Don't reset FontSelector font on style change
[quassel.git] / src / uisupport / uistyle.cpp
index 332344c..35d3162 100644 (file)
@@ -51,6 +51,7 @@ UiStyle::UiStyle(QObject *parent) : QObject(parent) {
   _formatCodes["%DU"] = Url;
 
   setTimestampFormatString("[hh:mm:ss]");
+
   loadStyleSheet();
 }
 
@@ -58,6 +59,10 @@ UiStyle::~UiStyle() {
   qDeleteAll(_metricsCache);
 }
 
+void UiStyle::reload() {
+  loadStyleSheet();
+}
+
 void UiStyle::loadStyleSheet() {
   qDeleteAll(_metricsCache);
   _metricsCache.clear();
@@ -72,15 +77,14 @@ void UiStyle::loadStyleSheet() {
     styleSheet += loadStyleSheet("file:///" + s.value("CustomStyleSheetPath").toString(), true);
   styleSheet += loadStyleSheet("file:///" + Quassel::optionValue("qss"), true);
 
-  if(styleSheet.isEmpty())
-    return;
-
-  QssParser parser;
-  parser.processStyleSheet(styleSheet);
-  QApplication::setPalette(parser.palette());
-  _formatCache = parser.formats();
+  if(!styleSheet.isEmpty()) {
+    QssParser parser;
+    parser.processStyleSheet(styleSheet);
+    QApplication::setPalette(parser.palette());
+    _formatCache = parser.formats();
 
-  qApp->setStyleSheet(styleSheet); // pass the remaining sections to the application
+    qApp->setStyleSheet(styleSheet); // pass the remaining sections to the application
+  }
 
   emit changed();
 }
@@ -230,7 +234,8 @@ UiStyle::FormatType UiStyle::formatType(Message::Type msgType) {
     case Message::DayChange:
       return DayChangeMsg;
   }
-  Q_ASSERT(false); // we need to handle all message types
+  //Q_ASSERT(false); // we need to handle all message types
+  qWarning() << Q_FUNC_INFO << "Unknown message type:" << msgType;
   return ErrorMsg;
 }