From f7b64a551b6284abc855d8cb7d785844baa0ad9d Mon Sep 17 00:00:00 2001 From: Andrew Date: Thu, 28 Nov 2013 15:46:04 -0600 Subject: Add icon for when no default account is selected Also fixed a bug where the icon on the accounts button wouldn't change when the user checked the "Use as default" checkbox in the account selection dialog. --- logic/lists/MojangAccountList.cpp | 13 ++++++++++--- logic/lists/MojangAccountList.h | 11 +++++++++++ 2 files changed, 21 insertions(+), 3 deletions(-) (limited to 'logic/lists') diff --git a/logic/lists/MojangAccountList.cpp b/logic/lists/MojangAccountList.cpp index c6dce836..ec1937ad 100644 --- a/logic/lists/MojangAccountList.cpp +++ b/logic/lists/MojangAccountList.cpp @@ -106,7 +106,7 @@ void MojangAccountList::setActiveAccount(const QString& username) } } endResetModel(); - onListChanged(); + onActiveChanged(); } @@ -116,8 +116,15 @@ void MojangAccountList::onListChanged() // TODO: Alert the user if this fails. saveList(); - // TODO: stop this getting called from setActiveAccount - //emit listChanged(); + emit listChanged(); +} + +void MojangAccountList::onActiveChanged() +{ + if (m_autosave) + saveList(); + + emit activeAccountChanged(); } diff --git a/logic/lists/MojangAccountList.h b/logic/lists/MojangAccountList.h index cfe96c11..908f5a7a 100644 --- a/logic/lists/MojangAccountList.h +++ b/logic/lists/MojangAccountList.h @@ -133,6 +133,11 @@ signals: */ void listChanged(); + /*! + * Signal emitted to indicate that the active account has changed. + */ + void activeAccountChanged(); + protected: /*! * Called whenever the list changes. @@ -140,6 +145,12 @@ protected: */ void onListChanged(); + /*! + * Called whenever the active account changes. + * Emits the activeAccountChanged() signal and autosaves the list if enabled. + */ + void onActiveChanged(); + QList m_accounts; /*! -- cgit v1.2.3