diff options
Diffstat (limited to 'MultiMC.h')
-rw-r--r-- | MultiMC.h | 39 |
1 files changed, 22 insertions, 17 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; @@ -31,9 +33,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 @@ -42,7 +54,7 @@ public: { Failed, Succeeded, - Initialized, + Initialized }; public: @@ -109,21 +121,7 @@ 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); - - /*! - * Gets the path to install updates from on exit. - * If this is an empty string, no updates should be installed on exit. - */ - QString getExitUpdatePath() const; + void installUpdates(const QString updateFilesDir, UpdateFlags flags = None); /*! * Opens a json file using either a system default editor, or, if note empty, the editor @@ -154,6 +152,12 @@ public: return origcwdPath; } +private slots: + /** + * Do all the things that should be done before we exit + */ + void onExit(); + private: void initLogger(); @@ -186,6 +190,7 @@ private: QsLogging::DestinationPtr m_debugDestination; QString m_updateOnExitPath; + UpdateFlags m_updateOnExitFlags = None; QString rootPath; QString binPath; |