24 #if defined (HAVE_CONFIG_H) 28 #include <QKeySequence> 29 #include <QApplication> 30 #include <QInputDialog> 38 #include <QDesktopServices> 39 #include <QDesktopWidget> 40 #include <QFileDialog> 41 #include <QMessageBox> 43 #include <QTextBrowser> 44 #include <QTextStream> 52 #if defined (HAVE_QSCINTILLA) 63 #include "builtin-defun-decls.h" 65 #if defined (HAVE_QT_GRAPHICS) 79 #if defined (HAVE_QSCINTILLA) 82 octave_unused_parameter (
p);
91 :
QObject (), m_app_context (app_context)
117 #if defined (HAVE_QT_GRAPHICS) 125 Fregister_graphics_toolkit (interp,
ovl (
"qt"));
128 exit_status = interp.
execute ();
131 catch (
const exit_exception& ex)
133 exit_status = ex.exit_status ();
147 m_main_thread (new
QThread ()), m_workspace_model (nullptr),
148 m_status_bar (nullptr), m_command_window (nullptr),
149 m_history_window (nullptr), m_file_browser_window (nullptr),
150 m_doc_browser_window (nullptr), m_editor_window (nullptr),
151 m_workspace_window (nullptr), m_variable_editor_window (nullptr),
152 m_settings_dlg (nullptr), m_find_files_dlg (nullptr),
153 m_release_notes_window (nullptr), m_community_news_window (nullptr),
154 m_octave_qt_link (nullptr), m_clipboard (QApplication::clipboard ()),
155 m_prevent_readline_conflicts (true), m_suppress_dbg_location (true),
156 m_start_gui (app_context && app_context->start_gui_p ()),
157 m_file_encoding (QString ())
173 QCoreApplication::setApplicationName (
"GNU Octave");
175 #if defined (HAVE_QGUIAPPLICATION_SETDESKTOPFILENAME) 177 QGuiApplication::setDesktopFileName (
"org.octave.Octave.desktop");
187 bool connect_to_web =
true;
188 QDateTime last_checked;
195 = settings->value (
"news/allow_web_connection",
false).toBool ();
198 = settings->value (
"news/last_time_checked", QDateTime ()).toDateTime ();
200 serial = settings->value (
"news/last_news_item", 0).toInt ();
203 QDateTime current = QDateTime::currentDateTime ();
204 QDateTime one_day_ago = current.addDays (-1);
207 && (! last_checked.isValid () || one_day_ago > last_checked))
216 connect (
m_interpreter, SIGNAL (octave_finished_signal (
int)),
219 connect (
m_interpreter, SIGNAL (octave_finished_signal (
int)),
304 if (
w->isAncestorOf (w_new))
313 w_new = qobject_cast<
QWidget *> (w_new->previousInFocusChain ());
335 if (edit_dock_widget == dock)
360 = QFileDialog::getSaveFileName (
this, tr (
"Save Workspace As"),
".",
362 QFileDialog::DontUseNativeDialog);
364 if (!
file.isEmpty ())
366 file.toStdString ());
371 QString
file = file_arg;
374 file = QFileDialog::getOpenFileName (
this, tr (
"Load Workspace"),
".",
376 QFileDialog::DontUseNativeDialog);
378 if (!
file.isEmpty ())
380 file.toStdString ());
407 const QString& new_name)
410 name_pair names (old_name.toStdString (), new_name.toStdString ());
436 QDesktopServices::openUrl (
437 QUrl (
"https://octave.org/doc/interpreter/index.html"));
449 if (
file->open (QFile::ReadOnly))
452 news =
stream->readAll ();
453 if (! news.isEmpty ())
456 news.replace (
"<",
"<");
457 news.replace (
">",
">");
459 news.prepend (
"<pre>");
460 news.append (
"</pre>");
463 news = (tr (
"The release notes file '%1' is empty.")
467 news = (tr (
"The release notes file '%1' cannot be read.")
473 browser->setText (news);
475 QVBoxLayout *vlayout =
new QVBoxLayout;
476 vlayout->addWidget (browser);
481 browser->document ()->adjustSize ();
484 QDesktopWidget *m_desktop = QApplication::desktop ();
485 int screen = m_desktop->screenNumber (
this);
486 QRect screen_geo = m_desktop->availableGeometry (screen);
487 int win_x = screen_geo.width ();
488 int win_y = screen_geo.height ();
489 int reln_x =
std::min (720, win_x-80);
490 int reln_y =
std::min (740, win_y-80);
512 ? settings->value (
"news/allow_web_connection",
false).toBool ()
515 QString base_url =
"https://octave.org";
516 QString
page =
"community-news.html";
523 reader->moveToThread (worker_thread);
525 connect (reader, SIGNAL (display_news_signal (
const QString&)),
528 connect (worker_thread, SIGNAL (started (
void)),
529 reader, SLOT (process (
void)));
531 connect (reader, SIGNAL (finished (
void)), worker_thread, SLOT (quit (
void)));
533 connect (reader, SIGNAL (finished (
void)), reader, SLOT (deleteLater (
void)));
535 connect (worker_thread, SIGNAL (finished (
void)),
536 worker_thread, SLOT (deleteLater (
void)));
538 worker_thread->start ();
549 browser->setHtml (news);
550 browser->setObjectName (
"OctaveNews");
551 browser->setOpenExternalLinks (
true);
553 QVBoxLayout *vlayout =
new QVBoxLayout;
555 vlayout->addWidget (browser);
561 QDesktopWidget *m_desktop = QApplication::desktop ();
562 int screen = m_desktop->screenNumber (
this);
563 QRect screen_geo = m_desktop->availableGeometry (screen);
564 int win_x = screen_geo.width ();
565 int win_y = screen_geo.height ();
566 int news_x =
std::min (640, win_x-80);
567 int news_y =
std::min (480, win_y-80);
587 QDesktopServices::openUrl (QUrl (
"https://octave.org/bugs.html"));
592 QDesktopServices::openUrl (QUrl (
"https://octave.org/packages.html"));
597 QDesktopServices::openUrl (QUrl (
"https://octave.org/contribute.html"));
602 QDesktopServices::openUrl (QUrl (
"https://octave.org/donate.html"));
610 if (! desired_tab.isEmpty ())
628 QClipboard *clipboard = QApplication::clipboard ();
638 clipboard->setImage (img);
641 QFile::remove (
file);
649 QMessageBox::about (
this, tr (
"About Octave"),
659 = settings->value (
"DockWidgets/widget_icon_set",
"NONE").toString ();
671 {
"NONE",
":/actions/icons/logo.png"},
672 {
"GRAPHIC",
":/actions/icons/graphic_logo_"},
673 {
"LETTER",
":/actions/icons/letter_logo_"},
678 int icon_set_found = 0;
680 while (! widget_icon_data[count].
name.isEmpty ())
683 if (widget_icon_data[count].
name == icon_set)
686 icon_set_found = count;
695 QString
name = widget->objectName ();
696 if (!
name.isEmpty ())
699 icon = widget_icon_data[icon_set_found].path;
700 if (widget_icon_data[icon_set_found].
name !=
"NONE")
701 icon +=
name +
".png";
702 widget->setWindowIcon (QIcon (icon));
705 if (widget_icon_data[icon_set_found].
name !=
"NONE")
707 +
"ReleaseWidget.png";
711 int icon_size_settings = settings->value (
"toolbar_icon_size",0).toInt ();
712 QStyle *st = style ();
713 int icon_size = st->pixelMetric (QStyle::PM_ToolBarIconSize);
715 if (icon_size_settings == 1)
716 icon_size = st->pixelMetric (QStyle::PM_LargeIconSize);
717 else if (icon_size_settings == -1)
718 icon_size = st->pixelMetric (QStyle::PM_SmallIconSize);
722 if (settings->value (
"show_status_bar",
true).toBool ())
728 = settings->value (
"shortcuts/prevent_readline_conflicts",
true).toBool ();
731 = ! settings->value (
"terminal/print_debug_location",
false).toBool ();
746 bool cursor_blinking;
748 if (settings->contains (
"cursor_blinking"))
749 cursor_blinking = settings->value (
"cursor_blinking",
true).toBool ();
751 cursor_blinking = settings->value (
"terminal/cursorBlinking",
true).toBool ();
754 QApplication::setCursorFlashTime (1000);
756 QApplication::setCursorFlashTime (0);
762 bool closenow =
true;
768 if (settings->value (
"prompt_to_exit",
false).toBool ())
770 int ans = QMessageBox::question (
this, tr (
"Octave"),
771 tr (
"Are you sure you want to exit Octave?"),
773 | QMessageBox::Cancel),
776 if (ans != QMessageBox::Ok)
780 #if defined (HAVE_QSCINTILLA) 835 = QFileDialog::getExistingDirectory (
this, tr (
"Browse directories"),
nullptr,
836 QFileDialog::ShowDirsOnly |
837 QFileDialog::DontUseNativeDialog);
851 QString xdir = (dir.isEmpty () ?
"." : dir);
853 QFileInfo fileInfo (xdir);
855 if (fileInfo.exists () && fileInfo.isDir ())
857 xdir.toStdString ());
910 setWindowTitle (
"Octave (Debugging)");
918 #if defined (HAVE_QSCINTILLA) 925 setWindowTitle (
"Octave");
933 #if defined (HAVE_QSCINTILLA) 984 && ! settings->value (
"useCustomFileEditor",
false).toBool ();
991 fileDialog->setNameFilter (tr (
"Octave Files (*.m);;All Files (*)"));
996 fileDialog->setOption (QFileDialog::DontUseNativeDialog,
true);
999 QGridLayout *extra =
new QGridLayout (fileDialog);
1000 QFrame *separator =
new QFrame (fileDialog);
1001 separator->setFrameShape (QFrame::HLine);
1002 separator->setFrameStyle (QFrame::Sunken);
1007 QLabel *label_enc =
new QLabel (tr (
"File Encoding:"));
1008 QComboBox *combo_enc =
new QComboBox ();
1013 connect (combo_enc, SIGNAL (currentIndexChanged (QString)),
1017 extra->addWidget (separator,0,0,1,3);
1018 extra->addWidget (label_enc,1,0);
1019 extra->addWidget (combo_enc,1,1);
1020 extra->addItem (
new QSpacerItem (1,20,QSizePolicy::Expanding,
1021 QSizePolicy::Fixed), 1,2);
1024 QGridLayout *dialog_layout =
dynamic_cast<QGridLayout *
> (
1025 fileDialog->layout ());
1026 dialog_layout->addLayout (extra,dialog_layout->rowCount (),0,
1027 1,dialog_layout->columnCount ());
1030 fileDialog->setAcceptMode (QFileDialog::AcceptOpen);
1031 fileDialog->setViewMode (QFileDialog::Detail);
1032 fileDialog->setFileMode (QFileDialog::ExistingFiles);
1035 connect (fileDialog, SIGNAL (filesSelected (
const QStringList&)),
1038 fileDialog->setWindowModality (Qt::NonModal);
1039 fileDialog->setAttribute (Qt::WA_DeleteOnClose);
1040 fileDialog->show ();
1058 if (!
p || settings->value (
"useCustomFileEditor",
false).toBool ())
1060 QString new_name = QInputDialog::getText (
p, tr (
"New Function"),
1061 tr (
"New function name:\n"), QLineEdit::Normal,
"", &ok);
1063 if (ok && new_name.length () > 0)
1066 if (new_name.rightRef (2) !=
".m")
1067 new_name.append (
".m");
1069 if (! settings->value (
"editor/create_new_file",
false).toBool ())
1072 settings->setValue (
"editor/create_new_file",
true);
1082 const QString& ffile,
1083 const QString& curr_dir,
1101 if (
type == QString (
"built-in function"))
1104 message = tr (
"%1 is a built-in function");
1106 else if (
type.isEmpty ())
1111 if (ffile.isEmpty ())
1113 if (curr_dir.isEmpty ())
1116 dir = QDir (curr_dir);
1119 dir = QDir (QFileInfo (ffile).canonicalPath ());
1122 QFileInfo
file = QFileInfo (dir,
fname +
".m");
1131 file = QFileInfo (ffile);
1132 file = QFileInfo (QDir (
file.canonicalPath () +
"/private"),
1141 message = tr (
"Can not find function %1");
1150 tr (
"Octave Editor"),
1152 QMessageBox::Ok,
this);
1154 msgBox->setWindowModality (Qt::NonModal);
1155 msgBox->setAttribute (Qt::WA_DeleteOnClose);
1193 const QString&
file,
1195 const QString& cond)
1211 qDebug (
"Error: QSettings pointer from resource manager is NULL.");
1218 QStringList curr_dirs
1219 = settings->value (
"MainWindow/current_directory_list").toStringList ();
1220 for (
int i=0;
i < curr_dirs.size ();
i++)
1234 restoreState (settings->value (
"MainWindow/windowState").toByteArray ());
1235 restoreGeometry (settings->value (
"MainWindow/geometry").toByteArray ());
1240 QString
name = widget->objectName ();
1242 if (!
name.isEmpty ())
1244 bool floating = settings->value
1245 (
"DockWidgets/" +
name +
"Floating",
false).toBool ();
1246 bool visible = settings->value
1247 (
"DockWidgets/" +
name +
"Visible",
true).toBool ();
1256 if (settings->value (
"DockWidgets/" + widget->objectName ()
1257 +
"_minimized").toBool ())
1258 widget->showMinimized ();
1260 widget->setVisible (
true);
1265 if (! widget->parent ())
1269 widget->setVisible (visible);
1282 qDebug (
"Error: QSettings pointer from resource manager is NULL.");
1286 settings->setValue (
"MainWindow/geometry", saveGeometry ());
1287 settings->setValue (
"MainWindow/windowState", saveState ());
1289 QStringList curr_dirs;
1294 settings->setValue (
"MainWindow/current_directory_list", curr_dirs);
1305 #if defined (HAVE_QSCINTILLA) 1315 if (edit && edit->hasSelectedText ())
1317 QClipboard *clipboard = QApplication::clipboard ();
1318 clipboard->setText (edit->selectedText ());
1330 QClipboard *clipboard = QApplication::clipboard ();
1331 QString
str = clipboard->text ();
1332 if (edit &&
str.length () > 0)
1363 SIGNAL (create_dialog (
const QString&,
const QString&,
1364 const QString&,
const QStringList&,
1365 const QString&,
const QStringList&)),
1368 const QString&,
const QStringList&,
1369 const QString&,
const QStringList&)));
1372 qRegisterMetaType<QIntList> (
"QIntList");
1374 SIGNAL (create_listview (
const QStringList&,
const QString&,
1376 const QString&,
const QStringList&,
1377 const QString&,
const QString&)),
1381 const QString&,
const QStringList&,
1382 const QString&,
const QString&)));
1385 qRegisterMetaType<QFloatList> (
"QFloatList");
1387 SIGNAL (create_inputlayout (
const QStringList&,
const QString&,
1389 const QStringList&)),
1394 const QStringList&)));
1397 SIGNAL (create_filedialog (
const QStringList &,
const QString&,
1398 const QString&,
const QString&,
1402 const QString&,
const QString&,
1410 const QString& title,
1411 const QString& icon,
1412 const QStringList& button,
1413 const QString& defbutton,
1414 const QStringList& role)
1417 button, defbutton, role);
1418 message_dialog->setAttribute (Qt::WA_DeleteOnClose);
1419 message_dialog->show ();
1426 const QString&
mode,
1429 const QString&
name,
1430 const QStringList& prompt,
1431 const QString& ok_string,
1432 const QString& cancel_string)
1435 initial,
name, prompt,
1436 ok_string, cancel_string);
1438 list_dialog->setAttribute (Qt::WA_DeleteOnClose);
1439 list_dialog->show ();
1445 const QString& title,
1448 const QStringList& defaults)
1453 input_dialog->setAttribute (Qt::WA_DeleteOnClose);
1454 input_dialog->show ();
1458 const QString& title,
1461 const QString& multimode)
1466 file_dialog->setAttribute (Qt::WA_DeleteOnClose);
1467 file_dialog->show ();
1491 QDir startup_dir = QDir ();
1495 if (settings->value (
"restore_octave_dir").toBool ())
1498 QStringList curr_dirs
1499 = settings->value (
"MainWindow/current_directory_list").toStringList ();
1501 = QDir (curr_dirs.at (0));
1503 else if (! settings->value (
"octave_startup_dir").toString ().isEmpty ())
1507 = QDir (settings->value (
"octave_startup_dir").toString ());
1511 if (! startup_dir.exists ())
1514 startup_dir = QDir ();
1521 #if defined (HAVE_QSCINTILLA) 1536 qApp->exit (exit_status);
1551 SLOT (set_current_directory (
const QString&)));
1554 this, SLOT (
open_file (
const QString &)));
1586 QKeySequence no_key = QKeySequence ();
1655 i.key ()->setTitle (
i.value ().at (disable));
1664 settings->setValue (
"editor/create_new_file",
false);
1679 for (
int i = 0;
i < open_file_names.count ();
i++)
1728 dummyWidget->setObjectName (
"CentralDummyWidget");
1729 dummyWidget->resize (10, 10);
1730 dummyWidget->setSizePolicy (QSizePolicy::Minimum, QSizePolicy::Minimum);
1731 dummyWidget->hide ();
1732 setCentralWidget (dummyWidget);
1740 setWindowIcon (QIcon (
":/actions/icons/logo.png"));
1748 SIGNAL (edit_variable_signal (
const QString&,
1757 SIGNAL (rename_variable (
const QString&,
const QString&)),
1770 connect (qApp, SIGNAL (aboutToQuit (
void)),
1773 connect (qApp, SIGNAL (aboutToQuit (
void)),
1776 connect (qApp, SIGNAL (aboutToQuit (
void)),
1779 connect (qApp, SIGNAL (aboutToQuit (
void)),
1782 connect (qApp, SIGNAL (aboutToQuit (
void)),
1785 connect (qApp, SIGNAL (aboutToQuit (
void)),
1788 connect (qApp, SIGNAL (aboutToQuit (
void)),
1791 connect (qApp, SIGNAL (aboutToQuit (
void)),
1794 connect (qApp, SIGNAL (aboutToQuit (
void)),
1798 connect (qApp, SIGNAL (aboutToQuit (
void)),
1814 SIGNAL (request_open_file_external (
const QString&,
int)),
1816 SLOT (call_custom_editor (
const QString&,
int)));
1819 SIGNAL (request_settings_dialog (
const QString&)),
1828 setWindowTitle (
"Octave");
1831 #if (QT_VERSION < 0x050601) || (QT_VERSION >= 0x050701) 1832 setDockOptions (QMainWindow::AnimatedDocks
1833 | QMainWindow::AllowNestedDocks
1834 | QMainWindow::AllowTabbedDocks);
1836 setDockNestingEnabled (
true);
1843 #if defined (HAVE_QSCINTILLA) 1854 int win_x = QApplication::desktop ()->width ();
1855 int win_y = QApplication::desktop ()->height ();
1863 setGeometry (0, 0, win_x, win_y);
1867 #if defined (HAVE_QSCINTILLA) 1882 int,
const QString&)),
1890 SIGNAL (file_remove_signal (
const QString&,
const QString&)),
1892 SLOT (handle_file_remove (
const QString&,
const QString&)));
1915 SIGNAL (copy_image_to_clipboard_signal (
const QString&,
bool)),
1921 SIGNAL (set_workspace_signal (
bool,
bool,
1924 SLOT (set_workspace (
bool,
bool,
const symbol_scope&)));
1939 SIGNAL (execute_command_in_terminal_signal (QString)),
1943 SIGNAL (set_history_signal (
const QStringList&)),
1947 SIGNAL (append_history_signal (
const QString&)),
1951 SIGNAL (clear_history_signal (
void)),
1961 SIGNAL (show_preferences_signal (
void)),
1965 SIGNAL (edit_file_signal (
const QString&)),
1967 SLOT (handle_edit_file_request (
const QString&)));
1983 int,
const QString&)),
1986 int,
const QString&)));
2003 QTimer::singleShot (0,
m_interpreter, SLOT (execute (
void)));
2007 const QString&
text,
const char *member,
2013 a = menu->addAction (icon,
text, receiver, member);
2015 a = menu->addAction (icon,
text,
this, member);
2018 a->setShortcutContext (Qt::ApplicationShortcut);
2026 QString base_name =
name;
2028 base_name.replace (
"&&",
"___octave_amp_replacement___");
2030 base_name.remove (
"&");
2032 base_name.replace (
"___octave_amp_replacement___",
"&&");
2056 #if defined (HAVE_QSCINTILLA) 2081 m_open_action->setShortcutContext (Qt::ApplicationShortcut);
2082 m_open_action->setToolTip (tr (
"Open an existing file in editor"));
2084 #if defined (HAVE_QSCINTILLA) 2088 file_menu->addSeparator ();
2091 = file_menu->addAction (tr (
"Load Workspace..."));
2094 = file_menu->addAction (tr (
"Save Workspace As..."));
2096 file_menu->addSeparator ();
2099 m_exit_action->setShortcutContext (Qt::ApplicationShortcut);
2111 this, SLOT (close (
void)));
2116 QMenu *new_menu =
p->addMenu (tr (
"New"));
2155 QKeySequence ctrl_shift = Qt::ControlModifier + Qt::ShiftModifier;
2159 m_undo_action->setShortcutContext (Qt::ApplicationShortcut);
2161 edit_menu->addSeparator ();
2166 m_copy_action->setShortcutContext (Qt::ApplicationShortcut);
2174 = edit_menu->addAction (tr (
"Select All"),
this, SLOT (
selectAll (
void)));
2178 = edit_menu->addAction (tr (
"Clear Clipboard"),
this,
2181 edit_menu->addSeparator ();
2185 tr (
"Find Files..."));
2187 edit_menu->addSeparator ();
2190 = edit_menu->addAction (tr (
"Clear Command Window"));
2193 = edit_menu->addAction (tr (
"Clear Command History"));
2196 = edit_menu->addAction (tr (
"Clear Workspace"));
2198 edit_menu->addSeparator ();
2202 tr (
"Preferences..."));
2216 connect (
m_clipboard, SIGNAL (dataChanged (
void)),
2219 #if defined (Q_OS_WIN32) 2232 const QString& item,
2239 action->setEnabled (
false);
2241 #if defined (HAVE_QSCINTILLA) 2254 "db-step", tr (
"Step"),
2258 "db-step-in", tr (
"Step In"),
2262 "db-step-out", tr (
"Step Out"),
2266 "db-cont", tr (
"Continue"),
2270 #if defined (HAVE_QSCINTILLA) 2275 "db-stop", tr (
"Quit Debug Mode"),
2280 const QString& item,
2284 QAction *action =
p->addAction (QIcon (), item);
2287 action->setCheckable (checkable);
2288 action->setShortcutContext (Qt::ApplicationShortcut);
2295 connect (action, SIGNAL (toggled (
bool)),
2296 widget, SLOT (setVisible (
bool)));
2298 connect (widget, SIGNAL (active_changed (
bool)),
2299 action, SLOT (setChecked (
bool)));
2304 connect (action, SIGNAL (triggered (
void)), widget, SLOT (focus (
void)));
2336 window_menu->addSeparator ();
2359 window_menu->addSeparator ();
2362 tr (
"Reset Default Window Layout"), SLOT (
reset_windows (
void)));
2371 help_menu->addSeparator ();
2385 help_menu->addSeparator ();
2393 QMenu *doc_menu =
p->addMenu (tr (
"Documentation"));
2438 QSizePolicy sizePol (QSizePolicy::Preferred, QSizePolicy::Preferred);
2447 tr (
"One directory up"));
2450 tr (
"Browse directories"));
2458 connect (current_dir_search, SIGNAL (triggered (
void)),
2461 connect (current_dir_up, SIGNAL (triggered (
void)),
2497 scope.
rename (names.first, names.second);
2550 Fhistory (
ovl (
"-c"));
2567 return settings->value (
"terminal/focus_after_command",
false).toBool ();
2577 Fbuiltin (interp,
ovl (
"figure"));
2594 "main_file:new_function");
2597 "main_file:load_workspace");
2599 "main_file:save_workspace");
2609 "main_edit:clear_clipboard");
2612 "main_edit:clear_history");
2614 "main_edit:clear_command_window");
2616 "main_edit:clear_workspace");
2627 "main_window:show_command");
2629 "main_window:show_history");
2631 "main_window:show_workspace");
2633 "main_window:show_file_browser");
2635 "main_window:show_editor");
2637 "main_window:show_doc");
2639 "main_window:show_variable_editor");
2644 "main_window:file_browser");
2648 "main_window:variable_editor");
2662 "main_news:release_notes");
2664 "main_news:community_news");
2674 #if defined (HAVE_QSCINTILLA) 2693 std::ostringstream buf;
2696 if (octave_dot_org.is_valid ())
2699 octave_dot_org.http_get (
param);
2701 if (octave_dot_org.good ())
2705 if (html_text.contains (
"this-is-the-gnu-octave-community-news-page"))
2713 settings->setValue (
"news/last_time_checked",
2714 QDateTime::currentDateTime ());
2719 QString tag (
"community-news-page-serial=");
2721 int b = html_text.indexOf (tag);
2727 int e = html_text.indexOf (
"\n",
b);
2729 QString
tmp = html_text.mid (
b,
e-
b);
2731 int curr_page_serial =
tmp.toInt ();
2737 settings->setValue (
"news/last_news_item",
2755 "Octave's community news source seems to be unavailable.\n" 2758 "For the latest news, please check\n" 2759 "<a href=\"https://octave.org/community-news.html\">https://octave.org/community-news.html</a>\n" 2760 "when you have a connection to the web (link opens in an external browser).\n" 2773 "Connecting to the web to display the latest Octave Community news has been disabled.\n" 2776 "For the latest news, please check\n" 2777 "<a href=\"https://octave.org/community-news.html\">https://octave.org/community-news.html</a>\n" 2778 "when you have a connection to the web (link opens in an external browser)\n" 2779 "or enable web connections for news in Octave's network settings dialog.\n" QAction * m_debug_continue
void request_new_function(bool triggered=true)
QAction * m_contribute_action
workspace_model * m_workspace_model
void clear_history_callback(void)
void set_search_dir(const QString &dir)
void handle_edit_mfile_request(const QString &name, const QString &file, const QString &curr_dir, int line)
static const int current_directory_max_visible
For Toolbars.
void handle_clear_command_window_request(void)
void unregister_doc_signal(const QString &)
void construct_edit_menu(QMenuBar *p)
void find_files(const QString &startdir=QDir::currentPath())
Find files dialog.
std::pair< std::string, std::string > name_pair
void handle_register_doc(const QString &file)
void open_online_documentation_page(void)
variable_editor * m_variable_editor_window
Dock widgets.
void set_screen_size_callback(const int_pair &)
terminal_dock_widget * m_command_window
Dock widgets.
For example cd octave end example noindent changes the current working directory to file
static void combo_encoding(QComboBox *combo, QString current=QString())
workspace_view * m_workspace_window
Dock widgets.
interpreter & __get_interpreter__(const std::string &who)
void browse_for_directory(void)
QString m_release_notes_icon
void change_directory(const QString &dir)
file_editor_interface * m_editor_window
Dock widgets.
void execute_command_in_terminal(const QString &dir)
find_files_dialog * m_find_files_dlg
Find files dialog.
QAction * m_new_script_action
std::string string_value(bool force=false) const
void handle_create_filedialog(const QStringList &filters, const QString &title, const QString &filename, const QString &dirname, const QString &multimode)
The value of lines which begin with a space character are not saved in the history list A value of all commands are saved on the history list
void load_and_display_community_news(int serial=-1)
std::string oct_etc_dir(void)
const T * data(void) const
void handle_enter_debugger(void)
void settings_changed(const QSettings *)
history_dock_widget * m_history_window
Dock widgets.
static void update_network_settings(void)
QWidget * m_active_editor
QAction * m_editor_action
void pasteClipboard(void)
identity matrix If supplied two scalar respectively For allows like xample val
QHash< QMenu *, QStringList > m_hash_menu_text
QAction * m_workspace_action
QAction * m_save_workspace_action
void handle_unregister_doc(const QString &file)
void construct_file_menu(QMenuBar *p)
Return the CPU time used by your Octave session The first output is the total time spent executing your process and is equal to the sum of second and third which are the number of CPU seconds spent executing in user mode and the number of CPU seconds spent executing in system mode
application * m_app_context
virtual void enable_menu_shortcuts(bool enable)=0
void handle_octave_ready()
void init_terminal_size_signal(void)
void rename_variable_callback(const name_pair &names)
static QSettings * get_default_settings(void)
void pasteClipboard_signal(void)
void construct_window_menu(QMenuBar *p)
OCTAVE_EXPORT octave_value_list page
QAction * m_new_figure_action
void active_dock_changed(octave_dock_widget *, octave_dock_widget *)
void open_contribute_page(void)
QAction * m_report_bug_action
QWidget * m_release_notes_window
Release notes window.
void add_cmd(octave_cmd *cmd)
Adds a new octave command to the command queue.
void open_donate_page(void)
virtual void empty_script(bool, bool)=0
QAction * add_action(QMenu *menu, const QIcon &icon, const QString &text, const char *member, const QWidget *receiver=nullptr)
virtual void insert_global_actions(QList< QAction *>)=0
void display_community_news(const QString &news)
QString fromStdString(const std::string &s)
QAction * m_file_browser_action
void set_global_shortcuts(bool enable)
Setting global shortcuts.
void command_window_undo_callback(void)
void editor_focus_changed(bool)
QAction * m_new_function_action
QAction * m_ondisk_doc_action
void execute(void)
Initialize and execute the octave interpreter.
Provides threadsafe access to octave.
void refresh_workspace_callback(void)
void edit_mfile(const QString &, int)
void edit_variable(const QString &name, const octave_value &)
Opens the variable editor for name.
std::string dirname(const std::string &path)
void request_reload_settings(void)
QToolBar * m_main_tool_bar
virtual void restore_session(QSettings *)=0
void handle_load_workspace_request(const QString &file=QString())
void change_directory_callback(const std::string &directory)
QAction * m_show_workspace_action
bool m_prevent_readline_conflicts
Some class global flags.
QAction * m_history_action
void copyClipboard_signal(void)
symbol_scope __get_current_scope__(const std::string &who)
OCTAVE_EXPORT octave_value_list Fsave(const octave_value_list &args, int nargout) ar
QAction * m_debug_step_into
bool m_closing
Flag for closing the whole application.
to define functions rather than attempting to enter them directly on the command line The block of commands is executed as soon as you exit the editor To avoid executing any simply delete all the lines from the buffer before leaving the editor When invoked with no edit the previously executed command
void octave_finished_signal(int)
bool command_window_has_focus(void) const
void clear_clipboard()
Handling the clipboard.
void shutdown_confirmation(bool sd)
void request_new_script(const QString &commands=QString())
void new_file(const QString &commands=QString())
virtual QToolBar * toolbar(void)=0
void debug_step_out(void)
void save_workspace_callback(const std::string &file)
void construct_menu_bar(void)
void show_about_octave(void)
QAction * m_variable_editor_action
void construct_octave_qt_link(void)
calling an anonymous function involves an overhead quite comparable to the overhead of an m file function Passing a handle to a built in function is because the interpreter is not involved in the internal loop For a
static shortcut_manager * instance
bool focus_console_after_command(void)
QAction * m_debug_step_over
void disable_menu_shortcuts(bool disable)
void handle_clear_history_request(void)
static void set_screen_size(int ht, int wd)
void clear_workspace_callback(void)
void focus_command_window(void)
void debug_continue(void)
void message(const char *name, const char *fmt,...)
void notice_settings(const QSettings *settings)
QAction * m_show_variable_editor_action
void connect_visibility_changed(void)
OCTAVE_EXPORT octave_value_list Fload(const octave_value_list &args, int nargout) ar
void report_status_message(const QString &statusMessage)
nd deftypefn *std::string name
void debug_step_over(void)
QAction * m_select_all_action
void construct_debug_menu(QMenuBar *p)
QAction * m_find_files_action
void accept_directory_line_edit(void)
QAction * m_show_file_browser_action
#define OCTAVE_RELEASE_DATE
static void set_shortcut(QAction *action, const QString &key)
QAction * m_documentation_action
QAction * construct_debug_menu_item(const char *icon, const QString &item, const char *member)
void confirm_shutdown_octave(void)
static void resize_terminal(void)
QAction * m_show_command_window_action
QAction * m_release_notes_action
std::complex< double > w(std::complex< double > z, double relerr=0)
static void set_workspace(void)
static const int current_directory_max_count
For Toolbars.
bool m_start_gui
Some class global flags.
void connect_uiwidget_links(void)
void prepare_to_exit(void)
void display_news_signal(const QString &news)
void handle_rename_variable_request(const QString &old_name, const QString &new_name)
void set_file_encoding(const QString &new_encoding)
void install___init_qt___functions(octave::symbol_table &symtab)
void process_settings_dialog_request(const QString &desired_tab=QString())
static void connect_link(octave_link *)
QComboBox * m_current_directory_combo_box
For Toolbars.
main_window(QWidget *parent, gui_application *app_context)
static void post_event(T *obj, void(T::*method)(void))
void handle_new_figure_request(void)
void closeEvent(QCloseEvent *closeEvent)
static octave::file_editor_interface * create_default_editor(QWidget *p)
QAction * m_show_history_action
bool m_suppress_dbg_location
Some class global flags.
const Cell & contents(const_iterator p) const
void rename(const std::string &old_name, const std::string &new_name)
void write_settings(void)
void focus_changed(QWidget *w_old, QWidget *w_new)
virtual void handle_exit_debug_mode(void)=0
octave_dock_widget * m_active_dock
Array< std::string > param
void debug_step_into(void)
QAction * m_preferences_action
void delete_debugger_pointer_signal(const QString &file, int line)
void new_figure_callback(void)
void selectAll_signal(void)
void update_breakpoint_marker_signal(bool insert, const QString &file, int line, const QString &cond)
void handle_save_workspace_request(void)
virtual void handle_enter_debug_mode(void)=0
void handle_insert_debugger_pointer_request(const QString &file, int line)
void set_window_layout(QSettings *settings)
void request_open_file(void)
static resource_manager * instance
QAction * construct_window_menu_item(QMenu *p, const QString &item, bool checkable, QWidget *)
void edit_variable(const QString &name, const octave_value &val)
octave_interpreter(application *app_context)
virtual QMenu * get_mru_menu(void)=0
void register_doc_signal(const QString &)
symbol_table & get_symbol_table(void)
std::string octave_name_version_copyright_copying_warranty_and_bugs(bool html, const std::string &extra_info)
static QIcon icon(const QString &icon_name, bool fallback=true)
QAction * m_load_workspace_action
void handle_clear_workspace_request(void)
static void redisplay(void)
void open_file(const QString &file_name=QString(), int line=-1)
void handle_create_dialog(const QString &message, const QString &title, const QString &icon, const QStringList &button, const QString &defbutton, const QStringList &role)
OCTAVE_EXPORT octave_value_list isa nd deftypefn *return ovl(args(0).isinteger())
QAction * m_current_news_action
void configure_shortcuts(void)
void handle_variable_editor_update(void)
virtual bool check_closing(void)=0
void construct_new_menu(QMenu *p)
void clear_command_window_callback(void)
void handle_update_breakpoint_marker_request(bool insert, const QString &file, int line, const QString &cond)
documentation_dock_widget * m_doc_browser_window
Dock widgets.
void set_current_working_directory(const QString &dir)
void show_doc_signal(const QString &)
virtual QMenu * debug_menu(void)=0
QAction * m_clear_workspace_action
void handle_create_inputlayout(const QStringList &, const QString &, const QFloatList &, const QFloatList &, const QStringList &)
void open_file_signal(const QString &)
void octave_ready_signal(void)
OCTAVE_EXPORT octave_value_list Fcd(const octave_value_list &args, int nargout) the current directory is changed to the user 's home directory(@qcode
static QSettings * get_settings(void)
static void kill_full_line(void)
octave_qt_link * m_octave_qt_link
void display_release_notes(void)
void run_file_in_terminal(const QFileInfo &info)
void handle_undo_request(void)
std::pair< int, int > int_pair
void load_workspace_callback(const std::string &file)
QStatusBar * m_status_bar
Toolbar.
void restore_create_file_setting(void)
void construct_documentation_menu(QMenu *p)
void construct_tool_bar(void)
QAction * m_clear_clipboard_action
void refresh_variable_editor(void)
void handle_create_listview(const QStringList &list, const QString &mode, int width, int height, const QIntList &initial, const QString &name, const QStringList &prompt, const QString &ok_string, const QString &cancel_string)
void setModel(workspace_model *model)
QAction * m_reset_windows_action
QMenu * m_add_menu(QMenuBar *p, QString text)
void insert_debugger_pointer_signal(const QString &file, int line)
void clipboard_has_changed(void)
Handling the clipboard.
bool initialized(void) const
QList< octave_dock_widget * > dock_widget_list(void)
gui_application * m_app_context
void open_octave_packages_page(void)
void request_open_files(const QStringList &open_file_names)
QAction * m_clear_command_history_action
void handle_show_doc(const QString &file)
QAction * m_about_octave_action
octave_interpreter * m_interpreter
void copy_image_to_clipboard(const QString &file, bool remove_file)
QPointer< settings_dialog > m_settings_dlg
Settings dialog as guarded pointer (set to 0 when deleted).
QAction * m_show_editor_action
void set_screen_size(int ht, int wd)
If this string is the system will ring the terminal sometimes it is useful to be able to print the original representation of the string
void handle_delete_debugger_pointer_request(const QString &file, int line)
void init_terminal_size(void)
void construct_help_menu(QMenuBar *p)
QAction * m_online_doc_action
void construct_news_menu(QMenuBar *p)
void handle_octave_finished(int)
QUIWidgetCreator uiwidget_creator
void resize_command_window_callback(void)
QAction * m_debug_step_out
QAction * m_clear_command_window_action
QAction * m_octave_packages_action
void find_files_finished(int)
Find files dialog.
QAction * m_show_documentation_action
charNDArray min(char d, const charNDArray &m)
void handle_exit_debugger(void)
QAction * m_developer_action
void change_directory_up(void)
void open_bug_tracker_page(void)
static void clear_screen(bool skip_redisplay=false)
to define functions rather than attempting to enter them directly on the command line The block of commands is executed as soon as you exit the editor To avoid executing any commands
octave_command_queue m_cmd_queue
Command queue and semaphore to synchronize execution signals and related callbacks.
files_dock_widget * m_file_browser_window
Dock widgets.
QAction * m_command_window_action
OCTAVE_EXPORT octave_value_list directory
external_editor_interface * m_external_editor
void new_file_signal(const QString &)
QWidget * m_community_news_window