Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix entering the invisible debug tab in SettingsWindows #80

Merged
merged 1 commit into from
Sep 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading