From 821f95b8ab259f89f379c10e533c42476c56d361 Mon Sep 17 00:00:00 2001 From: Tom Tanner Date: Thu, 13 Aug 2015 22:37:33 +0100 Subject: Clean up of fixes for custom executable window --- src/executableslist.cpp | 64 ++++++++++--------------------------------------- 1 file changed, 12 insertions(+), 52 deletions(-) (limited to 'src/executableslist.cpp') 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::iterator iter = m_Executables.begin(); iter != m_Executables.end(); ++iter) { -- cgit v1.3.1