diff options
Diffstat (limited to 'MultiMC.h')
-rw-r--r-- | MultiMC.h | 54 |
1 files changed, 39 insertions, 15 deletions
@@ -1,10 +1,12 @@ #pragma once +#include "config.h" #include <QApplication> #include "MultiMCVersion.h" #include <memory> #include "logger/QsLog.h" #include "logger/QsLogDest.h" +#include <QFlag> class MinecraftVersionList; class LWJGLVersionList; @@ -17,7 +19,9 @@ class QNetworkAccessManager; class ForgeVersionList; class JavaVersionList; class UpdateChecker; +class NotificationChecker; class NewsChecker; +class StatusChecker; #if defined(MMC) #undef MMC @@ -30,9 +34,19 @@ enum InstSortMode // Sort alphabetically by name. Sort_Name, // Sort by which instance was launched most recently. - Sort_LastLaunch, + Sort_LastLaunch }; +enum UpdateFlag +{ + None = 0x0, + RestartOnFinish = 0x1, + DryRun = 0x2, + OnExit = 0x4 +}; +Q_DECLARE_FLAGS(UpdateFlags, UpdateFlag); +Q_DECLARE_OPERATORS_FOR_FLAGS(UpdateFlags); + class MultiMC : public QApplication { Q_OBJECT @@ -41,11 +55,11 @@ public: { Failed, Succeeded, - Initialized, + Initialized }; public: - MultiMC(int &argc, char **argv, const QString &root = QString()); + MultiMC(int &argc, char **argv, bool root_override = false); virtual ~MultiMC(); std::shared_ptr<SettingsObject> settings() @@ -90,11 +104,21 @@ public: return m_updateChecker; } + std::shared_ptr<NotificationChecker> notificationChecker() + { + return m_notificationChecker; + } + std::shared_ptr<NewsChecker> newsChecker() { return m_newsChecker; } + std::shared_ptr<StatusChecker> statusChecker() + { + return m_statusChecker; + } + std::shared_ptr<LWJGLVersionList> lwjgllist(); std::shared_ptr<ForgeVersionList> forgelist(); @@ -103,21 +127,12 @@ public: std::shared_ptr<JavaVersionList> javalist(); - /*! - * Installs update from the given update files directory. - */ - void installUpdates(const QString &updateFilesDir, bool restartOnFinish = false); - - /*! - * Sets MultiMC to install updates from the given directory when it exits. - */ - void setUpdateOnExit(const QString &updateFilesDir); + void installUpdates(const QString updateFilesDir, UpdateFlags flags = None); /*! - * Gets the path to install updates from on exit. - * If this is an empty string, no updates should be installed on exit. + * Updates the application proxy settings from the settings object. */ - QString getExitUpdatePath() const; + void updateProxySettings(); /*! * Opens a json file using either a system default editor, or, if note empty, the editor @@ -148,6 +163,12 @@ public: return origcwdPath; } +private slots: + /** + * Do all the things that should be done before we exit + */ + void onExit(); + private: void initLogger(); @@ -166,7 +187,9 @@ private: std::shared_ptr<SettingsObject> m_settings; std::shared_ptr<InstanceList> m_instances; std::shared_ptr<UpdateChecker> m_updateChecker; + std::shared_ptr<NotificationChecker> m_notificationChecker; std::shared_ptr<NewsChecker> m_newsChecker; + std::shared_ptr<StatusChecker> m_statusChecker; std::shared_ptr<MojangAccountList> m_accounts; std::shared_ptr<IconList> m_icons; std::shared_ptr<QNetworkAccessManager> m_qnam; @@ -179,6 +202,7 @@ private: QsLogging::DestinationPtr m_debugDestination; QString m_updateOnExitPath; + UpdateFlags m_updateOnExitFlags = None; QString rootPath; QString binPath; |