GNU Octave 7.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
main-window.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 <QAction>
33#include <QApplication>
34#include <QClipboard>
35#include <QDateTime>
36#include <QDebug>
37#include <QDesktopServices>
38#include <QDesktopWidget>
39#include <QFileDialog>
40#include <QIcon>
41#include <QInputDialog>
42#include <QKeySequence>
43#include <QLabel>
44#include <QMenu>
45#include <QMenuBar>
46#include <QMessageBox>
47#include <QScreen>
48#include <QStyle>
49#include <QStyleFactory>
50#include <QTextBrowser>
51#include <QTextStream>
52#include <QThread>
53#include <QTimer>
54#include <QToolBar>
55#include <QWindow>
56
57// QTerminal includes
58#include "QTerminal.h"
59
60#if defined (HAVE_QSCINTILLA)
61# include "file-editor.h"
62#endif
63#include "command-widget.h"
64#include "gui-preferences-cs.h"
65#include "gui-preferences-dw.h"
66#include "gui-preferences-ed.h"
68#include "gui-preferences-mw.h"
69#include "gui-preferences-nr.h"
70#include "gui-preferences-sc.h"
71#include "gui-settings.h"
72#include "interpreter-qobject.h"
73#include "main-window.h"
74#include "news-reader.h"
75#include "octave-qobject.h"
76#include "octave-qtutils.h"
77#include "settings-dialog.h"
78#include "shortcut-manager.h"
79#include "welcome-wizard.h"
80
81#include "cmd-edit.h"
82#include "oct-env.h"
83#include "url-transfer.h"
84
85#include "builtin-defun-decls.h"
86#include "defaults.h"
87#include "interpreter.h"
88#include "load-path.h"
89#include "utils.h"
90#include "syminfo.h"
91#include "version.h"
92
93namespace octave
94{
96 : QMainWindow (), m_octave_qobj (oct_qobj),
97 m_status_bar (nullptr),
98 m_command_window (nullptr),
99 m_history_window (nullptr),
100 m_file_browser_window (nullptr),
101 m_editor_window (nullptr),
102 m_workspace_window (nullptr),
103 m_external_editor (new external_editor_interface (this, m_octave_qobj)),
104 m_active_editor (m_external_editor), m_settings_dlg (nullptr),
105 m_find_files_dlg (nullptr), m_set_path_dlg (nullptr),
106 m_clipboard (QApplication::clipboard ()),
107 m_prevent_readline_conflicts (true),
108 m_prevent_readline_conflicts_menu (false),
109 m_suppress_dbg_location (true),
110 m_closing (false), m_file_encoding (QString ())
111 {
113
114 if (rmgr.is_first_run ())
115 {
116 // Before wizard.
118
119 welcome_wizard welcomeWizard (m_octave_qobj);
120
121 if (welcomeWizard.exec () == QDialog::Rejected)
122 exit (1);
123
124 // Install settings file.
125 rmgr.reload_settings ();
126 }
127 else
128 {
129 // Get settings file.
130 rmgr.reload_settings ();
131
132 // After settings.
134 }
135
136 setObjectName (gui_obj_name_main_window);
137
139
140 // We provide specific terminal capabilities, so ensure that
141 // TERM is always set appropriately.
142
143#if defined (OCTAVE_USE_WINDOWS_API)
144 sys::env::putenv ("TERM", "cygwin");
145#else
146 sys::env::putenv ("TERM", "xterm");
147#endif
148
149 // FIXME: can we do this job when creating the shortcut manager?
150 // A quick look shows that it may require some coordination with the
151 // resource manager. Startup is complicated, but maybe we can make
152 // it simpler?
154 scmgr.init_data ();
155
157
158 m_status_bar = new QStatusBar (this);
160 QLabel *text = new QLabel (tr ("Profiler"));
161 m_status_bar->addPermanentWidget (text);
162 m_status_bar->addPermanentWidget (m_profiler_status_indicator);
163
165
166#if defined (HAVE_QGUIAPPLICATION_SETDESKTOPFILENAME)
167 QGuiApplication::setDesktopFileName ("org.octave.Octave.desktop");
168#endif
169
171
172 m_default_style = qapp->style ()->objectName ();
173
175
176 bool connect_to_web = true;
177 QDateTime last_checked;
178 int serial = 0;
179 m_active_dock = nullptr;
180
181 if (settings)
182 {
183 connect_to_web
184 = settings->value (nr_allow_connection).toBool ();
185
186 last_checked
187 = settings->value (nr_last_time).toDateTime ();
188
189 serial = settings->value (nr_last_news).toInt ();
190 m_default_encoding = settings->value (ed_default_enc).toString ();
191 }
192
193 QDateTime current = QDateTime::currentDateTime ();
194 QDateTime one_day_ago = current.addDays (-1);
195
196 if (connect_to_web
197 && (! last_checked.isValid () || one_day_ago > last_checked))
198 emit show_community_news_signal (serial);
199
201
202 // We have to set up all our windows, before we finally launch
203 // octave.
204
205 construct ();
206
207 read_settings ();
208
210
211 emit init_window_menu ();
212
214 }
215
217
219 {
227
229 }
230
232 {
234
236
237 connect (this, &main_window::settings_changed,
239
241 {
242 QTerminal *cmd_widget = m_command_window->get_qterminal ();
243
244 // The following connections were previously made in
245 // QTerminal::construct, QWinTerminalImpl::QWinTerminalImpl, and
246 // QUnixTerminalImpl::QUnixTerminalImpl. Similar actions should
247 // probably be possible for the new command widget.
248
249 connect (cmd_widget, &QTerminal::report_status_message,
251
252 connect (cmd_widget, &QTerminal::edit_mfile_request,
254
257
259 cmd_widget, &QTerminal::init_terminal_size);
260
261 connect (this, &main_window::copyClipboard_signal,
262 cmd_widget, &QTerminal::copyClipboard);
263
265 cmd_widget, &QTerminal::pasteClipboard);
266
267 connect (this, &main_window::selectAll_signal,
268 cmd_widget, &QTerminal::selectAll);
269
270 connect (cmd_widget, &QTerminal::request_edit_mfile_signal,
272
273 connect (cmd_widget, &QTerminal::request_open_file_signal,
275
276 connect (cmd_widget, &QTerminal::set_screen_size_signal,
278
279 connect (cmd_widget, &QTerminal::clear_command_window_request,
281 }
282 }
283
285 {
287
289 }
290
292 {
294
296
299 connect (m_file_browser_window,
302
305
308
311
314
317 }
318
320 {
322
324
327
330 }
331
333 {
335
337
340 }
341
343 {
345
346 qt_interpreter_events *qt_link = interp_qobj->qt_link ();
347
348#if defined (HAVE_QSCINTILLA)
349 file_editor *editor = new file_editor (this, m_octave_qobj);
350
352
353 // The editor is currently different from other dock widgets. Until
354 // those differences are resolved, make interpreter_event
355 // connections here instead of in base_qobject::editor_widget.
357
358 connect (editor, &file_editor::request_settings_dialog,
360
361 connect (editor, &file_editor::request_dbcont_signal,
363
366
369
372
373 connect (editor, &file_editor::run_file_signal,
375
376 connect (editor, &file_editor::edit_mfile_request,
378
379 connect (editor, &file_editor::debug_quit_signal,
381
382 connect (this, &main_window::editor_focus_changed,
384
387
390
393
396
399
402
405
406 // Signals for removing/renaming files/dirs in the file browser
409
412
413 // Signals for removing/renaming files/dirs in the terminal window
416
417 // Signals for entering/exiting debug mode
420
423
426
427 m_editor_window = editor;
428
429 m_editor_menubar = m_editor_window->menubar ();
430
432
433 m_editor_window->enable_menu_shortcuts (false);
434#else
435 m_editor_window = nullptr;
436
437 m_editor_menubar = nullptr;
438
440#endif
441
442 connect (qt_link, SIGNAL (edit_file_signal (const QString&)),
443 m_active_editor, SLOT (handle_edit_file_request (const QString&)));
444 }
445
447 {
449
451 }
452
454 {
455 connect (this, &main_window::init_window_menu,
457
458 connect (this, &main_window::settings_changed,
460
461 connect (this, &main_window::active_dock_changed,
463
464 // FIXME: shouldn't this action should be associated with closing
465 // the main window, not with exiting the application? At one time,
466 // those two actions happened together, but now it is possible to
467 // close the main window without exiting the application.
468 connect (qApp, &QApplication::aboutToQuit,
470
471 // The following is required when the exp. terminal widget is used
472 // and the main window is closed (no exit via interpreter)
473 connect (this, &main_window::close_gui_signal,
475 }
476
478 {
479 return m_command_window->has_focus ();
480 }
481
483 {
484 m_command_window->activate ();
485 }
486
487 void main_window::focus_window (const QString& win_name)
488 {
489 if (win_name == "command")
490 m_command_window->activate ();
491 else if (win_name == "history")
492 m_history_window->activate ();
493 else if (win_name == "workspace")
494 m_workspace_window->activate ();
495 else if (win_name == "filebrowser")
496 m_file_browser_window->activate ();
497 }
498
500 {
501 bool closenow = true;
502
505
507 global_prompt_to_exit.def).toBool ())
508 {
509 int ans = QMessageBox::question (this, tr ("Octave"),
510 tr ("Are you sure you want to exit Octave?"),
511 (QMessageBox::Ok
512 | QMessageBox::Cancel),
513 QMessageBox::Ok);
514
515 if (ans != QMessageBox::Ok)
516 closenow = false;
517 }
518
519#if defined (HAVE_QSCINTILLA)
520 if (closenow)
521 closenow = m_editor_window->check_closing ();
522#endif
523
524 return closenow;
525 }
526
527 // catch focus changes and determine the active dock widget
529 {
530 // If there is no new widget or the new widget is a menu bar
531 // (when pressing <alt>), we can return immediately and reset the
532 // focus to the previous widget
533 if (! new_widget
534 || (new_widget == menuBar ())
535 || (new_widget == m_editor_menubar))
536 {
537 if (m_active_dock)
538 m_active_dock->setFocus ();
539
540 return;
541 }
542
543 octave_dock_widget *dock = nullptr;
544 QWidget *w_new = new_widget; // get a copy of new focus widget
545 QWidget *start = w_new; // Save it as start of our search
546 int count = 0; // fallback to prevent endless loop
547
549
550 while (w_new && w_new != m_main_tool_bar && count < 100)
551 {
552 // Go through all dock widgets and check whether the current widget
553 // with focus is a child of one of them.
554 for (auto w : w_list)
555 {
556 if (w->isAncestorOf (w_new))
557 dock = w;
558 }
559
560 if (dock)
561 break;
562
563 // If not yet found (in case w_new is not a child of its dock widget),
564 // test next widget in the focus chain
565 w_new = qobject_cast<QWidget *> (w_new->previousInFocusChain ());
566
567 // Measures preventing an endless loop
568 if (w_new == start)
569 break; // We have arrived where we began ==> exit loop
570 count++; // Limited number of trials
571 }
572
573 // editor and terminal needs extra handling
574 octave_dock_widget *edit_dock_widget
575 = static_cast<octave_dock_widget *> (m_editor_window);
576 octave_dock_widget *cmd_dock_widget
577 = static_cast<octave_dock_widget *> (m_command_window);
578
579 // if new dock has focus, emit signal and store active focus
580 // except editor changes to a dialog (dock=0)
581 if ((dock || m_active_dock != edit_dock_widget) && (dock != m_active_dock))
582 {
583 // signal to all dock widgets for updating the style
585
586 if (dock)
587 {
588 QList<QDockWidget *> tabbed = tabifiedDockWidgets (dock);
589 if (tabbed.contains (m_active_dock))
591 }
592
593 // Check whether editor loses or gains focus
594 int editor = 0;
595 if (edit_dock_widget == dock)
596 {
597 emit editor_focus_changed (true);
598 editor = 1;
599 }
600 else if (edit_dock_widget == m_active_dock)
601 {
602 emit editor_focus_changed (false);
603 editor = -1;
604 }
605
606 // Check whether terminal loses or gains focus
607 int cmd_involved = 0;
608 if (cmd_dock_widget == dock)
609 cmd_involved = 1;
610 else if (cmd_dock_widget == m_active_dock)
611 cmd_involved = -1;
612
613 // If we have to take care of Alt+? accelerators of the main
614 // window, take result of test for terminal widget above
615 int command = 0;
617 command = cmd_involved;
618
619 // If editor or command gets/looses focus, disable/enable
620 // main menu accelerators (Alt + ?)
621 if (editor || command)
622 {
623 int sum = editor + command;
624 if (sum > 0)
626 else if (sum < 0)
628 }
629
630 if (m_active_dock)
632 m_active_dock = dock;
633
634 // En-/disable global shortcuts (preventing conflicts with
635 // readline. Do it here because it relies on m_active_dock
636 if (cmd_involved)
638 }
639 }
640
642 {
645
646 if (settings)
648 }
649
650 void main_window::report_status_message (const QString& statusMessage)
651 {
652 m_status_bar->showMessage (statusMessage, 1000);
653 }
654
656 {
657 // FIXME: Remove, if for all common KDE versions (bug #54607) is resolved.
658 int opts = 0; // No options by default.
661 if (! settings->value (global_use_native_dialogs).toBool ())
662 opts = QFileDialog::DontUseNativeDialog;
663
664 QString file
665 = QFileDialog::getSaveFileName (this, tr ("Save Workspace As"), ".",
666 nullptr, nullptr, QFileDialog::Option (opts));
667
668 if (! file.isEmpty ())
669 {
671 ([=] (interpreter& interp)
672 {
673 // INTERPRETER THREAD
674
675 Fsave (interp, ovl (file.toStdString ()));
676 });
677 }
678 }
679
680 void main_window::handle_load_workspace_request (const QString& file_arg)
681 {
682 // FIXME: Remove, if for all common KDE versions (bug #54607) is resolved.
683 int opts = 0; // No options by default.
686 if (! settings->value (global_use_native_dialogs).toBool ())
687 opts = QFileDialog::DontUseNativeDialog;
688
689 QString file = file_arg;
690
691 if (file.isEmpty ())
692 file = QFileDialog::getOpenFileName (this, tr ("Load Workspace"), ".",
693 nullptr, nullptr, QFileDialog::Option (opts));
694
695 if (! file.isEmpty ())
696 {
698 ([=] (interpreter& interp)
699 {
700 // INTERPRETER THREAD
701
702 Fload (interp, ovl (file.toStdString ()));
703
704 tree_evaluator& tw = interp.get_evaluator ();
705
706 event_manager& xevmgr = interp.get_event_manager ();
707
708 xevmgr.set_workspace (true, tw.get_symbol_info ());
709 });
710 }
711 }
712
713 void main_window::handle_open_any_request (const QString& file_arg)
714 {
715 if (! file_arg.isEmpty ())
716 {
717 std::string file = file_arg.toStdString ();
718
720 ([=] (interpreter& interp)
721 {
722 // INTERPRETER THREAD
723
724 interp.feval ("open", ovl (file));
725
726 // Update the workspace since open.m may have loaded new
727 // variables.
728 tree_evaluator& tw = interp.get_evaluator ();
729
730 event_manager& xevmgr = interp.get_event_manager ();
731
732 xevmgr.set_workspace (true, tw.get_symbol_info ());
733 });
734 }
735 }
736
738 {
740 ([] (interpreter& interp)
741 {
742 // INTERPRETER THREAD
743
744 Fclear (interp);
745 });
746 }
747
749 {
751 ([] (void)
752 {
753 // INTERPRETER THREAD
754
757 });
758 }
759
761 {
763 ([] (interpreter& interp)
764 {
765 // INTERPRETER THREAD
766
767 history_system& history_sys = interp.get_history_system ();
768
769 history_sys.do_history (ovl ("-c"));
770 });
771 }
772
774 {
776 {
778 ([] (void)
779 {
780 // INTERPRETER THREAD
781
784 });
785 }
786 else
787 emit undo_signal ();
788 }
789
790 void main_window::modify_path (const QStringList& dir_list,
791 bool rm, bool subdirs)
792 {
794 ([=] (interpreter& interp)
795 {
796 // INTERPRETER THREAD
797
798 octave_value_list paths;
799
800 // Loop over all directories in order to get all subdirs
801 for (octave_idx_type i = 0; i < dir_list.length (); i++)
802 {
803 std::string dir = dir_list.at(i).toStdString ();
804
805 if (subdirs)
806 paths.append (Fgenpath (ovl (dir)));
807 else
808 paths.append (dir);
809 }
810
811 if (rm)
812 Frmpath (interp, paths);
813 else
814 Faddpath (interp, paths);
815 });
816 }
817
818 void main_window::edit_mfile (const QString& name, int line)
819 {
820 handle_edit_mfile_request (name, QString (), QString (), line);
821 }
822
823 void main_window::file_remove_proxy (const QString& o, const QString& n)
824 {
826
827 qt_interpreter_events *qt_link = interp_qobj->qt_link ();
828
829 // Wait for worker to suspend
830 qt_link->lock ();
831
832 // Close the file if opened
833#if defined (HAVE_QSCINTILLA)
834 m_editor_window->handle_file_remove (o, n);
835#else
836 octave_unused_parameter (o);
837 octave_unused_parameter (n);
838#endif
839
840 // We are done: Unlock and wake the worker thread
841 qt_link->unlock ();
842 qt_link->wake_all ();
843 }
844
846 {
847 QDesktopServices::openUrl
848 (QUrl ("https://octave.org/doc/interpreter/index.html"));
849 }
850
852 {
853 QDesktopServices::openUrl (QUrl ("https://octave.org/bugs.html"));
854 }
855
857 {
858 QDesktopServices::openUrl (QUrl ("https://octave.org/packages.html"));
859 }
860
862 {
863 QDesktopServices::openUrl (QUrl ("https://octave.org/contribute.html"));
864 }
865
867 {
868 QDesktopServices::openUrl (QUrl ("https://octave.org/donate.html"));
869 }
870
871 void main_window::process_settings_dialog_request (const QString& desired_tab)
872 {
873 if (m_settings_dlg) // m_settings_dlg is a guarded pointer!
874 {
875 // here the dialog is still open and called once again
876 if (! desired_tab.isEmpty ())
877 m_settings_dlg->show_tab (desired_tab);
878 return;
879 }
880
881 m_settings_dlg = new settings_dialog (this, m_octave_qobj, desired_tab);
882
885
886 m_settings_dlg->setModal (false);
887 m_settings_dlg->setAttribute (Qt::WA_DeleteOnClose);
888 m_settings_dlg->show ();
889 }
890
892 {
893 std::string message
895
896 QMessageBox::about (this, tr ("About Octave"),
898 }
899
901 bool update_by_worker)
902 {
903 if (! settings)
904 return;
905
906 // Get desired style from preferences or take the default one if
907 // the desired one is not found
908 QString preferred_style = settings->value (global_style).toString ();
909
910 if (preferred_style == global_style.def.toString ())
911 preferred_style = m_default_style;
912
913 QStyle *new_style = QStyleFactory::create (preferred_style);
914 if (new_style)
915 {
917
918 qapp->setStyle (new_style);
919 }
920
921 // the widget's icons (when floating)
922 QString icon_set
923 = settings->value (dw_icon_set).toString ();
924
925 int count = 0;
926 int icon_set_found = 0; // default
927
928 while (! dw_icon_set_names[count].name.isEmpty ())
929 {
930 // while not end of data
931 if (dw_icon_set_names[count].name == icon_set)
932 {
933 // data of desired icon set found
934 icon_set_found = count;
935 break;
936 }
937 count++;
938 }
939
940 QString icon;
941 for (auto *widget : dock_widget_list ())
942 {
943 QString name = widget->objectName ();
944 if (! name.isEmpty ())
945 {
946 // if child has a name
947 icon = dw_icon_set_names[icon_set_found].path; // prefix | octave-logo
948 if (dw_icon_set_names[icon_set_found].name != "NONE")
949 icon += name + ".png"; // add widget name and ext.
950 widget->setWindowIcon (QIcon (icon));
951 }
952 }
953
954 int size_idx = settings->value (global_icon_size).toInt ();
955 size_idx = (size_idx > 0) - (size_idx < 0) + 1; // Make valid index from 0 to 2
956
957 QStyle *st = style ();
958 int icon_size = st->pixelMetric (global_icon_sizes[size_idx]);
959 m_main_tool_bar->setIconSize (QSize (icon_size, icon_size));
960
961 if (settings->value (global_status_bar).toBool ())
962 m_status_bar->show ();
963 else
964 m_status_bar->hide ();
965
967 = settings->value (sc_prevent_rl_conflicts).toBool ();
968
970 = settings->value (sc_prevent_rl_conflicts_menu).toBool ();
971
973 = ! settings->value (cs_dbg_location).toBool ();
974
977
978 emit active_dock_changed (nullptr, m_active_dock); // update dock widget styles
979
981
982 bool do_disable_main_menu_shortcuts
986
987 disable_menu_shortcuts (do_disable_main_menu_shortcuts);
988
989 // Check whether some octave internal preferences have to be updated
990 QString new_default_encoding
991 = settings->value (ed_default_enc).toString ();
992 // Do not update internal pref only if a) this update was not initiated
993 // by the worker and b) the pref has really changes
994 if (! update_by_worker && (new_default_encoding != m_default_encoding))
995 update_default_encoding (new_default_encoding);
996
997 // Set cursor blinking depending on the settings
998 // Cursor blinking: consider old terminal related setting if not yet set
999 // TODO: This pref. can be deprecated / removed if Qt adds support for
1000 // getting the cursor blink preferences from all OS environments
1001 bool cursor_blinking;
1002
1003 if (settings->contains (global_cursor_blinking.key))
1004 cursor_blinking = settings->value (global_cursor_blinking).toBool ();
1005 else
1006 cursor_blinking = settings->value (cs_cursor_blinking).toBool ();
1007
1008 if (cursor_blinking)
1009 QApplication::setCursorFlashTime (1000); // 1000 ms flash time
1010 else
1011 QApplication::setCursorFlashTime (0); // no flashing
1012
1013 }
1014
1016 {
1017 // Find files dialog is constructed dynamically, not at time of main_window
1018 // construction. Connecting it to qApp aboutToQuit signal would have
1019 // caused it to run after gui_settings is deleted.
1020 if (m_find_files_dlg)
1022
1023 if (m_set_path_dlg)
1024 m_set_path_dlg->save_settings ();
1025
1026 write_settings ();
1027
1028 // No more active dock, otherwise, focus_changed would try to set
1029 // the focus to a dock widget that might not exist anymore
1030 m_active_dock = nullptr;
1031 }
1032
1034 {
1036 }
1037
1039 {
1040 // Remove existing entry, if any, then add new directory at top and
1041 // mark it as the current directory. Finally, update the file list
1042 // widget.
1043
1044 int index = m_current_directory_combo_box->findText (dir);
1045
1046 if (index >= 0)
1047 m_current_directory_combo_box->removeItem (index);
1048
1049 m_current_directory_combo_box->insertItem (0, dir);
1050 m_current_directory_combo_box->setCurrentIndex (0);
1051 }
1052
1054 {
1055 // FIXME: Remove, if for all common KDE versions (bug #54607) is resolved.
1056 int opts = QFileDialog::ShowDirsOnly;
1059 if (! settings->value (global_use_native_dialogs).toBool ())
1060 opts = QFileDialog::DontUseNativeDialog;
1061
1062 QString dir
1063 = QFileDialog::getExistingDirectory (this, tr ("Browse directories"), nullptr,
1064 QFileDialog::Option (opts));
1065
1067
1068 // FIXME: on Windows systems, the command window freezes after the
1069 // previous actions. Forcing the focus appears to unstick it.
1070
1072 }
1073
1075 {
1076 // Change to dir if it is an existing directory.
1077
1078 QString xdir = (dir.isEmpty () ? "." : dir);
1079
1080 QFileInfo fileInfo (xdir);
1081
1082 if (fileInfo.exists () && fileInfo.isDir ())
1083 {
1085 ([=] (interpreter& interp)
1086 {
1087 // INTERPRETER THREAD
1088
1089 interp.chdir (xdir.toStdString ());
1090 });
1091 }
1092 }
1093
1095 {
1097 }
1098
1099 // Slot that is called if return is pressed in the line edit of the
1100 // combobox to change to a new directory or a directory that is already
1101 // in the drop down list.
1102
1104 {
1105 // Get new directory name, and change to it if it is new. Otherwise,
1106 // the combo box will trigger the "activated" signal to change to the
1107 // directory.
1108
1109 QString dir = m_current_directory_combo_box->currentText ();
1110
1111 int index = m_current_directory_combo_box->findText (dir);
1112
1113 if (index < 0)
1115 }
1116
1117 void main_window::execute_command_in_terminal (const QString& command)
1118 {
1120 ([=] (void)
1121 {
1122 // INTERPRETER THREAD
1123
1124 std::string pending_input = command_editor::get_current_line ();
1125
1126 command_editor::set_initial_input (pending_input);
1127 command_editor::replace_line (command.toStdString ());
1131 });
1132
1134 }
1135
1136 void main_window::run_file_in_terminal (const QFileInfo& info)
1137 {
1139 ([=] (interpreter& interp)
1140 {
1141 // INTERPRETER THREAD
1142
1143 QString function_name = info.fileName ();
1144 function_name.chop (info.suffix ().length () + 1);
1145 std::string file_path = info.absoluteFilePath ().toStdString ();
1146
1147 std::string pending_input = command_editor::get_current_line ();
1148
1149 if (valid_identifier (function_name.toStdString ()))
1150 {
1151 // Valid identifier: call as function with possibility to
1152 // debug.
1153
1154 load_path& lp = interp.get_load_path ();
1155
1156 std::string path = info.absolutePath ().toStdString ();
1157
1158 if (lp.contains_file_in_dir (file_path, path))
1159 command_editor::replace_line (function_name.toStdString ());
1160 }
1161 else
1162 {
1163 // No valid identifier: use equivalent of Fsource (), no
1164 // debug possible.
1165
1166 interp.source_file (file_path);
1167
1168 command_editor::replace_line ("");
1169 }
1170
1171 command_editor::set_initial_input (pending_input);
1175 });
1176
1178 }
1179
1181 {
1183 ([] (interpreter& interp)
1184 {
1185 // INTERPRETER THREAD
1186
1187 Fbuiltin (interp, ovl ("figure"));
1188 Fdrawnow (interp);
1189 });
1190 }
1191
1193 {
1194 setWindowTitle ("Octave (Debugging)");
1195
1196 m_debug_continue->setEnabled (true);
1197 m_debug_step_into->setEnabled (true);
1198 m_debug_step_over->setEnabled (true);
1199 m_debug_step_out->setEnabled (true);
1200 m_debug_quit->setEnabled (true);
1201 }
1202
1204 {
1205 setWindowTitle ("Octave");
1206
1207 m_debug_continue->setEnabled (false);
1208 m_debug_step_into->setEnabled (false);
1210 m_debug_step_out->setEnabled (false);
1211 m_debug_quit->setEnabled (false);
1212 }
1213
1215 {
1217 ([=] (interpreter& interp)
1218 {
1219 // INTERPRETER THREAD
1220
1222 Fdbcont (interp);
1223
1225 });
1226 }
1227
1229 {
1231 ([=] (interpreter& interp)
1232 {
1233 // INTERPRETER THREAD
1234
1236 Fdbstep (interp, ovl ("in"));
1237
1239 });
1240 }
1241
1243 {
1244 if (m_debug_quit->isEnabled ())
1245 {
1246 // We are in debug mode, just call dbstep.
1247
1249 ([=] (interpreter& interp)
1250 {
1251 // INTERPRETER THREAD
1252
1255 Fdbstep (interp);
1256
1258 });
1259 }
1260 else
1261 {
1262 // Not in debug mode: "step into" the current editor file
1263 emit step_into_file_signal ();
1264 }
1265 }
1266
1268 {
1270 ([=] (interpreter& interp)
1271 {
1272 // INTERPRETER THREAD
1273
1275 Fdbstep (interp, ovl ("out"));
1276
1278 });
1279 }
1280
1282 {
1284 ([] (interpreter& interp)
1285 {
1286 // INTERPRETER THREAD
1287
1288 Fdbquit (interp);
1289
1291 });
1292 }
1293
1294 //
1295 // Functions related to file editing
1296 //
1297 // These are moved from editor to here for also using them when octave
1298 // is built without qscintilla
1299 //
1301 {
1302 // Open file isn't a file_editor_tab or editor function since the file
1303 // might be opened in an external editor. Hence, functionality is here.
1304
1307 bool is_internal = m_editor_window
1309 global_use_custom_editor.def).toBool ();
1310
1311 // Create a NonModal message.
1312 QWidget *p = this;
1313 if (is_internal)
1314 p = m_editor_window;
1315 QFileDialog *fileDialog = new QFileDialog (p);
1316 fileDialog->setNameFilter (tr ("Octave Files (*.m);;All Files (*)"));
1317
1318 fileDialog->setAcceptMode (QFileDialog::AcceptOpen);
1319 fileDialog->setViewMode (QFileDialog::Detail);
1320 fileDialog->setFileMode (QFileDialog::ExistingFiles);
1321 fileDialog->setDirectory (m_current_directory_combo_box->itemText (0));
1322
1323 // FIXME: Remove, if for all common KDE versions (bug #54607) is resolved.
1324 if (! settings->value (global_use_native_dialogs).toBool ())
1325 fileDialog->setOption(QFileDialog::DontUseNativeDialog);
1326
1327 connect (fileDialog, &QFileDialog::filesSelected,
1329
1330 fileDialog->setWindowModality (Qt::NonModal);
1331 fileDialog->setAttribute (Qt::WA_DeleteOnClose);
1332 fileDialog->show ();
1333 }
1334
1335 // Create a new script
1336 void main_window::request_new_script (const QString& commands)
1337 {
1338 emit new_file_signal (commands);
1339 }
1340
1341 // Create a new function and open it
1343 {
1344 bool ok;
1345 // Get the name of the new function: Parent of the input dialog is the
1346 // editor window or the main window. The latter is chosen, if a custom
1347 // editor is used or qscintilla is not available
1351 if (! p || settings->value (global_use_custom_editor.key,
1352 global_use_custom_editor.def).toBool ())
1353 p = this;
1354 QString new_name = QInputDialog::getText (p, tr ("New Function"),
1355 tr ("New function name:\n"), QLineEdit::Normal, "", &ok);
1356
1357 if (ok && new_name.length () > 0)
1358 {
1359 // append suffix if it does not already exist
1360 if (new_name.rightRef (2) != ".m")
1361 new_name.append (".m");
1362 // check whether new files are created without prompt
1363 if (! settings->value (ed_create_new_file).toBool ())
1364 {
1365 // no, so enable this settings and wait for end of new file loading
1366 settings->setValue (ed_create_new_file.key, true);
1367 connect (m_editor_window, SIGNAL (file_loaded_signal (void)),
1368 this, SLOT (restore_create_file_setting (void)));
1369 }
1370 // start the edit command
1371 execute_command_in_terminal ("edit " + new_name);
1372 }
1373 }
1374
1375 void main_window::handle_edit_mfile_request (const QString& fname,
1376 const QString& ffile,
1377 const QString& curr_dir,
1378 int line)
1379 {
1381 ([=] (interpreter& interp)
1382 {
1383 // INTERPRETER THREAD
1384
1385 // Split possible subfunctions
1386 QStringList fcn_list = fname.split ('>');
1387 QString fcn_name = fcn_list.at (0) + ".m";
1388
1389 // FIXME: could use symbol_exist directly, but we may also want
1390 // to fix that to be a member function in the interpreter
1391 // class?
1392
1393 // Is it a regular function within the search path? (Call Fexist)
1394 octave_value_list fct = Fexist (interp, ovl (fname.toStdString ()),0);
1395 int type = fct (0).int_value ();
1396
1397 QString message = QString ();
1398 QString filename = QString ();
1399
1400 switch (type)
1401 {
1402 case 3:
1403 case 5:
1404 case 103:
1405 message = tr ("%1 is a built-in, compiled or inline\n"
1406 "function and can not be edited.");
1407 break;
1408
1409 case 2:
1410 // FIXME: could use a load_path function directly.
1411 octave_value_list file_path
1412 = Ffile_in_loadpath (interp, ovl (fcn_name.toStdString ()), 0);
1413 if (file_path.length () > 0)
1414 filename = QString::fromStdString (file_path (0).string_value ());
1415 break;
1416 }
1417
1418 if (filename.isEmpty () && message.isEmpty ())
1419 {
1420 // No error so far, but function still not known
1421 // -> try directory of edited file
1422 // get directory
1423 QDir dir;
1424 if (ffile.isEmpty ())
1425 {
1426 if (curr_dir.isEmpty ())
1427 dir = QDir (m_current_directory_combo_box->itemText (0));
1428 else
1429 dir = QDir (curr_dir);
1430 }
1431 else
1432 dir = QDir (QFileInfo (ffile).canonicalPath ());
1433
1434 QFileInfo file = QFileInfo (dir, fcn_name);
1435 if (file.exists ())
1436 filename = file.canonicalFilePath (); // local file exists
1437 else
1438 {
1439 // local file does not exist -> try private directory
1440 file = QFileInfo (ffile);
1441 file = QFileInfo (QDir (file.canonicalPath () + "/private"),
1442 fcn_name);
1443 if (file.exists ())
1444 filename = file.canonicalFilePath (); // private function exists
1445 else
1446 message = tr ("Can not find function %1"); // no file found
1447
1448 }
1449 }
1450
1451 if (! message.isEmpty ())
1452 {
1453 emit warning_function_not_found_signal (message.arg (fname));
1454 return;
1455 }
1456
1457 if (! filename.endsWith (".m"))
1458 filename.append (".m");
1459
1460 // default encoding
1461 emit open_file_signal (filename, QString (), line);
1462 });
1463 }
1464
1466 {
1467 QMessageBox *msgBox = new QMessageBox (QMessageBox::Critical,
1468 tr ("Octave Editor"),
1469 message, QMessageBox::Ok, this);
1470 msgBox->setWindowModality (Qt::NonModal);
1471 msgBox->setAttribute (Qt::WA_DeleteOnClose);
1472 msgBox->show ();
1473 }
1474
1476 int line)
1477 {
1478 bool cmd_focus = command_window_has_focus ();
1479
1480 emit insert_debugger_pointer_signal (file, line);
1481
1482 if (cmd_focus)
1484 }
1485
1487 int line)
1488 {
1489 bool cmd_focus = command_window_has_focus ();
1490
1491 emit delete_debugger_pointer_signal (file, line);
1492
1493 if (cmd_focus)
1495 }
1496
1498 const QString& file,
1499 int line,
1500 const QString& cond)
1501 {
1502 bool cmd_focus = command_window_has_focus ();
1503
1504 emit update_breakpoint_marker_signal (insert, file, line, cond);
1505
1506 if (cmd_focus)
1508 }
1509
1511 {
1514
1515 if (! settings)
1516 {
1517 qDebug ("Error: gui_settings pointer from resource manager is NULL.");
1518 return;
1519 }
1520
1522
1523 // restore the list of the last directories
1524 QStringList curr_dirs = settings->value (mw_dir_list).toStringList ();
1525 for (int i=0; i < curr_dirs.size (); i++)
1526 {
1527 m_current_directory_combo_box->addItem (curr_dirs.at (i));
1528 }
1530 }
1531
1533 {
1535 }
1536
1538 {
1539 // For resetting from some inconsistent state, first reset layout
1540 // without saving or showing it
1541 do_reset_windows (true, false);
1542
1543 // Restore main window state and geometry from settings file or, in case
1544 // of an error (no pref values yet), from the default layout.
1545 if (! restoreGeometry (settings->value (mw_geometry).toByteArray ()))
1546 {
1547 do_reset_windows (true);
1548 return;
1549 }
1550
1551 if (isMaximized())
1552 {
1553 // If the window state is restored to maximized layout, the
1554 // horizontal layout is not preserved. This cann be avoided by
1555 // setting the geometry to the max. available geometry. However, on
1556 // X11, the available geometry (excluding task bar etc.) is equal to
1557 // the total geometry leading to a full screen mode without window
1558 // decorations. This in turn can be avoided by reducing the max.
1559 // size by a few pixels.
1560
1561 // Get available geometry for current screen.
1562 QScreen *s = windowHandle ()->screen ();
1563 QRect av_geom = s->availableGeometry ();
1564
1565 QList<QScreen *> screen_list = QGuiApplication::screens ();
1566 if (screen_list.length () > 1)
1567 {
1568 // If we have more than one monitor and available and total
1569 // geometry are the same, reduce this too large geometry
1570 QRect new_geom (av_geom.x () + 1, av_geom.y () + 1,
1571 av_geom.width ()-2, av_geom.height ()-2);
1572 setGeometry (new_geom);
1573 }
1574 else
1575 setGeometry (av_geom); // Set (correct) available geometry
1576 }
1577
1578 if (! restoreState (settings->value (mw_state).toByteArray ()))
1579 {
1580 do_reset_windows (true);
1581 return;
1582 }
1583
1584 // Restore the geometry of all dock-widgets
1585
1586 for (auto *widget : dock_widget_list ())
1587 {
1588 // Leave any widgets that existed before main_window was created
1589 // as they were.
1590
1591 if (widget->adopted ())
1592 continue;
1593
1594 QString name = widget->objectName ();
1595
1596 if (! name.isEmpty ())
1597 {
1598 bool floating = false;
1599 bool visible = true;
1600
1601 floating = settings->value
1602 (dw_is_floating.key.arg (name), dw_is_floating.def).toBool ();
1603 visible = settings->value
1604 (dw_is_visible.key.arg (name), dw_is_visible.def).toBool ();
1605
1606 // If floating, make window from widget.
1607 if (floating)
1608 {
1609 widget->make_window ();
1610
1611 if (visible)
1612 {
1613 if (settings->value (dw_is_minimized.key.arg (name),
1614 dw_is_minimized.def).toBool ())
1615 widget->showMinimized ();
1616 else
1617 widget->setVisible (true);
1618 }
1619 else
1620 widget->setVisible (false);
1621 }
1622 else // not floating
1623 {
1624 if (! widget->parent ()) // should not be floating but is
1625 widget->make_widget (false); // no docking, just reparent
1626
1627 widget->make_widget ();
1628 widget->setVisible (visible); // not floating -> show
1629 }
1630 }
1631 }
1632
1633 show ();
1634 }
1635
1637 {
1640 if (! settings)
1641 {
1642 qDebug ("Error: gui_settings pointer from resource manager is NULL.");
1643 return;
1644 }
1645
1646 settings->setValue (mw_geometry.key, saveGeometry ());
1647 settings->setValue (mw_state.key, saveState ());
1648 // write the list of recently used directories
1649 QStringList curr_dirs;
1650 for (int i=0; i<m_current_directory_combo_box->count (); i++)
1651 {
1652 curr_dirs.append (m_current_directory_combo_box->itemText (i));
1653 }
1654 settings->setValue (mw_dir_list.key, curr_dirs);
1655 settings->sync ();
1656 }
1657
1659 {
1660 if (m_current_directory_combo_box->hasFocus ())
1661 {
1662 QLineEdit *edit = m_current_directory_combo_box->lineEdit ();
1663 if (edit && edit->hasSelectedText ())
1664 {
1665 QClipboard *clipboard = QApplication::clipboard ();
1666 clipboard->setText (edit->selectedText ());
1667 }
1668 }
1669 else
1670 emit copyClipboard_signal ();
1671 }
1672
1674 {
1675 if (m_current_directory_combo_box->hasFocus ())
1676 {
1677 QLineEdit *edit = m_current_directory_combo_box->lineEdit ();
1678 QClipboard *clipboard = QApplication::clipboard ();
1679 QString str = clipboard->text ();
1680 if (edit && str.length () > 0)
1681 {
1682 edit->insert (str);
1683 }
1684 }
1685 else
1686 emit pasteClipboard_signal ();
1687 }
1688
1690 {
1691 if (m_current_directory_combo_box->hasFocus ())
1692 {
1693 QLineEdit *edit = m_current_directory_combo_box->lineEdit ();
1694 if (edit)
1695 {
1696 edit->selectAll ();
1697 }
1698 }
1699 else
1700 emit selectAll_signal ();
1701 }
1702
1703 void main_window::handle_gui_status_update (const QString& feature,
1704 const QString& status)
1705 {
1706 // Put actions that are required for updating a gui features here
1707
1708 // Profiler on/off
1709 if (! feature.compare ("profiler"))
1710 {
1711 if (! status.compare ("on", Qt::CaseInsensitive))
1713 else if (! status.compare ("off", Qt::CaseInsensitive))
1715 }
1716 }
1717
1719 {
1720 // actions after the startup files are executed
1723
1724 QDir startup_dir = QDir (); // current octave dir after startup
1725
1726 if (settings)
1727 {
1728 if (settings->value (global_restore_ov_dir).toBool ())
1729 {
1730 // restore last dir from previous session
1731 QStringList curr_dirs
1732 = settings->value (mw_dir_list).toStringList ();
1733 if (curr_dirs.length () > 0)
1734 startup_dir = QDir (curr_dirs.at (0)); // last dir prev. session
1735 }
1736 else if (! settings->value (global_ov_startup_dir).toString ().isEmpty ())
1737 {
1738 // do not restore but there is a startup dir configured
1739 startup_dir
1740 = QDir (settings->value (global_ov_startup_dir).toString ());
1741 }
1742
1743 update_default_encoding (settings->value (ed_default_enc).toString ());
1744 }
1745
1746 if (! startup_dir.exists ())
1747 {
1748 // the configured startup dir does not exist, take actual one
1749 startup_dir = QDir ();
1750 }
1751
1752 set_current_working_directory (startup_dir.absolutePath ());
1753
1754 if (m_editor_window)
1755 {
1756#if defined (HAVE_QSCINTILLA)
1757 // Octave ready, determine whether to create an empty script.
1758 // This can not be done when the editor is created because all functions
1759 // must be known for the lexer's auto completion information
1760 m_editor_window->empty_script (true, false);
1761 m_editor_window->restore_session (settings);
1762#endif
1763 }
1764
1766 {
1767 // Set initial prompt.
1768
1770 ([] (interpreter& interp)
1771 {
1772 // INTERPRETER_THREAD
1773
1774 event_manager& evmgr = interp.get_event_manager ();
1775 input_system& input_sys = interp.get_input_system ();
1776
1777 input_sys.PS1 (">> ");
1778 std::string prompt = input_sys.PS1 ();
1779
1781 });
1782 }
1783
1784 focus_command_window (); // make sure that the command window has focus
1785 }
1786
1788 {
1789 if (m_set_path_dlg) // m_set_path_dlg is a guarded pointer!
1790 return;
1791
1793
1794 m_set_path_dlg->setModal (false);
1795 m_set_path_dlg->setAttribute (Qt::WA_DeleteOnClose);
1796 m_set_path_dlg->show ();
1797
1798 // Any interpreter_event signal from a set_path_dialog object is
1799 // handled the same as for the main_window object.
1800
1803
1806
1809
1811
1812 qt_interpreter_events *qt_link = interp_qobj->qt_link ();
1813
1816
1817 // Now that all the signal connections are in place for the dialog
1818 // we can set the initial value of the path in the model.
1819
1820 m_set_path_dlg->update_model ();
1821 }
1822
1823 void main_window::find_files (const QString& start_dir)
1824 {
1825
1826 if (! m_find_files_dlg)
1827 {
1829
1830 connect (m_find_files_dlg, &find_files_dialog::finished,
1832
1835
1838
1839 m_find_files_dlg->setWindowModality (Qt::NonModal);
1840 }
1841
1842 if (! m_find_files_dlg->isVisible ())
1843 {
1844 m_find_files_dlg->show ();
1845 }
1846
1847 m_find_files_dlg->set_search_dir (start_dir);
1848
1849 m_find_files_dlg->activateWindow ();
1850
1851 }
1852
1853 void main_window::set_screen_size (int ht, int wd)
1854 {
1856 ([=] (void)
1857 {
1858 // INTERPRETER THREAD
1859
1861 });
1862 }
1863
1865 {
1866 if (m_clipboard->text ().isEmpty ())
1867 {
1868 m_paste_action->setEnabled (false);
1869 m_clear_clipboard_action->setEnabled (false);
1870 }
1871 else
1872 {
1873 m_paste_action->setEnabled (true);
1874 m_clear_clipboard_action->setEnabled (true);
1875 }
1876 }
1877
1879 {
1880 m_clipboard->clear (QClipboard::Clipboard);
1881 }
1882
1884 {
1885 QHash<QMenu *, QStringList>::const_iterator i = m_hash_menu_text.constBegin ();
1886
1887 while (i != m_hash_menu_text.constEnd ())
1888 {
1889 i.key ()->setTitle (i.value ().at (disable));
1890 ++i;
1891 }
1892 }
1893
1895 {
1896 // restore the new files creation setting
1899 settings->setValue (ed_create_new_file.key, false);
1900 disconnect (m_editor_window, SIGNAL (file_loaded_signal (void)),
1901 this, SLOT (restore_create_file_setting (void)));
1902 }
1903
1904 void main_window::set_file_encoding (const QString& new_encoding)
1905 {
1906 m_file_encoding = new_encoding;
1907 }
1908
1909 // The following slot is called after files have been selected in the
1910 // open file dialog, possibly with a new selected encoding stored in
1911 // m_file_encoding
1912 void main_window::request_open_files (const QStringList& open_file_names)
1913 {
1914 for (int i = 0; i < open_file_names.count (); i++)
1915 emit open_file_signal (open_file_names.at (i), m_file_encoding, -1);
1916 }
1917
1919 {
1921 ([=] (interpreter& interp)
1922 {
1923 // INTERPRETER THREAD
1924
1925 Ffeval (interp, ovl ("profile","on"));
1926 });
1927 }
1928
1930 {
1932 ([=] (interpreter& interp)
1933 {
1934 // INTERPRETER THREAD
1935
1936 Ffeval (interp, ovl ("profile","resume"));
1937 });
1938 }
1939
1941 {
1943 ([=] (interpreter& interp)
1944 {
1945 // INTERPRETER THREAD
1946
1947 Ffeval (interp, ovl ("profile","off"));
1948 });
1949 }
1950
1952 {
1953 m_profiler_start->setEnabled (! active);
1954 m_profiler_resume->setEnabled (! active);
1955 m_profiler_stop->setEnabled (active);
1956
1958 if (active)
1961 }
1962
1964 {
1965 // Do not use a separate interpreter event as in the other
1966 // profiler slots since the output of the command "profshow"
1967 // would obscure the prompt and we do not need to emimt a signal
1968 // for action that is required in the gui after rhe command
1969 execute_command_in_terminal ("profshow");
1970 }
1971
1972 void main_window::closeEvent (QCloseEvent *e)
1973 {
1974 write_settings ();
1975
1976 if (confirm_shutdown ())
1977 {
1978 // FIXME: Instead of ignoring the event and posting an
1979 // interpreter event, should we just accept the event and
1980 // shutdown and clean up the interpreter as part of closing the
1981 // GUI? Going that route might make it easier to close the GUI
1982 // without having to stop the interpreter, for example, if the
1983 // GUI is started from the interpreter command line.
1984
1985 e->ignore ();
1986
1988 && ! m_octave_qobj.is_gui_app ())
1989 emit close_gui_signal ();
1990 else
1991 {
1993 ([] (interpreter& interp)
1994 {
1995 // INTERPRETER THREAD
1996
1997 interp.quit (0, false, false);
1998 });
1999 }
2000 }
2001 else
2002 e->ignore ();
2003 }
2004
2006 {
2007 // Create and set the central widget. QMainWindow takes ownership of
2008 // the widget (pointer) so there is no need to delete the object upon
2009 // destroying this main_window.
2010
2011 QWidget *dummyWidget = new QWidget ();
2012 dummyWidget->setObjectName ("CentralDummyWidget");
2013 dummyWidget->resize (10, 10);
2014 dummyWidget->setSizePolicy (QSizePolicy::Fixed, QSizePolicy::Fixed);
2015 dummyWidget->hide ();
2016 setCentralWidget (dummyWidget);
2017 }
2018
2019// Main subroutine of the constructor
2020
2022 {
2023 setWindowIcon (QIcon (":/actions/icons/logo.png"));
2024
2026
2027 qt_interpreter_events *qt_link = interp_qobj->qt_link ();
2028
2030
2032
2033 // FIXME: Is this action intended to be about quitting application
2034 // or closing the main window?
2035 connect (qApp, &QApplication::aboutToQuit,
2037
2038 connect (qApp, &QApplication::focusChanged,
2040
2041 connect (this, &main_window::settings_changed,
2042 this, [=] (const gui_settings *settings) { notice_settings (settings); });
2043
2044 // Connections for signals from the interpreter thread where the slot
2045 // should be executed by the gui thread
2046
2049
2050 setWindowTitle ("Octave");
2051
2052 setStatusBar (m_status_bar);
2053
2054 // Signals for removing/renaming files/dirs in the temrinal window
2057
2060
2063
2065 }
2066
2068 {
2070
2071 qt_interpreter_events *qt_link = interp_qobj->qt_link ();
2072
2073 connect (qt_link, &qt_interpreter_events::settings_changed,
2075
2078
2081
2084
2087
2090
2092 this, [=] () { process_settings_dialog_request (); });
2093
2096
2099
2102
2105
2108 }
2109
2110 QAction* main_window::add_action (QMenu *menu, const QIcon& icon,
2111 const QString& text, const char *member,
2112 const QWidget *receiver)
2113 {
2114 QAction *a;
2115
2116 if (receiver)
2117 a = menu->addAction (icon, text, receiver, member);
2118 else
2119 a = menu->addAction (icon, text, this, member);
2120
2121 addAction (a); // important for shortcut context
2122 a->setShortcutContext (Qt::ApplicationShortcut);
2123 return a;
2124 }
2125
2127 {
2128 QMenu *menu = p->addMenu (name);
2129
2130 QString base_name = name; // get a copy
2131 // replace intended '&' ("&&") by a temp. string
2132 base_name.replace ("&&", "___octave_amp_replacement___");
2133 // remove single '&' (shortcut)
2134 base_name.remove ("&");
2135 // restore intended '&'
2136 base_name.replace ("___octave_amp_replacement___", "&&");
2137
2138 // remember names with and without shortcut
2139 m_hash_menu_text[menu] = QStringList () << name << base_name;
2140
2141 return menu;
2142 }
2143
2145 {
2146 QMenuBar *menu_bar = menuBar ();
2147
2148 construct_file_menu (menu_bar);
2149
2150 construct_edit_menu (menu_bar);
2151
2152 construct_debug_menu (menu_bar);
2153
2154 construct_tools_menu (menu_bar);
2155
2156 construct_window_menu (menu_bar);
2157
2158 construct_help_menu (menu_bar);
2159
2160 construct_news_menu (menu_bar);
2161
2162#if defined (HAVE_QSCINTILLA)
2163 // call the editor to add actions which should also be available in the
2164 // editor's menu and tool bar
2165 QList<QAction *> shared_actions;
2166 shared_actions << m_new_script_action
2168 << m_open_action
2170 << m_undo_action
2171 << m_copy_action
2174 m_editor_window->insert_global_actions (shared_actions);
2175#endif
2176 }
2177
2179 {
2180 QMenu *file_menu = m_add_menu (p, tr ("&File"));
2181
2182 construct_new_menu (file_menu);
2183
2185
2187 file_menu, rmgr.icon ("document-open"), tr ("Open..."),
2188 SLOT (request_open_file (void)), this);
2189 m_open_action->setToolTip (tr ("Open an existing file in editor"));
2190
2191#if defined (HAVE_QSCINTILLA)
2192 file_menu->addMenu (m_editor_window->get_mru_menu ());
2193#endif
2194
2195 file_menu->addSeparator ();
2196
2198 file_menu, QIcon (), tr ("Load Workspace..."),
2199 SLOT (handle_load_workspace_request (void)), this);
2200
2202 file_menu, QIcon (), tr ("Save Workspace As..."),
2203 SLOT (handle_save_workspace_request (void)), this);
2204
2205 file_menu->addSeparator ();
2206
2208 file_menu, QIcon (), tr ("Exit"),
2209 SLOT (close (void)), this);
2210 m_exit_action->setMenuRole (QAction::QuitRole);
2211
2212 // Connect signal related to opening or creating editor files
2213 connect (this, SIGNAL (new_file_signal (const QString&)),
2214 m_active_editor, SLOT (request_new_file (const QString&)));
2215
2216 connect (this, SIGNAL (open_file_signal (const QString&)),
2217 m_active_editor, SLOT (request_open_file (const QString&)));
2218
2219 connect (this,
2220 SIGNAL (open_file_signal (const QString&, const QString&, int)),
2222 SLOT (request_open_file (const QString&, const QString&, int)));
2223 }
2224
2226 {
2227 QMenu *new_menu = p->addMenu (tr ("New"));
2228
2230
2232 new_menu, rmgr.icon ("document-new"), tr ("New Script"),
2233 SLOT (request_new_script (void)), this);
2234
2236 new_menu, QIcon (), tr ("New Function..."),
2237 SLOT (request_new_function (void)), this);
2238
2240 new_menu, QIcon (), tr ("New Figure"),
2241 SLOT (handle_new_figure_request (void)), this);
2242 }
2243
2245 {
2246 QMenu *edit_menu = m_add_menu (p, tr ("&Edit"));
2247
2248 QKeySequence ctrl_shift = Qt::ControlModifier + Qt::ShiftModifier;
2249
2252 = edit_menu->addAction (rmgr.icon ("edit-undo"), tr ("Undo"));
2253 m_undo_action->setShortcutContext (Qt::ApplicationShortcut);
2254
2255 edit_menu->addSeparator ();
2256
2258 = edit_menu->addAction (rmgr.icon ("edit-copy"), tr ("Copy"), this,
2260 m_copy_action->setShortcutContext (Qt::ApplicationShortcut);
2261
2263 = edit_menu->addAction (rmgr.icon ("edit-paste"), tr ("Paste"), this,
2265 m_paste_action->setShortcutContext (Qt::ApplicationShortcut);
2266
2268 = edit_menu->addAction (tr ("Select All"), this,
2270 m_select_all_action->setShortcutContext (Qt::ApplicationShortcut);
2271
2273 = edit_menu->addAction (tr ("Clear Clipboard"), this,
2275
2276 edit_menu->addSeparator ();
2277
2279 = edit_menu->addAction (rmgr.icon ("edit-find"), tr ("Find Files..."));
2280
2281 edit_menu->addSeparator ();
2282
2284 = edit_menu->addAction (tr ("Clear Command Window"));
2285
2287 = edit_menu->addAction (tr ("Clear Command History"));
2288
2290 = edit_menu->addAction (tr ("Clear Workspace"));
2291
2292 edit_menu->addSeparator ();
2293
2295 = edit_menu->addAction (tr ("Set Path"));
2296
2298 = edit_menu->addAction (rmgr.icon ("preferences-system"),
2299 tr ("Preferences..."));
2300
2301 connect (m_find_files_action, &QAction::triggered,
2302 this, [=] () { find_files (); });
2303
2304 connect (m_clear_command_window_action, &QAction::triggered,
2306
2307 connect (m_clear_command_history_action, &QAction::triggered,
2309
2310 connect (m_clear_workspace_action, &QAction::triggered,
2312
2313 connect (m_clipboard, &QClipboard::dataChanged,
2316#if defined (Q_OS_WIN32)
2317 // Always enable paste action (unreliable clipboard signals in windows)
2318 // FIXME: This has to be removed, when the clipboard signals in windows
2319 // are working again
2320 m_paste_action->setEnabled (true);
2321 m_clear_clipboard_action->setEnabled (true);
2322#endif
2323
2324 connect (m_preferences_action, &QAction::triggered,
2325 this, [=] () { process_settings_dialog_request (); });
2326
2327 connect (m_set_path_action, &QAction::triggered,
2329
2330 }
2331
2332 QAction * main_window::construct_debug_menu_item (const char *icon,
2333 const QString& item,
2334 const char *member)
2335 {
2337 QAction *action = add_action (m_debug_menu, rmgr.icon (QString (icon)),
2338 item, member);
2339
2340 action->setEnabled (false);
2341
2342#if defined (HAVE_QSCINTILLA)
2343 m_editor_window->debug_menu ()->addAction (action);
2344 m_editor_window->toolbar ()->addAction (action);
2345#endif
2346
2347 return action;
2348 }
2349
2351 {
2352 m_debug_menu = m_add_menu (p, tr ("De&bug"));
2353
2355 = construct_debug_menu_item ("db-step", tr ("Step"),
2356 SLOT (debug_step_over (void)));
2357
2359 = construct_debug_menu_item ("db-step-in", tr ("Step In"),
2360 SLOT (debug_step_into (void)));
2361
2363 = construct_debug_menu_item ("db-step-out", tr ("Step Out"),
2364 SLOT (debug_step_out (void)));
2365
2367 = construct_debug_menu_item ("db-cont", tr ("Continue"),
2368 SLOT (debug_continue (void)));
2369
2370 m_debug_menu->addSeparator ();
2371#if defined (HAVE_QSCINTILLA)
2372 m_editor_window->debug_menu ()->addSeparator ();
2373#endif
2374
2376 = construct_debug_menu_item ("db-stop", tr ("Quit Debug Mode"),
2377 SLOT (debug_quit (void)));
2378 }
2379
2381 {
2382 QMenu *tools_menu = m_add_menu (p, tr ("&Tools"));
2383
2384 m_profiler_start = add_action (tools_menu, QIcon (),
2385 tr ("Start &Profiler Session"), SLOT (profiler_session ()));
2386
2387 m_profiler_resume = add_action (tools_menu, QIcon (),
2388 tr ("&Resume Profiler Session"), SLOT (profiler_session_resume ()));
2389
2390 m_profiler_stop = add_action (tools_menu, QIcon (),
2391 tr ("&Stop Profiler"), SLOT (profiler_stop ()));
2392 m_profiler_stop->setEnabled (false);
2393
2394 m_profiler_show = add_action (tools_menu, QIcon (),
2395 tr ("&Show Profile Data"), SLOT (profiler_show ()));
2396 }
2397
2398 void main_window::editor_tabs_changed (bool have_tabs, bool is_octave)
2399 {
2400 // Set state of actions which depend on the existence of editor tabs
2401 m_editor_has_tabs = have_tabs;
2402 m_editor_is_octave_file = is_octave;
2403 m_debug_step_over->setEnabled (have_tabs && is_octave);
2404 }
2405
2407 const QString& item,
2408 bool checkable,
2409 QWidget *widget)
2410 {
2411 QAction *action = p->addAction (QIcon (), item);
2412
2413 addAction (action); // important for shortcut context
2414 action->setCheckable (checkable);
2415 action->setShortcutContext (Qt::ApplicationShortcut);
2416
2417 if (widget) // might be zero for m_editor_window
2418 {
2419 if (checkable)
2420 {
2421 // action for visibility of dock widget
2422 connect (action, SIGNAL (toggled (bool)),
2423 widget, SLOT (setVisible (bool)));
2424
2425 connect (widget, SIGNAL (active_changed (bool)),
2426 action, SLOT (setChecked (bool)));
2427 }
2428 else
2429 {
2430 // action for focus of dock widget
2431 connect (action, SIGNAL (triggered (void)),
2432 widget, SLOT (activate (void)));
2433 }
2434 }
2435 else
2436 {
2437 action->setEnabled (false);
2438 }
2439
2440 return action;
2441 }
2442
2444 {
2445 QMenu *window_menu = m_add_menu (p, tr ("&Window"));
2446
2448 (window_menu, tr ("Show Command Window"), true, m_command_window);
2449
2451 (window_menu, tr ("Show Command History"), true, m_history_window);
2452
2454 (window_menu, tr ("Show File Browser"), true, m_file_browser_window);
2455
2457 (window_menu, tr ("Show Workspace"), true, m_workspace_window);
2458
2460 (window_menu, tr ("Show Editor"), true, m_editor_window);
2461
2463 (window_menu, tr ("Show Documentation"), true, m_doc_browser_window);
2464
2466 (window_menu, tr ("Show Variable Editor"), true, m_variable_editor_window);
2467
2468 window_menu->addSeparator ();
2469
2471 (window_menu, tr ("Command Window"), false, m_command_window);
2472
2474 (window_menu, tr ("Command History"), false, m_history_window);
2475
2477 (window_menu, tr ("File Browser"), false, m_file_browser_window);
2478
2480 (window_menu, tr ("Workspace"), false, m_workspace_window);
2481
2483 (window_menu, tr ("Editor"), false, m_editor_window);
2484
2486 (window_menu, tr ("Documentation"), false, m_doc_browser_window);
2487
2489 (window_menu, tr ("Variable Editor"), false, m_variable_editor_window);
2490
2491 window_menu->addSeparator ();
2492
2493 m_previous_dock_action = add_action (window_menu, QIcon (),
2494 tr ("Previous Widget"), SLOT (go_to_previous_widget (void)));
2495
2496 window_menu->addSeparator ();
2497
2498 m_reset_windows_action = add_action (window_menu, QIcon (),
2499 tr ("Reset Default Window Layout"), SLOT (reset_windows (void)));
2500 }
2501
2503 {
2504 QMenu *help_menu = m_add_menu (p, tr ("&Help"));
2505
2506 construct_documentation_menu (help_menu);
2507
2508 help_menu->addSeparator ();
2509
2510 m_report_bug_action = add_action (help_menu, QIcon (),
2511 tr ("Report Bug"), SLOT (open_bug_tracker_page ()));
2512
2513 m_octave_packages_action = add_action (help_menu, QIcon (),
2514 tr ("Octave Packages"), SLOT (open_octave_packages_page ()));
2515
2516 m_contribute_action = add_action (help_menu, QIcon (),
2517 tr ("Contribute"), SLOT (open_contribute_page ()));
2518
2519 m_developer_action = add_action (help_menu, QIcon (),
2520 tr ("Donate to Octave"), SLOT (open_donate_page ()));
2521
2522 help_menu->addSeparator ();
2523
2524 m_about_octave_action = add_action (help_menu, QIcon (),
2525 tr ("About Octave"), SLOT (show_about_octave ()));
2526 }
2527
2529 {
2530 QMenu *doc_menu = p->addMenu (tr ("Documentation"));
2531
2532 m_ondisk_doc_action = add_action (doc_menu, QIcon (),
2533 tr ("On Disk"), SLOT (activate ()), m_doc_browser_window);
2534
2535 m_online_doc_action = add_action (doc_menu, QIcon (),
2536 tr ("Online"), SLOT (open_online_documentation_page ()));
2537 }
2538
2540 {
2541 QMenu *news_menu = m_add_menu (p, tr ("&News"));
2542
2544 = news_menu->addAction (QIcon (), tr ("Release Notes"),
2545 [=] () {
2547 });
2548 addAction (m_release_notes_action);
2549 m_release_notes_action->setShortcutContext (Qt::ApplicationShortcut);
2550
2552 = news_menu->addAction (QIcon (), tr ("Community News"),
2553 [=] () {
2555 });
2556 addAction (m_current_news_action);
2557 m_current_news_action->setShortcutContext (Qt::ApplicationShortcut);
2558 }
2559
2561 {
2562 m_main_tool_bar = addToolBar (tr ("Toolbar"));
2563 m_main_tool_bar->setStyleSheet (m_main_tool_bar->styleSheet ()
2565
2566 m_main_tool_bar->setObjectName ("MainToolBar");
2568 m_main_tool_bar->addAction (m_open_action);
2569
2570 m_main_tool_bar->addSeparator ();
2571
2572 m_main_tool_bar->addAction (m_copy_action);
2573 m_main_tool_bar->addAction (m_paste_action);
2574 m_main_tool_bar->addAction (m_undo_action);
2575
2576 m_main_tool_bar->addSeparator ();
2577
2578 m_current_directory_combo_box = new QComboBox (this);
2579 QFontMetrics fm = m_current_directory_combo_box->fontMetrics ();
2580 m_current_directory_combo_box->setFixedWidth (48*fm.averageCharWidth ());
2581 m_current_directory_combo_box->setEditable (true);
2582 m_current_directory_combo_box->setInsertPolicy (QComboBox::NoInsert);
2583 m_current_directory_combo_box->setToolTip (tr ("Enter directory name"));
2586 QSizePolicy sizePol (QSizePolicy::Preferred, QSizePolicy::Preferred);
2587 m_current_directory_combo_box->setSizePolicy (sizePol);
2588
2589 // addWidget takes ownership of the objects so there is no
2590 // need to delete these upon destroying this main_window.
2591 m_main_tool_bar->addWidget (new QLabel (tr ("Current Directory: ")));
2594 QAction *current_dir_up
2595 = m_main_tool_bar->addAction (rmgr.icon ("go-up"),
2596 tr ("One directory up"));
2597 QAction *current_dir_search
2598 = m_main_tool_bar->addAction (rmgr.icon ("folder"),
2599 tr ("Browse directories"));
2600
2601 connect (m_current_directory_combo_box, SIGNAL (activated (const QString&)),
2602 this, SLOT (set_current_working_directory (const QString&)));
2603
2604 connect (m_current_directory_combo_box->lineEdit (),
2605 &QLineEdit::returnPressed,
2607
2608 connect (current_dir_search, &QAction::triggered,
2610
2611 connect (current_dir_up, &QAction::triggered,
2613
2614 connect (m_undo_action, &QAction::triggered,
2616 }
2617
2619 {
2622 if (settings->value (cs_focus_cmd).toBool ())
2624 }
2625
2627 {
2628 bool enable
2630
2632
2633 // file menu
2641
2642 // edit menu
2654
2655 // debug menu
2661
2662 // tools menu
2665 scmgr.set_shortcut (m_profiler_stop, sc_main_tools_start_profiler, enable); // same, toggling
2667
2668 // window menu
2678 // Switching to the other widgets (including the previous one) is always enabled
2686
2687 // help menu
2695
2696 // news menu
2699 }
2700
2702 {
2704 list.append (static_cast<octave_dock_widget *> (m_command_window));
2705 list.append (static_cast<octave_dock_widget *> (m_history_window));
2706 list.append (static_cast<octave_dock_widget *> (m_file_browser_window));
2707 list.append (static_cast<octave_dock_widget *> (m_doc_browser_window));
2708#if defined (HAVE_QSCINTILLA)
2709 list.append (static_cast<octave_dock_widget *> (m_editor_window));
2710#endif
2711 list.append (static_cast<octave_dock_widget *> (m_workspace_window));
2712 list.append (static_cast<octave_dock_widget *> (m_variable_editor_window));
2713 return list;
2714 }
2715
2716 void main_window::update_default_encoding (const QString& default_encoding)
2717 {
2718 m_default_encoding = default_encoding;
2719 std::string mfile_encoding = m_default_encoding.toStdString ();
2720 if (m_default_encoding.startsWith ("SYSTEM", Qt::CaseInsensitive))
2721 mfile_encoding = "SYSTEM";
2722
2724 ([=] (interpreter& interp)
2725 {
2726 // INTERPRETER THREAD
2727
2728 F__mfile_encoding__ (interp, ovl (mfile_encoding));
2729 });
2730 }
2731
2732 // Get size of screen where the main window is located
2733 void main_window::get_screen_geometry (int& width, int& height)
2734 {
2735 QRect screen_geometry = QApplication::desktop ()->availableGeometry (this);
2736
2737 width = screen_geometry.width ();
2738 height = screen_geometry.height ();
2739 }
2740
2741 void main_window::resize_dock (QDockWidget *dw, int width, int height)
2742 {
2743#if defined (HAVE_QMAINWINDOW_RESIZEDOCKS)
2744 // resizeDockWidget was added to Qt in Qt 5.6
2745 if (width >= 0)
2746 resizeDocks ({dw}, {width}, Qt::Horizontal);
2747 if (height >= 0)
2748 resizeDocks ({dw}, {height}, Qt::Vertical);
2749#else
2750 // This replacement of resizeDockWidget is not very reliable.
2751 // But even if Qt4 is not yet
2752 QSize s = dw->widget ()->size ();
2753 if (width >= 0)
2754 s.setWidth (width);
2755 if (height >= 0)
2756 s.setHeight (height);
2757 dw->widget ()->resize (s);
2758 dw->adjustSize ();
2759#endif
2760 }
2761
2762 // The default main window size relative to the desktop size
2764 {
2765 int win_x, win_y;
2766 get_screen_geometry (win_x, win_y);
2767
2768 move (0, 0);
2769 resize (2*win_x/3, 7*win_y/8);
2770 }
2771
2773 {
2774 // Slot for resetting the window layout to the default one
2775 hide ();
2776 showNormal (); // Unmaximize
2777 do_reset_windows (true, true, true); // Add all widgets
2778
2779 // Re-add after giving time: This seems to be a reliable way to
2780 // reset the main window's layout
2781
2782 // JWE says: The following also works for me with 0 delay, so I
2783 // think the problem might just be that the event loop needs to run
2784 // somewhere in the sequence of resizing and adding widgets. Maybe
2785 // some actions in do_reset_windows should be using signal/slot
2786 // connections so that the event loop can do what it needs to do.
2787 // But I haven't been able to find the magic sequence.
2788
2789 QTimer::singleShot (250, this, [=] () { do_reset_windows (true, true, true); });
2790 }
2791
2792 // Create the default layout of the main window. Do not use
2793 // restoreState () and restoreGeometry () with default values since
2794 // this might lead to problems when the Qt version changes
2795 void main_window::do_reset_windows (bool show, bool save, bool force_all)
2796 {
2797 // Set main window default geometry and store its width for
2798 // later resizing the command window
2800 int win_x = geometry ().width ();
2801
2802 // Resize command window (if docked),
2803 //the important one in the default layout
2804 if (dockWidgetArea (m_command_window) != Qt::NoDockWidgetArea)
2805 resize_dock (m_command_window, 7*win_x/8, -1);
2806
2807 // See Octave bug #53409 and https://bugreports.qt.io/browse/QTBUG-55357
2808#if (QT_VERSION < 0x050601) || (QT_VERSION >= 0x050701)
2809 setDockOptions (QMainWindow::AnimatedDocks
2810 | QMainWindow::AllowNestedDocks
2811 | QMainWindow::AllowTabbedDocks);
2812#else
2813 setDockNestingEnabled (true);
2814#endif
2815
2816 // Add the dock widgets and show them
2817 if (! m_file_browser_window->adopted () || force_all)
2818 {
2819 // FIXME: Maybe there should be a main_window::add_dock_widget
2820 // function that combines both of these actions?
2821
2822 addDockWidget (Qt::LeftDockWidgetArea, m_file_browser_window);
2823 m_file_browser_window->set_adopted (false);
2824 }
2825
2826 if (! m_workspace_window->adopted () || force_all)
2827 {
2828 addDockWidget (Qt::LeftDockWidgetArea, m_workspace_window);
2829 m_workspace_window->set_adopted (false);
2830 }
2831
2832 if (! m_history_window->adopted () || force_all)
2833 {
2834 addDockWidget (Qt::LeftDockWidgetArea, m_history_window);
2835 m_history_window->set_adopted (false);
2836 }
2837
2838 if (! m_command_window->adopted () || force_all)
2839 {
2840 addDockWidget (Qt::RightDockWidgetArea, m_command_window);
2841 m_command_window->set_adopted (false);
2842 }
2843
2844 if (! m_doc_browser_window->adopted () || force_all)
2845 {
2846 addDockWidget (Qt::RightDockWidgetArea, m_doc_browser_window);
2847 tabifyDockWidget (m_command_window, m_doc_browser_window);
2848 m_doc_browser_window->set_adopted (false);
2849 }
2850
2851 if (! m_variable_editor_window->adopted () || force_all)
2852 {
2853 addDockWidget (Qt::RightDockWidgetArea, m_variable_editor_window);
2854 tabifyDockWidget (m_command_window, m_variable_editor_window);
2855 m_variable_editor_window->set_adopted (false);
2856 }
2857
2858#if defined (HAVE_QSCINTILLA)
2859 addDockWidget (Qt::RightDockWidgetArea, m_editor_window);
2860 tabifyDockWidget (m_command_window, m_editor_window);
2861#endif
2862
2863 // Resize command window, the important one in the default layout
2864 resize_dock (m_command_window, 2*win_x/3, -1);
2865
2866 // Show main wibdow, save state and geometry of main window and
2867 // all dock widgets
2868 if (show)
2869 {
2870 // Show all dock widgets
2871 for (auto *widget : dock_widget_list ())
2872 widget->show ();
2873
2874 // Show main window and store size and state
2875 showNormal ();
2876
2877 if (save)
2878 {
2881
2882 settings->setValue (mw_geometry.key, saveGeometry ());
2883 settings->setValue (mw_state.key, saveState ());
2884 }
2885
2887 }
2888 }
2889}
void report_status_message(const QString &)
virtual void pasteClipboard(void)=0
void set_screen_size_signal(int, int)
virtual void init_terminal_size(void)
Definition: QTerminal.h:131
void edit_mfile_request(const QString &, int)
void request_edit_mfile_signal(const QString &, int)
void request_open_file_signal(const QString &, const QString &, int)
virtual void copyClipboard(void)=0
void clear_command_window_request(void)
void execute_command_in_terminal_signal(const QString &)
virtual void selectAll(void)=0
Provides threadsafe access to octave.
OCTINTERP_API void set_workspace(void)
void update_prompt(const std::string &prompt)
string_vector do_history(const octave_value_list &args=octave_value_list(), int nargout=0)
Definition: oct-hist.cc:319
octave_value PS1(const octave_value_list &args, int nargout)
void quit(int exit_status, bool force=false, bool confirm=true)
tree_evaluator & get_evaluator(void)
int chdir(const std::string &dir)
event_manager & get_event_manager(void)
Definition: interpreter.h:328
history_system & get_history_system(void)
Definition: interpreter.h:271
input_system & get_input_system(void)
Definition: interpreter.h:261
octave_value_list feval(const char *name, const octave_value_list &args=octave_value_list(), int nargout=0)
Evaluate an Octave function (built-in or interpreted) and return the list of result values.
Base class for Octave interfaces that use Qt.
shortcut_manager & get_shortcut_manager(void)
interpreter_qobject * interpreter_qobj(void)
QPointer< variable_editor > variable_editor_widget(main_window *mw=nullptr)
QPointer< workspace_view > workspace_widget(main_window *mw=nullptr)
QApplication * qapplication(void)
QPointer< files_dock_widget > file_browser_widget(main_window *mw=nullptr)
void connect_interpreter_events(T *widget)
bool experimental_terminal_widget(void) const
bool is_gui_app(void) const
QPointer< history_dock_widget > history_widget(main_window *mw=nullptr)
QPointer< documentation_dock_widget > documentation_widget(main_window *mw=nullptr)
QPointer< terminal_dock_widget > terminal_widget(main_window *mw=nullptr)
resource_manager & get_resource_manager(void)
void config_translators(void)
void interpreter_event(const fcn_callback &fcn)
static bool interrupt(bool=true)
Definition: cmd-edit.cc:1618
static void clear_screen(bool skip_redisplay=false)
Definition: cmd-edit.cc:1250
static void replace_line(const std::string &text, bool clear_undo=true)
Definition: cmd-edit.cc:1454
static bool undo(void)
Definition: cmd-edit.cc:1489
static std::string decode_prompt_string(const std::string &s)
Definition: cmd-edit.cc:1271
static void set_screen_size(int ht, int wd)
Definition: cmd-edit.cc:1264
static void set_initial_input(const std::string &text)
Definition: cmd-edit.cc:1106
static void kill_full_line(void)
Definition: cmd-edit.cc:1461
static std::string get_current_line(void)
Definition: cmd-edit.cc:1440
static void accept_line(void)
Definition: cmd-edit.cc:1482
static void interrupt_event_loop(bool flag=true)
Definition: cmd-edit.cc:1638
static void redisplay(void)
Definition: cmd-edit.cc:1231
bool call_custom_editor(const QString &file=QString(), int line=-1)
void request_settings_dialog(const QString &)
void focus_console_after_command_signal(void)
void handle_update_breakpoint_marker_request(bool insert, const QString &file, int line, const QString &cond)
void request_step_into_file()
Definition: file-editor.cc:688
void handle_file_remove(const QString &, const QString &)
void enable_menu_shortcuts(bool)
Definition: file-editor.cc:395
void edit_mfile_request(const QString &, const QString &, const QString &, int)
void request_open_file_external(const QString &file_name, int line)
void handle_exit_debug_mode(void)
Definition: file-editor.cc:197
void handle_delete_debugger_pointer_request(const QString &file, int line)
void handle_file_renamed(bool load_new=true)
void execute_command_in_terminal_signal(const QString &)
void handle_insert_debugger_pointer_request(const QString &file, int line)
void update_octave_directory(const QString &dir)
void editor_tabs_changed_signal(bool, bool)
void update_gui_lexer_signal(bool)
void request_dbcont_signal(void)
void request_settings_dialog(const QString &)
void run_file_signal(const QFileInfo &)
void debug_quit_signal(void)
void handle_enter_debug_mode(void)
Definition: file-editor.cc:182
void open_file(const QString &fileName)
Emitted, whenever the user requested to open a file.
void open_any_signal(const QString &fileName)
Emitted, whenever the user requested to open an unknown type file.
void modify_path_signal(const QStringList &dir_list, bool rm, bool subdirs)
Emitted, when the path has to be modified.
void run_file_signal(const QFileInfo &info)
Emitted, whenever the user requested to run a file.
void file_remove_signal(const QString &old_name, const QString &new_name)
Emitted, whenever the user removes or renames a file.
void find_files_signal(const QString &startdir)
Emitted, whenever wants to search for a file .
void load_file_signal(const QString &fileName)
Emitted, whenever the user requested to load a file in the text editor.
void set_current_directory(const QString &dir)
Sets the current directory being displayed.
void file_renamed_signal(bool)
Emitted, when a file or directory is renamed.
void displayed_directory_changed(const QString &dir)
Emitted, whenever the currently displayed directory changed.
void file_selected(const QString &fileName)
void set_search_dir(const QString &dir)
void dir_selected(const QString &fileName)
void command_double_clicked(const QString &command)
Signal emitted whenever the user double-clicks a command in the history.
void command_create_script(const QString &commands)
Signal emitted whenever the user selects commands and chooses "Create script" from the popup menu.
qt_interpreter_events * qt_link(void)
void set_state(led_state state)
QHash< QMenu *, QStringList > m_hash_menu_text
Definition: main-window.h:308
void debug_step_over(void)
QAction * m_reset_windows_action
Definition: main-window.h:388
bool command_window_has_focus(void) const
Definition: main-window.cc:477
void adopt_dock_widgets(void)
Definition: main-window.cc:218
void construct_edit_menu(QMenuBar *p)
void handle_update_breakpoint_marker_request(bool insert, const QString &file, int line, const QString &cond)
QAction * m_save_workspace_action
Definition: main-window.h:353
void construct_window_menu(QMenuBar *p)
void change_directory_up(void)
void make_dock_widget_connections(octave_dock_widget *dw)
Definition: main-window.cc:453
void warning_function_not_found(const QString &message)
QAction * m_new_function_action
Definition: main-window.h:349
void file_remove_proxy(const QString &o, const QString &n)
Definition: main-window.cc:823
QPointer< files_dock_widget > m_file_browser_window
Dock widgets.
Definition: main-window.h:323
octave_dock_widget * m_previous_dock
Definition: main-window.h:333
QAction * m_ondisk_doc_action
Definition: main-window.h:390
bool m_prevent_readline_conflicts
Some class global flags.
Definition: main-window.h:428
static const int current_directory_max_count
For Toolbars.
Definition: main-window.h:405
external_editor_interface * m_external_editor
Definition: main-window.h:330
QAction * m_release_notes_action
Definition: main-window.h:398
QAction * m_show_workspace_action
Definition: main-window.h:375
QAction * m_documentation_action
Definition: main-window.h:385
QAction * m_copy_action
Definition: main-window.h:358
void construct_help_menu(QMenuBar *p)
QAction * m_octave_packages_action
Definition: main-window.h:393
void handle_exit_debugger(void)
QAction * m_clear_clipboard_action
Definition: main-window.h:360
void report_status_message(const QString &statusMessage)
Definition: main-window.cc:650
QAction * m_show_variable_editor_action
Definition: main-window.h:379
void settings_changed(const gui_settings *)
QStatusBar * m_status_bar
Toolbar.
Definition: main-window.h:316
void notice_settings(const gui_settings *settings, bool update_by_worker=false)
Definition: main-window.cc:900
void undo_signal(void)
void do_reset_windows(bool show=true, bool save=true, bool force_all=false)
octave_dock_widget * m_active_dock
Definition: main-window.h:334
QAction * m_show_file_browser_action
Definition: main-window.h:376
void set_window_layout(gui_settings *settings)
QAction * m_about_octave_action
Definition: main-window.h:396
QPointer< set_path_dialog > m_set_path_dlg
Set path dialog.
Definition: main-window.h:418
void handle_clear_command_window_request(void)
Definition: main-window.cc:748
void handle_gui_status_update(const QString &feature, const QString &status)
QAction * m_previous_dock_action
Definition: main-window.h:387
QPointer< settings_dialog > m_settings_dlg
Settings dialog as guarded pointer (set to 0 when deleted).
Definition: main-window.h:411
QAction * m_editor_action
Definition: main-window.h:384
void handle_save_workspace_request(void)
Definition: main-window.cc:655
void handle_clear_workspace_request(void)
Definition: main-window.cc:737
void set_current_working_directory(const QString &dir)
void construct_tools_menu(QMenuBar *p)
QPointer< workspace_view > m_workspace_window
Dock widgets.
Definition: main-window.h:326
bool m_suppress_dbg_location
Some class global flags.
Definition: main-window.h:430
find_files_dialog * m_find_files_dlg
Find files dialog.
Definition: main-window.h:415
void construct_tool_bar(void)
void find_files_finished(int)
Find files dialog.
Definition: main-window.h:224
void adopt_editor_widget(void)
Definition: main-window.cc:342
void construct_documentation_menu(QMenu *p)
void handle_open_any_request(const QString &file=QString())
Definition: main-window.cc:713
QAction * m_profiler_show
Definition: main-window.h:371
QAction * m_history_action
Definition: main-window.h:381
void clear_clipboard()
Handling the clipboard.
void init_window_menu(void)
void focus_command_window(void)
Definition: main-window.cc:482
void show_release_notes_signal(void)
QAction * m_developer_action
Definition: main-window.h:395
void profiler_stop(void)
static const int current_directory_max_visible
For Toolbars.
Definition: main-window.h:404
QPointer< documentation_dock_widget > m_doc_browser_window
Dock widgets.
Definition: main-window.h:324
QAction * m_select_all_action
Definition: main-window.h:366
QAction * m_command_window_action
Definition: main-window.h:380
void construct_debug_menu(QMenuBar *p)
void init_terminal_size(void)
void editor_tabs_changed(bool, bool)
void handle_clear_history_request(void)
Definition: main-window.cc:760
void get_screen_geometry(int &width, int &height)
QAction * m_preferences_action
Definition: main-window.h:355
void run_file_in_terminal(const QFileInfo &info)
void handle_profiler_status_update(bool)
void accept_directory_line_edit(void)
void handle_set_path_dialog_request(void)
void focus_console_after_command(void)
QAction * m_find_files_action
Definition: main-window.h:365
QAction * m_debug_step_out
Definition: main-window.h:345
void focus_changed(QWidget *w_old, QWidget *w_new)
Definition: main-window.cc:528
void write_settings(void)
void construct_central_widget(void)
void request_open_file(void)
QClipboard * m_clipboard
Definition: main-window.h:424
void editor_focus_changed(bool)
QAction * m_undo_action
Definition: main-window.h:361
QToolBar * m_main_tool_bar
Definition: main-window.h:336
void interpreter_event(const fcn_callback &fcn)
void warning_function_not_found_signal(const QString &message)
void request_new_function(bool triggered=true)
QAction * m_show_documentation_action
Definition: main-window.h:378
QAction * m_open_action
Definition: main-window.h:350
QPointer< terminal_dock_widget > m_command_window
Dock widgets.
Definition: main-window.h:321
QPointer< variable_editor > m_variable_editor_window
Dock widgets.
Definition: main-window.h:327
void open_bug_tracker_page(void)
Definition: main-window.cc:851
void request_new_script(const QString &commands=QString())
QAction * m_clear_command_window_action
Definition: main-window.h:362
void profiler_session_resume(void)
void modify_path(const QStringList &dir_list, bool rm, bool subdirs)
Definition: main-window.cc:790
void new_file_signal(const QString &)
QMenuBar * m_editor_menubar
Definition: main-window.h:340
QAction * m_contribute_action
Definition: main-window.h:394
void set_default_geometry(void)
void disable_menu_shortcuts(bool disable)
void handle_edit_mfile_request(const QString &name, const QString &file, const QString &curr_dir, int line)
void profiler_show(void)
bool confirm_shutdown(void)
Definition: main-window.cc:499
QAction * m_paste_action
Definition: main-window.h:359
main_window(base_qobject &oct_qobj)
Definition: main-window.cc:95
QAction * m_show_history_action
Definition: main-window.h:374
QAction * m_show_command_window_action
Definition: main-window.h:373
void handle_insert_debugger_pointer_request(const QString &file, int line)
void adopt_file_browser_widget(void)
Definition: main-window.cc:291
QComboBox * m_current_directory_combo_box
For Toolbars.
Definition: main-window.h:403
QAction * m_online_doc_action
Definition: main-window.h:391
void active_dock_changed(octave_dock_widget *, octave_dock_widget *)
QAction * m_profiler_stop
Definition: main-window.h:370
QAction * construct_debug_menu_item(const char *icon, const QString &item, const char *member)
void adopt_variable_editor_widget(void)
Definition: main-window.cc:446
void browse_for_directory(void)
void update_default_encoding(const QString &default_encoding)
QAction * m_variable_editor_action
Definition: main-window.h:386
QAction * m_clear_workspace_action
Definition: main-window.h:364
void read_settings(void)
void close_gui_signal(void)
void handle_new_figure_request(void)
void construct_file_menu(QMenuBar *p)
void open_octave_packages_page(void)
Definition: main-window.cc:856
QAction * m_file_browser_action
Definition: main-window.h:383
void adopt_workspace_widget(void)
Definition: main-window.cc:332
void adopt_documentation_widget(void)
Definition: main-window.cc:284
bool m_prevent_readline_conflicts_menu
Some class global flags.
Definition: main-window.h:429
void open_contribute_page(void)
Definition: main-window.cc:861
void pasteClipboard(void)
void construct_news_menu(QMenuBar *p)
bool m_editor_is_octave_file
Some class global flags.
Definition: main-window.h:432
void focus_window(const QString &win_name)
Definition: main-window.cc:487
QAction * m_debug_step_over
Definition: main-window.h:344
void update_breakpoint_marker_signal(bool insert, const QString &file, int line, const QString &cond)
QList< octave_dock_widget * > dock_widget_list(void)
QAction * m_load_workspace_action
Definition: main-window.h:352
void debug_step_into(void)
QPointer< history_dock_widget > m_history_window
Dock widgets.
Definition: main-window.h:322
void edit_mfile(const QString &, int)
Definition: main-window.cc:818
QString m_default_encoding
Definition: main-window.h:310
QPointer< file_editor_interface > m_editor_window
Dock widgets.
Definition: main-window.h:325
void step_into_file_signal(void)
QAction * m_clear_command_history_action
Definition: main-window.h:363
void handle_enter_debugger(void)
void set_file_encoding(const QString &new_encoding)
QAction * m_new_figure_action
Definition: main-window.h:351
QAction * m_report_bug_action
Definition: main-window.h:392
QAction * m_profiler_resume
Definition: main-window.h:369
void construct_new_menu(QMenu *p)
QAction * m_debug_continue
Definition: main-window.h:342
void configure_shortcuts(void)
void clipboard_has_changed(void)
Handling the clipboard.
void debug_continue(void)
QAction * m_exit_action
Definition: main-window.h:356
void adopt_history_widget(void)
Definition: main-window.cc:319
base_qobject & m_octave_qobj
Definition: main-window.h:306
void show_community_news_signal(int serial)
void pasteClipboard_signal(void)
QAction * add_action(QMenu *menu, const QIcon &icon, const QString &text, const char *member, const QWidget *receiver=nullptr)
QAction * m_current_news_action
Definition: main-window.h:399
QAction * m_set_path_action
Definition: main-window.h:354
void execute_command_in_terminal(const QString &dir)
void handle_delete_debugger_pointer_request(const QString &file, int line)
void find_files(const QString &startdir=QDir::currentPath())
Find files dialog.
QAction * m_show_editor_action
Definition: main-window.h:377
void resize_dock(QDockWidget *dw, int width, int height)
QWidget * m_active_editor
Definition: main-window.h:331
void reset_windows(void)
QAction * m_profiler_start
Definition: main-window.h:368
void update_gui_lexer_signal(bool)
void selectAll_signal(void)
QAction * m_new_script_action
Definition: main-window.h:348
void insert_debugger_pointer_signal(const QString &file, int line)
void show_about_octave(void)
Definition: main-window.cc:891
led_indicator * m_profiler_status_indicator
Definition: main-window.h:317
void copyClipboard(void)
void handle_load_workspace_request(const QString &file=QString())
Definition: main-window.cc:680
void request_reload_settings(void)
Definition: main-window.cc:641
void restore_create_file_setting(void)
void construct_octave_qt_link(void)
void open_donate_page(void)
Definition: main-window.cc:866
void update_octave_directory(const QString &dir)
void handle_undo_request(void)
Definition: main-window.cc:773
void profiler_session(void)
bool m_editor_has_tabs
Some class global flags.
Definition: main-window.h:431
void request_open_files(const QStringList &open_file_names)
void closeEvent(QCloseEvent *closeEvent)
void set_screen_size(int ht, int wd)
void process_settings_dialog_request(const QString &desired_tab=QString())
Definition: main-window.cc:871
void open_online_documentation_page(void)
Definition: main-window.cc:845
void delete_debugger_pointer_signal(const QString &file, int line)
void copyClipboard_signal(void)
void debug_step_out(void)
void prepare_to_exit(void)
void construct_menu_bar(void)
QAction * m_debug_quit
Definition: main-window.h:346
void adopt_terminal_widget(void)
Definition: main-window.cc:231
void go_to_previous_widget(void)
void init_terminal_size_signal(void)
void open_file_signal(const QString &)
QAction * m_debug_step_into
Definition: main-window.h:343
QAction * m_workspace_action
Definition: main-window.h:382
QMenu * m_add_menu(QMenuBar *p, QString text)
QAction * construct_window_menu_item(QMenu *p, const QString &item, bool checkable, QWidget *)
void handle_settings(const gui_settings *)
void handle_active_dock_changed(octave_dock_widget *, octave_dock_widget *)
void set_predecessor_widget(octave_dock_widget *prev_widget)
virtual void save_settings(void)
void file_remove_signal(const QString &old_name, const QString &new_name)
void insert_debugger_pointer_signal(const QString &, int)
void gui_status_update_signal(const QString &feature, const QString &status)
void file_renamed_signal(bool load_new)
void update_gui_lexer_signal(bool update_apis_only)
void update_breakpoint_marker_signal(bool insert, const QString &file, int line, const QString &cond)
void delete_debugger_pointer_signal(const QString &, int)
void directory_changed_signal(const QString &dir)
void settings_changed(const gui_settings *, bool)
void execute_command_in_terminal_signal(const QString &command)
gui_settings * get_settings(void) const
bool is_first_run(void) const
QIcon icon(const QString &icon_name, bool fallback=true)
void interpreter_event(const fcn_callback &fcn)
void modify_path_signal(const QStringList &dir_list, bool rm, bool subdirs)
Emitted, when the path has to be modified.
void apply_new_settings(void)
void set_shortcut(QAction *action, const sc_pref &scpref, bool enable=true)
static void putenv(const std::string &name, const std::string &value)
Definition: oct-env.cc:301
void notice_settings(const gui_settings *settings)
void command_requested(const QString &cmd)
Signal that user had requested a command on a variable.
octave_value_list & append(const octave_value &val)
Definition: ovl.cc:98
octave_idx_type length(void) const
Definition: ovl.h:113
symbol_info_list get_symbol_info(void)
Definition: pt-eval.cc:4411
OCTAVE_EXPORT octave_value_list Fdbstep(octave::interpreter &interp, const octave_value_list &args, int)
Definition: debug.cc:1068
OCTAVE_EXPORT octave_value_list Fdbcont(octave::interpreter &interp, const octave_value_list &args, int)
Definition: debug.cc:1121
OCTAVE_EXPORT octave_value_list F__db_next_breakpoint_quiet__(octave::interpreter &interp, const octave_value_list &args, int)
Definition: debug.cc:1194
OCTAVE_EXPORT octave_value_list Fdbquit(octave::interpreter &interp, const octave_value_list &args, int)
Definition: debug.cc:1144
void message(const char *name, const char *fmt,...)
Definition: error.cc:948
OCTAVE_EXPORT octave_value_list Fdrawnow(octave::interpreter &interp, const octave_value_list &args, int)
Definition: graphics.cc:13899
const gui_pref cs_focus_cmd("terminal/focus_after_command", QVariant(false))
const gui_pref cs_dbg_location("terminal/print_debug_location", QVariant(false))
const gui_pref cs_cursor_blinking("terminal/cursorBlinking", QVariant(true))
const struct @23 dw_icon_set_names[]
const gui_pref dw_is_floating("DockWidgets/%1Floating", QVariant(false))
const gui_pref dw_is_visible("DockWidgets/%1Visible", QVariant(true))
const gui_pref dw_is_minimized("DockWidgets/%1_minimized", QVariant(false))
QString name
const gui_pref dw_icon_set("DockWidgets/widget_icon_set", QVariant("NONE"))
const gui_pref ed_create_new_file("editor/create_new_file", QVariant(false))
const gui_pref ed_default_enc("editor/default_encoding", QVariant("UTF-8"))
const gui_pref global_restore_ov_dir("restore_octave_dir", QVariant(false))
const gui_pref global_status_bar("show_status_bar", QVariant(true))
const QStyle::PixelMetric global_icon_sizes[3]
const QString gui_obj_name_main_window
const gui_pref global_prompt_to_exit("prompt_to_exit", QVariant(false))
const gui_pref global_use_native_dialogs("use_native_file_dialogs", QVariant(true))
const gui_pref global_use_custom_editor("useCustomFileEditor", QVariant(false))
const gui_pref global_ov_startup_dir("octave_startup_dir", QVariant(QString()))
const QString global_toolbar_style("QToolBar {" "margin-top: 0px;" "margin-bottom: 0px;" "padding-top: 0px;" "padding-bottom: 0px;" "border-top: 0px;" "border-bottom: 0px;" "}")
const gui_pref global_icon_size("toolbar_icon_size", QVariant(0))
const gui_pref global_cursor_blinking("cursor_blinking", QVariant(true))
const gui_pref global_style("style", QVariant("default"))
const gui_pref mw_dir_list("MainWindow/current_directory_list", QVariant(QStringList()))
const gui_pref mw_geometry("MainWindow/geometry", QVariant(QByteArray()))
const gui_pref mw_state("MainWindow/windowState", QVariant(QByteArray()))
const gui_pref nr_allow_connection("news/allow_web_connection", QVariant(false))
const gui_pref nr_last_news("news/last_news_item", QVariant(0))
const gui_pref nr_last_time("news/last_time_checked", QVariant(QDateTime()))
const sc_pref sc_main_help_online_doc(sc_main_help+":online_doc", QKeySequence::UnknownKey)
const sc_pref sc_main_file_exit(sc_main_file+":exit", QKeySequence::Quit)
const sc_pref sc_main_file_new_file(sc_main_file+":new_file", QKeySequence::New)
const sc_pref sc_main_news_release_notes(sc_main_news+":release_notes", QKeySequence::UnknownKey)
const sc_pref sc_main_window_workspace(sc_main_window+":workspace", PRE+CTRL+Qt::Key_3)
const sc_pref sc_main_file_new_figure(sc_main_file+":new_figure", QKeySequence::UnknownKey)
const sc_pref sc_main_window_doc(sc_main_window+":doc", PRE+CTRL+Qt::Key_5)
const sc_pref sc_main_debug_step_over(sc_main_debug+":step_over", PRE+Qt::Key_F10)
const sc_pref sc_main_window_show_editor(sc_main_window+":show_editor", PRE+CTRL_SHIFT+Qt::Key_4)
const sc_pref sc_main_edit_set_path(sc_main_edit+":set_path", QKeySequence::UnknownKey)
const sc_pref sc_main_window_file_browser(sc_main_window+":file_browser", PRE+CTRL+Qt::Key_2)
const sc_pref sc_main_debug_continue(sc_main_debug+":continue", PRE+Qt::Key_F5)
const sc_pref sc_main_edit_clear_clipboard(sc_main_edit+":clear_clipboard", QKeySequence::UnknownKey)
const sc_pref sc_main_window_show_history(sc_main_window+":show_history", PRE+CTRL_SHIFT+Qt::Key_1)
const sc_pref sc_main_window_show_workspace(sc_main_window+":show_workspace", PRE+CTRL_SHIFT+Qt::Key_3)
const sc_pref sc_main_edit_clear_workspace(sc_main_edit+":clear_workspace", QKeySequence::UnknownKey)
const sc_pref sc_main_file_open_file(sc_main_file+":open_file", QKeySequence::Open)
const sc_pref sc_main_window_show_doc(sc_main_window+":show_doc", PRE+CTRL_SHIFT+Qt::Key_5)
const sc_pref sc_main_file_new_function(sc_main_file+":new_function", CTRL_SHIFT+Qt::Key_N)
const sc_pref sc_main_debug_step_into(sc_main_debug+":step_into", PRE+Qt::Key_F11)
const sc_pref sc_main_help_about(sc_main_help+":about", QKeySequence::UnknownKey)
const sc_pref sc_main_window_show_variable_editor(sc_main_window+":show_variable_editor", PRE+CTRL_SHIFT+Qt::Key_6)
const sc_pref sc_main_window_show_command(sc_main_window+":show_command", PRE+CTRL_SHIFT+Qt::Key_0)
const sc_pref sc_main_window_editor(sc_main_window+":editor", PRE+CTRL+Qt::Key_4)
const sc_pref sc_main_window_variable_editor(sc_main_window+":variable_editor", PRE+CTRL+Qt::Key_6)
const sc_pref sc_main_window_command(sc_main_window+":command", PRE+CTRL+Qt::Key_0)
const sc_pref sc_main_debug_quit(sc_main_debug+":quit", PRE+Qt::ShiftModifier+Qt::Key_F5)
const sc_pref sc_main_edit_copy(sc_main_edit+":copy", QKeySequence::Copy)
const sc_pref sc_main_help_ondisk_doc(sc_main_help+":ondisk_doc", QKeySequence::UnknownKey)
const sc_pref sc_main_help_developer(sc_main_help+":developer", QKeySequence::UnknownKey)
const gui_pref sc_prevent_rl_conflicts("shortcuts/prevent_readline_conflicts", QVariant(false))
const sc_pref sc_main_edit_undo(sc_main_edit+":undo", QKeySequence::Undo)
const sc_pref sc_main_edit_clear_command_window(sc_main_edit+":clear_command_window", QKeySequence::UnknownKey)
const sc_pref sc_main_window_reset(sc_main_window+":reset", QKeySequence::UnknownKey)
const sc_pref sc_main_window_previous_dock(sc_main_window+":previous_widget", PRE+CTRL_ALT+Qt::Key_P)
const sc_pref sc_main_help_contribute(sc_main_help+":contribute", QKeySequence::UnknownKey)
const sc_pref sc_main_window_history(sc_main_window+":history", PRE+CTRL+Qt::Key_1)
const gui_pref sc_prevent_rl_conflicts_menu("shortcuts/prevent_readline_conflicts_menu", QVariant(false))
const sc_pref sc_main_edit_preferences(sc_main_edit+":preferences", QKeySequence::UnknownKey)
const sc_pref sc_main_tools_show_profiler(sc_main_tools+":show_profiler", Qt::AltModifier+Qt::ShiftModifier+Qt::Key_P)
const sc_pref sc_main_help_packages(sc_main_help+":packages", QKeySequence::UnknownKey)
const sc_pref sc_main_file_save_workspace(sc_main_file+":save_workspace", QKeySequence::UnknownKey)
const sc_pref sc_main_edit_paste(sc_main_edit+":paste", QKeySequence::Paste)
const sc_pref sc_main_tools_resume_profiler(sc_main_tools+":resume_profiler", QKeySequence::UnknownKey)
const sc_pref sc_main_edit_find_in_files(sc_main_edit+":find_in_files", CTRL_SHIFT+Qt::Key_F)
const sc_pref sc_main_edit_select_all(sc_main_edit+":select_all", QKeySequence::SelectAll)
const sc_pref sc_main_window_show_file_browser(sc_main_window+":show_file_browser", PRE+CTRL_SHIFT+Qt::Key_2)
const sc_pref sc_main_edit_clear_history(sc_main_edit+":clear_history", QKeySequence::UnknownKey)
const sc_pref sc_main_debug_step_out(sc_main_debug+":step_out", PRE+Qt::ShiftModifier+Qt::Key_F11)
const sc_pref sc_main_news_community_news(sc_main_news+":community_news", QKeySequence::UnknownKey)
const sc_pref sc_main_tools_start_profiler(sc_main_tools+":start_profiler", CTRL_SHIFT+Qt::Key_P)
const sc_pref sc_main_help_report_bug(sc_main_help+":report_bug", QKeySequence::UnknownKey)
const sc_pref sc_main_file_load_workspace(sc_main_file+":load_workspace", QKeySequence::UnknownKey)
OCTAVE_EXPORT octave_value_list Fgenpath(const octave_value_list &args, int)
Definition: load-path.cc:2470
OCTAVE_EXPORT octave_value_list Faddpath(octave::interpreter &interp, const octave_value_list &args, int nargout)
Definition: load-path.cc:2646
OCTAVE_EXPORT octave_value_list Frmpath(octave::interpreter &interp, const octave_value_list &args, int nargout)
Definition: load-path.cc:2773
OCTAVE_EXPORT octave_value_list Fsave(octave::interpreter &interp, const octave_value_list &args, int nargout)
Definition: load-save.cc:1810
OCTAVE_EXPORT octave_value_list Fload(octave::interpreter &interp, const octave_value_list &args, int nargout)
Definition: load-save.cc:1655
std::complex< double > w(std::complex< double > z, double relerr=0)
QString fromStdString(const std::string &s)
std::string toStdString(const QString &s)
static uint32_t state[624]
Definition: randmtzig.cc:192
OCTAVE_EXPORT octave_value_list Fbuiltin(octave::interpreter &interp, const octave_value_list &args, int nargout)
Definition: oct-parse.cc:10409
OCTAVE_EXPORT octave_value_list Ffeval(octave::interpreter &interp, const octave_value_list &args, int nargout)
Definition: oct-parse.cc:10377
octave_value_list ovl(const OV_Args &... args)
Construct an octave_value_list with less typing.
Definition: ovl.h:211
const QString key
const QVariant def
OCTAVE_NAMESPACE_BEGIN bool valid_identifier(const char *s)
Definition: utils.cc:77
OCTAVE_EXPORT octave_value_list Ffile_in_loadpath(octave::interpreter &interp, const octave_value_list &args, int)
Definition: utils.cc:568
OCTAVE_EXPORT octave_value_list Fexist(octave::interpreter &interp, const octave_value_list &args, int)
Definition: variables.cc:435
OCTAVE_EXPORT octave_value_list Fclear(octave::interpreter &interp, const octave_value_list &args, int)
Definition: variables.cc:1236
std::string octave_name_version_copyright_copying_warranty_and_bugs(bool html, const std::string &extra_info)
Definition: version.cc:100