diff options
author | Petr Mrázek <peterix@gmail.com> | 2013-09-07 04:00:58 +0200 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2013-09-07 04:00:58 +0200 |
commit | 6892c11e9f287dcfb1e698f8f46233a01fb7abb6 (patch) | |
tree | ee94607e92bcf39faef7f35842499fafbb2e270f /MultiMC.h | |
parent | 3f30055afe757637ae865b2adc7cf021edd9b8b5 (diff) | |
download | PrismLauncher-6892c11e9f287dcfb1e698f8f46233a01fb7abb6.tar.gz PrismLauncher-6892c11e9f287dcfb1e698f8f46233a01fb7abb6.tar.bz2 PrismLauncher-6892c11e9f287dcfb1e698f8f46233a01fb7abb6.zip |
Move a good chunk of the singleton objects into a new QApplication subclass.
Diffstat (limited to 'MultiMC.h')
-rw-r--r-- | MultiMC.h | 68 |
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 |