# HG changeset patch # User Torsten # Date 1389736303 -3600 # Node ID 4dadae02bd4cda81493b67709e2985ff88c8a6b3 # Parent 8d98ebeceab40af514f8bdcd52c68128ec3ce806 max. width of editor tabs limited and configurable * settings-dialog.ui: new spin box for max. tab width * settings-dialog.cc (constructor): set spin box value from settings file; (write_changed_settings): write spin box value into settings file * file-editor.cc (construct): set right text alignment in editor tabs; (notice_settings): set tab's style sheet depending on tab width diff -r 8d98ebeceab4 -r 4dadae02bd4c libgui/src/m-editor/file-editor.cc --- a/libgui/src/m-editor/file-editor.cc Tue Jan 14 13:17:55 2014 -0800 +++ b/libgui/src/m-editor/file-editor.cc Tue Jan 14 22:51:43 2014 +0100 @@ -842,6 +842,13 @@ { int icon_size = settings->value ("toolbar_icon_size", 16).toInt (); _tool_bar->setIconSize (QSize (icon_size, icon_size)); + + int tab_width = settings->value ("editor/tab_width", 300).toInt (); + QString style_sheet = QString ("QTabBar::tab {max-height: 4ex; " + "max-width: %1px; text-align: right }"). + arg (tab_width); + _tab_widget->setStyleSheet (style_sheet); + // Relay signal to file editor tabs. emit fetab_settings_changed (settings); } @@ -874,8 +881,7 @@ #ifdef HAVE_QTABWIDGET_SETMOVABLE _tab_widget->setMovable (true); #endif - _tab_widget->setStyleSheet ("QTabBar::tab {max-height: 4ex; }"); - + _tab_widget->setElideMode (Qt::ElideLeft); QAction *new_action = new QAction (QIcon (":/actions/icons/filenew.png"), diff -r 8d98ebeceab4 -r 4dadae02bd4c libgui/src/settings-dialog.cc --- a/libgui/src/settings-dialog.cc Tue Jan 14 13:17:55 2014 -0800 +++ b/libgui/src/settings-dialog.cc Tue Jan 14 22:51:43 2014 +0100 @@ -162,6 +162,8 @@ settings->value ("editor/tab_width", 2).toInt ()); ui->editor_longWindowTitle->setChecked ( settings->value ("editor/longWindowTitle",false).toBool ()); + ui->editor_tab_width->setValue ( + settings->value ("editor/tab_width", 300).toInt ()); ui->editor_restoreSession->setChecked ( settings->value ("editor/restoreSession", true).toBool ()); ui->editor_create_new_file->setChecked ( @@ -539,6 +541,8 @@ ui->editor_tab_width_spinbox->value ()); settings->setValue ("editor/longWindowTitle", ui->editor_longWindowTitle->isChecked ()); + settings->setValue ("editor/tab_width", + ui->editor_tab_width->value ()); settings->setValue ("editor/restoreSession", ui->editor_restoreSession->isChecked ()); settings->setValue ("editor/create_new_file", diff -r 8d98ebeceab4 -r 4dadae02bd4c libgui/src/settings-dialog.ui --- a/libgui/src/settings-dialog.ui Tue Jan 14 13:17:55 2014 -0800 +++ b/libgui/src/settings-dialog.ui Tue Jan 14 22:51:43 2014 +0100 @@ -32,7 +32,7 @@ - 0 + 1 @@ -294,14 +294,14 @@ 6 - + Show whitespace - + true @@ -311,14 +311,14 @@ - + Show complete path in window title - + false @@ -328,7 +328,20 @@ - + + + + Qt::Horizontal + + + + 40 + 20 + + + + + true @@ -338,7 +351,7 @@ - + 12 @@ -387,7 +400,7 @@ - + Qt::Horizontal @@ -400,41 +413,84 @@ + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + - - - Qt::Horizontal - - - - 40 - 20 - - - + + + + + Max. tab width in pixel + + + + + + + 100 + + + 600 + + + 20 + + + 300 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + - - + + Qt::Horizontal - - - 40 - 20 - - - - - - - - Qt::Horizontal + + QSizePolicy::Fixed - 40 - 20 + 10 + 0 @@ -453,8 +509,22 @@ 0 - - + + + + Indent width + + + + + + + Tab indents line + + + + + Qt::Horizontal @@ -469,20 +539,6 @@ - - - - Indent width - - - - - - - Tab indents line - - - @@ -547,8 +603,21 @@ - - + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + Qt::Horizontal @@ -563,19 +632,6 @@ - - - - Qt::Horizontal - - - - 40 - 20 - - - -