#pragma once #include #include #include #include #include #include #include class FolderInstanceProvider; class GenericPageProvider; class QFile; class MinecraftVersionList; class LWJGLVersionList; class HttpMetaCache; class SettingsObject; class InstanceList; class MojangAccountList; class IconList; class QNetworkAccessManager; class ForgeVersionList; class LiteLoaderVersionList; class JavaInstallList; class UpdateChecker; class BaseProfilerFactory; class BaseDetachedToolFactory; class TranslationDownloader; class ITheme; #if defined(MMC) #undef MMC #endif #define MMC (static_cast(QCoreApplication::instance())) class MultiMC : public QApplication { // friends for the purpose of limiting access to deprecated stuff friend class MultiMCPage; friend class MainWindow; Q_OBJECT public: enum Status { Failed, Succeeded, Initialized }; public: MultiMC(int &argc, char **argv); virtual ~MultiMC(); // InstanceList, IconList, OneSixFTBInstance, LegacyUpdate, LegacyInstance, MCEditTool, JVisualVM, MinecraftInstance, JProfiler, BaseInstance std::shared_ptr settings() { return m_settings; } std::shared_ptr globalSettingsPages() { return m_globalSettingsProvider; } qint64 timeSinceStart() const { return startTime.msecsTo(QDateTime::currentDateTime()); } QIcon getThemedIcon(const QString& name); void setIconTheme(const QString& name); std::vector getValidApplicationThemes(); void setApplicationTheme(const QString& name); // DownloadUpdateTask std::shared_ptr updateChecker() { return m_updateChecker; } std::shared_ptr minecraftlist(); std::shared_ptr lwjgllist(); std::shared_ptr forgelist(); std::shared_ptr liteloaderlist(); std::shared_ptr javalist(); // APPLICATION ONLY std::shared_ptr instances() { return m_instances; } FolderInstanceProvider * folderProvider() { return m_instanceFolder; } std::shared_ptr icons() { return m_icons; } // APPLICATION ONLY std::shared_ptr accounts() { return m_accounts; } // APPLICATION ONLY Status status() { return m_status; } // APPLICATION ONLY QMap> profilers() { return m_profilers; } // APPLICATION ONLY QMap> tools() { return m_tools; } // APPLICATION ONLY QString getFinishCmd(); void installUpdates(const QString updateFilesDir, GoUpdate::OperationList operations); void updateXP(const QString updateFilesDir, GoUpdate::OperationList operations); void updateModern(const QString updateFilesDir, GoUpdate::OperationList operations); /*! * Opens a json file using either a system default editor, or, if note empty, the editor * specified in the settings */ bool openJsonEditor(const QString &filename); protected: /* to be removed! */ // FIXME: remove. used by MainWindow to create application update tasks /// this is the root of the 'installation'. Used for automatic updates const QString &root() { return rootPath; } private slots: /** * Do all the things that should be done before we exit */ void onExit(); private: void initLogger(); void initIcons(); void initThemes(); void initGlobalSettings(); void initTranslations(); void initSSL(); private: friend class UpdateCheckerTest; friend class DownloadTaskTest; QDateTime startTime; std::shared_ptr m_qt_translator; std::shared_ptr m_mmc_translator; std::shared_ptr m_settings; std::shared_ptr m_instances; FolderInstanceProvider * m_instanceFolder; std::shared_ptr m_icons; std::shared_ptr m_updateChecker; std::shared_ptr m_accounts; std::shared_ptr m_lwjgllist; std::shared_ptr m_forgelist; std::shared_ptr m_liteloaderlist; std::shared_ptr m_minecraftlist; std::shared_ptr m_javalist; std::shared_ptr m_translationChecker; std::shared_ptr m_globalSettingsProvider; std::map> m_themes; QMap> m_profilers; QMap> m_tools; QString rootPath; Status m_status = MultiMC::Failed; bool consoleAttached = false; public: QString launchId; std::shared_ptr logFile; };