From 8837046d9c47f765cf404fd1eb92d1836acad340 Mon Sep 17 00:00:00 2001 From: Thunderforge Date: Sun, 28 Jan 2018 22:49:49 -0600 Subject: [PATCH] Adding panel for advanced settings.cfg options --- apps/launcher/CMakeLists.txt | 4 + apps/launcher/advancedpage.cpp | 89 ++++++ apps/launcher/advancedpage.hpp | 32 ++ apps/launcher/maindialog.cpp | 17 +- apps/launcher/maindialog.hpp | 2 + .../icons/tango/48x48/emblem-system.png | Bin 0 -> 3423 bytes files/launcher/launcher.qrc | 3 +- files/ui/advancedpage.ui | 286 ++++++++++++++++++ files/ui/mainwindow.ui | 4 +- 9 files changed, 430 insertions(+), 7 deletions(-) create mode 100644 apps/launcher/advancedpage.cpp create mode 100644 apps/launcher/advancedpage.hpp create mode 100644 files/launcher/icons/tango/48x48/emblem-system.png create mode 100644 files/ui/advancedpage.ui diff --git a/apps/launcher/CMakeLists.txt b/apps/launcher/CMakeLists.txt index aac076404..aec8c2533 100644 --- a/apps/launcher/CMakeLists.txt +++ b/apps/launcher/CMakeLists.txt @@ -6,6 +6,7 @@ set(LAUNCHER playpage.cpp textslotmsgbox.cpp settingspage.cpp + advancedpage.cpp utils/profilescombobox.cpp utils/textinputdialog.cpp @@ -21,6 +22,7 @@ set(LAUNCHER_HEADER playpage.hpp textslotmsgbox.hpp settingspage.hpp + advancedpage.hpp utils/profilescombobox.hpp utils/textinputdialog.hpp @@ -35,6 +37,7 @@ set(LAUNCHER_HEADER_MOC playpage.hpp textslotmsgbox.hpp settingspage.hpp + advancedpage.hpp utils/textinputdialog.hpp utils/profilescombobox.hpp @@ -49,6 +52,7 @@ set(LAUNCHER_UI ${CMAKE_SOURCE_DIR}/files/ui/playpage.ui ${CMAKE_SOURCE_DIR}/files/ui/contentselector.ui ${CMAKE_SOURCE_DIR}/files/ui/settingspage.ui + ${CMAKE_SOURCE_DIR}/files/ui/advancedpage.ui ) source_group(launcher FILES ${LAUNCHER} ${LAUNCHER_HEADER}) diff --git a/apps/launcher/advancedpage.cpp b/apps/launcher/advancedpage.cpp new file mode 100644 index 000000000..da142ff26 --- /dev/null +++ b/apps/launcher/advancedpage.cpp @@ -0,0 +1,89 @@ +#include "advancedpage.hpp" + +#include + +Launcher::AdvancedPage::AdvancedPage(Files::ConfigurationManager &cfg, Settings::Manager &engineSettings, QWidget *parent) + : QWidget(parent) + , mCfgMgr(cfg) + , mEngineSettings(engineSettings) +{ + setObjectName ("AdvancedPage"); + setupUi(this); + + loadSettings(); +} + +bool Launcher::AdvancedPage::loadSettings() +{ + // Game Settings + 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(showMeleeInfoCheckBox, "show enchant chance", "Game"); + loadSettingBool(showMeleeInfoCheckBox, "show melee info", "Game"); + loadSettingBool(showProjectileDamageCheckBox, "show projectile damage", "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"); + loadSettingBool(toggleSneakCheckBox, "toggle sneak", "Input"); + + // Other Settings + loadSettingBool(timePlayedCheckbox, "timeplayed", "Saves"); + + QString screenshotFormatString = QString::fromStdString(mEngineSettings.getString("screenshot format", "General")).toUpper(); + if (screenshotFormatComboBox->findText(screenshotFormatString) == -1) + screenshotFormatComboBox->addItem(screenshotFormatString); + screenshotFormatComboBox->setCurrentText(screenshotFormatString); + + return true; +} + +void Launcher::AdvancedPage::saveSettings() +{ + // Ensure we only set the new settings if they changed. This is to avoid cluttering the + // user settings file (which by definition should only contain settings the user has touched) + + // Game Settings + 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(showMeleeInfoCheckBox, "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); + + // Input Settings + saveSettingBool(allowThirdPersonZoomCheckBox, "allow third person zoom", "Input"); + saveSettingBool(grabCursorCheckBox, "grab cursor", "Input"); + saveSettingBool(toggleSneakCheckBox, "toggle sneak", "Input"); + + // Other Settings + saveSettingBool(timePlayedCheckbox, "timeplayed", "Saves"); + + std::string screenshotFormatString = screenshotFormatComboBox->currentText().toLower().toStdString(); + if (screenshotFormatString != mEngineSettings.getString("screenshot format", "General")) + mEngineSettings.setString("screenshot format", "General", screenshotFormatString); +} + +void Launcher::AdvancedPage::loadSettingBool(QCheckBox *checkbox, const std::string &setting, const std::string &group) { + if (mEngineSettings.getBool(setting, group)) + checkbox->setCheckState(Qt::Checked); +} + +void Launcher::AdvancedPage::saveSettingBool(QCheckBox *checkbox, const std::string &setting, const std::string &group) { + bool cValue = checkbox->checkState(); + if (cValue != mEngineSettings.getBool(setting, group)) + mEngineSettings.setBool(setting, group, cValue); +} \ No newline at end of file diff --git a/apps/launcher/advancedpage.hpp b/apps/launcher/advancedpage.hpp new file mode 100644 index 000000000..a8361c98e --- /dev/null +++ b/apps/launcher/advancedpage.hpp @@ -0,0 +1,32 @@ +#ifndef ADVANCEDPAGE_H +#define ADVANCEDPAGE_H + +#include + +#include "ui_advancedpage.h" + +#include + +namespace Files { struct ConfigurationManager; } + +namespace Launcher +{ + class AdvancedPage : public QWidget, private Ui::AdvancedPage + { + Q_OBJECT + + public: + AdvancedPage(Files::ConfigurationManager &cfg, Settings::Manager &engineSettings, QWidget *parent = 0); + + bool loadSettings(); + void saveSettings(); + + private: + Files::ConfigurationManager &mCfgMgr; + Settings::Manager &mEngineSettings; + + void loadSettingBool(QCheckBox *checkbox, const std::string& setting, const std::string& group); + void saveSettingBool(QCheckBox *checkbox, const std::string& setting, const std::string& group); + }; +} +#endif diff --git a/apps/launcher/maindialog.cpp b/apps/launcher/maindialog.cpp index 31da90d2f..1a210ccc5 100644 --- a/apps/launcher/maindialog.cpp +++ b/apps/launcher/maindialog.cpp @@ -2,9 +2,7 @@ #include -#include #include -#include #include #include #include @@ -12,8 +10,6 @@ #include #include #include -#include -#include #include @@ -21,6 +17,7 @@ #include "graphicspage.hpp" #include "datafilespage.hpp" #include "settingspage.hpp" +#include "advancedpage.hpp" using namespace Process; @@ -104,6 +101,12 @@ void Launcher::MainDialog::createIcons() settingsButton->setTextAlignment(Qt::AlignHCenter | Qt::AlignBottom); settingsButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); + QListWidgetItem *advancedButton = new QListWidgetItem(iconWidget); + advancedButton->setIcon(QIcon::fromTheme("emblem-system")); + advancedButton->setText(tr("Advanced")); + advancedButton->setTextAlignment(Qt::AlignHCenter | Qt::AlignBottom); + advancedButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); + connect(iconWidget, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), this, SLOT(changePage(QListWidgetItem*,QListWidgetItem*))); @@ -116,6 +119,7 @@ void Launcher::MainDialog::createPages() mDataFilesPage = new DataFilesPage(mCfgMgr, mGameSettings, mLauncherSettings, this); mGraphicsPage = new GraphicsPage(mCfgMgr, mEngineSettings, this); mSettingsPage = new SettingsPage(mCfgMgr, mGameSettings, mLauncherSettings, this); + mAdvancedPage = new AdvancedPage(mCfgMgr, mEngineSettings, this); // Set the combobox of the play page to imitate the combobox on the datafilespage mPlayPage->setProfilesModel(mDataFilesPage->profilesModel()); @@ -126,6 +130,7 @@ void Launcher::MainDialog::createPages() pagesWidget->addWidget(mDataFilesPage); pagesWidget->addWidget(mGraphicsPage); pagesWidget->addWidget(mSettingsPage); + pagesWidget->addWidget(mAdvancedPage); // Select the first page iconWidget->setCurrentItem(iconWidget->item(0), QItemSelectionModel::Select); @@ -245,6 +250,9 @@ bool Launcher::MainDialog::reloadSettings() if (!mGraphicsPage->loadSettings()) return false; + if (!mAdvancedPage->loadSettings()) + return false; + return true; } @@ -483,6 +491,7 @@ bool Launcher::MainDialog::writeSettings() mDataFilesPage->saveSettings(); mGraphicsPage->saveSettings(); mSettingsPage->saveSettings(); + mAdvancedPage->saveSettings(); QString userPath = QString::fromUtf8(mCfgMgr.getUserConfigPath().string().c_str()); QDir dir(userPath); diff --git a/apps/launcher/maindialog.hpp b/apps/launcher/maindialog.hpp index 8d0d61b8f..6d3871b7c 100644 --- a/apps/launcher/maindialog.hpp +++ b/apps/launcher/maindialog.hpp @@ -30,6 +30,7 @@ namespace Launcher class DataFilesPage; class UnshieldThread; class SettingsPage; + class AdvancedPage; enum FirstRunDialogResult { @@ -88,6 +89,7 @@ namespace Launcher GraphicsPage *mGraphicsPage; DataFilesPage *mDataFilesPage; SettingsPage *mSettingsPage; + AdvancedPage *mAdvancedPage; Process::ProcessInvoker *mGameInvoker; Process::ProcessInvoker *mWizardInvoker; diff --git a/files/launcher/icons/tango/48x48/emblem-system.png b/files/launcher/icons/tango/48x48/emblem-system.png new file mode 100644 index 0000000000000000000000000000000000000000..9a765247cac594055fb1b80c2c164680070cc9f6 GIT binary patch literal 3423 zcmV-l4WROgP)b)L-ur1ltjd#20I+m9nxVfI<2&)NPDZmA#Q`vVej4t$G~A<0IKF!tb=FynELr)RpWyY55WLwh`9n}jRrQJ34(Rlon!Pd)Y2*aZI%t*NQ$SB~T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iyLZpYX0xcS zu7;|rc@gP!8VeULl&Y$#mi6}b{-PM?OlkDbg%B$jEm|abvj!mqnx^5#jT`)vPd-6q zWu^JlQ&0J8YHE2lqQE`#y6N%p#~+7jn&|KE=UrW0*@1z9 z+qZAu{@Jl($BrwC@*BV3zjkP7XkJ}ioicf_LVJ6=VHn09#@HvtIA=Z7H#IdKk3=G` zz4+pb{=vaP=i>L{;^}nemm&^8Vm;2J$v?SUAS=JU#Y6PK~WUtg%@5>Na-vg??N+t$|B0RRfV4neO`0F*KIhwa<9`;y6I zezAu_A?Uh}%a<=-K6>=%+b;0r)$)k2_U+rZWcBLRClZN7?D+BH=O=$}0dNW-ORa%C zJOK6R(WAe5_0?Cew6wJJrBW#gfHo<>YqERgoR3UQOe|CsC7$z-4? zNG%-CCZA=Y6@70Ab`PZ3;5m4Bq z0s(~!tyJh03Mdrf!q2%q(*Ik)1Mt}dxc05v{{b)@Ww8q+=<@&o002ovPDHLkV1mVP BtH=NV literal 0 HcmV?d00001 diff --git a/files/launcher/launcher.qrc b/files/launcher/launcher.qrc index 4f55fccd5..ddcc26e59 100644 --- a/files/launcher/launcher.qrc +++ b/files/launcher/launcher.qrc @@ -9,8 +9,9 @@ icons/tango/index.theme - icons/tango/48x48/video-display.png + icons/tango/48x48/emblem-system.png icons/tango/48x48/preferences-system.png + icons/tango/48x48/video-display.png icons/tango/16x16/document-new.png icons/tango/16x16/edit-copy.png icons/tango/16x16/edit-delete.png diff --git a/files/ui/advancedpage.ui b/files/ui/advancedpage.ui new file mode 100644 index 000000000..426cce0f8 --- /dev/null +++ b/files/ui/advancedpage.ui @@ -0,0 +1,286 @@ + + + AdvancedPage + + + + 0 + 0 + 434 + 373 + + + + + + + <html><head/><body><p>These settings are not available in the game. <span style=" font-weight:600;">Use at your own risk!</span></p></body></html> + + + + + + + true + + + + + 0 + 0 + 393 + 437 + + + + + + + Game + + + + + + <html><head/><body><p>If this setting is true, the player is allowed to loot actors (e.g. summoned creatures) during death animation, if they are not in combat. However disposing corpses during death animation is not recommended - death counter may not be incremented, and this behaviour can break quests. This is how original Morrowind behaves.</p><p>If this setting is false, player has to wait until end of death animation in all cases. This case is more safe, but makes using of summoned creatures exploit (looting summoned Dremoras and Golden Saints for expensive weapons) a lot harder.</p></body></html> + + + Can loot during death animation + + + + + + + <html><head/><body><p>Makes player followers and escorters start combat with enemies who have started combat with them or the player. Otherwise they wait for the enemies or the player to do an attack first.</p></body></html> + + + Followers attack on sight + + + + + + + <html><head/><body><p>Prevents merchants from equipping items that are sold to them.</p></body></html> + + + Prevent merchant equipping + + + + + + + <html><head/><body><p>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. </p><p>The default value is false.</p></body></html> + + + Show effect duration + + + + + + + <html><head/><body><p>Whether or not the chance of success will be displayed in the enchanting menu.</p><p>The default value is false.</p></body></html> + + + Show enchant chance + + + + + + + <html><head/><body><p>If this setting is true, melee weapons reach and speed will be showed on item tooltip.</p><p>The default value is false.</p></body></html> + + + Show melee info + + + + + + + <html><head/><body><p>If this setting is true, damage bonus of arrows and bolts will be showed on item tooltip.</p><p>The default value is false.</p></body></html> + + + Show projectile damage + + + + + + + <html><head/><body><p>Enable visual clues for items owned by NPCs when the crosshair is on the object.</p><p>The default value is Off.</p></body></html> + + + + -1 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Show owned: + + + + + + + + Off + + + + + Tool Tip Only + + + + + Crosshair Only + + + + + Tooltip and Crosshair + + + + + + + + + + + + + + Input + + + + + + <html><head/><body><p>Allow zooming in and out using the middle mouse wheel in third person view. This feature may not work correctly if the mouse wheel is bound to other actions, and may be triggered accidentally in some cases, so is disabled by default.</p></body></html> + + + Allow third person zoom + + + + + + + <html><head/><body><p>OpenMW will capture control of the cursor if this setting is true.</p><p>In “look mode”, OpenMW will center the cursor regardless of the value of this setting (since the cursor/crosshair is always centered in the OpenMW window). However, in GUI mode, this setting determines the behavior when the cursor is moved outside the OpenMW window. If true, the cursor movement stops at the edge of the window preventing access to other applications. If false, the cursor is allowed to move freely on the desktop.</p><p>This setting does not apply to the screen where escape has been pressed, where the cursor is never captured. Regardless of this setting “Alt-Tab” or some other operating system dependent key sequence can be used to allow the operating system to regain control of the mouse cursor. This setting interacts with the minimize on focus loss setting by affecting what counts as a focus loss. Specifically on a two-screen configuration it may be more convenient to access the second screen with setting disabled.</p><p>Note for developers: it’s desirable to have this setting disabled when running the game in a debugger, to prevent the mouse cursor from becoming unusable when the game pauses on a breakpoint.</p></body></html> + + + Grab cursor + + + + + + + <html><head/><body><p>This setting causes the behavior of the sneak key (bound to Ctrl by default) to toggle sneaking on and off rather than requiring the key to be held down while sneaking. Players that spend significant time sneaking may find the character easier to control with this option enabled. </p></body></html> + + + Toggle sneak + + + + + + + + + + Other + + + + + + <html><head/><body><p>This setting determines whether the amount of the time the player has spent playing will be displayed for each saved game in the Load menu.</p></body></html> + + + Add "Time Played" to saves + + + + + + + <html><head/><body><p>Specify the format for screen shots taken by pressing the screen shot key (bound to F12 by default). This setting should be the file extension commonly associated with the desired format. The formats supported will be determined at compilation, but “jpg”, “png”, and “tga” should be allowed.</p></body></html> + + + + -1 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Screenshot Format + + + + + + + + JPG + + + + + PNG + + + + + TGA + + + + + + + + + + + + + + + + + + + diff --git a/files/ui/mainwindow.ui b/files/ui/mainwindow.ui index 45578ef9e..13e8593e0 100644 --- a/files/ui/mainwindow.ui +++ b/files/ui/mainwindow.ui @@ -6,13 +6,13 @@ 0 0 - 635 + 720 565 - 635 + 720 565