# HG changeset patch # User Torsten # Date 1390502143 -3600 # Node ID 3df71e1d3b246b91202137ce773f0a980df9f5f5 # Parent 1ecfcfa4858e3e988f9834ff6e2d0a3fd747c263 improve width of editor tabs when showing complete file path * settings-dialog.ui (editor tab): new option for min tab width * settings-dialog.cc (constructor): init new spin box for min tab width; (write-changed-settings): read value from new spin box for min tab width * file-editor.cc (notice-settings): elife mode and style sheet for tabs width new min. and max. option only when displaying complete path diff -r 1ecfcfa4858e -r 3df71e1d3b24 libgui/src/m-editor/file-editor.cc --- a/libgui/src/m-editor/file-editor.cc Thu Jan 23 03:43:11 2014 -0500 +++ b/libgui/src/m-editor/file-editor.cc Thu Jan 23 19:35:43 2014 +0100 @@ -856,10 +856,26 @@ int icon_size = settings->value ("toolbar_icon_size", 16).toInt (); _tool_bar->setIconSize (QSize (icon_size, icon_size)); - int tab_width = settings->value ("editor/notebook_tab_width", 300).toInt (); - QString style_sheet = QString ("QTabBar::tab {max-height: 4ex; " - "max-width: %1px; text-align: right }"). - arg (tab_width); + int tab_width_min = settings->value ("editor/notebook_tab_width_min", 160) + .toInt (); + int tab_width_max = settings->value ("editor/notebook_tab_width_max", 300) + .toInt (); + + QString style_sheet; + if (settings->value ("editor/longWindowTitle", false).toBool ()) + { + style_sheet = QString ("QTabBar::tab {max-height: 4ex; " + "min-width: %1px; max-width: %2px;}") + .arg (tab_width_min).arg (tab_width_max); + _tab_widget->setElideMode (Qt::ElideLeft); + } + else + { + style_sheet = QString ("QTabBar::tab {max-height: 4ex;}"); + _tab_widget->setElideMode (Qt::ElideNone); + } + + _tab_widget->setUsesScrollButtons (true); _tab_widget->setStyleSheet (style_sheet); // Relay signal to file editor tabs. @@ -894,8 +910,6 @@ #ifdef HAVE_QTABWIDGET_SETMOVABLE _tab_widget->setMovable (true); #endif - _tab_widget->setElideMode (Qt::ElideLeft); - QAction *new_action = new QAction (QIcon (":/actions/icons/filenew.png"), tr ("&New File"), _tool_bar); diff -r 1ecfcfa4858e -r 3df71e1d3b24 libgui/src/settings-dialog.cc --- a/libgui/src/settings-dialog.cc Thu Jan 23 03:43:11 2014 -0500 +++ b/libgui/src/settings-dialog.cc Thu Jan 23 19:35:43 2014 +0100 @@ -173,8 +173,10 @@ settings->value ("editor/tab_width", 2).toInt ()); ui->editor_longWindowTitle->setChecked ( settings->value ("editor/longWindowTitle",false).toBool ()); - ui->editor_notebook_tab_width->setValue ( - settings->value ("editor/notebook_tab_width", 300).toInt ()); + ui->editor_notebook_tab_width_min->setValue ( + settings->value ("editor/notebook_tab_width_min", 160).toInt ()); + ui->editor_notebook_tab_width_max->setValue ( + settings->value ("editor/notebook_tab_width_max", 300).toInt ()); ui->editor_restoreSession->setChecked ( settings->value ("editor/restoreSession", true).toBool ()); ui->editor_create_new_file->setChecked ( @@ -570,8 +572,10 @@ ui->editor_tab_width_spinbox->value ()); settings->setValue ("editor/longWindowTitle", ui->editor_longWindowTitle->isChecked ()); - settings->setValue ("editor/notebook_tab_width", - ui->editor_notebook_tab_width->value ()); + settings->setValue ("editor/notebook_tab_width_min", + ui->editor_notebook_tab_width_min->value ()); + settings->setValue ("editor/notebook_tab_width_max", + ui->editor_notebook_tab_width_max->value ()); settings->setValue ("editor/restoreSession", ui->editor_restoreSession->isChecked ()); settings->setValue ("editor/create_new_file", diff -r 1ecfcfa4858e -r 3df71e1d3b24 libgui/src/settings-dialog.ui --- a/libgui/src/settings-dialog.ui Thu Jan 23 03:43:11 2014 -0500 +++ b/libgui/src/settings-dialog.ui Thu Jan 23 19:35:43 2014 +0100 @@ -32,7 +32,7 @@ - 0 + 1 @@ -388,7 +388,7 @@ 0 0 - 554 + 662 399 @@ -554,16 +554,45 @@ - + - Max. tab width in pixel + Tab width min. - - + + - 100 + 80 + + + 600 + + + 20 + + + 160 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + 180 600 @@ -576,18 +605,12 @@ - - - - Qt::Horizontal + + + + max. - - - 40 - 20 - - - + @@ -1327,8 +1350,8 @@ 0 0 - 474 - 318 + 678 + 378 @@ -1491,8 +1514,8 @@ 0 0 - 154 - 114 + 678 + 378 @@ -1569,8 +1592,8 @@ 0 0 - 529 - 204 + 678 + 378 @@ -2174,5 +2197,69 @@ + + editor_longWindowTitle + toggled(bool) + editor_lbl_min_tab_width + setEnabled(bool) + + + 145 + 72 + + + 343 + 72 + + + + + editor_longWindowTitle + toggled(bool) + editor_notebook_tab_width_max + setEnabled(bool) + + + 145 + 72 + + + 437 + 72 + + + + + editor_longWindowTitle + toggled(bool) + editor_lbl_max_tab_width + setEnabled(bool) + + + 145 + 72 + + + 439 + 72 + + + + + editor_longWindowTitle + toggled(bool) + editor_notebook_tab_width_min + setEnabled(bool) + + + 145 + 72 + + + 393 + 72 + + +