diff options
| author | Petr Mrázek <peterix@gmail.com> | 2013-07-29 00:59:35 +0200 |
|---|---|---|
| committer | Petr Mrázek <peterix@gmail.com> | 2013-07-29 00:59:35 +0200 |
| commit | 2e0cbf393a5320dbf5448ca44a9b5905314b0be8 (patch) | |
| tree | 4baac9cf015ca7b15d83de33c705e0d8d4497d30 /libmultimc/include | |
| parent | 8808a8b108b82916eaf30f9aca50cd3ab16af230 (diff) | |
| download | PrismLauncher-2e0cbf393a5320dbf5448ca44a9b5905314b0be8.tar.gz PrismLauncher-2e0cbf393a5320dbf5448ca44a9b5905314b0be8.tar.bz2 PrismLauncher-2e0cbf393a5320dbf5448ca44a9b5905314b0be8.zip | |
Massive renaming in the backend folder, all around restructure in the same.
Diffstat (limited to 'libmultimc/include')
| -rw-r--r-- | libmultimc/include/appsettings.h | 32 | ||||
| -rw-r--r-- | libmultimc/include/fullversion.h | 76 | ||||
| -rw-r--r-- | libmultimc/include/fullversionfactory.h | 25 | ||||
| -rw-r--r-- | libmultimc/include/gameupdatetask.h | 159 | ||||
| -rw-r--r-- | libmultimc/include/instance.h | 342 | ||||
| -rw-r--r-- | libmultimc/include/instancelist.h | 95 | ||||
| -rw-r--r-- | libmultimc/include/instanceloader.h | 82 | ||||
| -rw-r--r-- | libmultimc/include/instversion.h | 124 | ||||
| -rw-r--r-- | libmultimc/include/instversionlist.h | 124 | ||||
| -rw-r--r-- | libmultimc/include/libmmc_config.h | 27 | ||||
| -rw-r--r-- | libmultimc/include/library.h | 208 | ||||
| -rw-r--r-- | libmultimc/include/loginresponse.h | 96 | ||||
| -rw-r--r-- | libmultimc/include/logintask.h | 49 | ||||
| -rw-r--r-- | libmultimc/include/lwjglversionlist.h | 134 | ||||
| -rw-r--r-- | libmultimc/include/minecraftprocess.h | 121 | ||||
| -rw-r--r-- | libmultimc/include/minecraftversion.h | 99 | ||||
| -rw-r--r-- | libmultimc/include/minecraftversionlist.h | 109 | ||||
| -rw-r--r-- | libmultimc/include/task.h | 78 | ||||
| -rw-r--r-- | libmultimc/include/userinfo.h | 41 | ||||
| -rw-r--r-- | libmultimc/include/version.h | 69 |
20 files changed, 0 insertions, 2090 deletions
diff --git a/libmultimc/include/appsettings.h b/libmultimc/include/appsettings.h deleted file mode 100644 index 8447d58b..00000000 --- a/libmultimc/include/appsettings.h +++ /dev/null @@ -1,32 +0,0 @@ -/* Copyright 2013 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef APPSETTINGS_H -#define APPSETTINGS_H - -#include <QObject> - -#include <inisettingsobject.h> - -#include "libmmc_config.h" - -class LIBMULTIMC_EXPORT AppSettings : public INISettingsObject -{ - Q_OBJECT -public: - explicit AppSettings(QObject *parent = 0); -}; - -#endif // APPSETTINGS_H diff --git a/libmultimc/include/fullversion.h b/libmultimc/include/fullversion.h deleted file mode 100644 index 8547960f..00000000 --- a/libmultimc/include/fullversion.h +++ /dev/null @@ -1,76 +0,0 @@ -#pragma once -#include <QString> - -class Library; - -class FullVersion -{ -public: - /// the ID - determines which jar to use! ACTUALLY IMPORTANT! - QString id; - /// Last updated time - as a string - QString time; - /// Release time - as a string - QString releaseTime; - /// Release type - "release" or "snapshot" - QString type; - /** - * DEPRECATED: Old versions of the new vanilla launcher used this - * ex: "username_session_version" - */ - QString processArguments; - /** - * arguments that should be used for launching minecraft - * - * ex: "--username ${auth_player_name} --session ${auth_session} - * --version ${version_name} --gameDir ${game_directory} --assetsDir ${game_assets}" - */ - QString minecraftArguments; - /** - * the minimum launcher version required by this version ... current is 4 (at point of writing) - */ - int minimumLauncherVersion; - /** - * The main class to load first - */ - QString mainClass; - - /// the list of libs - both active and inactive, native and java - QList<QSharedPointer<Library> > libraries; - - /** - * is this actually a legacy version? if so, none of the other stuff here will be ever used. - * added by FullVersionFactory - */ - bool isLegacy; - - /* - FIXME: add support for those rules here? Looks like a pile of quick hacks to me though. - - "rules": [ - { - "action": "allow" - }, - { - "action": "disallow", - "os": { - "name": "osx", - "version": "^10\\.5\\.\\d$" - } - } - ], - "incompatibilityReason": "There is a bug in LWJGL which makes it incompatible with OSX 10.5.8. Please go to New Profile and use 1.5.2 for now. Sorry!" - } - */ - // QList<Rule> rules; - -public: - FullVersion() - { - minimumLauncherVersion = 0xDEADBEEF; - isLegacy = false; - } - - QList<QSharedPointer<Library> > getActiveNormalLibs(); - QList<QSharedPointer<Library> > getActiveNativeLibs(); -};
\ No newline at end of file diff --git a/libmultimc/include/fullversionfactory.h b/libmultimc/include/fullversionfactory.h deleted file mode 100644 index 60e5c983..00000000 --- a/libmultimc/include/fullversionfactory.h +++ /dev/null @@ -1,25 +0,0 @@ -#pragma once -#include <QtCore> - -struct FullVersion; -class Rule; - -class FullVersionFactory -{ -public: - enum Error - { - AllOK, // all parsed OK - ParseError, // the file was corrupted somehow - UnsupportedVersion // the file was meant for a launcher version we don't support (yet) - } m_error; - QString error_string; - -public: - FullVersionFactory(); - QSharedPointer<FullVersion> parse(QByteArray data); -private: - QSharedPointer<FullVersion> parse4(QJsonObject root, QSharedPointer<FullVersion> product); - QList<QSharedPointer<Rule> > parse4rules(QJsonObject & baseObj); - QStringList legacyWhitelist; -};
\ No newline at end of file diff --git a/libmultimc/include/gameupdatetask.h b/libmultimc/include/gameupdatetask.h deleted file mode 100644 index b56c448b..00000000 --- a/libmultimc/include/gameupdatetask.h +++ /dev/null @@ -1,159 +0,0 @@ -/* Copyright 2013 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef GAMEUPDATETASK_H -#define GAMEUPDATETASK_H - -#include <QObject> - -#include <QList> - -#include <QNetworkAccessManager> -#include <QUrl> -#include "dlqueue.h" - -#include "task.h" -#include "loginresponse.h" -#include "instance.h" - -#include "libmmc_config.h" - -class MinecraftVersion; - -/*! - * The game update task is the task that handles downloading instances' files. - */ -class LIBMULTIMC_EXPORT GameUpdateTask : public Task -{ - Q_OBJECT - - /*! - * The task's state. - * A certain state message will be shown depending on what this is set to. - */ - Q_PROPERTY(int state READ state WRITE setState) - - /*! - * The substatus message. - * This will be next to the the state message in the task's status. - */ - Q_PROPERTY(QString subStatus READ subStatus WRITE setSubStatus) -public: - explicit GameUpdateTask(const LoginResponse &response, Instance *inst, QObject *parent = 0); - - - ///////////////////////// - // EXECUTION FUNCTIONS // - ///////////////////////// - - virtual void executeTask(); - - ////////////////////// - // STATE AND STATUS // - ////////////////////// - - virtual int state() const; - virtual void setState(int state, bool resetSubStatus = true); - - virtual QString subStatus() const; - virtual void setSubStatus(const QString &msg); - - /*! - * Gets the message that will be displated for the given state. - */ - virtual QString getStateMessage(int state); - -private: - void getLegacyJar(); - void determineNewVersion(); - -public slots: - - /*! - * Updates the status message based on the state and substatus message. - */ - virtual void updateStatus(); - - - virtual void error(const QString &msg); - - -private slots: - void updateDownloadProgress(qint64 current, qint64 total); - void legacyJarFinished(); - void legacyJarFailed(); - - void versionFileFinished(); - void versionFileFailed(); - - void jarlibFinished(); - void jarlibFailed(); - -signals: - /*! - * \brief Signal emitted when the game update is complete. - * \param response The login response received from login task. - */ - void gameUpdateComplete(const LoginResponse &response); - - /*! - * \brief Signal emitted if an error occurrs during the update. - * \param errorMsg An error message to be displayed to the user. - */ - void gameUpdateError(const QString &errorMsg); - -private: - /////////// - // STUFF // - /////////// - - Instance *m_inst; - LoginResponse m_response; - - //////////////////////////// - // STATE AND STATUS STUFF // - //////////////////////////// - - int m_updateState; - QString m_subStatusMsg; - - enum UpdateState - { - // Initializing - StateInit = 0, - - // Determining files to download - StateDetermineURLs, - - // Downloading files - StateDownloadFiles, - - // Installing files - StateInstall, - - // Finished - StateFinished - }; - JobListPtr legacyDownloadJob; - JobListPtr specificVersionDownloadJob; - JobListPtr jarlibDownloadJob; - JobListQueue download_queue; - - // target version, determined during this task - MinecraftVersion *targetVersion; -}; - - -#endif // GAMEUPDATETASK_H diff --git a/libmultimc/include/instance.h b/libmultimc/include/instance.h deleted file mode 100644 index 36db7ffb..00000000 --- a/libmultimc/include/instance.h +++ /dev/null @@ -1,342 +0,0 @@ -/* Copyright 2013 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef INSTANCE_H -#define INSTANCE_H - -#include <QObject> -#include <QDateTime> - -#include <settingsobject.h> - -#include "inifile.h" -#include "instversionlist.h" - -#include "libmmc_config.h" - -class InstanceList; - -/*! - * \brief Base class for instances. - * This class implements many functions that are common between instances and - * provides a standard interface for all instances. - * - * To create a new instance type, create a new class inheriting from this class - * and implement the pure virtual functions. - */ -class LIBMULTIMC_EXPORT Instance : public QObject -{ - Q_OBJECT - - // Properties - /*! - * The instance's ID. - * This is a unique identifier string that is, by default, set to the - * instance's folder name. It's not always the instance's folder name, - * however, as any class deriving from Instance can override the id() - * method and change how the ID is determined. The instance's ID should - * always remain constant. Undefined behavior results if an already loaded - * instance's ID changes. - */ - Q_PROPERTY(QString id READ id STORED false) - - //! Path to the instance's root directory. - Q_PROPERTY(QString rootDir READ rootDir) - - //! The name of the instance that is displayed to the user. - Q_PROPERTY(QString name READ name WRITE setName) - - //! The instance's icon key. - Q_PROPERTY(QString iconKey READ iconKey WRITE setIconKey) - - //! The instance's notes. - Q_PROPERTY(QString notes READ notes WRITE setNotes) - - //! The instance's group. - Q_PROPERTY(QString group READ group WRITE setGroup) - - /*! - * Whether or not the instance's minecraft.jar needs to be rebuilt. - * If this is true, when the instance launches, its jar mods will be - * re-added to a fresh minecraft.jar file. - */ - Q_PROPERTY(bool shouldRebuild READ shouldRebuild WRITE setShouldRebuild) - - /*! - * Whether or not Minecraft should be downloaded when the instance is launched. - * This returns true if shouldForceUpdate game is true or if the intended and - * current versions don't match. - */ - Q_PROPERTY(bool shouldUpdate READ shouldUpdate WRITE setShouldUpdate) - - /*! - * The instance's current version. - * This value represents the instance's current version. If this value is - * different from the intendedVersion, the instance should be updated. - * \warning Don't change this value unless you know what you're doing. - */ - Q_PROPERTY(QString currentVersion READ currentVersion WRITE setCurrentVersion) - - /*! - * The version that the user has set for this instance to use. - * If this is not the same as currentVersion, the instance's game updater - * will be run on launch. - */ - Q_PROPERTY(QString intendedVersion READ intendedVersion WRITE setIntendedVersion) - - //! The version of LWJGL that this instance uses. - Q_PROPERTY(QString lwjglVersion READ lwjglVersion WRITE setLWJGLVersion) - - - /*! - * Gets the time that the instance was last launched. - * Stored in milliseconds since epoch. - * This value is usually used for things like sorting instances by the time - * they were last launched. - */ - Q_PROPERTY(qint64 lastLaunch READ lastLaunch WRITE setLastLaunch) - - /*! - * Gets the last time that the current version was checked. - * This is checked against the last modified time on the jar file to see if - * the current version needs to be checked again. - */ - Q_PROPERTY(qint64 lastCurrentVersionUpdate READ lastCurrentVersionUpdate WRITE setLastCurrentVersionUpdate) - - /*! - * Is the instance a new launcher instance? Get/Set - */ - Q_PROPERTY(bool isForNewLauncher READ isForNewLauncher WRITE setIsForNewLauncher) - - // Dirs - //! Path to the instance's .minecraft folder. - Q_PROPERTY(QString minecraftDir READ minecraftDir STORED false) - - //! Path to the instance's instMods folder. - Q_PROPERTY(QString instModsDir READ instModsDir STORED false) - - //! Path to the instance's bin folder. - Q_PROPERTY(QString binDir READ binDir STORED false) - - //! Path to the instance's saves folder. - Q_PROPERTY(QString savesDir READ savesDir STORED false) - - //! Path to the instance's mods folder (.minecraft/mods) - Q_PROPERTY(QString mlModsDir READ mlModsDir STORED false) - - //! Path to the instance's coremods folder. - Q_PROPERTY(QString coreModsDir READ coreModsDir STORED false) - - //! Path to the instance's resources folder. - Q_PROPERTY(QString resourceDir READ resourceDir STORED false) - - //! Path to the instance's screenshots folder. - Q_PROPERTY(QString screenshotsDir READ screenshotsDir STORED false) - - //! Path to the instance's texturepacks folder. - Q_PROPERTY(QString texturePacksDir READ texturePacksDir STORED false) - - - // Files - //! Path to the instance's minecraft.jar - Q_PROPERTY(QString mcJar READ mcJar STORED false) - - //! Path to the instance's mcbackup.jar - Q_PROPERTY(QString mcBackup READ mcBackup STORED false) - - //! Path to the instance's config file. - Q_PROPERTY(QString configFile READ configFile STORED false) - - //! Path to the instance's modlist file. - Q_PROPERTY(QString modListFile READ modListFile STORED false) - -public: - explicit Instance(const QString &rootDir, QObject *parent = 0); - - // Please, for the sake of my (and everyone else's) sanity, at least keep this shit - // *somewhat* organized. Also, documentation is semi-important here. Please don't - // leave undocumented stuff behind. - // As a side-note, doxygen processes comments for accessor functions and - // properties separately, so please document properties in the massive block of - // Q_PROPERTY declarations above rather than documenting their accessors. - - - //////// STUFF //////// - virtual QString id() const; - - virtual QString rootDir() const; - - /*! - * \brief Gets the instance list that this instance is a part of. - * Returns NULL if this instance is not in a list - * (the parent is not an InstanceList). - * \return A pointer to the InstanceList containing this instance. - */ - virtual InstanceList *instList() const; - - - //////// INSTANCE INFO //////// - - //// General Info //// - virtual QString name() const { return settings().get("name").toString(); } - virtual void setName(QString val) - { - settings().set("name", val); - emit propertiesChanged(this); - } - - virtual QString iconKey() const { return settings().get("iconKey").toString(); } - virtual void setIconKey(QString val) - { - settings().set("iconKey", val); - emit propertiesChanged(this); - } - - virtual QString notes() const { return settings().get("notes").toString(); } - virtual void setNotes(QString val) { settings().set("notes", val); } - - virtual QString group() const { return m_group; } - virtual void setGroup(QString val) - { - m_group = val; - emit propertiesChanged(this); - } - - virtual bool shouldRebuild() const { return settings().get("NeedsRebuild").toBool(); } - virtual void setShouldRebuild(bool val) { settings().set("NeedsRebuild", val); } - - - //// Version Stuff //// - - virtual QString currentVersion() const { return settings().get("JarVersion").toString(); } - virtual void setCurrentVersion(QString val) { settings().set("JarVersion", val); } - - virtual QString lwjglVersion() const { return settings().get("LwjglVersion").toString(); } - virtual void setLWJGLVersion(QString val) { settings().set("LwjglVersion", val); } - - virtual QString intendedVersion() const { return settings().get("IntendedJarVersion").toString(); } - virtual void setIntendedVersion(QString val) { settings().set("IntendedJarVersion", val); } - - virtual bool shouldUpdate() const - { - QVariant var = settings().get("ShouldUpdate"); - if(!var.isValid() || var.toBool() == false) - { - return intendedVersion() != currentVersion(); - } - return true; - } - virtual void setShouldUpdate(bool val) { settings().set("ShouldUpdate", val); } - - //// Timestamps //// - - virtual qint64 lastLaunch() const { return settings().get("lastLaunchTime").value<qint64>(); } - virtual void setLastLaunch(qint64 val = QDateTime::currentMSecsSinceEpoch()) - { - settings().set("lastLaunchTime", val); - emit propertiesChanged(this); - } - - virtual qint64 lastCurrentVersionUpdate() const { return settings().get("lastVersionUpdate").value<qint64>(); } - virtual void setLastCurrentVersionUpdate(qint64 val) { settings().set("lastVersionUpdate", val); } - - virtual bool isForNewLauncher() - { - return settings().get("IsForNewLauncher").value<bool>(); - } - - virtual void setIsForNewLauncher(bool value = true) - { - settings().set("IsForNewLauncher", value); - } - - ////// Directories ////// - QString minecraftDir() const; - QString instModsDir() const; - QString binDir() const; - QString savesDir() const; - QString mlModsDir() const; - QString coreModsDir() const; - QString resourceDir() const; - QString screenshotsDir() const; - QString texturePacksDir() const; - - - ////// Files ////// - QString mcJar() const; - QString mcBackup() const; - QString configFile() const; - QString modListFile() const; - - - //////// LISTS, LISTS, AND MORE LISTS //////// - /*! - * \brief Gets a pointer to this instance's version list. - * \return A pointer to the available version list for this instance. - */ - virtual InstVersionList *versionList() const; - - - //////// OTHER FUNCTIONS //////// - - //// Version System //// - - /*! - * \brief Checks whether or not the currentVersion of the instance needs to be updated. - * If this returns true, updateCurrentVersion is called. In the - * standard instance, this is determined by checking a timestamp - * stored in the instance config file against the last modified time of Minecraft.jar. - * \return True if updateCurrentVersion() should be called. - */ - virtual bool shouldUpdateCurrentVersion() const; - - /*! - * \brief Updates the current version. - * This function should first set the current version timestamp - * (setCurrentVersionTimestamp()) to the current time. Next, if - * keepCurrent is false, this function should check what the - * instance's current version is and call setCurrentVersion() to - * update it. This function will automatically be called when the - * instance is loaded if shouldUpdateCurrentVersion returns true. - * \param keepCurrent If true, only the version timestamp will be updated. - */ - virtual void updateCurrentVersion(bool keepCurrent = false); - - - //// Settings System //// - - /*! - * \brief Gets this instance's settings object. - * This settings object stores instance-specific settings. - * \return A pointer to this instance's settings object. - */ - virtual SettingsObject &settings() const; - -signals: - /*! - * \brief Signal emitted when properties relevant to the instance view change - */ - void propertiesChanged(Instance * inst); - -private: - QString m_rootDir; - QString m_group; - SettingsObject *m_settings; -}; - -// pointer for lazy people -typedef QSharedPointer<Instance> InstancePtr; - -#endif // INSTANCE_H diff --git a/libmultimc/include/instancelist.h b/libmultimc/include/instancelist.h deleted file mode 100644 index bd8d0627..00000000 --- a/libmultimc/include/instancelist.h +++ /dev/null @@ -1,95 +0,0 @@ -/* Copyright 2013 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef INSTANCELIST_H -#define INSTANCELIST_H - -#include <QObject> -#include <QSharedPointer> - -#include "instance.h" -#include "libmmc_config.h" - -class Instance; - -class LIBMULTIMC_EXPORT InstanceList : public QObject -{ - Q_OBJECT -private: - /*! - * \brief Get the instance groups - */ - void loadGroupList(QMap<QString, QString> & groupList); - -public: - explicit InstanceList(const QString &instDir, QObject *parent = 0); - - /*! - * \brief Error codes returned by functions in the InstanceList class. - * NoError Indicates that no error occurred. - * UnknownError indicates that an unspecified error occurred. - */ - enum InstListError - { - NoError = 0, - UnknownError - }; - - QString instDir() const { return m_instDir; } - - /*! - * \brief Loads the instance list. Triggers notifications. - */ - InstListError loadList(); - - /*! - * \brief Get the instance at index - */ - InstancePtr at(int i) const - { - return m_instances.at(i); - }; - - /*! - * \brief Get the count of loaded instances - */ - int count() const - { - return m_instances.count(); - }; - - /// Clear all instances. Triggers notifications. - void clear(); - - /// Add an instance. Triggers notifications, returns the new index - int add(InstancePtr t); - - /// Get an instance by ID - InstancePtr getInstanceById (QString id); - -signals: - void instanceAdded(int index); - void instanceChanged(int index); - void invalidated(); - -private slots: - void propertiesChanged(Instance * inst); - -protected: - QString m_instDir; - QList< InstancePtr > m_instances; -}; - -#endif // INSTANCELIST_H diff --git a/libmultimc/include/instanceloader.h b/libmultimc/include/instanceloader.h deleted file mode 100644 index af5bf92d..00000000 --- a/libmultimc/include/instanceloader.h +++ /dev/null @@ -1,82 +0,0 @@ -/* Copyright 2013 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef INSTANCELOADER_H -#define INSTANCELOADER_H - -#include <QObject> -#include <QMap> -#include <QList> - -#include "libmmc_config.h" - -class Instance; - -/*! - * The InstanceLoader is a singleton that manages loading and creating instances. - */ -class LIBMULTIMC_EXPORT InstanceLoader : public QObject -{ - Q_OBJECT -public: - /*! - * \brief Gets a reference to the instance loader. - */ - static InstanceLoader &get() { return loader; } - - enum InstLoadError - { - NoLoadError = 0, - UnknownLoadError, - NotAnInstance - }; - - enum InstCreateError - { - NoCreateError = 0, - UnknownCreateError, - InstExists, - CantCreateDir - }; - - /*! - * \brief Creates an instance with the given type and stores it in inst. - * - * \param inst Pointer to store the created instance in. - * \param type The type of instance to create. - * \param instDir The instance's directory. - * \return An InstCreateError error code. - * - InstExists if the given instance directory is already an instance. - * - CantCreateDir if the given instance directory cannot be created. - */ - InstCreateError createInstance(Instance *&inst, const QString &instDir); - - /*! - * \brief Loads an instance from the given directory. - * Checks the instance's INI file to figure out what the instance's type is first. - * \param inst Pointer to store the loaded instance in. - * \param instDir The instance's directory. - * \return An InstLoadError error code. - * - NotAnInstance if the given instance directory isn't a valid instance. - */ - InstLoadError loadInstance(Instance *&inst, const QString &instDir); - -private: - InstanceLoader(); - - static InstanceLoader loader; -}; - -#endif // INSTANCELOADER_H diff --git a/libmultimc/include/instversion.h b/libmultimc/include/instversion.h deleted file mode 100644 index af632939..00000000 --- a/libmultimc/include/instversion.h +++ /dev/null @@ -1,124 +0,0 @@ -/* Copyright 2013 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef INSTVERSION_H -#define INSTVERSION_H - -#include <QObject> - -#include "libmmc_config.h" - -class InstVersionList; - -/*! - * An abstract base class for instance versions. - * InstVersions hold information about versions such as their names, identifiers, - * types, etc. - */ -class LIBMULTIMC_EXPORT InstVersion : public QObject -{ - Q_OBJECT - - /*! - * A string used to identify this version in config files. - * This should be unique within the version list or shenanigans will occur. - */ - Q_PROPERTY(QString descriptor READ descriptor CONSTANT) - - /*! - * The name of this version as it is displayed to the user. - * For example: "1.5.1" - */ - Q_PROPERTY(QString name READ name) - - /*! - * The name of this version's type as it is displayed to the user. - * For example: "Latest Version", "Snapshot", or "MCNostalgia" - */ - Q_PROPERTY(QString typeName READ typeName) - - /*! - * Gets the version's timestamp. - * This is primarily used for sorting versions in a list. - */ - Q_PROPERTY(qint64 timestamp READ timestamp) - - -public: - /*! - * \brief Constructs a new InstVersion with the given parent. - * The parent *must* be the InstVersionList that contains this InstVersion. - * The InstVersion will be added to the list immediately after being created. - */ - explicit InstVersion(const QString &descriptor, - const QString &name, - qint64 timestamp, - InstVersionList *parent = 0); - - /*! - * Copy constructor. - * If the 'parent' parameter is not NULL, sets this version's parent to the - * specified object, rather than setting it to the same parent as the version - * we're copying from. - * \param other The version to copy. - * \param parent If not NULL, will be set as the new version object's parent. - */ - InstVersion(const InstVersion &other, QObject *parent = 0); - - virtual QString descriptor() const; - virtual QString name() const; - virtual QString typeName() const = 0; - virtual qint64 timestamp() const; - - virtual InstVersionList *versionList() const; - - /*! - * Creates a copy of this version with a different parent. - * \param newParent The parent QObject of the copy. - * \return A new, identical copy of this version with the given parent set. - */ - virtual InstVersion *copyVersion(InstVersionList *newParent) const = 0; - - /*! - * Checks if this version is less (older) than the given version. - * \param other The version to compare this one to. < |
