summaryrefslogtreecommitdiff
path: root/src/executableslist.cpp
diff options
context:
space:
mode:
authorTom Tanner <thosrtanner2@users.sourceforge.net>2015-08-13 21:48:33 +0100
committerTom Tanner <thosrtanner2@users.sourceforge.net>2015-08-13 21:48:33 +0100
commit716dbcc97d306115df4bcd32cef717e616190ce4 (patch)
tree72ee314c91077c6843087f531cb646c122ef99e6 /src/executableslist.cpp
parent69a8a40b9993b791d99097549b13dee2fad0f222 (diff)
parent8e7ac4e064c51cf8bdba7b036a027bdec1f8468f (diff)
Merge
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;
+ }
}