changeset 29468:46def32e6806

do not allow full path in editor tabs * gui-preferences-ed.h: remove preferences for long tab titles, min. and max. width of tabs * file-editor-tab.cc (update_window_title): always use file name for title; (notice_settings): remove setting the related class variable * file-editor-tab.h: remove class variable for long tab titles * file-editor.cc (notice_settings): remove code for style sheet with min. and max. width * settings-dialog.cc (settings_dialog): do not initialize removed items; (write_changed_settings): remove storing vlaues of obsolete items * settings-dialog.ui: remove all items related to long titles with min. and max. width
author Torsten Lilge <ttl-octave@mailbox.org>
date Mon, 29 Mar 2021 07:54:26 +0200
parents 80457383d5e1
children b4906d3eeb63 2ae4764180c6
files libgui/src/gui-preferences-ed.h libgui/src/m-editor/file-editor-tab.cc libgui/src/m-editor/file-editor-tab.h libgui/src/m-editor/file-editor.cc libgui/src/settings-dialog.cc libgui/src/settings-dialog.ui
diffstat 6 files changed, 13 insertions(+), 226 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/gui-preferences-ed.h	Sun Mar 28 22:55:08 2021 +0200
+++ b/libgui/src/gui-preferences-ed.h	Mon Mar 29 07:54:26 2021 +0200
@@ -213,15 +213,6 @@
 // File handling
 
 const gui_pref
-ed_long_window_title ("editor/longWindowTitle", QVariant (false));
-
-const gui_pref
-ed_notebook_tab_width_min ("editor/notebook_tab_width_min", QVariant (160));
-
-const gui_pref
-ed_notebook_tab_width_max ("editor/notebook_tab_width_max", QVariant (300));
-
-const gui_pref
 ed_force_newline ("editor/force_newline", QVariant (true));
 
 const gui_pref
--- a/libgui/src/m-editor/file-editor-tab.cc	Sun Mar 28 22:55:08 2021 +0200
+++ b/libgui/src/m-editor/file-editor-tab.cc	Mon Mar 29 07:54:26 2021 +0200
@@ -1632,14 +1632,9 @@
       title = tr ("<unnamed>");
     else
       {
-        if (m_long_title)
-          title = m_file_name;
-        else
-          {
-            QFileInfo file (m_file_name);
-            title = file.fileName ();
-            tooltip = m_file_name;
-          }
+        QFileInfo file (m_file_name);
+        title = file.fileName ();
+        tooltip = m_file_name;
       }
 
     emit file_name_changed (title, tooltip, modified);
@@ -2730,7 +2725,6 @@
     m_edit_area->SendScintilla (QsciScintillaBase::SCI_SETSCROLLWIDTH,-1);
     m_edit_area->SendScintilla (QsciScintillaBase::SCI_SETSCROLLWIDTHTRACKING,true);
 
-    m_long_title = settings->value (ed_long_window_title).toBool ();
     update_window_title (m_edit_area->isModified ());
 
     m_auto_endif = settings->value (ed_auto_endif).toInt ();
--- a/libgui/src/m-editor/file-editor-tab.h	Sun Mar 28 22:55:08 2021 +0200
+++ b/libgui/src/m-editor/file-editor-tab.h	Mon Mar 29 07:54:26 2021 +0200
@@ -307,7 +307,6 @@
     QDateTime m_last_modified;
 
     bool m_autoc_active;
-    bool m_long_title;
     bool m_copy_available;
     bool m_is_octave_file;
     bool m_always_reload_changed_files;
--- a/libgui/src/m-editor/file-editor.cc	Sun Mar 28 22:55:08 2021 +0200
+++ b/libgui/src/m-editor/file-editor.cc	Mon Mar 29 07:54:26 2021 +0200
@@ -1283,20 +1283,6 @@
                                  "max-" + width_str + ": %2px; }")
                           .arg (height).arg (width);
 
-    // Style sheet for tab height together with width when full path is shown
-    if (settings->value (ed_long_window_title).toBool ())
-      {
-        // Min and max width for full path titles
-        int tab_width_min = settings->value (ed_notebook_tab_width_min).toInt ();
-        int tab_width_max = settings->value (ed_notebook_tab_width_max).toInt ();
-        style_sheet = QString ("QTabBar::tab "
-                               " {max-" + height_str + ": %1px;"
-                               "  min-" + width_str + ": %2px;"
-                               "  max-" + width_str + ": %3px;}")
-                      .arg (height).arg (tab_width_min).arg (tab_width_max);
-        m_tab_widget->setElideMode (Qt::ElideLeft);
-      }
-
 #if defined (Q_OS_MAC)
     // FIXME: This is a workaround for missing tab close buttons on MacOS
     // in several Qt versions (https://bugreports.qt.io/browse/QTBUG-61092)
--- a/libgui/src/settings-dialog.cc	Sun Mar 28 22:55:08 2021 +0200
+++ b/libgui/src/settings-dialog.cc	Mon Mar 29 07:54:26 2021 +0200
@@ -352,9 +352,6 @@
     editor_ind_width_spinbox->setValue (settings->value (ed_indent_width).toInt ());
     editor_ind_uses_tabs_checkbox->setChecked (settings->value (ed_indent_uses_tabs).toBool ());
     editor_tab_width_spinbox->setValue (settings->value (ed_tab_width).toInt ());
-    editor_longWindowTitle->setChecked (settings->value (ed_long_window_title).toBool ());
-    editor_notebook_tab_width_min->setValue (settings->value (ed_notebook_tab_width_min).toInt ());
-    editor_notebook_tab_width_max->setValue (settings->value (ed_notebook_tab_width_max).toInt ());
     editor_restoreSession->setChecked (settings->value (ed_restore_session).toBool ());
     editor_create_new_file->setChecked (settings->value (ed_create_new_file).toBool ());
     editor_reload_changed_files->setChecked (settings->value (ed_always_reload_changed_files).toBool ());
@@ -992,9 +989,6 @@
     settings->setValue (ed_indent_width.key, editor_ind_width_spinbox->value ());
     settings->setValue (ed_indent_uses_tabs.key, editor_ind_uses_tabs_checkbox->isChecked ());
     settings->setValue (ed_tab_width.key, editor_tab_width_spinbox->value ());
-    settings->setValue (ed_long_window_title.key, editor_longWindowTitle->isChecked ());
-    settings->setValue (ed_notebook_tab_width_min.key, editor_notebook_tab_width_min->value ());
-    settings->setValue (ed_notebook_tab_width_max.key, editor_notebook_tab_width_max->value ());
     settings->setValue (ed_restore_session.key, editor_restoreSession->isChecked ());
     settings->setValue (ed_create_new_file.key, editor_create_new_file->isChecked ());
     settings->setValue (ed_hiding_closes_files.key, editor_hiding_closes_files->isChecked ());
--- a/libgui/src/settings-dialog.ui	Sun Mar 28 22:55:08 2021 +0200
+++ b/libgui/src/settings-dialog.ui	Mon Mar 29 07:54:26 2021 +0200
@@ -863,7 +863,7 @@
             <x>0</x>
             <y>0</y>
             <width>1021</width>
-            <height>1530</height>
+            <height>1494</height>
            </rect>
           </property>
           <layout class="QVBoxLayout" name="verticalLayout_16">
@@ -1199,23 +1199,7 @@
              <layout class="QVBoxLayout" name="verticalLayout_32">
               <item>
                <layout class="QGridLayout" name="gridLayout_23">
-                <item row="1" column="1">
-                 <spacer name="horizontalSpacer_24">
-                  <property name="orientation">
-                   <enum>Qt::Horizontal</enum>
-                  </property>
-                  <property name="sizeType">
-                   <enum>QSizePolicy::Fixed</enum>
-                  </property>
-                  <property name="sizeHint" stdset="0">
-                   <size>
-                    <width>10</width>
-                    <height>0</height>
-                   </size>
-                  </property>
-                 </spacer>
-                </item>
-                <item row="0" column="2">
+                <item row="0" column="1">
                  <layout class="QHBoxLayout" name="horizontalLayout_21">
                   <item>
                    <widget class="QComboBox" name="editor_combox_tab_pos"/>
@@ -1226,12 +1210,12 @@
                      <enum>Qt::Horizontal</enum>
                     </property>
                     <property name="sizeType">
-                     <enum>QSizePolicy::Expanding</enum>
+                     <enum>QSizePolicy::Fixed</enum>
                     </property>
                     <property name="sizeHint" stdset="0">
                      <size>
                       <width>20</width>
-                      <height>20</height>
+                      <height>10</height>
                      </size>
                     </property>
                    </spacer>
@@ -1251,10 +1235,13 @@
                     <property name="orientation">
                      <enum>Qt::Horizontal</enum>
                     </property>
+                    <property name="sizeType">
+                     <enum>QSizePolicy::Fixed</enum>
+                    </property>
                     <property name="sizeHint" stdset="0">
                      <size>
-                      <width>40</width>
-                      <height>20</height>
+                      <width>20</width>
+                      <height>10</height>
                      </size>
                     </property>
                    </spacer>
@@ -1268,107 +1255,7 @@
                   </property>
                  </widget>
                 </item>
-                <item row="1" column="2">
-                 <layout class="QHBoxLayout" name="horizontalLayout_20">
-                  <property name="rightMargin">
-                   <number>0</number>
-                  </property>
-                  <item>
-                   <widget class="QLabel" name="editor_lbl_min_tab_width">
-                    <property name="enabled">
-                     <bool>false</bool>
-                    </property>
-                    <property name="text">
-                     <string>Tab width min.</string>
-                    </property>
-                   </widget>
-                  </item>
-                  <item>
-                   <widget class="QSpinBox" name="editor_notebook_tab_width_min">
-                    <property name="sizePolicy">
-                     <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
-                      <horstretch>0</horstretch>
-                      <verstretch>0</verstretch>
-                     </sizepolicy>
-                    </property>
-                    <property name="minimum">
-                     <number>80</number>
-                    </property>
-                    <property name="maximum">
-                     <number>600</number>
-                    </property>
-                    <property name="singleStep">
-                     <number>20</number>
-                    </property>
-                    <property name="value">
-                     <number>160</number>
-                    </property>
-                   </widget>
-                  </item>
-                  <item>
-                   <widget class="QLabel" name="editor_lbl_max_tab_width">
-                    <property name="enabled">
-                     <bool>false</bool>
-                    </property>
-                    <property name="text">
-                     <string>max.</string>
-                    </property>
-                   </widget>
-                  </item>
-                  <item>
-                   <widget class="QSpinBox" name="editor_notebook_tab_width_max">
-                    <property name="enabled">
-                     <bool>false</bool>
-                    </property>
-                    <property name="sizePolicy">
-                     <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
-                      <horstretch>0</horstretch>
-                      <verstretch>0</verstretch>
-                     </sizepolicy>
-                    </property>
-                    <property name="minimum">
-                     <number>180</number>
-                    </property>
-                    <property name="maximum">
-                     <number>600</number>
-                    </property>
-                    <property name="singleStep">
-                     <number>20</number>
-                    </property>
-                    <property name="value">
-                     <number>300</number>
-                    </property>
-                   </widget>
-                  </item>
-                 </layout>
-                </item>
-                <item row="1" column="0">
-                 <widget class="QCheckBox" name="editor_longWindowTitle">
-                  <property name="sizePolicy">
-                   <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
-                    <horstretch>0</horstretch>
-                    <verstretch>0</verstretch>
-                   </sizepolicy>
-                  </property>
-                  <property name="text">
-                   <string>Show complete path in title</string>
-                  </property>
-                 </widget>
-                </item>
-                <item row="1" column="3">
-                 <spacer name="horizontalSpacer_5">
-                  <property name="orientation">
-                   <enum>Qt::Horizontal</enum>
-                  </property>
-                  <property name="sizeHint" stdset="0">
-                   <size>
-                    <width>40</width>
-                    <height>20</height>
-                   </size>
-                  </property>
-                 </spacer>
-                </item>
-                <item row="0" column="3">
+                <item row="0" column="2">
                  <layout class="QHBoxLayout" name="horizontalLayout_15">
                   <item>
                    <widget class="QLabel" name="label_3">
@@ -3294,70 +3181,6 @@
    </hints>
   </connection>
   <connection>
-   <sender>editor_longWindowTitle</sender>
-   <signal>toggled(bool)</signal>
-   <receiver>editor_lbl_min_tab_width</receiver>
-   <slot>setEnabled(bool)</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>145</x>
-     <y>72</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>343</x>
-     <y>72</y>
-    </hint>
-   </hints>
-  </connection>
-  <connection>
-   <sender>editor_longWindowTitle</sender>
-   <signal>toggled(bool)</signal>
-   <receiver>editor_notebook_tab_width_max</receiver>
-   <slot>setEnabled(bool)</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>145</x>
-     <y>72</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>437</x>
-     <y>72</y>
-    </hint>
-   </hints>
-  </connection>
-  <connection>
-   <sender>editor_longWindowTitle</sender>
-   <signal>toggled(bool)</signal>
-   <receiver>editor_lbl_max_tab_width</receiver>
-   <slot>setEnabled(bool)</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>145</x>
-     <y>72</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>439</x>
-     <y>72</y>
-    </hint>
-   </hints>
-  </connection>
-  <connection>
-   <sender>editor_longWindowTitle</sender>
-   <signal>toggled(bool)</signal>
-   <receiver>editor_notebook_tab_width_min</receiver>
-   <slot>setEnabled(bool)</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>145</x>
-     <y>72</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>393</x>
-     <y>72</y>
-    </hint>
-   </hints>
-  </connection>
-  <connection>
    <sender>editor_checkbox_ac_keywords</sender>
    <signal>toggled(bool)</signal>
    <receiver>editor_checkbox_ac_builtins</receiver>