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();
|
||||
settings->SetOsSeparator(ui->osOptionCheck->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)
|
||||
{
|
||||
|
@ -151,6 +156,8 @@ void TapePreferencesConfigurationPage::Apply()
|
|||
settings->SetDefSize(ui->defSizeCombo->currentText().toInt());
|
||||
m_defGradationChanged = false;
|
||||
}
|
||||
|
||||
return preferences;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -44,7 +44,7 @@ public:
|
|||
explicit TapePreferencesConfigurationPage(QWidget *parent = nullptr);
|
||||
virtual ~TapePreferencesConfigurationPage();
|
||||
|
||||
void Apply();
|
||||
QStringList Apply();
|
||||
protected:
|
||||
virtual void changeEvent(QEvent* event) override;
|
||||
private:
|
||||
|
|
|
@ -263,7 +263,7 @@
|
|||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Activate dark mode(Restart required)</string>
|
||||
<string>Activate dark mode</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include "configpages/tapepreferencesconfigurationpage.h"
|
||||
#include "configpages/tapepreferencespathpage.h"
|
||||
|
||||
#include <QMessageBox>
|
||||
#include <QPushButton>
|
||||
#include <QShowEvent>
|
||||
|
||||
|
@ -124,9 +125,18 @@ void DialogTapePreferences::changeEvent(QEvent *event)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogTapePreferences::Apply()
|
||||
{
|
||||
m_configurationPage->Apply();
|
||||
QStringList preferences;
|
||||
|
||||
preferences += m_configurationPage->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());
|
||||
emit UpdateProperties();
|
||||
setResult(QDialog::Accepted);
|
||||
|
|
|
@ -171,7 +171,13 @@ QStringList PreferencesConfigurationPage::Apply()
|
|||
|
||||
settings->SetOsSeparator(ui->osOptionCheck->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->SetDoubleClickZoomFitBestCurrentPP(ui->checkBoxZoomFitBestCurrentPP->isChecked());
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<y>-152</y>
|
||||
<width>624</width>
|
||||
<height>707</height>
|
||||
</rect>
|
||||
|
@ -266,7 +266,7 @@
|
|||
<item>
|
||||
<widget class="QCheckBox" name="darkModeCheck">
|
||||
<property name="text">
|
||||
<string>Activate dark mode(Restart required)</string>
|
||||
<string>Activate dark mode</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
|
|
Loading…
Reference in New Issue
Block a user