summaryrefslogtreecommitdiff
path: root/src/executableslist.cpp
diff options
context:
space:
mode:
authorTom Tanner <thosrtanner2@users.sourceforge.net>2015-08-13 22:37:33 +0100
committerTom Tanner <thosrtanner2@users.sourceforge.net>2015-08-13 22:37:33 +0100
commit821f95b8ab259f89f379c10e533c42476c56d361 (patch)
treecbe6388e85de04924a27762e87705248fe361f0d /src/executableslist.cpp
parent716dbcc97d306115df4bcd32cef717e616190ce4 (diff)
Clean up of fixes for custom executable window
Diffstat (limited to 'src/executableslist.cpp')
-rw-r--r--src/executableslist.cpp64
1 files changed, 12 insertions, 52 deletions
diff --git a/src/executableslist.cpp b/src/executableslist.cpp
index 8a16e206..7002ccc4 100644
--- a/src/executableslist.cpp
+++ b/src/executableslist.cpp
@@ -129,60 +129,24 @@ void ExecutablesList::addExecutable(const Executable &executable)
}
-void ExecutablesList::configureExecutable(const QString &title,
- const QString &executableName,
- const QString &arguments,
- const QString &workingDirectory,
- ExecutableInfo::CloseMOStyle closeMO,
- const QString &steamAppID,
- Executable::Flags flags)
+void ExecutablesList::updateExecutable(const QString &title,
+ const QString &executableName,
+ const QString &arguments,
+ const QString &workingDirectory,
+ ExecutableInfo::CloseMOStyle closeMO,
+ const QString &steamAppID,
+ Executable::Flags mask,
+ Executable::Flags flags)
{
QFileInfo file(executableName);
auto existingExe = findExe(title);
+ flags &= mask;
if (existingExe != m_Executables.end()) {
existingExe->m_Title = title;
existingExe->m_CloseMO = closeMO;
- existingExe->m_Flags = flags;
- if (flags & Executable::CustomExecutable) {
- // for pre-configured executables don't overwrite settings we didn't store
- 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 | flags;
- m_Executables.push_back(newExe);
- }
-}
-
-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;
- }
+ existingExe->m_Flags &= ~mask;
+ existingExe->m_Flags |= flags;
// for pre-configured executables don't overwrite settings we didn't store
if (existingExe->isCustom()) {
existingExe->m_BinaryInfo = file;
@@ -198,16 +162,12 @@ void ExecutablesList::updateOrAddExecutable(const QString &title,
newExe.m_Arguments = arguments;
newExe.m_WorkingDirectory = workingDirectory;
newExe.m_SteamAppID = steamAppID;
- newExe.m_Flags = Executable::CustomExecutable;
- if (usesApplicationIcon) {
- newExe.m_Flags |= Executable::UseApplicationIcon;
- }
+ newExe.m_Flags = Executable::CustomExecutable | flags;
m_Executables.push_back(newExe);
}
}
-
void ExecutablesList::remove(const QString &title)
{
for (std::vector<Executable>::iterator iter = m_Executables.begin(); iter != m_Executables.end(); ++iter) {