Split the overcrowded and chaotic UI pref pane into two (#7524)

This commit is contained in:
Juergen Spitzmueller 2013-03-02 12:24:32 +01:00
parent 3266415217
commit ab5306803e
6 changed files with 440 additions and 253 deletions

View File

@ -2491,39 +2491,12 @@ PrefUserInterface::PrefUserInterface(GuiPreferences * form)
{
setupUi(this);
connect(autoSaveCB, SIGNAL(toggled(bool)),
autoSaveSB, SLOT(setEnabled(bool)));
connect(autoSaveCB, SIGNAL(toggled(bool)),
TextLabel1, SLOT(setEnabled(bool)));
connect(openDocumentsInTabsCB, SIGNAL(clicked()),
this, SIGNAL(changed()));
connect(singleInstanceCB, SIGNAL(clicked()),
this, SIGNAL(changed()));
#if QT_VERSION < 0x040500
singleCloseTabButtonCB->setEnabled(false);
#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()),
this, SIGNAL(changed()));
connect(allowGeometrySessionCB, SIGNAL(clicked()),
this, SIGNAL(changed()));
connect(autoSaveSB, SIGNAL(valueChanged(int)),
this, SIGNAL(changed()));
connect(autoSaveCB, SIGNAL(clicked()),
this, SIGNAL(changed()));
connect(backupCB, SIGNAL(clicked()),
this, SIGNAL(changed()));
connect(saveCompressedCB, SIGNAL(clicked()),
this, SIGNAL(changed()));
connect(lastfilesSB, SIGNAL(valueChanged(int)),
this, SIGNAL(changed()));
connect(tooltipCB, SIGNAL(toggled(bool)),
@ -2542,20 +2515,8 @@ void PrefUserInterface::apply(LyXRC & rc) const
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();
#if QT_VERSION < 0x040500
rc.single_close_tab_button = true;
#endif
}
@ -2566,6 +2527,79 @@ void PrefUserInterface::update(LyXRC const & rc)
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)),
TextLabel1, SLOT(setEnabled(bool)));
connect(openDocumentsInTabsCB, SIGNAL(clicked()),
this, SIGNAL(changed()));
connect(singleInstanceCB, SIGNAL(clicked()),
this, SIGNAL(changed()));
#if QT_VERSION < 0x040500
singleCloseTabButtonCB->setEnabled(false);
#endif
connect(singleCloseTabButtonCB, SIGNAL(clicked()),
this, SIGNAL(changed()));
connect(restoreCursorCB, SIGNAL(clicked()),
this, SIGNAL(changed()));
connect(loadSessionCB, SIGNAL(clicked()),
this, SIGNAL(changed()));
connect(allowGeometrySessionCB, SIGNAL(clicked()),
this, SIGNAL(changed()));
connect(autoSaveSB, SIGNAL(valueChanged(int)),
this, SIGNAL(changed()));
connect(autoSaveCB, SIGNAL(clicked()),
this, SIGNAL(changed()));
connect(backupCB, SIGNAL(clicked()),
this, SIGNAL(changed()));
connect(saveCompressedCB, SIGNAL(clicked()),
this, SIGNAL(changed()));
}
void PrefDocHandling::apply(LyXRC & rc) const
{
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.open_buffers_in_tabs = openDocumentsInTabsCB->isChecked();
rc.single_instance = singleInstanceCB->isChecked();
rc.single_close_tab_button = singleCloseTabButtonCB->isChecked();
#if QT_VERSION < 0x040500
rc.single_close_tab_button = true;
#endif
}
void PrefDocHandling::update(LyXRC const & rc)
{
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);

View File

@ -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

View File

@ -309,6 +309,7 @@ UIFILES = \
PrefColorsUi.ui \
PrefCompletionUi.ui \
PrefConvertersUi.ui \
PrefDocHandlingUi.ui \
PrefOutputUi.ui \
PrefDisplayUi.ui \
PrefEditUi.ui \

View File

@ -0,0 +1,256 @@
<ui version="4.0">
<class>PrefDocHandlingUi</class>
<widget class="QWidget" name="PrefDocHandlingUi">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>524</width>
<height>417</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string/>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<widget class="QGroupBox" name="GeometryGB">
<property name="title">
<string>Session handling</string>
</property>
<property name="flat">
<bool>true</bool>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QCheckBox" name="allowGeometrySessionCB">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>Restore window layouts and &amp;geometries</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="restoreCursorCB">
<property name="toolTip">
<string>Restore to the cursor position when the file was last closed</string>
</property>
<property name="text">
<string>Restore cursor &amp;positions</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="loadSessionCB">
<property name="text">
<string>&amp;Load opened files from last session</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QPushButton" name="clearSessionPB">
<property name="text">
<string>&amp;Clear all session information</string>
</property>
</widget>
</item>
<item row="3" column="1">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>225</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<widget class="QGroupBox" name="documentsGB">
<property name="title">
<string>Backup &amp;&amp; saving</string>
</property>
<property name="flat">
<bool>true</bool>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QCheckBox" name="backupCB">
<property name="text">
<string>Backup &amp;original documents when saving</string>
</property>
</widget>
</item>
<item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QCheckBox" name="autoSaveCB">
<property name="text">
<string>&amp;Backup documents, every</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="autoSaveSB">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>300</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="TextLabel1">
<property name="text">
<string>&amp;minutes</string>
</property>
<property name="buddy">
<cstring>autoSaveSB</cstring>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>61</width>
<height>21</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="saveCompressedCB">
<property name="text">
<string>&amp;Save documents compressed by default</string>
</property>
</widget>
</item>
<item row="3" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="lastfilesLA">
<property name="text">
<string>Ma&amp;ximum last files:</string>
</property>
<property name="buddy">
<cstring>lastfilesSB</cstring>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="lastfilesSB">
<property name="maximum">
<number>9</number>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>48</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item row="2" column="0">
<widget class="QGroupBox" name="tabsGB">
<property name="title">
<string>Windows &amp;&amp; work area</string>
</property>
<property name="flat">
<bool>true</bool>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QCheckBox" name="openDocumentsInTabsCB">
<property name="text">
<string>Open documents in &amp;tabs</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="singleInstanceCB">
<property name="toolTip">
<string>Whether to open documents in an already running instance of LyX.
(Set the LyXServer pipe path and restart LyX to enable this feature)</string>
</property>
<property name="text">
<string>Use s&amp;ingle instance</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="singleCloseTabButtonCB">
<property name="toolTip">
<string>Whether to place close button on each tab or only one in the top left.</string>
</property>
<property name="text">
<string>Displa&amp;y single close-tab button</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="3" column="0">
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>395</width>
<height>16</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<layoutdefault spacing="4" margin="9"/>
<tabstops>
<tabstop>restoreCursorCB</tabstop>
<tabstop>loadSessionCB</tabstop>
<tabstop>clearSessionPB</tabstop>
<tabstop>backupCB</tabstop>
<tabstop>autoSaveCB</tabstop>
<tabstop>autoSaveSB</tabstop>
<tabstop>saveCompressedCB</tabstop>
<tabstop>lastfilesSB</tabstop>
</tabstops>
<includes>
<include location="local">qt_i18n.h</include>
</includes>
<resources/>
<connections/>
</ui>

View File

@ -20,59 +20,93 @@
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QLabel" name="uiFileLA">
<property name="text">
<string>&amp;User interface file:</string>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>General Look &amp;&amp; Feel</string>
</property>
<property name="buddy">
<cstring>uiFileED</cstring>
<property name="flat">
<bool>true</bool>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="uiFileLA">
<property name="text">
<string>&amp;User interface file:</string>
</property>
<property name="buddy">
<cstring>uiFileED</cstring>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="uiFileED"/>
</item>
<item>
<widget class="QPushButton" name="uiFilePB">
<property name="text">
<string>Bro&amp;wse...</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>77</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="iconSetLA">
<property name="text">
<string>&amp;Icon Set:</string>
</property>
<property name="buddy">
<cstring>iconSetCO</cstring>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="iconSetCO">
<property name="toolTip">
<string>The icon set to use. Warning: normal size of icons may be
wrong until you save the preferences and restart LyX.</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="uiFileED"/>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="uiFilePB">
<property name="text">
<string>Bro&amp;wse...</string>
</property>
</widget>
</item>
<item row="0" column="3">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>77</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0" >
<widget class="QLabel" name="iconSetLA" >
<property name="text" >
<string>&amp;Icon Set:</string>
</property>
<property name="buddy" >
<cstring>iconSetCO</cstring>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="QComboBox" name="iconSetCO" >
<property name="toolTip" >
<string>The icon set to use. Warning: normal size of icons may be&#x0a;wrong until you save the preferences and restart LyX.</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="4">
<item row="1" column="0">
<widget class="QGroupBox" name="pixmapCacheGB_2">
<property name="title">
<string>Automatic help</string>
<string>Context help</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
@ -100,126 +134,16 @@
</layout>
</widget>
</item>
<item row="3" column="0" colspan="4">
<widget class="QGroupBox" name="GeometryGB">
<property name="title">
<string>Session</string>
</property>
<property name="flat">
<bool>true</bool>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0" colspan="2">
<widget class="QCheckBox" name="allowGeometrySessionCB">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>Restore window layouts and &amp;geometries</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="restoreCursorCB">
<property name="toolTip">
<string>Restore to the cursor position when the file was last closed</string>
</property>
<property name="text">
<string>Restore cursor &amp;positions</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QCheckBox" name="loadSessionCB">
<property name="text">
<string>&amp;Load opened files from last session</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QPushButton" name="clearSessionPB">
<property name="text">
<string>&amp;Clear all session information</string>
</property>
</widget>
</item>
<item row="3" column="1">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>225</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="4" column="0" colspan="4">
<item row="2" column="0">
<widget class="QGroupBox" name="documentsGB">
<property name="title">
<string>Documents</string>
<string>Menus</string>
</property>
<property name="flat">
<bool>true</bool>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0" colspan="5">
<widget class="QCheckBox" name="backupCB">
<property name="text">
<string>Backup original documents when saving</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="3">
<widget class="QCheckBox" name="autoSaveCB">
<property name="text">
<string>&amp;Backup documents, every</string>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QSpinBox" name="autoSaveSB">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>300</number>
</property>
</widget>
</item>
<item row="1" column="4">
<widget class="QLabel" name="TextLabel1">
<property name="text">
<string>minutes</string>
</property>
</widget>
</item>
<item row="1" column="5">
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>61</width>
<height>21</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="saveCompressedCB">
<property name="text">
<string>&amp;Save documents compressed by default</string>
</property>
</widget>
</item>
<item row="3" column="0">
<item row="0" column="0">
<widget class="QLabel" name="lastfilesLA">
<property name="text">
<string>&amp;Maximum last files:</string>
@ -229,14 +153,7 @@
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QSpinBox" name="lastfilesSB">
<property name="maximum">
<number>9</number>
</property>
</widget>
</item>
<item row="3" column="2" colspan="2">
<item row="0" column="3" colspan="2">
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
@ -249,37 +166,17 @@
</property>
</spacer>
</item>
<item row="4" column="0" colspan="2">
<widget class="QCheckBox" name="openDocumentsInTabsCB">
<property name="text">
<string>&amp;Open documents in tabs</string>
</property>
</widget>
</item>
<item row="5" column="0" colspan="2">
<widget class="QCheckBox" name="singleInstanceCB">
<property name="toolTip">
<string>Whether to open documents in an already running instance of LyX.&#x0a;(Set the LyXServer pipe path and restart LyX to enable this feature)</string>
</property>
<property name="text">
<string>S&amp;ingle instance</string>
</property>
</widget>
</item>
<item row="6" column="0" colspan="2">
<widget class="QCheckBox" name="singleCloseTabButtonCB">
<property name="toolTip">
<string>Whether to place close button on each tab or only one in the top left.</string>
</property>
<property name="text">
<string>&amp;Single close-tab button</string>
<item row="0" column="2">
<widget class="QSpinBox" name="lastfilesSB">
<property name="maximum">
<number>9</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="5" column="0" colspan="4">
<item row="3" column="0">
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
@ -300,16 +197,6 @@
<tabstop>uiFilePB</tabstop>
<tabstop>iconSetCO</tabstop>
<tabstop>tooltipCB</tabstop>
<tabstop>allowGeometrySessionCB</tabstop>
<tabstop>restoreCursorCB</tabstop>
<tabstop>loadSessionCB</tabstop>
<tabstop>clearSessionPB</tabstop>
<tabstop>backupCB</tabstop>
<tabstop>autoSaveCB</tabstop>
<tabstop>autoSaveSB</tabstop>
<tabstop>saveCompressedCB</tabstop>
<tabstop>lastfilesSB</tabstop>
<tabstop>openDocumentsInTabsCB</tabstop>
</tabstops>
<includes>
<include location="local">qt_i18n.h</include>

View File

@ -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