GNU Octave  8.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
octave-qobject.cc
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (C) 2011-2023 The Octave Project Developers
4 //
5 // See the file COPYRIGHT.md in the top-level directory of this
6 // distribution or <https://octave.org/copyright/>.
7 //
8 // This file is part of Octave.
9 //
10 // Octave is free software: you can redistribute it and/or modify it
11 // under the terms of the GNU General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // Octave is distributed in the hope that it will be useful, but
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU General Public License for more details.
19 //
20 // You should have received a copy of the GNU General Public License
21 // along with Octave; see the file COPYING. If not, see
22 // <https://www.gnu.org/licenses/>.
23 //
24 ////////////////////////////////////////////////////////////////////////
25 
26 #if defined (HAVE_CONFIG_H)
27 # include "config.h"
28 #endif
29 
30 #include <utility>
31 
32 #include <QApplication>
33 #include <QClipboard>
34 #include <QFile>
35 #include <QTextCodec>
36 #include <QThread>
37 #include <QTimer>
38 #include <QTranslator>
39 
40 // QTerminal includes
41 #include "QTerminal.h"
42 
43 #if defined (HAVE_QSCINTILLA)
44 # include "command-widget.h"
45 #endif
46 #include "community-news.h"
48 #include "files-dock-widget.h"
49 #include "history-dock-widget.h"
50 #include "interpreter-qobject.h"
51 #include "main-window.h"
52 #include "octave-qobject.h"
53 #include "qt-application.h"
54 #include "qt-interpreter-events.h"
55 #include "release-notes.h"
56 #include "resource-manager.h"
57 #include "shortcut-manager.h"
58 #include "terminal-dock-widget.h"
59 #include "variable-editor.h"
60 #include "workspace-model.h"
61 #include "workspace-view.h"
62 
63 // Bug #55940 (Disable App Nap on Mac)
64 #if defined (Q_OS_MAC)
65 # include <objc/runtime.h>
66 # include <objc/message.h>
67 #endif
68 
69 #include "interpreter.h"
70 #include "oct-env.h"
71 #include "version.h"
72 
73 #include "ovl.h"
74 
75 // Bug #55940 (Disable App Nap on Mac)
76 #if defined (Q_OS_MAC)
77 static void disable_app_nap (void)
78 {
79  Class process_info_class;
80  SEL process_info_selector;
81  SEL begin_activity_with_options_selector;
82  id process_info;
83  id reason_string;
84  id osx_latencycritical_activity;
85 
86  // Option codes found at https://stackoverflow.com/questions/22784886/what-can-make-nanosleep-drift-with-exactly-10-sec-on-mac-os-x-10-9/32729281#32729281
87  unsigned long long NSActivityUserInitiatedAllowingIdleSystemSleep = 0x00FFFFFFULL;
88  unsigned long long NSActivityLatencyCritical = 0xFF00000000ULL;
89 
90  // Avoid errors on older versions of OS X
91  process_info_class = reinterpret_cast<Class> (objc_getClass ("NSProcessInfo"));
92  if (process_info_class == nil)
93  return;
94 
95  process_info_selector = sel_getUid ("processInfo");
96  if (class_getClassMethod (process_info_class, process_info_selector)
97  == nullptr)
98  return;
99 
100  begin_activity_with_options_selector = sel_getUid ("beginActivityWithOptions:reason:");
101  if (class_getInstanceMethod (process_info_class,
102  begin_activity_with_options_selector)
103  == nullptr)
104  return;
105 
106  process_info = reinterpret_cast<id (*) (id, SEL)> (objc_msgSend)
107  (reinterpret_cast<id> (process_info_class),
108  process_info_selector);
109  if (process_info == nil)
110  return;
111 
112  reason_string = reinterpret_cast<id (*) (id, SEL)> (objc_msgSend)
113  (reinterpret_cast<id> (objc_getClass ("NSString")),
114  sel_getUid ("alloc"));
115  reason_string = reinterpret_cast<id (*) (id, SEL, const char *)> (objc_msgSend)
116  (reason_string, sel_getUid ("initWithUTF8String:"),
117  "App Nap causes pause() malfunction");
118 
119  // Start an Activity that suppresses App Nap. This Activity will run for
120  // the entire duration of the Octave process. This is intentional,
121  // not a leak.
122  osx_latencycritical_activity =
123  reinterpret_cast<id (*) (id, SEL, unsigned long long, id)> (objc_msgSend)
124  (process_info,
125  begin_activity_with_options_selector,
126  NSActivityUserInitiatedAllowingIdleSystemSleep
127  | NSActivityLatencyCritical,
128  reason_string);
129 }
130 #endif
131 
133 
134 // Disable all Qt messages by default.
135 
136 static void
137 message_handler (QtMsgType, const QMessageLogContext&, const QString&)
138 { }
139 
140 //! Reimplement QApplication::notify. Octave's own exceptions are
141 //! caught and rethrown in the interpreter thread.
142 
143 bool octave_qapplication::notify (QObject *receiver, QEvent *ev)
144 {
145  try
146  {
147  return QApplication::notify (receiver, ev);
148  }
149  catch (execution_exception& ee)
150  {
151  emit interpreter_event
152  ([=] (void)
153  {
154  // INTERPRETER THREAD
155  throw ee;
156  });
157  }
158 
159  return false;
160 }
161 
162 // We will create a QApplication object, even if START_GUI is false,
163 // so that we can use Qt widgets for plot windows when running in
164 // command-line mode. Note that we are creating an
165 // octave_qapplication object but handling it as a QApplication object
166 // because the octave_qapplication should behave identically to a
167 // QApplication object except that it overrides the notify method so
168 // we can handle forward Octave interpreter exceptions from the GUI
169 // thread to the interpreter thread.
170 
171 base_qobject::base_qobject (qt_application& app_context, bool gui_app)
172  : QObject (),
173  m_app_context (app_context),
174  m_argc (m_app_context.sys_argc ()),
175  m_argv (m_app_context.sys_argv ()),
176  m_qapplication (new octave_qapplication (m_argc, m_argv)),
177  m_resource_manager (),
178  m_shortcut_manager (*this),
179  m_qt_tr (new QTranslator ()),
180  m_gui_tr (new QTranslator ()),
181  m_qsci_tr (new QTranslator ()),
182  m_translators_installed (false),
183  m_qt_interpreter_events (new qt_interpreter_events (*this)),
184  m_interpreter_qobj (new interpreter_qobject (*this)),
185  m_main_thread (new QThread ()),
186  m_gui_app (gui_app),
187  m_interpreter_ready (false),
188  m_workspace_model (new workspace_model ()),
189  m_documentation_widget (),
190  m_file_browser_widget (),
191  m_history_widget (),
192  m_workspace_widget (),
193  m_editor_widget (),
194  m_variable_editor_widget (),
195  m_main_window (nullptr)
196 {
197  std::string show_gui_msgs =
198  sys::env::getenv ("OCTAVE_SHOW_GUI_MESSAGES");
199 
200  // Installing our handler suppresses the messages.
201 
202  if (show_gui_msgs.empty ())
203  qInstallMessageHandler (message_handler);
204 
205  // Set the codec for all strings (before wizard or any GUI object)
206 #if ! defined (Q_OS_WIN32)
207  QTextCodec::setCodecForLocale (QTextCodec::codecForName ("UTF-8"));
208 #endif
209 
210  // Initialize global Qt application metadata.
211 
212  QCoreApplication::setApplicationName ("GNU Octave");
213  QCoreApplication::setApplicationVersion (OCTAVE_VERSION);
214 
215  // Register octave_value_list for connecting thread crossing signals.
216 
217  qRegisterMetaType<octave_value_list> ("octave_value_list");
218 
219  // Bug #55940 (Disable App Nap on Mac)
220 #if defined (Q_OS_MAC)
221  // Mac App Nap feature causes pause() and sleep() to misbehave.
222  // Disable it for the entire program run.
223  disable_app_nap ();
224 #endif
225 
226  // Force left-to-right alignment (see bug #46204)
227  m_qapplication->setLayoutDirection (Qt::LeftToRight);
228 
229  // Qt docs recommend using Qt::QueuedConnection when connecting to
230  // the QCoreApplication::exit slot.
232  m_qapplication, &octave_qapplication::exit,
233  Qt::QueuedConnection);
234 
237 
238  connect (m_main_thread, &QThread::finished,
239  m_main_thread, &QThread::deleteLater);
240 
241  // Handle any interpreter_event signal from the octave_qapplication
242  // object here.
243 
246 
249 
251  {
253  this, &base_qobject::start_gui);
254 
257  }
258 
261 
264 
267 
270 
273 
276 
279 
282 
284  {
285  m_qapplication->setQuitOnLastWindowClosed (false);
286  }
287  else
288  {
289  if (gui_app)
290  {
291  m_main_window = new main_window (*this);
292 
295 
298 
301  else
304 
307 
308  m_app_context.gui_running (true);
309  }
310  else
311  {
312  // Get settings file.
314 
315  // After settings.
318 
319  // Initilize the shortcut-manager
321 
322  m_qapplication->setQuitOnLastWindowClosed (false);
323  }
324  }
325 
327 }
328 
330 {
331  // Note that we don't delete m_main_thread here. That is handled by
332  // deleteLater slot that is called when the m_main_thread issues a
333  // finished signal.
334 
335  // FIXME: Why are dock widget settings and/or the main window
336  // configuration not saved correctly if the main window is deleted
337  // after the dock widgets?
338 
339  // Calling close will cause settings to be saved.
340  // If m_main_window exists, the widgets are closed by the main window
341 
342  if (! m_main_window)
343  {
344  if (m_terminal_widget)
345  m_terminal_widget->close ();
346 
348  m_documentation_widget->close ();
349 
351  m_file_browser_widget->close ();
352 
353  if (m_history_widget)
354  m_history_widget->close ();
355 
356  if (m_workspace_widget)
357  m_workspace_widget->close ();
358 
359  if (m_editor_widget)
360  m_editor_widget->close ();
361 
363  m_variable_editor_widget->close ();
364 
365  if (m_community_news)
366  m_community_news->close ();
367  }
368  else
369  {
370  delete m_main_window;
371  }
372 
373  delete m_terminal_widget;
374  delete m_documentation_widget;
375  delete m_file_browser_widget;
376  delete m_history_widget;
377  delete m_workspace_widget;
378  delete m_editor_widget;
380  delete m_community_news;
381 
382  delete m_interpreter_qobj;
383  delete m_qsci_tr;
384  delete m_gui_tr;
385  delete m_qt_tr;
386  delete m_qapplication;
387  delete m_workspace_model;
388 
390 }
391 
393 {
395  return;
396 
398 
399  m_qapplication->installTranslator (m_qt_tr);
400  m_qapplication->installTranslator (m_gui_tr);
401  m_qapplication->installTranslator (m_qsci_tr);
402 
404 }
405 
407 {
408  // Note: if using the new experimental terminal widget, we defer
409  // initializing and executing the interpreter until the main event
410  // loop begins executing.
411 
412  // With the old terminal widget, we defer initializing and executing
413  // the interpreter until after the main window and QApplication are
414  // running to prevent race conditions.
415 
416  QTimer::singleShot (0, m_interpreter_qobj, SLOT (execute (void)));
417 
418  m_interpreter_qobj->moveToThread (m_main_thread);
419 
420  m_main_thread->start ();
421 }
422 
424 {
425  int status = m_qapplication->exec ();
426 
427 #if defined (Q_OS_MAC)
428  // fprintf to stderr is needed by macOS, for poorly-understood reasons.
429  fprintf (stderr, "\n");
430 #endif
431 
432  m_main_thread->quit ();
433  m_main_thread->wait ();
434 
435  return status;
436 }
437 
438 // Provided for convenience. Will be removed once we eliminate the
439 // old terminal widget.
441 {
443 }
444 
445 bool base_qobject::gui_running (void) const
446 {
447  return m_app_context.gui_running ();
448 }
449 
450 QPointer<terminal_dock_widget>
452 {
453  if (m_terminal_widget && mw)
454  {
455  m_terminal_widget->set_main_window (mw);
456  m_terminal_widget->set_adopted (true);
457  }
458  else if (! m_terminal_widget)
459  {
461  = QPointer<terminal_dock_widget> (new terminal_dock_widget (mw, *this));
463  {
464 #if defined (HAVE_QSCINTILLA)
465  command_widget *cmd_widget
466  = m_terminal_widget->get_command_widget ();
467 
468  connect (cmd_widget, &command_widget::interpreter_pause,
470 
471  connect (cmd_widget, &command_widget::interpreter_resume,
473 
474  connect (cmd_widget, &command_widget::interpreter_stop,
476 
479 
482 
485 
486  connect_interpreter_events (cmd_widget);
487 #endif
488  }
489  else
490  {
491  QTerminal *cmd_widget = m_terminal_widget->get_qterminal ();
492 
493  // Connect the interrupt signal (emitted by Ctrl-C)
494  connect (cmd_widget, &QTerminal::interrupt_signal,
496  }
497  }
498 
499  return m_terminal_widget;
500 }
501 
502 QPointer<documentation_dock_widget>
504 {
505  if (m_documentation_widget && mw)
506  {
507  m_documentation_widget->set_main_window (mw);
508  m_documentation_widget->set_adopted (true);
509  }
510  else if (! m_documentation_widget)
511  {
513  = QPointer<documentation_dock_widget> (new documentation_dock_widget (mw, *this));
514 
515  connect (qt_link (),
519 
520  connect (qt_link (),
524  }
525 
526  return m_documentation_widget;
527 }
528 
529 QPointer<files_dock_widget>
531 {
533  {
534  m_file_browser_widget->set_main_window (mw);
535  m_file_browser_widget->set_adopted (true);
536  }
537  else if (! m_file_browser_widget)
539  = QPointer<files_dock_widget> (new files_dock_widget (mw, *this));
540 
543 
544  return m_file_browser_widget;
545 }
546 
547 QPointer<history_dock_widget>
549 {
550  if (m_history_widget)
551  {
552  m_history_widget->set_main_window (mw);
553  m_history_widget->set_adopted (true);
554  }
555  else if (! m_history_widget)
556  {
558  = QPointer<history_dock_widget> (new history_dock_widget (mw, *this));
559 
562 
565 
568 
569  emit interpreter_event
570  ([=] (interpreter& interp) {
571  // INTERPRETER THREAD
572 
573  event_manager& xevmgr = interp.get_event_manager ();
574 
575  xevmgr.set_history ();
576  });
577  }
578 
579  return m_history_widget;
580 }
581 
582 QPointer<workspace_view>
584 {
585  if (m_workspace_widget)
586  {
587  m_workspace_widget->set_main_window (mw);
588  m_workspace_widget->set_adopted (true);
589  }
590  else if (! m_workspace_widget)
591  {
593  = QPointer<workspace_view> (new workspace_view (mw, *this));
594 
596 
599 
602 
605 
606  connect (m_workspace_widget,
608  [=] (const QString& var_name) {
609  emit interpreter_event
610  ([=] (interpreter& interp)
611  {
612  // INTERPRETER THREAD
613 
614  octave_value val = interp.varval (var_name.toStdString ());
615 
616  if (val.is_undefined ())
617  val = 0;
618 
619  std::ostringstream buf;
620  val.print_raw (buf, true);
621 
622  // FIXME: is the following operation thread safe or should
623  // it be done with a signal/slot connection?
624 
625  QClipboard *clipboard = QApplication::clipboard ();
626  clipboard->setText (QString::fromStdString (buf.str ()));
627  });
628  });
629 
631  [=] (const QString& old_name, const QString& new_name) {
632  emit interpreter_event
633  ([=] (interpreter& interp) {
634  // INTERPRETER THREAD
635 
636  symbol_scope scope = interp.get_current_scope ();
637 
638  if (scope)
639  {
640  scope.rename (old_name.toStdString (),
641  new_name.toStdString ());
642 
643  tree_evaluator& tw = interp.get_evaluator ();
644 
645  event_manager& xevmgr = interp.get_event_manager ();
646 
647  xevmgr.set_workspace (true, tw.get_symbol_info ());
648  }
649 
650  // FIXME: if this action fails, do we need a way to
651  // display that info in the GUI?
652  });
653  });
654 
656  [=] (const QString& var_name) {
657  emit interpreter_event
658  ([=] (interpreter& interp) {
659  // INTERPRETER THREAD
660 
661  std::string name = var_name.toStdString ();
662  octave_value val = interp.varval (name);
663 
664  event_manager& xevmgr = interp.get_event_manager ();
665 
666  xevmgr.edit_variable (name, val);
667  });
668  });
669 
670  emit interpreter_event
671  ([=] (interpreter& interp) {
672  // INTERPRETER THREAD
673 
674  event_manager& xevmgr = interp.get_event_manager ();
675 
676  xevmgr.set_workspace ();
677  });
678  }
679 
680  return m_workspace_widget;
681 }
682 
683 QPointer<file_editor_interface>
685 {
686 #if 0
687  if (m_editor_widget && mw)
688  {
689  m_editor_widget->set_main_window (mw);
690  m_editor_widget->set_adopted (true);
691  }
692  else if (! m_editor_widget)
693  m_editor_widget = new file_editor (mw, *this);
694 #endif
695 
696  return m_editor_widget;
697 }
698 
699 QPointer<variable_editor>
701 {
702  if (m_variable_editor_widget && mw)
703  {
704  m_variable_editor_widget->set_main_window (mw);
705  m_variable_editor_widget->set_adopted (true);
706  }
707  else if (! m_variable_editor_widget)
708  {
710  = QPointer<variable_editor> (new variable_editor (mw, *this));
711 
714 
717 
718  connect (qt_link (),
721 
722  connect_interpreter_events<variable_editor> (m_variable_editor_widget);
723  }
724 
726 }
727 
728 QPointer<community_news> base_qobject::community_news_widget (int serial)
729 {
730  if (! m_community_news)
732  = QPointer<community_news> (new community_news (*this, serial));
733 
734  return m_community_news;
735 }
736 
737 QPointer<release_notes> base_qobject::release_notes_widget (void)
738 {
739  if (! m_release_notes)
740  m_release_notes = QPointer<release_notes> (new release_notes (*this));
741 
742  return m_release_notes;
743 }
744 
746 {
747  // Currently, we forward to main_window::confirm_shutdown instead of
748  // just displaying a dialog box here because the main_window also
749  // knows about and is responsible for notifying the editor.
750 
751  return m_main_window ? m_main_window->confirm_shutdown () : true;
752 }
753 
754 void base_qobject::start_gui (bool gui_app)
755 {
757  {
758  if (m_main_window)
759  return;
760 
761  m_gui_app = gui_app;
762 
763  m_main_window = new main_window (*this);
764 
767 
769  this, &base_qobject::close_gui);
770 
772  this, &base_qobject::close_gui);
773 
776 
779 
782  else
785 
786  if (m_gui_app)
787  m_qapplication->setQuitOnLastWindowClosed (true);
788  else
789  {
790  // FIXME: Save current values of PS1 and PS2 so they can be
791  // restored when we return to the command line?
792  }
793 
794  m_app_context.gui_running (true);
795  }
796 }
797 
799 {
800  terminal_dock_widget *widget
803 
804  if (! widget->isVisible ())
805  {
806  widget->show ();
807  widget->raise ();
808  }
809 }
810 
811 void base_qobject::show_documentation_window (const QString& file)
812 {
816 
817  widget->showDoc (file);
818 
819  if (! widget->isVisible ())
820  {
821  widget->show ();
822  widget->raise ();
823  }
824 }
825 
827 {
828  files_dock_widget *widget
830 
831  if (! widget->isVisible ())
832  {
833  widget->show ();
834  widget->raise ();
835  }
836 }
837 
839 {
840  history_dock_widget *widget
842 
843  if (! widget->isVisible ())
844  {
845  widget->show ();
846  widget->raise ();
847  }
848 }
849 
851 {
852  workspace_view *widget
854 
855  if (! widget->isVisible ())
856  {
857  widget->show ();
858  widget->raise ();
859  }
860 }
861 
863  const octave_value& value)
864 {
865  variable_editor *widget
868 
869  if (! widget->isVisible ())
870  {
871  widget->show ();
872  widget->raise ();
873  }
874 
875  // FIXME: Should this be done with a signal/slot connection?
876  widget->edit_variable (name, value);
877 }
878 
880 {
881  // Called when the variable editor emits the updated signal. The size
882  // of a variable may have changed, so we refresh the workspace in the
883  // interpreter. That will eventually cause the workspace view in the
884  // GUI to be updated.
885 
887  ([] (interpreter& interp)
888  {
889  // INTERPRETER THREAD
890 
891  tree_evaluator& tw = interp.get_evaluator ();
892 
893  event_manager& xevmgr = interp.get_event_manager ();
894 
895  xevmgr.set_workspace (true, tw.get_symbol_info (), false);
896  });
897 }
898 
900 {
901  // Ensure widget exists.
902  community_news_widget (serial);
903 
904  m_community_news->display ();
905 }
906 
908 {
909  // Ensure widget exists.
911 
912  m_release_notes->display ();
913 }
914 
915 void base_qobject::execute_command (const QString& command)
916 {
917  emit interpreter_event
918  ([=] (interpreter& interp)
919  {
920  // INTERPRETER THREAD
921 
922  // FIXME: Do we need to do anything special about errors here?
923  // Currently the eval function will just call error() in the
924  // interpreter event loop and throw an execution error. It will
925  // be caught, so shouldn't crash the interpreter, but the
926  // message may not go anywhere useful depending on how the GUI
927  // is being used or if Octave running server mode.
928 
929  interp.eval (command.toStdString (), 0);
930  });
931 }
932 
934 {
936  {
937  if (! m_main_window)
938  return;
939 
940  // FIXME: Restore previous values of PS1 and PS2 if we are
941  // returning to the command line?
942 
944  ([=] (interpreter& interp)
945  {
946  // INTERPRETER THREAD
947 
948  application *app = interp.get_app_context ();
949 
950  cmdline_options opts = app->options ();
951 
952  if (opts.gui ())
953  interp.quit (0, false, false);
954  });
955 
956  m_app_context.gui_running (false);
957 
958  if (m_main_window)
959  {
960  m_main_window->deleteLater ();
961 
962  m_main_window = nullptr;
963  }
964  }
965 }
966 
968 {
969  m_interpreter_ready = true;
970 }
971 
973 {
974  // The following is a direct function call across threads. It works
975  // because it is accessing a thread-safe queue of events that
976  // are later executed by the Octave interpreter in the other thread.
977 
978  // See also the comments in interpreter-qobject.h about
979  // interpreter_qobject slots.
980 
982 }
983 
985 {
986  // The following is a direct function call across threads. It works
987  // because it is accessing a thread-safe queue of events that
988  // are later executed by the Octave interpreter in the other thread.
989 
990  // See also the comments in interpreter-qobject.h about
991  // interpreter_qobject slots.
992 
994 }
995 
997 {
999 }
1000 
1001 // FIXME: Should we try to make the pause, stop, and resume actions
1002 // work for both the old and new terminal widget?
1003 
1005 {
1008 }
1009 
1011 {
1014 }
1015 
1017 {
1020 }
1021 
1022 void base_qobject::copy_image_to_clipboard (const QString& file,
1023  bool remove_file)
1024 {
1025  QClipboard *clipboard = QApplication::clipboard ();
1026 
1027  QImage img (file);
1028 
1029  if (img.isNull ())
1030  {
1031  // Report error?
1032  return;
1033  }
1034 
1035  clipboard->setImage (img);
1036 
1037  if (remove_file)
1038  QFile::remove (file);
1039 }
1040 
OCTAVE_END_NAMESPACE(octave)
void interrupt_signal(void)
cmdline_options options(void) const
Definition: octave.h:267
bool experimental_terminal_widget(void) const
Definition: octave.cc:334
QThread * m_main_thread
QPointer< files_dock_widget > m_file_browser_widget
QPointer< history_dock_widget > history_widget(main_window *mw=nullptr)
void interpreter_pause(void)
void show_variable_editor_window(const QString &name, const octave_value &value)
workspace_model * m_workspace_model
resource_manager m_resource_manager
QPointer< files_dock_widget > file_browser_widget(main_window *mw=nullptr)
void show_release_notes(void)
QPointer< community_news > community_news_widget(int serial=-1)
void connect_interpreter_events(T *widget)
void interpreter_ready(void)
void show_file_browser_window(void)
void execute_command(const QString &command)
virtual bool confirm_shutdown(void)
void interpreter_resume(void)
void copy_image_to_clipboard(const QString &file, bool remove_file)
QPointer< documentation_dock_widget > m_documentation_widget
void show_workspace_window(void)
QTranslator * m_qt_tr
QTranslator * m_qsci_tr
bool experimental_terminal_widget(void) const
void handle_variable_editor_update(void)
bool gui_running(void) const
qt_application & m_app_context
int exec(void)
QPointer< workspace_view > m_workspace_widget
main_window * m_main_window
qt_interpreter_events * qt_link(void)
QPointer< file_editor_interface > m_editor_widget
octave_qapplication * m_qapplication
void interpreter_interrupt(void)
void interpreter_stop(void)
void close_gui(void)
void show_command_history_window(void)
QTranslator * m_gui_tr
QPointer< variable_editor > variable_editor_widget(main_window *mw=nullptr)
shortcut_manager m_shortcut_manager
void show_documentation_window(const QString &file)
void interpreter_event(const fcn_callback &fcn)
void show_community_news(int serial)
bool m_translators_installed
bool m_interpreter_ready
QPointer< file_editor_interface > editor_widget(main_window *mw=nullptr)
base_qobject(qt_application &app_context, bool gui_app=false)
QPointer< variable_editor > m_variable_editor_widget
QPointer< terminal_dock_widget > terminal_widget(main_window *mw=nullptr)
void show_terminal_window(void)
void start_main_thread(void)
QPointer< history_dock_widget > m_history_widget
void start_gui(bool gui_app)
interpreter_qobject * m_interpreter_qobj
void config_translators(void)
QPointer< release_notes > release_notes_widget(void)
QPointer< community_news > m_community_news
QPointer< workspace_view > workspace_widget(main_window *mw=nullptr)
QPointer< terminal_dock_widget > m_terminal_widget
QPointer< documentation_dock_widget > documentation_widget(main_window *mw=nullptr)
QPointer< release_notes > m_release_notes
bool gui(void) const
Definition: octave.h:64
void interpreter_resume(void)
void interpreter_stop(void)
void interpreter_pause(void)
void showDoc(const QString &name)
void unregisterDoc(const QString &name)
void registerDoc(const QString &name)
Provides threadsafe access to octave.
bool edit_variable(const std::string &name, const octave_value &val)
OCTINTERP_API void set_workspace(void)
OCTINTERP_API void set_history(void)
Dock widget to display files in the current directory.
void update_octave_directory(const QString &dir)
Set the internal variable that holds the actual octave variable.
void set_history(const QStringList &hist)
void append_history(const QString &hist_entry)
void interpreter_event(const fcn_callback &fcn)
void shutdown_finished(int)
octave_value varval(const std::string &name) const
event_manager & get_event_manager(void)
Definition: interpreter.h:328
void quit(int exit_status, bool force=false, bool confirm=true)
application * get_app_context(void)
Definition: interpreter.h:231
octave_value_list eval(const std::string &try_code, int nargout)
tree_evaluator & get_evaluator(void)
symbol_scope get_current_scope(void) const
Represents the main window.
Definition: main-window.h:73
void focus_window(const QString &win_name)
Definition: main-window.cc:495
void close_gui_signal(void)
void show_community_news_signal(int serial)
bool confirm_shutdown(void)
Definition: main-window.cc:507
void show_release_notes_signal(void)
void handle_octave_ready()
This class is a simple wrapper around QApplication so that we can reimplement QApplication::notify.
virtual bool notify(QObject *receiver, QEvent *e) override
Reimplement QApplication::notify.
void interpreter_event(const fcn_callback &fcn)
void print_raw(std::ostream &os, bool pr_as_read_syntax=false) const
Definition: ov.h:1431
bool is_undefined(void) const
Definition: ov.h:640
This class inherits from the pure-virtual base class application and provides an implementation of th...
bool gui_running(void) const
void focus_window_signal(const QString &win_name)
void show_file_browser_signal(void)
void close_gui_signal(void)
void unregister_documentation_signal(const QString &file)
void set_workspace_signal(bool top_level, bool debug, const symbol_info_list &syminfo)
void interpreter_output_signal(const QString &msg)
void directory_changed_signal(const QString &dir)
void register_documentation_signal(const QString &file)
void clear_workspace_signal(void)
void set_history_signal(const QStringList &hist)
void copy_image_to_clipboard_signal(const QString &file, bool remove_file)
void new_command_line_signal(const QString &msg=QString())
void append_history_signal(const QString &hist_entry)
void edit_variable_signal(const QString &name, const octave_value &val)
void show_terminal_window_signal(void)
void show_command_history_signal(void)
void clear_history_signal(void)
void refresh_variable_editor_signal(void)
void update_prompt_signal(const QString &prompt)
void show_release_notes_signal(void)
void show_community_news_signal(int serial)
void show_workspace_signal(void)
void start_gui_signal(bool gui_app)
void show_documentation_signal(const QString &file)
void config_translators(QTranslator *qt_tr, QTranslator *qsci_tr, QTranslator *gui_tr)
void config_icon_theme(void)
void reload_settings(void)
static void delete_c_str_vec(const char *const *)
Definition: str-vec.cc:185
void rename(const std::string &old_name, const std::string &new_name)
Definition: symscope.h:490
void new_command_line_signal(const QString &=QString())
void interpreter_output_signal(const QString &)
void update_prompt_signal(const QString &)
symbol_info_list get_symbol_info(void)
Definition: pt-eval.cc:4571
void command_signal(const QString &cmd)
void updated(void)
void edit_variable(const QString &name, const octave_value &val)
void model_changed(void)
void clear_workspace(void)
void set_workspace(bool top_level, bool debug, const symbol_info_list &syminfo)
void rename_variable_signal(const QString &, const QString &)
Signal that user wants to rename a variable.
void edit_variable_signal(const QString &)
Signal that user wants to edit a variable.
void copy_variable_value_to_clipboard(const QString &)
Signal that user wnats to copy a variable value to the clipboard.
void handle_model_changed(void)
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
std::function< void(void)> fcn_callback
Definition: event-manager.h:43
std::function< void(interpreter &)> meth_callback
Definition: event-manager.h:48
#define OCTAVE_VERSION
Definition: main.in.cc:63
QString fromStdString(const std::string &s)
static void message_handler(QtMsgType, const QMessageLogContext &, const QString &)