Author: mir3x
Date: Mon Dec 28 09:51:29 2015
New Revision: 31228

URL: http://svn.gna.org/viewcvs/freeciv?rev=31228&view=rev
Log:
Display player colors in pregame in Qt client.

See patch #6725


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

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=31228&r1=31227&r2=31228&view=diff
==============================================================================
--- branches/S2_6/client/gui-qt/pages.cpp       (original)
+++ branches/S2_6/client/gui-qt/pages.cpp       Mon Dec 28 09:51:29 2015
@@ -34,6 +34,7 @@
 #include "connectdlg_common.h"
 
 // gui-qt
+#include "colors.h"
 #include "dialogs.h"
 #include "pages.h"
 #include "sprite.h"
@@ -544,8 +545,8 @@
   chat_line->installEventFilter(this);
 
   pr_options->init();
-  player_widget_list << _("Name") << _("Ready") << _("Leader")
-                     << _("Flag") << _("Nation") << _("Team");
+  player_widget_list << _("Name") << _("Ready") << Q_("?player:Leader")
+                     << _("Flag") << _("Border") << _("Nation") << _("Team");
 
 
   start_players_tree->setColumnCount(player_widget_list.count());
@@ -1255,6 +1256,7 @@
   bool is_ready;
   QString nation, leader, team, str;
   QPixmap *pixmap;
+  QPainter p;
   struct sprite *psprite;
   QTreeWidgetItem *item;
   QTreeWidgetItem *item_r;
@@ -1325,7 +1327,8 @@
       team = "";
     }
 
-    for (int col = 0; col < 6; col++) {
+    for (int col = 0; col < 7; col++) {
+      item->setTextAlignment(col, Qt::AlignVCenter);
       switch (col) {
       case 0:
         str = pplayer->username;
@@ -1360,9 +1363,24 @@
         item->setData(col, Qt::DecorationRole, *pixmap);
         break;
       case 4:
+        if (!player_has_color(tileset, pplayer)) {
+          break;
+        }
+        pixmap = new QPixmap(
+                     start_players_tree->header()->sectionSizeHint(col), 16);
+        pixmap->fill(Qt::transparent);
+        p.begin(pixmap);
+        p.fillRect(pixmap->width() / 2 - 8, 0, 16, 16, Qt::black);
+        p.fillRect(pixmap->width() / 2 - 7, 1, 14, 14,
+                   get_player_color(tileset, pplayer)->qcolor);
+        p.end();
+        item->setData(col, Qt::DecorationRole, *pixmap);
+        delete pixmap;
+        break;
+      case 5:
         item->setText(col, nation);
         break;
-      case 5:
+      case 6:
         item->setText(col, team);
         break;
       }


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

Reply via email to