Warn a user if change in preferences requires restart.
--HG-- branch : develop
This commit is contained in:
parent
b01305b92f
commit
cc5bb4ec15
|
@ -118,14 +118,19 @@ TapePreferencesConfigurationPage::~TapePreferencesConfigurationPage()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void TapePreferencesConfigurationPage::Apply()
|
QStringList TapePreferencesConfigurationPage::Apply()
|
||||||
{
|
{
|
||||||
|
QStringList preferences;
|
||||||
VTapeSettings *settings = qApp->TapeSettings();
|
VTapeSettings *settings = qApp->TapeSettings();
|
||||||
settings->SetOsSeparator(ui->osOptionCheck->isChecked());
|
settings->SetOsSeparator(ui->osOptionCheck->isChecked());
|
||||||
|
|
||||||
settings->SetToolBarStyle(ui->toolBarStyleCheck->isChecked());
|
settings->SetToolBarStyle(ui->toolBarStyleCheck->isChecked());
|
||||||
|
|
||||||
settings->SetDarkMode(ui->darkModeCheck->isChecked());
|
if (settings->GetDarkMode() != ui->darkModeCheck->isChecked())
|
||||||
|
{
|
||||||
|
settings->SetDarkMode(ui->darkModeCheck->isChecked());
|
||||||
|
preferences.append(tr("dark mode"));
|
||||||
|
}
|
||||||
|
|
||||||
if (m_langChanged || m_systemChanged)
|
if (m_langChanged || m_systemChanged)
|
||||||
{
|
{
|
||||||
|
@ -151,6 +156,8 @@ void TapePreferencesConfigurationPage::Apply()
|
||||||
settings->SetDefSize(ui->defSizeCombo->currentText().toInt());
|
settings->SetDefSize(ui->defSizeCombo->currentText().toInt());
|
||||||
m_defGradationChanged = false;
|
m_defGradationChanged = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return preferences;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -44,7 +44,7 @@ public:
|
||||||
explicit TapePreferencesConfigurationPage(QWidget *parent = nullptr);
|
explicit TapePreferencesConfigurationPage(QWidget *parent = nullptr);
|
||||||
virtual ~TapePreferencesConfigurationPage();
|
virtual ~TapePreferencesConfigurationPage();
|
||||||
|
|
||||||
void Apply();
|
QStringList Apply();
|
||||||
protected:
|
protected:
|
||||||
virtual void changeEvent(QEvent* event) override;
|
virtual void changeEvent(QEvent* event) override;
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -263,7 +263,7 @@
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Activate dark mode(Restart required)</string>
|
<string>Activate dark mode</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
#include "configpages/tapepreferencesconfigurationpage.h"
|
#include "configpages/tapepreferencesconfigurationpage.h"
|
||||||
#include "configpages/tapepreferencespathpage.h"
|
#include "configpages/tapepreferencespathpage.h"
|
||||||
|
|
||||||
|
#include <QMessageBox>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QShowEvent>
|
#include <QShowEvent>
|
||||||
|
|
||||||
|
@ -124,9 +125,18 @@ void DialogTapePreferences::changeEvent(QEvent *event)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogTapePreferences::Apply()
|
void DialogTapePreferences::Apply()
|
||||||
{
|
{
|
||||||
m_configurationPage->Apply();
|
QStringList preferences;
|
||||||
|
|
||||||
|
preferences += m_configurationPage->Apply();
|
||||||
m_pathPage->Apply();
|
m_pathPage->Apply();
|
||||||
|
|
||||||
|
if (not preferences.isEmpty())
|
||||||
|
{
|
||||||
|
const QString text = tr("Followed %n option(s) require restart to take effect: %1.", "",
|
||||||
|
preferences.size()).arg(preferences.join(QStringLiteral(", ")));
|
||||||
|
QMessageBox::information(this, QCoreApplication::applicationName(), text);
|
||||||
|
}
|
||||||
|
|
||||||
qApp->TapeSettings()->GetOsSeparator() ? setLocale(QLocale()) : setLocale(QLocale::c());
|
qApp->TapeSettings()->GetOsSeparator() ? setLocale(QLocale()) : setLocale(QLocale::c());
|
||||||
emit UpdateProperties();
|
emit UpdateProperties();
|
||||||
setResult(QDialog::Accepted);
|
setResult(QDialog::Accepted);
|
||||||
|
|
|
@ -171,7 +171,13 @@ QStringList PreferencesConfigurationPage::Apply()
|
||||||
|
|
||||||
settings->SetOsSeparator(ui->osOptionCheck->isChecked());
|
settings->SetOsSeparator(ui->osOptionCheck->isChecked());
|
||||||
settings->SetToolBarStyle(ui->toolBarStyleCheck->isChecked());
|
settings->SetToolBarStyle(ui->toolBarStyleCheck->isChecked());
|
||||||
settings->SetDarkMode(ui->darkModeCheck->isChecked());
|
|
||||||
|
if (settings->GetDarkMode() != ui->darkModeCheck->isChecked())
|
||||||
|
{
|
||||||
|
settings->SetDarkMode(ui->darkModeCheck->isChecked());
|
||||||
|
preferences.append(tr("dark mode"));
|
||||||
|
}
|
||||||
|
|
||||||
settings->SetFreeCurveMode(ui->checkBoxFreeCurve->isChecked());
|
settings->SetFreeCurveMode(ui->checkBoxFreeCurve->isChecked());
|
||||||
settings->SetDoubleClickZoomFitBestCurrentPP(ui->checkBoxZoomFitBestCurrentPP->isChecked());
|
settings->SetDoubleClickZoomFitBestCurrentPP(ui->checkBoxZoomFitBestCurrentPP->isChecked());
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>-152</y>
|
||||||
<width>624</width>
|
<width>624</width>
|
||||||
<height>707</height>
|
<height>707</height>
|
||||||
</rect>
|
</rect>
|
||||||
|
@ -266,7 +266,7 @@
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="darkModeCheck">
|
<widget class="QCheckBox" name="darkModeCheck">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Activate dark mode(Restart required)</string>
|
<string>Activate dark mode</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="checked">
|
<property name="checked">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user