Skip to content

Commit

Permalink
Fix entering the invisible debug tab in SettingsWindows
Browse files Browse the repository at this point in the history
  • Loading branch information
SpriteOvO committed Sep 4, 2023
1 parent ce7cfb6 commit e009106
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
5 changes: 5 additions & 0 deletions Source/Gui/SettingsWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,11 @@ int SettingsWindow::GetTabCurrentIndex() const
return _ui.tabWidget->currentIndex();
}

int SettingsWindow::GetTabLastVisibleIndex() const
{
return GetTabCount() - 2 /* Skip the Debug tab */;
}

void SettingsWindow::SetTabIndex(int index)
{
_ui.tabWidget->setCurrentIndex(index);
Expand Down
1 change: 1 addition & 0 deletions Source/Gui/SettingsWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class SettingsWindow : public QDialog

int GetTabCount() const;
int GetTabCurrentIndex() const;
int GetTabLastVisibleIndex() const;
void SetTabIndex(int index);

private:
Expand Down
4 changes: 2 additions & 2 deletions Source/Gui/TrayIcon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ void TrayIcon::OnNewVersionClicked()
void TrayIcon::OnSettingsClicked()
{
if (!_settingsWindow.isVisible() ||
_settingsWindow.GetTabCurrentIndex() == _settingsWindow.GetTabCount() - 1)
_settingsWindow.GetTabCurrentIndex() == _settingsWindow.GetTabLastVisibleIndex())
{
_settingsWindow.SetTabIndex(0);
}
Expand All @@ -331,7 +331,7 @@ void TrayIcon::OnSettingsClicked()

void TrayIcon::OnAboutClicked()
{
_settingsWindow.SetTabIndex(_settingsWindow.GetTabCount() - 1);
_settingsWindow.SetTabIndex(_settingsWindow.GetTabLastVisibleIndex());
_settingsWindow.show();
_settingsWindow.raise();
}
Expand Down

0 comments on commit e009106

Please sign in to comment.