Author: mir3x
Date: Wed Dec  2 13:18:11 2015
New Revision: 30840

URL: http://svn.gna.org/viewcvs/freeciv?rev=30840&view=rev
Log:
In game chat, all chat messages are made ligher (brighter) and 
background a bit darker.

See patch #6640


Modified:
    branches/S2_6/client/gui-qt/chatline.cpp
    branches/S2_6/client/gui-qt/chatline.h
    branches/S2_6/client/gui-qt/messagewin.cpp

Modified: branches/S2_6/client/gui-qt/chatline.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-qt/chatline.cpp?rev=30840&r1=30839&r2=30840&view=diff
==============================================================================
--- branches/S2_6/client/gui-qt/chatline.cpp    (original)
+++ branches/S2_6/client/gui-qt/chatline.cpp    Wed Dec  2 13:18:11 2015
@@ -199,7 +199,7 @@
 ***************************************************************************/
 void chatwdg::paint(QPainter *painter, QPaintEvent *event)
 {
-  painter->setBrush(QColor(0, 0, 0, 65));
+  painter->setBrush(QColor(0, 0, 0, 35));
   painter->drawRect(0, 0, width(), height());
 }
 
@@ -274,7 +274,8 @@
 /***************************************************************************
   Applies tags to text
 ***************************************************************************/
-QString apply_tags(QString str, const struct text_tag_list *tags)
+QString apply_tags(QString str, const struct text_tag_list *tags,
+                   bool colors_change)
 {
   QByteArray qba;
   int start, stop;
@@ -320,12 +321,18 @@
     case TTT_COLOR:
       if (text_tag_color_foreground(ptag)) {
         color = text_tag_color_foreground(ptag);
-        if (color == "#00008B" && gui()->current_page() == PAGE_GAME) {
-          color = "#E8FF00";
+        if (colors_change) {
+          if (color == "#00008B") {
+            color = "#E8FF00";
+          } else {
+            qc.setNamedColor(color);
+            qc = qc.lighter(200);
+            color = qc.name();
+          }
         }
-        str_col = QString("<span style=color:%1>").arg(color);
-        mm.insert(stop, "</span>");
-        mm.insert(start, str_col);
+          str_col = QString("<span style=color:%1>").arg(color);
+          mm.insert(stop, "</span>");
+          mm.insert(start, str_col);
       }
       if (text_tag_color_background(ptag)) {
         color = text_tag_color_background(ptag);
@@ -364,8 +371,7 @@
       mm.insert(start, color);
     }
     }
-  }
-  text_tag_list_iterate_end;
+  } text_tag_list_iterate_end;
 
   /* insert html starting from last items */
   QMultiMap<int, QString>::const_iterator i = mm.constEnd();
@@ -469,11 +475,10 @@
   gui()->update_completer();
 
   str = replace_html(str);
-  str  = apply_tags(str, tags);
-
-  gui()->append_output_window(str);
+
+  gui()->append_output_window(apply_tags(str, tags, false));
   if (gui()->infotab != NULL) {
-    gui()->infotab->chtwdg->append(str);
+    gui()->infotab->chtwdg->append(apply_tags(str, tags, true));
   }
 }
 

Modified: branches/S2_6/client/gui-qt/chatline.h
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-qt/chatline.h?rev=30840&r1=30839&r2=30840&view=diff
==============================================================================
--- branches/S2_6/client/gui-qt/chatline.h      (original)
+++ branches/S2_6/client/gui-qt/chatline.h      Wed Dec  2 13:18:11 2015
@@ -29,7 +29,8 @@
 
 class QPushButton;
 
-QString apply_tags(QString str, const struct text_tag_list *tags);
+QString apply_tags(QString str, const struct text_tag_list *tags,
+                   bool colors_change);
 /***************************************************************************
   Class for chat widget
 ***************************************************************************/

Modified: branches/S2_6/client/gui-qt/messagewin.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-qt/messagewin.cpp?rev=30840&r1=30839&r2=30840&view=diff
==============================================================================
--- branches/S2_6/client/gui-qt/messagewin.cpp  (original)
+++ branches/S2_6/client/gui-qt/messagewin.cpp  Wed Dec  2 13:18:11 2015
@@ -81,7 +81,7 @@
 ***************************************************************************/
 void info_tab::paint(QPainter *painter, QPaintEvent *event)
 {
-  painter->setBrush(QColor(0, 0, 0, 135));
+  painter->setBrush(QColor(0, 0, 0, 175));
   painter->drawRect(0, 0, width(), height());
 }
 


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

Reply via email to