mirror of
https://github.com/UltimMC/Launcher.git
synced 2025-12-14 04:32:14 +00:00
Move a good chunk of the singleton objects into a new QApplication subclass.
This commit is contained in:
68
MultiMC.h
Normal file
68
MultiMC.h
Normal file
@@ -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};
|
||||
};
|
||||
Reference in New Issue
Block a user