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. - * \return True if this version is older than the given version. - */ - virtual bool isLessThan(const InstVersion &other) const; - - /*! - * Checks if this version is greater (newer) than the given version. - * \param other The version to compare this one to. - * \return True if this version is newer than the given version. - */ - virtual bool isGreaterThan(const InstVersion &other) const; - - /*! - * \sa shouldSortBefore() - */ - virtual bool operator<(const InstVersion &rhs) { return isLessThan(rhs); } - - /*! - * \sa shouldSortAfter() - */ - virtual bool operator>(const InstVersion &rhs) { return isGreaterThan(rhs); } - -protected: - QString m_descriptor; - QString m_name; - qint64 m_timestamp; -}; - -#endif // INSTVERSION_H diff --git a/libmultimc/include/instversionlist.h b/libmultimc/include/instversionlist.h deleted file mode 100644 index 5abfb91d..00000000 --- a/libmultimc/include/instversionlist.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 INSTVERSIONLIST_H -#define INSTVERSIONLIST_H - -#include <QObject> -#include <QVariant> -#include <QAbstractListModel> - -#include "libmmc_config.h" - -class InstVersion; -class Task; - -/*! - * \brief Class that each instance type's version list derives from. - * Version lists are the lists that keep track of the available game versions - * for that instance. This list will not be loaded on startup. It will be loaded - * when the list's load function is called. Before using the version list, you - * should check to see if it has been loaded yet and if not, load the list. - * - * Note that this class also inherits from QAbstractListModel. Methods from that - * class determine how this version list shows up in a list view. Said methods - * all have a default implementation, but they can be overridden by plugins to - * change the behavior of the list. - */ -class LIBMULTIMC_EXPORT InstVersionList : public QAbstractListModel -{ - Q_OBJECT -public: - enum ModelRoles - { - VersionPointerRole = 0x34B1CB48 - }; - - enum VListColumns - { - // First column - Name - NameColumn = 0, - - // Second column - Type - TypeColumn, - - // Third column - Timestamp - TimeColumn - }; - - explicit InstVersionList(QObject *parent = 0); - - /*! - * \brief Gets a task that will reload the version islt. - * Simply execute the task to load the list. - * The task returned by this function should reset the model when it's done. - * \return A pointer to a task that reloads the version list. - */ - virtual Task *getLoadTask() = 0; - - //! Checks whether or not the list is loaded. If this returns false, the list should be loaded. - virtual bool isLoaded() = 0; - - //! Gets the version at the given index. - virtual const InstVersion *at(int i) const = 0; - - //! Returns the number of versions in the list. - virtual int count() const = 0; - - - //////// List Model Functions //////// - virtual QVariant data(const QModelIndex &index, int role) const; - virtual QVariant headerData(int section, Qt::Orientation orientation, int role) const; - virtual int rowCount(const QModelIndex &parent) const; - virtual int columnCount(const QModelIndex &parent) const; - - - /*! - * \brief Finds a version by its descriptor. - * \param The descriptor of the version to find. - * \return A const pointer to the version with the given descriptor. NULL if - * one doesn't exist. - */ - virtual const InstVersion *findVersion(const QString &descriptor); - - /*! - * \brief Gets the latest stable version of this instance type. - * This is the version that will be selected by default. - * By default, this is simply the first version in the list. - */ - virtual const InstVersion *getLatestStable() const; - - /*! - * Sorts the version list. - */ - virtual void sort() = 0; - -protected slots: - /*! - * Updates this list with the given list of versions. - * This is done by copying each version in the given list and inserting it - * into this one. - * We need to do this so that we can set the parents of the versions are set to this - * version list. This can't be done in the load task, because the versions the load - * task creates are on the load task's thread and Qt won't allow their parents - * to be set to something created on another thread. - * To get around that problem, we invoke this method on the GUI thread, which - * then copies the versions and sets their parents correctly. - * \param versions List of versions whose parents should be set. - */ - virtual void updateListData(QList<InstVersion *> versions) = 0; -}; - -#endif // INSTVERSIONLIST_H diff --git a/libmultimc/include/libmmc_config.h b/libmultimc/include/libmmc_config.h deleted file mode 100644 index 0ff2154a..00000000 --- a/libmultimc/include/libmmc_config.h +++ /dev/null @@ -1,27 +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 LIBINSTANCE_CONFIG_H -//#define LIBINSTANCE_CONFIG_H - -#include <QtCore/QtGlobal> - -#ifdef LIBMULTIMC_LIBRARY -# define LIBMULTIMC_EXPORT Q_DECL_EXPORT -#else -# define LIBMULTIMC_EXPORT Q_DECL_IMPORT -#endif - -//#endif // LIBINSTANCE_CONFIG_H diff --git a/libmultimc/include/library.h b/libmultimc/include/library.h deleted file mode 100644 index ed377ddd..00000000 --- a/libmultimc/include/library.h +++ /dev/null @@ -1,208 +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. - */ - -#pragma once - -#include <QtCore> - -class Library; - -enum OpSys -{ - Os_Windows, - Os_Linux, - Os_OSX, - Os_Other -}; - -OpSys OpSys_fromString(QString); - -#ifdef Q_OS_MAC - #define currentSystem Os_OSX -#endif - -#ifdef Q_OS_LINUX - #define currentSystem Os_Linux -#endif - -#ifdef Q_OS_WIN32 - #define currentSystem Os_Windows -#endif - -#ifndef currentSystem - #define currentSystem Os_Other -#endif - - -enum RuleAction -{ - Allow, - Disallow, - Defer -}; - -RuleAction RuleAction_fromString(QString); - -class Rule -{ -protected: - RuleAction m_result; - virtual bool applies(Library * parent) = 0; -public: - Rule(RuleAction result) - :m_result(result) {} - virtual ~Rule(){}; - RuleAction apply(Library * parent) - { - if(applies(parent)) - return m_result; - else - return Defer; - }; -}; - -class OsRule : public Rule -{ -private: - // the OS - OpSys m_system; - // the OS version regexp - QString m_version_regexp; -protected: - virtual bool applies ( Library* ) - { - return (m_system == currentSystem); - } - OsRule(RuleAction result, OpSys system, QString version_regexp) - : Rule(result), m_system(system), m_version_regexp(version_regexp) {} -public: - static QSharedPointer<OsRule> create(RuleAction result, OpSys system, QString version_regexp) - { - return QSharedPointer<OsRule> (new OsRule(result, system, version_regexp)); - } -}; - -class ImplicitRule : public Rule -{ -protected: - virtual bool applies ( Library* ) - { - return true; - } - ImplicitRule(RuleAction result) - : Rule(result) {} -public: - static QSharedPointer<ImplicitRule> create(RuleAction result) - { - return QSharedPointer<ImplicitRule> (new ImplicitRule(result)); - } -}; - -class Library -{ -private: - // basic values used internally (so far) - QString m_name; - QString m_base_url; - QList<QSharedPointer<Rule> > m_rules; - - // derived values used for real things - /// where to store the lib locally - QString m_storage_path; - /// where to download the lib from - QString m_download_path; - /// is this lib actuall active on the current OS? - bool m_is_active; - - // native lib? - bool m_is_native; - QMap<OpSys, QString> m_native_suffixes; -public: - QStringList extract_excludes; - -public: - /// Constructor - Library(QString name) - { - m_is_native = false; - m_is_native = false; - m_name = name; - m_base_url = "https://s3.amazonaws.com/Minecraft.Download/libraries/"; - } - - /** - * finalize the library, processing the input values into derived values and state - * - * This SHALL be called after all the values are parsed or after any further change. - */ - void finalize(); - - - /** - * Set the library composite name - */ - void setName(QString name) - { - m_name = name; - } - - /** - * Set the url base for downloads - */ - void setBaseUrl(QString base_url) - { - m_base_url = base_url; - } - - /** - * Call this to mark the library as 'native' (it's a zip archive with DLLs) - */ - void setIsNative() - { - m_is_native = true; - } - - /** - * Attach a name suffix to the specified OS native - */ - void addNative(OpSys os, QString suffix) - { - m_is_native = true; - m_native_suffixes[os] = suffix; - } - - /** - * Set the load rules - */ - void setRules(QList<QSharedPointer<Rule> > rules) - { - m_rules = rules; - } - - /** - * Returns true if the library should be loaded (or extracted, in case of natives) - */ - bool getIsActive() - { - return m_is_active; - } - /** - * Returns true if the library is native - */ - bool getIsNative() - { - return m_is_native; - } -}; diff --git a/libmultimc/include/loginresponse.h b/libmultimc/include/loginresponse.h deleted file mode 100644 index 0b06a972..00000000 --- a/libmultimc/include/loginresponse.h +++ /dev/null @@ -1,96 +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 LOGINRESPONSE_H -#define LOGINRESPONSE_H - -#include <QObject> - -#include "libmmc_config.h" - -/*! - * \brief The LoginResponse class represents a response received from Minecraft's login servers. - */ -class LIBMULTIMC_EXPORT LoginResponse : public QObject -{ - Q_OBJECT -public: - /*! - * \brief Creates a new instance of the LoginResponse class. - * \param username The user's username. - * \param sessionID The user's session ID. - * \param latestVersion The latest version of Minecraft. - * \param parent The parent object. - */ - explicit LoginResponse(const QString &username, const QString &sessionID, - qint64 latestVersion, QObject *parent = 0); - LoginResponse(); - LoginResponse(const LoginResponse& other); - - /*! - * \brief Gets the username. - * This one should go without saying. - * \return The username. - * \sa setUsername() - */ - QString username() const; - - /*! - * \brief setUsername Sets the username. - * \param username The new username. - * \sa username() - */ - void setUsername(const QString& username); - - - /*! - * \brief Gets the session ID. - * \return The session ID. - * \sa setSessionID() - */ - QString sessionID() const; - - /*! - * \brief Sets the session ID. - * \param sessionID The new session ID. - * \sa sessionID() - */ - void setSessionID(const QString& sessionID); - - - /*! - * \brief Gets the latest version. - * This is a value returned by the login servers when a user logs in. - * \return The latest version. - * \sa setLatestVersion() - */ - qint64 latestVersion() const; - - /*! - * \brief Sets the latest version. - * \param v The new latest version. - * \sa latestVersion() - */ - void setLatestVersion(qint64 v); - -private: - QString m_username; - QString m_sessionID; - qint64 m_latestVersion; -}; - -Q_DECLARE_METATYPE(LoginResponse) - -#endif // LOGINRESPONSE_H diff --git a/libmultimc/include/logintask.h b/libmultimc/include/logintask.h deleted file mode 100644 index 15d715bd..00000000 --- a/libmultimc/include/logintask.h +++ /dev/null @@ -1,49 +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 LOGINTASK_H -#define LOGINTASK_H - -#include "task.h" - -#include "userinfo.h" -#include "loginresponse.h" - -#include "libmmc_config.h" - -//class QNetworkAccessManager; -class QNetworkReply; - -class LIBMULTIMC_EXPORT LoginTask : public Task -{ - Q_OBJECT -public: - explicit LoginTask(const UserInfo& uInfo, QObject *parent = 0); - -public slots: - void processNetReply(QNetworkReply* reply); - -signals: - void loginComplete(LoginResponse loginResponse); - void loginFailed(const QString& errorMsg); - -protected: - void executeTask(); - - QNetworkReply* netReply; - UserInfo uInfo; -}; - -#endif // LOGINTASK_H diff --git a/libmultimc/include/lwjglversionlist.h b/libmultimc/include/lwjglversionlist.h deleted file mode 100644 index 25b5c4c3..00000000 --- a/libmultimc/include/lwjglversionlist.h +++ /dev/null @@ -1,134 +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 LWJGLVERSIONLIST_H -#define LWJGLVERSIONLIST_H - -#include <QObject> -#include <QAbstractListModel> -#include <QSharedPointer> -#include <QUrl> - -#include <QNetworkAccessManager> -#include <QNetworkReply> - -#include "libmmc_config.h" - -class LWJGLVersion; -typedef QSharedPointer<LWJGLVersion> PtrLWJGLVersion; - -class LIBMULTIMC_EXPORT LWJGLVersion : public QObject -{ - Q_OBJECT - - /*! - * The name of the LWJGL version. - */ - Q_PROPERTY(QString name READ name) - - /*! - * The URL for this version of LWJGL. - */ - Q_PROPERTY(QUrl url READ url) - - LWJGLVersion(const QString &name, const QUrl &url, QObject *parent = 0) : - QObject(parent), m_name(name), m_url(url) { } -public: - - static PtrLWJGLVersion Create(const QString &name, const QUrl &url, QObject *parent = 0) - { - return PtrLWJGLVersion(new LWJGLVersion(name, url, parent)); - }; - - QString name() const { return m_name; } - - QUrl url() const { return m_url; } - -protected: - QString m_name; - QUrl m_url; -}; - -class LIBMULTIMC_EXPORT LWJGLVersionList : public QAbstractListModel -{ - Q_OBJECT -public: - explicit LWJGLVersionList(QObject *parent = 0); - - static LWJGLVersionList &get(); - - bool isLoaded() { return m_vlist.length() > 0; } - - const PtrLWJGLVersion getVersion(const QString &versionName); - PtrLWJGLVersion at(int index) { return m_vlist[index]; } - const PtrLWJGLVersion at(int index) const { return m_vlist[index]; } - - int count() const { return m_vlist.length(); } - - virtual QVariant data(const QModelIndex &index, int role) const; - virtual QVariant headerData(int section, Qt::Orientation orientation, int role) const; - virtual int rowCount(const QModelIndex &parent) const { return count(); } - virtual int columnCount(const QModelIndex &parent) const; - - virtual bool isLoading() const; - virtual bool errored() const { return m_errored; } - - virtual QString lastErrorMsg() const { return m_lastErrorMsg; } - -public slots: - /*! - * Loads the version list. - * This is done asynchronously. On success, the loadListFinished() signal will - * be emitted. The list model will be reset as well, resulting in the modelReset() - * signal being emitted. Note that the model will be reset before loadListFinished() is emitted. - * If loading the list failed, the loadListFailed(QString msg), - * signal will be emitted. - */ - virtual void loadList(); - -signals: - /*! - * Emitted when the list either starts or finishes loading. - * \param loading Whether or not the list is loading. - */ - void loadingStateUpdated(bool loading); - - void loadListFinished(); - - void loadListFailed(QString msg); - -private: - QList<PtrLWJGLVersion> m_vlist; - - QNetworkReply *m_netReply; - - QNetworkAccessManager netMgr; - QNetworkReply *reply; - - bool m_loading; - bool m_errored; - QString m_lastErrorMsg; - - void failed(QString msg); - - void finished(); - - void setLoading(bool loading); - -private slots: - virtual void netRequestComplete(); -}; - -#endif // LWJGLVERSIONLIST_H diff --git a/libmultimc/include/minecraftprocess.h b/libmultimc/include/minecraftprocess.h deleted file mode 100644 index eb861236..00000000 --- a/libmultimc/include/minecraftprocess.h +++ /dev/null @@ -1,121 +0,0 @@ -/* Copyright 2013 MultiMC Contributors - * - * Authors: Orochimarufan <orochimarufan.x3@gmail.com> - * - * 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 MINECRAFTPROCESS_H -#define MINECRAFTPROCESS_H - -#include <QProcess> - -#include "instance.h" - -#include "libmmc_config.h" - -/** - * @brief the MessageLevel Enum - * defines what level a message is - */ -namespace MessageLevel { -enum LIBMULTIMC_EXPORT Enum { - MultiMC, /**< MultiMC Messages */ - Debug, /**< Debug Messages */ - Info, /**< Info Messages */ - Message, /**< Standard Messages */ - Warning, /**< Warnings */ - Error, /**< Errors */ - Fatal /**< Fatal Errors */ -}; -} - -/** - * @file data/minecraftprocess.h - * @brief The MinecraftProcess class - */ -class LIBMULTIMC_EXPORT MinecraftProcess : public QProcess -{ - Q_OBJECT -public: - /** - * @brief MinecraftProcess constructor - * @param inst the Instance pointer to launch - * @param user the minecraft username - * @param session the minecraft session id - * @param console the instance console window - */ - MinecraftProcess(Instance *inst, QString user, QString session); - - /** - * @brief launch minecraft - */ - void launch(); - - /** - * @brief extract the instance icon - * @param inst the instance - * @param destination the destination path - */ - static inline void extractIcon(Instance *inst, QString destination); - - /** - * @brief extract the MultiMC launcher.jar - * @param destination the destination path - */ - static inline void extractLauncher(QString destination); - - /** - * @brief prepare the launch by extracting icon and launcher - * @param inst the instance - */ - static void prepare(Instance *inst); - - /** - * @brief split a string into argv items like a shell would do - * @param args the argument string - * @return a QStringList containing all arguments - */ - static QStringList splitArgs(QString args); - -signals: - /** - * @brief emitted when mc has finished and the PostLaunchCommand was run - */ - void ended(); - - /** - * @brief emitted when we want to log something - * @param text the text to log - * @param level the level to log at - */ - void log(QString text, MessageLevel::Enum level=MessageLevel::MultiMC); - -protected: - Instance *m_instance; - QString m_user; - QString m_session; - QString m_err_leftover; - QString m_out_leftover; - QProcess m_prepostlaunchprocess; - QStringList m_arguments; - - void genArgs(); - -protected slots: - void finish(int, QProcess::ExitStatus status); - void on_stdErr(); - void on_stdOut(); - -}; - -#endif // MINECRAFTPROCESS_H diff --git a/libmultimc/include/minecraftversion.h b/libmultimc/include/minecraftversion.h deleted file mode 100644 index 6f9b7879..00000000 --- a/libmultimc/include/minecraftversion.h +++ /dev/null @@ -1,99 +0,0 @@ -/* Copyright 2013 Andrew Okin - * - * 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 MINECRAFTVERSION_H -#define MINECRAFTVERSION_H - -#include "libmmc_config.h" - -#include "instversion.h" - -class LIBMULTIMC_EXPORT MinecraftVersion : public InstVersion -{ - Q_OBJECT - - /*! - * This version's type. Used internally to identify what kind of version this is. - */ - Q_PROPERTY(VersionType versionType READ versionType WRITE setVersionType) - - /*! - * This version's launcher. Used to identify the launcher version this is intended for. - */ - Q_PROPERTY(LauncherVersion versionType READ launcherVersion WRITE setLauncherVersion) - - /*! - * The URL that this version will be downloaded from. - */ - Q_PROPERTY(QString downloadURL READ downloadURL) - - /*! - * ETag/MD5 Used to verify the integrity of the downloaded minecraft.jar. - */ - Q_PROPERTY(QString etag READ etag) - - -public: - explicit MinecraftVersion(QString descriptor, - QString name, - qint64 timestamp, - QString dlUrl, - QString etag, - InstVersionList *parent = 0); - - static InstVersion *mcnVersion(QString rawName, QString niceName); - - enum VersionType - { - OldSnapshot, - Stable, - CurrentStable, - Snapshot, - MCNostalgia - }; - - enum LauncherVersion - { - Unknown = -1, - Legacy = 0, // the legacy launcher that's been around since ... forever - Launcher16 = 1, // current launcher as of 26/06/2013 - }; - - virtual QString descriptor() const; - virtual QString name() const; - virtual QString typeName() const; - virtual qint64 timestamp() const; - - virtual VersionType versionType() const; - virtual void setVersionType(VersionType typeName); - - virtual LauncherVersion launcherVersion() const; - virtual void setLauncherVersion(LauncherVersion launcherVersion); - - virtual QString downloadURL() const; - virtual QString etag() const; - - virtual InstVersion *copyVersion(InstVersionList *newParent) const; - -private: - QString m_dlUrl; - QString m_etag; - VersionType m_type; - LauncherVersion m_launcherVersion; - - bool m_isNewLauncherVersion; -}; - -#endif // MINECRAFTVERSION_H diff --git a/libmultimc/include/minecraftversionlist.h b/libmultimc/include/minecraftversionlist.h deleted file mode 100644 index 81d5ac2f..00000000 --- a/libmultimc/include/minecraftversionlist.h +++ /dev/null @@ -1,109 +0,0 @@ -/* Copyright 2013 Andrew Okin - * - * 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 MINECRAFTVERSIONLIST_H -#define MINECRAFTVERSIONLIST_H - -#include <QObject> - -#include <QNetworkAccessManager> - -#include <QList> - -#include "instversionlist.h" - -#include "task.h" - -#include "minecraftversion.h" - -#include "libmmc_config.h" - -class MCVListLoadTask; - -class LIBMULTIMC_EXPORT MinecraftVersionList : public InstVersionList -{ - Q_OBJECT -public: - friend class MCVListLoadTask; - - explicit MinecraftVersionList(QObject *parent = 0); - - virtual Task *getLoadTask(); - virtual bool isLoaded(); - virtual const InstVersion *at(int i) const; - virtual int count() const; - virtual void printToStdOut() const; - virtual void sort(); - - virtual InstVersion *getLatestStable() const; - - /*! - * Gets the main version list instance. - */ - static MinecraftVersionList &getMainList(); - - -protected: - QList<InstVersion *>m_vlist; - - bool m_loaded; - -protected slots: - virtual void updateListData(QList<InstVersion *> versions); -}; - -class MCVListLoadTask : public Task -{ - Q_OBJECT - -public: - explicit MCVListLoadTask(MinecraftVersionList *vlist); - ~MCVListLoadTask(); - - virtual void executeTask(); - -protected: - void setSubStatus(const QString msg = ""); - - //! Loads versions from Mojang's official version list. - bool loadFromVList(); - - //! Loads versions from assets.minecraft.net. Any duplicates are ignored. - bool loadFromAssets(); - - //! Loads versions from MCNostalgia. - bool loadMCNostalgia(); - - //! Finalizes loading by updating the version list. - bool finalize(); - - void updateStuff(); - - QNetworkAccessManager *netMgr; - - MinecraftVersionList *m_list; - QList<InstVersion *> tempList; //! < List of loaded versions - QList<InstVersion *> assetsList; //! < List of versions loaded from assets.minecraft.net - QList<InstVersion *> mcnList; //! < List of loaded MCNostalgia versions - - MinecraftVersion *m_currentStable; - - bool processedMCVListReply; - bool processedAssetsReply; - bool processedMCNReply; -}; - - -#endif // MINECRAFTVERSIONLIST_H diff --git a/libmultimc/include/task.h b/libmultimc/include/task.h deleted file mode 100644 index c8c12c02..00000000 --- a/libmultimc/include/task.h +++ /dev/null @@ -1,78 +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 TASK_H -#define TASK_H - -#include <QObject> -#include <QThread> -#include <QString> - -#include "libmmc_config.h" - -class LIBMULTIMC_EXPORT Task : public QThread -{ - Q_OBJECT -public: - explicit Task(QObject *parent = 0); - - // Starts the task. - void startTask(); - - QString getStatus() const; - int getProgress() const; - - /*! - * \brief Calculates and sets the task's progress based on the number of parts completed out of the total number to complete. - * This is essentially just shorthand for setProgress((parts / whole) * 100); - * \param parts The parts out of the whole completed. This parameter should - * be less than whole. If it is greater than whole, progress is set to 100. - * \param whole The total number of things that need to be completed. - */ - void calcProgress(int parts, int whole); - -public slots: - void setStatus(const QString& status); - void setProgress(int progress); - -signals: - void started(Task* task); - void ended(Task* task); - - void started(); - void ended(); - - - void statusChanged(Task* task, const QString& status); - void progressChanged(Task* task, int progress); - - void statusChanged(const QString& status); - void progressChanged(int progress); - -protected: - virtual void run(); - virtual void executeTask() = 0; - - virtual void emitStarted(); - virtual void emitEnded(); - - virtual void emitStatusChange(const QString &status); - virtual void emitProgressChange(int progress); - - QString status; - int progress; -}; - -#endif // TASK_H diff --git a/libmultimc/include/userinfo.h b/libmultimc/include/userinfo.h deleted file mode 100644 index 280f98de..00000000 --- a/libmultimc/include/userinfo.h +++ /dev/null @@ -1,41 +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 USERINFO_H -#define USERINFO_H - -#include <QObject> - -#include "libmmc_config.h" - -class LIBMULTIMC_EXPORT UserInfo : public QObject -{ - Q_OBJECT -public: - explicit UserInfo(const QString& username, const QString& password, QObject *parent = 0); - explicit UserInfo(const UserInfo& other); - - QString username() const; - void setUsername(const QString& username); - - QString password() const; - void setPassword(const QString& password); - -protected: - QString m_username; - QString m_password; -}; - -#endif // USERINFO_H diff --git a/libmultimc/include/version.h b/libmultimc/include/version.h deleted file mode 100644 index 3025260b..00000000 --- a/libmultimc/include/version.h +++ /dev/null @@ -1,69 +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 VERSION_H -#define VERSION_H - -#include <QObject> - -#include "libmmc_config.h" - -/*! - * \brief The Version class represents a MultiMC version number. - */ -class LIBMULTIMC_EXPORT Version : public QObject -{ - Q_OBJECT -public: - explicit Version(int major = 0, int minor = 0, int revision = 0, - int build = 0, QObject *parent = 0); - - Version(const Version& ver); - - /*! - * \brief Converts the Version to a string. - * \return The version number in string format (major.minor.revision.build). - */ - QString toString() const; - - /*! - * \brief The major version number. - * For MultiMC 5, this will always be 5. - */ - int major; - - /*! - * \brief The minor version number. - * This number is incremented when major features are added. - */ - int minor; - - /*! - * \brief The revision number. - * This number is incremented for bugfixes and small features. - */ - int revision; - - /*! - * \brief The build number. - * This number is automatically set by Jenkins. It is incremented every time - * a new build is run. - */ - int build; - - static Version current; -}; - -#endif // VERSION_H |