changeset 16703:5cf19370011d

add more settings concerning tabs and indentation to the editor settings * settings-dialog.ui: insert input widget for tabs and indentation * settings-dialog.cc(constructor): read state for input widgets from settings, (write_changed_settings): write state of input widgets into settings file * file-editor-tab.cc(notice-settings): load tab width and indentation options from settings
author Torsten <ttl@justmail.de>
date Sun, 26 May 2013 22:16:21 +0200
parents 553cfdd5d660
children e38a0fa08368
files libgui/src/m-editor/file-editor-tab.cc libgui/src/settings-dialog.cc libgui/src/settings-dialog.ui
diffstat 3 files changed, 206 insertions(+), 56 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/m-editor/file-editor-tab.cc	Sun May 26 14:49:41 2013 +0200
+++ b/libgui/src/m-editor/file-editor-tab.cc	Sun May 26 22:16:21 2013 +0200
@@ -1142,6 +1142,18 @@
       _edit_area->setMarginWidth (2, 0);
     }
 
+  _edit_area->setAutoIndent
+        (settings->value ("editor/auto_indent",true).toBool ());
+  _edit_area->setTabIndents
+        (settings->value ("editor/tab_indents_line",false).toBool ());
+  _edit_area->setBackspaceUnindents
+        (settings->value ("editor/backspace_unindents_line",false).toBool ());
+  _edit_area->setIndentationGuides
+        (settings->value ("editor/show_indent_guides",false).toBool ());
+
+  _edit_area->setTabWidth
+        (settings->value ("editor/tab_width",2).toInt ());
+
   _long_title = settings->value ("editor/longWindowTitle", false).toBool ();
 
   update_window_title (false);
--- a/libgui/src/settings-dialog.cc	Sun May 26 14:49:41 2013 +0200
+++ b/libgui/src/settings-dialog.cc	Sun May 26 22:16:21 2013 +0200
@@ -110,6 +110,12 @@
   ui->editor_checkbox_ac_replace->setChecked (settings->value ("editor/codeCompletion_replace",false).toBool ());
   ui->editor_ws_checkbox->setChecked (settings->value ("editor/show_white_space",false).toBool ());
   ui->editor_ws_indent_checkbox->setChecked (settings->value ("editor/show_white_space_indent",false).toBool ());
+  ui->editor_auto_ind_checkbox->setChecked (settings->value ("editor/auto_indent",true).toBool ());
+  ui->editor_tab_ind_checkbox->setChecked (settings->value ("editor/tab_indents_line",false).toBool ());
+  ui->editor_bs_unind_checkbox->setChecked (settings->value ("editor/backspace_unindents_line",false).toBool ());
+  ui->editor_ind_guides_checkbox->setChecked (settings->value ("editor/show_indent_guides",false).toBool ());
+  ui->editor_ind_width_spinbox->setValue (settings->value ("editor/indent_width",2).toInt ());
+  ui->editor_tab_width_spinbox->setValue (settings->value ("editor/tab_width",2).toInt ());
   ui->editor_longWindowTitle->setChecked (settings->value ("editor/longWindowTitle",false).toBool ());
   ui->editor_restoreSession->setChecked (settings->value ("editor/restoreSession",true).toBool ());
   ui->terminal_fontName->setCurrentFont (QFont (settings->value ("terminal/fontName","Courier New").toString()) );
@@ -415,6 +421,12 @@
   settings->setValue ("editor/codeCompletion_replace", ui->editor_checkbox_ac_replace->isChecked ());
   settings->setValue ("editor/show_white_space", ui->editor_ws_checkbox->isChecked ());
   settings->setValue ("editor/show_white_space_indent", ui->editor_ws_indent_checkbox->isChecked ());
+  settings->setValue ("editor/auto_indent", ui->editor_auto_ind_checkbox->isChecked ());
+  settings->setValue ("editor/tab_indents_line", ui->editor_tab_ind_checkbox->isChecked ());
+  settings->setValue ("editor/backspace_unindents_line", ui->editor_bs_unind_checkbox->isChecked ());
+  settings->setValue ("editor/show_indent_guides", ui->editor_ind_guides_checkbox->isChecked ());
+  settings->setValue ("editor/indent_width", ui->editor_ind_width_spinbox->value ());
+  settings->setValue ("editor/tab_width", ui->editor_tab_width_spinbox->value ());
   settings->setValue ("editor/longWindowTitle", ui->editor_longWindowTitle->isChecked());
   settings->setValue ("editor/restoreSession", ui->editor_restoreSession->isChecked ());
   settings->setValue ("terminal/fontSize", ui->terminal_fontSize->value());
--- a/libgui/src/settings-dialog.ui	Sun May 26 14:49:41 2013 +0200
+++ b/libgui/src/settings-dialog.ui	Sun May 26 22:16:21 2013 +0200
@@ -198,6 +198,13 @@
        <item>
         <layout class="QVBoxLayout" name="verticalLayout_9">
          <item>
+          <widget class="QCheckBox" name="editor_longWindowTitle">
+           <property name="text">
+            <string>Show complete path in window title</string>
+           </property>
+          </widget>
+         </item>
+         <item>
           <widget class="QCheckBox" name="editor_showLineNumbers">
            <property name="enabled">
             <bool>true</bool>
@@ -222,7 +229,7 @@
               <bool>false</bool>
              </property>
              <property name="text">
-              <string>But no white spaces used for indentation</string>
+              <string>Do not show white spaces used for indentation</string>
              </property>
             </widget>
            </item>
@@ -297,6 +304,98 @@
              <property name="orientation">
               <enum>Qt::Horizontal</enum>
              </property>
+             <property name="sizeType">
+              <enum>QSizePolicy::Fixed</enum>
+             </property>
+             <property name="sizeHint" stdset="0">
+              <size>
+               <width>80</width>
+               <height>20</height>
+              </size>
+             </property>
+            </spacer>
+           </item>
+          </layout>
+         </item>
+         <item>
+          <widget class="Line" name="line">
+           <property name="orientation">
+            <enum>Qt::Horizontal</enum>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <layout class="QGridLayout" name="gridLayout_4">
+           <item row="0" column="0">
+            <widget class="QLabel" name="label_13">
+             <property name="text">
+              <string>Indent width</string>
+             </property>
+            </widget>
+           </item>
+           <item row="2" column="4">
+            <widget class="QCheckBox" name="editor_tab_ind_checkbox">
+             <property name="text">
+              <string>Tab indents line</string>
+             </property>
+            </widget>
+           </item>
+           <item row="0" column="4">
+            <widget class="QCheckBox" name="editor_auto_ind_checkbox">
+             <property name="text">
+              <string>Auto indentation</string>
+             </property>
+            </widget>
+           </item>
+           <item row="0" column="2">
+            <widget class="QSpinBox" name="editor_ind_width_spinbox">
+             <property name="minimum">
+              <number>1</number>
+             </property>
+             <property name="maximum">
+              <number>32</number>
+             </property>
+             <property name="value">
+              <number>2</number>
+             </property>
+            </widget>
+           </item>
+           <item row="2" column="0">
+            <widget class="QLabel" name="label_14">
+             <property name="text">
+              <string>Tab width</string>
+             </property>
+            </widget>
+           </item>
+           <item row="0" column="5">
+            <widget class="QCheckBox" name="editor_ind_guides_checkbox">
+             <property name="text">
+              <string>Show indentation guides</string>
+             </property>
+            </widget>
+           </item>
+           <item row="2" column="2">
+            <widget class="QSpinBox" name="editor_tab_width_spinbox">
+             <property name="minimum">
+              <number>1</number>
+             </property>
+             <property name="maximum">
+              <number>32</number>
+             </property>
+            </widget>
+           </item>
+           <item row="2" column="5">
+            <widget class="QCheckBox" name="editor_bs_unind_checkbox">
+             <property name="text">
+              <string>Backspace unindents line</string>
+             </property>
+            </widget>
+           </item>
+           <item row="0" column="9">
+            <spacer name="horizontalSpacer_13">
+             <property name="orientation">
+              <enum>Qt::Horizontal</enum>
+             </property>
              <property name="sizeHint" stdset="0">
               <size>
                <width>40</width>
@@ -308,16 +407,9 @@
           </layout>
          </item>
          <item>
-          <widget class="QCheckBox" name="editor_longWindowTitle">
-           <property name="text">
-            <string>Show complete path in window title</string>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <widget class="QCheckBox" name="editor_restoreSession">
-           <property name="text">
-            <string>Restore tabs from previous session on startup</string>
+          <widget class="Line" name="line_2">
+           <property name="orientation">
+            <enum>Qt::Horizontal</enum>
            </property>
           </widget>
          </item>
@@ -472,9 +564,30 @@
            </item>
           </layout>
          </item>
+         <item>
+          <widget class="Line" name="line_3">
+           <property name="orientation">
+            <enum>Qt::Horizontal</enum>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QCheckBox" name="editor_restoreSession">
+           <property name="text">
+            <string>Restore editor tabs from previous session on startup</string>
+           </property>
+          </widget>
+         </item>
         </layout>
        </item>
        <item>
+        <widget class="Line" name="line_4">
+         <property name="orientation">
+          <enum>Qt::Horizontal</enum>
+         </property>
+        </widget>
+       </item>
+       <item>
         <spacer name="verticalSpacer">
          <property name="orientation">
           <enum>Qt::Vertical</enum>
@@ -714,7 +827,7 @@
         <item>
          <widget class="QLabel" name="label_12">
           <property name="text">
-           <string>Font Size</string>
+           <string>Font size</string>
           </property>
          </widget>
         </item>
@@ -839,25 +952,18 @@
       </attribute>
       <layout class="QVBoxLayout" name="verticalLayout_4">
        <item>
-        <widget class="QCheckBox" name="useProxyServer">
-         <property name="text">
-          <string>Use proxy server</string>
-         </property>
-        </widget>
-       </item>
-       <item>
-        <layout class="QFormLayout" name="formLayout">
-         <item row="0" column="0">
-          <widget class="QLabel" name="label_3">
+        <layout class="QGridLayout" name="gridLayout_5">
+         <item row="1" column="1">
+          <widget class="QLabel" name="label_4">
            <property name="enabled">
             <bool>false</bool>
            </property>
            <property name="text">
-            <string>Proxy Type:</string>
+            <string>Hostname:</string>
            </property>
           </widget>
          </item>
-         <item row="0" column="1">
+         <item row="0" column="2">
           <widget class="QComboBox" name="proxyType">
            <property name="enabled">
             <bool>false</bool>
@@ -874,24 +980,34 @@
            </item>
           </widget>
          </item>
-         <item row="1" column="0">
-          <widget class="QLabel" name="label_4">
+         <item row="3" column="1">
+          <widget class="QLabel" name="label_6">
            <property name="enabled">
             <bool>false</bool>
            </property>
            <property name="text">
-            <string>Hostname:</string>
+            <string>Username:</string>
+           </property>
+          </widget>
+         </item>
+         <item row="0" column="0">
+          <widget class="QCheckBox" name="useProxyServer">
+           <property name="text">
+            <string>Use proxy server</string>
            </property>
           </widget>
          </item>
-         <item row="1" column="1">
-          <widget class="QLineEdit" name="proxyHostName">
+         <item row="0" column="1">
+          <widget class="QLabel" name="label_3">
            <property name="enabled">
             <bool>false</bool>
            </property>
+           <property name="text">
+            <string>Proxy Type:</string>
+           </property>
           </widget>
          </item>
-         <item row="2" column="0">
+         <item row="2" column="1">
           <widget class="QLabel" name="label_5">
            <property name="enabled">
             <bool>false</bool>
@@ -901,31 +1017,7 @@
            </property>
           </widget>
          </item>
-         <item row="2" column="1">
-          <widget class="QLineEdit" name="proxyPort">
-           <property name="enabled">
-            <bool>false</bool>
-           </property>
-          </widget>
-         </item>
-         <item row="3" column="0">
-          <widget class="QLabel" name="label_6">
-           <property name="enabled">
-            <bool>false</bool>
-           </property>
-           <property name="text">
-            <string>Username:</string>
-           </property>
-          </widget>
-         </item>
-         <item row="3" column="1">
-          <widget class="QLineEdit" name="proxyUserName">
-           <property name="enabled">
-            <bool>false</bool>
-           </property>
-          </widget>
-         </item>
-         <item row="4" column="0">
+         <item row="4" column="1">
           <widget class="QLabel" name="label_7">
            <property name="enabled">
             <bool>false</bool>
@@ -935,7 +1027,28 @@
            </property>
           </widget>
          </item>
-         <item row="4" column="1">
+         <item row="1" column="2">
+          <widget class="QLineEdit" name="proxyHostName">
+           <property name="enabled">
+            <bool>false</bool>
+           </property>
+          </widget>
+         </item>
+         <item row="2" column="2">
+          <widget class="QLineEdit" name="proxyPort">
+           <property name="enabled">
+            <bool>false</bool>
+           </property>
+          </widget>
+         </item>
+         <item row="3" column="2">
+          <widget class="QLineEdit" name="proxyUserName">
+           <property name="enabled">
+            <bool>false</bool>
+           </property>
+          </widget>
+         </item>
+         <item row="4" column="2">
           <widget class="QLineEdit" name="proxyPassword">
            <property name="enabled">
             <bool>false</bool>
@@ -947,6 +1060,19 @@
          </item>
         </layout>
        </item>
+       <item>
+        <spacer name="verticalSpacer_5">
+         <property name="orientation">
+          <enum>Qt::Vertical</enum>
+         </property>
+         <property name="sizeHint" stdset="0">
+          <size>
+           <width>20</width>
+           <height>40</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
       </layout>
      </widget>
     </widget>