summaryrefslogtreecommitdiffstats
path: root/data
diff options
context:
space:
mode:
Diffstat (limited to 'data')
-rw-r--r--data/appsettings.cpp70
-rw-r--r--data/appsettings.h32
-rw-r--r--data/loginresponse.cpp36
-rw-r--r--data/loginresponse.h59
-rw-r--r--data/userinfo.cpp20
-rw-r--r--data/userinfo.h8
-rw-r--r--data/version.h27
7 files changed, 214 insertions, 38 deletions
diff --git a/data/appsettings.cpp b/data/appsettings.cpp
new file mode 100644
index 00000000..bdb66535
--- /dev/null
+++ b/data/appsettings.cpp
@@ -0,0 +1,70 @@
+/* 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 *settings;
+
+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
new file mode 100644
index 00000000..fc0098fc
--- /dev/null
+++ b/data/appsettings.h
@@ -0,0 +1,32 @@
+/* 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);
+};
+
+extern AppSettings *settings;
+
+#endif // APPSETTINGS_H
diff --git a/data/loginresponse.cpp b/data/loginresponse.cpp
index 44bc80eb..99a618ad 100644
--- a/data/loginresponse.cpp
+++ b/data/loginresponse.cpp
@@ -19,51 +19,51 @@ LoginResponse::LoginResponse(const QString& username, const QString& sessionID,
qint64 latestVersion, QObject *parent) :
QObject(parent)
{
- this->username = username;
- this->sessionID = sessionID;
- this->latestVersion = latestVersion;
+ this->m_username = username;
+ this->m_sessionID = sessionID;
+ this->m_latestVersion = latestVersion;
}
LoginResponse::LoginResponse()
{
- this->username = "";
- this->sessionID = "";
- this->latestVersion = 0;
+ this->m_username = "";
+ this->m_sessionID = "";
+ this->m_latestVersion = 0;
}
LoginResponse::LoginResponse(const LoginResponse &other)
{
- this->username = other.getUsername();
- this->sessionID = other.getSessionID();
- this->latestVersion = other.getLatestVersion();
+ this->m_username = other.username();
+ this->m_sessionID = other.sessionID();
+ this->m_latestVersion = other.latestVersion();
}
-QString LoginResponse::getUsername() const
+QString LoginResponse::username() const
{
- return username;
+ return m_username;
}
void LoginResponse::setUsername(const QString& username)
{
- this->username = username;
+ this->m_username = username;
}
-QString LoginResponse::getSessionID() const
+QString LoginResponse::sessionID() const
{
- return sessionID;
+ return m_sessionID;
}
void LoginResponse::setSessionID(const QString& sessionID)
{
- this->sessionID = sessionID;
+ this->m_sessionID = sessionID;
}
-qint64 LoginResponse::getLatestVersion() const
+qint64 LoginResponse::latestVersion() const
{
- return latestVersion;
+ return m_latestVersion;
}
void LoginResponse::setLatestVersion(qint64 v)
{
- this->latestVersion = v;
+ this->m_latestVersion = v;
}
diff --git a/data/loginresponse.h b/data/loginresponse.h
index bcb77d56..c30897c3 100644
--- a/data/loginresponse.h
+++ b/data/loginresponse.h
@@ -18,28 +18,75 @@
#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);
- QString getUsername() const;
+ /*!
+ * \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);
- QString getSessionID() const;
+
+ /*!
+ * \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);
- qint64 getLatestVersion() const;
+
+ /*!
+ * \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 username;
- QString sessionID;
- qint64 latestVersion;
+ QString m_username;
+ QString m_sessionID;
+ qint64 m_latestVersion;
};
Q_DECLARE_METATYPE(LoginResponse)
diff --git a/data/userinfo.cpp b/data/userinfo.cpp
index 907f93a2..0bb5da11 100644
--- a/data/userinfo.cpp
+++ b/data/userinfo.cpp
@@ -18,32 +18,32 @@
UserInfo::UserInfo(const QString &username, const QString &password, QObject *parent) :
QObject(parent)
{
- this->username = username;
- this->password = password;
+ this->m_username = username;
+ this->m_password = password;
}
UserInfo::UserInfo(const UserInfo &other)
{
- this->username = other.username;
- this->password = other.password;
+ this->m_username = other.m_username;
+ this->m_password = other.m_password;
}
-QString UserInfo::getUsername() const
+QString UserInfo::username() const
{
- return username;
+ return m_username;
}
void UserInfo::setUsername(const QString &username)
{
- this->username = username;
+ this->m_username = username;
}
-QString UserInfo::getPassword() const
+QString UserInfo::password() const
{
- return password;
+ return m_password;
}
void UserInfo::setPassword(const QString &password)
{
- this->password = password;
+ this->m_password = password;
}
diff --git a/data/userinfo.h b/data/userinfo.h
index ccfc741e..486ce2a6 100644
--- a/data/userinfo.h
+++ b/data/userinfo.h
@@ -25,15 +25,15 @@ public:
explicit UserInfo(const QString& username, const QString& password, QObject *parent = 0);
explicit UserInfo(const UserInfo& other);
- QString getUsername() const;
+ QString username() const;
void setUsername(const QString& username);
- QString getPassword() const;
+ QString password() const;
void setPassword(const QString& password);
protected:
- QString username;
- QString password;
+ QString m_username;
+ QString m_password;
};
#endif // USERINFO_H
diff --git a/data/version.h b/data/version.h
index 321b1680..d5d276db 100644
--- a/data/version.h
+++ b/data/version.h
@@ -18,6 +18,9 @@
#include <QObject>
+/*!
+ * \brief The Version class represents a MultiMC version number.
+ */
class Version : public QObject
{
Q_OBJECT
@@ -27,11 +30,35 @@ public:
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;