From 06218502ed5379555eda1504e6b05f2ef6dfb292 Mon Sep 17 00:00:00 2001
From: isanae <14251494+isanae@users.noreply.github.com>
Date: Wed, 11 Sep 2019 23:34:54 -0400
Subject: fixes for ExpanderWidget removed dead code in MainWindow
---
src/settings.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
(limited to 'src/settings.h')
diff --git a/src/settings.h b/src/settings.h
index 91b87e29..815ed160 100644
--- a/src/settings.h
+++ b/src/settings.h
@@ -32,13 +32,13 @@ along with Mod Organizer. If not, see .
namespace MOBase {
class IPlugin;
class IPluginGame;
+ class ExpanderWidget;
}
class QSplitter;
class ServerList;
class Settings;
-class ExpanderWidget;
// helper class that calls restoreGeometry() in the constructor and
@@ -153,8 +153,8 @@ public:
void saveState(const QSplitter* splitter);
bool restoreState(QSplitter* splitter) const;
- void saveState(const ExpanderWidget* expander);
- bool restoreState(ExpanderWidget* expander) const;
+ void saveState(const MOBase::ExpanderWidget* expander);
+ bool restoreState(MOBase::ExpanderWidget* expander) const;
void saveVisibility(const QWidget* w);
bool restoreVisibility(QWidget* w, std::optional def={}) const;
--
cgit v1.3.1
From a5db7ed864ac58657bf9bfbbc292cdccbeeaa38b Mon Sep 17 00:00:00 2001
From: isanae <14251494+isanae@users.noreply.github.com>
Date: Thu, 19 Sep 2019 11:23:21 -0400
Subject: added Settings::isExecutableBlacklisted() moved blacklisted
confirmation to dialogs
---
src/settings.cpp | 11 +++++++++++
src/settings.h | 1 +
src/spawn.cpp | 29 ++++++++++++++++-------------
3 files changed, 28 insertions(+), 13 deletions(-)
(limited to 'src/settings.h')
diff --git a/src/settings.cpp b/src/settings.cpp
index 7fdda2bf..ae487c18 100644
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -222,6 +222,17 @@ QString Settings::executablesBlacklist() const
return get(m_Settings, "Settings", "executable_blacklist", def);
}
+bool Settings::isExecutableBlacklisted(const QString& s) const
+{
+ for (auto exec : executablesBlacklist().split(";")) {
+ if (exec.compare(s, Qt::CaseInsensitive) == 0) {
+ return true;
+ }
+ }
+
+ return false;
+}
+
void Settings::setExecutablesBlacklist(const QString& s)
{
set(m_Settings, "Settings", "executable_blacklist", s);
diff --git a/src/settings.h b/src/settings.h
index 815ed160..cd478a5b 100644
--- a/src/settings.h
+++ b/src/settings.h
@@ -678,6 +678,7 @@ public:
// by MO but given to usvfs when starting an executable
//
QString executablesBlacklist() const;
+ bool isExecutableBlacklisted(const QString& s) const;
void setExecutablesBlacklist(const QString& s);
// ? looks obsolete, only used by dead code
diff --git a/src/spawn.cpp b/src/spawn.cpp
index c9025d98..45324d79 100644
--- a/src/spawn.cpp
+++ b/src/spawn.cpp
@@ -345,6 +345,20 @@ bool eventLogNotRunning(
return (r != QDialogButtonBox::No);
}
+bool confirmBlacklisted(QWidget* parent, const SpawnParameters& sp)
+{
+ const auto r = QuestionBoxMemory::query(
+ parent, QString("blacklistedExecutable"), sp.binary.fileName(),
+ QObject::tr("Blacklisted Executable"),
+ QObject::tr("The executable you are attempted to launch is blacklisted in the virtual file"
+ " system. This will likely prevent the executable, and any executables that are"
+ " launched by this one, from seeing any mods. This could extend to INI files, save"
+ " games and any other virtualized files.\n\nContinue launching %1?").arg(sp.binary.fileName()),
+ QDialogButtonBox::Yes | QDialogButtonBox::No);
+
+ return (r != QDialogButtonBox::No);
+}
+
} // namespace
@@ -652,18 +666,8 @@ bool checkEnvironment(QWidget* parent, const SpawnParameters& sp)
bool checkBlacklist(QWidget* parent, const SpawnParameters& sp, const Settings& settings)
{
- for (auto exec : settings.executablesBlacklist().split(";")) {
- if (exec.compare(sp.binary.fileName(), Qt::CaseInsensitive) == 0) {
- if (QuestionBoxMemory::query(parent, QString("blacklistedExecutable"), sp.binary.fileName(),
- QObject::tr("Blacklisted Executable"),
- QObject::tr("The executable you are attempted to launch is blacklisted in the virtual file"
- " system. This will likely prevent the executable, and any executables that are"
- " launched by this one, from seeing any mods. This could extend to INI files, save"
- " games and any other virtualized files.\n\nContinue launching %1?").arg(sp.binary.fileName()),
- QDialogButtonBox::Yes | QDialogButtonBox::No) == QDialogButtonBox::No) {
- return false;
- }
- }
+ if (settings.isExecutableBlacklisted(sp.binary.fileName())) {
+ return dialogs::confirmBlacklisted(parent, sp);
}
return true;
@@ -779,7 +783,6 @@ bool backdateBSAs(const std::wstring &moPath, const std::wstring &dataPath)
return helperExec(moPath, commandLine, FALSE);
}
-
bool adminLaunch(const std::wstring &moPath, const std::wstring &moFile, const std::wstring &workingDir)
{
const std::wstring commandLine = fmt::format(
--
cgit v1.3.1