diff libinterp/corefcn/event-manager.cc @ 29057:450920c987b8

update profiler status in gui from interpreter * main-window.cc (handle_gui_status_update): new slot for updating status indicators in the gui triggered by the interpreter; (profiler_session, profiler_session_resume, profiler_stop): do not trigger status update here (construct_octave_qt_link): connect gui status update signal with new related slot; (construct_profile_menu): remove obsolete connection of former status update signal with related slot * main-window.h: remove obsolete update signal of the main window; new slote for updateing status indicators in the gui * qt-interpreter-events.cc (gui_status_update): slot for the event managers status update signal emitting signal for the main window * interpreter-events.h: new slot gui_status_update, new signal gui_status_update_signal * event-manager.cc (__event_manager_gui_status_update__): new function, for now just a stub, which should only be activated if some interpreter action only implemented in m-files requires to update a status indicator in the gui * event-manager.h: new virtual slot for gui status update, new slot calling qt-links gui_status_update * profiler.cc: include event-manager.h; (__profiler_enable__): call event managers gui_status_update depending on enabling/disabling the profiler
author Torsten Lilge <ttl-octave@mailbox.org>
date Thu, 12 Nov 2020 21:11:50 +0100
parents 06c8e0877864
children 0280fd549502
line wrap: on
line diff
--- a/libinterp/corefcn/event-manager.cc	Thu Nov 12 18:28:49 2020 +0100
+++ b/libinterp/corefcn/event-manager.cc	Thu Nov 12 21:11:50 2020 +0100
@@ -577,6 +577,40 @@
   return ovl (evmgr.unregister_doc (file));
 }
 
+DEFMETHOD (__event_manager_gui_status_update__, interp, args, ,
+           doc: /* -*- texinfo -*-
+@deftypefn {} {} __event_manager_gui_status_update__ (@var{feature}, @var{status})
+Internal function for updating the status of some features in the GUI.
+@end deftypefn */)
+{
+  // This is currently a stub and should only be activated some
+  // interpreter action only implemented in m-files requires to update
+  // a status indicator in the gui. BUT: This internal function can
+  // be activated by the user leading to gui indicators not reflecting
+  // the real state of the related feature.
+  return ovl ();
+
+  std::string feature;
+  std::string status;
+
+  if (! (Fisguirunning ())(0).is_true ())
+    return ovl ();
+
+  if (args.length () < 2)
+    error ("__event_manager_gui_status_update__: two parameters required");
+  if (! (args(0).is_string ()))
+    error ("__event_manager_gui_status_update__: FEATURE must be a string");
+  if (! (args(1).is_string ()))
+    error ("__event_manager_gui_status_update__: STATUS must be a string");
+
+  feature = args(0).string_value ();
+  status = args(1).string_value ();
+
+  octave::event_manager& evmgr = interp.get_event_manager ();
+
+  return ovl (evmgr.gui_status_update (feature, status));
+}
+
 DEFMETHOD (__event_manager_update_gui_lexer__, interp, , ,
            doc: /* -*- texinfo -*-
 @deftypefn {} {} __event_manager_update_gui_lexer__ ()