Commit f128c337 authored by Andreas Traczyk's avatar Andreas Traczyk

mainwindow: navigate to wizard when last account is deleted

Change-Id: I9503fcd32e8e3467df34ed2cf0ef524bbf588eeb
parent 83948a71
......@@ -199,6 +199,12 @@ MainWindow::MainWindow(QWidget* parent)
this, &MainWindow::slotSwitchVideoWidget);
connect(ui->settingswidget, &SettingsWidget::videoInputDeviceConnectionLost,
this, &MainWindow::slotSwitchVideoWidget);
connect(&LRCInstance::accountModel(), &lrc::api::NewAccountModel::accountRemoved,
[this](const std::string& accountId) {
Q_UNUSED(accountId);
emit LRCInstance::instance().accountListChanged();
});
}
MainWindow::~MainWindow()
......@@ -415,6 +421,11 @@ void MainWindow::slotAccountListChanged()
} else {
systrayMenu->addAction(exitAction_);
}
if (!LRCInstance::accountModel().getAccountList().size()) {
if (auto currentWidget = dynamic_cast<NavWidget*>(ui->navStack->currentWidget())) {
emit currentWidget->NavigationRequested(ScreenEnum::WizardScreen);
}
}
}
void MainWindow::slotSwitchVideoWidget(Utils::VideoWidgetSwapType type)
......
......@@ -694,12 +694,8 @@ void SettingsWidget::delAccountSlot()
if (ret == QDialog::Accepted) {
LRCInstance::setSelectedAccountId();
emit LRCInstance::instance().accountListChanged();
if (!LRCInstance::accountModel().getAccountList().size()) {
emit NavigationRequested(ScreenEnum::WizardScreen);
} else {
LRCInstance::setSelectedConvId();
LRCInstance::setSelectedConvId();
if (LRCInstance::accountModel().getAccountList().size()) {
emit NavigationRequested(ScreenEnum::CallScreen);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment