]> git.lyx.org Git - features.git/commitdiff
Rework OK/Apply/Cancel UI of prefs dialog
authorJuergen Spitzmueller <spitz@lyx.org>
Sat, 28 Apr 2018 09:19:26 +0000 (11:19 +0200)
committerJuergen Spitzmueller <spitz@lyx.org>
Mon, 8 Oct 2018 09:46:42 +0000 (11:46 +0200)
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 c7bdb3b342823d3144f3c73e125e274aa40c77e2)

src/frontends/qt4/GuiPrefs.cpp
src/frontends/qt4/ui/PrefsUi.ui
status.23x

index dc04ec5c3dc07cd5103349811c4b4258794ec099..8e4dbcde6a4608230032c61325f8ce8c690af238 100644 (file)
@@ -3440,7 +3440,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()));
@@ -3485,7 +3485,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);
@@ -3596,8 +3596,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));
 }
 
index 5da08dba44a27d01ca9d3e500e91886bdcc0e230..ffdd011b60f4ca818c68d28de31daa339741fafb 100644 (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" >
+   <item row="1" column="0">
+    <layout class="QHBoxLayout">
+     <property name="spacing">
+      <number>6</number>
+     </property>
+     <property name="leftMargin">
       <number>0</number>
      </property>
-     <property name="spacing" >
-      <number>6</number>
+     <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>
       </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="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" >
+       <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>
  <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/>
index 3091f06bd1383127d2b7214296304698bc542685..79eec6488ee8d5c466947c1e2936bd670e43ee8e 100644 (file)
@@ -50,6 +50,8 @@ What's new
 
 - 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).
 
 - Unify capitalzation in dialog (bug 11237).