mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 20:48:56 +02:00
Fix vr menu login item update
This commit is contained in:
parent
0faab41057
commit
3349093908
1 changed files with 6 additions and 3 deletions
|
@ -34,16 +34,19 @@ void LoginDialog::toggleAction() {
|
||||||
AccountManager& accountManager = AccountManager::getInstance();
|
AccountManager& accountManager = AccountManager::getInstance();
|
||||||
QAction* loginAction = Menu::getInstance()->getActionForOption(MenuOption::Login);
|
QAction* loginAction = Menu::getInstance()->getActionForOption(MenuOption::Login);
|
||||||
Q_CHECK_PTR(loginAction);
|
Q_CHECK_PTR(loginAction);
|
||||||
disconnect(loginAction, 0, 0, 0);
|
static QMetaObject::Connection connection;
|
||||||
|
if (connection) {
|
||||||
|
disconnect(connection);
|
||||||
|
}
|
||||||
|
|
||||||
if (accountManager.isLoggedIn()) {
|
if (accountManager.isLoggedIn()) {
|
||||||
// change the menu item to logout
|
// change the menu item to logout
|
||||||
loginAction->setText("Logout " + accountManager.getAccountInfo().getUsername());
|
loginAction->setText("Logout " + accountManager.getAccountInfo().getUsername());
|
||||||
connect(loginAction, &QAction::triggered, &accountManager, &AccountManager::logout);
|
connection = connect(loginAction, &QAction::triggered, &accountManager, &AccountManager::logout);
|
||||||
} else {
|
} else {
|
||||||
// change the menu item to login
|
// change the menu item to login
|
||||||
loginAction->setText("Login");
|
loginAction->setText("Login");
|
||||||
connect(loginAction, &QAction::triggered, [] {
|
connection = connect(loginAction, &QAction::triggered, [] {
|
||||||
LoginDialog::show();
|
LoginDialog::show();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue