changeset 31640:e518e1f7e944

Backed out changeset 34c3cd39c4b9 Revert change because there is code that uses gui_pref.ignore, but only on MAC_OS: global_use_native_dialogs in gui-preferences-global.h. Are there others?
author John W. Eaton <jwe@octave.org>
date Mon, 05 Dec 2022 10:17:17 -0500
parents ca7d58406f82
children ab33554f97d2
files libgui/src/gui-preferences.h libgui/src/gui-settings.h
diffstat 2 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/gui-preferences.h	Sun Dec 04 22:57:02 2022 -0500
+++ b/libgui/src/gui-preferences.h	Mon Dec 05 10:17:17 2022 -0500
@@ -36,8 +36,9 @@
 
 struct gui_pref
 {
-  gui_pref (const QString& key_arg, const QVariant& def_arg)
-    : key (key_arg), def (def_arg)
+  gui_pref (const QString& key_arg, const QVariant& def_arg,
+            const bool ignore_arg = false)
+    : key (key_arg), def (def_arg), ignore (ignore_arg)
   { }
 
   // No copying!
@@ -50,6 +51,7 @@
 
   const QString key;   // the key name
   const QVariant def;  // the default value
+  const bool ignore;   // when true, ignore, i.e. always take default
 };
 
 // The version for shortcuts, where the default value is stored as a
--- a/libgui/src/gui-settings.h	Sun Dec 04 22:57:02 2022 -0500
+++ b/libgui/src/gui-settings.h	Mon Dec 05 10:17:17 2022 -0500
@@ -75,6 +75,9 @@
 
     QVariant value (const gui_pref& pref) const
     {
+      if (pref.ignore)
+        return pref.def;  // ignore the current pref and always use default
+
       return value (pref.key, pref.def);
     }