NOISSUE make shared logic library ... shared

This commit is contained in:
Petr Mrázek 2015-09-05 18:46:57 +02:00
parent cd108fd029
commit 23d0bd8edd
76 changed files with 259 additions and 116 deletions

View File

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8.9)
cmake_minimum_required(VERSION 3.2.0)
string(COMPARE EQUAL "${CMAKE_SOURCE_DIR}" "${CMAKE_BUILD_DIR}" IS_IN_SOURCE_BUILD)
if(IS_IN_SOURCE_BUILD)
@ -34,8 +34,10 @@ set(CMAKE_JAVA_TARGET_OUTPUT_DIR ${PROJECT_BINARY_DIR}/jars)
######## Set compiler flags ########
include(UseCXX14)
include(Coverage)
include(GenerateExportHeader)
set(CMAKE_CXX_FLAGS " -Wall ${CMAKE_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Werror=return-type")
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
# cmake code needed for the coverity scan upload
include(Coverity)

View File

@ -323,7 +323,7 @@ if(WIN32)
set(MultiMC_LINK_ADDITIONAL_LIBS ${MultiMC_LINK_ADDITIONAL_LIBS} Qt5::WinMain)
endif(WIN32)
include_directories(../logic)
include_directories(../logic ${CMAKE_CURRENT_BINARY_DIR}/../logic)
# Qt 5 stuff
qt5_wrap_ui(MULTIMC_UI ${MULTIMC_UIS})

View File

@ -1105,6 +1105,8 @@ void MainWindow::instanceFromZipPack(QString instName, QString instGroup, QStrin
errorMsg += tr("Not an instance");
CustomMessageBox::selectable(this, tr("Error"), errorMsg, QMessageBox::Warning)->show();
return;
default:
break;
}
newInstance->setName(instName);

View File

@ -70,7 +70,7 @@ private:
private:
Ui::OtherLogsPage *ui;
QString m_path;
RecursiveFileSystemWatcher *m_watcher;
QString m_currentFile;
IPathMatcher::Ptr m_fileFilter;
RecursiveFileSystemWatcher *m_watcher;
};

View File

@ -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();

View File

@ -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:

View File

@ -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:

View File

@ -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})

View File

@ -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:

View File

@ -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) \
{ \
} \
}

View File

@ -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);
}

View File

@ -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);

View File

@ -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:

View File

@ -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);

View File

@ -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);
}

View File

@ -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());
}

View File

@ -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:

View File

@ -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);

View File

@ -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 */

View File

@ -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:

View File

@ -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:

View File

@ -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:

View File

@ -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);

View File

@ -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 IconList : public QAbstractListModel
class MULTIMC_LOGIC_EXPORT IconList : public QAbstractListModel
{
Q_OBJECT
public:

View File

@ -17,7 +17,10 @@
#include <QString>
#include <QDateTime>
#include <QIcon>
struct MMCImage
#include "multimc_logic_export.h"
struct MULTIMC_LOGIC_EXPORT MMCImage
{
QIcon icon;
QString filename;
@ -28,7 +31,7 @@ struct MMCImage
}
};
struct MMCIcon
struct MULTIMC_LOGIC_EXPORT MMCIcon
{
enum Type : unsigned
{

View File

@ -3,6 +3,8 @@
#include <QTimer>
#include <memory>
#include "multimc_logic_export.h"
class JavaChecker;
@ -20,7 +22,7 @@ struct JavaCheckResult
typedef std::shared_ptr<QProcess> QProcessPtr;
typedef std::shared_ptr<JavaChecker> JavaCheckerPtr;
class JavaChecker : public QObject
class MULTIMC_LOGIC_EXPORT JavaChecker : public QObject
{
Q_OBJECT
public:

View File

@ -27,7 +27,9 @@
#include <windows.h>
#endif
class JavaUtils : public QObject
#include "multimc_logic_export.h"
class MULTIMC_LOGIC_EXPORT JavaUtils : public QObject
{
Q_OBJECT
public:

View File

@ -22,6 +22,8 @@
#include "tasks/Task.h"
#include "java/JavaCheckerJob.h"
#include "multimc_logic_export.h"
class JavaListLoadTask;
struct JavaVersion : public BaseVersion
@ -54,7 +56,7 @@ struct JavaVersion : public BaseVersion
typedef std::shared_ptr<JavaVersion> JavaVersionPtr;
class JavaVersionList : public BaseVersionList
class MULTIMC_LOGIC_EXPORT JavaVersionList : public BaseVersionList
{
Q_OBJECT
public:

View File

@ -22,7 +22,9 @@
#include "LoggedProcess.h"
#include "LaunchStep.h"
class LaunchTask: public Task
#include "multimc_logic_export.h"
class MULTIMC_LOGIC_EXPORT LaunchTask: public Task
{
Q_OBJECT
protected:

View File

@ -57,7 +57,6 @@ void CheckJava::executeTask()
if (javaUnixTime != storedUnixTime)
{
m_JavaChecker = std::make_shared<JavaChecker>();
bool successful = false;
QString errorLog;
QString version;
emit logLine(tr("Checking Java version..."), MessageLevel::MultiMC);

View File

@ -81,8 +81,8 @@ void LaunchMinecraft::on_state(LoggedProcess::State state)
case LoggedProcess::Finished:
{
m_parent->setPid(-1);
auto exitCode = m_process.exitCode();
//FIXME: make this work again
// auto exitCode = m_process.exitCode();
// m_postlaunchprocess.processEnvironment().insert("INST_EXITCODE", QString(exitCode));
// run post-exit
emitSucceeded();

View File

@ -19,7 +19,13 @@
#include <launch/LoggedProcess.h>
#include <java/JavaChecker.h>
class TextPrint: public LaunchStep
#include "multimc_logic_export.h"
/*
* FIXME: maybe do not export
*/
class MULTIMC_LOGIC_EXPORT TextPrint: public LaunchStep
{
Q_OBJECT
public:

View File

@ -21,7 +21,9 @@
#include "BaseInstaller.h"
#include "liteloader/LiteLoaderVersionList.h"
class LiteLoaderInstaller : public BaseInstaller
#include "multimc_logic_export.h"
class MULTIMC_LOGIC_EXPORT LiteLoaderInstaller : public BaseInstaller
{
public:
LiteLoaderInstaller();

View File

@ -25,6 +25,8 @@
#include "net/NetJob.h"
#include <minecraft/RawLibrary.h>
#include "multimc_logic_export.h"
class LLListLoadTask;
class QNetworkReply;
@ -65,7 +67,7 @@ public:
};
typedef std::shared_ptr<LiteLoaderVersion> LiteLoaderVersionPtr;
class LiteLoaderVersionList : public BaseVersionList
class MULTIMC_LOGIC_EXPORT LiteLoaderVersionList : public BaseVersionList
{
Q_OBJECT
public:

View File

@ -17,10 +17,12 @@
#include "minecraft/MinecraftInstance.h"
#include "multimc_logic_export.h"
class ModList;
class Task;
class LegacyInstance : public MinecraftInstance
class MULTIMC_LOGIC_EXPORT LegacyInstance : public MinecraftInstance
{
Q_OBJECT
public:

View File

@ -24,10 +24,12 @@
#include "BaseVersion.h"
#include "BaseVersionList.h"
#include "multimc_logic_export.h"
class LWJGLVersion;
typedef std::shared_ptr<LWJGLVersion> PtrLWJGLVersion;
class LWJGLVersion : public BaseVersion
class MULTIMC_LOGIC_EXPORT LWJGLVersion : public BaseVersion
{
public:
LWJGLVersion(const QString &name, const QString &url)
@ -60,7 +62,7 @@ protected:
QString m_url;
};
class LWJGLVersionList : public BaseVersionList
class MULTIMC_LOGIC_EXPORT LWJGLVersionList : public BaseVersionList
{
Q_OBJECT
public:

View File

@ -3,9 +3,11 @@
#include "minecraft/Mod.h"
#include <QProcess>
#include "multimc_logic_export.h"
class ModList;
class MinecraftInstance: public BaseInstance
class MULTIMC_LOGIC_EXPORT MinecraftInstance: public BaseInstance
{
public:
MinecraftInstance(SettingsObjectPtr globalSettings, SettingsObjectPtr settings, const QString &rootDir);

View File

@ -25,10 +25,13 @@
#include "VersionFile.h"
#include "JarMod.h"
#include "multimc_logic_export.h"
class ProfileStrategy;
class OneSixInstance;
class MinecraftProfile : public QAbstractListModel
class MULTIMC_LOGIC_EXPORT MinecraftProfile : public QAbstractListModel
{
Q_OBJECT
friend class ProfileStrategy;

View File

@ -24,11 +24,13 @@
#include "VersionFile.h"
#include "VersionSource.h"
#include "multimc_logic_export.h"
class MinecraftProfile;
class MinecraftVersion;
typedef std::shared_ptr<MinecraftVersion> MinecraftVersionPtr;
class MinecraftVersion : public BaseVersion, public ProfilePatch
class MULTIMC_LOGIC_EXPORT MinecraftVersion : public BaseVersion, public ProfilePatch
{
public: /* methods */
bool usesLegacyLauncher();

View File

@ -24,10 +24,12 @@
#include "minecraft/MinecraftVersion.h"
#include <net/NetJob.h>
#include "multimc_logic_export.h"
class MCVListLoadTask;
class MCVListVersionUpdateTask;
class MinecraftVersionList : public BaseVersionList
class MULTIMC_LOGIC_EXPORT MinecraftVersionList : public BaseVersionList
{
Q_OBJECT
private:

View File

@ -22,6 +22,8 @@
#include "minecraft/Mod.h"
#include "multimc_logic_export.h"
class LegacyInstance;
class BaseInstance;
class QFileSystemWatcher;
@ -30,7 +32,7 @@ class QFileSystemWatcher;
* A legacy mod list.
* Backed by a folder.
*/
class ModList : public QAbstractListModel
class MULTIMC_LOGIC_EXPORT ModList : public QAbstractListModel
{
Q_OBJECT
public:

View File

@ -292,7 +292,7 @@ std::shared_ptr<Task> OneSixInstance::createJarModdingTask()
class JarModTask : public Task
{
public:
explicit JarModTask(std::shared_ptr<OneSixInstance> inst) : m_inst(inst), Task(nullptr)
explicit JarModTask(std::shared_ptr<OneSixInstance> inst) : Task(nullptr), m_inst(inst)
{
}
virtual void executeTask()

View File

@ -20,7 +20,9 @@
#include "minecraft/MinecraftProfile.h"
#include "minecraft/ModList.h"
class OneSixInstance : public MinecraftInstance
#include "multimc_logic_export.h"
class MULTIMC_LOGIC_EXPORT OneSixInstance : public MinecraftInstance
{
Q_OBJECT
public:

View File

@ -17,7 +17,9 @@
#include <QPixmap>
#include "multimc_logic_export.h"
namespace SkinUtils
{
QPixmap getFaceFromCache(QString username, int height = 64, int width = 64);
QPixmap MULTIMC_LOGIC_EXPORT getFaceFromCache(QString username, int height = 64, int width = 64);
}

View File

@ -4,6 +4,8 @@
#include <QSet>
#include <QDateTime>
#include "multimc_logic_export.h"
struct FMLlib
{
QString filename;
@ -29,4 +31,4 @@ struct VersionFilterData
// Currently discouraged java version (anything equal and above will be discouraged)
QString discouragedJavaVersion;
};
extern VersionFilterData g_VersionFilterData;
extern VersionFilterData MULTIMC_LOGIC_EXPORT g_VersionFilterData;

View File

@ -16,8 +16,10 @@
#pragma once
#include "NetAction.h"
#include "multimc_logic_export.h"
typedef std::shared_ptr<class ByteArrayDownload> ByteArrayDownloadPtr;
class ByteArrayDownload : public NetAction
class MULTIMC_LOGIC_EXPORT ByteArrayDownload : public NetAction
{
Q_OBJECT
public:

View File

@ -20,19 +20,22 @@
#include <QCryptographicHash>
#include <QSaveFile>
class INetworkValidator
#include "multimc_logic_export.h"
/* FIXME: move to its own file(s) */
class MULTIMC_LOGIC_EXPORT INetworkValidator
{
public:
virtual ~INetworkValidator() {}
virtual void validate(const QByteArray &data) = 0;
};
class JsonValidator : public INetworkValidator
class MULTIMC_LOGIC_EXPORT JsonValidator : public INetworkValidator
{
public:
void validate(const QByteArray &data) override;
};
class MD5HashValidator : public INetworkValidator
class MULTIMC_LOGIC_EXPORT MD5HashValidator : public INetworkValidator
{
public:
explicit MD5HashValidator(const QByteArray &expected)
@ -44,7 +47,7 @@ private:
};
typedef std::shared_ptr<class CacheDownload> CacheDownloadPtr;
class CacheDownload : public NetAction
class MULTIMC_LOGIC_EXPORT CacheDownload : public NetAction
{
Q_OBJECT
private:

View File

@ -19,9 +19,11 @@
#include <qtimer.h>
#include <memory>
#include "multimc_logic_export.h"
class HttpMetaCache;
struct MetaEntry
struct MULTIMC_LOGIC_EXPORT MetaEntry
{
QString base;
QString path;
@ -35,7 +37,7 @@ struct MetaEntry
typedef std::shared_ptr<MetaEntry> MetaEntryPtr;
class HttpMetaCache : public QObject
class MULTIMC_LOGIC_EXPORT HttpMetaCache : public QObject
{
Q_OBJECT
public:

View File

@ -24,10 +24,12 @@
#include "tasks/Task.h"
#include "QObjectPtr.h"
#include "multimc_logic_export.h"
class NetJob;
typedef QObjectPtr<NetJob> NetJobPtr;
class NetJob : public Task
class MULTIMC_LOGIC_EXPORT NetJob : public Task
{
Q_OBJECT
public:

View File

@ -4,7 +4,9 @@
#include <QNetworkReply>
#include <memory>
class PasteUpload : public Task
#include "multimc_logic_export.h"
class MULTIMC_LOGIC_EXPORT PasteUpload : public Task
{
Q_OBJECT
public:

View File

@ -17,6 +17,8 @@
#include <QString>
#include "multimc_logic_export.h"
namespace URLConstants
{
extern const QString AWS_DOWNLOAD_BASE;
@ -26,7 +28,7 @@ extern const QString AWS_DOWNLOAD_INDEXES;
extern const QString ASSETS_BASE;
extern const QString RESOURCE_BASE;
extern const QString LIBRARY_BASE;
extern const QString SKINS_BASE;
MULTIMC_LOGIC_EXPORT extern const QString SKINS_BASE;
extern const QString AUTH_BASE;
extern const QString FORGE_LEGACY_URL;
extern const QString FORGE_GRADLE_URL;

View File

@ -23,7 +23,9 @@
#include "NewsEntry.h"
class NewsChecker : public QObject
#include "multimc_logic_export.h"
class MULTIMC_LOGIC_EXPORT NewsChecker : public QObject
{
Q_OBJECT
public:

View File

@ -5,7 +5,9 @@
#include "net/NetJob.h"
#include "net/CacheDownload.h"
class NotificationChecker : public QObject
#include "multimc_logic_export.h"
class MULTIMC_LOGIC_EXPORT NotificationChecker : public QObject
{
Q_OBJECT

View File

@ -4,7 +4,9 @@
#include "ResourceHandler.h"
class IconResourceHandler : public ResourceHandler
#include "multimc_logic_export.h"
class MULTIMC_LOGIC_EXPORT IconResourceHandler : public ResourceHandler
{
public:
explicit IconResourceHandler(const QString &key);

View File

@ -9,6 +9,8 @@
#include "ResourceObserver.h"
#include "TypeMagic.h"
#include "multimc_logic_export.h"
class ResourceHandler;
/** Frontend class for resources
@ -27,7 +29,7 @@ class ResourceHandler;
*
* @note Always pass resource around using Resource::Ptr! Copy and move constructors are disabled for a reason.
*/
class Resource : public std::enable_shared_from_this<Resource>
class MULTIMC_LOGIC_EXPORT Resource : public std::enable_shared_from_this<Resource>
{
// only allow creation from Resource::create and disallow passing around non-pointers
explicit Resource(const QString &resource);

View File

@ -3,6 +3,8 @@
#include <QVariant>
#include <memory>
#include "multimc_logic_export.h"
class Resource;
/** Base class for things that can retrieve a resource.
@ -11,7 +13,7 @@ class Resource;
* call Resource::registerHandler<MyResourceHandler>("<id>"), where <id> is the
* prefix of the resource ("web", "icon", etc.)
*/
class ResourceHandler
class MULTIMC_LOGIC_EXPORT ResourceHandler
{
public:
virtual ~ResourceHandler() {}

View File

@ -5,12 +5,13 @@
#include <QObject>
#include <QMetaProperty>
#include "multimc_logic_export.h"
class QVariant;
class Resource;
/// Base class for things that can use a resource
class ResourceObserver
class MULTIMC_LOGIC_EXPORT ResourceObserver
{
public:
virtual ~ResourceObserver();
@ -39,7 +40,7 @@ private:
*
* If no name is given an attempt to find a default property for some common classes is done.
*/
class QObjectResourceObserver : public QObject, public ResourceObserver
class MULTIMC_LOGIC_EXPORT QObjectResourceObserver : public QObject, public ResourceObserver
{
public:
explicit QObjectResourceObserver(QObject *target, const char *property = nullptr);
@ -57,7 +58,7 @@ private:
* * We need Func in order to std::forward the function
*/
template <typename Ret, typename Arg, typename Func>
class FunctionResourceObserver : public ResourceObserver
class MULTIMC_LOGIC_EXPORT FunctionResourceObserver : public ResourceObserver
{
std::function<Ret(Arg)> m_function;
public:

View File

@ -2,8 +2,10 @@
#include "net/NetAction.h"
#include "Screenshot.h"
#include "multimc_logic_export.h"
typedef std::shared_ptr<class ImgurAlbumCreation> ImgurAlbumCreationPtr;
class ImgurAlbumCreation : public NetAction
class MULTIMC_LOGIC_EXPORT ImgurAlbumCreation : public NetAction
{
public:
explicit ImgurAlbumCreation(QList<ScreenshotPtr> screenshots);

View File

@ -2,8 +2,10 @@
#include "net/NetAction.h"
#include "Screenshot.h"
#include "multimc_logic_export.h"
typedef std::shared_ptr<class ImgurUpload> ImgurUploadPtr;
class ImgurUpload : public NetAction
class MULTIMC_LOGIC_EXPORT ImgurUpload : public NetAction
{
public:
explicit ImgurUpload(ScreenshotPtr shot);

View File

@ -19,8 +19,10 @@
#include <QVariant>
#include <QIODevice>
#include "multimc_logic_export.h"
// Sectionless INI parser (for instance config files)
class INIFile : public QMap<QString, QVariant>
class MULTIMC_LOGIC_EXPORT INIFile : public QMap<QString, QVariant>
{
public:
explicit INIFile();

View File

@ -21,10 +21,12 @@
#include "settings/SettingsObject.h"
#include "multimc_logic_export.h"
/*!
* \brief A settings object that stores its settings in an INIFile.
*/
class INISettingsObject : public SettingsObject
class MULTIMC_LOGIC_EXPORT INISettingsObject : public SettingsObject
{
Q_OBJECT
public:

View File

@ -20,12 +20,14 @@
#include <QStringList>
#include <memory>
#include "multimc_logic_export.h"
class SettingsObject;
/*!
*
*/
class Setting : public QObject
class MULTIMC_LOGIC_EXPORT Setting : public QObject
{
Q_OBJECT
public:

View File

@ -21,6 +21,8 @@
#include <QVariant>
#include <memory>
#include "multimc_logic_export.h"
class Setting;
class SettingsObject;
@ -38,7 +40,7 @@ typedef std::shared_ptr<SettingsObject> SettingsObjectPtr;
*
* \sa Setting
*/
class SettingsObject : public QObject
class MULTIMC_LOGIC_EXPORT SettingsObject : public QObject
{
Q_OBJECT
public:

View File

@ -21,7 +21,9 @@
#include <net/NetJob.h>
class StatusChecker : public QObject
#include "multimc_logic_export.h"
class MULTIMC_LOGIC_EXPORT StatusChecker : public QObject
{
Q_OBJECT
public:

View File

@ -5,7 +5,9 @@
#include <QQueue>
#include <memory>
class SequentialTask : public Task
#include "multimc_logic_export.h"
class MULTIMC_LOGIC_EXPORT SequentialTask : public Task
{
Q_OBJECT
public:

View File

@ -18,7 +18,9 @@
#include <QObject>
#include <QString>
class Task : public QObject
#include "multimc_logic_export.h"
class MULTIMC_LOGIC_EXPORT Task : public QObject
{
Q_OBJECT
public:

View File

@ -3,11 +3,13 @@
#include <QObject>
#include <BaseInstance.h>
#include "multimc_logic_export.h"
class BaseInstance;
class SettingsObject;
class QProcess;
class BaseExternalTool : public QObject
class MULTIMC_LOGIC_EXPORT BaseExternalTool : public QObject
{
Q_OBJECT
public:
@ -19,7 +21,7 @@ protected:
SettingsObjectPtr globalSettings;
};
class BaseDetachedTool : public BaseExternalTool
class MULTIMC_LOGIC_EXPORT BaseDetachedTool : public BaseExternalTool
{
Q_OBJECT
public:
@ -33,7 +35,7 @@ protected:
virtual void runImpl() = 0;
};
class BaseExternalToolFactory
class MULTIMC_LOGIC_EXPORT BaseExternalToolFactory
{
public:
virtual ~BaseExternalToolFactory();
@ -51,7 +53,7 @@ protected:
SettingsObjectPtr globalSettings;
};
class BaseDetachedToolFactory : public BaseExternalToolFactory
class MULTIMC_LOGIC_EXPORT BaseDetachedToolFactory : public BaseExternalToolFactory
{
public:
virtual BaseDetachedTool *createDetachedTool(InstancePtr instance, QObject *parent = 0);

View File

@ -2,12 +2,14 @@
#include "BaseExternalTool.h"
#include "multimc_logic_export.h"
class BaseInstance;
class SettingsObject;
class LaunchTask;
class QProcess;
class BaseProfiler : public BaseExternalTool
class MULTIMC_LOGIC_EXPORT BaseProfiler : public BaseExternalTool
{
Q_OBJECT
public:
@ -29,7 +31,7 @@ signals:
void abortLaunch(const QString &message);
};
class BaseProfilerFactory : public BaseExternalToolFactory
class MULTIMC_LOGIC_EXPORT BaseProfilerFactory : public BaseExternalToolFactory
{
public:
virtual BaseProfiler *createProfiler(InstancePtr instance, QObject *parent = 0);

View File

@ -2,7 +2,9 @@
#include "BaseProfiler.h"
class JProfilerFactory : public BaseProfilerFactory
#include "multimc_logic_export.h"
class MULTIMC_LOGIC_EXPORT JProfilerFactory : public BaseProfilerFactory
{
public:
QString name() const override { return "JProfiler"; }

View File

@ -2,7 +2,9 @@
#include "BaseProfiler.h"
class JVisualVMFactory : public BaseProfilerFactory
#include "multimc_logic_export.h"
class MULTIMC_LOGIC_EXPORT JVisualVMFactory : public BaseProfilerFactory
{
public:
QString name() const override { return "JVisualVM"; }

View File

@ -2,7 +2,9 @@
#include "BaseExternalTool.h"
class MCEditTool : public BaseDetachedTool
#include "multimc_logic_export.h"
class MULTIMC_LOGIC_EXPORT MCEditTool : public BaseDetachedTool
{
Q_OBJECT
public:
@ -13,7 +15,7 @@ protected:
void runImpl() override;
};
class MCEditFactory : public BaseDetachedToolFactory
class MULTIMC_LOGIC_EXPORT MCEditFactory : public BaseDetachedToolFactory
{
public:
QString name() const override { return "MCEdit"; }

View File

@ -5,11 +5,12 @@
#include <memory>
#include <QObject>
#include <net/NetJob.h>
#include "multimc_logic_export.h"
class ByteArrayDownload;
class NetJob;
class TranslationDownloader : public QObject
class MULTIMC_LOGIC_EXPORT TranslationDownloader : public QObject
{
Q_OBJECT

View File

@ -19,13 +19,15 @@
#include "net/NetJob.h"
#include "GoUpdate.h"
#include "multimc_logic_export.h"
namespace GoUpdate
{
/*!
* The DownloadTask is a task that takes a given version ID and repository URL,
* downloads that version's files from the repository, and prepares to install them.
*/
class DownloadTask : public Task
class MULTIMC_LOGIC_EXPORT DownloadTask : public Task
{
Q_OBJECT

View File

@ -2,13 +2,15 @@
#include <QByteArray>
#include <net/NetJob.h>
#include "multimc_logic_export.h"
namespace GoUpdate
{
/**
* A temporary object exchanged between updated checker and the actual update task
*/
struct Status
struct MULTIMC_LOGIC_EXPORT Status
{
bool updateAvailable = false;
@ -25,7 +27,7 @@ struct Status
/**
* Struct that describes an entry in a VersionFileEntry's `Sources` list.
*/
struct FileSource
struct MULTIMC_LOGIC_EXPORT FileSource
{
FileSource(QString type, QString url, QString compression="")
{
@ -48,7 +50,7 @@ typedef QList<FileSource> FileSourceList;
/**
* Structure that describes an entry in a GoUpdate version's `Files` list.
*/
struct VersionFileEntry
struct MULTIMC_LOGIC_EXPORT VersionFileEntry
{
QString path;
int mode;
@ -64,7 +66,7 @@ typedef QList<VersionFileEntry> VersionFileList;
/**
* Structure that describes an operation to perform when installing updates.
*/
struct Operation
struct MULTIMC_LOGIC_EXPORT Operation
{
static Operation CopyOp(QString fsource, QString fdest, int fmode=0644)
{
@ -102,13 +104,13 @@ typedef QList<Operation> OperationList;
/**
* Loads the file list from the given version info JSON object into the given list.
*/
bool parseVersionInfo(const QByteArray &data, VersionFileList& list, QString &error);
bool MULTIMC_LOGIC_EXPORT parseVersionInfo(const QByteArray &data, VersionFileList& list, QString &error);
/*!
* Takes a list of file entries for the current version's files and the new version's files
* and populates the downloadList and operationList with information about how to download and install the update.
*/
bool processFileLists
bool MULTIMC_LOGIC_EXPORT processFileLists
(
const VersionFileList &currentVersion,
const VersionFileList &newVersion,
@ -125,7 +127,7 @@ bool processFileLists
*
* @return false if the path couldn't be fixed (is invalid)
*/
bool fixPathForOSX(QString &path);
bool MULTIMC_LOGIC_EXPORT fixPathForOSX(QString &path);
}
Q_DECLARE_METATYPE(GoUpdate::Status);

View File

@ -20,7 +20,9 @@
#include <QUrl>
class UpdateChecker : public QObject
#include "multimc_logic_export.h"
class MULTIMC_LOGIC_EXPORT UpdateChecker : public QObject
{
Q_OBJECT

View File

@ -1,7 +1,7 @@
# run the unit tests with `make test`
find_package(Qt5 COMPONENTS Test Core Network)
include_directories(../logic)
include_directories(../logic ${CMAKE_CURRENT_BINARY_DIR}/../logic)
include_directories(../depends/util/include/)
unset(MultiMC_TESTS)