Only one instance of the settings dialog should be open at once

This commit is contained in:
Rasmus Karlsson 2017-05-27 15:40:06 +02:00
parent 5614322a08
commit 0b2b6a0dc7
4 changed files with 15 additions and 4 deletions

View file

@ -181,9 +181,7 @@ void Notebook::resizeEvent(QResizeEvent *)
void Notebook::settingsButtonClicked()
{
SettingsDialog *a = new SettingsDialog();
a->show();
SettingsDialog::showDialog();
}
void Notebook::usersButtonClicked()

View file

@ -33,6 +33,7 @@ private:
bool _mouseDown = false;
QPoint _mousePos;
};
} // namespace widgets
} // namespace chatterino

View file

@ -1,6 +1,6 @@
#include "widgets/settingsdialog.h"
#include "twitch/twitchaccount.h"
#include "accountmanager.h"
#include "twitch/twitchaccount.h"
#include "widgets/settingsdialogtab.h"
#include "windowmanager.h"
@ -299,6 +299,16 @@ void SettingsDialog::select(SettingsDialogTab *tab)
_selectedTab = tab;
}
void SettingsDialog::showDialog()
{
static SettingsDialog *instance = new SettingsDialog();
instance->show();
instance->activateWindow();
instance->raise();
instance->setFocus();
}
/// Widget creation helpers
QCheckBox *SettingsDialog::createCheckbox(const QString &title, Setting<bool> &setting)
{

View file

@ -26,6 +26,8 @@ public:
void select(SettingsDialogTab *tab);
static void showDialog();
private:
SettingsSnapshot _snapshot;