[PATCH] kmessagewidget: add a custom color scheme Information_Subsurface

Lubomir I. Ivanov neolit123 at gmail.com
Mon Oct 5 07:48:44 PDT 2015


From: "Lubomir I. Ivanov" <neolit123 at gmail.com>

Information_Subsurface is now the default color scheme based
on the Subsurface logo colors in KMessageWidget.

Taking colors from the OS is a good practice and makes the app
look consistent with how the user has customized the OS,
but it becomes difficult to control the application colors when
the user has selected a weird color scheme as is using
a more complicated compositor (e.g. Aero with transparent title
bars).

Signed-off-by: Lubomir I. Ivanov <neolit123 at gmail.com>
---

Fixes John Smith's complain that the location edit dialog had
difficult to read text under Windows 7.

Please, apply only if see fit. For me the white text on light blue
background looked OK on Windows 7.
---
 qt-ui/kmessagewidget.cpp | 13 ++++++++++---
 qt-ui/kmessagewidget.h   |  1 +
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/qt-ui/kmessagewidget.cpp b/qt-ui/kmessagewidget.cpp
index 2e506af..6b98ffe 100644
--- a/qt-ui/kmessagewidget.cpp
+++ b/qt-ui/kmessagewidget.cpp
@@ -97,7 +97,7 @@ void KMessageWidgetPrivate::init(KMessageWidget *q_ptr)
     closeButton->setAutoRaise(true);
     closeButton->setDefaultAction(closeAction);
 
-    q->setMessageType(KMessageWidget::Information);
+    q->setMessageType(KMessageWidget::Information_Subsurface);
 }
 
 void KMessageWidgetPrivate::createLayout()
@@ -269,6 +269,10 @@ void KMessageWidget::setMessageType(KMessageWidget::MessageType type)
 {
     d->messageType = type;
     QColor bg0, bg1, bg2, border, fg;
+
+    // foreground color
+    fg = palette().highlightedText().color();
+
     switch (type) {
     case Positive:
         bg1.setRgb(0, 110,  40); // values taken from kcolorscheme.cpp (Positive)
@@ -276,6 +280,10 @@ void KMessageWidget::setMessageType(KMessageWidget::MessageType type)
     case Information:
         bg1 = palette().highlight().color();
         break;
+    case Information_Subsurface:
+        fg.setRgb(238, 238, 238);
+        bg1.setRgb(32, 74, 135);
+        break;
     case Warning:
         bg1.setRgb(176, 128, 0); // values taken from kcolorscheme.cpp (Neutral)
         break;
@@ -284,8 +292,7 @@ void KMessageWidget::setMessageType(KMessageWidget::MessageType type)
         break;
     }
 
-    // Colors
-    fg = palette().highlightedText().color();
+    // background and border colors
     bg0 = bg1.lighter(110);
     bg2 = bg1.darker(110);
     border = darkShade(bg1);
diff --git a/qt-ui/kmessagewidget.h b/qt-ui/kmessagewidget.h
index 885d2a7..4d5eda7 100644
--- a/qt-ui/kmessagewidget.h
+++ b/qt-ui/kmessagewidget.h
@@ -112,6 +112,7 @@ public:
     enum MessageType {
         Positive,
         Information,
+        Information_Subsurface,
         Warning,
         Error
     };
-- 
1.7.11.msysgit.0



More information about the subsurface mailing list