From a4a610221ae62897b792ef2e5fb9bb6f65e7b1df 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 | 303 ++++++++++++++++++++ src/frontends/qt4/ui/PrefUi.ui | 324 ++++++---------------- 5 files changed, 474 insertions(+), 272 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 e2ecb06e70..4ca856ef5c 100644 --- a/src/frontends/qt4/GuiPrefs.cpp +++ b/src/frontends/qt4/GuiPrefs.cpp @@ -2507,6 +2507,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)), @@ -2517,12 +2577,6 @@ PrefUserInterface::PrefUserInterface(GuiPreferences * form) this, SIGNAL(changed())); 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(closeLastViewCO, SIGNAL(activated(int)), this, SIGNAL(changed())); connect(restoreCursorCB, SIGNAL(clicked()), @@ -2539,32 +2593,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(); @@ -2585,13 +2624,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); @@ -2605,8 +2639,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()); @@ -2620,15 +2652,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(); } @@ -3241,6 +3265,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 9cb96bca5f..02156ab8de 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" @@ -420,10 +421,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 bbb2c5f285..fc42e9b9d6 100644 --- a/src/frontends/qt4/Makefile.am +++ b/src/frontends/qt4/Makefile.am @@ -319,6 +319,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..aed6250910 --- /dev/null +++ b/src/frontends/qt4/ui/PrefDocHandlingUi.ui @@ -0,0 +1,303 @@ + + + PrefDocHandlingUi + + + + 0 + 0 + 524 + 440 + + + + + 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 + + + + + + + + + Closing last &view: + + + closeLastViewCO + + + + + + + + Closes document + + + + + Hides document + + + + + Ask the user + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + 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 a9a8dc52cc..e9cb1313c7 100644 --- a/src/frontends/qt4/ui/PrefUi.ui +++ b/src/frontends/qt4/ui/PrefUi.ui @@ -6,8 +6,8 @@ 0 0 - 604 - 559 + 450 + 271 @@ -21,59 +21,93 @@ - - - &User interface file: - - - uiFileED + + + General Look && Feel - - - - - - - - - Bro&wse... + + 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 + + + + + + + - - - - 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. - - - - - Automatic help + Context help Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop @@ -101,126 +135,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: @@ -230,14 +154,7 @@ - - - - 9 - - - - + Qt::Horizontal @@ -250,66 +167,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 - - - - - - - Closing last view: - - - closeLastViewCO + + + + 9 - - - - - Closes document - - - - - Hides document - - - - - Ask the user - - - - - + Qt::Vertical @@ -330,16 +198,6 @@ uiFilePB iconSetCO tooltipCB - allowGeometrySessionCB - restoreCursorCB - loadSessionCB - clearSessionPB - backupCB - autoSaveCB - autoSaveSB - saveCompressedCB - lastfilesSB - openDocumentsInTabsCB qt_i18n.h -- 2.39.2