From c1d0047a12475f56d794bbb0034e664aec7af982 Mon Sep 17 00:00:00 2001 From: Jonathan Feenstra <26406078+JonathanFeenstra@users.noreply.github.com> Date: Sun, 18 Jan 2026 17:12:45 +0100 Subject: [PATCH 1/2] Add executables list to plugin API --- src/executableslist.cpp | 4 +++ src/executableslist.h | 14 ++++---- src/executableslistproxy.cpp | 70 ++++++++++++++++++++++++++++++++++++ src/executableslistproxy.h | 49 +++++++++++++++++++++++++ src/organizerproxy.cpp | 8 +++++ src/organizerproxy.h | 3 ++ 6 files changed, 142 insertions(+), 6 deletions(-) create mode 100644 src/executableslistproxy.cpp create mode 100644 src/executableslistproxy.h diff --git a/src/executableslist.cpp b/src/executableslist.cpp index c4563f90c..b94765fc0 100644 --- a/src/executableslist.cpp +++ b/src/executableslist.cpp @@ -364,6 +364,10 @@ void ExecutablesList::dump() const flags.push_back("hide"); } + if (e.flags() & Executable::MinimizeToSystemTray) { + flags.push_back("minimizeToSystemTray"); + } + log::debug(" . executable '{}'\n" " binary: {}\n" " arguments: {}\n" diff --git a/src/executableslist.h b/src/executableslist.h index d3d31f920..d90320b97 100644 --- a/src/executableslist.h +++ b/src/executableslist.h @@ -28,6 +28,8 @@ along with Mod Organizer. If not, see . #include #include +#include + namespace MOBase { class IPluginGame; @@ -38,7 +40,7 @@ class Settings; /*! * @brief Information about an executable **/ -class Executable +class Executable : public MOBase::IExecutable { public: enum Flag @@ -58,11 +60,11 @@ class Executable */ Executable(const MOBase::ExecutableInfo& info, Flags flags); - const QString& title() const; - const QFileInfo& binaryInfo() const; - const QString& arguments() const; - const QString& steamAppID() const; - const QString& workingDirectory() const; + const QString& title() const override; + const QFileInfo& binaryInfo() const override; + const QString& arguments() const override; + const QString& steamAppID() const override; + const QString& workingDirectory() const override; Flags flags() const; Executable& title(const QString& s); diff --git a/src/executableslistproxy.cpp b/src/executableslistproxy.cpp new file mode 100644 index 000000000..d53fdd976 --- /dev/null +++ b/src/executableslistproxy.cpp @@ -0,0 +1,70 @@ +/* +Copyright (C) 2012 Sebastian Herbord. All rights reserved. + +This file is part of Mod Organizer. + +Mod Organizer is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +Mod Organizer is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with Mod Organizer. If not, see . +*/ + +#include "executableslistproxy.h" + +#include "executableslist.h" + +#include +#include + +#include +#include + +ExecutablesListProxy::ExecutablesListProxy(ExecutablesList* executablesList) + : m_Proxied(executablesList) +{} + +std::vector> +ExecutablesListProxy::executables() const +{ + std::vector> executables; + for (const auto& exe : *m_Proxied) { + executables.emplace_back(std::make_shared(exe)); + } + + return executables; +} + +std::shared_ptr +ExecutablesListProxy::getByTitle(const QString& title) const +{ + try { + const auto& exe = m_Proxied->get(title); + return std::make_shared(exe); + } catch (const std::runtime_error&) { + return nullptr; + } +} + +std::shared_ptr +ExecutablesListProxy::getByBinary(const QFileInfo& info) const +{ + try { + const auto& exe = m_Proxied->getByBinary(info); + return std::make_shared(exe); + } catch (const std::runtime_error&) { + return nullptr; + } +} + +bool ExecutablesListProxy::titleExists(const QString& title) const +{ + return m_Proxied->titleExists(title); +} diff --git a/src/executableslistproxy.h b/src/executableslistproxy.h new file mode 100644 index 000000000..9a7f9273d --- /dev/null +++ b/src/executableslistproxy.h @@ -0,0 +1,49 @@ +/* +Copyright (C) 2012 Sebastian Herbord. All rights reserved. + +This file is part of Mod Organizer. + +Mod Organizer is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +Mod Organizer is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with Mod Organizer. If not, see . +*/ + +#ifndef EXECUTABLESLISTPROXY_H +#define EXECUTABLESLISTPROXY_H + +#include "executableslist.h" + +#include +#include + +#include +#include + +#include +#include + +class ExecutablesListProxy : public MOBase::IExecutablesList +{ +public: + ExecutablesListProxy(ExecutablesList* executablesList); + std::vector> executables() const override; + std::shared_ptr + getByTitle(const QString& title) const override; + std::shared_ptr + getByBinary(const QFileInfo& info) const override; + bool titleExists(const QString& title) const override; + +private: + ExecutablesList* m_Proxied; +}; + +#endif // EXECUTABLESLISTPROXY_H diff --git a/src/organizerproxy.cpp b/src/organizerproxy.cpp index 776f842c7..973af3d1e 100644 --- a/src/organizerproxy.cpp +++ b/src/organizerproxy.cpp @@ -1,6 +1,7 @@ #include "organizerproxy.h" #include "downloadmanagerproxy.h" +#include "executableslistproxy.h" #include "gamefeaturesproxy.h" #include "glob_matching.h" #include "instancemanager.h" @@ -28,6 +29,8 @@ OrganizerProxy::OrganizerProxy(OrganizerCore* organizer, m_DownloadManagerProxy( std::make_unique(this, organizer->downloadManager())), m_ModListProxy(std::make_unique(this, organizer->modList())), + m_ExecutablesListProxy( + std::make_unique(organizer->executablesList())), m_PluginListProxy( std::make_unique(this, organizer->pluginList())), m_GameFeaturesProxy( @@ -365,6 +368,11 @@ MOBase::IModList* OrganizerProxy::modList() const return m_ModListProxy.get(); } +MOBase::IExecutablesList* OrganizerProxy::executablesList() const +{ + return m_ExecutablesListProxy.get(); +} + MOBase::IGameFeatures* OrganizerProxy::gameFeatures() const { return m_GameFeaturesProxy.get(); diff --git a/src/organizerproxy.h b/src/organizerproxy.h index f5e87046d..8382bd24d 100644 --- a/src/organizerproxy.h +++ b/src/organizerproxy.h @@ -11,6 +11,7 @@ class GameFeaturesProxy; class PluginContainer; class DownloadManagerProxy; +class ExecutablesListProxy; class ModListProxy; class PluginListProxy; @@ -65,6 +66,7 @@ class OrganizerProxy : public MOBase::IOrganizer MOBase::IDownloadManager* downloadManager() const override; MOBase::IPluginList* pluginList() const override; MOBase::IModList* modList() const override; + MOBase::IExecutablesList* executablesList() const override; std::shared_ptr profile() const override; QStringList profileNames() const override; std::shared_ptr @@ -157,6 +159,7 @@ class OrganizerProxy : public MOBase::IOrganizer std::unique_ptr m_DownloadManagerProxy; std::unique_ptr m_ModListProxy; std::unique_ptr m_PluginListProxy; + std::unique_ptr m_ExecutablesListProxy; std::unique_ptr m_GameFeaturesProxy; }; From f68b7ef3ef4e32915ba14e50b17203dfcbe83306 Mon Sep 17 00:00:00 2001 From: Jonathan Feenstra <26406078+JonathanFeenstra@users.noreply.github.com> Date: Sat, 24 Jan 2026 19:43:20 +0100 Subject: [PATCH 2/2] WIP --- src/executableslistproxy.cpp | 25 +++++++++---------------- src/executableslistproxy.h | 13 +++++-------- 2 files changed, 14 insertions(+), 24 deletions(-) diff --git a/src/executableslistproxy.cpp b/src/executableslistproxy.cpp index d53fdd976..034c377db 100644 --- a/src/executableslistproxy.cpp +++ b/src/executableslistproxy.cpp @@ -21,8 +21,8 @@ along with Mod Organizer. If not, see . #include "executableslist.h" -#include -#include +#include +#include #include #include @@ -31,40 +31,33 @@ ExecutablesListProxy::ExecutablesListProxy(ExecutablesList* executablesList) : m_Proxied(executablesList) {} -std::vector> -ExecutablesListProxy::executables() const +std::generator ExecutablesListProxy::executables() const { - std::vector> executables; for (const auto& exe : *m_Proxied) { - executables.emplace_back(std::make_shared(exe)); + co_yield exe; } - - return executables; } -std::shared_ptr -ExecutablesListProxy::getByTitle(const QString& title) const +const MOBase::IExecutable* ExecutablesListProxy::getByTitle(const QString& title) const { try { - const auto& exe = m_Proxied->get(title); - return std::make_shared(exe); + return &m_Proxied->get(title); } catch (const std::runtime_error&) { return nullptr; } } -std::shared_ptr +const MOBase::IExecutable* ExecutablesListProxy::getByBinary(const QFileInfo& info) const { try { - const auto& exe = m_Proxied->getByBinary(info); - return std::make_shared(exe); + return &m_Proxied->getByBinary(info); } catch (const std::runtime_error&) { return nullptr; } } -bool ExecutablesListProxy::titleExists(const QString& title) const +bool ExecutablesListProxy::contains(const QString& title) const { return m_Proxied->titleExists(title); } diff --git a/src/executableslistproxy.h b/src/executableslistproxy.h index 9a7f9273d..9bc4cf0f5 100644 --- a/src/executableslistproxy.h +++ b/src/executableslistproxy.h @@ -22,8 +22,7 @@ along with Mod Organizer. If not, see . #include "executableslist.h" -#include -#include +#include #include #include @@ -35,12 +34,10 @@ class ExecutablesListProxy : public MOBase::IExecutablesList { public: ExecutablesListProxy(ExecutablesList* executablesList); - std::vector> executables() const override; - std::shared_ptr - getByTitle(const QString& title) const override; - std::shared_ptr - getByBinary(const QFileInfo& info) const override; - bool titleExists(const QString& title) const override; + std::generator executables() const override; + const MOBase::IExecutable* getByTitle(const QString& title) const override; + const MOBase::IExecutable* getByBinary(const QFileInfo& info) const override; + bool contains(const QString& title) const override; private: ExecutablesList* m_Proxied;