From ab5306803ec468bab8f188c77f8065befa9eedad Mon Sep 17 00:00:00 2001 From: Juergen Spitzmueller Date: Sat, 2 Mar 2013 12:24:32 +0100 Subject: [PATCH] Split the overcrowded and chaotic UI pref pane into two (#7524) --- src/frontends/qt4/GuiPrefs.cpp | 103 +++++--- src/frontends/qt4/GuiPrefs.h | 15 ++ src/frontends/qt4/Makefile.am | 1 + src/frontends/qt4/ui/PrefDocHandlingUi.ui | 256 +++++++++++++++++++ src/frontends/qt4/ui/PrefUi.ui | 293 +++++++--------------- status.20x | 3 + 6 files changed, 429 insertions(+), 242 deletions(-) create mode 100644 src/frontends/qt4/ui/PrefDocHandlingUi.ui diff --git a/src/frontends/qt4/GuiPrefs.cpp b/src/frontends/qt4/GuiPrefs.cpp index 7f6bfa05a2..5a9c810e79 100644 --- a/src/frontends/qt4/GuiPrefs.cpp +++ b/src/frontends/qt4/GuiPrefs.cpp @@ -2491,6 +2491,66 @@ PrefUserInterface::PrefUserInterface(GuiPreferences * form) { setupUi(this); + connect(uiFilePB, SIGNAL(clicked()), + this, SLOT(selectUi())); + connect(uiFileED, SIGNAL(textChanged(QString)), + this, SIGNAL(changed())); + connect(iconSetCO, SIGNAL(activated(int)), + this, SIGNAL(changed())); + connect(lastfilesSB, SIGNAL(valueChanged(int)), + this, SIGNAL(changed())); + connect(tooltipCB, SIGNAL(toggled(bool)), + this, SIGNAL(changed())); + lastfilesSB->setMaximum(maxlastfiles); + + iconSetCO->addItem(qt_("Default"), QString()); + iconSetCO->addItem(qt_("Classic"), "classic"); + iconSetCO->addItem(qt_("Oxygen"), "oxygen"); +} + + +void PrefUserInterface::apply(LyXRC & rc) const +{ + rc.icon_set = fromqstr(iconSetCO->itemData( + iconSetCO->currentIndex()).toString()); + + rc.ui_file = internal_path(fromqstr(uiFileED->text())); + rc.num_lastfiles = lastfilesSB->value(); + rc.use_tooltip = tooltipCB->isChecked(); +} + + +void PrefUserInterface::update(LyXRC const & rc) +{ + int iconset = iconSetCO->findData(toqstr(rc.icon_set)); + if (iconset < 0) + iconset = 0; + iconSetCO->setCurrentIndex(iconset); + uiFileED->setText(toqstr(external_path(rc.ui_file))); + lastfilesSB->setValue(rc.num_lastfiles); + tooltipCB->setChecked(rc.use_tooltip); +} + + +void PrefUserInterface::selectUi() +{ + QString file = form_->browseUI(internalPath(uiFileED->text())); + if (!file.isEmpty()) + uiFileED->setText(file); +} + + +///////////////////////////////////////////////////////////////////// +// +// PrefDocumentHandling +// +///////////////////////////////////////////////////////////////////// + +PrefDocHandling::PrefDocHandling(GuiPreferences * form) + : PrefModule(qt_(catLookAndFeel), qt_("Document Handling"), form) +{ + setupUi(this); + connect(autoSaveCB, SIGNAL(toggled(bool)), autoSaveSB, SLOT(setEnabled(bool))); connect(autoSaveCB, SIGNAL(toggled(bool)), @@ -2504,12 +2564,6 @@ PrefUserInterface::PrefUserInterface(GuiPreferences * form) #endif connect(singleCloseTabButtonCB, SIGNAL(clicked()), this, SIGNAL(changed())); - connect(uiFilePB, SIGNAL(clicked()), - this, SLOT(selectUi())); - connect(uiFileED, SIGNAL(textChanged(QString)), - this, SIGNAL(changed())); - connect(iconSetCO, SIGNAL(activated(int)), - this, SIGNAL(changed())); connect(restoreCursorCB, SIGNAL(clicked()), this, SIGNAL(changed())); connect(loadSessionCB, SIGNAL(clicked()), @@ -2524,32 +2578,17 @@ PrefUserInterface::PrefUserInterface(GuiPreferences * form) this, SIGNAL(changed())); connect(saveCompressedCB, SIGNAL(clicked()), this, SIGNAL(changed())); - connect(lastfilesSB, SIGNAL(valueChanged(int)), - this, SIGNAL(changed())); - connect(tooltipCB, SIGNAL(toggled(bool)), - this, SIGNAL(changed())); - lastfilesSB->setMaximum(maxlastfiles); - - iconSetCO->addItem(qt_("Default"), QString()); - iconSetCO->addItem(qt_("Classic"), "classic"); - iconSetCO->addItem(qt_("Oxygen"), "oxygen"); } -void PrefUserInterface::apply(LyXRC & rc) const +void PrefDocHandling::apply(LyXRC & rc) const { - rc.icon_set = fromqstr(iconSetCO->itemData( - iconSetCO->currentIndex()).toString()); - - rc.ui_file = internal_path(fromqstr(uiFileED->text())); rc.use_lastfilepos = restoreCursorCB->isChecked(); rc.load_session = loadSessionCB->isChecked(); rc.allow_geometry_session = allowGeometrySessionCB->isChecked(); rc.autosave = autoSaveCB->isChecked() ? autoSaveSB->value() * 60 : 0; rc.make_backup = backupCB->isChecked(); rc.save_compressed = saveCompressedCB->isChecked(); - rc.num_lastfiles = lastfilesSB->value(); - rc.use_tooltip = tooltipCB->isChecked(); rc.open_buffers_in_tabs = openDocumentsInTabsCB->isChecked(); rc.single_instance = singleInstanceCB->isChecked(); rc.single_close_tab_button = singleCloseTabButtonCB->isChecked(); @@ -2559,13 +2598,8 @@ void PrefUserInterface::apply(LyXRC & rc) const } -void PrefUserInterface::update(LyXRC const & rc) +void PrefDocHandling::update(LyXRC const & rc) { - int iconset = iconSetCO->findData(toqstr(rc.icon_set)); - if (iconset < 0) - iconset = 0; - iconSetCO->setCurrentIndex(iconset); - uiFileED->setText(toqstr(external_path(rc.ui_file))); restoreCursorCB->setChecked(rc.use_lastfilepos); loadSessionCB->setChecked(rc.load_session); allowGeometrySessionCB->setChecked(rc.allow_geometry_session); @@ -2579,8 +2613,6 @@ void PrefUserInterface::update(LyXRC const & rc) autoSaveSB->setEnabled(autosave); backupCB->setChecked(rc.make_backup); saveCompressedCB->setChecked(rc.save_compressed); - lastfilesSB->setValue(rc.num_lastfiles); - tooltipCB->setChecked(rc.use_tooltip); openDocumentsInTabsCB->setChecked(rc.open_buffers_in_tabs); singleInstanceCB->setChecked(rc.single_instance && !rc.lyxpipes.empty()); singleInstanceCB->setEnabled(!rc.lyxpipes.empty()); @@ -2588,15 +2620,7 @@ void PrefUserInterface::update(LyXRC const & rc) } -void PrefUserInterface::selectUi() -{ - QString file = form_->browseUI(internalPath(uiFileED->text())); - if (!file.isEmpty()) - uiFileED->setText(file); -} - - -void PrefUserInterface::on_clearSessionPB_clicked() +void PrefDocHandling::on_clearSessionPB_clicked() { guiApp->clearSession(); } @@ -3209,6 +3233,7 @@ GuiPreferences::GuiPreferences(GuiView & lv) connect(restorePB, SIGNAL(clicked()), this, SLOT(slotRestore())); addModule(new PrefUserInterface(this)); + addModule(new PrefDocHandling(this)); addModule(new PrefEdit(this)); addModule(new PrefShortcuts(this)); PrefScreenFonts * screenfonts = new PrefScreenFonts(this); diff --git a/src/frontends/qt4/GuiPrefs.h b/src/frontends/qt4/GuiPrefs.h index 57b9a32cfc..bfb042ace1 100644 --- a/src/frontends/qt4/GuiPrefs.h +++ b/src/frontends/qt4/GuiPrefs.h @@ -33,6 +33,7 @@ #include "ui_PrefCompletionUi.h" #include "ui_PrefColorsUi.h" #include "ui_PrefDisplayUi.h" +#include "ui_PrefDocHandlingUi.h" #include "ui_PrefEditUi.h" #include "ui_PrefPathsUi.h" #include "ui_PrefShortcutsUi.h" @@ -424,10 +425,24 @@ public: public Q_SLOTS: void selectUi(); +}; + + +class PrefDocHandling : public PrefModule, public Ui::PrefDocHandlingUi +{ + Q_OBJECT +public: + PrefDocHandling(GuiPreferences * form); + + void apply(LyXRC & rc) const; + void update(LyXRC const & rc); + +public Q_SLOTS: void on_clearSessionPB_clicked(); }; + class PrefEdit : public PrefModule, public Ui::PrefEditUi { Q_OBJECT diff --git a/src/frontends/qt4/Makefile.am b/src/frontends/qt4/Makefile.am index caa41159ae..6bacb7bb83 100644 --- a/src/frontends/qt4/Makefile.am +++ b/src/frontends/qt4/Makefile.am @@ -309,6 +309,7 @@ UIFILES = \ PrefColorsUi.ui \ PrefCompletionUi.ui \ PrefConvertersUi.ui \ + PrefDocHandlingUi.ui \ PrefOutputUi.ui \ PrefDisplayUi.ui \ PrefEditUi.ui \ diff --git a/src/frontends/qt4/ui/PrefDocHandlingUi.ui b/src/frontends/qt4/ui/PrefDocHandlingUi.ui new file mode 100644 index 0000000000..5a5631d34e --- /dev/null +++ b/src/frontends/qt4/ui/PrefDocHandlingUi.ui @@ -0,0 +1,256 @@ + + PrefDocHandlingUi + + + + 0 + 0 + 524 + 417 + + + + + 0 + 0 + + + + + + + + + + Session handling + + + true + + + + + + true + + + Restore window layouts and &geometries + + + + + + + Restore to the cursor position when the file was last closed + + + Restore cursor &positions + + + + + + + &Load opened files from last session + + + + + + + &Clear all session information + + + + + + + Qt::Horizontal + + + + 225 + 20 + + + + + + + + + + + Backup && saving + + + true + + + + + + Backup &original documents when saving + + + + + + + + + &Backup documents, every + + + + + + + 1 + + + 300 + + + + + + + &minutes + + + autoSaveSB + + + + + + + Qt::Horizontal + + + + 61 + 21 + + + + + + + + + + &Save documents compressed by default + + + + + + + + + Ma&ximum last files: + + + lastfilesSB + + + + + + + 9 + + + + + + + Qt::Horizontal + + + + 48 + 20 + + + + + + + + + + + + + Windows && work area + + + true + + + + + + Open documents in &tabs + + + + + + + Whether to open documents in an already running instance of LyX. +(Set the LyXServer pipe path and restart LyX to enable this feature) + + + Use s&ingle instance + + + + + + + Whether to place close button on each tab or only one in the top left. + + + Displa&y single close-tab button + + + + + + + + + + Qt::Vertical + + + + 395 + 16 + + + + + + + + + restoreCursorCB + loadSessionCB + clearSessionPB + backupCB + autoSaveCB + autoSaveSB + saveCompressedCB + lastfilesSB + + + qt_i18n.h + + + + diff --git a/src/frontends/qt4/ui/PrefUi.ui b/src/frontends/qt4/ui/PrefUi.ui index fe50bcf0c6..e5f54e2ebd 100644 --- a/src/frontends/qt4/ui/PrefUi.ui +++ b/src/frontends/qt4/ui/PrefUi.ui @@ -20,59 +20,93 @@ - - - &User interface file: - - - uiFileED - - - - - - - - - - Bro&wse... - - - - - - - Qt::Horizontal - - - - 77 - 20 - - - - - - - - &Icon Set: - - - iconSetCO + + + General Look && Feel - - - - - - The icon set to use. Warning: normal size of icons may be wrong until you save the preferences and restart LyX. + + true + + + + + + + &User interface file: + + + uiFileED + + + + + + + + + + Bro&wse... + + + + + + + Qt::Horizontal + + + + 77 + 20 + + + + + + + + + + + + &Icon Set: + + + iconSetCO + + + + + + + The icon set to use. Warning: normal size of icons may be +wrong until you save the preferences and restart LyX. + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + - + - Automatic help + Context help Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop @@ -100,126 +134,16 @@ - - - - Session - - - true - - - - - - true - - - Restore window layouts and &geometries - - - - - - - Restore to the cursor position when the file was last closed - - - Restore cursor &positions - - - - - - - &Load opened files from last session - - - - - - - &Clear all session information - - - - - - - Qt::Horizontal - - - - 225 - 20 - - - - - - - - + - Documents + Menus true - - - - Backup original documents when saving - - - - - - - &Backup documents, every - - - - - - - 1 - - - 300 - - - - - - - minutes - - - - - - - Qt::Horizontal - - - - 61 - 21 - - - - - - - - &Save documents compressed by default - - - - + &Maximum last files: @@ -229,14 +153,7 @@ - - - - 9 - - - - + Qt::Horizontal @@ -249,37 +166,17 @@ - - - - &Open documents in tabs - - - - - - - Whether to open documents in an already running instance of LyX. (Set the LyXServer pipe path and restart LyX to enable this feature) - - - S&ingle instance - - - - - - - Whether to place close button on each tab or only one in the top left. - - - &Single close-tab button + + + + 9 - + Qt::Vertical @@ -300,16 +197,6 @@ uiFilePB iconSetCO tooltipCB - allowGeometrySessionCB - restoreCursorCB - loadSessionCB - clearSessionPB - backupCB - autoSaveCB - autoSaveSB - saveCompressedCB - lastfilesSB - openDocumentsInTabsCB qt_i18n.h diff --git a/status.20x b/status.20x index ef779bd781..fc99d80893 100644 --- a/status.20x +++ b/status.20x @@ -156,6 +156,9 @@ What's new - Do not try to process included files when viewing source (bug 8557). +- Reorder Look & Feel section in Preferences in order to fit the dialog + into netbook screens (bug 7524). + * DOCUMENTATION AND LOCALIZATION -- 2.39.5