diff options
author | Gingeh <39150378+Gingeh@users.noreply.github.com> | 2022-06-29 18:46:39 +1000 |
---|---|---|
committer | Gingeh <39150378+Gingeh@users.noreply.github.com> | 2022-06-29 18:46:39 +1000 |
commit | d6f4ff26b548f9b340297c15df33680cf45359ad (patch) | |
tree | 202934ee950a12a6418f52287d086498670a0d5a | |
parent | b606a2e040b96b6d80fae012a4eef43307a04771 (diff) | |
download | PrismLauncher-d6f4ff26b548f9b340297c15df33680cf45359ad.tar.gz PrismLauncher-d6f4ff26b548f9b340297c15df33680cf45359ad.tar.bz2 PrismLauncher-d6f4ff26b548f9b340297c15df33680cf45359ad.zip |
Disable skin buttons for offline accounts
-rw-r--r-- | launcher/ui/pages/global/AccountListPage.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/launcher/ui/pages/global/AccountListPage.cpp b/launcher/ui/pages/global/AccountListPage.cpp index b97fe35e..5447a07b 100644 --- a/launcher/ui/pages/global/AccountListPage.cpp +++ b/launcher/ui/pages/global/AccountListPage.cpp @@ -255,18 +255,20 @@ void AccountListPage::updateButtonStates() { // If there is no selection, disable buttons that require something selected. QModelIndexList selection = ui->listView->selectionModel()->selectedIndexes(); - bool hasSelection = selection.size() > 0; + bool hasSelection = !selection.empty(); bool accountIsReady = false; + bool accountIsOnline; if (hasSelection) { QModelIndex selected = selection.first(); MinecraftAccountPtr account = selected.data(AccountList::PointerRole).value<MinecraftAccountPtr>(); accountIsReady = !account->isActive(); + accountIsOnline = !account->isOffline(); } ui->actionRemove->setEnabled(accountIsReady); ui->actionSetDefault->setEnabled(accountIsReady); - ui->actionUploadSkin->setEnabled(accountIsReady); - ui->actionDeleteSkin->setEnabled(accountIsReady); + ui->actionUploadSkin->setEnabled(accountIsReady && accountIsOnline); + ui->actionDeleteSkin->setEnabled(accountIsReady && accountIsOnline); ui->actionRefresh->setEnabled(accountIsReady); if(m_accounts->defaultAccount().get() == nullptr) { |