GNU Octave 7.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-2022 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#include "command-widget.h"
44#include "community-news.h"
46#include "files-dock-widget.h"
47#include "history-dock-widget.h"
48#include "interpreter-qobject.h"
49#include "main-window.h"
50#include "octave-qobject.h"
51#include "qt-application.h"
53#include "release-notes.h"
54#include "resource-manager.h"
55#include "shortcut-manager.h"
57#include "variable-editor.h"
58#include "workspace-model.h"
59#include "workspace-view.h"
60
61// Bug #55940 (Disable App Nap on Mac)
62#if defined (Q_OS_MAC)
63# include <objc/runtime.h>
64# include <objc/message.h>
65#endif
66
67#include "interpreter.h"
68#include "oct-env.h"
69#include "version.h"
70
71#include "ovl.h"
72
73
74// Bug #55940 (Disable App Nap on Mac)
75#if defined (Q_OS_MAC)
76static void disable_app_nap (void)
77{
78 Class process_info_class;
79 SEL process_info_selector;
80 SEL begin_activity_with_options_selector;
81 id process_info;
82 id reason_string;
83 id osx_latencycritical_activity;
84
85 // 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
86 unsigned long long NSActivityUserInitiatedAllowingIdleSystemSleep = 0x00FFFFFFULL;
87 unsigned long long NSActivityLatencyCritical = 0xFF00000000ULL;
88
89 // Avoid errors on older versions of OS X
90 process_info_class = reinterpret_cast<Class> (objc_getClass ("NSProcessInfo"));
91 if (process_info_class == nil)
92 return;
93
94 process_info_selector = sel_getUid ("processInfo");
95 if (class_getClassMethod (process_info_class, process_info_selector)
96 == nullptr)
97 return;
98
99 begin_activity_with_options_selector = sel_getUid ("beginActivityWithOptions:reason:");
100 if (class_getInstanceMethod (process_info_class,
101 begin_activity_with_options_selector)
102 == nullptr)
103 return;
104
105 process_info = reinterpret_cast<id (*) (id, SEL)> (objc_msgSend)
106 (reinterpret_cast<id> (process_info_class),
107 process_info_selector);
108 if (process_info == nil)
109 return;
110
111 reason_string = reinterpret_cast<id (*) (id, SEL)> (objc_msgSend)
112 (reinterpret_cast<id> (objc_getClass ("NSString")),
113 sel_getUid ("alloc"));
114 reason_string = reinterpret_cast<id (*) (id, SEL, const char *)> (objc_msgSend)
115 (reason_string, sel_getUid ("initWithUTF8String:"),
116 "App Nap causes pause() malfunction");
117
118 // Start an Activity that suppresses App Nap. This Activity will run for
119 // the entire duration of the Octave process. This is intentional,
120 // not a leak.
121 osx_latencycritical_activity =
122 reinterpret_cast<id (*) (id, SEL, unsigned long long, id)> (objc_msgSend)
123 (process_info,
124 begin_activity_with_options_selector,
125 NSActivityUserInitiatedAllowingIdleSystemSleep
126 | NSActivityLatencyCritical,
127 reason_string);
128}
129#endif
130
131namespace octave
132{
133 // Disable all Qt messages by default.
134
135 static void
136 message_handler (QtMsgType, const QMessageLogContext&, const QString&)
137 { }
138
139 //! Reimplement QApplication::notify. Octave's own exceptions are
140 //! caught and rethrown in the interpreter thread.
141
142 bool octave_qapplication::notify (QObject *receiver, QEvent *ev)
143 {
144 try
145 {
146 return QApplication::notify (receiver, ev);
147 }
148 catch (execution_exception& ee)
149 {
151 ([=] (void)
152 {
153 // INTERPRETER THREAD
154 throw ee;
155 });
156 }
157
158 return false;
159 }
160
161 // We will create a QApplication object, even if START_GUI is false,
162 // so that we can use Qt widgets for plot windows when running in
163 // command-line mode. Note that we are creating an
164 // octave_qapplication object but handling it as a QApplication object
165 // because the octave_qapplication should behave identically to a
166 // QApplication object except that it overrides the notify method so
167 // we can handle forward Octave interpreter exceptions from the GUI
168 // thread to the interpreter thread.
169
170 base_qobject::base_qobject (qt_application& app_context, bool gui_app)
171 : QObject (),
172 m_app_context (app_context),
173 m_argc (m_app_context.sys_argc ()),
174 m_argv (m_app_context.sys_argv ()),
175 m_qapplication (new octave_qapplication (m_argc, m_argv)),
176 m_resource_manager (),
177 m_shortcut_manager (*this),
178 m_qt_tr (new QTranslator ()),
179 m_gui_tr (new QTranslator ()),
180 m_qsci_tr (new QTranslator ()),
181 m_translators_installed (false),
182 m_qt_interpreter_events (new qt_interpreter_events (*this)),
183 m_interpreter_qobj (new interpreter_qobject (*this)),
184 m_main_thread (new QThread ()),
185 m_gui_app (gui_app),
186 m_interpreter_ready (false),
187 m_workspace_model (new workspace_model ()),
188 m_documentation_widget (),
189 m_file_browser_widget (),
190 m_history_widget (),
191 m_workspace_widget (),
192 m_editor_widget (),
193 m_variable_editor_widget (),
194 m_main_window (nullptr)
195 {
196 std::string show_gui_msgs =
197 sys::env::getenv ("OCTAVE_SHOW_GUI_MESSAGES");
198
199 // Installing our handler suppresses the messages.
200
201 if (show_gui_msgs.empty ())
202 qInstallMessageHandler (message_handler);
203
204 // Set the codec for all strings (before wizard or any GUI object)
205#if ! defined (Q_OS_WIN32)
206 QTextCodec::setCodecForLocale (QTextCodec::codecForName ("UTF-8"));
207#endif
208
209 // Initialize global Qt application metadata.
210
211 QCoreApplication::setApplicationName ("GNU Octave");
212 QCoreApplication::setApplicationVersion (OCTAVE_VERSION);
213
214 // Register octave_value_list for connecting thread crossing signals.
215
216 qRegisterMetaType<octave_value_list> ("octave_value_list");
217
218// Bug #55940 (Disable App Nap on Mac)
219#if defined (Q_OS_MAC)
220 // Mac App Nap feature causes pause() and sleep() to misbehave.
221 // Disable it for the entire program run.
222 disable_app_nap ();
223#endif
224
225 // Force left-to-right alignment (see bug #46204)
226 m_qapplication->setLayoutDirection (Qt::LeftToRight);
227
228 // Qt docs recommend using Qt::QueuedConnection when connecting to
229 // the QCoreApplication::exit slot.
231 m_qapplication, &octave_qapplication::exit,
232 Qt::QueuedConnection);
233
236
237 connect (m_main_thread, &QThread::finished,
238 m_main_thread, &QThread::deleteLater);
239
240 // Handle any interpreter_event signal from the octave_qapplication
241 // object here.
242
245
248
250 {
253
256 }
257
260
263
266
269
272
275
278
281
283 {
284 m_qapplication->setQuitOnLastWindowClosed (false);
285 }
286 else
287 {
288 if (gui_app)
289 {
290 m_main_window = new main_window (*this);
291
294
297
300 else
303
306
308 }
309 else
310 {
311 // Get settings file.
313
314 // After settings.
316
317 // Initilize the shortcut-manager
319
320 m_qapplication->setQuitOnLastWindowClosed (false);
321 }
322 }
323
325 }
326
328 {
329 // Note that we don't delete m_main_thread here. That is handled by
330 // deleteLater slot that is called when the m_main_thread issues a
331 // finished signal.
332
333 // FIXME: Why are dock widget settings and/or the main window
334 // configuration not saved correctly if the main window is deleted
335 // after the dock widgets?
336
337
338 // Calling close will cause settings to be saved.
339 // If m_main_window exists, the widgets are closed by the main window
340
341 if (! m_main_window)
342 {
344 m_terminal_widget->close ();
345
347 m_documentation_widget->close ();
348
350 m_file_browser_widget->close ();
351
353 m_history_widget->close ();
354
356 m_workspace_widget->close ();
357
358 if (m_editor_widget)
359 m_editor_widget->close ();
360
362 m_variable_editor_widget->close ();
363
365 m_community_news->close ();
366 }
367 else
368 {
369 delete m_main_window;
370 }
371
372 delete m_terminal_widget;
375 delete m_history_widget;
376 delete m_workspace_widget;
377 delete m_editor_widget;
379 delete m_community_news;
380
381 delete m_interpreter_qobj;
382 delete m_qsci_tr;
383 delete m_gui_tr;
384 delete m_qt_tr;
385 delete m_qapplication;
386 delete m_workspace_model;
387
389 }
390
392 {
394 return;
395
397
398 m_qapplication->installTranslator (m_qt_tr);
399 m_qapplication->installTranslator (m_gui_tr);
400 m_qapplication->installTranslator (m_qsci_tr);
401
403 }
404
406 {
407 // Note: if using the new experimental terminal widget, we defer
408 // initializing and executing the interpreter until the main event
409 // loop begins executing.
410
411 // With the old terminal widget, we defer initializing and executing
412 // the interpreter until after the main window and QApplication are
413 // running to prevent race conditions.
414
415 QTimer::singleShot (0, m_interpreter_qobj, SLOT (execute (void)));
416
417 m_interpreter_qobj->moveToThread (m_main_thread);
418
419 m_main_thread->start ();
420 }
421
423 {
424 int status = m_qapplication->exec ();
425
426#if defined (Q_OS_MAC)
427 // fprintf to stderr is needed by macOS, for poorly-understood reasons.
428 fprintf (stderr, "\n");
429#endif
430
431 m_main_thread->quit ();
432 m_main_thread->wait ();
433
434 return status;
435 }
436
437 // Provided for convenience. Will be removed once we eliminate the
438 // old terminal widget.
440 {
442 }
443
445 {
446 return m_app_context.gui_running ();
447 }
448
449 QPointer<terminal_dock_widget>
451 {
452 if (m_terminal_widget && mw)
453 {
454 m_terminal_widget->set_main_window (mw);
455 m_terminal_widget->set_adopted (true);
456 }
457 else if (! m_terminal_widget)
458 {
460 = QPointer<terminal_dock_widget> (new terminal_dock_widget (mw, *this));
462 {
463 command_widget *cmd_widget
464 = m_terminal_widget->get_command_widget ();
465
466 connect (cmd_widget, &command_widget::interpreter_pause,
468
469 connect (cmd_widget, &command_widget::interpreter_resume,
471
472 connect (cmd_widget, &command_widget::interpreter_stop,
474
477
480
481 connect_interpreter_events (cmd_widget);
482 }
483 else
484 {
485 QTerminal *cmd_widget = m_terminal_widget->get_qterminal ();
486
487 // Connect the interrupt signal (emitted by Ctrl-C)
488 connect (cmd_widget, &QTerminal::interrupt_signal,
490 }
491 }
492
493 return m_terminal_widget;
494 }
495
496 QPointer<documentation_dock_widget>
498 {
499 if (m_documentation_widget && mw)
500 {
501 m_documentation_widget->set_main_window (mw);
502 m_documentation_widget->set_adopted (true);
503 }
504 else if (! m_documentation_widget)
505 {
507 = QPointer<documentation_dock_widget> (new documentation_dock_widget (mw, *this));
508
509 connect (qt_link (),
513
514 connect (qt_link (),
518 }
519
521 }
522
523 QPointer<files_dock_widget>
525 {
527 {
528 m_file_browser_widget->set_main_window (mw);
529 m_file_browser_widget->set_adopted (true);
530 }
531 else if (! m_file_browser_widget)
533 = QPointer<files_dock_widget> (new files_dock_widget (mw, *this));
534
537
539 }
540
541 QPointer<history_dock_widget>
543 {
545 {
546 m_history_widget->set_main_window (mw);
547 m_history_widget->set_adopted (true);
548 }
549 else if (! m_history_widget)
550 {
552 = QPointer<history_dock_widget> (new history_dock_widget (mw, *this));
553
556
559
562
564 ([=] (interpreter& interp) {
565 // INTERPRETER THREAD
566
567 event_manager& xevmgr = interp.get_event_manager ();
568
569 xevmgr.set_history ();
570 });
571 }
572
573 return m_history_widget;
574 }
575
576 QPointer<workspace_view>
578 {
580 {
581 m_workspace_widget->set_main_window (mw);
582 m_workspace_widget->set_adopted (true);
583 }
584 else if (! m_workspace_widget)
585 {
587 = QPointer<workspace_view> (new workspace_view (mw, *this));
588
590
593
596
599
600 connect (m_workspace_widget,
602 [=] (const QString& var_name) {
604 ([=] (interpreter& interp)
605 {
606 // INTERPRETER THREAD
607
608 octave_value val = interp.varval (var_name.toStdString ());
609
610 if (val.is_undefined ())
611 val = 0;
612
613 std::ostringstream buf;
614 val.print_raw (buf, true);
615
616 // FIXME: is the following operation thread safe or should
617 // it be done with a signal/slot connection?
618
619 QClipboard *clipboard = QApplication::clipboard ();
620 clipboard->setText (QString::fromStdString (buf.str ()));
621 });
622 });
623
625 [=] (const QString& old_name, const QString& new_name) {
627 ([=] (interpreter& interp) {
628 // INTERPRETER THREAD
629
630 symbol_scope scope = interp.get_current_scope ();
631
632 if (scope)
633 {
634 scope.rename (old_name.toStdString (),
635 new_name.toStdString ());
636
637 tree_evaluator& tw = interp.get_evaluator ();
638
639 event_manager& xevmgr = interp.get_event_manager ();
640
641 xevmgr.set_workspace (true, tw.get_symbol_info ());
642 }
643
644 // FIXME: if this action fails, do we need a way to
645 // display that info in the GUI?
646 });
647 });
648
650 [=] (const QString& var_name) {
652 ([=] (interpreter& interp) {
653 // INTERPRETER THREAD
654
655 std::string name = var_name.toStdString ();
656 octave_value val = interp.varval (name);
657
658 event_manager& xevmgr = interp.get_event_manager ();
659
660 xevmgr.edit_variable (name, val);
661 });
662 });
663
665 ([=] (interpreter& interp) {
666 // INTERPRETER THREAD
667
668 event_manager& xevmgr = interp.get_event_manager ();
669
670 xevmgr.set_workspace ();
671 });
672 }
673
674 return m_workspace_widget;
675 }
676
677 QPointer<file_editor_interface>
679 {
680#if 0
681 if (m_editor_widget && mw)
682 {
683 m_editor_widget->set_main_window (mw);
684 m_editor_widget->set_adopted (true);
685 }
686 else if (! m_editor_widget)
687 m_editor_widget = new file_editor (mw, *this);
688#endif
689
690 return m_editor_widget;
691 }
692
693 QPointer<variable_editor>
695 {
696 if (m_variable_editor_widget && mw)
697 {
698 m_variable_editor_widget->set_main_window (mw);
699 m_variable_editor_widget->set_adopted (true);
700 }
701 else if (! m_variable_editor_widget)
702 {
704 = QPointer<variable_editor> (new variable_editor (mw, *this));
705
708
711
712 connect (qt_link (),
715
716 connect_interpreter_events<variable_editor> (m_variable_editor_widget);
717 }
718
720 }
721
722 QPointer<community_news> base_qobject::community_news_widget (int serial)
723 {
724 if (! m_community_news)
726 = QPointer<community_news> (new community_news (*this, serial));
727
728 return m_community_news;
729 }
730
731 QPointer<release_notes> base_qobject::release_notes_widget (void)
732 {
733 if (! m_release_notes)
734 m_release_notes = QPointer<release_notes> (new release_notes ());
735
736 return m_release_notes;
737 }
738
740 {
741 // Currently, we forward to main_window::confirm_shutdown instead of
742 // just displaying a dialog box here because the main_window also
743 // knows about and is responsible for notifying the editor.
744
745 return m_main_window ? m_main_window->confirm_shutdown () : true;
746 }
747
748 void base_qobject::start_gui (bool gui_app)
749 {
751 {
752 if (m_main_window)
753 return;
754
755 m_gui_app = gui_app;
756
757 m_main_window = new main_window (*this);
758
761
764
767
770
773
776 else
779
780 if (m_gui_app)
781 m_qapplication->setQuitOnLastWindowClosed (true);
782 else
783 {
784 // FIXME: Save current values of PS1 and PS2 so they can be
785 // restored when we return to the command line?
786 }
787
789 }
790 }
791
793 {
797
798 if (! widget->isVisible ())
799 {
800 widget->show ();
801 widget->raise ();
802 }
803 }
804
806 {
810
811 widget->showDoc (file);
812
813 if (! widget->isVisible ())
814 {
815 widget->show ();
816 widget->raise ();
817 }
818 }
819
821 {
822 files_dock_widget *widget
824
825 if (! widget->isVisible ())
826 {
827 widget->show ();
828 widget->raise ();
829 }
830 }
831
833 {
834 history_dock_widget *widget
836
837 if (! widget->isVisible ())
838 {
839 widget->show ();
840 widget->raise ();
841 }
842 }
843
845 {
846 workspace_view *widget
848
849 if (! widget->isVisible ())
850 {
851 widget->show ();
852 widget->raise ();
853 }
854 }
855
857 const octave_value& value)
858 {
859 variable_editor *widget
862
863 if (! widget->isVisible ())
864 {
865 widget->show ();
866 widget->raise ();
867 }
868
869 // FIXME: Should this be done with a signal/slot connection?
870 widget->edit_variable (name, value);
871 }
872
874 {
875 // Called when the variable editor emits the updated signal. The size
876 // of a variable may have changed, so we refresh the workspace in the
877 // interpreter. That will eventually cause the workspace view in the
878 // GUI to be updated.
879
881 ([] (interpreter& interp)
882 {
883 // INTERPRETER THREAD
884
885 tree_evaluator& tw = interp.get_evaluator ();
886
887 event_manager& xevmgr = interp.get_event_manager ();
888
889 xevmgr.set_workspace (true, tw.get_symbol_info (), false);
890 });
891 }
892
894 {
895 // Ensure widget exists.
896 community_news_widget (serial);
897
898 m_community_news->display ();
899 }
900
902 {
903 // Ensure widget exists.
905
906 m_release_notes->display ();
907 }
908
909 void base_qobject::execute_command (const QString& command)
910 {
912 ([=] (interpreter& interp)
913 {
914 // INTERPRETER THREAD
915
916 // FIXME: Do we need to do anything special about errors here?
917 // Currently the eval function will just call error() in the
918 // interpreter event loop and throw an execution error. It will
919 // be caught, so shouldn't crash the interpreter, but the
920 // message may not go anywhere useful depending on how the GUI
921 // is being used or if Octave running server mode.
922
923 interp.eval (command.toStdString (), 0);
924 });
925 }
926
928 {
930 {
931 if (! m_main_window)
932 return;
933
934 // FIXME: Restore previous values of PS1 and PS2 if we are
935 // returning to the command line?
936
938 ([=] (interpreter& interp)
939 {
940 // INTERPRETER THREAD
941
942 application *app = interp.get_app_context ();
943
944 cmdline_options opts = app->options ();
945
946 if (opts.gui ())
947 interp.quit (0, false, false);
948 });
949
951
952 if (m_main_window)
953 {
954 m_main_window->deleteLater ();
955
956 m_main_window = nullptr;
957 }
958 }
959 }
960
962 {
963 m_interpreter_ready = true;
964 }
965
967 {
968 // The following is a direct function call across threads. It works
969 // because it is accessing a thread-safe queue of events that
970 // are later executed by the Octave interpreter in the other thread.
971
972 // See also the comments in interpreter-qobject.h about
973 // interpreter_qobject slots.
974
976 }
977
979 {
980 // The following is a direct function call across threads. It works
981 // because it is accessing a thread-safe queue of events that
982 // are later executed by the Octave interpreter in the other thread.
983
984 // See also the comments in interpreter-qobject.h about
985 // interpreter_qobject slots.
986
988 }
989
991 {
993 }
994
995 // FIXME: Should we try to make the pause, stop, and resume actions
996 // work for both the old and new terminal widget?
997
999 {
1002 }
1003
1005 {
1008 }
1009
1011 {
1014 }
1015
1016 void base_qobject::copy_image_to_clipboard (const QString& file,
1017 bool remove_file)
1018 {
1019 QClipboard *clipboard = QApplication::clipboard ();
1020
1021 QImage img (file);
1022
1023 if (img.isNull ())
1024 {
1025 // Report error?
1026 return;
1027 }
1028
1029 clipboard->setImage (img);
1030
1031 if (remove_file)
1032 QFile::remove (file);
1033 }
1034}
void interrupt_signal(void)
cmdline_options options(void) const
Definition: octave.h:262
bool experimental_terminal_widget(void) const
Definition: octave.cc:332
bool gui(void) const
Definition: octave.h:63
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)
octave_value varval(const std::string &name) const
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
event_manager & get_event_manager(void)
Definition: interpreter.h:328
void show_file_browser_window(void)
void show_release_notes(void)
void copy_image_to_clipboard(const QString &file, bool remove_file)
QPointer< workspace_view > m_workspace_widget
QPointer< community_news > community_news_widget(int serial=-1)
QPointer< community_news > m_community_news
QPointer< file_editor_interface > m_editor_widget
void show_community_news(int serial)
QPointer< variable_editor > variable_editor_widget(main_window *mw=nullptr)
interpreter_qobject * m_interpreter_qobj
void start_gui(bool gui_app)
void execute_command(const QString &command)
shortcut_manager m_shortcut_manager
qt_application & m_app_context
main_window * m_main_window
QTranslator * m_qt_tr
QPointer< workspace_view > workspace_widget(main_window *mw=nullptr)
QPointer< files_dock_widget > file_browser_widget(main_window *mw=nullptr)
void connect_interpreter_events(T *widget)
workspace_model * m_workspace_model
void show_command_history_window(void)
bool experimental_terminal_widget(void) const
QPointer< release_notes > m_release_notes
void start_main_thread(void)
void interpreter_ready(void)
resource_manager m_resource_manager
QTranslator * m_qsci_tr
QPointer< terminal_dock_widget > m_terminal_widget
qt_interpreter_events * qt_link(void)
void handle_variable_editor_update(void)
bool gui_running(void) const
void show_variable_editor_window(const QString &name, const octave_value &value)
void show_workspace_window(void)
QPointer< documentation_dock_widget > m_documentation_widget
void show_terminal_window(void)
QPointer< history_dock_widget > m_history_widget
QPointer< history_dock_widget > history_widget(main_window *mw=nullptr)
QTranslator * m_gui_tr
QPointer< variable_editor > m_variable_editor_widget
virtual bool confirm_shutdown(void)
base_qobject(qt_application &app_context, bool gui_app=false)
QPointer< documentation_dock_widget > documentation_widget(main_window *mw=nullptr)
QPointer< terminal_dock_widget > terminal_widget(main_window *mw=nullptr)
octave_qapplication * m_qapplication
void interpreter_pause(void)
void show_documentation_window(const QString &file)
QPointer< file_editor_interface > editor_widget(main_window *mw=nullptr)
void interpreter_interrupt(void)
void config_translators(void)
QPointer< files_dock_widget > m_file_browser_widget
void interpreter_event(const fcn_callback &fcn)
QPointer< release_notes > release_notes_widget(void)
void interpreter_stop(void)
void interpreter_resume(void)
void interpreter_pause(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 append_history(const QString &hist_entry)
void set_history(const QStringList &hist)
void interpreter_event(const fcn_callback &fcn)
Represents the main window.
Definition: main-window.h:73
void show_release_notes_signal(void)
bool confirm_shutdown(void)
Definition: main-window.cc:499
void close_gui_signal(void)
void focus_window(const QString &win_name)
Definition: main-window.cc:487
void show_community_news_signal(int serial)
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)
This class inherits from the pure-virtual base class application and provides an implementation of th...
bool gui_running(void) const
void start_gui_signal(bool gui_app)
void update_prompt_signal(const QString &prompt)
void focus_window_signal(const QString &win_name)
void append_history_signal(const QString &hist_entry)
void register_documentation_signal(const QString &file)
void set_history_signal(const QStringList &hist)
void copy_image_to_clipboard_signal(const QString &file, bool remove_file)
void edit_variable_signal(const QString &name, const octave_value &val)
void directory_changed_signal(const QString &dir)
void refresh_variable_editor_signal(void)
void show_documentation_signal(const QString &file)
void unregister_documentation_signal(const QString &file)
void show_community_news_signal(int serial)
void set_workspace_signal(bool top_level, bool debug, const symbol_info_list &syminfo)
void interpreter_output_signal(const QString &msg)
void config_translators(QTranslator *qt_tr, QTranslator *qsci_tr, QTranslator *gui_tr)
void rename(const std::string &old_name, const std::string &new_name)
Definition: symscope.h:490
static std::string getenv(const std::string &name)
Definition: oct-env.cc:294
void interpreter_output(const QString &)
void update_prompt(const QString &)
void edit_variable(const QString &name, const octave_value &val)
void command_signal(const QString &cmd)
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 print_raw(std::ostream &os, bool pr_as_read_syntax=false) const
Definition: ov.h:1428
bool is_undefined(void) const
Definition: ov.h:640
static void delete_c_str_vec(const char *const *)
Definition: str-vec.cc:185
symbol_info_list get_symbol_info(void)
Definition: pt-eval.cc:4411
OCTAVE_NAMESPACE_BEGIN typedef std::function< void(void)> fcn_callback
Definition: event-manager.h:47
std::function< void(interpreter &)> meth_callback
Definition: event-manager.h:48
QString name
#define OCTAVE_VERSION
Definition: main.in.cc:63
QString fromStdString(const std::string &s)
static void message_handler(QtMsgType, const QMessageLogContext &, const QString &)