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
This commit is contained in:
Juergen Spitzmueller 2018-04-28 11:19:26 +02:00
parent e49a10729e
commit c7bdb3b342
2 changed files with 70 additions and 43 deletions

View File

@ -3417,7 +3417,7 @@ GuiPreferences::GuiPreferences(GuiView & lv)
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(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
connect(restorePB, SIGNAL(clicked()), this, SLOT(slotRestore()));
@ -3462,7 +3462,7 @@ GuiPreferences::GuiPreferences(GuiView & lv)
#endif
bc().setPolicy(ButtonPolicy::PreferencesPolicy);
bc().setOK(savePB);
bc().setOK(okPB);
bc().setApply(applyPB);
bc().setCancel(closePB);
bc().setRestore(restorePB);
@ -3573,8 +3573,8 @@ void GuiPreferences::dispatchParams()
update_previews_ = false;
}
// The Save button has been pressed
if (isClosing())
// Save permanently
if (!tempSaveCB->isChecked())
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>
<widget class="QDialog" name="PrefsUi" >
<property name="geometry" >
<widget class="QDialog" name="PrefsUi">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>433</width>
<width>650</width>
<height>352</height>
</rect>
</property>
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>1</hsizetype>
<vsizetype>1</vsizetype>
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle" >
<property name="windowTitle">
<string/>
</property>
<property name="sizeGripEnabled" >
<property name="sizeGripEnabled">
<bool>true</bool>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<layout class="QGridLayout">
<property name="leftMargin">
<number>11</number>
</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>
</property>
<item row="1" column="0" >
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<item row="1" column="0">
<layout class="QHBoxLayout">
<property name="spacing">
<number>6</number>
</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>
<widget class="QPushButton" name="restorePB" >
<property name="text" >
<widget class="QPushButton" name="restorePB">
<property name="text">
<string>&amp;Restore</string>
</property>
<property name="autoDefault" >
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
@ -65,39 +82,49 @@
</spacer>
</item>
<item>
<widget class="QPushButton" name="savePB" >
<property name="text" >
<string>&amp;Save</string>
<widget class="QCheckBox" name="tempSaveCB">
<property name="toolTip">
<string>If this is checked, pressing OK or Apply will save the changes only for the current LyX session, not permanently.</string>
</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>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="applyPB" >
<property name="text" >
<widget class="QPushButton" name="applyPB">
<property name="text">
<string>&amp;Apply</string>
</property>
<property name="autoDefault" >
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="closePB" >
<property name="text" >
<widget class="QPushButton" name="closePB">
<property name="text">
<string>&amp;Close</string>
</property>
<property name="autoDefault" >
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="0" >
<widget class="lyx::frontend::PanelStack" native="1" name="prefsPS" />
<item row="0" column="0">
<widget class="lyx::frontend::PanelStack" name="prefsPS" native="true"/>
</item>
</layout>
</widget>
@ -112,12 +139,12 @@
<tabstops>
<tabstop>prefsPS</tabstop>
<tabstop>restorePB</tabstop>
<tabstop>savePB</tabstop>
<tabstop>okPB</tabstop>
<tabstop>applyPB</tabstop>
<tabstop>closePB</tabstop>
</tabstops>
<includes>
<include location="local" >qt_i18n.h</include>
<include location="local">qt_i18n.h</include>
</includes>
<resources/>
<connections/>