summaryrefslogtreecommitdiffstats
path: root/logic/lists/MojangAccountList.h
diff options
context:
space:
mode:
Diffstat (limited to 'logic/lists/MojangAccountList.h')
-rw-r--r--logic/lists/MojangAccountList.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/logic/lists/MojangAccountList.h b/logic/lists/MojangAccountList.h
index 37c928de..491abf6d 100644
--- a/logic/lists/MojangAccountList.h
+++ b/logic/lists/MojangAccountList.h
@@ -79,6 +79,15 @@ public:
* one doesn't exist.
*/
virtual MojangAccountPtr findAccount(const QString &username);
+
+ /*!
+ * Sets the default path to save the list file to.
+ * If autosave is true, this list will automatically save to the given path whenever it changes.
+ * THIS FUNCTION DOES NOT LOAD THE LIST. If you set autosave, be sure to call loadList() immediately
+ * after calling this function to ensure an autosaved change doesn't overwrite the list you intended
+ * to load.
+ */
+ virtual void setListFilePath(QString path, bool autosave=false);
/*!
* \brief Loads the account list from the given file path.
@@ -102,8 +111,23 @@ signals:
void listChanged();
protected:
+ /*!
+ * Called whenever the list changes.
+ * This emits the listChanged() signal and autosaves the list (if autosave is enabled).
+ */
+ void onListChanged();
+
QList<MojangAccountPtr> m_accounts;
+ //! Path to the account list file. Empty string if there isn't one.
+ QString m_listFilePath;
+
+ /*!
+ * If true, the account list will automatically save to the account list path when it changes.
+ * Ignored if m_listFilePath is blank.
+ */
+ bool m_autosave;
+
protected
slots:
/*!