Commit ef7cb1b0 authored by Ming Rui Zhang's avatar Ming Rui Zhang

settingwidget: fix the issue where sometimes account setting does not match account type

- create a pastAccount, if pastAccount matches the current account,
  setSelected will return as usual, and if not, it will reselect
  the correct account setting widget

Change-Id: I870eb6d52d7e5f352489ddbd9347c3a5437e918d
parent 36a18c85
...@@ -172,7 +172,9 @@ void SettingsWidget::setSelected(Button sel) ...@@ -172,7 +172,9 @@ void SettingsWidget::setSelected(Button sel)
ui->accountSettingsButton->setChecked(true); ui->accountSettingsButton->setChecked(true);
ui->generalSettingsButton->setChecked(false); ui->generalSettingsButton->setChecked(false);
ui->mediaSettingsButton->setChecked(false); ui->mediaSettingsButton->setChecked(false);
if (pastButton_ == sel) { return; } if (pastButton_ == sel && pastAccount_ == LRCInstance::getCurrentAccountInfo().profileInfo.type) {
return;
}
if (!LRCInstance::getActiveCalls().size()) { if (!LRCInstance::getActiveCalls().size()) {
QtConcurrent::run( [this] { LRCInstance::avModel().stopPreview(); }); QtConcurrent::run( [this] { LRCInstance::avModel().stopPreview(); });
...@@ -183,11 +185,13 @@ void SettingsWidget::setSelected(Button sel) ...@@ -183,11 +185,13 @@ void SettingsWidget::setSelected(Button sel)
if (advancedSIPSettingsDropped_) { if (advancedSIPSettingsDropped_) {
toggleAdvancedSIPSettings(); toggleAdvancedSIPSettings();
} }
pastAccount_ = lrc::api::profile::Type::SIP;
} else { } else {
ui->stackedWidget->setCurrentWidget(ui->currentAccountSettingsScrollWidget); ui->stackedWidget->setCurrentWidget(ui->currentAccountSettingsScrollWidget);
if (advancedSettingsDropped_) { if (advancedSettingsDropped_) {
toggleAdvancedSettings(); toggleAdvancedSettings();
} }
pastAccount_ = lrc::api::profile::Type::RING;
} }
break; break;
......
...@@ -93,6 +93,7 @@ private: ...@@ -93,6 +93,7 @@ private:
AdvancedSettingsWidget* advancedSettingsWidget_; AdvancedSettingsWidget* advancedSettingsWidget_;
QScrollArea* scrollArea_; QScrollArea* scrollArea_;
Button pastButton_ = Button::generalSettingsButton; Button pastButton_ = Button::generalSettingsButton;
lrc::api::profile::Type pastAccount_ = lrc::api::profile::Type::INVALID;
bool advancedSettingsDropped_ = false; bool advancedSettingsDropped_ = false;
QList<QPair<std::string, float>> formatIndexList_; QList<QPair<std::string, float>> formatIndexList_;
std::string currentDisplayedVideoDevice_; std::string currentDisplayedVideoDevice_;
......
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