Author: mir3x
Date: Thu Sep 22 19:22:31 2016
New Revision: 33851

URL: http://svn.gna.org/viewcvs/freeciv?rev=33851&view=rev
Log:
Qt client - fixed misleading pregame player display immediately after loading 
savegame.
Added "loading" page.

Reported by Jacob Nevins <jtn>

See bug #25072

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

Modified: trunk/client/gui-qt/fc_client.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/fc_client.cpp?rev=33851&r1=33850&r2=33851&view=diff
==============================================================================
--- trunk/client/gui-qt/fc_client.cpp   (original)
+++ trunk/client/gui-qt/fc_client.cpp   Thu Sep 22 19:22:31 2016
@@ -166,6 +166,9 @@
   pages[PAGE_GAME] = new QWidget(central_wdg);
   init_mapcanvas_and_overview();
   create_game_page();
+  
+  pages[PAGE_GAME + 1] = new QWidget(central_wdg);
+  create_loading_page();
 
   pages_layout[PAGE_GAME]->setContentsMargins(0, 0, 0, 0);
 
@@ -175,6 +178,7 @@
   pages[PAGE_SCENARIO]->setLayout(pages_layout[PAGE_SCENARIO]);
   pages[PAGE_START]->setLayout(pages_layout[PAGE_START]);
   pages[PAGE_GAME]->setLayout(pages_layout[PAGE_GAME]);
+  pages[PAGE_GAME + 1]->setLayout(pages_layout[PAGE_GAME + 1]);
 
   central_layout->addWidget(pages[PAGE_MAIN]);
   central_layout->addWidget(pages[PAGE_NETWORK]);
@@ -182,6 +186,7 @@
   central_layout->addWidget(pages[PAGE_SCENARIO]);
   central_layout->addWidget(pages[PAGE_START]);
   central_layout->addWidget(pages[PAGE_GAME]);
+  central_layout->addWidget(pages[PAGE_GAME + 1]);
 
   central_wdg->setLayout(central_layout);
   setCentralWidget(central_wdg);
@@ -297,6 +302,7 @@
 {
   char buf[256];
   enum client_pages new_page;
+  int i_page;
 
   new_page = static_cast<client_pages>(new_pg);
 
@@ -317,7 +323,8 @@
 
   central_layout->setCurrentWidget(pages[new_pg]);
   page = new_page;
-  switch (page) {
+  i_page = new_page;
+  switch (i_page) {
   case PAGE_MAIN:
     break;
   case PAGE_START:
@@ -361,6 +368,8 @@
     connect_password_edit->setDisabled(true);
     connect_confirm_password_edit->setDisabled(true);
     break;
+  case (PAGE_GAME + 1):
+    break;
   default:
     if (client.conn.used) {
       disconnect_from_server();

Modified: trunk/client/gui-qt/fc_client.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/fc_client.h?rev=33851&r1=33850&r2=33851&view=diff
==============================================================================
--- trunk/client/gui-qt/fc_client.h     (original)
+++ trunk/client/gui-qt/fc_client.h     Thu Sep 22 19:22:31 2016
@@ -152,12 +152,12 @@
 {
   Q_OBJECT
   QWidget *main_wdg;
-  QWidget *pages[ (int) PAGE_GAME + 1];
+  QWidget *pages[ (int) PAGE_GAME + 2];
   QWidget *connect_lan;
   QWidget *connect_metaserver;
   QWidget *game_main_widget;
 
-  QGridLayout *pages_layout[PAGE_GAME + 1];
+  QGridLayout *pages_layout[PAGE_GAME + 2];
   QStackedLayout *central_layout;
   QGridLayout *game_layout;
 
@@ -306,6 +306,7 @@
   void create_scenario_page();
   void create_start_page();
   void create_game_page();
+  void create_loading_page();
   bool chat_active_on_page(enum client_pages);
   void destroy_server_scans (void);
   void update_server_list(enum server_scan_type sstype,

Modified: trunk/client/gui-qt/pages.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/pages.cpp?rev=33851&r1=33850&r2=33851&view=diff
==============================================================================
--- trunk/client/gui-qt/pages.cpp       (original)
+++ trunk/client/gui-qt/pages.cpp       Thu Sep 22 19:22:31 2016
@@ -439,6 +439,18 @@
     status_bar_label->setText("");
   }
 }
+
+/***************************************************************************
+  Creates page LOADING, showing label with Loading text
+***************************************************************************/
+void fc_client::create_loading_page()
+{
+  pages_layout[PAGE_GAME + 1] = new QGridLayout;
+  QLabel *label = new QLabel(_("Loading ..."));
+  pages_layout[PAGE_GAME + 1]->addWidget(label, 0, 0, 1, 1,
+                                         Qt::AlignHCenter);
+}
+
 /***************************************************************************
   Creates buttons and layouts for load page.
 ***************************************************************************/
@@ -1037,7 +1049,7 @@
     send_chat("/detach");
   }
   send_chat_printf("/load %s", current_file.toLocal8Bit().data());
-  switch_page(PAGE_START);
+  switch_page(PAGE_GAME + 1);
 }
 
 /**************************************************************************
@@ -1050,7 +1062,7 @@
     send_chat("/detach");
   }
   send_chat_printf("/load %s", current_file.toLocal8Bit().data());
-  switch_page(PAGE_START);
+  switch_page(PAGE_GAME + 1);
 }
 
 /***************************************************************************
@@ -1080,6 +1092,7 @@
     return;
   }
   k = 0;
+
   switch (i) {
   case PAGE_NETWORK:
     index = indexes.at(0);


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

Reply via email to