From 6892c11e9f287dcfb1e698f8f46233a01fb7abb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Sat, 7 Sep 2013 04:00:58 +0200 Subject: Move a good chunk of the singleton objects into a new QApplication subclass. --- MultiMC.h | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 MultiMC.h (limited to 'MultiMC.h') 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 +#include "MultiMCVersion.h" +#include "config.h" + +class SettingsObject; +class InstanceList; +class IconList; +class QNetworkAccessManager; + +#if defined(MMC) +#undef MMC +#endif +#define MMC (static_cast(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 -- cgit v1.2.3