diff --git a/include/uibase/iexecutable.h b/include/uibase/iexecutable.h new file mode 100644 index 0000000..7873b10 --- /dev/null +++ b/include/uibase/iexecutable.h @@ -0,0 +1,84 @@ +/* +Mod Organizer shared UI functionality + +Copyright (C) 2012 Sebastian Herbord. All rights reserved. + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version 3 of the License, or (at your option) any later version. + +This library 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 +Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with this library; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef IEXECUTABLE_H +#define IEXECUTABLE_H + +#include +#include + +namespace MOBase +{ +class IExecutable +{ +public: // Information found in ExecutableInfo + /** + * @return the title of the executable. + */ + virtual const QString& title() const = 0; + + /** + * @return the file info of the executable binary. + */ + virtual const QFileInfo& binaryInfo() const = 0; + + /** + * @return the arguments to be passed to the executable. + * + * @note This API might be changed in the future to return a QStringList instead. + */ + virtual const QString& arguments() const = 0; + + /** + * @return the Steam App ID associated with this executable, or an empty string if + * there is none. + */ + virtual const QString& steamAppID() const = 0; + + /** + * @return the working directory for the executable. + */ + virtual const QString& workingDirectory() const = 0; + +public: // Information found in flags + /** + * @return true if the executable is shown on the toolbar. + */ + virtual bool isShownOnToolbar() const = 0; + + /** + * @return true if the executable's application icon is used for desktop shortcuts. + */ + virtual bool usesOwnIcon() const = 0; + + /** + * @return true if Mod Organizer should minimize to the system tray while this + * executable is running. + */ + virtual bool minimizeToSystemTray() const = 0; + + /** + * @return true if this executable is hidden in the user interface. + */ + virtual bool hide() const = 0; +}; +} // namespace MOBase + +#endif // IEXECUTABLE_H diff --git a/include/uibase/iexecutableslist.h b/include/uibase/iexecutableslist.h new file mode 100644 index 0000000..f8f7a3f --- /dev/null +++ b/include/uibase/iexecutableslist.h @@ -0,0 +1,75 @@ +/* +Mod Organizer shared UI functionality + +Copyright (C) 2012 Sebastian Herbord. All rights reserved. + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version 3 of the License, or (at your option) any later version. + +This library 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 +Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with this library; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef IEXECUTABLESLIST_H +#define IEXECUTABLESLIST_H + +#include +#include + +#include + +#include "iexecutable.h" + +namespace MOBase +{ +/** + * @brief Interface to the list of executables configured in Mod Organizer. + */ +class IExecutablesList +{ +public: + /** + * @brief Retrieve all configured executables. + * + * @return a generator yielding all configured executables. + */ + virtual std::generator executables() const = 0; + + /** + * @brief Retrieve an executable by its title. + * + * @param title Title of the executable to retrieve. + * + * @return the executable with the specified title, or nullptr if not found. + */ + virtual const IExecutable* getByTitle(const QString& title) const = 0; + + /** + * @brief Retrieve an executable by its binary file info. + * + * @param info File info of the executable binary to retrieve. + * + * @return the executable with the specified binary, or nullptr if not found. + */ + virtual const IExecutable* getByBinary(const QFileInfo& info) const = 0; + + /** + * @brief Check if an executable with the specified title exists. + * + * @param title Title of the executable to check. + * + * @return true if an executable with the specified title exists, false otherwise. + */ + virtual bool contains(const QString& title) const = 0; +}; +} // namespace MOBase + +#endif // IEXECUTABLESLIST_H diff --git a/include/uibase/imoinfo.h b/include/uibase/imoinfo.h index a6c9883..36233b1 100644 --- a/include/uibase/imoinfo.h +++ b/include/uibase/imoinfo.h @@ -41,6 +41,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA namespace MOBase { +class IExecutablesList; class IFileTree; class IModInterface; class IModRepositoryBridge; @@ -330,6 +331,11 @@ class QDLLEXPORT IOrganizer : public QObject */ virtual IModList* modList() const = 0; + /** + * @return interface to the list of executables + */ + virtual IExecutablesList* executablesList() const = 0; + /** * @return interface to the active profile */ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b8cedfe..ffab48a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -34,6 +34,8 @@ set(root_headers ../include/uibase/versioninfo.h ) set(interface_headers + ../include/uibase/iexecutable.h + ../include/uibase/iexecutableslist.h ../include/uibase/ifiletree.h ../include/uibase/ifiletree_utils.h ../include/uibase/iinstallationmanager.h