From 8d4d83f168f0a6bdc93c9d9cd07f91cb2009f418 Mon Sep 17 00:00:00 2001 From: Torsten Paul Date: Tue, 30 Dec 2014 13:03:51 +0100 Subject: [PATCH 1/2] Fix build with Qt4. --- src/Preferences.cc | 23 ++++++++++++++--------- src/Preferences.h | 3 ++- src/mainwin.cc | 2 +- 3 files changed, 17 insertions(+), 11 deletions(-) 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 From bebe08483f511fe87df191fbff5261a729e64b9f Mon Sep 17 00:00:00 2001 From: Torsten Paul Date: Tue, 30 Dec 2014 13:58:48 +0100 Subject: [PATCH 2/2] The WrapFlagInMargin value is only available in QScintilla 2.7 and later. This is a workaround for Debian 7 which has QScintilla 2.6.2. The "Margin" setting is simply ignored and behaves as "None". --- src/scintillaeditor.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/scintillaeditor.cpp b/src/scintillaeditor.cpp index a240d24c..88836747 100644 --- a/src/scintillaeditor.cpp +++ b/src/scintillaeditor.cpp @@ -35,8 +35,10 @@ QsciScintilla::WrapVisualFlag SettingsConverter::toLineWrapVisualization(Value v return QsciScintilla::WrapFlagByText; } else if (v == "Border") { return QsciScintilla::WrapFlagByBorder; +#if QSCINTILLA_VERSION >= 0x020700 } else if (v == "Margin") { return QsciScintilla::WrapFlagInMargin; +#endif } else { return QsciScintilla::WrapFlagNone; }