Author: mir3x
Date: Mon Jul 11 07:00:34 2016
New Revision: 33209

URL: http://svn.gna.org/viewcvs/freeciv?rev=33209&view=rev
Log:
Removed tabs in network page, both local and internet servers 
are on single screen now. 

See patch #7392


Modified:
    branches/S2_6/client/gui-qt/fc_client.cpp
    branches/S2_6/client/gui-qt/fc_client.h
    branches/S2_6/client/gui-qt/pages.cpp

Modified: branches/S2_6/client/gui-qt/fc_client.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-qt/fc_client.cpp?rev=33209&r1=33208&r2=33209&view=diff
==============================================================================
--- branches/S2_6/client/gui-qt/fc_client.cpp   (original)
+++ branches/S2_6/client/gui-qt/fc_client.cpp   Mon Jul 11 07:00:34 2016
@@ -68,7 +68,6 @@
   button_box = NULL;
   server_notifier = NULL;
   chat_line = NULL;
-  connect_tab_widget = NULL;
   lan_widget = NULL;
   wan_widget = NULL;
   info_widget = NULL;
@@ -152,8 +151,6 @@
   // PAGE_NETWORK
   pages[PAGE_NETWORK] = new QWidget(central_wdg);
   create_network_page();
-  meta_scan_timer = new QTimer;
-  lan_scan_timer = new QTimer;
   pages[PAGE_NETWORK]->setVisible(false);
 
   // PAGE_GAME

Modified: branches/S2_6/client/gui-qt/fc_client.h
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-qt/fc_client.h?rev=33209&r1=33208&r2=33209&view=diff
==============================================================================
--- branches/S2_6/client/gui-qt/fc_client.h     (original)
+++ branches/S2_6/client/gui-qt/fc_client.h     Mon Jul 11 07:00:34 2016
@@ -179,8 +179,6 @@
   QSocketNotifier *server_notifier;
 
   QLineEdit *chat_line;
-
-  QTabWidget *connect_tab_widget;
 
   QTableWidget* lan_widget;
   QTableWidget* wan_widget;
@@ -280,7 +278,6 @@
   void browse_saves();
   void browse_scenarios();
   void clear_status_bar();
-  void network_tab_changed(int index);
 
 public slots:
   void switch_page(int i);

Modified: branches/S2_6/client/gui-qt/pages.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-qt/pages.cpp?rev=33209&r1=33208&r2=33209&view=diff
==============================================================================
--- branches/S2_6/client/gui-qt/pages.cpp       (original)
+++ branches/S2_6/client/gui-qt/pages.cpp       Mon Jul 11 07:00:34 2016
@@ -250,6 +250,7 @@
 {
   QHeaderView *header;
   QLabel *connect_msg;
+  QLabel *lan_label;
   QPushButton *network_button;
 
   pages_layout[PAGE_NETWORK] = new QGridLayout;
@@ -269,7 +270,6 @@
 
   connect_password_edit->setDisabled(true);
   connect_confirm_password_edit->setDisabled(true);
-  connect_tab_widget = new QTabWidget;
   connect_lan = new QWidget;
   connect_metaserver = new QWidget;
   lan_widget = new QTableWidget;
@@ -300,11 +300,13 @@
   lan_widget->setProperty("showGrid", "false");
   lan_widget->setProperty("selectionBehavior", "SelectRows");
   lan_widget->setEditTriggers(QAbstractItemView::NoEditTriggers);
+  lan_widget->setSelectionMode(QAbstractItemView::SingleSelection);
 
   wan_widget->setHorizontalHeaderLabels(servers_list);
   wan_widget->setProperty("showGrid", "false");
   wan_widget->setProperty("selectionBehavior", "SelectRows");
   wan_widget->setEditTriggers(QAbstractItemView::NoEditTriggers);
+  wan_widget->setSelectionMode(QAbstractItemView::SingleSelection);
 
   connect(wan_widget->selectionModel(),
           SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection 
&)), this,
@@ -369,13 +371,14 @@
 
   connect_lan->setLayout(page_network_lan_layout);
   connect_metaserver->setLayout(page_network_wan_layout);
-  page_network_lan_layout->addWidget(lan_widget, 1);
+  page_network_lan_layout->addWidget(lan_widget, 0);
   page_network_wan_layout->addWidget(wan_widget, 1);
-  page_network_layout->addWidget(connect_tab_widget, 1);
-  connect_tab_widget->addTab(connect_lan, _("LAN"));
-  connect_tab_widget->addTab(connect_metaserver, _("NETWORK"));
-  connect(connect_tab_widget, SIGNAL(currentChanged(int)),
-         this, SLOT(network_tab_changed(int)));
+  lan_label = new QLabel(_("Internet servers:"));
+  page_network_layout->addWidget(lan_label, 1);
+  page_network_layout->addWidget(wan_widget, 10);
+  lan_label = new QLabel(_("Local servers:"));
+  page_network_layout->addWidget(lan_label, 1);
+  page_network_layout->addWidget(lan_widget, 1);
   page_network_grid_layout->setColumnStretch(3, 4);
   pages_layout[PAGE_NETWORK]->addLayout(page_network_layout, 1, 1);
   pages_layout[PAGE_NETWORK]->addLayout(page_network_grid_layout, 2, 1);
@@ -829,24 +832,6 @@
   }
 }
 
-/***************************************************************************
-  Tab in network page has been changed.
-  Force current selection change to emit signal.
-***************************************************************************/
-void fc_client::network_tab_changed(int index)
-{
-  QWidget *w;
-  QHBoxLayout *l;
-  QTableWidget *tw;
-  int i;
-
-  w = connect_tab_widget->currentWidget();
-  l = qobject_cast<QHBoxLayout *>(w->layout());
-  tw = qobject_cast<QTableWidget *>(l->itemAt(0)->widget());
-  i = tw->currentRow();
-  tw->clearSelection();
-  tw->selectRow(i);
-}
 
 /**************************************************************************
   Free the server scans.
@@ -998,9 +983,7 @@
   QStringList sl;
   QModelIndex index;
   QTableWidgetItem *item;
-  QWidget *w;
-  QHBoxLayout *l;
-  QTableWidget *tw;
+  QItemSelectionModel *tw;
   QVariant qvar;
   int k, col, n;
   client_pages i = current_page();
@@ -1018,13 +1001,14 @@
     index = indexes.at(1);
     connect_port_edit->setText(index.data().toString());
 
-    w = connect_tab_widget->currentWidget();
-    l = qobject_cast<QHBoxLayout *>(w->layout());
-    tw = qobject_cast<QTableWidget *>(l->itemAt(0)->widget());
-
-    if (tw == lan_widget) {
-      return;
-    }
+    tw = qobject_cast<QItemSelectionModel *>(sender());
+
+    if (tw == lan_widget->selectionModel()) {
+      wan_widget->clearSelection();
+    } else {
+      lan_widget->clearSelection();
+    }
+
     srvrs = server_scan_get_list(meta_scan);
     if (!holding_srv_list_mutex) {
       fc_allocate_mutex(&srvrs->mutex);


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to