Enable per-chat history, line wrap by default
[quassel.git] / src / qtui / qtuiapplication.cpp
index 755a032..36bb1a4 100644 (file)
@@ -145,12 +145,29 @@ bool QtUiApplication::init()
             return false;
         }
 
             return false;
         }
 
+        // Checking if settings Icon Theme is valid
+        QString savedIcontheme = QtUiSettings().value("IconTheme", QVariant("")).toString();
+#ifndef WITH_OXYGEN
+        if (savedIcontheme == "oxygen")
+            QtUiSettings().remove("IconTheme");
+#endif
+#ifndef WITH_BREEZE
+        if (savedIcontheme == "breeze")
+            QtUiSettings().remove("IconTheme");
+#endif
+#ifndef WITH_BREEZE_DARK
+        if (savedIcontheme == "breezedark")
+            QtUiSettings().remove("IconTheme");
+#endif
+
         // Set the icon theme
         if (Quassel::isOptionSet("icontheme"))
             QIcon::setThemeName(Quassel::optionValue("icontheme"));
         // Set the icon theme
         if (Quassel::isOptionSet("icontheme"))
             QIcon::setThemeName(Quassel::optionValue("icontheme"));
+        else if (QtUiSettings().value("IconTheme", QVariant("")).toString() != "")
+            QIcon::setThemeName(QtUiSettings().value("IconTheme").toString());
         else if (QIcon::themeName().isEmpty())
         else if (QIcon::themeName().isEmpty())
-            // Some platforms don't set a default icon theme; chances are we can find our bundled Oxygen theme though
-            QIcon::setThemeName("oxygen");
+            // Some platforms don't set a default icon theme; chances are we can find our bundled theme though
+            QIcon::setThemeName("breeze");
 
         // session resume
         QtUi *gui = new QtUi();
 
         // session resume
         QtUi *gui = new QtUi();
@@ -193,7 +210,7 @@ bool QtUiApplication::migrateSettings()
     // --------
     // Check minor settings version, handling upgrades/downgrades as needed
     // Current minor version
     // --------
     // Check minor settings version, handling upgrades/downgrades as needed
     // Current minor version
-    const uint VERSION_MINOR_CURRENT = 2;
+    const uint VERSION_MINOR_CURRENT = 3;
     // Stored minor version
     uint versionMinor = s.versionMinor();
 
     // Stored minor version
     uint versionMinor = s.versionMinor();
 
@@ -252,10 +269,33 @@ bool QtUiApplication::applySettingsMigration(QtUiSettings settings, const uint n
     // oldest version.  Ignore those, start from 2 and higher.
     // Each missed version will be called in sequence.  E.g. to upgrade from '1' to '3', this
     // function will be called with '2', then '3'.
     // oldest version.  Ignore those, start from 2 and higher.
     // Each missed version will be called in sequence.  E.g. to upgrade from '1' to '3', this
     // function will be called with '2', then '3'.
-    case 2:
+    // Use explicit scope via { ... } to avoid cross-initialization
+    case 3:
     {
     {
-        // Use explicit scope via { ... } to avoid cross-initialization
+        // New default changes: per-chat history and line wrapping enabled by default.  Preserve
+        // the older default values for keys that haven't been saved.
+
+        // --------
+        // InputWidget settings
+        UiSettings settingsInputWidget("InputWidget");
+        const QString enableInputPerChatId = "EnablePerChatHistory";
+        if (!settingsInputWidget.valueExists(enableInputPerChatId)) {
+            // New default value is true, preserve previous behavior by setting to false
+            settingsInputWidget.setValue(enableInputPerChatId, false);
+        }
 
 
+        const QString enableInputLinewrap = "EnableLineWrap";
+        if (!settingsInputWidget.valueExists(enableInputLinewrap)) {
+            // New default value is true, preserve previous behavior by setting to false
+            settingsInputWidget.setValue(enableInputLinewrap, false);
+        }
+        // --------
+
+        // Migration complete!
+        return true;
+    }
+    case 2:
+    {
         // New default changes: sender <nick> brackets disabled, sender colors and sender CTCP
         // colors enabled.  Preserve the older default values for keys that haven't been saved.
 
         // New default changes: sender <nick> brackets disabled, sender colors and sender CTCP
         // colors enabled.  Preserve the older default values for keys that haven't been saved.