diff options
| -rw-r--r-- | src/CMakeLists.txt | 3 | ||||
| -rw-r--r-- | src/loadmechanism.cpp | 6 | ||||
| -rw-r--r-- | src/loadmechanism.h | 6 | ||||
| -rw-r--r-- | src/settings.cpp | 73 | ||||
| -rw-r--r-- | src/settings.h | 20 | ||||
| -rw-r--r-- | src/settingsdialog.cpp | 51 | ||||
| -rw-r--r-- | src/settingsdialog.h | 14 | ||||
| -rw-r--r-- | src/settingsdialogplugins.cpp | 9 | ||||
| -rw-r--r-- | src/settingsdialogplugins.h | 1 | ||||
| -rw-r--r-- | src/settingsdialogworkarounds.cpp | 108 | ||||
| -rw-r--r-- | src/settingsdialogworkarounds.h | 25 |
11 files changed, 157 insertions, 159 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a8ded510..86ef9721 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -42,6 +42,7 @@ SET(organizer_SRCS settingsdialogpaths.cpp settingsdialogplugins.cpp settingsdialogsteam.cpp + settingsdialogworkarounds.cpp settings.cpp selfupdater.cpp selectiondialog.cpp @@ -161,6 +162,7 @@ SET(organizer_HDRS settingsdialogpaths.h settingsdialogplugins.h settingsdialogsteam.h + settingsdialogworkarounds.h settings.h selfupdater.h selectiondialog.h @@ -446,6 +448,7 @@ set(settings settingsdialogpaths settingsdialogplugins settingsdialogsteam + settingsdialogworkarounds ) set(utilities diff --git a/src/loadmechanism.cpp b/src/loadmechanism.cpp index 4d6cebd4..2d01562d 100644 --- a/src/loadmechanism.cpp +++ b/src/loadmechanism.cpp @@ -63,7 +63,7 @@ void LoadMechanism::removeHintFile(QDir targetDirectory) }
-bool LoadMechanism::isDirectLoadingSupported()
+bool LoadMechanism::isDirectLoadingSupported() const
{
//FIXME: Seriously? isn't there a 'do i need steam' thing?
IPluginGame const *game = qApp->property("managed_game").value<IPluginGame*>();
@@ -76,7 +76,7 @@ bool LoadMechanism::isDirectLoadingSupported() }
}
-bool LoadMechanism::isScriptExtenderSupported()
+bool LoadMechanism::isScriptExtenderSupported() const
{
IPluginGame const *game = qApp->property("managed_game").value<IPluginGame*>();
ScriptExtender *extender = game->feature<ScriptExtender>();
@@ -85,7 +85,7 @@ bool LoadMechanism::isScriptExtenderSupported() return extender != nullptr && extender->isInstalled();
}
-bool LoadMechanism::isProxyDLLSupported()
+bool LoadMechanism::isProxyDLLSupported() const
{
// using steam_api.dll as the proxy is way too game specific as many games will have different
// versions of that dll.
diff --git a/src/loadmechanism.h b/src/loadmechanism.h index c04473ab..51fefaf9 100644 --- a/src/loadmechanism.h +++ b/src/loadmechanism.h @@ -68,21 +68,21 @@ public: *
* @return true if the load mechanism is supported
**/
- bool isDirectLoadingSupported();
+ bool isDirectLoadingSupported() const;
/**
* @brief test whether the "Script Extender" load mechanism is supported for the current game
*
* @return true if the load mechanism is supported
**/
- bool isScriptExtenderSupported();
+ bool isScriptExtenderSupported() const;
/**
* @brief test whether the "Proxy DLL" load mechanism is supported for the current game
*
* @return true if the load mechanism is supported
**/
- bool isProxyDLLSupported();
+ bool isProxyDLLSupported() const;
private:
diff --git a/src/settings.cpp b/src/settings.cpp index bc45b720..515ff907 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -27,6 +27,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. #include "settingsdialogpaths.h" #include "settingsdialogplugins.h" #include "settingsdialogsteam.h" +#include "settingsdialogworkarounds.h" #include "versioninfo.h" #include "appconfig.h" #include "organizercore.h" @@ -679,7 +680,7 @@ void Settings::query(PluginContainer *pluginContainer, QWidget *parent) tabs.push_back(std::unique_ptr<SettingsTab>(new NexusSettingsTab(this, dialog))); tabs.push_back(std::unique_ptr<SettingsTab>(new SteamSettingsTab(this, dialog))); tabs.push_back(std::unique_ptr<SettingsTab>(new PluginsSettingsTab(this, dialog))); - tabs.push_back(std::unique_ptr<SettingsTab>(new WorkaroundsTab(this, dialog))); + tabs.push_back(std::unique_ptr<SettingsTab>(new WorkaroundsSettingsTab(this, dialog))); QString key = QString("geometry/%1").arg(dialog.objectName()); @@ -770,73 +771,3 @@ void Settings::DiagnosticsTab::update() m_Settings.setValue("Settings/crash_dumps_type", m_dumpsTypeBox->currentIndex()); m_Settings.setValue("Settings/crash_dumps_max", m_dumpsMaxEdit->value()); } - - -Settings::WorkaroundsTab::WorkaroundsTab(Settings *m_parent, - SettingsDialog &m_dialog) - : SettingsTab(m_parent, m_dialog) - , m_appIDEdit(m_dialog.findChild<QLineEdit *>("appIDEdit")) - , m_mechanismBox(m_dialog.findChild<QComboBox *>("mechanismBox")) - , m_hideUncheckedBox(m_dialog.findChild<QCheckBox *>("hideUncheckedBox")) - , m_forceEnableBox(m_dialog.findChild<QCheckBox *>("forceEnableBox")) - , m_displayForeignBox(m_dialog.findChild<QCheckBox *>("displayForeignBox")) - , m_lockGUIBox(m_dialog.findChild<QCheckBox *>("lockGUIBox")) - , m_enableArchiveParsingBox(m_dialog.findChild<QCheckBox *>("enableArchiveParsingBox")) - , m_resetGeometriesBtn(m_dialog.findChild<QPushButton *>("resetGeometryBtn")) -{ - m_appIDEdit->setText(m_parent->getSteamAppID()); - - LoadMechanism::EMechanism mechanismID = m_parent->getLoadMechanism(); - int index = 0; - - if (m_parent->m_LoadMechanism.isDirectLoadingSupported()) { - m_mechanismBox->addItem(QObject::tr("Mod Organizer"), LoadMechanism::LOAD_MODORGANIZER); - if (mechanismID == LoadMechanism::LOAD_MODORGANIZER) { - index = m_mechanismBox->count() - 1; - } - } - - if (m_parent->m_LoadMechanism.isScriptExtenderSupported()) { - m_mechanismBox->addItem(QObject::tr("Script Extender"), LoadMechanism::LOAD_SCRIPTEXTENDER); - if (mechanismID == LoadMechanism::LOAD_SCRIPTEXTENDER) { - index = m_mechanismBox->count() - 1; - } - } - - if (m_parent->m_LoadMechanism.isProxyDLLSupported()) { - m_mechanismBox->addItem(QObject::tr("Proxy DLL"), LoadMechanism::LOAD_PROXYDLL); - if (mechanismID == LoadMechanism::LOAD_PROXYDLL) { - index = m_mechanismBox->count() - 1; - } - } - - m_mechanismBox->setCurrentIndex(index); - - m_hideUncheckedBox->setChecked(m_parent->hideUncheckedPlugins()); - m_forceEnableBox->setChecked(m_parent->forceEnableCoreFiles()); - m_displayForeignBox->setChecked(m_parent->displayForeign()); - m_lockGUIBox->setChecked(m_parent->lockGUI()); - m_enableArchiveParsingBox->setChecked(m_parent->archiveParsing()); - - m_resetGeometriesBtn->setChecked(m_parent->directInterface().value("reset_geometry", false).toBool()); - - m_dialog.setExecutableBlacklist(m_parent->executablesBlacklist()); - -} - -void Settings::WorkaroundsTab::update() -{ - if (m_appIDEdit->text() != m_parent->m_GamePlugin->steamAPPId()) { - m_Settings.setValue("Settings/app_id", m_appIDEdit->text()); - } else { - m_Settings.remove("Settings/app_id"); - } - m_Settings.setValue("Settings/load_mechanism", m_mechanismBox->itemData(m_mechanismBox->currentIndex()).toInt()); - m_Settings.setValue("Settings/hide_unchecked_plugins", m_hideUncheckedBox->isChecked()); - m_Settings.setValue("Settings/force_enable_core_files", m_forceEnableBox->isChecked()); - m_Settings.setValue("Settings/display_foreign", m_displayForeignBox->isChecked()); - m_Settings.setValue("Settings/lock_gui", m_lockGUIBox->isChecked()); - m_Settings.setValue("Settings/archive_parsing_experimental", m_enableArchiveParsingBox->isChecked()); - - m_Settings.setValue("Settings/executable_blacklist", m_dialog.getExecutableBlacklist()); -} diff --git a/src/settings.h b/src/settings.h index 5298103a..64068173 100644 --- a/src/settings.h +++ b/src/settings.h @@ -434,6 +434,7 @@ public: QMap<QString, QVariantMap> m_PluginDescriptions; QSet<QString> m_PluginBlacklist; void writePluginBlacklist(); + const LoadMechanism& loadMechanism() const { return m_LoadMechanism; } public slots: @@ -466,25 +467,6 @@ private: void setLevelsBox(); }; - /** Display/store the configuration in the 'workarounds' tab of the settings dialogue */ - class WorkaroundsTab : public SettingsTab - { - public: - WorkaroundsTab(Settings *m_parent, SettingsDialog &m_dialog); - - void update(); - - private: - QLineEdit *m_appIDEdit; - QComboBox *m_mechanismBox; - QCheckBox *m_hideUncheckedBox; - QCheckBox *m_forceEnableBox; - QCheckBox *m_displayForeignBox; - QCheckBox *m_lockGUIBox; - QCheckBox *m_enableArchiveParsingBox; - QPushButton *m_resetGeometriesBtn; - }; - private slots: signals: diff --git a/src/settingsdialog.cpp b/src/settingsdialog.cpp index f43f7ae8..76b0a146 100644 --- a/src/settingsdialog.cpp +++ b/src/settingsdialog.cpp @@ -58,10 +58,6 @@ SettingsDialog::SettingsDialog(PluginContainer *pluginContainer, Settings* setti { ui->setupUi(this); ui->pluginSettingsList->setStyleSheet("QTreeWidget::item {padding-right: 10px;}"); - - QShortcut *delShortcut = new QShortcut( - QKeySequence(Qt::Key_Delete), ui->pluginBlacklist); - connect(delShortcut, SIGNAL(activated()), this, SLOT(deleteBlacklistItem())); } SettingsDialog::~SettingsDialog() @@ -111,50 +107,3 @@ bool SettingsDialog::getApiKeyChanged() { return m_keyChanged; } - -void SettingsDialog::on_execBlacklistBtn_clicked() -{ - bool ok = false; - QString result = QInputDialog::getMultiLineText( - this, - tr("Executables Blacklist"), - tr("Enter one executable per line to be blacklisted from the virtual file system.\n" - "Mods and other virtualized files will not be visible to these executables and\n" - "any executables launched by them.\n\n" - "Example:\n" - " Chrome.exe\n" - " Firefox.exe"), - m_ExecutableBlacklist.split(";").join("\n"), - &ok - ); - if (ok) { - QStringList blacklist; - for (auto exec : result.split("\n")) { - if (exec.trimmed().endsWith(".exe", Qt::CaseInsensitive)) { - blacklist << exec.trimmed(); - } - } - m_ExecutableBlacklist = blacklist.join(";"); - } -} - -void SettingsDialog::on_bsaDateBtn_clicked() -{ - IPluginGame const *game - = qApp->property("managed_game").value<IPluginGame *>(); - QDir dir = game->dataDirectory(); - - Helper::backdateBSAs(qApp->applicationDirPath().toStdWString(), - dir.absolutePath().toStdWString()); -} - -void SettingsDialog::deleteBlacklistItem() -{ - ui->pluginBlacklist->takeItem(ui->pluginBlacklist->currentIndex().row()); -} - -void SettingsDialog::on_resetGeometryBtn_clicked() -{ - m_GeometriesReset = true; - ui->resetGeometryBtn->setChecked(true); -} diff --git a/src/settingsdialog.h b/src/settingsdialog.h index 319e6ed8..81c17f44 100644 --- a/src/settingsdialog.h +++ b/src/settingsdialog.h @@ -57,30 +57,20 @@ public: // temp Ui::SettingsDialog *ui; bool m_keyChanged; + bool m_GeometriesReset; PluginContainer *m_PluginContainer; public slots: virtual void accept(); public: - QString getExecutableBlacklist() { return m_ExecutableBlacklist; } - void setExecutableBlacklist(QString blacklist) { m_ExecutableBlacklist = blacklist; } - bool getResetGeometries(); bool getApiKeyChanged(); - -private slots: - void on_bsaDateBtn_clicked(); - void on_execBlacklistBtn_clicked(); - void on_resetGeometryBtn_clicked(); - - void deleteBlacklistItem(); + bool getResetGeometries(); private: Settings* m_settings; - bool m_GeometriesReset; - QString m_ExecutableBlacklist; }; #endif // SETTINGSDIALOG_H diff --git a/src/settingsdialogplugins.cpp b/src/settingsdialogplugins.cpp index 32269344..33bc1563 100644 --- a/src/settingsdialogplugins.cpp +++ b/src/settingsdialogplugins.cpp @@ -29,6 +29,10 @@ PluginsSettingsTab::PluginsSettingsTab(Settings *m_parent, SettingsDialog &m_dia QObject::connect( ui->pluginsList, &QListWidget::currentItemChanged, [&](auto* current, auto* previous) { on_pluginsList_currentItemChanged(current, previous); }); + + QShortcut *delShortcut = new QShortcut( + QKeySequence(Qt::Key_Delete), ui->pluginBlacklist); + QObject::connect(delShortcut, &QShortcut::activated, parentWidget(), [&]{ deleteBlacklistItem(); }); } void PluginsSettingsTab::update() @@ -95,6 +99,11 @@ void PluginsSettingsTab::on_pluginsList_currentItemChanged(QListWidgetItem *curr ui->pluginSettingsList->resizeColumnToContents(1); } +void PluginsSettingsTab::deleteBlacklistItem() +{ + ui->pluginBlacklist->takeItem(ui->pluginBlacklist->currentIndex().row()); +} + void PluginsSettingsTab::storeSettings(QListWidgetItem *pluginItem) { if (pluginItem != nullptr) { diff --git a/src/settingsdialogplugins.h b/src/settingsdialogplugins.h index 48d61858..9d21daa6 100644 --- a/src/settingsdialogplugins.h +++ b/src/settingsdialogplugins.h @@ -14,6 +14,7 @@ public: private: void on_pluginsList_currentItemChanged(QListWidgetItem *current, QListWidgetItem *previous); + void deleteBlacklistItem(); void storeSettings(QListWidgetItem *pluginItem); }; diff --git a/src/settingsdialogworkarounds.cpp b/src/settingsdialogworkarounds.cpp new file mode 100644 index 00000000..4cca5fd4 --- /dev/null +++ b/src/settingsdialogworkarounds.cpp @@ -0,0 +1,108 @@ +#include "settingsdialogworkarounds.h" +#include "ui_settingsdialog.h" +#include "helper.h" +#include <iplugingame.h> + +WorkaroundsSettingsTab::WorkaroundsSettingsTab(Settings *m_parent, SettingsDialog &m_dialog) + : SettingsTab(m_parent, m_dialog) +{ + ui->appIDEdit->setText(m_parent->getSteamAppID()); + + LoadMechanism::EMechanism mechanismID = m_parent->getLoadMechanism(); + int index = 0; + + if (m_parent->loadMechanism().isDirectLoadingSupported()) { + ui->mechanismBox->addItem(QObject::tr("Mod Organizer"), LoadMechanism::LOAD_MODORGANIZER); + if (mechanismID == LoadMechanism::LOAD_MODORGANIZER) { + index = ui->mechanismBox->count() - 1; + } + } + + if (m_parent->loadMechanism().isScriptExtenderSupported()) { + ui->mechanismBox->addItem(QObject::tr("Script Extender"), LoadMechanism::LOAD_SCRIPTEXTENDER); + if (mechanismID == LoadMechanism::LOAD_SCRIPTEXTENDER) { + index = ui->mechanismBox->count() - 1; + } + } + + if (m_parent->loadMechanism().isProxyDLLSupported()) { + ui->mechanismBox->addItem(QObject::tr("Proxy DLL"), LoadMechanism::LOAD_PROXYDLL); + if (mechanismID == LoadMechanism::LOAD_PROXYDLL) { + index = ui->mechanismBox->count() - 1; + } + } + + ui->mechanismBox->setCurrentIndex(index); + + ui->hideUncheckedBox->setChecked(m_parent->hideUncheckedPlugins()); + ui->forceEnableBox->setChecked(m_parent->forceEnableCoreFiles()); + ui->displayForeignBox->setChecked(m_parent->displayForeign()); + ui->lockGUIBox->setChecked(m_parent->lockGUI()); + ui->enableArchiveParsingBox->setChecked(m_parent->archiveParsing()); + + ui->resetGeometryBtn->setChecked(m_parent->directInterface().value("reset_geometry", false).toBool()); + + setExecutableBlacklist(m_parent->executablesBlacklist()); + + QObject::connect(ui->bsaDateBtn, &QPushButton::clicked, [&]{ on_bsaDateBtn_clicked(); }); + QObject::connect(ui->execBlacklistBtn, &QPushButton::clicked, [&]{ on_execBlacklistBtn_clicked(); }); + QObject::connect(ui->resetGeometryBtn, &QPushButton::clicked, [&]{ on_resetGeometryBtn_clicked(); }); +} + +void WorkaroundsSettingsTab::update() +{ + if (ui->appIDEdit->text() != m_parent->gamePlugin()->steamAPPId()) { + m_Settings.setValue("Settings/app_id", ui->appIDEdit->text()); + } else { + m_Settings.remove("Settings/app_id"); + } + m_Settings.setValue("Settings/load_mechanism", ui->mechanismBox->itemData(ui->mechanismBox->currentIndex()).toInt()); + m_Settings.setValue("Settings/hide_unchecked_plugins", ui->hideUncheckedBox->isChecked()); + m_Settings.setValue("Settings/force_enable_core_files", ui->forceEnableBox->isChecked()); + m_Settings.setValue("Settings/display_foreign", ui->displayForeignBox->isChecked()); + m_Settings.setValue("Settings/lock_gui", ui->lockGUIBox->isChecked()); + m_Settings.setValue("Settings/archive_parsing_experimental", ui->enableArchiveParsingBox->isChecked()); + + m_Settings.setValue("Settings/executable_blacklist", getExecutableBlacklist()); +} + +void WorkaroundsSettingsTab::on_execBlacklistBtn_clicked() +{ + bool ok = false; + QString result = QInputDialog::getMultiLineText( + parentWidget(), + QObject::tr("Executables Blacklist"), + QObject::tr("Enter one executable per line to be blacklisted from the virtual file system.\n" + "Mods and other virtualized files will not be visible to these executables and\n" + "any executables launched by them.\n\n" + "Example:\n" + " Chrome.exe\n" + " Firefox.exe"), + m_ExecutableBlacklist.split(";").join("\n"), + &ok + ); + if (ok) { + QStringList blacklist; + for (auto exec : result.split("\n")) { + if (exec.trimmed().endsWith(".exe", Qt::CaseInsensitive)) { + blacklist << exec.trimmed(); + } + } + m_ExecutableBlacklist = blacklist.join(";"); + } +} + +void WorkaroundsSettingsTab::on_bsaDateBtn_clicked() +{ + const auto* game = qApp->property("managed_game").value<MOBase::IPluginGame*>(); + QDir dir = game->dataDirectory(); + + Helper::backdateBSAs(qApp->applicationDirPath().toStdWString(), + dir.absolutePath().toStdWString()); +} + +void WorkaroundsSettingsTab::on_resetGeometryBtn_clicked() +{ + m_dialog.m_GeometriesReset = true; + ui->resetGeometryBtn->setChecked(true); +} diff --git a/src/settingsdialogworkarounds.h b/src/settingsdialogworkarounds.h new file mode 100644 index 00000000..1687624b --- /dev/null +++ b/src/settingsdialogworkarounds.h @@ -0,0 +1,25 @@ +#ifndef SETTINGSDIALOGWORKAROUNDS_H +#define SETTINGSDIALOGWORKAROUNDS_H + +#include "settings.h" +#include "settingsdialog.h" + +class WorkaroundsSettingsTab : public SettingsTab +{ +public: + WorkaroundsSettingsTab(Settings *m_parent, SettingsDialog &m_dialog); + + void update(); + +private: + QString m_ExecutableBlacklist; + + void on_bsaDateBtn_clicked(); + void on_execBlacklistBtn_clicked(); + void on_resetGeometryBtn_clicked(); + + QString getExecutableBlacklist() { return m_ExecutableBlacklist; } + void setExecutableBlacklist(QString blacklist) { m_ExecutableBlacklist = blacklist; } +}; + +#endif // SETTINGSDIALOGWORKAROUNDS_H |
