diff options
Diffstat (limited to 'data')
-rw-r--r-- | data/appsettings.cpp | 68 | ||||
-rw-r--r-- | data/appsettings.h | 30 | ||||
-rw-r--r-- | data/loginresponse.cpp | 69 | ||||
-rw-r--r-- | data/loginresponse.h | 94 | ||||
-rw-r--r-- | data/minecraftprocess.cpp | 248 | ||||
-rw-r--r-- | data/minecraftprocess.h | 98 | ||||
-rw-r--r-- | data/plugin/pluginmanager.cpp | 105 | ||||
-rw-r--r-- | data/plugin/pluginmanager.h | 72 | ||||
-rw-r--r-- | data/userinfo.cpp | 49 | ||||
-rw-r--r-- | data/userinfo.h | 39 | ||||
-rw-r--r-- | data/version.cpp | 46 | ||||
-rw-r--r-- | data/version.h | 67 |
12 files changed, 0 insertions, 985 deletions
diff --git a/data/appsettings.cpp b/data/appsettings.cpp deleted file mode 100644 index 6b724cd9..00000000 --- a/data/appsettings.cpp +++ /dev/null @@ -1,68 +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. - */ - -#include "appsettings.h" - -#include <setting.h> - -#include <QPoint> -#include <QColor> - -AppSettings::AppSettings(QObject *parent) : - BasicSettingsObject(parent) -{ - // Updates - registerSetting(new Setting("UseDevBuilds", false)); - registerSetting(new Setting("AutoUpdate", true)); - - // Folders - registerSetting(new Setting("InstanceDir", "instances")); - registerSetting(new Setting("CentralModsDir", "mods")); - registerSetting(new Setting("LWJGLDir", "lwjgl")); - - // Console - registerSetting(new Setting("ShowConsole", true)); - registerSetting(new Setting("AutoCloseConsole", true)); - - // Toolbar settings - registerSetting(new Setting("InstanceToolbarVisible", true)); - registerSetting(new Setting("InstanceToolbarPosition", QPoint())); - - // Console Colors - registerSetting(new Setting("SysMessageColor", QColor(Qt::blue))); - registerSetting(new Setting("StdOutColor", QColor(Qt::black))); - registerSetting(new Setting("StdErrColor", QColor(Qt::red))); - - // Window Size - registerSetting(new Setting("LaunchCompatMode", false)); - registerSetting(new Setting("LaunchMaximized", false)); - registerSetting(new Setting("MinecraftWinWidth", 854)); - registerSetting(new Setting("MinecraftWinHeight", 480)); - - // Auto login - registerSetting(new Setting("AutoLogin", false)); - - // Memory - registerSetting(new Setting("MinMemAlloc", 512)); - registerSetting(new Setting("MaxMemAlloc", 1024)); - - // Java Settings - registerSetting(new Setting("JavaPath", "java")); - registerSetting(new Setting("JvmArgs", "")); - - // Custom Commands - registerSetting(new Setting("PreLaunchCommand", "")); - registerSetting(new Setting("PostExitCommand", "")); -} diff --git a/data/appsettings.h b/data/appsettings.h deleted file mode 100644 index ba4ef242..00000000 --- a/data/appsettings.h +++ /dev/null @@ -1,30 +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 <basicsettingsobject.h> - -class AppSettings : public BasicSettingsObject -{ - Q_OBJECT -public: - explicit AppSettings(QObject *parent = 0); -}; - -#endif // APPSETTINGS_H diff --git a/data/loginresponse.cpp b/data/loginresponse.cpp deleted file mode 100644 index 99a618ad..00000000 --- a/data/loginresponse.cpp +++ /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. - */ - -#include "loginresponse.h" - -LoginResponse::LoginResponse(const QString& username, const QString& sessionID, - qint64 latestVersion, QObject *parent) : - QObject(parent) -{ - this->m_username = username; - this->m_sessionID = sessionID; - this->m_latestVersion = latestVersion; -} - -LoginResponse::LoginResponse() -{ - this->m_username = ""; - this->m_sessionID = ""; - this->m_latestVersion = 0; -} - -LoginResponse::LoginResponse(const LoginResponse &other) -{ - this->m_username = other.username(); - this->m_sessionID = other.sessionID(); - this->m_latestVersion = other.latestVersion(); -} - -QString LoginResponse::username() const -{ - return m_username; -} - -void LoginResponse::setUsername(const QString& username) -{ - this->m_username = username; -} - -QString LoginResponse::sessionID() const -{ - return m_sessionID; -} - -void LoginResponse::setSessionID(const QString& sessionID) -{ - this->m_sessionID = sessionID; -} - -qint64 LoginResponse::latestVersion() const -{ - return m_latestVersion; -} - -void LoginResponse::setLatestVersion(qint64 v) -{ - this->m_latestVersion = v; -} diff --git a/data/loginresponse.h b/data/loginresponse.h deleted file mode 100644 index c30897c3..00000000 --- a/data/loginresponse.h +++ /dev/null @@ -1,94 +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> - -/*! - * \brief The LoginResponse class represents a response received from Minecraft's login servers. - */ -class 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/data/minecraftprocess.cpp b/data/minecraftprocess.cpp deleted file mode 100644 index 1eea8f82..00000000 --- a/data/minecraftprocess.cpp +++ /dev/null @@ -1,248 +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. - */ - -#include "minecraftprocess.h" - -#include <QDataStream> -#include <QFile> -#include <QDir> -#include <QImage> -#include <QProcessEnvironment> - -#include "instance.h" - -#include "osutils.h" -#include "pathutils.h" - -#define LAUNCHER_FILE "MultiMCLauncher.jar" -#define IBUS "@im=ibus" - -// commandline splitter -QStringList MinecraftProcess::splitArgs(QString args) -{ - QStringList argv; - QString current; - bool escape = false; - QChar inquotes; - for (int i=0; i<args.length(); i++) - { - QChar cchar = args.at(i); - - // \ escaped - if (escape) { - current += cchar; - escape = false; - // in "quotes" - } else if (!inquotes.isNull()) { - if (cchar == 0x5C) - escape = true; - else if (cchar == inquotes) - inquotes = 0; - else - current += cchar; - // otherwise - } else { - if (cchar == 0x20) { - if (!current.isEmpty()) { - argv << current; - current.clear(); - } - } else if (cchar == 0x22 || cchar == 0x27) - inquotes = cchar; - else - current += cchar; - } - } - if (!current.isEmpty()) - argv << current; - return argv; -} - -// prepare tools -inline void MinecraftProcess::extractIcon(InstancePtr inst, QString destination) -{ - QImage(":/icons/instances/" + inst->iconKey()).save(destination); -} - -inline void MinecraftProcess::extractLauncher(QString destination) -{ - QFile(":/launcher/launcher.jar").copy(destination); -} - -void MinecraftProcess::prepare(InstancePtr inst) -{ - extractLauncher(PathCombine(inst->minecraftDir(), LAUNCHER_FILE)); - extractIcon(inst, PathCombine(inst->minecraftDir(), "icon.png")); -} - -// constructor -MinecraftProcess::MinecraftProcess(InstancePtr inst, QString user, QString session, ConsoleWindow *console) : - m_instance(inst), m_user(user), m_session(session), m_console(console) -{ - connect(this, SIGNAL(finished(int, QProcess::ExitStatus)), SLOT(finish(int, QProcess::ExitStatus))); - - // prepare the process environment - QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); - -#ifdef LINUX - // Strip IBus - if (env.value("XMODIFIERS").contains(IBUS)) - env.insert("XMODIFIERS", env.value("XMODIFIERS").replace(IBUS, "")); -#endif - - // export some infos - env.insert("INST_NAME", inst->name()); - env.insert("INST_ID", inst->id()); - env.insert("INST_DIR", QDir(inst->rootDir()).absolutePath()); - - this->setProcessEnvironment(env); - m_prepostlaunchprocess.setProcessEnvironment(env); - - // set the cwd - QDir mcDir(inst->minecraftDir()); - this->setWorkingDirectory(mcDir.absolutePath()); - m_prepostlaunchprocess.setWorkingDirectory(mcDir.absolutePath()); - - // std channels - connect(this, SIGNAL(readyReadStandardError()), SLOT(on_stdErr())); - connect(this, SIGNAL(readyReadStandardOutput()), SLOT(on_stdOut())); -} - -// console window -void MinecraftProcess::on_stdErr() -{ - if (m_console != nullptr) - m_console->write(readAllStandardError(), ConsoleWindow::ERROR); -} - -void MinecraftProcess::on_stdOut() -{ - if (m_console != nullptr) - m_console->write(readAllStandardOutput(), ConsoleWindow::DEFAULT); -} - -void MinecraftProcess::log(QString text) -{ - if (m_console != nullptr) - m_console->write(text); - else - qDebug(qPrintable(text)); -} - -// exit handler -void MinecraftProcess::finish(int code, ExitStatus status) -{ - if (status != NormalExit) - { - //TODO: error handling - } - - log("Minecraft exited."); - - m_prepostlaunchprocess.processEnvironment().insert("INST_EXITCODE", QString(code)); - - // run post-exit - if (!m_instance->settings().get("PostExitCommand").toString().isEmpty()) - { - m_prepostlaunchprocess.start(m_instance->settings().get("PostExitCommand").toString()); - m_prepostlaunchprocess.waitForFinished(); - if (m_prepostlaunchprocess.exitStatus() != NormalExit) - { - //TODO: error handling - } - } - - if (m_console != nullptr) - m_console->setMayClose(true); - - emit ended(); -} - -void MinecraftProcess::launch() -{ - if (!m_instance->settings().get("PreLaunchCommand").toString().isEmpty()) - { - m_prepostlaunchprocess.start(m_instance->settings().get("PreLaunchCommand").toString()); - m_prepostlaunchprocess.waitForFinished(); - if (m_prepostlaunchprocess.exitStatus() != NormalExit) - { - //TODO: error handling - return; - } - } - - m_instance->setLastLaunch(); - - prepare(m_instance); - - genArgs(); - - log(QString("Minecraft folder is: '%1'").arg(workingDirectory())); - log(QString("Instance launched with arguments: '%1'").arg(m_arguments.join("' '"))); - - start(m_instance->settings().get("JavaPath").toString(), m_arguments); - if (!waitForStarted()) - { - //TODO: error handling - } - - if(m_console != nullptr) - m_console->setMayClose(false); -} - -void MinecraftProcess::genArgs() -{ - // start fresh - m_arguments.clear(); - - // window size - QString windowSize; - if (m_instance->settings().get("LaunchMaximized").toBool()) - windowSize = "max"; - else - windowSize = QString("%1x%2"). - arg(m_instance->settings().get("MinecraftWinWidth").toInt()). - arg(m_instance->settings().get("MinecraftWinHeight").toInt()); - - // window title - QString windowTitle; - windowTitle.append("MultiMC: ").append(m_instance->name()); - - // Java arguments - m_arguments.append(splitArgs(m_instance->settings().get("JvmArgs").toString())); - -#ifdef OSX - // OSX dock icon and name - m_arguments << "-Xdock:icon=icon.png"; - m_arguments << QString("-Xdock:name=\"%1\"").arg(windowTitle); -#endif - - // lwjgl - QString lwjgl = m_instance->lwjglVersion(); - if (lwjgl != "Mojang") - lwjgl = QDir(globalSettings->get("LWJGLDir").toString() + "/" + lwjgl).absolutePath(); - - // launcher arguments - m_arguments << QString("-Xms%1m").arg(m_instance->settings().get("MinMemAlloc").toInt()); - m_arguments << QString("-Xmx%1m").arg(m_instance->settings().get("MaxMemAlloc").toInt()); - m_arguments << "-jar" << LAUNCHER_FILE; - m_arguments << m_user; - m_arguments << m_session; - m_arguments << windowTitle; - m_arguments << windowSize; - m_arguments << lwjgl; -} diff --git a/data/minecraftprocess.h b/data/minecraftprocess.h deleted file mode 100644 index bede9486..00000000 --- a/data/minecraftprocess.h +++ /dev/null @@ -1,98 +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 "gui/consolewindow.h" - -#include "instance.h" - -/** - * @file data/minecraftprocess.h - * @brief The MinecraftProcess class - */ -class 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(InstancePtr inst, QString user, QString session, ConsoleWindow *console); - - /** - * @brief launch minecraft - */ - void launch(); - - /** - * @brief extract the instance icon - * @param inst the instance - * @param destination the destination path - */ - static inline void extractIcon(InstancePtr 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(InstancePtr 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(); - -protected: - ConsoleWindow *m_console; - InstancePtr m_instance; - QString m_user; - QString m_session; - QProcess m_prepostlaunchprocess; - QStringList m_arguments; - - void genArgs(); - void log(QString text); - -protected slots: - void finish(int, QProcess::ExitStatus status); - void on_stdErr(); - void on_stdOut(); - -}; - -#endif // MINECRAFTPROCESS_H diff --git a/data/plugin/pluginmanager.cpp b/data/plugin/pluginmanager.cpp deleted file mode 100644 index 2f066293..00000000 --- a/data/plugin/pluginmanager.cpp +++ /dev/null @@ -1,105 +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. - */ - -#include "pluginmanager.h" - -#include <QDir> -#include <QDirIterator> -#include <QFileInfo> -#include <QVariant> - -#include <QJsonObject> - -#include <QtPlugin> - -#include "instancetypeinterface.h" - -// MultiMC's API version. This must match the "api" field in each plugin's -// metadata or MultiMC won't consider them valid MultiMC plugin. -#define MMC_API_VERSION "MultiMC5-API-1" - -PluginManager PluginManager::manager; - -PluginManager::PluginManager() : - QObject(NULL) -{ - -} - -bool PluginManager::loadPlugins(QString pluginDir) -{ - // Delete the loaded plugins and clear the list. - for (int i = 0; i < m_plugins.count(); i++) - { - delete m_plugins[i]; - } - m_plugins.clear(); - - qDebug(QString("Loading plugins from directory: %1"). - arg(pluginDir).toUtf8()); - - QDir dir(pluginDir); - QDirIterator iter(dir); - - while (iter.hasNext()) - { - QFileInfo pluginFile(dir.absoluteFilePath(iter.next())); - - if (pluginFile.exists() && pluginFile.isFile()) - { - qDebug(QString("Attempting to load plugin: %1"). - arg(pluginFile.canonicalFilePath()).toUtf8()); - - QPluginLoader *pluginLoader = new QPluginLoader(pluginFile.absoluteFilePath()); - - QJsonObject pluginInfo = pluginLoader->metaData(); - QJsonObject pluginMetadata = pluginInfo.value("MetaData").toObject(); - - if (pluginMetadata.value("api").toString("") != MMC_API_VERSION) - { - // If "api" is not specified, it's not a MultiMC plugin. - qDebug(QString("Not loading plugin %1. Not a valid MultiMC plugin. " - "API: %2"). - arg(pluginFile.canonicalFilePath(), pluginMetadata.value("api").toString("")).toUtf8()); - continue; - } - - qDebug(QString("Loaded plugin: %1"). - arg(pluginInfo.value("IID").toString()).toUtf8()); - m_plugins.push_back(pluginLoader); - } - } - - return true; -} - -QPluginLoader *PluginManager::getPlugin(int index) -{ - return m_plugins[index]; -} - -void PluginManager::initInstanceTypes() -{ - for (int i = 0; i < m_plugins.count(); i++) - { - InstanceTypeInterface *instType = qobject_cast<InstanceTypeInterface *>(m_plugins[i]->instance()); - - if (instType) - { - // TODO: Handle errors - InstanceLoader::get().registerInstanceType(instType); - } - } -} diff --git a/data/plugin/pluginmanager.h b/data/plugin/pluginmanager.h deleted file mode 100644 index b93fd6d2..00000000 --- a/data/plugin/pluginmanager.h +++ /dev/null @@ -1,72 +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 PLUGINMANAGER_H -#define PLUGINMANAGER_H - -#include <QObject> -#include <QList> -#include <QPluginLoader> - -/*! - * \brief This class is a singleton that manages loading plugins. - */ -class PluginManager : public QObject -{ - Q_OBJECT -public: - /*! - * \brief Gets the plugin manager instance. - */ - static PluginManager &get() { return manager; } - - /*! - * \brief Loads plugins from the given directory. - * This function does \e not initialize the plugins. It simply loads their - * classes. Use the init functions to initialize the various plugin types. - * \param The directory to load plugins from. - * \return True if successful. False on failure. - */ - bool loadPlugins(QString pluginDir); - - /*! - * \brief Checks how many plugins are loaded. - * \return The number of plugins. - */ - int count() { return m_plugins.count(); } - - /*! - * \brief Gets the plugin at the given index. - * \param index The index of the plugin to get. - * \return The plugin at the given index. - */ - QPluginLoader *getPlugin(int index); - - /*! - * \brief Initializes and registers all the instance types. - * This is done by going through the plugin list and registering all of the - * plugins that derive from the InstanceTypeInterface with the InstanceLoader. - */ - void initInstanceTypes(); - -private: - PluginManager(); - - QList<QPluginLoader *> m_plugins; - - static PluginManager manager; -}; - -#endif // PLUGINMANAGER_H diff --git a/data/userinfo.cpp b/data/userinfo.cpp deleted file mode 100644 index 0bb5da11..00000000 --- a/data/userinfo.cpp +++ /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. - */ - -#include "userinfo.h" - -UserInfo::UserInfo(const QString &username, const QString &password, QObject *parent) : - QObject(parent) -{ - this->m_username = username; - this->m_password = password; -} - -UserInfo::UserInfo(const UserInfo &other) -{ - this->m_username = other.m_username; - this->m_password = other.m_password; -} - -QString UserInfo::username() const -{ - return m_username; -} - -void UserInfo::setUsername(const QString &username) -{ - this->m_username = username; -} - -QString UserInfo::password() const -{ - return m_password; -} - -void UserInfo::setPassword(const QString &password) -{ - this->m_password = password; -} diff --git a/data/userinfo.h b/data/userinfo.h deleted file mode 100644 index 486ce2a6..00000000 --- a/data/userinfo.h +++ /dev/null @@ -1,39 +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> - -class 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/data/version.cpp b/data/version.cpp deleted file mode 100644 index eec50e13..00000000 --- a/data/version.cpp +++ /dev/null @@ -1,46 +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. - */ - -#include "version.h" - -#include "config.h" - -Version Version::current(VERSION_MAJOR, VERSION_MINOR, VERSION_REVISION, VERSION_BUILD); - -Version::Version(int major, int minor, int revision, int build, QObject *parent) : - QObject(parent) -{ - this->major = major; - this->minor = minor; - this->revision = revision; - this->build = build; -} - -Version::Version(const Version& ver) -{ - this->major = ver.major; - this->minor = ver.minor; - this->revision = ver.revision; - this->build = ver.build; -} - -QString Version::toString() const -{ - return QString("%1.%2.%3.%4").arg( - QString::number(major), - QString::number(minor), - QString::number(revision), - QString::number(build)); -} diff --git a/data/version.h b/data/version.h deleted file mode 100644 index d5d276db..00000000 --- a/data/version.h +++ /dev/null @@ -1,67 +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> - -/*! - * \brief The Version class represents a MultiMC version number. - */ -class 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 |