From 72f6b1a6939cd9a220a5262f34b4b3d7224da59d Mon Sep 17 00:00:00 2001
From: Thunderforge <wjherrmann@gmail.com>
Date: Thu, 28 Jun 2018 20:13:18 -0500
Subject: [PATCH] Separating "Game" Advanced Settings into "Game Mechanics" and
 "User Interface"

---
 CHANGELOG.md                   |   1 +
 apps/launcher/advancedpage.cpp |  37 +++---
 files/ui/advancedpage.ui       | 209 +++++++++++++++++----------------
 3 files changed, 129 insertions(+), 118 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index c1181b615..89fe8eac4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -50,6 +50,7 @@
     Bug #4469: Abot Silt Striders – Model turn 90 degrees on horizontal
     Bug #4474: No fallback when getVampireHead fails
     Bug #4475: Scripted animations should not cause movement
+    Bug #4479: "Game" category on Advanced page is getting too long
     Feature #3276: Editor: Search- Show number of (remaining) search results and indicate a search without any results
     Feature #4222: 360° screenshots
     Feature #4256: Implement ToggleBorders (TB) console command
diff --git a/apps/launcher/advancedpage.cpp b/apps/launcher/advancedpage.cpp
index 2b2d7b448..b0a35f0a5 100644
--- a/apps/launcher/advancedpage.cpp
+++ b/apps/launcher/advancedpage.cpp
@@ -73,18 +73,8 @@ bool Launcher::AdvancedPage::loadSettings()
     loadSettingBool(canLootDuringDeathAnimationCheckBox, "can loot during death animation", "Game");
     loadSettingBool(followersAttackOnSightCheckBox, "followers attack on sight", "Game");
     loadSettingBool(preventMerchantEquippingCheckBox, "prevent merchant equipping", "Game");
-    loadSettingBool(showEffectDurationCheckBox, "show effect duration", "Game");
-    loadSettingBool(showEnchantChanceCheckBox, "show enchant chance", "Game");
-    loadSettingBool(showMeleeInfoCheckBox, "show melee info", "Game");
-    loadSettingBool(showProjectileDamageCheckBox, "show projectile damage", "Game");
     loadSettingBool(rebalanceSoulGemValuesCheckBox, "rebalance soul gem values", "Game");
 
-    // Expected values are (0, 1, 2, 3)
-    int showOwnedIndex = mEngineSettings.getInt("show owned", "Game");
-    // Match the index with the option. Will default to 0 if invalid.
-    if (showOwnedIndex >= 0 && showOwnedIndex <= 3)
-        showOwnedComboBox->setCurrentIndex(showOwnedIndex);
-
     // Input Settings
     loadSettingBool(allowThirdPersonZoomCheckBox, "allow third person zoom", "Input");
     loadSettingBool(grabCursorCheckBox, "grab cursor", "Input");
@@ -94,6 +84,16 @@ bool Launcher::AdvancedPage::loadSettings()
     loadSettingBool(timePlayedCheckbox, "timeplayed", "Saves");
     maximumQuicksavesComboBox->setValue(mEngineSettings.getInt("max quicksaves", "Saves"));
 
+    // User Interface Settings
+    loadSettingBool(showEffectDurationCheckBox, "show effect duration", "Game");
+    loadSettingBool(showEnchantChanceCheckBox, "show enchant chance", "Game");
+    loadSettingBool(showMeleeInfoCheckBox, "show melee info", "Game");
+    loadSettingBool(showProjectileDamageCheckBox, "show projectile damage", "Game");
+    int showOwnedIndex = mEngineSettings.getInt("show owned", "Game");
+    // Match the index with the option (only 0, 1, 2, or 3 are valid). Will default to 0 if invalid.
+    if (showOwnedIndex >= 0 && showOwnedIndex <= 3)
+        showOwnedComboBox->setCurrentIndex(showOwnedIndex);
+
     // Other Settings
     QString screenshotFormatString = QString::fromStdString(mEngineSettings.getString("screenshot format", "General")).toUpper();
     if (screenshotFormatComboBox->findText(screenshotFormatString) == -1)
@@ -125,16 +125,8 @@ void Launcher::AdvancedPage::saveSettings()
     saveSettingBool(canLootDuringDeathAnimationCheckBox, "can loot during death animation", "Game");
     saveSettingBool(followersAttackOnSightCheckBox, "followers attack on sight", "Game");
     saveSettingBool(preventMerchantEquippingCheckBox, "prevent merchant equipping", "Game");
-    saveSettingBool(showEffectDurationCheckBox, "show effect duration", "Game");
-    saveSettingBool(showEnchantChanceCheckBox, "show enchant chance", "Game");
-    saveSettingBool(showMeleeInfoCheckBox, "show melee info", "Game");
-    saveSettingBool(showProjectileDamageCheckBox, "show projectile damage", "Game");
     saveSettingBool(rebalanceSoulGemValuesCheckBox, "rebalance soul gem values", "Game");
 
-    int showOwnedCurrentIndex = showOwnedComboBox->currentIndex();
-    if (showOwnedCurrentIndex != mEngineSettings.getInt("show owned", "Game"))
-        mEngineSettings.setInt("show owned", "Game", showOwnedCurrentIndex);
-
     // Input Settings
     saveSettingBool(allowThirdPersonZoomCheckBox, "allow third person zoom", "Input");
     saveSettingBool(grabCursorCheckBox, "grab cursor", "Input");
@@ -147,6 +139,15 @@ void Launcher::AdvancedPage::saveSettings()
         mEngineSettings.setInt("max quicksaves", "Saves", maximumQuicksaves);
     }
 
+    // User Interface Settings
+    saveSettingBool(showEffectDurationCheckBox, "show effect duration", "Game");
+    saveSettingBool(showEnchantChanceCheckBox, "show enchant chance", "Game");
+    saveSettingBool(showMeleeInfoCheckBox, "show melee info", "Game");
+    saveSettingBool(showProjectileDamageCheckBox, "show projectile damage", "Game");
+    int showOwnedCurrentIndex = showOwnedComboBox->currentIndex();
+    if (showOwnedCurrentIndex != mEngineSettings.getInt("show owned", "Game"))
+        mEngineSettings.setInt("show owned", "Game", showOwnedCurrentIndex);
+
     // Other Settings
     std::string screenshotFormatString = screenshotFormatComboBox->currentText().toLower().toStdString();
     if (screenshotFormatString != mEngineSettings.getString("screenshot format", "General"))
diff --git a/files/ui/advancedpage.ui b/files/ui/advancedpage.ui
index 7a01ce41d..0e43654f2 100644
--- a/files/ui/advancedpage.ui
+++ b/files/ui/advancedpage.ui
@@ -22,14 +22,14 @@
         <x>0</x>
         <y>0</y>
         <width>630</width>
-        <height>746</height>
+        <height>791</height>
        </rect>
       </property>
       <layout class="QVBoxLayout" name="scrollAreaVerticalLayout">
        <item>
         <widget class="QGroupBox" name="gameGroup">
          <property name="title">
-          <string>Game</string>
+          <string>Game Mechanics</string>
          </property>
          <layout class="QVBoxLayout" name="gameGroupVerticalLayout">
           <item>
@@ -62,46 +62,6 @@
             </property>
            </widget>
           </item>
-          <item>
-           <widget class="QCheckBox" name="showEffectDurationCheckBox">
-            <property name="toolTip">
-             <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Show the remaining duration of magic effects and lights if this setting is true. The remaining duration is displayed in the tooltip by hovering over the magical effect. &lt;/p&gt;&lt;p&gt;The default value is false.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
-            </property>
-            <property name="text">
-             <string>Show effect duration</string>
-            </property>
-           </widget>
-          </item>
-          <item>
-           <widget class="QCheckBox" name="showEnchantChanceCheckBox">
-            <property name="toolTip">
-             <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Whether or not the chance of success will be displayed in the enchanting menu.&lt;/p&gt;&lt;p&gt;The default value is false.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
-            </property>
-            <property name="text">
-             <string>Show enchant chance</string>
-            </property>
-           </widget>
-          </item>
-          <item>
-           <widget class="QCheckBox" name="showMeleeInfoCheckBox">
-            <property name="toolTip">
-             <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;If this setting is true, melee weapons reach and speed will be showed on item tooltip.&lt;/p&gt;&lt;p&gt;The default value is false.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
-            </property>
-            <property name="text">
-             <string>Show melee info</string>
-            </property>
-           </widget>
-          </item>
-          <item>
-           <widget class="QCheckBox" name="showProjectileDamageCheckBox">
-            <property name="toolTip">
-             <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;If this setting is true, damage bonus of arrows and bolts will be showed on item tooltip.&lt;/p&gt;&lt;p&gt;The default value is false.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
-            </property>
-            <property name="text">
-             <string>Show projectile damage</string>
-            </property>
-           </widget>
-          </item>
           <item>
            <widget class="QCheckBox" name="rebalanceSoulGemValuesCheckBox">
             <property name="toolTip">
@@ -112,64 +72,6 @@
             </property>
            </widget>
           </item>
-          <item alignment="Qt::AlignLeft">
-           <widget class="QWidget" name="showOwnedGroup" native="true">
-            <property name="toolTip">
-             <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Enable visual clues for items owned by NPCs when the crosshair is on the object.&lt;/p&gt;&lt;p&gt;The default value is Off.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
-            </property>
-            <layout class="QHBoxLayout" name="horizontalLayout">
-             <property name="spacing">
-              <number>-1</number>
-             </property>
-             <property name="leftMargin">
-              <number>0</number>
-             </property>
-             <property name="topMargin">
-              <number>0</number>
-             </property>
-             <property name="rightMargin">
-              <number>0</number>
-             </property>
-             <property name="bottomMargin">
-              <number>0</number>
-             </property>
-             <item alignment="Qt::AlignRight">
-              <widget class="QLabel" name="showOwnedLabel">
-               <property name="text">
-                <string>Show owned:</string>
-               </property>
-              </widget>
-             </item>
-             <item>
-              <widget class="QComboBox" name="showOwnedComboBox">
-               <property name="currentIndex">
-                <number>1</number>
-               </property>
-               <item>
-                <property name="text">
-                 <string>Off</string>
-                </property>
-               </item>
-               <item>
-                <property name="text">
-                 <string>Tool Tip Only</string>
-                </property>
-               </item>
-               <item>
-                <property name="text">
-                 <string>Crosshair Only</string>
-                </property>
-               </item>
-               <item>
-                <property name="text">
-                 <string>Tool Tip and Crosshair</string>
-                </property>
-               </item>
-              </widget>
-             </item>
-            </layout>
-           </widget>
-          </item>
          </layout>
         </widget>
        </item>
@@ -357,6 +259,113 @@
          </layout>
         </widget>
        </item>
+       <item>
+        <widget class="QGroupBox" name="userInterfaceGroup">
+         <property name="title">
+          <string>User Interface</string>
+         </property>
+         <layout class="QVBoxLayout" name="userInterfaceVerticalLayout">
+          <item>
+           <widget class="QCheckBox" name="showEffectDurationCheckBox">
+            <property name="toolTip">
+             <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Show the remaining duration of magic effects and lights if this setting is true. The remaining duration is displayed in the tooltip by hovering over the magical effect. &lt;/p&gt;&lt;p&gt;The default value is false.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+            </property>
+            <property name="text">
+             <string>Show effect duration</string>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QCheckBox" name="showEnchantChanceCheckBox">
+            <property name="toolTip">
+             <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Whether or not the chance of success will be displayed in the enchanting menu.&lt;/p&gt;&lt;p&gt;The default value is false.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+            </property>
+            <property name="text">
+             <string>Show enchant chance</string>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QCheckBox" name="showMeleeInfoCheckBox">
+            <property name="toolTip">
+             <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;If this setting is true, melee weapons reach and speed will be showed on item tooltip.&lt;/p&gt;&lt;p&gt;The default value is false.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+            </property>
+            <property name="text">
+             <string>Show melee info</string>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QCheckBox" name="showProjectileDamageCheckBox">
+            <property name="toolTip">
+             <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;If this setting is true, damage bonus of arrows and bolts will be showed on item tooltip.&lt;/p&gt;&lt;p&gt;The default value is false.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+            </property>
+            <property name="text">
+             <string>Show projectile damage</string>
+            </property>
+           </widget>
+          </item>
+          <item alignment="Qt::AlignLeft">
+           <widget class="QWidget" name="showOwnedGroup" native="true">
+            <property name="toolTip">
+             <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Enable visual clues for items owned by NPCs when the crosshair is on the object.&lt;/p&gt;&lt;p&gt;The default value is Off.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+            </property>
+            <layout class="QHBoxLayout" name="horizontalLayout">
+             <property name="spacing">
+              <number>-1</number>
+             </property>
+             <property name="leftMargin">
+              <number>0</number>
+             </property>
+             <property name="topMargin">
+              <number>0</number>
+             </property>
+             <property name="rightMargin">
+              <number>0</number>
+             </property>
+             <property name="bottomMargin">
+              <number>0</number>
+             </property>
+             <item alignment="Qt::AlignRight">
+              <widget class="QLabel" name="showOwnedLabel">
+               <property name="text">
+                <string>Show owned:</string>
+               </property>
+              </widget>
+             </item>
+             <item>
+              <widget class="QComboBox" name="showOwnedComboBox">
+               <property name="currentIndex">
+                <number>1</number>
+               </property>
+               <item>
+                <property name="text">
+                 <string>Off</string>
+                </property>
+               </item>
+               <item>
+                <property name="text">
+                 <string>Tool Tip Only</string>
+                </property>
+               </item>
+               <item>
+                <property name="text">
+                 <string>Crosshair Only</string>
+                </property>
+               </item>
+               <item>
+                <property name="text">
+                 <string>Tool Tip and Crosshair</string>
+                </property>
+               </item>
+              </widget>
+             </item>
+            </layout>
+           </widget>
+          </item>
+         </layout>
+        </widget>
+       </item>
        <item>
         <widget class="QGroupBox" name="otherGroup">
          <property name="title">