Mercurial > octave
comparison libgui/src/main-window.cc @ 31771:21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
* mk-opts.pl, external.txi, embedded.cc, make_int.cc, standalone.cc,
standalonebuiltin.cc, BaseControl.cc, BaseControl.h, ButtonControl.cc,
ButtonControl.h, ButtonGroup.cc, ButtonGroup.h, Canvas.cc, Canvas.h,
CheckBoxControl.cc, CheckBoxControl.h, Container.cc, Container.h,
ContextMenu.cc, ContextMenu.h, EditControl.cc, EditControl.h, Figure.cc,
Figure.h, FigureWindow.cc, FigureWindow.h, GLCanvas.cc, GLCanvas.h,
GenericEventNotify.h, KeyMap.cc, ListBoxControl.cc, ListBoxControl.h,
Logger.cc, Logger.h, Menu.cc, Menu.h, MenuContainer.h, Object.cc, Object.h,
ObjectProxy.cc, ObjectProxy.h, Panel.cc, Panel.h, PopupMenuControl.cc,
PopupMenuControl.h, PushButtonControl.cc, PushButtonControl.h, PushTool.cc,
PushTool.h, RadioButtonControl.cc, RadioButtonControl.h, SliderControl.cc,
SliderControl.h, Table.cc, Table.h, TextControl.cc, TextControl.h, TextEdit.h,
ToggleButtonControl.cc, ToggleButtonControl.h, ToggleTool.cc, ToggleTool.h,
ToolBar.cc, ToolBar.h, ToolBarButton.cc, ToolBarButton.h, gl-select.cc,
gl-select.h, qopengl-functions.h, qt-graphics-toolkit.h, qdialog.cpp,
qfontdialog.cpp, qprintdialog_win.cpp, liboctgui-build-info.h,
liboctgui-build-info.in.cc, color-picker.cc, color-picker.h, command-widget.cc,
command-widget.h, community-news.cc, community-news.h, dialog.cc, dialog.h,
documentation-bookmarks.cc, documentation-bookmarks.h,
documentation-dock-widget.cc, documentation-dock-widget.h, documentation.cc,
documentation.h, dw-main-window.cc, dw-main-window.h,
external-editor-interface.cc, external-editor-interface.h,
files-dock-widget.cc, files-dock-widget.h, find-files-dialog.cc,
find-files-dialog.h, find-files-model.cc, find-files-model.h,
gui-preferences.cc, gui-preferences.h, gui-settings.cc, gui-settings.h,
history-dock-widget.cc, history-dock-widget.h, interpreter-qobject.cc,
interpreter-qobject.h, file-editor-interface.h, file-editor-tab.cc,
file-editor-tab.h, file-editor.cc, file-editor.h, find-dialog.cc,
find-dialog.h, marker.cc, marker.h, octave-qscintilla.cc, octave-qscintilla.h,
octave-txt-lexer.cc, octave-txt-lexer.h, main-window.cc, main-window.h,
news-reader.cc, news-reader.h, octave-dock-widget.cc, octave-dock-widget.h,
octave-qobject.cc, octave-qobject.h, qt-application.cc, qt-application.h,
qt-interpreter-events.cc, qt-interpreter-events.h, release-notes.cc,
release-notes.h, set-path-dialog.cc, set-path-dialog.h, set-path-model.cc,
set-path-model.h, settings-dialog.cc, settings-dialog.h,
shortcuts-tree-widget.cc, shortcuts-tree-widget.h, tab-bar.cc, tab-bar.h,
terminal-dock-widget.cc, terminal-dock-widget.h, variable-editor-model.cc,
variable-editor-model.h, variable-editor.cc, variable-editor.h,
welcome-wizard.cc, welcome-wizard.h, workspace-model.cc, workspace-model.h,
workspace-view.cc, workspace-view.h, build-env.h, Cell.cc, Cell.h,
__contourc__.cc, __magick_read__.cc, auto-shlib.cc, auto-shlib.h,
base-text-renderer.h, bsxfun.cc, c-file-ptr-stream.cc, c-file-ptr-stream.h,
call-stack.cc, call-stack.h, debug.cc, defaults.cc, defaults.h, defun.cc,
display.cc, display.h, dynamic-ld.cc, dynamic-ld.h, environment.cc,
environment.h, error.cc, error.h, errwarn.cc, errwarn.h, event-manager.cc,
event-manager.h, event-queue.cc, event-queue.h, fcn-info.cc, fcn-info.h,
ft-text-renderer.cc, ft-text-renderer.h, genprops.awk, gh-manager.cc,
gh-manager.h, gl-render.cc, gl-render.h, gl2ps-print.cc, graphics-toolkit.h,
graphics.cc, graphics.in.h, gtk-manager.cc, gtk-manager.h, help.cc, help.h,
hook-fcn.h, input.cc, input.h, interpreter-private.cc, interpreter-private.h,
interpreter.cc, interpreter.h, jsondecode.cc, latex-text-renderer.cc,
latex-text-renderer.h, load-path.cc, load-path.h, load-save.cc, load-save.h,
ls-hdf5.cc, ls-hdf5.h, mxarray.h, oct-errno.h, oct-errno.in.cc, oct-fstrm.cc,
oct-fstrm.h, oct-handle.h, oct-hist.cc, oct-hist.h, oct-iostrm.cc,
oct-iostrm.h, oct-map.cc, oct-map.h, oct-opengl.h, oct-prcstrm.cc,
oct-prcstrm.h, oct-procbuf.cc, oct-procbuf.h, oct-process.h, oct-stdstrm.h,
oct-stream.cc, oct-stream.h, oct-strstrm.cc, oct-strstrm.h,
oct-tex-lexer.in.ll, pager.cc, pager.h, pr-flt-fmt.cc, pr-flt-fmt.h,
pr-output.cc, pr-output.h, procstream.cc, procstream.h, settings.cc,
settings.h, sighandlers.cc, sighandlers.h, stack-frame.cc, stack-frame.h,
svd.cc, syminfo.cc, syminfo.h, symrec.cc, symrec.h, symscope.cc, symscope.h,
symtab.cc, symtab.h, sysdep.cc, sysdep.h, text-engine.cc, text-engine.h,
text-renderer.cc, text-renderer.h, toplev.cc, url-handle-manager.cc,
url-handle-manager.h, variables.cc, xpow.cc, __init_fltk__.cc,
__init_gnuplot__.cc, __ode15__.cc, audiodevinfo.cc, gzip.cc,
liboctinterp-build-info.h, liboctinterp-build-info.in.cc,
mk-build-env-features.sh, mk-builtins.pl, cdef-class.cc, cdef-class.h,
cdef-manager.h, cdef-method.cc, cdef-method.h, cdef-object.cc, cdef-object.h,
cdef-package.cc, cdef-package.h, cdef-property.cc, cdef-property.h,
cdef-utils.cc, cdef-utils.h, ov-base-diag.cc, ov-base-diag.h, ov-base-int.cc,
ov-base-int.h, ov-base-mat.cc, ov-base-mat.h, ov-base-scalar.cc,
ov-base-scalar.h, ov-base-sparse.cc, ov-base-sparse.h, ov-base.cc, ov-base.h,
ov-bool-mat.cc, ov-bool-mat.h, ov-bool-sparse.cc, ov-bool-sparse.h, ov-bool.cc,
ov-bool.h, ov-builtin.cc, ov-builtin.h, ov-cell.cc, ov-cell.h, ov-ch-mat.cc,
ov-ch-mat.h, ov-class.cc, ov-class.h, ov-classdef.cc, ov-classdef.h,
ov-colon.h, ov-complex.cc, ov-complex.h, ov-cs-list.h, ov-cx-diag.cc,
ov-cx-diag.h, ov-cx-mat.cc, ov-cx-mat.h, ov-cx-sparse.cc, ov-cx-sparse.h,
ov-dld-fcn.cc, ov-dld-fcn.h, ov-fcn-handle.cc, ov-fcn-handle.h, ov-fcn.cc,
ov-fcn.h, ov-float.cc, ov-float.h, ov-flt-complex.cc, ov-flt-complex.h,
ov-flt-cx-diag.cc, ov-flt-cx-diag.h, ov-flt-cx-mat.cc, ov-flt-cx-mat.h,
ov-flt-re-diag.cc, ov-flt-re-diag.h, ov-flt-re-mat.cc, ov-flt-re-mat.h,
ov-intx.h, ov-java.cc, ov-java.h, ov-lazy-idx.cc, ov-lazy-idx.h,
ov-legacy-range.cc, ov-legacy-range.h, ov-magic-int.cc, ov-magic-int.h,
ov-mex-fcn.cc, ov-mex-fcn.h, ov-null-mat.cc, ov-null-mat.h, ov-oncleanup.cc,
ov-oncleanup.h, ov-perm.cc, ov-perm.h, ov-range.cc, ov-range.h, ov-re-diag.cc,
ov-re-diag.h, ov-re-mat.cc, ov-re-mat.h, ov-re-sparse.cc, ov-re-sparse.h,
ov-scalar.cc, ov-scalar.h, ov-str-mat.cc, ov-str-mat.h, ov-struct.cc,
ov-struct.h, ov-typeinfo.cc, ov-typeinfo.h, ov-usr-fcn.cc, ov-usr-fcn.h, ov.cc,
ov.h, ovl.cc, ovl.h, octave.cc, octave.h, anon-fcn-validator.h, bp-table.cc,
bp-table.h, comment-list.cc, comment-list.h, filepos.h, lex.h, lex.ll,
oct-lvalue.cc, oct-lvalue.h, oct-parse.yy, parse.h, profiler.cc, profiler.h,
pt-anon-scopes.h, pt-arg-list.cc, pt-arg-list.h, pt-args-block.cc,
pt-args-block.h, pt-array-list.cc, pt-array-list.h, pt-assign.cc, pt-assign.h,
pt-binop.cc, pt-binop.h, pt-bp.h, pt-cbinop.h, pt-cell.h, pt-check.h,
pt-classdef.cc, pt-classdef.h, pt-cmd.h, pt-colon.h, pt-const.h, pt-decl.cc,
pt-decl.h, pt-eval.cc, pt-eval.h, pt-except.cc, pt-except.h, pt-exp.cc,
pt-exp.h, pt-fcn-handle.cc, pt-fcn-handle.h, pt-id.cc, pt-id.h, pt-idx.cc,
pt-idx.h, pt-jump.h, pt-loop.cc, pt-loop.h, pt-mat.h, pt-misc.cc, pt-misc.h,
pt-pr-code.cc, pt-pr-code.h, pt-select.cc, pt-select.h, pt-spmd.cc, pt-spmd.h,
pt-stmt.cc, pt-stmt.h, pt-tm-const.cc, pt-tm-const.h, pt-unop.cc, pt-unop.h,
pt-walk.h, pt.cc, pt.h, token.cc, token.h, usage.h, Array-base.cc, Array.h,
CColVector.cc, CColVector.h, CDiagMatrix.cc, CDiagMatrix.h, CMatrix.cc,
CMatrix.h, CNDArray.cc, CNDArray.h, CRowVector.cc, CRowVector.h, CSparse.cc,
CSparse.h, DiagArray2.cc, DiagArray2.h, MArray.cc, MArray.h, MDiagArray2.h,
MSparse.h, MatrixType.cc, MatrixType.h, PermMatrix.cc, PermMatrix.h, Range.cc,
Range.h, Sparse-b.cc, Sparse.cc, Sparse.h, boolMatrix.cc, boolMatrix.h,
boolNDArray.cc, boolNDArray.h, boolSparse.cc, boolSparse.h, chMatrix.h,
chNDArray.h, dColVector.cc, dColVector.h, dDiagMatrix.cc, dDiagMatrix.h,
dMatrix.cc, dMatrix.h, dNDArray.cc, dNDArray.h, dRowVector.cc, dRowVector.h,
dSparse.cc, dSparse.h, dim-vector.cc, dim-vector.h, fCColVector.cc,
fCColVector.h, fCDiagMatrix.cc, fCDiagMatrix.h, fCMatrix.cc, fCMatrix.h,
fCNDArray.cc, fCNDArray.h, fCRowVector.cc, fCRowVector.h, fColVector.cc,
fColVector.h, fDiagMatrix.cc, fDiagMatrix.h, fMatrix.cc, fMatrix.h,
fNDArray.cc, fNDArray.h, fRowVector.cc, fRowVector.h, idx-vector.cc,
idx-vector.h, intNDArray.cc, intNDArray.h, liboctave-build-info.h,
liboctave-build-info.in.cc, CollocWt.cc, CollocWt.h, DAE.h, DAEFunc.h, DAERT.h,
DAERTFunc.h, DASPK.cc, DASPK.h, DASRT.cc, DASRT.h, DASSL.cc, DASSL.h, DET.h,
EIG.h, LSODE.cc, LSODE.h, ODE.h, ODEFunc.h, ODES.h, ODESFunc.h, Quad.h,
aepbalance.cc, aepbalance.h, base-dae.h, base-de.h, chol.cc, chol.h,
eigs-base.cc, fEIG.h, gepbalance.h, gsvd.cc, gsvd.h, hess.h, lu.cc, lu.h,
oct-fftw.cc, oct-fftw.h, oct-rand.cc, oct-rand.h, oct-spparms.cc,
oct-spparms.h, qr.cc, qr.h, qrp.cc, qrp.h, randmtzig.cc, randmtzig.h, schur.h,
sparse-chol.cc, sparse-chol.h, sparse-lu.cc, sparse-lu.h, sparse-qr.cc,
sparse-qr.h, svd.cc, svd.h, child-list.cc, child-list.h, dir-ops.cc, dir-ops.h,
file-ops.cc, file-ops.h, file-stat.cc, file-stat.h, lo-sysdep.cc, lo-sysdep.h,
lo-sysinfo.cc, lo-sysinfo.h, mach-info.cc, mach-info.h, oct-env.cc, oct-env.h,
oct-group.cc, oct-group.h, oct-password.cc, oct-password.h, oct-syscalls.cc,
oct-syscalls.h, oct-time.cc, oct-time.h, oct-uname.cc, oct-uname.h,
action-container.h, base-list.h, caseless-str.h, cmd-edit.cc, cmd-edit.h,
cmd-hist.cc, cmd-hist.h, data-conv.cc, file-info.h, glob-match.cc,
glob-match.h, kpse.cc, kpse.h, lo-array-errwarn.cc, lo-array-errwarn.h,
lo-hash.cc, lo-hash.h, lo-ieee.cc, lo-ieee.h, lo-regexp.cc, lo-regexp.h,
oct-inttypes.cc, oct-inttypes.h, oct-mutex.cc, oct-mutex.h, oct-refcount.h,
oct-shlib.cc, oct-shlib.h, oct-sort.cc, oct-sort.h, oct-sparse.cc,
octave-preserve-stream-state.h, pathsearch.cc, pathsearch.h, quit.cc,
singleton-cleanup.cc, singleton-cleanup.h, str-vec.cc, str-vec.h,
unwind-prot.cc, unwind-prot.h, url-transfer.cc, url-transfer.h, version.cc,
version.in.h, cxx-signal-helpers.cc, acinclude.m4, main-cli.cc, main-gui.cc,
main.in.cc, mkoctfile.in.cc, octave-build-info.h, octave-build-info.in.cc,
octave-config.in.cc, octave-svgconvert.cc, shared-fcns.h:
maint: Eliminate "(void)" in C++ function prototypes/declarations.
author | Rik <rik@octave.org> |
---|---|
date | Tue, 24 Jan 2023 17:19:44 -0800 |
parents | 90a741992f3f |
children | 2891372cce9f |
comparison
equal
deleted
inserted
replaced
31770:1d1eff97670e | 31771:21f9b34eb893 |
---|---|
196 emit init_window_menu (); | 196 emit init_window_menu (); |
197 | 197 |
198 focus_command_window (); | 198 focus_command_window (); |
199 } | 199 } |
200 | 200 |
201 main_window::~main_window (void) { } | 201 main_window::~main_window () { } |
202 | 202 |
203 void main_window::adopt_dock_widgets (void) | 203 void main_window::adopt_dock_widgets () |
204 { | 204 { |
205 adopt_terminal_widget (); | 205 adopt_terminal_widget (); |
206 adopt_documentation_widget (); | 206 adopt_documentation_widget (); |
207 adopt_file_browser_widget (); | 207 adopt_file_browser_widget (); |
208 adopt_history_widget (); | 208 adopt_history_widget (); |
211 adopt_variable_editor_widget (); | 211 adopt_variable_editor_widget (); |
212 | 212 |
213 m_previous_dock = m_command_window; | 213 m_previous_dock = m_command_window; |
214 } | 214 } |
215 | 215 |
216 void main_window::adopt_terminal_widget (void) | 216 void main_window::adopt_terminal_widget () |
217 { | 217 { |
218 m_command_window = m_octave_qobj.terminal_widget (this); | 218 m_command_window = m_octave_qobj.terminal_widget (this); |
219 | 219 |
220 make_dock_widget_connections (m_command_window); | 220 make_dock_widget_connections (m_command_window); |
221 | 221 |
269 connect (this, &main_window::execute_command_signal, | 269 connect (this, &main_window::execute_command_signal, |
270 m_command_window, &terminal_dock_widget::execute_command_signal); | 270 m_command_window, &terminal_dock_widget::execute_command_signal); |
271 } | 271 } |
272 } | 272 } |
273 | 273 |
274 void main_window::adopt_documentation_widget (void) | 274 void main_window::adopt_documentation_widget () |
275 { | 275 { |
276 m_doc_browser_window = m_octave_qobj.documentation_widget (this); | 276 m_doc_browser_window = m_octave_qobj.documentation_widget (this); |
277 | 277 |
278 make_dock_widget_connections (m_doc_browser_window); | 278 make_dock_widget_connections (m_doc_browser_window); |
279 } | 279 } |
280 | 280 |
281 void main_window::adopt_file_browser_widget (void) | 281 void main_window::adopt_file_browser_widget () |
282 { | 282 { |
283 m_file_browser_window = m_octave_qobj.file_browser_widget (this); | 283 m_file_browser_window = m_octave_qobj.file_browser_widget (this); |
284 | 284 |
285 make_dock_widget_connections (m_file_browser_window); | 285 make_dock_widget_connections (m_file_browser_window); |
286 | 286 |
304 | 304 |
305 connect (m_file_browser_window, &files_dock_widget::find_files_signal, | 305 connect (m_file_browser_window, &files_dock_widget::find_files_signal, |
306 this, &main_window::find_files); | 306 this, &main_window::find_files); |
307 } | 307 } |
308 | 308 |
309 void main_window::adopt_history_widget (void) | 309 void main_window::adopt_history_widget () |
310 { | 310 { |
311 m_history_window = m_octave_qobj.history_widget (this); | 311 m_history_window = m_octave_qobj.history_widget (this); |
312 | 312 |
313 make_dock_widget_connections (m_history_window); | 313 make_dock_widget_connections (m_history_window); |
314 | 314 |
317 | 317 |
318 connect (m_history_window, &history_dock_widget::command_double_clicked, | 318 connect (m_history_window, &history_dock_widget::command_double_clicked, |
319 this, &main_window::execute_command_in_terminal); | 319 this, &main_window::execute_command_in_terminal); |
320 } | 320 } |
321 | 321 |
322 void main_window::adopt_workspace_widget (void) | 322 void main_window::adopt_workspace_widget () |
323 { | 323 { |
324 m_workspace_window = m_octave_qobj.workspace_widget (this); | 324 m_workspace_window = m_octave_qobj.workspace_widget (this); |
325 | 325 |
326 make_dock_widget_connections (m_workspace_window); | 326 make_dock_widget_connections (m_workspace_window); |
327 | 327 |
328 connect (m_workspace_window, &workspace_view::command_requested, | 328 connect (m_workspace_window, &workspace_view::command_requested, |
329 this, &main_window::execute_command_in_terminal); | 329 this, &main_window::execute_command_in_terminal); |
330 } | 330 } |
331 | 331 |
332 void main_window::adopt_editor_widget (void) | 332 void main_window::adopt_editor_widget () |
333 { | 333 { |
334 interpreter_qobject *interp_qobj = m_octave_qobj.interpreter_qobj (); | 334 interpreter_qobject *interp_qobj = m_octave_qobj.interpreter_qobj (); |
335 | 335 |
336 qt_interpreter_events *qt_link = interp_qobj->qt_link (); | 336 qt_interpreter_events *qt_link = interp_qobj->qt_link (); |
337 | 337 |
435 | 435 |
436 connect (qt_link, SIGNAL (edit_file_signal (const QString&)), | 436 connect (qt_link, SIGNAL (edit_file_signal (const QString&)), |
437 m_active_editor, SLOT (handle_edit_file_request (const QString&))); | 437 m_active_editor, SLOT (handle_edit_file_request (const QString&))); |
438 } | 438 } |
439 | 439 |
440 void main_window::adopt_variable_editor_widget (void) | 440 void main_window::adopt_variable_editor_widget () |
441 { | 441 { |
442 m_variable_editor_window = m_octave_qobj.variable_editor_widget (this); | 442 m_variable_editor_window = m_octave_qobj.variable_editor_widget (this); |
443 | 443 |
444 make_dock_widget_connections (m_variable_editor_window); | 444 make_dock_widget_connections (m_variable_editor_window); |
445 } | 445 } |
466 // and the main window is closed (no exit via interpreter) | 466 // and the main window is closed (no exit via interpreter) |
467 connect (this, &main_window::close_gui_signal, | 467 connect (this, &main_window::close_gui_signal, |
468 dw, &octave_dock_widget::save_settings); | 468 dw, &octave_dock_widget::save_settings); |
469 } | 469 } |
470 | 470 |
471 bool main_window::command_window_has_focus (void) const | 471 bool main_window::command_window_has_focus () const |
472 { | 472 { |
473 return m_command_window->has_focus (); | 473 return m_command_window->has_focus (); |
474 } | 474 } |
475 | 475 |
476 void main_window::focus_command_window (void) | 476 void main_window::focus_command_window () |
477 { | 477 { |
478 m_command_window->activate (); | 478 m_command_window->activate (); |
479 } | 479 } |
480 | 480 |
481 void main_window::focus_window (const QString& win_name) | 481 void main_window::focus_window (const QString& win_name) |
488 m_workspace_window->activate (); | 488 m_workspace_window->activate (); |
489 else if (win_name == "filebrowser") | 489 else if (win_name == "filebrowser") |
490 m_file_browser_window->activate (); | 490 m_file_browser_window->activate (); |
491 } | 491 } |
492 | 492 |
493 bool main_window::confirm_shutdown (void) | 493 bool main_window::confirm_shutdown () |
494 { | 494 { |
495 bool closenow = true; | 495 bool closenow = true; |
496 | 496 |
497 gui_settings settings; | 497 gui_settings settings; |
498 | 498 |
629 if (cmd_involved) | 629 if (cmd_involved) |
630 configure_shortcuts (); | 630 configure_shortcuts (); |
631 } | 631 } |
632 } | 632 } |
633 | 633 |
634 void main_window::request_reload_settings (void) | 634 void main_window::request_reload_settings () |
635 { | 635 { |
636 emit settings_changed (); | 636 emit settings_changed (); |
637 } | 637 } |
638 | 638 |
639 void main_window::report_status_message (const QString& statusMessage) | 639 void main_window::report_status_message (const QString& statusMessage) |
640 { | 640 { |
641 m_status_bar->showMessage (statusMessage, 1000); | 641 m_status_bar->showMessage (statusMessage, 1000); |
642 } | 642 } |
643 | 643 |
644 void main_window::handle_save_workspace_request (void) | 644 void main_window::handle_save_workspace_request () |
645 { | 645 { |
646 // FIXME: Remove, if for all common KDE versions (bug #54607) is resolved. | 646 // FIXME: Remove, if for all common KDE versions (bug #54607) is resolved. |
647 int opts = 0; // No options by default. | 647 int opts = 0; // No options by default. |
648 | 648 |
649 gui_settings settings; | 649 gui_settings settings; |
723 xevmgr.set_workspace (true, tw.get_symbol_info ()); | 723 xevmgr.set_workspace (true, tw.get_symbol_info ()); |
724 }); | 724 }); |
725 } | 725 } |
726 } | 726 } |
727 | 727 |
728 void main_window::handle_clear_workspace_request (void) | 728 void main_window::handle_clear_workspace_request () |
729 { | 729 { |
730 emit interpreter_event | 730 emit interpreter_event |
731 ([] (interpreter& interp) | 731 ([] (interpreter& interp) |
732 { | 732 { |
733 // INTERPRETER THREAD | 733 // INTERPRETER THREAD |
734 | 734 |
735 Fclear (interp); | 735 Fclear (interp); |
736 }); | 736 }); |
737 } | 737 } |
738 | 738 |
739 void main_window::handle_clear_command_window_request (void) | 739 void main_window::handle_clear_command_window_request () |
740 { | 740 { |
741 emit interpreter_event | 741 emit interpreter_event |
742 ([] (void) | 742 ([] () |
743 { | 743 { |
744 // INTERPRETER THREAD | 744 // INTERPRETER THREAD |
745 | 745 |
746 command_editor::kill_full_line (); | 746 command_editor::kill_full_line (); |
747 command_editor::clear_screen (); | 747 command_editor::clear_screen (); |
748 }); | 748 }); |
749 } | 749 } |
750 | 750 |
751 void main_window::handle_clear_history_request (void) | 751 void main_window::handle_clear_history_request () |
752 { | 752 { |
753 emit interpreter_event | 753 emit interpreter_event |
754 ([] (interpreter& interp) | 754 ([] (interpreter& interp) |
755 { | 755 { |
756 // INTERPRETER THREAD | 756 // INTERPRETER THREAD |
759 | 759 |
760 history_sys.do_history (ovl ("-c")); | 760 history_sys.do_history (ovl ("-c")); |
761 }); | 761 }); |
762 } | 762 } |
763 | 763 |
764 void main_window::handle_undo_request (void) | 764 void main_window::handle_undo_request () |
765 { | 765 { |
766 if (command_window_has_focus ()) | 766 if (command_window_has_focus ()) |
767 { | 767 { |
768 emit interpreter_event | 768 emit interpreter_event |
769 ([] (void) | 769 ([] () |
770 { | 770 { |
771 // INTERPRETER THREAD | 771 // INTERPRETER THREAD |
772 | 772 |
773 command_editor::undo (); | 773 command_editor::undo (); |
774 command_editor::redisplay (); | 774 command_editor::redisplay (); |
830 // We are done: Unlock and wake the worker thread | 830 // We are done: Unlock and wake the worker thread |
831 qt_link->unlock (); | 831 qt_link->unlock (); |
832 qt_link->wake_all (); | 832 qt_link->wake_all (); |
833 } | 833 } |
834 | 834 |
835 void main_window::open_online_documentation_page (void) | 835 void main_window::open_online_documentation_page () |
836 { | 836 { |
837 QDesktopServices::openUrl | 837 QDesktopServices::openUrl |
838 (QUrl ("https://octave.org/doc/interpreter/index.html")); | 838 (QUrl ("https://octave.org/doc/interpreter/index.html")); |
839 } | 839 } |
840 | 840 |
841 void main_window::open_bug_tracker_page (void) | 841 void main_window::open_bug_tracker_page () |
842 { | 842 { |
843 QDesktopServices::openUrl (QUrl ("https://octave.org/bugs.html")); | 843 QDesktopServices::openUrl (QUrl ("https://octave.org/bugs.html")); |
844 } | 844 } |
845 | 845 |
846 void main_window::open_octave_packages_page (void) | 846 void main_window::open_octave_packages_page () |
847 { | 847 { |
848 QDesktopServices::openUrl (QUrl ("https://packages.octave.org/index.html")); | 848 QDesktopServices::openUrl (QUrl ("https://packages.octave.org/index.html")); |
849 } | 849 } |
850 | 850 |
851 void main_window::open_contribute_page (void) | 851 void main_window::open_contribute_page () |
852 { | 852 { |
853 QDesktopServices::openUrl (QUrl ("https://octave.org/contribute.html")); | 853 QDesktopServices::openUrl (QUrl ("https://octave.org/contribute.html")); |
854 } | 854 } |
855 | 855 |
856 void main_window::open_donate_page (void) | 856 void main_window::open_donate_page () |
857 { | 857 { |
858 QDesktopServices::openUrl (QUrl ("https://octave.org/donate.html")); | 858 QDesktopServices::openUrl (QUrl ("https://octave.org/donate.html")); |
859 } | 859 } |
860 | 860 |
861 void main_window::process_settings_dialog_request (const QString& desired_tab) | 861 void main_window::process_settings_dialog_request (const QString& desired_tab) |
876 m_settings_dlg->setModal (false); | 876 m_settings_dlg->setModal (false); |
877 m_settings_dlg->setAttribute (Qt::WA_DeleteOnClose); | 877 m_settings_dlg->setAttribute (Qt::WA_DeleteOnClose); |
878 m_settings_dlg->show (); | 878 m_settings_dlg->show (); |
879 } | 879 } |
880 | 880 |
881 void main_window::show_about_octave (void) | 881 void main_window::show_about_octave () |
882 { | 882 { |
883 std::string message | 883 std::string message |
884 = octave_name_version_copyright_copying_warranty_and_bugs (true); | 884 = octave_name_version_copyright_copying_warranty_and_bugs (true); |
885 | 885 |
886 QMessageBox::about (this, tr ("About Octave"), | 886 QMessageBox::about (this, tr ("About Octave"), |
1020 darkPalette.setColor(QPalette::Disabled, QPalette::HighlightedText, QColor(127, 127, 127)); | 1020 darkPalette.setColor(QPalette::Disabled, QPalette::HighlightedText, QColor(127, 127, 127)); |
1021 | 1021 |
1022 return darkPalette; | 1022 return darkPalette; |
1023 } | 1023 } |
1024 | 1024 |
1025 void main_window::prepare_to_exit (void) | 1025 void main_window::prepare_to_exit () |
1026 { | 1026 { |
1027 // Find files dialog is constructed dynamically, not at time of main_window | 1027 // Find files dialog is constructed dynamically, not at time of main_window |
1028 // construction. Connecting it to qApp aboutToQuit signal would have | 1028 // construction. Connecting it to qApp aboutToQuit signal would have |
1029 // caused it to run after gui_settings is deleted. | 1029 // caused it to run after gui_settings is deleted. |
1030 if (m_find_files_dlg) | 1030 if (m_find_files_dlg) |
1038 // No more active dock, otherwise, focus_changed would try to set | 1038 // No more active dock, otherwise, focus_changed would try to set |
1039 // the focus to a dock widget that might not exist anymore | 1039 // the focus to a dock widget that might not exist anymore |
1040 m_active_dock = nullptr; | 1040 m_active_dock = nullptr; |
1041 } | 1041 } |
1042 | 1042 |
1043 void main_window::go_to_previous_widget (void) | 1043 void main_window::go_to_previous_widget () |
1044 { | 1044 { |
1045 m_previous_dock->activate (); | 1045 m_previous_dock->activate (); |
1046 } | 1046 } |
1047 | 1047 |
1048 void main_window::update_octave_directory (const QString& dir) | 1048 void main_window::update_octave_directory (const QString& dir) |
1058 | 1058 |
1059 m_current_directory_combo_box->insertItem (0, dir); | 1059 m_current_directory_combo_box->insertItem (0, dir); |
1060 m_current_directory_combo_box->setCurrentIndex (0); | 1060 m_current_directory_combo_box->setCurrentIndex (0); |
1061 } | 1061 } |
1062 | 1062 |
1063 void main_window::browse_for_directory (void) | 1063 void main_window::browse_for_directory () |
1064 { | 1064 { |
1065 // FIXME: Remove, if for all common KDE versions (bug #54607) is resolved. | 1065 // FIXME: Remove, if for all common KDE versions (bug #54607) is resolved. |
1066 int opts = QFileDialog::ShowDirsOnly; | 1066 int opts = QFileDialog::ShowDirsOnly; |
1067 | 1067 |
1068 gui_settings settings; | 1068 gui_settings settings; |
1100 interp.chdir (xdir.toStdString ()); | 1100 interp.chdir (xdir.toStdString ()); |
1101 }); | 1101 }); |
1102 } | 1102 } |
1103 } | 1103 } |
1104 | 1104 |
1105 void main_window::change_directory_up (void) | 1105 void main_window::change_directory_up () |
1106 { | 1106 { |
1107 set_current_working_directory (".."); | 1107 set_current_working_directory (".."); |
1108 } | 1108 } |
1109 | 1109 |
1110 // Slot that is called if return is pressed in the line edit of the | 1110 // Slot that is called if return is pressed in the line edit of the |
1111 // combobox to change to a new directory or a directory that is already | 1111 // combobox to change to a new directory or a directory that is already |
1112 // in the drop down list. | 1112 // in the drop down list. |
1113 | 1113 |
1114 void main_window::accept_directory_line_edit (void) | 1114 void main_window::accept_directory_line_edit () |
1115 { | 1115 { |
1116 // Get new directory name, and change to it if it is new. Otherwise, | 1116 // Get new directory name, and change to it if it is new. Otherwise, |
1117 // the combo box will trigger the "activated" signal to change to the | 1117 // the combo box will trigger the "activated" signal to change to the |
1118 // directory. | 1118 // directory. |
1119 | 1119 |
1132 emit execute_command_signal (command); | 1132 emit execute_command_signal (command); |
1133 } | 1133 } |
1134 else | 1134 else |
1135 { | 1135 { |
1136 emit interpreter_event | 1136 emit interpreter_event |
1137 ([=] (void) | 1137 ([=] () |
1138 { | 1138 { |
1139 // INTERPRETER THREAD | 1139 // INTERPRETER THREAD |
1140 | 1140 |
1141 std::string pending_input = command_editor::get_current_line (); | 1141 std::string pending_input = command_editor::get_current_line (); |
1142 | 1142 |
1193 }); | 1193 }); |
1194 | 1194 |
1195 focus_console_after_command (); | 1195 focus_console_after_command (); |
1196 } | 1196 } |
1197 | 1197 |
1198 void main_window::handle_new_figure_request (void) | 1198 void main_window::handle_new_figure_request () |
1199 { | 1199 { |
1200 emit interpreter_event | 1200 emit interpreter_event |
1201 ([] (interpreter& interp) | 1201 ([] (interpreter& interp) |
1202 { | 1202 { |
1203 // INTERPRETER THREAD | 1203 // INTERPRETER THREAD |
1205 Fbuiltin (interp, ovl ("figure")); | 1205 Fbuiltin (interp, ovl ("figure")); |
1206 Fdrawnow (interp); | 1206 Fdrawnow (interp); |
1207 }); | 1207 }); |
1208 } | 1208 } |
1209 | 1209 |
1210 void main_window::handle_enter_debugger (void) | 1210 void main_window::handle_enter_debugger () |
1211 { | 1211 { |
1212 setWindowTitle ("Octave (Debugging)"); | 1212 setWindowTitle ("Octave (Debugging)"); |
1213 | 1213 |
1214 m_debug_continue->setEnabled (true); | 1214 m_debug_continue->setEnabled (true); |
1215 m_debug_step_into->setEnabled (true); | 1215 m_debug_step_into->setEnabled (true); |
1216 m_debug_step_over->setEnabled (true); | 1216 m_debug_step_over->setEnabled (true); |
1217 m_debug_step_out->setEnabled (true); | 1217 m_debug_step_out->setEnabled (true); |
1218 m_debug_quit->setEnabled (true); | 1218 m_debug_quit->setEnabled (true); |
1219 } | 1219 } |
1220 | 1220 |
1221 void main_window::handle_exit_debugger (void) | 1221 void main_window::handle_exit_debugger () |
1222 { | 1222 { |
1223 setWindowTitle ("Octave"); | 1223 setWindowTitle ("Octave"); |
1224 | 1224 |
1225 m_debug_continue->setEnabled (false); | 1225 m_debug_continue->setEnabled (false); |
1226 m_debug_step_into->setEnabled (false); | 1226 m_debug_step_into->setEnabled (false); |
1227 m_debug_step_over->setEnabled (m_editor_has_tabs && m_editor_is_octave_file); | 1227 m_debug_step_over->setEnabled (m_editor_has_tabs && m_editor_is_octave_file); |
1228 m_debug_step_out->setEnabled (false); | 1228 m_debug_step_out->setEnabled (false); |
1229 m_debug_quit->setEnabled (false); | 1229 m_debug_quit->setEnabled (false); |
1230 } | 1230 } |
1231 | 1231 |
1232 void main_window::debug_continue (void) | 1232 void main_window::debug_continue () |
1233 { | 1233 { |
1234 emit interpreter_event | 1234 emit interpreter_event |
1235 ([=] (interpreter& interp) | 1235 ([=] (interpreter& interp) |
1236 { | 1236 { |
1237 // INTERPRETER THREAD | 1237 // INTERPRETER THREAD |
1241 | 1241 |
1242 command_editor::interrupt (true); | 1242 command_editor::interrupt (true); |
1243 }); | 1243 }); |
1244 } | 1244 } |
1245 | 1245 |
1246 void main_window::debug_step_into (void) | 1246 void main_window::debug_step_into () |
1247 { | 1247 { |
1248 emit interpreter_event | 1248 emit interpreter_event |
1249 ([=] (interpreter& interp) | 1249 ([=] (interpreter& interp) |
1250 { | 1250 { |
1251 // INTERPRETER THREAD | 1251 // INTERPRETER THREAD |
1255 | 1255 |
1256 command_editor::interrupt (true); | 1256 command_editor::interrupt (true); |
1257 }); | 1257 }); |
1258 } | 1258 } |
1259 | 1259 |
1260 void main_window::debug_step_over (void) | 1260 void main_window::debug_step_over () |
1261 { | 1261 { |
1262 if (m_debug_quit->isEnabled ()) | 1262 if (m_debug_quit->isEnabled ()) |
1263 { | 1263 { |
1264 // We are in debug mode, just call dbstep. | 1264 // We are in debug mode, just call dbstep. |
1265 | 1265 |
1280 // Not in debug mode: "step into" the current editor file | 1280 // Not in debug mode: "step into" the current editor file |
1281 emit step_into_file_signal (); | 1281 emit step_into_file_signal (); |
1282 } | 1282 } |
1283 } | 1283 } |
1284 | 1284 |
1285 void main_window::debug_step_out (void) | 1285 void main_window::debug_step_out () |
1286 { | 1286 { |
1287 emit interpreter_event | 1287 emit interpreter_event |
1288 ([=] (interpreter& interp) | 1288 ([=] (interpreter& interp) |
1289 { | 1289 { |
1290 // INTERPRETER THREAD | 1290 // INTERPRETER THREAD |
1294 | 1294 |
1295 command_editor::interrupt (true); | 1295 command_editor::interrupt (true); |
1296 }); | 1296 }); |
1297 } | 1297 } |
1298 | 1298 |
1299 void main_window::debug_quit (void) | 1299 void main_window::debug_quit () |
1300 { | 1300 { |
1301 emit interpreter_event | 1301 emit interpreter_event |
1302 ([] (interpreter& interp) | 1302 ([] (interpreter& interp) |
1303 { | 1303 { |
1304 // INTERPRETER THREAD | 1304 // INTERPRETER THREAD |
1313 // Functions related to file editing | 1313 // Functions related to file editing |
1314 // | 1314 // |
1315 // These are moved from editor to here for also using them when octave | 1315 // These are moved from editor to here for also using them when octave |
1316 // is built without qscintilla | 1316 // is built without qscintilla |
1317 // | 1317 // |
1318 void main_window::request_open_file (void) | 1318 void main_window::request_open_file () |
1319 { | 1319 { |
1320 // Open file isn't a file_editor_tab or editor function since the file | 1320 // Open file isn't a file_editor_tab or editor function since the file |
1321 // might be opened in an external editor. Hence, functionality is here. | 1321 // might be opened in an external editor. Hence, functionality is here. |
1322 | 1322 |
1323 gui_settings settings; | 1323 gui_settings settings; |
1381 // check whether new files are created without prompt | 1381 // check whether new files are created without prompt |
1382 if (! settings.bool_value (ed_create_new_file)) | 1382 if (! settings.bool_value (ed_create_new_file)) |
1383 { | 1383 { |
1384 // no, so enable this settings and wait for end of new file loading | 1384 // no, so enable this settings and wait for end of new file loading |
1385 settings.setValue (ed_create_new_file.settings_key (), true); | 1385 settings.setValue (ed_create_new_file.settings_key (), true); |
1386 connect (m_editor_window, SIGNAL (file_loaded_signal (void)), | 1386 connect (m_editor_window, SIGNAL (file_loaded_signal ()), |
1387 this, SLOT (restore_create_file_setting (void))); | 1387 this, SLOT (restore_create_file_setting ())); |
1388 } | 1388 } |
1389 // start the edit command | 1389 // start the edit command |
1390 execute_command_in_terminal ("edit " + new_name); | 1390 execute_command_in_terminal ("edit " + new_name); |
1391 } | 1391 } |
1392 } | 1392 } |
1535 | 1535 |
1536 if (cmd_focus) | 1536 if (cmd_focus) |
1537 focus_command_window (); | 1537 focus_command_window (); |
1538 } | 1538 } |
1539 | 1539 |
1540 void main_window::read_settings (void) | 1540 void main_window::read_settings () |
1541 { | 1541 { |
1542 gui_settings settings; | 1542 gui_settings settings; |
1543 | 1543 |
1544 set_window_layout (); | 1544 set_window_layout (); |
1545 | 1545 |
1551 } | 1551 } |
1552 | 1552 |
1553 emit settings_changed (); | 1553 emit settings_changed (); |
1554 } | 1554 } |
1555 | 1555 |
1556 void main_window::init_terminal_size (void) | 1556 void main_window::init_terminal_size () |
1557 { | 1557 { |
1558 emit init_terminal_size_signal (); | 1558 emit init_terminal_size_signal (); |
1559 } | 1559 } |
1560 | 1560 |
1561 void main_window::set_window_layout (void) | 1561 void main_window::set_window_layout () |
1562 { | 1562 { |
1563 gui_settings settings; | 1563 gui_settings settings; |
1564 | 1564 |
1565 // For resetting from some inconsistent state, first reset layout | 1565 // For resetting from some inconsistent state, first reset layout |
1566 // without saving or showing it | 1566 // without saving or showing it |
1653 } | 1653 } |
1654 | 1654 |
1655 show (); | 1655 show (); |
1656 } | 1656 } |
1657 | 1657 |
1658 void main_window::write_settings (void) | 1658 void main_window::write_settings () |
1659 { | 1659 { |
1660 gui_settings settings; | 1660 gui_settings settings; |
1661 | 1661 |
1662 settings.setValue (mw_geometry.settings_key (), saveGeometry ()); | 1662 settings.setValue (mw_geometry.settings_key (), saveGeometry ()); |
1663 settings.setValue (mw_state.settings_key (), saveState ()); | 1663 settings.setValue (mw_state.settings_key (), saveState ()); |
1669 } | 1669 } |
1670 settings.setValue (mw_dir_list.settings_key (), curr_dirs); | 1670 settings.setValue (mw_dir_list.settings_key (), curr_dirs); |
1671 settings.sync (); | 1671 settings.sync (); |
1672 } | 1672 } |
1673 | 1673 |
1674 void main_window::copyClipboard (void) | 1674 void main_window::copyClipboard () |
1675 { | 1675 { |
1676 if (m_current_directory_combo_box->hasFocus ()) | 1676 if (m_current_directory_combo_box->hasFocus ()) |
1677 { | 1677 { |
1678 QLineEdit *edit = m_current_directory_combo_box->lineEdit (); | 1678 QLineEdit *edit = m_current_directory_combo_box->lineEdit (); |
1679 if (edit && edit->hasSelectedText ()) | 1679 if (edit && edit->hasSelectedText ()) |
1684 } | 1684 } |
1685 else | 1685 else |
1686 emit copyClipboard_signal (); | 1686 emit copyClipboard_signal (); |
1687 } | 1687 } |
1688 | 1688 |
1689 void main_window::pasteClipboard (void) | 1689 void main_window::pasteClipboard () |
1690 { | 1690 { |
1691 if (m_current_directory_combo_box->hasFocus ()) | 1691 if (m_current_directory_combo_box->hasFocus ()) |
1692 { | 1692 { |
1693 QLineEdit *edit = m_current_directory_combo_box->lineEdit (); | 1693 QLineEdit *edit = m_current_directory_combo_box->lineEdit (); |
1694 QClipboard *clipboard = QApplication::clipboard (); | 1694 QClipboard *clipboard = QApplication::clipboard (); |
1700 } | 1700 } |
1701 else | 1701 else |
1702 emit pasteClipboard_signal (); | 1702 emit pasteClipboard_signal (); |
1703 } | 1703 } |
1704 | 1704 |
1705 void main_window::selectAll (void) | 1705 void main_window::selectAll () |
1706 { | 1706 { |
1707 if (m_current_directory_combo_box->hasFocus ()) | 1707 if (m_current_directory_combo_box->hasFocus ()) |
1708 { | 1708 { |
1709 QLineEdit *edit = m_current_directory_combo_box->lineEdit (); | 1709 QLineEdit *edit = m_current_directory_combo_box->lineEdit (); |
1710 if (edit) | 1710 if (edit) |
1729 else if (! status.compare ("off", Qt::CaseInsensitive)) | 1729 else if (! status.compare ("off", Qt::CaseInsensitive)) |
1730 handle_profiler_status_update (false); | 1730 handle_profiler_status_update (false); |
1731 } | 1731 } |
1732 } | 1732 } |
1733 | 1733 |
1734 void main_window::handle_octave_ready (void) | 1734 void main_window::handle_octave_ready () |
1735 { | 1735 { |
1736 // actions after the startup files are executed | 1736 // actions after the startup files are executed |
1737 | 1737 |
1738 gui_settings settings; | 1738 gui_settings settings; |
1739 | 1739 |
1809 | 1809 |
1810 m_command_window->init_command_prompt (); | 1810 m_command_window->init_command_prompt (); |
1811 focus_command_window (); // make sure that the command window has focus | 1811 focus_command_window (); // make sure that the command window has focus |
1812 } | 1812 } |
1813 | 1813 |
1814 void main_window::handle_set_path_dialog_request (void) | 1814 void main_window::handle_set_path_dialog_request () |
1815 { | 1815 { |
1816 if (m_set_path_dlg) // m_set_path_dlg is a guarded pointer! | 1816 if (m_set_path_dlg) // m_set_path_dlg is a guarded pointer! |
1817 return; | 1817 return; |
1818 | 1818 |
1819 m_set_path_dlg = new set_path_dialog (this); | 1819 m_set_path_dlg = new set_path_dialog (this); |
1878 } | 1878 } |
1879 | 1879 |
1880 void main_window::set_screen_size (int ht, int wd) | 1880 void main_window::set_screen_size (int ht, int wd) |
1881 { | 1881 { |
1882 emit interpreter_event | 1882 emit interpreter_event |
1883 ([=] (void) | 1883 ([=] () |
1884 { | 1884 { |
1885 // INTERPRETER THREAD | 1885 // INTERPRETER THREAD |
1886 | 1886 |
1887 command_editor::set_screen_size (ht, wd); | 1887 command_editor::set_screen_size (ht, wd); |
1888 }); | 1888 }); |
1889 } | 1889 } |
1890 | 1890 |
1891 void main_window::clipboard_has_changed (void) | 1891 void main_window::clipboard_has_changed () |
1892 { | 1892 { |
1893 if (m_clipboard->text ().isEmpty ()) | 1893 if (m_clipboard->text ().isEmpty ()) |
1894 { | 1894 { |
1895 m_paste_action->setEnabled (false); | 1895 m_paste_action->setEnabled (false); |
1896 m_clear_clipboard_action->setEnabled (false); | 1896 m_clear_clipboard_action->setEnabled (false); |
1900 m_paste_action->setEnabled (true); | 1900 m_paste_action->setEnabled (true); |
1901 m_clear_clipboard_action->setEnabled (true); | 1901 m_clear_clipboard_action->setEnabled (true); |
1902 } | 1902 } |
1903 } | 1903 } |
1904 | 1904 |
1905 void main_window::clear_clipboard (void) | 1905 void main_window::clear_clipboard () |
1906 { | 1906 { |
1907 m_clipboard->clear (QClipboard::Clipboard); | 1907 m_clipboard->clear (QClipboard::Clipboard); |
1908 } | 1908 } |
1909 | 1909 |
1910 void main_window::disable_menu_shortcuts (bool disable) | 1910 void main_window::disable_menu_shortcuts (bool disable) |
1916 i.key ()->setTitle (i.value ().at (disable)); | 1916 i.key ()->setTitle (i.value ().at (disable)); |
1917 ++i; | 1917 ++i; |
1918 } | 1918 } |
1919 } | 1919 } |
1920 | 1920 |
1921 void main_window::restore_create_file_setting (void) | 1921 void main_window::restore_create_file_setting () |
1922 { | 1922 { |
1923 // restore the new files creation setting | 1923 // restore the new files creation setting |
1924 | 1924 |
1925 gui_settings settings; | 1925 gui_settings settings; |
1926 | 1926 |
1927 settings.setValue (ed_create_new_file.settings_key (), false); | 1927 settings.setValue (ed_create_new_file.settings_key (), false); |
1928 disconnect (m_editor_window, SIGNAL (file_loaded_signal (void)), | 1928 disconnect (m_editor_window, SIGNAL (file_loaded_signal ()), |
1929 this, SLOT (restore_create_file_setting (void))); | 1929 this, SLOT (restore_create_file_setting ())); |
1930 } | 1930 } |
1931 | 1931 |
1932 void main_window::set_file_encoding (const QString& new_encoding) | 1932 void main_window::set_file_encoding (const QString& new_encoding) |
1933 { | 1933 { |
1934 m_file_encoding = new_encoding; | 1934 m_file_encoding = new_encoding; |
1941 { | 1941 { |
1942 for (int i = 0; i < open_file_names.count (); i++) | 1942 for (int i = 0; i < open_file_names.count (); i++) |
1943 emit open_file_signal (open_file_names.at (i), m_file_encoding, -1); | 1943 emit open_file_signal (open_file_names.at (i), m_file_encoding, -1); |
1944 } | 1944 } |
1945 | 1945 |
1946 void main_window::profiler_session (void) | 1946 void main_window::profiler_session () |
1947 { | 1947 { |
1948 emit interpreter_event | 1948 emit interpreter_event |
1949 ([=] (interpreter& interp) | 1949 ([=] (interpreter& interp) |
1950 { | 1950 { |
1951 // INTERPRETER THREAD | 1951 // INTERPRETER THREAD |
1952 | 1952 |
1953 Ffeval (interp, ovl ("profile","on")); | 1953 Ffeval (interp, ovl ("profile","on")); |
1954 }); | 1954 }); |
1955 } | 1955 } |
1956 | 1956 |
1957 void main_window::profiler_session_resume (void) | 1957 void main_window::profiler_session_resume () |
1958 { | 1958 { |
1959 emit interpreter_event | 1959 emit interpreter_event |
1960 ([=] (interpreter& interp) | 1960 ([=] (interpreter& interp) |
1961 { | 1961 { |
1962 // INTERPRETER THREAD | 1962 // INTERPRETER THREAD |
1963 | 1963 |
1964 Ffeval (interp, ovl ("profile","resume")); | 1964 Ffeval (interp, ovl ("profile","resume")); |
1965 }); | 1965 }); |
1966 } | 1966 } |
1967 | 1967 |
1968 void main_window::profiler_stop (void) | 1968 void main_window::profiler_stop () |
1969 { | 1969 { |
1970 emit interpreter_event | 1970 emit interpreter_event |
1971 ([=] (interpreter& interp) | 1971 ([=] (interpreter& interp) |
1972 { | 1972 { |
1973 // INTERPRETER THREAD | 1973 // INTERPRETER THREAD |
1986 if (active) | 1986 if (active) |
1987 state = led_indicator::LED_STATE_ACTIVE; | 1987 state = led_indicator::LED_STATE_ACTIVE; |
1988 m_profiler_status_indicator->set_state (state); | 1988 m_profiler_status_indicator->set_state (state); |
1989 } | 1989 } |
1990 | 1990 |
1991 void main_window::profiler_show (void) | 1991 void main_window::profiler_show () |
1992 { | 1992 { |
1993 // Do not use a separate interpreter event as in the other | 1993 // Do not use a separate interpreter event as in the other |
1994 // profiler slots since the output of the command "profshow" | 1994 // profiler slots since the output of the command "profshow" |
1995 // would obscure the prompt and we do not need to emimt a signal | 1995 // would obscure the prompt and we do not need to emimt a signal |
1996 // for action that is required in the gui after rhe command | 1996 // for action that is required in the gui after rhe command |
2028 } | 2028 } |
2029 else | 2029 else |
2030 e->ignore (); | 2030 e->ignore (); |
2031 } | 2031 } |
2032 | 2032 |
2033 void main_window::construct_central_widget (void) | 2033 void main_window::construct_central_widget () |
2034 { | 2034 { |
2035 // Create and set the central widget. QMainWindow takes ownership of | 2035 // Create and set the central widget. QMainWindow takes ownership of |
2036 // the widget (pointer) so there is no need to delete the object upon | 2036 // the widget (pointer) so there is no need to delete the object upon |
2037 // destroying this main_window. | 2037 // destroying this main_window. |
2038 | 2038 |
2044 setCentralWidget (dummyWidget); | 2044 setCentralWidget (dummyWidget); |
2045 } | 2045 } |
2046 | 2046 |
2047 // Main subroutine of the constructor | 2047 // Main subroutine of the constructor |
2048 | 2048 |
2049 void main_window::construct (void) | 2049 void main_window::construct () |
2050 { | 2050 { |
2051 setWindowIcon (QIcon (dw_icon_set_names["NONE"])); | 2051 setWindowIcon (QIcon (dw_icon_set_names["NONE"])); |
2052 | 2052 |
2053 interpreter_qobject *interp_qobj = m_octave_qobj.interpreter_qobj (); | 2053 interpreter_qobject *interp_qobj = m_octave_qobj.interpreter_qobj (); |
2054 | 2054 |
2091 &m_octave_qobj, QOverload<const meth_callback&>::of (&base_qobject::interpreter_event)); | 2091 &m_octave_qobj, QOverload<const meth_callback&>::of (&base_qobject::interpreter_event)); |
2092 | 2092 |
2093 configure_shortcuts (); | 2093 configure_shortcuts (); |
2094 } | 2094 } |
2095 | 2095 |
2096 void main_window::construct_octave_qt_link (void) | 2096 void main_window::construct_octave_qt_link () |
2097 { | 2097 { |
2098 interpreter_qobject *interp_qobj = m_octave_qobj.interpreter_qobj (); | 2098 interpreter_qobject *interp_qobj = m_octave_qobj.interpreter_qobj (); |
2099 | 2099 |
2100 qt_interpreter_events *qt_link = interp_qobj->qt_link (); | 2100 qt_interpreter_events *qt_link = interp_qobj->qt_link (); |
2101 | 2101 |
2168 m_hash_menu_text[menu] = QStringList ({ name, base_name }); | 2168 m_hash_menu_text[menu] = QStringList ({ name, base_name }); |
2169 | 2169 |
2170 return menu; | 2170 return menu; |
2171 } | 2171 } |
2172 | 2172 |
2173 void main_window::construct_menu_bar (void) | 2173 void main_window::construct_menu_bar () |
2174 { | 2174 { |
2175 QMenuBar *menu_bar = menuBar (); | 2175 QMenuBar *menu_bar = menuBar (); |
2176 | 2176 |
2177 construct_file_menu (menu_bar); | 2177 construct_file_menu (menu_bar); |
2178 | 2178 |
2213 | 2213 |
2214 gui_settings settings; | 2214 gui_settings settings; |
2215 | 2215 |
2216 m_open_action | 2216 m_open_action |
2217 = add_action (file_menu, settings.icon ("document-open"), tr ("Open..."), | 2217 = add_action (file_menu, settings.icon ("document-open"), tr ("Open..."), |
2218 SLOT (request_open_file (void)), this); | 2218 SLOT (request_open_file ()), this); |
2219 m_open_action->setToolTip (tr ("Open an existing file in editor")); | 2219 m_open_action->setToolTip (tr ("Open an existing file in editor")); |
2220 | 2220 |
2221 #if defined (HAVE_QSCINTILLA) | 2221 #if defined (HAVE_QSCINTILLA) |
2222 file_menu->addMenu (m_editor_window->get_mru_menu ()); | 2222 file_menu->addMenu (m_editor_window->get_mru_menu ()); |
2223 #endif | 2223 #endif |
2224 | 2224 |
2225 file_menu->addSeparator (); | 2225 file_menu->addSeparator (); |
2226 | 2226 |
2227 m_load_workspace_action | 2227 m_load_workspace_action |
2228 = add_action (file_menu, QIcon (), tr ("Load Workspace..."), | 2228 = add_action (file_menu, QIcon (), tr ("Load Workspace..."), |
2229 SLOT (handle_load_workspace_request (void)), this); | 2229 SLOT (handle_load_workspace_request ()), this); |
2230 | 2230 |
2231 m_save_workspace_action | 2231 m_save_workspace_action |
2232 = add_action (file_menu, QIcon (), tr ("Save Workspace As..."), | 2232 = add_action (file_menu, QIcon (), tr ("Save Workspace As..."), |
2233 SLOT (handle_save_workspace_request (void)), this); | 2233 SLOT (handle_save_workspace_request ()), this); |
2234 | 2234 |
2235 file_menu->addSeparator (); | 2235 file_menu->addSeparator (); |
2236 | 2236 |
2237 m_exit_action | 2237 m_exit_action |
2238 = add_action (file_menu, QIcon (), tr ("Exit"), | 2238 = add_action (file_menu, QIcon (), tr ("Exit"), |
2239 SLOT (close (void)), this); | 2239 SLOT (close ()), this); |
2240 m_exit_action->setMenuRole (QAction::QuitRole); | 2240 m_exit_action->setMenuRole (QAction::QuitRole); |
2241 | 2241 |
2242 // Connect signal related to opening or creating editor files | 2242 // Connect signal related to opening or creating editor files |
2243 connect (this, SIGNAL (new_file_signal (const QString&)), | 2243 connect (this, SIGNAL (new_file_signal (const QString&)), |
2244 m_active_editor, SLOT (request_new_file (const QString&))); | 2244 m_active_editor, SLOT (request_new_file (const QString&))); |
2258 | 2258 |
2259 gui_settings settings; | 2259 gui_settings settings; |
2260 | 2260 |
2261 m_new_script_action | 2261 m_new_script_action |
2262 = add_action (new_menu, settings.icon ("document-new"), tr ("New Script"), | 2262 = add_action (new_menu, settings.icon ("document-new"), tr ("New Script"), |
2263 SLOT (request_new_script (void)), this); | 2263 SLOT (request_new_script ()), this); |
2264 | 2264 |
2265 m_new_function_action | 2265 m_new_function_action |
2266 = add_action (new_menu, QIcon (), tr ("New Function..."), | 2266 = add_action (new_menu, QIcon (), tr ("New Function..."), |
2267 SLOT (request_new_function (void)), this); | 2267 SLOT (request_new_function ()), this); |
2268 | 2268 |
2269 m_new_figure_action | 2269 m_new_figure_action |
2270 = add_action (new_menu, QIcon (), tr ("New Figure"), | 2270 = add_action (new_menu, QIcon (), tr ("New Figure"), |
2271 SLOT (handle_new_figure_request (void)), this); | 2271 SLOT (handle_new_figure_request ()), this); |
2272 } | 2272 } |
2273 | 2273 |
2274 void main_window::construct_edit_menu (QMenuBar *p) | 2274 void main_window::construct_edit_menu (QMenuBar *p) |
2275 { | 2275 { |
2276 QMenu *edit_menu = m_add_menu (p, tr ("&Edit")); | 2276 QMenu *edit_menu = m_add_menu (p, tr ("&Edit")); |
2384 { | 2384 { |
2385 m_debug_menu = m_add_menu (p, tr ("De&bug")); | 2385 m_debug_menu = m_add_menu (p, tr ("De&bug")); |
2386 | 2386 |
2387 m_debug_step_over | 2387 m_debug_step_over |
2388 = construct_debug_menu_item ("db-step", tr ("Step"), | 2388 = construct_debug_menu_item ("db-step", tr ("Step"), |
2389 SLOT (debug_step_over (void))); | 2389 SLOT (debug_step_over ())); |
2390 | 2390 |
2391 m_debug_step_into | 2391 m_debug_step_into |
2392 = construct_debug_menu_item ("db-step-in", tr ("Step In"), | 2392 = construct_debug_menu_item ("db-step-in", tr ("Step In"), |
2393 SLOT (debug_step_into (void))); | 2393 SLOT (debug_step_into ())); |
2394 | 2394 |
2395 m_debug_step_out | 2395 m_debug_step_out |
2396 = construct_debug_menu_item ("db-step-out", tr ("Step Out"), | 2396 = construct_debug_menu_item ("db-step-out", tr ("Step Out"), |
2397 SLOT (debug_step_out (void))); | 2397 SLOT (debug_step_out ())); |
2398 | 2398 |
2399 m_debug_continue | 2399 m_debug_continue |
2400 = construct_debug_menu_item ("db-cont", tr ("Continue"), | 2400 = construct_debug_menu_item ("db-cont", tr ("Continue"), |
2401 SLOT (debug_continue (void))); | 2401 SLOT (debug_continue ())); |
2402 | 2402 |
2403 m_debug_menu->addSeparator (); | 2403 m_debug_menu->addSeparator (); |
2404 #if defined (HAVE_QSCINTILLA) | 2404 #if defined (HAVE_QSCINTILLA) |
2405 m_editor_window->debug_menu ()->addSeparator (); | 2405 m_editor_window->debug_menu ()->addSeparator (); |
2406 #endif | 2406 #endif |
2407 | 2407 |
2408 m_debug_quit | 2408 m_debug_quit |
2409 = construct_debug_menu_item ("db-stop", tr ("Quit Debug Mode"), | 2409 = construct_debug_menu_item ("db-stop", tr ("Quit Debug Mode"), |
2410 SLOT (debug_quit (void))); | 2410 SLOT (debug_quit ())); |
2411 } | 2411 } |
2412 | 2412 |
2413 void main_window::construct_tools_menu (QMenuBar *p) | 2413 void main_window::construct_tools_menu (QMenuBar *p) |
2414 { | 2414 { |
2415 QMenu *tools_menu = m_add_menu (p, tr ("&Tools")); | 2415 QMenu *tools_menu = m_add_menu (p, tr ("&Tools")); |
2459 action, SLOT (setChecked (bool))); | 2459 action, SLOT (setChecked (bool))); |
2460 } | 2460 } |
2461 else | 2461 else |
2462 { | 2462 { |
2463 // action for focus of dock widget | 2463 // action for focus of dock widget |
2464 connect (action, SIGNAL (triggered (void)), | 2464 connect (action, SIGNAL (triggered ()), |
2465 widget, SLOT (activate (void))); | 2465 widget, SLOT (activate ())); |
2466 } | 2466 } |
2467 } | 2467 } |
2468 else | 2468 else |
2469 { | 2469 { |
2470 action->setEnabled (false); | 2470 action->setEnabled (false); |
2522 (window_menu, tr ("Variable Editor"), false, m_variable_editor_window); | 2522 (window_menu, tr ("Variable Editor"), false, m_variable_editor_window); |
2523 | 2523 |
2524 window_menu->addSeparator (); | 2524 window_menu->addSeparator (); |
2525 | 2525 |
2526 m_previous_dock_action = add_action (window_menu, QIcon (), | 2526 m_previous_dock_action = add_action (window_menu, QIcon (), |
2527 tr ("Previous Widget"), SLOT (go_to_previous_widget (void))); | 2527 tr ("Previous Widget"), SLOT (go_to_previous_widget ())); |
2528 | 2528 |
2529 window_menu->addSeparator (); | 2529 window_menu->addSeparator (); |
2530 | 2530 |
2531 m_reset_windows_action = add_action (window_menu, QIcon (), | 2531 m_reset_windows_action = add_action (window_menu, QIcon (), |
2532 tr ("Reset Default Window Layout"), SLOT (reset_windows (void))); | 2532 tr ("Reset Default Window Layout"), SLOT (reset_windows ())); |
2533 } | 2533 } |
2534 | 2534 |
2535 void main_window::construct_help_menu (QMenuBar *p) | 2535 void main_window::construct_help_menu (QMenuBar *p) |
2536 { | 2536 { |
2537 QMenu *help_menu = m_add_menu (p, tr ("&Help")); | 2537 QMenu *help_menu = m_add_menu (p, tr ("&Help")); |
2588 }); | 2588 }); |
2589 addAction (m_current_news_action); | 2589 addAction (m_current_news_action); |
2590 m_current_news_action->setShortcutContext (Qt::ApplicationShortcut); | 2590 m_current_news_action->setShortcutContext (Qt::ApplicationShortcut); |
2591 } | 2591 } |
2592 | 2592 |
2593 void main_window::construct_tool_bar (void) | 2593 void main_window::construct_tool_bar () |
2594 { | 2594 { |
2595 m_main_tool_bar = addToolBar (tr ("Toolbar")); | 2595 m_main_tool_bar = addToolBar (tr ("Toolbar")); |
2596 m_main_tool_bar->setStyleSheet (m_main_tool_bar->styleSheet () | 2596 m_main_tool_bar->setStyleSheet (m_main_tool_bar->styleSheet () |
2597 + global_toolbar_style); | 2597 + global_toolbar_style); |
2598 | 2598 |
2648 | 2648 |
2649 connect (m_undo_action, &QAction::triggered, | 2649 connect (m_undo_action, &QAction::triggered, |
2650 this, &main_window::handle_undo_request); | 2650 this, &main_window::handle_undo_request); |
2651 } | 2651 } |
2652 | 2652 |
2653 void main_window::focus_console_after_command (void) | 2653 void main_window::focus_console_after_command () |
2654 { | 2654 { |
2655 gui_settings settings; | 2655 gui_settings settings; |
2656 | 2656 |
2657 if (settings.bool_value (cs_focus_cmd)) | 2657 if (settings.bool_value (cs_focus_cmd)) |
2658 focus_command_window (); | 2658 focus_command_window (); |
2659 } | 2659 } |
2660 | 2660 |
2661 void main_window::configure_shortcuts (void) | 2661 void main_window::configure_shortcuts () |
2662 { | 2662 { |
2663 gui_settings settings; | 2663 gui_settings settings; |
2664 | 2664 |
2665 bool enable | 2665 bool enable |
2666 = ! ((m_active_dock == m_command_window) && m_prevent_readline_conflicts); | 2666 = ! ((m_active_dock == m_command_window) && m_prevent_readline_conflicts); |
2731 // news menu | 2731 // news menu |
2732 settings.set_shortcut (m_release_notes_action, sc_main_news_release_notes, enable); | 2732 settings.set_shortcut (m_release_notes_action, sc_main_news_release_notes, enable); |
2733 settings.set_shortcut (m_current_news_action, sc_main_news_community_news, enable); | 2733 settings.set_shortcut (m_current_news_action, sc_main_news_community_news, enable); |
2734 } | 2734 } |
2735 | 2735 |
2736 QList<octave_dock_widget *> main_window::dock_widget_list (void) | 2736 QList<octave_dock_widget *> main_window::dock_widget_list () |
2737 { | 2737 { |
2738 QList<octave_dock_widget *> list = QList<octave_dock_widget *> (); | 2738 QList<octave_dock_widget *> list = QList<octave_dock_widget *> (); |
2739 list.append (static_cast<octave_dock_widget *> (m_command_window)); | 2739 list.append (static_cast<octave_dock_widget *> (m_command_window)); |
2740 list.append (static_cast<octave_dock_widget *> (m_history_window)); | 2740 list.append (static_cast<octave_dock_widget *> (m_history_window)); |
2741 list.append (static_cast<octave_dock_widget *> (m_file_browser_window)); | 2741 list.append (static_cast<octave_dock_widget *> (m_file_browser_window)); |
2781 | 2781 |
2782 move (0, 0); | 2782 move (0, 0); |
2783 resize (2*win_x/3, 7*win_y/8); | 2783 resize (2*win_x/3, 7*win_y/8); |
2784 } | 2784 } |
2785 | 2785 |
2786 void main_window::reset_windows (void) | 2786 void main_window::reset_windows () |
2787 { | 2787 { |
2788 // Slot for resetting the window layout to the default one | 2788 // Slot for resetting the window layout to the default one |
2789 hide (); | 2789 hide (); |
2790 showNormal (); // Unmaximize | 2790 showNormal (); // Unmaximize |
2791 do_reset_windows (true, true, true); // Add all widgets | 2791 do_reset_windows (true, true, true); // Add all widgets |