Merge pull request #855 from Gingeh/account-list
This commit is contained in:
		| @@ -73,9 +73,11 @@ AccountListPage::AccountListPage(QWidget *parent) | ||||
|     m_accounts = APPLICATION->accounts(); | ||||
|  | ||||
|     ui->listView->setModel(m_accounts.get()); | ||||
|     ui->listView->header()->setSectionResizeMode(0, QHeaderView::Stretch); | ||||
|     ui->listView->header()->setSectionResizeMode(1, QHeaderView::Stretch); | ||||
|     ui->listView->header()->setSectionResizeMode(2, QHeaderView::ResizeToContents); | ||||
|     ui->listView->header()->setSectionResizeMode(AccountList::VListColumns::ProfileNameColumn, QHeaderView::Stretch); | ||||
|     ui->listView->header()->setSectionResizeMode(AccountList::VListColumns::NameColumn, QHeaderView::Stretch); | ||||
|     ui->listView->header()->setSectionResizeMode(AccountList::VListColumns::MigrationColumn, QHeaderView::ResizeToContents); | ||||
|     ui->listView->header()->setSectionResizeMode(AccountList::VListColumns::TypeColumn, QHeaderView::ResizeToContents); | ||||
|     ui->listView->header()->setSectionResizeMode(AccountList::VListColumns::StatusColumn, QHeaderView::ResizeToContents); | ||||
|     ui->listView->setSelectionMode(QAbstractItemView::SingleSelection); | ||||
|  | ||||
|     // Expand the account column | ||||
| @@ -253,19 +255,21 @@ 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->actionRefresh->setEnabled(accountIsReady); | ||||
|     ui->actionUploadSkin->setEnabled(accountIsReady && accountIsOnline); | ||||
|     ui->actionDeleteSkin->setEnabled(accountIsReady && accountIsOnline); | ||||
|     ui->actionRefresh->setEnabled(accountIsReady && accountIsOnline); | ||||
|  | ||||
|     if(m_accounts->defaultAccount().get() == nullptr) { | ||||
|         ui->actionNoDefault->setEnabled(false); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Sefa Eyeoglu
					Sefa Eyeoglu