changeset 23996:a5b20fc6588a

editor: more consistent behavior of lon line marker settings in (bug #51872) * file-editor-tab.cc (notice_settings): new settings for long line marker, one flag for active or not and two other flags for line or background * file-editor.cc (show_long_line, notice_settings): respect new settings flags * settings-dialog.cc (settings_dialog): set the updated dialog objects to the related values of the settings file; (write_changed_settings): write the values form the dialog into the settings file * settings-dialog.ui: changed objects for long line marker, a checkbox for enabling it and radio buttons for the implementation (line or background)
author Torsten <mttl@mailbox.org>
date Sat, 02 Sep 2017 17:55:15 +0200
parents d511f7e15652
children da835449d822
files libgui/src/m-editor/file-editor-tab.cc libgui/src/settings-dialog.cc libgui/src/settings-dialog.ui
diffstat 3 files changed, 79 insertions(+), 36 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/m-editor/file-editor-tab.cc	Sat Sep 02 05:03:21 2017 -0700
+++ b/libgui/src/m-editor/file-editor-tab.cc	Sat Sep 02 17:55:15 2017 +0200
@@ -2419,11 +2419,22 @@
   // long line marker
   int line_length = settings->value ("editor/long_line_column",80).toInt ();
   _edit_area->setEdgeColumn (line_length);
-  _edit_area->setEdgeMode (QsciScintilla::EdgeNone);
+
   if (settings->value ("editor/long_line_marker",true).toBool ())
-    _edit_area->setEdgeMode (QsciScintilla::EdgeLine);
-  if (settings->value ("editor/long_line_marker_background",true).toBool ())
-    _edit_area->setEdgeMode (QsciScintilla::EdgeBackground);
+    {
+      if (settings->value ("editor/long_line_marker_line",true).toBool ())
+        _edit_area->setEdgeMode (QsciScintilla::EdgeLine);
+      else
+        {
+          if (settings->value ("editor/long_line_marker_background",false)
+                        .toBool ())
+            _edit_area->setEdgeMode (QsciScintilla::EdgeBackground);
+          else
+            _edit_area->setEdgeMode (QsciScintilla::EdgeLine);
+        }
+    }
+  else
+    _edit_area->setEdgeMode (QsciScintilla::EdgeNone);
 
   // line wrapping and breaking
   _edit_area->setWrapVisualFlags (QsciScintilla::WrapFlagByBorder);
--- a/libgui/src/settings-dialog.cc	Sat Sep 02 05:03:21 2017 -0700
+++ b/libgui/src/settings-dialog.cc	Sat Sep 02 17:55:15 2017 +0200
@@ -418,12 +418,16 @@
            _editor_current_line_color, SLOT (setEnabled (bool)));
   ui->editor_highlightCurrentLine->setChecked (
     settings->value ("editor/highlightCurrentLine",true).toBool ());
-  ui->editor_long_line_marker_none->setChecked (
-    settings->value ("editor/long_line_marker_none",false).toBool ());
   ui->editor_long_line_marker->setChecked (
-    settings->value ("editor/long_line_marker",true).toBool ());
-  ui->editor_long_line_marker_background->setChecked (
-    settings->value ("editor/long_line_marker_background",false).toBool ());
+            settings->value ("editor/long_line_marker",true).toBool ());
+  bool long_line =
+        settings->value ("editor/long_line_marker_line",true).toBool ();
+  ui->editor_long_line_marker_line->setChecked (long_line);
+  bool long_back =
+        settings->value ("editor/long_line_marker_background",false).toBool ();
+  ui->editor_long_line_marker_background->setChecked (long_back);
+  if (! (long_line || long_back))
+    ui->editor_long_line_marker_line->setChecked (true);
   ui->editor_long_line_column->setValue (
     settings->value ("editor/long_line_column",80).toInt ());
   ui->editor_break_checkbox->setChecked (
@@ -892,10 +896,10 @@
                       ui->editor_highlightCurrentLine->isChecked ());
   settings->setValue ("editor/highlight_current_line_color",
                       _editor_current_line_color->color ());
-  settings->setValue ("editor/long_line_marker_none",
-                      ui->editor_long_line_marker_none->isChecked ());
   settings->setValue ("editor/long_line_marker",
                       ui->editor_long_line_marker->isChecked ());
+  settings->setValue ("editor/long_line_marker_line",
+                      ui->editor_long_line_marker_line->isChecked ());
   settings->setValue ("editor/long_line_marker_background",
                       ui->editor_long_line_marker_background->isChecked ());
   settings->setValue ("editor/long_line_column",
--- a/libgui/src/settings-dialog.ui	Sat Sep 02 05:03:21 2017 -0700
+++ b/libgui/src/settings-dialog.ui	Sat Sep 02 17:55:15 2017 +0200
@@ -32,7 +32,7 @@
       </size>
      </property>
      <property name="currentIndex">
-      <number>8</number>
+      <number>1</number>
      </property>
      <widget class="QWidget" name="tab_general">
       <property name="enabled">
@@ -52,8 +52,8 @@
            <rect>
             <x>0</x>
             <y>0</y>
-            <width>658</width>
-            <height>573</height>
+            <width>570</width>
+            <height>404</height>
            </rect>
           </property>
           <layout class="QVBoxLayout" name="verticalLayout_17">
@@ -1101,16 +1101,9 @@
                 <item row="0" column="5">
                  <layout class="QHBoxLayout" name="horizontalLayout_3">
                   <item>
-                   <widget class="QLabel" name="label_24">
+                   <widget class="QCheckBox" name="editor_long_line_marker">
                     <property name="text">
-                     <string>Long line marker:</string>
-                    </property>
-                   </widget>
-                  </item>
-                  <item>
-                   <widget class="QRadioButton" name="editor_long_line_marker_none">
-                    <property name="text">
-                     <string>None</string>
+                     <string>Long line marker</string>
                     </property>
                     <property name="checked">
                      <bool>true</bool>
@@ -1118,10 +1111,13 @@
                    </widget>
                   </item>
                   <item>
-                   <widget class="QRadioButton" name="editor_long_line_marker">
+                   <widget class="QRadioButton" name="editor_long_line_marker_line">
                     <property name="text">
                      <string>Line</string>
                     </property>
+                    <property name="checked">
+                     <bool>true</bool>
+                    </property>
                    </widget>
                   </item>
                   <item>
@@ -1820,8 +1816,8 @@
            <rect>
             <x>0</x>
             <y>0</y>
-            <width>658</width>
-            <height>573</height>
+            <width>481</width>
+            <height>230</height>
            </rect>
           </property>
           <layout class="QVBoxLayout" name="verticalLayout_7">
@@ -2101,8 +2097,8 @@
            <rect>
             <x>0</x>
             <y>0</y>
-            <width>658</width>
-            <height>573</height>
+            <width>474</width>
+            <height>196</height>
            </rect>
           </property>
           <layout class="QGridLayout" name="gridLayout_8">
@@ -2245,8 +2241,8 @@
            <rect>
             <x>0</x>
             <y>0</y>
-            <width>658</width>
-            <height>573</height>
+            <width>200</width>
+            <height>77</height>
            </rect>
           </property>
           <layout class="QVBoxLayout" name="verticalLayout_19">
@@ -2314,8 +2310,8 @@
            <rect>
             <x>0</x>
             <y>0</y>
-            <width>658</width>
-            <height>573</height>
+            <width>364</width>
+            <height>210</height>
            </rect>
           </property>
           <layout class="QVBoxLayout" name="verticalLayout_25">
@@ -2513,8 +2509,8 @@
            <rect>
             <x>0</x>
             <y>0</y>
-            <width>658</width>
-            <height>573</height>
+            <width>529</width>
+            <height>199</height>
            </rect>
           </property>
           <layout class="QVBoxLayout" name="verticalLayout_20">
@@ -2672,8 +2668,8 @@
            <rect>
             <x>0</x>
             <y>0</y>
-            <width>658</width>
-            <height>573</height>
+            <width>615</width>
+            <height>169</height>
            </rect>
           </property>
           <layout class="QVBoxLayout" name="verticalLayout_vesc_manual">
@@ -3445,5 +3441,37 @@
     </hint>
    </hints>
   </connection>
+  <connection>
+   <sender>editor_long_line_marker</sender>
+   <signal>toggled(bool)</signal>
+   <receiver>editor_long_line_marker_line</receiver>
+   <slot>setEnabled(bool)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>252</x>
+     <y>397</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>346</x>
+     <y>397</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>editor_long_line_marker</sender>
+   <signal>toggled(bool)</signal>
+   <receiver>editor_long_line_marker_background</receiver>
+   <slot>setEnabled(bool)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>252</x>
+     <y>397</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>428</x>
+     <y>397</y>
+    </hint>
+   </hints>
+  </connection>
  </connections>
 </ui>