Rework OK/Apply/Cancel UI of prefs dialog

Instead of "Save" (permanently) and "Apply" (temporarily), OK and Apply
now always save permanently, unless the new checkbox "Apply to current
session only" is checked.

Addresses: #10016
(cherry picked from commit c7bdb3b342)
This commit is contained in:
Juergen Spitzmueller 2018-04-28 11:19:26 +02:00
parent 4a8b508d40
commit 7a0416b374
3 changed files with 72 additions and 43 deletions

View File

@ -3440,7 +3440,7 @@ GuiPreferences::GuiPreferences(GuiView & lv)
QDialog::setModal(false); QDialog::setModal(false);
connect(savePB, SIGNAL(clicked()), this, SLOT(slotOK())); connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
connect(applyPB, SIGNAL(clicked()), this, SLOT(slotApply())); connect(applyPB, SIGNAL(clicked()), this, SLOT(slotApply()));
connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose())); connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
connect(restorePB, SIGNAL(clicked()), this, SLOT(slotRestore())); connect(restorePB, SIGNAL(clicked()), this, SLOT(slotRestore()));
@ -3485,7 +3485,7 @@ GuiPreferences::GuiPreferences(GuiView & lv)
#endif #endif
bc().setPolicy(ButtonPolicy::PreferencesPolicy); bc().setPolicy(ButtonPolicy::PreferencesPolicy);
bc().setOK(savePB); bc().setOK(okPB);
bc().setApply(applyPB); bc().setApply(applyPB);
bc().setCancel(closePB); bc().setCancel(closePB);
bc().setRestore(restorePB); bc().setRestore(restorePB);
@ -3596,8 +3596,8 @@ void GuiPreferences::dispatchParams()
update_previews_ = false; update_previews_ = false;
} }
// The Save button has been pressed // Save permanently
if (isClosing()) if (!tempSaveCB->isChecked())
dispatch(FuncRequest(LFUN_PREFERENCES_SAVE)); dispatch(FuncRequest(LFUN_PREFERENCES_SAVE));
} }

View File

@ -1,62 +1,79 @@
<ui version="4.0" > <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>PrefsUi</class> <class>PrefsUi</class>
<widget class="QDialog" name="PrefsUi" > <widget class="QDialog" name="PrefsUi">
<property name="geometry" > <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>433</width> <width>650</width>
<height>352</height> <height>352</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy" > <property name="sizePolicy">
<sizepolicy> <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<hsizetype>1</hsizetype>
<vsizetype>1</vsizetype>
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="windowTitle" > <property name="windowTitle">
<string/> <string/>
</property> </property>
<property name="sizeGripEnabled" > <property name="sizeGripEnabled">
<bool>true</bool> <bool>true</bool>
</property> </property>
<layout class="QGridLayout" > <layout class="QGridLayout">
<property name="margin" > <property name="leftMargin">
<number>11</number> <number>11</number>
</property> </property>
<property name="spacing" > <property name="topMargin">
<number>11</number>
</property>
<property name="rightMargin">
<number>11</number>
</property>
<property name="bottomMargin">
<number>11</number>
</property>
<property name="spacing">
<number>6</number> <number>6</number>
</property> </property>
<item row="1" column="0" > <item row="1" column="0">
<layout class="QHBoxLayout" > <layout class="QHBoxLayout">
<property name="margin" > <property name="spacing">
<number>0</number>
</property>
<property name="spacing" >
<number>6</number> <number>6</number>
</property> </property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item> <item>
<widget class="QPushButton" name="restorePB" > <widget class="QPushButton" name="restorePB">
<property name="text" > <property name="text">
<string>&amp;Restore</string> <string>&amp;Restore</string>
</property> </property>
<property name="autoDefault" > <property name="autoDefault">
<bool>false</bool> <bool>false</bool>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<spacer> <spacer>
<property name="orientation" > <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
<property name="sizeType" > <property name="sizeType">
<enum>QSizePolicy::Expanding</enum> <enum>QSizePolicy::Expanding</enum>
</property> </property>
<property name="sizeHint" > <property name="sizeHint" stdset="0">
<size> <size>
<width>20</width> <width>20</width>
<height>20</height> <height>20</height>
@ -65,39 +82,49 @@
</spacer> </spacer>
</item> </item>
<item> <item>
<widget class="QPushButton" name="savePB" > <widget class="QCheckBox" name="tempSaveCB">
<property name="text" > <property name="toolTip">
<string>&amp;Save</string> <string>If this is checked, pressing OK or Apply will save the changes only for the current LyX session, not permanently.</string>
</property> </property>
<property name="autoDefault" > <property name="text">
<string>A&amp;pply to current session only</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="okPB">
<property name="text">
<string>&amp;OK</string>
</property>
<property name="autoDefault">
<bool>false</bool> <bool>false</bool>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QPushButton" name="applyPB" > <widget class="QPushButton" name="applyPB">
<property name="text" > <property name="text">
<string>&amp;Apply</string> <string>&amp;Apply</string>
</property> </property>
<property name="autoDefault" > <property name="autoDefault">
<bool>false</bool> <bool>false</bool>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QPushButton" name="closePB" > <widget class="QPushButton" name="closePB">
<property name="text" > <property name="text">
<string>&amp;Close</string> <string>&amp;Close</string>
</property> </property>
<property name="autoDefault" > <property name="autoDefault">
<bool>false</bool> <bool>false</bool>
</property> </property>
</widget> </widget>
</item> </item>
</layout> </layout>
</item> </item>
<item row="0" column="0" > <item row="0" column="0">
<widget class="lyx::frontend::PanelStack" native="1" name="prefsPS" /> <widget class="lyx::frontend::PanelStack" name="prefsPS" native="true"/>
</item> </item>
</layout> </layout>
</widget> </widget>
@ -112,12 +139,12 @@
<tabstops> <tabstops>
<tabstop>prefsPS</tabstop> <tabstop>prefsPS</tabstop>
<tabstop>restorePB</tabstop> <tabstop>restorePB</tabstop>
<tabstop>savePB</tabstop> <tabstop>okPB</tabstop>
<tabstop>applyPB</tabstop> <tabstop>applyPB</tabstop>
<tabstop>closePB</tabstop> <tabstop>closePB</tabstop>
</tabstops> </tabstops>
<includes> <includes>
<include location="local" >qt_i18n.h</include> <include location="local">qt_i18n.h</include>
</includes> </includes>
<resources/> <resources/>
<connections/> <connections/>

View File

@ -50,6 +50,8 @@ What's new
- Improve layout of the character dialog (bugs 2752, 3804, 3884, and 4836). - Improve layout of the character dialog (bugs 2752, 3804, 3884, and 4836).
- Rework OK/Apply/Cancel behavior of preferences dialog (bug 10016).
- Disambiguate dialog message (bug 11242). - Disambiguate dialog message (bug 11242).
- Unify capitalzation in dialog (bug 11237). - Unify capitalzation in dialog (bug 11237).