changeset 27602:ba317c535adb

define new __event_manager_apply_preferences__ function * qt-interpreter-events.h, qt-interpreter-events.cc (): (qt_interpreter_events::apply_preferences): New function. (qt_interpreter_events::apply_new_settings): New signal. * event-manager.h, event-manager.cc (interpreter_events::apply_preferences): New virtual function. (event_manager::apply_preferences): New function. (F__event_manager_apply_preferences__): New function. * main-window.cc (main_window::construct_octave_qt_link): Connect qt_interpreter_events apply_new_settings signal to main_window request_reload_settings slot.
author John W. Eaton <jwe@octave.org>
date Thu, 31 Oct 2019 14:43:47 -0400
parents 7a748f7545c9
children bf6b192428a0
files libgui/src/main-window.cc libgui/src/qt-interpreter-events.cc libgui/src/qt-interpreter-events.h libinterp/corefcn/event-manager.cc libinterp/corefcn/event-manager.h
diffstat 5 files changed, 36 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/main-window.cc	Thu Oct 31 14:36:11 2019 -0400
+++ b/libgui/src/main-window.cc	Thu Oct 31 14:43:47 2019 -0400
@@ -2132,6 +2132,9 @@
     connect (qt_link, SIGNAL (settings_changed (const QSettings *)),
              this, SLOT (notice_settings (const QSettings *)));
 
+    connect (qt_link, SIGNAL (apply_new_settings (void)),
+             this, SLOT (request_reload_settings (void)));
+
     connect (qt_link,
              SIGNAL (set_workspace_signal (bool, bool, const symbol_info_list&)),
              m_workspace_model,
--- a/libgui/src/qt-interpreter-events.cc	Thu Oct 31 14:36:11 2019 -0400
+++ b/libgui/src/qt-interpreter-events.cc	Thu Oct 31 14:43:47 2019 -0400
@@ -237,6 +237,11 @@
     emit show_preferences_signal ();
   }
 
+  void qt_interpreter_events::apply_preferences (void)
+  {
+    emit apply_new_settings ();
+  }
+
   void qt_interpreter_events::show_doc (const std::string& file)
   {
     emit show_doc_signal (QString::fromStdString (file));
--- a/libgui/src/qt-interpreter-events.h	Thu Oct 31 14:36:11 2019 -0400
+++ b/libgui/src/qt-interpreter-events.h	Thu Oct 31 14:43:47 2019 -0400
@@ -109,6 +109,8 @@
 
     void show_preferences (void);
 
+    void apply_preferences (void);
+
     void show_doc (const std::string& file);
 
     bool edit_file (const std::string& file);
@@ -243,6 +245,8 @@
 
     void settings_changed (const QSettings *);
 
+    void apply_new_settings (void);
+
   private:
 
     QString gui_preference_adjust (const QString& key, const QString& value);
--- a/libinterp/corefcn/event-manager.cc	Thu Oct 31 14:36:11 2019 -0400
+++ b/libinterp/corefcn/event-manager.cc	Thu Oct 31 14:43:47 2019 -0400
@@ -407,6 +407,17 @@
   return ovl (evmgr.show_preferences ());
 }
 
+DEFMETHOD (__event_manager_apply_preferences__, interp, , ,
+       doc: /* -*- texinfo -*-
+@deftypefn {} {} __event_manager_apply_preferences__ ()
+Undocumented internal function.
+@end deftypefn */)
+{
+  octave::event_manager& evmgr = interp.get_event_manager ();
+
+  return ovl (evmgr.apply_preferences ());
+}
+
 DEFMETHOD (__event_manager_gui_preference__, interp, args, ,
            doc: /* -*- texinfo -*-
 @deftypefn {} {} __event_manager_gui_preference__ ()
--- a/libinterp/corefcn/event-manager.h	Thu Oct 31 14:36:11 2019 -0400
+++ b/libinterp/corefcn/event-manager.h	Thu Oct 31 14:43:47 2019 -0400
@@ -132,6 +132,8 @@
 
     virtual void show_preferences (void) { }
 
+    virtual void apply_preferences (void) { }
+
     virtual void show_doc (const std::string& /*file*/) { }
 
     virtual bool edit_file (const std::string& /*file*/) { return false; }
@@ -378,6 +380,17 @@
         return false;
     }
 
+    bool apply_preferences (void)
+    {
+      if (enabled ())
+        {
+          instance->apply_preferences ();
+          return true;
+        }
+      else
+        return false;
+    }
+
     bool show_doc (const std::string& file)
     {
       if (enabled ())