diff --git a/src/Preferences.cc b/src/Preferences.cc index 11d64502..f133ffdc 100644 --- a/src/Preferences.cc +++ b/src/Preferences.cc @@ -474,13 +474,13 @@ void Preferences::on_launcherBox_toggled(bool state) void Preferences::on_spinBoxIndentationWidth_valueChanged(int val) { Settings::Settings::inst()->set(Settings::Settings::indentationWidth, Value(val)); - fireEditorConfigChanged(); + writeSettings(); } void Preferences::on_spinBoxTabWidth_valueChanged(int val) { Settings::Settings::inst()->set(Settings::Settings::tabWidth, Value(val)); - fireEditorConfigChanged(); + writeSettings(); } void Preferences::on_comboBoxLineWrap_activated(int val) @@ -496,7 +496,7 @@ void Preferences::on_comboBoxLineWrapIndentationStyle_activated(int val) void Preferences::on_spinBoxLineWrapIndentationIndent_valueChanged(int val) { Settings::Settings::inst()->set(Settings::Settings::lineWrapIndentation, Value(val)); - fireEditorConfigChanged(); + writeSettings(); } void Preferences::on_comboBoxLineWrapVisualizationStart_activated(int val) @@ -517,13 +517,13 @@ void Preferences::on_comboBoxShowWhitespace_activated(int val) void Preferences::on_spinBoxShowWhitespaceSize_valueChanged(int val) { Settings::Settings::inst()->set(Settings::Settings::showWhitespaceSize, Value(val)); - fireEditorConfigChanged(); + writeSettings(); } void Preferences::on_checkBoxAutoIndent_toggled(bool val) { Settings::Settings::inst()->set(Settings::Settings::autoIndent, Value(val)); - fireEditorConfigChanged(); + writeSettings(); } void Preferences::on_comboBoxIndentUsing_activated(int val) @@ -539,19 +539,24 @@ void Preferences::on_comboBoxTabKeyFunction_activated(int val) void Preferences::on_checkBoxHighlightCurrentLine_toggled(bool val) { Settings::Settings::inst()->set(Settings::Settings::highlightCurrentLine, Value(val)); - fireEditorConfigChanged(); + writeSettings(); } void Preferences::on_checkBoxEnableBraceMatching_toggled(bool val) { Settings::Settings::inst()->set(Settings::Settings::enableBraceMatching, Value(val)); + writeSettings(); +} + +void Preferences::writeSettings() +{ + SettingsWriter settingsWriter; + Settings::Settings::inst()->visit(settingsWriter); fireEditorConfigChanged(); } void Preferences::fireEditorConfigChanged() const { - SettingsWriter settingsWriter; - Settings::Settings::inst()->visit(settingsWriter); emit editorConfigChanged(); } @@ -709,7 +714,7 @@ void Preferences::applyComboBox(QComboBox *comboBox, int val, Settings::Settings { QString s = comboBox->itemData(val).toString(); Settings::Settings::inst()->set(entry, Value(s.toStdString())); - fireEditorConfigChanged(); + writeSettings(); } void Preferences::apply() const diff --git a/src/Preferences.h b/src/Preferences.h index 35c7d625..82cced50 100644 --- a/src/Preferences.h +++ b/src/Preferences.h @@ -20,6 +20,7 @@ public: QVariant getValue(const QString &key) const; void init(); void apply() const; + void fireEditorConfigChanged() const; public slots: void actionTriggered(class QAction *); @@ -87,7 +88,7 @@ private: void updateGUI(); void removeDefaultSettings(); void setupFeaturesPage(); - void fireEditorConfigChanged() const; + void writeSettings(); void addPrefPage(QActionGroup *group, QAction *action, QWidget *widget); /** Initialize combobox list values from the settings range values */ diff --git a/src/mainwin.cc b/src/mainwin.cc index e4a01584..c39dfe58 100644 --- a/src/mainwin.cc +++ b/src/mainwin.cc @@ -204,7 +204,7 @@ MainWindow::MainWindow(const QString &filename) #ifdef USE_SCINTILLA_EDITOR if (useScintilla) { connect(Preferences::inst(), SIGNAL(editorConfigChanged()), editor, SLOT(applySettings())); - Preferences::inst()->editorConfigChanged(); + Preferences::inst()->fireEditorConfigChanged(); } #endif