OSDN Git Service

Fixed the default UI color
authorThorbjørn Lindeijer <thorbjorn.lindeijer@nokia.com>
Thu, 27 May 2010 14:07:52 +0000 (16:07 +0200)
committerThorbjørn Lindeijer <thorbjorn.lindeijer@nokia.com>
Thu, 27 May 2010 14:21:29 +0000 (16:21 +0200)
When there was no existing configuration, it would get set to pure black
on startup, resulting in a very dark gray Qt Creator. Now it is back to
its old friendly gray as default color.

Also made sure that the default on startup and the color used for
resetting the UI color in the settings are always in sync.

Reviewed-by: Jens Bache-Wiig
src/libs/utils/stylehelper.cpp
src/libs/utils/stylehelper.h
src/plugins/coreplugin/generalsettings.cpp
src/plugins/coreplugin/mainwindow.cpp

index 8f6499c..d6a5d54 100644 (file)
@@ -94,8 +94,9 @@ QColor StyleHelper::panelTextColor(bool lightColored)
         return Qt::black;
 }
 
-QColor StyleHelper::m_baseColor(0x666666);
-QColor StyleHelper::m_requestedBaseColor(0x666666);
+// Invalid by default, setBaseColor needs to be called at least once
+QColor StyleHelper::m_baseColor;
+QColor StyleHelper::m_requestedBaseColor;
 
 QColor StyleHelper::baseColor(bool lightColored)
 {
index 5533691..75435c4 100644 (file)
@@ -50,6 +50,8 @@ namespace Utils {
 class QTCREATOR_UTILS_EXPORT StyleHelper
 {
 public:
+    static const unsigned int DEFAULT_BASE_COLOR = 0x666666;
+
     // Height of the project explorer navigation bar
     static int navigationWidgetHeight() { return 24; }
     static qreal sidebarFontSize();
index a9953ba..12a719a 100644 (file)
@@ -237,7 +237,7 @@ void GeneralSettings::finish()
 
 void GeneralSettings::resetInterfaceColor()
 {
-    m_page->colorButton->setColor(0x666666);
+    m_page->colorButton->setColor(StyleHelper::DEFAULT_BASE_COLOR);
 }
 
 void GeneralSettings::resetExternalEditor()
index 2011050..ed1d48a 100644 (file)
@@ -1130,7 +1130,9 @@ void MainWindow::readSettings()
         // Get adapted base color.
         m_overrideColor = Utils::StyleHelper::baseColor();
     } else {
-        Utils::StyleHelper::setBaseColor(m_settings->value(QLatin1String(colorKey)).value<QColor>());
+        Utils::StyleHelper::setBaseColor(
+                m_settings->value(QLatin1String(colorKey),
+                                  QColor(Utils::StyleHelper::DEFAULT_BASE_COLOR)).value<QColor>());
     }
 
     const QVariant geom = m_settings->value(QLatin1String(geometryKey));