Author: mir3x
Date: Sat Oct 15 00:52:46 2016
New Revision: 34138

URL: http://svn.gna.org/viewcvs/freeciv?rev=34138&view=rev
Log:
Qt client - control unit selection dialog colors from theme

See patch #7829


Modified:
    branches/S2_6/client/gui-qt/dialogs.cpp
    branches/S2_6/client/gui-qt/dialogs.h
    branches/S2_6/client/gui-qt/fc_client.cpp
    branches/S2_6/client/gui-qt/fc_client.h
    branches/S2_6/data/themes/gui-qt/Classic/resource.qss
    branches/S2_6/data/themes/gui-qt/Necrophos/resource.qss
    branches/S2_6/data/themes/gui-qt/NightStalker/resource.qss
    branches/S2_6/data/themes/gui-qt/System/resource.qss

Modified: branches/S2_6/client/gui-qt/dialogs.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-qt/dialogs.cpp?rev=34138&r1=34137&r2=34138&view=diff
==============================================================================
--- branches/S2_6/client/gui-qt/dialogs.cpp     (original)
+++ branches/S2_6/client/gui-qt/dialogs.cpp     Sat Oct 15 00:52:46 2016
@@ -2402,9 +2402,9 @@
 }
 
 /****************************************************************
-  Contructor for unit_select
+  Contructor for units_select
 *****************************************************************/
-unit_select::unit_select(tile *ptile, QWidget *parent)
+units_select::units_select(tile *ptile, QWidget *parent)
 {
   QPoint p, final_p;
 
@@ -2436,7 +2436,7 @@
 /****************************************************************
   Destructor for unit select
 *****************************************************************/
-unit_select::~unit_select()
+units_select::~units_select()
 {
     delete h_pix;
     delete pix;
@@ -2446,7 +2446,7 @@
 /****************************************************************
   Create pixmap of whole widget except borders (pix)
 *****************************************************************/
-void unit_select::create_pixmap()
+void units_select::create_pixmap()
 {
   struct unit *punit;
   QPixmap *tmp_pix;
@@ -2471,10 +2471,11 @@
   item_size.setWidth(tileset_full_tile_width(tileset));
   item_size.setHeight(tileset_tile_height(tileset) * 3 / 2);
   more = false;
-  if (h_pix == NULL) {
-    h_pix = new QPixmap(item_size.width(), item_size.height());
-    h_pix->fill(QColor(100, 100, 100, 140));
-  }
+  if (h_pix != nullptr) {
+    delete h_pix;
+  }
+  h_pix = new QPixmap(item_size.width(), item_size.height());
+  h_pix->fill(palette().color(QPalette::HighlightedText));
   if (unit_list.size() < 5) {
     row_count = 1;
     pix = new QPixmap((unit_list.size()) * item_size.width(),
@@ -2502,7 +2503,7 @@
   p.begin(pix);
   ufont.setPixelSize(a);
   p.setFont(ufont);
-  pen.setColor(QColor(232, 255, 0));
+  pen.setColor(palette().color(QPalette::Text));
   p.setPen(pen);
 
   while (!pix_list.isEmpty()) {
@@ -2542,9 +2543,9 @@
 }
 
 /****************************************************************
-  Event for mouse moving around unit_select
+  Event for mouse moving around units_select
 *****************************************************************/
-void unit_select::mouseMoveEvent(QMouseEvent *event)
+void units_select::mouseMoveEvent(QMouseEvent *event)
 {
   int a, b;
   int old_h;
@@ -2568,11 +2569,11 @@
 }
 
 /****************************************************************
-  Mouse pressed event for unit_select.
+  Mouse pressed event for units_select.
   Left Button - chooses units
   Right Button - closes widget
 *****************************************************************/
-void unit_select::mousePressEvent(QMouseEvent *event)
+void units_select::mousePressEvent(QMouseEvent *event)
 {
   struct unit *punit;
   if (event->button() == Qt::RightButton) {
@@ -2596,7 +2597,7 @@
 /****************************************************************
   Redirected paint event
 *****************************************************************/
-void unit_select::paint(QPainter *painter, QPaintEvent *event)
+void units_select::paint(QPainter *painter, QPaintEvent *event)
 {
   QFontMetrics fm(info_font);
   int h, i;
@@ -2634,11 +2635,9 @@
     }
   }
   h = fm.height();
-  painter->setBrush(QColor(0, 0, 0, 135));
-  painter->drawRect(0, 0, width(), height());
   if (pix != NULL) {
     painter->drawPixmap(10, h + 3, *pix);
-    pen.setColor(QColor(232, 255, 0));
+    pen.setColor(palette().color(QPalette::Text));
     painter->setPen(pen);
     painter->setFont(info_font);
     painter->drawText(10, h, str);
@@ -2656,7 +2655,7 @@
 /****************************************************************
   Paint event, redirects to paint(...)
 *****************************************************************/
-void unit_select::paintEvent(QPaintEvent *event)
+void units_select::paintEvent(QPaintEvent *event)
 {
   QPainter painter;
 
@@ -2669,7 +2668,7 @@
   Function from abstract fcwidget to update menu, its not needed
   cause widget is easy closable via right mouse click
 *****************************************************************/
-void unit_select::update_menu()
+void units_select::update_menu()
 {
   was_destroyed = true;
   close();
@@ -2679,7 +2678,7 @@
 /****************************************************************
   Updates unit list on tile
 *****************************************************************/
-void unit_select::update_units()
+void units_select::update_units()
 {
   int i = 1;
   struct unit_list *punit_list;
@@ -2707,18 +2706,18 @@
 }
 
 /****************************************************************
-  Close event for unit_select, restores focus to map
+  Close event for units_select, restores focus to map
 *****************************************************************/
-void unit_select::closeEvent(QCloseEvent* event)
+void units_select::closeEvent(QCloseEvent* event)
 {
   gui()->mapview_wdg->setFocus();
   QWidget::closeEvent(event);
 }
 
 /****************************************************************
-  Mouse wheel event for unit_select
+  Mouse wheel event for units_select
 *****************************************************************/
-void unit_select::wheelEvent(QWheelEvent *event)
+void units_select::wheelEvent(QWheelEvent *event)
 {
   int nr;
 
@@ -2740,9 +2739,9 @@
 }
 
 /****************************************************************
-  Keyboard handler for unit_select
+  Keyboard handler for units_select
 *****************************************************************/
-void unit_select::keyPressEvent(QKeyEvent *event)
+void units_select::keyPressEvent(QKeyEvent *event)
 {
   if (event->key() == Qt::Key_Escape) {
     was_destroyed = true;
@@ -2755,7 +2754,7 @@
 /***************************************************************************
   Change the fonts when needed
 ***************************************************************************/
-void unit_select::update_font(const QString& name, const QFont& font)
+void units_select::update_font(const QString& name, const QFont& font)
 {
   // FIXME Updating fonts isn't practical because the size of the widget
   // will change -> its position too.

Modified: branches/S2_6/client/gui-qt/dialogs.h
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-qt/dialogs.h?rev=34138&r1=34137&r2=34138&view=diff
==============================================================================
--- branches/S2_6/client/gui-qt/dialogs.h       (original)
+++ branches/S2_6/client/gui-qt/dialogs.h       Sat Oct 15 00:52:46 2016
@@ -161,7 +161,7 @@
  TODO Add some simple scrollbars (just paint it during paint event,
  if 'more' is true->scroll visible and would depend on show_line
 ***************************************************************************/
-class unit_select: public fcwidget
+class units_select: public fcwidget
 {
   Q_OBJECT
   QPixmap *pix;
@@ -174,8 +174,8 @@
   int row_count;
   close_widget *cw;
 public:
-  unit_select(struct tile *ptile, QWidget *parent);
-  ~unit_select();
+  units_select(struct tile *ptile, QWidget *parent);
+  ~units_select();
   void update_menu();
   void update_units();
   void create_pixmap();

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=34138&r1=34137&r2=34138&view=diff
==============================================================================
--- branches/S2_6/client/gui-qt/fc_client.cpp   (original)
+++ branches/S2_6/client/gui-qt/fc_client.cpp   Sat Oct 15 00:52:46 2016
@@ -630,10 +630,10 @@
   if (unit_sel != NULL) {
     unit_sel->close();
     delete unit_sel;
-    unit_sel = new unit_select(ptile, gui()->mapview_wdg);
+    unit_sel = new units_select(ptile, gui()->mapview_wdg);
     unit_sel->show();
   } else {
-    unit_sel = new unit_select(ptile, gui()->mapview_wdg);
+    unit_sel = new units_select(ptile, gui()->mapview_wdg);
     unit_sel->show();
   }
 }

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=34138&r1=34137&r2=34138&view=diff
==============================================================================
--- branches/S2_6/client/gui-qt/fc_client.h     (original)
+++ branches/S2_6/client/gui-qt/fc_client.h     Sat Oct 15 00:52:46 2016
@@ -246,7 +246,7 @@
   messagewdg *msgwdg;
   info_tab *infotab;
   pregamevote *pre_vote;
-  unit_select *unit_sel;
+  units_select *unit_sel;
   xvote *x_vote;
   goto_dialog *gtd;
   QCursor *fc_cursors[CURSOR_LAST][NUM_CURSOR_FRAMES];

Modified: branches/S2_6/data/themes/gui-qt/Classic/resource.qss
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/data/themes/gui-qt/Classic/resource.qss?rev=34138&r1=34137&r2=34138&view=diff
==============================================================================
--- branches/S2_6/data/themes/gui-qt/Classic/resource.qss       (original)
+++ branches/S2_6/data/themes/gui-qt/Classic/resource.qss       Sat Oct 15 
00:52:46 2016
@@ -549,6 +549,13 @@
   color: black;
 }
 
+units_select {
+  background-color: rgba(0, 0, 0,175);
+  color: #e8ff00;
+  selection-color: rgba(221, 204, 161, 140);
+  border: 1px solid black;
+}
+
 chatwdg QTextBrowser
 {
   background-color: transparent;

Modified: branches/S2_6/data/themes/gui-qt/Necrophos/resource.qss
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/data/themes/gui-qt/Necrophos/resource.qss?rev=34138&r1=34137&r2=34138&view=diff
==============================================================================
--- branches/S2_6/data/themes/gui-qt/Necrophos/resource.qss     (original)
+++ branches/S2_6/data/themes/gui-qt/Necrophos/resource.qss     Sat Oct 15 
00:52:46 2016
@@ -448,6 +448,13 @@
   background-image:url(LittleFingersun.jpg);
 }
 
+units_select {
+  background-color: rgba(0, 0, 0,175);
+  color: #dcffcf;
+  selection-color: rgba(0, 100, 0, 140);
+  border: 1px solid black;
+}
+
 science_report QScrollArea QWidget {
   background-image:url(LittleFingersun.jpg);
 }

Modified: branches/S2_6/data/themes/gui-qt/NightStalker/resource.qss
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/data/themes/gui-qt/NightStalker/resource.qss?rev=34138&r1=34137&r2=34138&view=diff
==============================================================================
--- branches/S2_6/data/themes/gui-qt/NightStalker/resource.qss  (original)
+++ branches/S2_6/data/themes/gui-qt/NightStalker/resource.qss  Sat Oct 15 
00:52:46 2016
@@ -572,6 +572,13 @@
   color: white;
 }
 
+units_select {
+  background-color: rgba(0, 0, 0, 135);
+  color: white;
+  selection-color: rgba(25, 25, 95, 135);
+  border: 2px solid #0000AA;
+}
+
 chatwdg QTextBrowser
 {
   background-color: transparent;

Modified: branches/S2_6/data/themes/gui-qt/System/resource.qss
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/data/themes/gui-qt/System/resource.qss?rev=34138&r1=34137&r2=34138&view=diff
==============================================================================
--- branches/S2_6/data/themes/gui-qt/System/resource.qss        (original)
+++ branches/S2_6/data/themes/gui-qt/System/resource.qss        Sat Oct 15 
00:52:46 2016
@@ -42,6 +42,13 @@
   background-color: transparent;
 }
 
+units_select {
+  background-color: rgba(0, 0, 0, 135);
+  color: #e8ff00;
+  selection-color: rgba(100, 100, 100, 140);
+  border: 1px solid black;
+}
+
 messagewdg QTableWidget::item:hover {
   color: #3399FF;
   background-color: rgba(55, 55, 54, 225);


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

Reply via email to