diff options
Diffstat (limited to 'logic')
71 files changed, 251 insertions, 112 deletions
diff --git a/logic/BaseInstaller.h b/logic/BaseInstaller.h index d4f43beb..dd804085 100644 --- a/logic/BaseInstaller.h +++ b/logic/BaseInstaller.h @@ -17,6 +17,8 @@ #include <memory> +#include "multimc_logic_export.h" + class OneSixInstance; class QDir; class QString; @@ -25,7 +27,7 @@ class Task; struct BaseVersion; typedef std::shared_ptr<BaseVersion> BaseVersionPtr; -class BaseInstaller +class MULTIMC_LOGIC_EXPORT BaseInstaller { public: BaseInstaller(); diff --git a/logic/BaseInstance.h b/logic/BaseInstance.h index 070a9838..7fbd5de5 100644 --- a/logic/BaseInstance.h +++ b/logic/BaseInstance.h @@ -28,6 +28,8 @@ #include "launch/MessageLevel.h" #include "pathmatcher/IPathMatcher.h" +#include "multimc_logic_export.h" + class QDir; class Task; class LaunchTask; @@ -44,7 +46,7 @@ typedef std::shared_ptr<BaseInstance> InstancePtr; * To create a new instance type, create a new class inheriting from this class * and implement the pure virtual functions. */ -class BaseInstance : public QObject, public std::enable_shared_from_this<BaseInstance> +class MULTIMC_LOGIC_EXPORT BaseInstance : public QObject, public std::enable_shared_from_this<BaseInstance> { Q_OBJECT protected: diff --git a/logic/BaseVersionList.h b/logic/BaseVersionList.h index ce36e286..e8d0cca7 100644 --- a/logic/BaseVersionList.h +++ b/logic/BaseVersionList.h @@ -20,8 +20,8 @@ #include <QAbstractListModel> #include "BaseVersion.h" - -class Task; +#include "tasks/Task.h" +#include "multimc_logic_export.h" /*! * \brief Class that each instance type's version list derives from. @@ -35,7 +35,7 @@ class Task; * all have a default implementation, but they can be overridden by plugins to * change the behavior of the list. */ -class BaseVersionList : public QAbstractListModel +class MULTIMC_LOGIC_EXPORT BaseVersionList : public QAbstractListModel { Q_OBJECT public: diff --git a/logic/CMakeLists.txt b/logic/CMakeLists.txt index fce89ac8..1f6b62bf 100644 --- a/logic/CMakeLists.txt +++ b/logic/CMakeLists.txt @@ -308,7 +308,9 @@ if(WIN32) endif() # Add common library -add_library(MultiMC_logic STATIC ${LOGIC_SOURCES}) +add_library(MultiMC_logic SHARED ${LOGIC_SOURCES}) + +generate_export_header(MultiMC_logic) # Use system zlib on unix and Qt ZLIB on Windows if(UNIX) @@ -328,3 +330,5 @@ target_link_libraries(MultiMC_logic xz-embedded unpack200 iconfix libUtil Logica ${ZLIB_LIBRARIES} ${MultiMC_LINK_ADDITIONAL_LIBS}) add_dependencies(MultiMC_logic QuaZIP) + +include_directories(${CMAKE_CURRENT_BINARY_DIR}) diff --git a/logic/Env.h b/logic/Env.h index a53a62cb..b81cfa62 100644 --- a/logic/Env.h +++ b/logic/Env.h @@ -4,6 +4,8 @@ #include <QString> #include <QMap> +#include "multimc_logic_export.h" + class IconList; class QNetworkAccessManager; class HttpMetaCache; @@ -15,7 +17,7 @@ class BaseVersion; #endif #define ENV (Env::getInstance()) -class Env +class MULTIMC_LOGIC_EXPORT Env { friend class MultiMC; private: diff --git a/logic/Exception.h b/logic/Exception.h index 2664910e..0dae39a0 100644 --- a/logic/Exception.h +++ b/logic/Exception.h @@ -6,7 +6,9 @@ #include <QLoggingCategory> #include <exception> -class Exception : public std::exception +#include "multimc_logic_export.h" + +class MULTIMC_LOGIC_EXPORT Exception : public std::exception { public: Exception(const QString &message) : std::exception(), m_message(message) @@ -30,12 +32,3 @@ public: private: QString m_message; }; - -#define DECLARE_EXCEPTION(name) \ - class name##Exception : public ::Exception \ - { \ - public: \ - name##Exception(const QString &message) : Exception(message) \ - { \ - } \ - } diff --git a/logic/FileSystem.h b/logic/FileSystem.h index e70f3165..a66e7ead 100644 --- a/logic/FileSystem.h +++ b/logic/FileSystem.h @@ -4,10 +4,17 @@ #include "Exception.h" +#include "multimc_logic_export.h" + namespace FS { -DECLARE_EXCEPTION(FileSystem); -void write(const QString &filename, const QByteArray &data); -QByteArray read(const QString &filename); +class MULTIMC_LOGIC_EXPORT FileSystemException : public ::Exception +{ +public: + FileSystemException(const QString &message) : Exception(message) {} +}; + +void MULTIMC_LOGIC_EXPORT write(const QString &filename, const QByteArray &data); +QByteArray MULTIMC_LOGIC_EXPORT read(const QString &filename); } diff --git a/logic/GZip.h b/logic/GZip.h index cd9f53d8..7ccf1d38 100644 --- a/logic/GZip.h +++ b/logic/GZip.h @@ -1,7 +1,9 @@ #pragma once #include <QByteArray> -class GZip +#include "multimc_logic_export.h" + +class MULTIMC_LOGIC_EXPORT GZip { public: static bool inflate(const QByteArray &compressedBytes, QByteArray &uncompressedBytes); diff --git a/logic/InstanceList.h b/logic/InstanceList.h index 07a71ffb..1799080a 100644 --- a/logic/InstanceList.h +++ b/logic/InstanceList.h @@ -21,10 +21,12 @@ #include "BaseInstance.h" +#include "multimc_logic_export.h" + class BaseInstance; class QDir; -class InstanceList : public QAbstractListModel +class MULTIMC_LOGIC_EXPORT InstanceList : public QAbstractListModel { Q_OBJECT private: diff --git a/logic/Json.h b/logic/Json.h index 55f0cfc1..f03f777a 100644 --- a/logic/Json.h +++ b/logic/Json.h @@ -16,7 +16,11 @@ namespace Json { -DECLARE_EXCEPTION(Json); +class MULTIMC_LOGIC_EXPORT JsonException : public ::Exception +{ +public: + JsonException(const QString &message) : Exception(message) {} +}; /// @throw FileSystemException void write(const QJsonDocument &doc, const QString &filename); diff --git a/logic/MMCStrings.h b/logic/MMCStrings.h index b2dd3912..5606b909 100644 --- a/logic/MMCStrings.h +++ b/logic/MMCStrings.h @@ -2,7 +2,9 @@ #include <QString> +#include "multimc_logic_export.h" + namespace Strings { - int naturalCompare(const QString &s1, const QString &s2, Qt::CaseSensitivity cs); + int MULTIMC_LOGIC_EXPORT naturalCompare(const QString &s1, const QString &s2, Qt::CaseSensitivity cs); } diff --git a/logic/MMCZip.h b/logic/MMCZip.h index 0107d7a6..a3167079 100644 --- a/logic/MMCZip.h +++ b/logic/MMCZip.h @@ -7,6 +7,8 @@ #include "SeparatorPrefixTree.h" #include <functional> +#include "multimc_logic_export.h" + class QuaZip; namespace MMCZip @@ -19,7 +21,7 @@ namespace MMCZip * \param recursive Whether to pack sub-directories as well or only files. * \return true if success, false otherwise. */ - bool compressSubDir(QuaZip *zip, QString dir, QString origDir, QSet<QString> &added, + bool MULTIMC_LOGIC_EXPORT compressSubDir(QuaZip *zip, QString dir, QString origDir, QSet<QString> &added, QString prefix = QString(), const SeparatorPrefixTree <'/'> * blacklist = nullptr); /** @@ -29,23 +31,23 @@ namespace MMCZip * \param recursive Whether to pack the subdirectories as well, or just regular files. * \return true if success, false otherwise. */ - bool compressDir(QString zipFile, QString dir, QString prefix = QString(), const SeparatorPrefixTree <'/'> * blacklist = nullptr); + bool MULTIMC_LOGIC_EXPORT compressDir(QString zipFile, QString dir, QString prefix = QString(), const SeparatorPrefixTree <'/'> * blacklist = nullptr); /// filter function for @mergeZipFiles - passthrough - bool noFilter(QString key); + bool MULTIMC_LOGIC_EXPORT noFilter(QString key); /// filter function for @mergeZipFiles - ignores METAINF - bool metaInfFilter(QString key); + bool MULTIMC_LOGIC_EXPORT metaInfFilter(QString key); /** * Merge two zip files, using a filter function */ - bool mergeZipFiles(QuaZip *into, QFileInfo from, QSet<QString> &contained, std::function<bool(QString)> filter); + bool MULTIMC_LOGIC_EXPORT mergeZipFiles(QuaZip *into, QFileInfo from, QSet<QString> &contained, std::function<bool(QString)> filter); /** * take a source jar, add mods to it, resulting in target jar */ - bool createModdedJar(QString sourceJarPath, QString targetJarPath, const QList<Mod>& mods); + bool MULTIMC_LOGIC_EXPORT createModdedJar(QString sourceJarPath, QString targetJarPath, const QList<Mod>& mods); /** * Extract a whole archive. @@ -55,5 +57,5 @@ namespace MMCZip * left empty. * \return The list of the full paths of the files extracted, empty on failure. */ - QStringList extractDir(QString fileCompressed, QString dir = QString()); + QStringList MULTIMC_LOGIC_EXPORT extractDir(QString fileCompressed, QString dir = QString()); }
\ No newline at end of file diff --git a/logic/RecursiveFileSystemWatcher.h b/logic/RecursiveFileSystemWatcher.h index a2a9e7e3..07bce0b9 100644 --- a/logic/RecursiveFileSystemWatcher.h +++ b/logic/RecursiveFileSystemWatcher.h @@ -4,7 +4,9 @@ #include <QDir> #include "pathmatcher/IPathMatcher.h" -class RecursiveFileSystemWatcher : public QObject +#include "multimc_logic_export.h" + +class MULTIMC_LOGIC_EXPORT RecursiveFileSystemWatcher : public QObject { Q_OBJECT public: diff --git a/logic/auth/AuthSession.h b/logic/auth/AuthSession.h index 2ac170fa..dede90a9 100644 --- a/logic/auth/AuthSession.h +++ b/logic/auth/AuthSession.h @@ -4,13 +4,15 @@ #include <QMultiMap> #include <memory> +#include "multimc_logic_export.h" + struct User { QString id; QMultiMap<QString, QString> properties; }; -struct AuthSession +struct MULTIMC_LOGIC_EXPORT AuthSession { bool MakeOffline(QString offline_playername); diff --git a/logic/auth/MojangAccount.h b/logic/auth/MojangAccount.h index 47ebf91b..5cf8a0f2 100644 --- a/logic/auth/MojangAccount.h +++ b/logic/auth/MojangAccount.h @@ -25,6 +25,9 @@ #include <memory> #include "AuthSession.h" +#include "multimc_logic_export.h" +MULTIMC_LOGIC_EXPORT + class Task; class YggdrasilTask; class MojangAccount; @@ -58,7 +61,7 @@ enum AccountStatus * Said information may include things such as that account's username, client token, and access * token if the user chose to stay logged in. */ -class MojangAccount : public QObject +class MULTIMC_LOGIC_EXPORT MojangAccount : public QObject { Q_OBJECT public: /* construction */ diff --git a/logic/auth/MojangAccountList.h b/logic/auth/MojangAccountList.h index b68343f2..49b71fab 100644 --- a/logic/auth/MojangAccountList.h +++ b/logic/auth/MojangAccountList.h @@ -22,6 +22,8 @@ #include "auth/MojangAccount.h" +#include "multimc_logic_export.h" + /*! * \brief List of available Mojang accounts. * This should be loaded in the background by MultiMC on startup. @@ -31,7 +33,7 @@ * all have a default implementation, but they can be overridden by subclasses to * change the behavior of the list. */ -class MojangAccountList : public QAbstractListModel +class MULTIMC_LOGIC_EXPORT MojangAccountList : public QAbstractListModel { Q_OBJECT public: @@ -126,7 +128,7 @@ public: * If the username given is an empty string, sets the active account to nothing. */ virtual void setActiveAccount(const QString &username); - + /*! * Returns true if any of the account is at least Validated */ diff --git a/logic/forge/ForgeInstaller.h b/logic/forge/ForgeInstaller.h index ae30177f..0de762b6 100644 --- a/logic/forge/ForgeInstaller.h +++ b/logic/forge/ForgeInstaller.h @@ -20,11 +20,13 @@ #include <QString> #include <memory> +#include "multimc_logic_export.h" + class MinecraftProfile; class ForgeInstallTask; struct ForgeVersion; -class ForgeInstaller : public BaseInstaller +class MULTIMC_LOGIC_EXPORT ForgeInstaller : public BaseInstaller { friend class ForgeInstallTask; public: diff --git a/logic/forge/ForgeVersionList.h b/logic/forge/ForgeVersionList.h index 35af3233..e2e8c3f8 100644 --- a/logic/forge/ForgeVersionList.h +++ b/logic/forge/ForgeVersionList.h @@ -25,7 +25,9 @@ #include "net/NetJob.h" #include "forge/ForgeVersion.h" -class ForgeVersionList : public BaseVersionList +#include "multimc_logic_export.h" + +class MULTIMC_LOGIC_EXPORT ForgeVersionList : public BaseVersionList { Q_OBJECT public: diff --git a/logic/ftb/FTBPlugin.h b/logic/ftb/FTBPlugin.h index 30913d19..6851d8a5 100644 --- a/logic/ftb/FTBPlugin.h +++ b/logic/ftb/FTBPlugin.h @@ -2,8 +2,10 @@ #include <BaseInstance.h> +#include "multimc_logic_export.h" + // Pseudo-plugin for FTB related things. Super derpy! -class FTBPlugin +class MULTIMC_LOGIC_EXPORT FTBPlugin { public: static void initialize(SettingsObjectPtr globalSettings); diff --git a/logic/icons/IconList.h b/logic/icons/IconList.h index cc2ba5c4..971db824 100644 --- a/logic/icons/IconList.h +++ b/logic/icons/IconList.h @@ -25,9 +25,11 @@ #include "settings/Setting.h" #include "Env.h" // there is a global icon list inside Env. +#include "multimc_logic_export.h" + class QFileSystemWatcher; -class IconLis |
