summaryrefslogtreecommitdiff
path: root/src/executableslist.cpp
diff options
context:
space:
mode:
authorTom Tanner <thosrtanner2@users.sourceforge.net>2015-08-13 20:07:21 +0100
committerTom Tanner <thosrtanner2@users.sourceforge.net>2015-08-13 20:07:21 +0100
commit8e7ac4e064c51cf8bdba7b036a027bdec1f8468f (patch)
tree69a166505c7c89d9b57adefc41840ccf8afbaf40 /src/executableslist.cpp
parent9c3b390f081aff3a9777d4bb002e5c5b3bc2473e (diff)
Fix the executable configuration flags going awry from Customise window
Diffstat (limited to 'src/executableslist.cpp')
-rw-r--r--src/executableslist.cpp62
1 files changed, 53 insertions, 9 deletions
diff --git a/src/executableslist.cpp b/src/executableslist.cpp
index 76fe73d7..8a16e206 100644
--- a/src/executableslist.cpp
+++ b/src/executableslist.cpp
@@ -129,13 +129,13 @@ void ExecutablesList::addExecutable(const Executable &executable)
}
-void ExecutablesList::addExecutable(const QString &title,
- const QString &executableName,
- const QString &arguments,
- const QString &workingDirectory,
- ExecutableInfo::CloseMOStyle closeMO,
- const QString &steamAppID,
- Executable::Flags flags)
+void ExecutablesList::configureExecutable(const QString &title,
+ const QString &executableName,
+ const QString &arguments,
+ const QString &workingDirectory,
+ ExecutableInfo::CloseMOStyle closeMO,
+ const QString &steamAppID,
+ Executable::Flags flags)
{
QFileInfo file(executableName);
auto existingExe = findExe(title);
@@ -164,6 +164,49 @@ void ExecutablesList::addExecutable(const QString &title,
}
}
+void ExecutablesList::updateOrAddExecutable(const QString &title,
+ const QString &executableName,
+ const QString &arguments,
+ const QString &workingDirectory,
+ ExecutableInfo::CloseMOStyle closeMO,
+ const QString &steamAppID,
+ bool usesApplicationIcon)
+{
+ QFileInfo file(executableName);
+ auto existingExe = findExe(title);
+
+ if (existingExe != m_Executables.end()) {
+ existingExe->m_Title = title;
+ existingExe->m_CloseMO = closeMO;
+ if (usesApplicationIcon) {
+ existingExe->m_Flags |= Executable::UseApplicationIcon;
+ } else {
+ existingExe->m_Flags &= ~Executable::UseApplicationIcon;
+ }
+ // for pre-configured executables don't overwrite settings we didn't store
+ if (existingExe->isCustom()) {
+ existingExe->m_BinaryInfo = file;
+ existingExe->m_Arguments = arguments;
+ existingExe->m_WorkingDirectory = workingDirectory;
+ existingExe->m_SteamAppID = steamAppID;
+ }
+ } else {
+ Executable newExe;
+ newExe.m_Title = title;
+ newExe.m_CloseMO = closeMO;
+ newExe.m_BinaryInfo = file;
+ newExe.m_Arguments = arguments;
+ newExe.m_WorkingDirectory = workingDirectory;
+ newExe.m_SteamAppID = steamAppID;
+ newExe.m_Flags = Executable::CustomExecutable;
+ if (usesApplicationIcon) {
+ newExe.m_Flags |= Executable::UseApplicationIcon;
+ }
+ m_Executables.push_back(newExe);
+ }
+}
+
+
void ExecutablesList::remove(const QString &title)
{
@@ -197,8 +240,9 @@ void ExecutablesList::addExecutableInternal(const QString &title, const QString
void Executable::showOnToolbar(bool state)
{
- if (state)
+ if (state) {
m_Flags |= ShowInToolbar;
- else
+ } else {
m_Flags &= ~ShowInToolbar;
+ }
}