Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/executableslist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
14 changes: 8 additions & 6 deletions src/executableslist.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#include <QFileInfo>
#include <QMetaType>

#include <uibase/iexecutable.h>

namespace MOBase
{
class IPluginGame;
Expand All @@ -38,7 +40,7 @@ class Settings;
/*!
* @brief Information about an executable
**/
class Executable
class Executable : public MOBase::IExecutable
{
public:
enum Flag
Expand All @@ -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);
Expand Down
63 changes: 63 additions & 0 deletions src/executableslistproxy.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/*
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 <http://www.gnu.org/licenses/>.
*/

#include "executableslistproxy.h"

#include "executableslist.h"

#include <generator>
#include <stdexcept>

#include <QFileInfo>
#include <QString>

ExecutablesListProxy::ExecutablesListProxy(ExecutablesList* executablesList)
: m_Proxied(executablesList)
{}

std::generator<const MOBase::IExecutable&> ExecutablesListProxy::executables() const
{
for (const auto& exe : *m_Proxied) {
co_yield exe;
}
}

const MOBase::IExecutable* ExecutablesListProxy::getByTitle(const QString& title) const
{
try {
return &m_Proxied->get(title);
} catch (const std::runtime_error&) {
return nullptr;
}
}

const MOBase::IExecutable*
ExecutablesListProxy::getByBinary(const QFileInfo& info) const
{
try {
return &m_Proxied->getByBinary(info);
} catch (const std::runtime_error&) {
return nullptr;
}
}

bool ExecutablesListProxy::contains(const QString& title) const
{
return m_Proxied->titleExists(title);
}
46 changes: 46 additions & 0 deletions src/executableslistproxy.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
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 <http://www.gnu.org/licenses/>.
*/

#ifndef EXECUTABLESLISTPROXY_H
#define EXECUTABLESLISTPROXY_H

#include "executableslist.h"

#include <generator>

#include <QFileInfo>
#include <QString>

#include <uibase/iexecutable.h>
#include <uibase/iexecutableslist.h>

class ExecutablesListProxy : public MOBase::IExecutablesList
{
public:
ExecutablesListProxy(ExecutablesList* executablesList);
std::generator<const MOBase::IExecutable&> 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;
};

#endif // EXECUTABLESLISTPROXY_H
8 changes: 8 additions & 0 deletions src/organizerproxy.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "organizerproxy.h"

#include "downloadmanagerproxy.h"
#include "executableslistproxy.h"
#include "gamefeaturesproxy.h"
#include "glob_matching.h"
#include "instancemanager.h"
Expand Down Expand Up @@ -28,6 +29,8 @@ OrganizerProxy::OrganizerProxy(OrganizerCore* organizer,
m_DownloadManagerProxy(
std::make_unique<DownloadManagerProxy>(this, organizer->downloadManager())),
m_ModListProxy(std::make_unique<ModListProxy>(this, organizer->modList())),
m_ExecutablesListProxy(
std::make_unique<ExecutablesListProxy>(organizer->executablesList())),
m_PluginListProxy(
std::make_unique<PluginListProxy>(this, organizer->pluginList())),
m_GameFeaturesProxy(
Expand Down Expand Up @@ -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();
Expand Down
3 changes: 3 additions & 0 deletions src/organizerproxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
class GameFeaturesProxy;
class PluginContainer;
class DownloadManagerProxy;
class ExecutablesListProxy;
class ModListProxy;
class PluginListProxy;

Expand Down Expand Up @@ -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<MOBase::IProfile> profile() const override;
QStringList profileNames() const override;
std::shared_ptr<const MOBase::IProfile>
Expand Down Expand Up @@ -157,6 +159,7 @@ class OrganizerProxy : public MOBase::IOrganizer
std::unique_ptr<DownloadManagerProxy> m_DownloadManagerProxy;
std::unique_ptr<ModListProxy> m_ModListProxy;
std::unique_ptr<PluginListProxy> m_PluginListProxy;
std::unique_ptr<ExecutablesListProxy> m_ExecutablesListProxy;
std::unique_ptr<GameFeaturesProxy> m_GameFeaturesProxy;
};

Expand Down