Add logged in accounts to the profiles menu bar menu
Additionally, add keyboard shortcuts for switching between different accounts.
This commit is contained in:
parent
1303771b58
commit
1049507b3f
@ -511,7 +511,6 @@ public:
|
|||||||
editMenu->addAction(settingsAct);
|
editMenu->addAction(settingsAct);
|
||||||
|
|
||||||
profileMenu = menuBar->addMenu(tr("&Profiles"));
|
profileMenu = menuBar->addMenu(tr("&Profiles"));
|
||||||
// TODO: add a list of logged in accounts here
|
|
||||||
profileMenu->addAction(manageAccountAct);
|
profileMenu->addAction(manageAccountAct);
|
||||||
|
|
||||||
helpMenu = menuBar->addMenu(tr("&Help"));
|
helpMenu = menuBar->addMenu(tr("&Help"));
|
||||||
@ -1379,6 +1378,7 @@ void MainWindow::updateToolsMenu()
|
|||||||
void MainWindow::repopulateAccountsMenu()
|
void MainWindow::repopulateAccountsMenu()
|
||||||
{
|
{
|
||||||
accountMenu->clear();
|
accountMenu->clear();
|
||||||
|
ui->profileMenu->clear();
|
||||||
|
|
||||||
auto accounts = APPLICATION->accounts();
|
auto accounts = APPLICATION->accounts();
|
||||||
MinecraftAccountPtr defaultAccount = accounts->defaultAccount();
|
MinecraftAccountPtr defaultAccount = accounts->defaultAccount();
|
||||||
@ -1399,6 +1399,7 @@ void MainWindow::repopulateAccountsMenu()
|
|||||||
QAction *action = new QAction(tr("No accounts added!"), this);
|
QAction *action = new QAction(tr("No accounts added!"), this);
|
||||||
action->setEnabled(false);
|
action->setEnabled(false);
|
||||||
accountMenu->addAction(action);
|
accountMenu->addAction(action);
|
||||||
|
ui->profileMenu->addAction(action);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1422,26 +1423,39 @@ void MainWindow::repopulateAccountsMenu()
|
|||||||
else {
|
else {
|
||||||
action->setIcon(APPLICATION->getThemedIcon("noaccount"));
|
action->setIcon(APPLICATION->getThemedIcon("noaccount"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const int highestNumberKey = 9;
|
||||||
|
if(i<highestNumberKey)
|
||||||
|
{
|
||||||
|
action->setShortcut(QKeySequence(tr("Ctrl+%1").arg(i + 1)));
|
||||||
|
}
|
||||||
|
|
||||||
accountMenu->addAction(action);
|
accountMenu->addAction(action);
|
||||||
|
ui->profileMenu->addAction(action);
|
||||||
connect(action, SIGNAL(triggered(bool)), SLOT(changeActiveAccount()));
|
connect(action, SIGNAL(triggered(bool)), SLOT(changeActiveAccount()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
accountMenu->addSeparator();
|
accountMenu->addSeparator();
|
||||||
|
ui->profileMenu->addSeparator();
|
||||||
|
|
||||||
QAction *action = new QAction(tr("No Default Account"), this);
|
QAction *action = new QAction(tr("No Default Account"), this);
|
||||||
action->setCheckable(true);
|
action->setCheckable(true);
|
||||||
action->setIcon(APPLICATION->getThemedIcon("noaccount"));
|
action->setIcon(APPLICATION->getThemedIcon("noaccount"));
|
||||||
action->setData(-1);
|
action->setData(-1);
|
||||||
|
action->setShortcut(QKeySequence(tr("Ctrl+0")));
|
||||||
if (!defaultAccount) {
|
if (!defaultAccount) {
|
||||||
action->setChecked(true);
|
action->setChecked(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
accountMenu->addAction(action);
|
accountMenu->addAction(action);
|
||||||
|
ui->profileMenu->addAction(action);
|
||||||
connect(action, SIGNAL(triggered(bool)), SLOT(changeActiveAccount()));
|
connect(action, SIGNAL(triggered(bool)), SLOT(changeActiveAccount()));
|
||||||
|
|
||||||
accountMenu->addSeparator();
|
accountMenu->addSeparator();
|
||||||
|
ui->profileMenu->addSeparator();
|
||||||
accountMenu->addAction(ui->actionManageAccounts);
|
accountMenu->addAction(ui->actionManageAccounts);
|
||||||
|
ui->profileMenu->addAction(ui->manageAccountAct);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::updatesAllowedChanged(bool allowed)
|
void MainWindow::updatesAllowedChanged(bool allowed)
|
||||||
|
Loading…
Reference in New Issue
Block a user