summaryrefslogtreecommitdiffstats
path: root/MultiMC.h
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2013-09-07 04:00:58 +0200
committerPetr Mrázek <peterix@gmail.com>2013-09-07 04:00:58 +0200
commit6892c11e9f287dcfb1e698f8f46233a01fb7abb6 (patch)
treeee94607e92bcf39faef7f35842499fafbb2e270f /MultiMC.h
parent3f30055afe757637ae865b2adc7cf021edd9b8b5 (diff)
downloadMultiMC-6892c11e9f287dcfb1e698f8f46233a01fb7abb6.tar
MultiMC-6892c11e9f287dcfb1e698f8f46233a01fb7abb6.tar.gz
MultiMC-6892c11e9f287dcfb1e698f8f46233a01fb7abb6.tar.lz
MultiMC-6892c11e9f287dcfb1e698f8f46233a01fb7abb6.tar.xz
MultiMC-6892c11e9f287dcfb1e698f8f46233a01fb7abb6.zip
Move a good chunk of the singleton objects into a new QApplication subclass.
Diffstat (limited to 'MultiMC.h')
-rw-r--r--MultiMC.h68
1 files changed, 68 insertions, 0 deletions
diff --git a/MultiMC.h b/MultiMC.h
new file mode 100644
index 00000000..99d90b99
--- /dev/null
+++ b/MultiMC.h
@@ -0,0 +1,68 @@
+#pragma once
+
+#include <QApplication>
+#include "MultiMCVersion.h"
+#include "config.h"
+
+class SettingsObject;
+class InstanceList;
+class IconList;
+class QNetworkAccessManager;
+
+#if defined(MMC)
+#undef MMC
+#endif
+#define MMC (static_cast<MultiMC *>(QCoreApplication::instance()))
+
+class MultiMC : public QApplication
+{
+ Q_OBJECT
+public:
+ enum Status
+ {
+ Failed,
+ Succeeded,
+ Initialized,
+ };
+
+public:
+ MultiMC ( int& argc, char** argv );
+ virtual ~MultiMC();
+
+ SettingsObject * settings()
+ {
+ return m_settings;
+ };
+
+ InstanceList * instances()
+ {
+ return m_instances;
+ };
+
+ IconList * icons();
+
+ Status status()
+ {
+ return m_status;
+ }
+
+ MultiMCVersion version()
+ {
+ return m_version;
+ }
+
+ QNetworkAccessManager * qnam()
+ {
+ return m_qnam;
+ }
+private:
+ void initGlobalSettings();
+
+private:
+ SettingsObject * m_settings = nullptr;
+ InstanceList * m_instances = nullptr;
+ IconList * m_icons = nullptr;
+ QNetworkAccessManager * m_qnam = nullptr;
+ Status m_status = MultiMC::Failed;
+ MultiMCVersion m_version = {VERSION_MAJOR, VERSION_MINOR, VERSION_REVISION, VERSION_BUILD};
+}; \ No newline at end of file