annotate libgui/src/octave-qt-link.cc @ 21724:aba2e6293dd8

use "#if ..." consistently instead of "#ifdef" and "#ifndef" * configure.ac, Doxyfile.in, make_int.cc, Backend.cc, BaseControl.cc, ButtonControl.cc, Canvas.cc, CheckBoxControl.cc, Container.cc, ContextMenu.cc, EditControl.cc, Figure.cc, FigureWindow.cc, GLCanvas.cc, KeyMap.cc, ListBoxControl.cc, Logger.cc, Menu.cc, MouseModeActionGroup.cc, Object.cc, ObjectFactory.cc, ObjectProxy.cc, Panel.cc, PopupMenuControl.cc, PushButtonControl.cc, PushTool.cc, QtHandlesUtils.cc, RadioButtonControl.cc, SliderControl.cc, TextControl.cc, TextEdit.cc, ToggleButtonControl.cc, ToggleTool.cc, ToolBar.cc, __init_qt__.cc, annotation-dialog.cc, gl-select.cc, module.mk, color-picker.cc, dialog.cc, documentation-dock-widget.cc, files-dock-widget.cc, find-files-dialog.cc, find-files-model.cc, history-dock-widget.cc, liboctgui-build-info.in.cc, file-editor-tab.cc, file-editor.cc, find-dialog.cc, marker.cc, marker.h, octave-qscintilla.cc, octave-txt-lexer.cc, main-window.cc, octave-cmd.cc, octave-dock-widget.cc, octave-gui.cc, octave-interpreter.cc, octave-qt-link.cc, parser.cc, webinfo.cc, resource-manager.cc, settings-dialog.cc, shortcut-manager.cc, terminal-dock-widget.cc, thread-manager.cc, welcome-wizard.cc, workspace-model.cc, workspace-view.cc, build-env.in.cc, Cell.cc, __contourc__.cc, __dispatch__.cc, __dsearchn__.cc, __ichol__.cc, __ilu__.cc, __lin_interpn__.cc, __luinc__.cc, __magick_read__.cc, __pchip_deriv__.cc, __qp__.cc, balance.cc, besselj.cc, betainc.cc, bitfcns.cc, bsxfun.cc, c-file-ptr-stream.cc, c-file-ptr-stream.h, cdisplay.c, cdisplay.h, cellfun.cc, coct-hdf5-types.c, colloc.cc, comment-list.cc, conv2.cc, daspk.cc, dasrt.cc, dassl.cc, data.cc, debug.cc, defaults.cc, defaults.in.h, defun.cc, det.cc, dirfns.cc, display.cc, dlmread.cc, dot.cc, dynamic-ld.cc, eig.cc, ellipj.cc, error.cc, errwarn.cc, event-queue.cc, fft.cc, fft2.cc, fftn.cc, file-io.cc, filter.cc, find.cc, ft-text-renderer.cc, gammainc.cc, gcd.cc, getgrent.cc, getpwent.cc, getrusage.cc, givens.cc, gl-render.cc, gl2ps-print.cc, graphics.cc, gripes.cc, hash.cc, help.cc, hess.cc, hex2num.cc, input.cc, inv.cc, jit-ir.cc, jit-ir.h, jit-typeinfo.cc, jit-typeinfo.h, jit-util.cc, jit-util.h, kron.cc, load-path.cc, load-save.cc, lookup.cc, ls-ascii-helper.cc, ls-hdf5.cc, ls-mat-ascii.cc, ls-mat4.cc, ls-mat5.cc, ls-oct-binary.cc, ls-oct-text.cc, ls-oct-text.h, ls-utils.cc, lsode.cc, lu.cc, mappers.cc, matrix_type.cc, max.cc, mex.cc, mex.h, mexproto.h, mgorth.cc, nproc.cc, oct-errno.in.cc, oct-fstrm.cc, oct-hdf5-types.cc, oct-hdf5-types.h, oct-hist.cc, oct-iostrm.cc, oct-lvalue.cc, oct-map.cc, oct-prcstrm.cc, oct-procbuf.cc, oct-stdstrm.h, oct-stream.cc, oct-strstrm.cc, oct-tex-lexer.in.ll, oct-tex-parser.in.yy, octave-link.cc, ordschur.cc, pager.cc, pinv.cc, pr-output.cc, procstream.cc, profiler.cc, psi.cc, pt-jit.cc, pt-jit.h, quad.cc, quadcc.cc, qz.cc, rand.cc, rcond.cc, regexp.cc, schur.cc, sighandlers.cc, sighandlers.h, siglist.c, siglist.h, sparse-xdiv.cc, sparse-xpow.cc, sparse.cc, spparms.cc, sqrtm.cc, str2double.cc, strfind.cc, strfns.cc, sub2ind.cc, svd.cc, sylvester.cc, symtab.cc, syscalls.cc, sysdep.cc, text-renderer.cc, time.cc, toplev.cc, tril.cc, tsearch.cc, txt-eng.cc, typecast.cc, urlwrite.cc, utils.cc, variables.cc, xdiv.cc, xgl2ps.c, xnorm.cc, xpow.cc, zfstream.cc, zfstream.h, __delaunayn__.cc, __eigs__.cc, __fltk_uigetfile__.cc, __glpk__.cc, __init_fltk__.cc, __init_gnuplot__.cc, __osmesa_print__.cc, __voronoi__.cc, amd.cc, audiodevinfo.cc, audioread.cc, ccolamd.cc, chol.cc, colamd.cc, convhulln.cc, dmperm.cc, fftw.cc, qr.cc, symbfact.cc, symrcm.cc, liboctinterp-build-info.in.cc, mkbuiltins, mkops, ov-base.cc, ov-bool-mat.cc, ov-bool-sparse.cc, ov-bool.cc, ov-builtin.cc, ov-cell.cc, ov-ch-mat.cc, ov-class.cc, ov-classdef.cc, ov-colon.cc, ov-complex.cc, ov-cs-list.cc, ov-cx-diag.cc, ov-cx-mat.cc, ov-cx-sparse.cc, ov-dld-fcn.cc, ov-fcn-handle.cc, ov-fcn-inline.cc, ov-fcn.cc, ov-float.cc, ov-flt-complex.cc, ov-flt-cx-diag.cc, ov-flt-cx-mat.cc, ov-flt-re-diag.cc, ov-flt-re-mat.cc, ov-int16.cc, ov-int32.cc, ov-int64.cc, ov-int8.cc, ov-java.cc, ov-lazy-idx.cc, ov-mex-fcn.cc, ov-null-mat.cc, ov-oncleanup.cc, ov-perm.cc, ov-range.cc, ov-re-diag.cc, ov-re-mat.cc, ov-re-sparse.cc, ov-scalar.cc, ov-str-mat.cc, ov-struct.cc, ov-typeinfo.cc, ov-uint16.cc, ov-uint32.cc, ov-uint64.cc, ov-uint8.cc, ov-usr-fcn.cc, ov-usr-fcn.h, ov.cc, ovl.cc, octave.cc, octave.h, op-b-b.cc, op-b-bm.cc, op-b-sbm.cc, op-bm-b.cc, op-bm-bm.cc, op-bm-sbm.cc, op-cdm-cdm.cc, op-cdm-cm.cc, op-cdm-dm.cc, op-cdm-m.cc, op-cell.cc, op-chm.cc, op-class.cc, op-cm-cdm.cc, op-cm-cm.cc, op-cm-cs.cc, op-cm-dm.cc, op-cm-m.cc, op-cm-s.cc, op-cm-scm.cc, op-cm-sm.cc, op-cs-cm.cc, op-cs-cs.cc, op-cs-m.cc, op-cs-s.cc, op-cs-scm.cc, op-cs-sm.cc, op-dm-cdm.cc, op-dm-cm.cc, op-dm-dm.cc, op-dm-m.cc, op-dm-scm.cc, op-dm-sm.cc, op-dm-template.cc, op-dms-template.cc, op-double-conv.cc, op-fcdm-fcdm.cc, op-fcdm-fcm.cc, op-fcdm-fdm.cc, op-fcdm-fm.cc, op-fcm-fcdm.cc, op-fcm-fcm.cc, op-fcm-fcs.cc, op-fcm-fdm.cc, op-fcm-fm.cc, op-fcm-fs.cc, op-fcn.cc, op-fcs-fcm.cc, op-fcs-fcs.cc, op-fcs-fm.cc, op-fcs-fs.cc, op-fdm-fcdm.cc, op-fdm-fcm.cc, op-fdm-fdm.cc, op-fdm-fm.cc, op-float-conv.cc, op-fm-fcdm.cc, op-fm-fcm.cc, op-fm-fcs.cc, op-fm-fdm.cc, op-fm-fm.cc, op-fm-fs.cc, op-fs-fcm.cc, op-fs-fcs.cc, op-fs-fm.cc, op-fs-fs.cc, op-i16-i16.cc, op-i32-i32.cc, op-i64-i64.cc, op-i8-i8.cc, op-int-concat.cc, op-int-conv.cc, op-m-cdm.cc, op-m-cm.cc, op-m-cs.cc, op-m-dm.cc, op-m-m.cc, op-m-s.cc, op-m-scm.cc, op-m-sm.cc, op-pm-pm.cc, op-pm-scm.cc, op-pm-sm.cc, op-pm-template.cc, op-range.cc, op-s-cm.cc, op-s-cs.cc, op-s-m.cc, op-s-s.cc, op-s-scm.cc, op-s-sm.cc, op-sbm-b.cc, op-sbm-bm.cc, op-sbm-sbm.cc, op-scm-cm.cc, op-scm-cs.cc, op-scm-m.cc, op-scm-s.cc, op-scm-scm.cc, op-scm-sm.cc, op-sm-cm.cc, op-sm-cs.cc, op-sm-m.cc, op-sm-s.cc, op-sm-scm.cc, op-sm-sm.cc, op-str-m.cc, op-str-s.cc, op-str-str.cc, op-struct.cc, op-ui16-ui16.cc, op-ui32-ui32.cc, op-ui64-ui64.cc, op-ui8-ui8.cc, lex.ll, oct-parse.in.yy, pt-arg-list.cc, pt-array-list.cc, pt-assign.cc, pt-binop.cc, pt-bp.cc, pt-cbinop.cc, pt-cell.cc, pt-check.cc, pt-classdef.cc, pt-cmd.cc, pt-colon.cc, pt-const.cc, pt-decl.cc, pt-eval.cc, pt-except.cc, pt-exp.cc, pt-fcn-handle.cc, pt-funcall.cc, pt-id.cc, pt-idx.cc, pt-jump.cc, pt-loop.cc, pt-loop.h, pt-mat.cc, pt-misc.cc, pt-pr-code.cc, pt-select.cc, pt-stmt.cc, pt-unop.cc, pt.cc, token.cc, Array-jit.cc, Array-tc.cc, version.cc, Array-C.cc, Array-b.cc, Array-ch.cc, Array-d.cc, Array-f.cc, Array-fC.cc, Array-i.cc, Array-idx-vec.cc, Array-s.cc, Array-str.cc, Array-util.cc, Array-voidp.cc, Array.cc, CColVector.cc, CDiagMatrix.cc, CMatrix.cc, CNDArray.cc, CRowVector.cc, CSparse.cc, MArray-C.cc, MArray-d.cc, MArray-f.cc, MArray-fC.cc, MArray-i.cc, MArray-s.cc, MSparse-C.cc, MSparse-d.cc, MatrixType.cc, PermMatrix.cc, Range.cc, Sparse-C.cc, Sparse-b.cc, Sparse-d.cc, boolMatrix.cc, boolNDArray.cc, boolSparse.cc, chMatrix.cc, chNDArray.cc, dColVector.cc, dDiagMatrix.cc, dMatrix.cc, dNDArray.cc, dRowVector.cc, dSparse.cc, dim-vector.cc, dim-vector.h, fCColVector.cc, fCDiagMatrix.cc, fCMatrix.cc, fCNDArray.cc, fCRowVector.cc, fColVector.cc, fDiagMatrix.cc, fMatrix.cc, fNDArray.cc, fRowVector.cc, idx-vector.cc, int16NDArray.cc, int32NDArray.cc, int64NDArray.cc, int8NDArray.cc, uint16NDArray.cc, uint32NDArray.cc, uint64NDArray.cc, uint8NDArray.cc, Faddeeva.cc, blaswrap.c, cquit.c, f77-extern.cc, f77-fcn.c, f77-fcn.h, lo-error.c, lo-error.h, quit.cc, quit.h, liboctave-build-info.in.cc, CollocWt.cc, DASPK.cc, DASRT.cc, DASSL.cc, EIG.cc, LSODE.cc, ODES.cc, Quad.cc, aepbalance.cc, chol.cc, eigs-base.cc, fEIG.cc, gepbalance.cc, hess.cc, lo-mappers.cc, lo-specfun.cc, lu.cc, oct-convn.cc, oct-fftw.cc, oct-norm.cc, oct-rand.cc, oct-spparms.cc, qr.cc, qrp.cc, randmtzig.cc, randpoisson.cc, schur.cc, sparse-chol.cc, sparse-dmsolve.cc, sparse-lu.cc, sparse-qr.cc, svd.cc, mk-ops.awk, mx-defs.h, dir-ops.cc, file-ops.cc, file-stat.cc, lo-sysdep.cc, mach-info.cc, oct-env.cc, oct-group.cc, oct-passwd.cc, oct-syscalls.cc, oct-time.cc, oct-uname.cc, pathlen.h, syswait.h, cmd-edit.cc, cmd-hist.cc, data-conv.cc, f2c-main.c, glob-match.cc, kpse.cc, lo-array-errwarn.cc, lo-array-gripes.cc, lo-cutils.c, lo-cutils.h, lo-ieee.cc, lo-ieee.h, lo-regexp.cc, lo-utils.cc, oct-base64.cc, oct-glob.cc, oct-inttypes.cc, oct-inttypes.h, oct-locbuf.cc, oct-mutex.cc, oct-rl-edit.c, oct-rl-edit.h, oct-rl-hist.c, oct-rl-hist.h, oct-shlib.cc, oct-sort.cc, pathsearch.cc, singleton-cleanup.cc, sparse-sort.cc, sparse-util.cc, statdefs.h, str-vec.cc, unwind-prot.cc, url-transfer.cc, acinclude.m4, display-available.c, display-available.h, main-cli.cc, main-gui.cc, main.in.cc, mkoctfile.in.cc, octave-build-info.in.cc, octave-config.in.cc, shared-fcns.h: Use "#if ..." consistently instead of "#ifdef" and "#ifndef".
author John W. Eaton <jwe@octave.org>
date Tue, 17 May 2016 12:09:30 -0400
parents efdf6424003a
children 6a1eded90355
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
16415
70032fc70bee move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1 /*
70032fc70bee move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
2
19697
4197fc428c7d maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents: 19596
diff changeset
3 Copyright (C) 2013-2015 John W. Eaton
4197fc428c7d maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents: 19596
diff changeset
4 Copyright (C) 2011-2015 Jacob Dawid
4197fc428c7d maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents: 19596
diff changeset
5 Copyright (C) 2011-2015 John P. Swensen
16415
70032fc70bee move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
6
70032fc70bee move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
7 This file is part of Octave.
70032fc70bee move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
8
70032fc70bee move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
9 Octave is free software; you can redistribute it and/or modify it
70032fc70bee move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
10 under the terms of the GNU General Public License as published by the
70032fc70bee move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
11 Free Software Foundation; either version 3 of the License, or (at your
70032fc70bee move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
12 option) any later version.
70032fc70bee move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
13
70032fc70bee move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
14 Octave is distributed in the hope that it will be useful, but WITHOUT
70032fc70bee move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
70032fc70bee move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
16 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
70032fc70bee move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
17 for more details.
70032fc70bee move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
18
70032fc70bee move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
19 You should have received a copy of the GNU General Public License
70032fc70bee move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
20 along with Octave; see the file COPYING. If not, see
70032fc70bee move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
21 <http://www.gnu.org/licenses/>.
70032fc70bee move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
22
70032fc70bee move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
23 */
70032fc70bee move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
24
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21717
diff changeset
25 #if defined (HAVE_CONFIG_H)
21301
40de9f8f23a6 Use '#include "config.h"' rather than <config.h>.
Rik <rik@octave.org>
parents: 21203
diff changeset
26 # include "config.h"
16415
70032fc70bee move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
27 #endif
70032fc70bee move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
28
16431
5982d469f79b use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents: 16426
diff changeset
29 #include <QStringList>
17884
766ad9be2966 Prompt for non-existent new file when using edit.m from GUI (bug #40450)
Torsten <ttl@justmail.de>
parents: 17824
diff changeset
30 #include <QDialog>
766ad9be2966 Prompt for non-existent new file when using edit.m from GUI (bug #40450)
Torsten <ttl@justmail.de>
parents: 17824
diff changeset
31 #include <QDir>
21158
65827e9cccb8 Gui support for enhancement of dbstop.
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21148
diff changeset
32 #include <QPushButton>
16431
5982d469f79b use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents: 16426
diff changeset
33
5982d469f79b use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents: 16426
diff changeset
34 #include "str-vec.h"
16512
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
35 #include "dialog.h"
16547
3cd80afc3509 improve debugging with the GUI
John W. Eaton <jwe@octave.org>
parents: 16528
diff changeset
36 #include "error.h"
16468
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16443
diff changeset
37 #include "workspace-element.h"
16635
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16581
diff changeset
38 #include "builtin-defun-decls.h"
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16581
diff changeset
39 #include "load-path.h"
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16581
diff changeset
40 #include "oct-env.h"
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16581
diff changeset
41 #include "utils.h"
16468
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16443
diff changeset
42
16415
70032fc70bee move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
43 #include "octave-qt-link.h"
70032fc70bee move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
44
17884
766ad9be2966 Prompt for non-existent new file when using edit.m from GUI (bug #40450)
Torsten <ttl@justmail.de>
parents: 17824
diff changeset
45 #include "resource-manager.h"
766ad9be2966 Prompt for non-existent new file when using edit.m from GUI (bug #40450)
Torsten <ttl@justmail.de>
parents: 17824
diff changeset
46
21311
718332a58d35 Fix left mouse button in editor margin bug from cset 65827e9cccb8
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21310
diff changeset
47 #include <unistd.h>
18309
024940bd5b77 gui: provide prefernces for the octave directory at startup
Torsten <ttl@justmail.de>
parents: 17920
diff changeset
48 octave_qt_link::octave_qt_link (QWidget *p)
17918
a38cee8f0a9b derive octave_main_thread from QObject, not QThread
John W. Eaton <jwe@octave.org>
parents: 17884
diff changeset
49 : octave_link (), main_thread (new QThread ()),
17919
b6d07dd90f3d rename octave_main_thread to octave_interpreter
John W. Eaton <jwe@octave.org>
parents: 17918
diff changeset
50 command_interpreter (new octave_interpreter ())
17918
a38cee8f0a9b derive octave_main_thread from QObject, not QThread
John W. Eaton <jwe@octave.org>
parents: 17884
diff changeset
51 {
20132
d7bea5b11fc3 only update file browser and dir selection box when on top-level (bug #44622)
Torsten <ttl@justmail.de>
parents: 20113
diff changeset
52 _current_directory = "";
d7bea5b11fc3 only update file browser and dir selection box when on top-level (bug #44622)
Torsten <ttl@justmail.de>
parents: 20113
diff changeset
53 _new_dir = true;
d7bea5b11fc3 only update file browser and dir selection box when on top-level (bug #44622)
Torsten <ttl@justmail.de>
parents: 20113
diff changeset
54
17918
a38cee8f0a9b derive octave_main_thread from QObject, not QThread
John W. Eaton <jwe@octave.org>
parents: 17884
diff changeset
55 connect (this, SIGNAL (execute_interpreter_signal (void)),
17919
b6d07dd90f3d rename octave_main_thread to octave_interpreter
John W. Eaton <jwe@octave.org>
parents: 17918
diff changeset
56 command_interpreter, SLOT (execute (void)));
17918
a38cee8f0a9b derive octave_main_thread from QObject, not QThread
John W. Eaton <jwe@octave.org>
parents: 17884
diff changeset
57
18309
024940bd5b77 gui: provide prefernces for the octave directory at startup
Torsten <ttl@justmail.de>
parents: 17920
diff changeset
58 connect (command_interpreter, SIGNAL (octave_ready_signal ()),
024940bd5b77 gui: provide prefernces for the octave directory at startup
Torsten <ttl@justmail.de>
parents: 17920
diff changeset
59 p, SLOT (handle_octave_ready ()));
024940bd5b77 gui: provide prefernces for the octave directory at startup
Torsten <ttl@justmail.de>
parents: 17920
diff changeset
60
17919
b6d07dd90f3d rename octave_main_thread to octave_interpreter
John W. Eaton <jwe@octave.org>
parents: 17918
diff changeset
61 command_interpreter->moveToThread (main_thread);
17918
a38cee8f0a9b derive octave_main_thread from QObject, not QThread
John W. Eaton <jwe@octave.org>
parents: 17884
diff changeset
62
a38cee8f0a9b derive octave_main_thread from QObject, not QThread
John W. Eaton <jwe@octave.org>
parents: 17884
diff changeset
63 main_thread->start ();
a38cee8f0a9b derive octave_main_thread from QObject, not QThread
John W. Eaton <jwe@octave.org>
parents: 17884
diff changeset
64 }
16479
7a71ea0b7ae9 eliminate event listener class
John W. Eaton <jwe@octave.org>
parents: 16468
diff changeset
65
21440
062c65569ad7 avoid some address-sanitizer leak warnings (bug #47372)
John W. Eaton <jwe@octave.org>
parents: 21311
diff changeset
66 octave_qt_link::~octave_qt_link (void)
062c65569ad7 avoid some address-sanitizer leak warnings (bug #47372)
John W. Eaton <jwe@octave.org>
parents: 21311
diff changeset
67 {
062c65569ad7 avoid some address-sanitizer leak warnings (bug #47372)
John W. Eaton <jwe@octave.org>
parents: 21311
diff changeset
68 delete command_interpreter;
062c65569ad7 avoid some address-sanitizer leak warnings (bug #47372)
John W. Eaton <jwe@octave.org>
parents: 21311
diff changeset
69 delete main_thread;
062c65569ad7 avoid some address-sanitizer leak warnings (bug #47372)
John W. Eaton <jwe@octave.org>
parents: 21311
diff changeset
70 }
16432
fe4cd846c3e7 separate octave interpreter thread creation from execution
John W. Eaton <jwe@octave.org>
parents: 16431
diff changeset
71
fe4cd846c3e7 separate octave interpreter thread creation from execution
John W. Eaton <jwe@octave.org>
parents: 16431
diff changeset
72 void
fe4cd846c3e7 separate octave interpreter thread creation from execution
John W. Eaton <jwe@octave.org>
parents: 16431
diff changeset
73 octave_qt_link::execute_interpreter (void)
fe4cd846c3e7 separate octave interpreter thread creation from execution
John W. Eaton <jwe@octave.org>
parents: 16431
diff changeset
74 {
17918
a38cee8f0a9b derive octave_main_thread from QObject, not QThread
John W. Eaton <jwe@octave.org>
parents: 17884
diff changeset
75 emit execute_interpreter_signal ();
16415
70032fc70bee move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
76 }
70032fc70bee move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
77
16443
7a2ee6ea7800 rename dbstop -> breakpoint in GUI interface functions
John W. Eaton <jwe@octave.org>
parents: 16438
diff changeset
78 bool
19714
21015ca26566 Restructure shutdown flow and behavior for improved robustness
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19697
diff changeset
79 octave_qt_link::do_confirm_shutdown (void)
21015ca26566 Restructure shutdown flow and behavior for improved robustness
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19697
diff changeset
80 {
20091
89d843d6de14 Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19970
diff changeset
81 // Lock the mutex before emitting signal.
89d843d6de14 Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19970
diff changeset
82 mutex.lock ();
89d843d6de14 Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19970
diff changeset
83
19714
21015ca26566 Restructure shutdown flow and behavior for improved robustness
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19697
diff changeset
84 emit confirm_shutdown_signal ();
21015ca26566 Restructure shutdown flow and behavior for improved robustness
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19697
diff changeset
85
21015ca26566 Restructure shutdown flow and behavior for improved robustness
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19697
diff changeset
86 // Wait while the GUI shuts down.
21015ca26566 Restructure shutdown flow and behavior for improved robustness
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19697
diff changeset
87 waitcondition.wait (&mutex);
21015ca26566 Restructure shutdown flow and behavior for improved robustness
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19697
diff changeset
88
20091
89d843d6de14 Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19970
diff changeset
89 // The GUI has sent a signal and the thread has been awakened.
89d843d6de14 Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19970
diff changeset
90
89d843d6de14 Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19970
diff changeset
91 mutex.unlock ();
89d843d6de14 Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19970
diff changeset
92
19714
21015ca26566 Restructure shutdown flow and behavior for improved robustness
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19697
diff changeset
93 return _shutdown_confirm_result;
21015ca26566 Restructure shutdown flow and behavior for improved robustness
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19697
diff changeset
94 }
21015ca26566 Restructure shutdown flow and behavior for improved robustness
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19697
diff changeset
95
21015ca26566 Restructure shutdown flow and behavior for improved robustness
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19697
diff changeset
96 bool
16485
8b783661e03f improve exit sequence for GUI
John W. Eaton <jwe@octave.org>
parents: 16479
diff changeset
97 octave_qt_link::do_exit (int status)
8b783661e03f improve exit sequence for GUI
John W. Eaton <jwe@octave.org>
parents: 16479
diff changeset
98 {
19714
21015ca26566 Restructure shutdown flow and behavior for improved robustness
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19697
diff changeset
99 emit exit_app_signal (status);
16485
8b783661e03f improve exit sequence for GUI
John W. Eaton <jwe@octave.org>
parents: 16479
diff changeset
100
19714
21015ca26566 Restructure shutdown flow and behavior for improved robustness
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19697
diff changeset
101 // Could wait for a while and then timeout, but for now just
21015ca26566 Restructure shutdown flow and behavior for improved robustness
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19697
diff changeset
102 // assume the GUI application exit will be without problems.
16485
8b783661e03f improve exit sequence for GUI
John W. Eaton <jwe@octave.org>
parents: 16479
diff changeset
103 return true;
8b783661e03f improve exit sequence for GUI
John W. Eaton <jwe@octave.org>
parents: 16479
diff changeset
104 }
8b783661e03f improve exit sequence for GUI
John W. Eaton <jwe@octave.org>
parents: 16479
diff changeset
105
8b783661e03f improve exit sequence for GUI
John W. Eaton <jwe@octave.org>
parents: 16479
diff changeset
106 bool
20113
c36f2b083613 make copying figures to clipboard work (bug #44866)
John W. Eaton <jwe@octave.org>
parents: 20091
diff changeset
107 octave_qt_link::do_copy_image_to_clipboard (const std::string& file)
c36f2b083613 make copying figures to clipboard work (bug #44866)
John W. Eaton <jwe@octave.org>
parents: 20091
diff changeset
108 {
c36f2b083613 make copying figures to clipboard work (bug #44866)
John W. Eaton <jwe@octave.org>
parents: 20091
diff changeset
109 emit copy_image_to_clipboard_signal (QString::fromStdString (file), true);
c36f2b083613 make copying figures to clipboard work (bug #44866)
John W. Eaton <jwe@octave.org>
parents: 20091
diff changeset
110
c36f2b083613 make copying figures to clipboard work (bug #44866)
John W. Eaton <jwe@octave.org>
parents: 20091
diff changeset
111 return true;
c36f2b083613 make copying figures to clipboard work (bug #44866)
John W. Eaton <jwe@octave.org>
parents: 20091
diff changeset
112 }
c36f2b083613 make copying figures to clipboard work (bug #44866)
John W. Eaton <jwe@octave.org>
parents: 20091
diff changeset
113
c36f2b083613 make copying figures to clipboard work (bug #44866)
John W. Eaton <jwe@octave.org>
parents: 20091
diff changeset
114 bool
16443
7a2ee6ea7800 rename dbstop -> breakpoint in GUI interface functions
John W. Eaton <jwe@octave.org>
parents: 16438
diff changeset
115 octave_qt_link::do_edit_file (const std::string& file)
7a2ee6ea7800 rename dbstop -> breakpoint in GUI interface functions
John W. Eaton <jwe@octave.org>
parents: 16438
diff changeset
116 {
7a2ee6ea7800 rename dbstop -> breakpoint in GUI interface functions
John W. Eaton <jwe@octave.org>
parents: 16438
diff changeset
117 emit edit_file_signal (QString::fromStdString (file));
7a2ee6ea7800 rename dbstop -> breakpoint in GUI interface functions
John W. Eaton <jwe@octave.org>
parents: 16438
diff changeset
118
7a2ee6ea7800 rename dbstop -> breakpoint in GUI interface functions
John W. Eaton <jwe@octave.org>
parents: 16438
diff changeset
119 return true;
7a2ee6ea7800 rename dbstop -> breakpoint in GUI interface functions
John W. Eaton <jwe@octave.org>
parents: 16438
diff changeset
120 }
7a2ee6ea7800 rename dbstop -> breakpoint in GUI interface functions
John W. Eaton <jwe@octave.org>
parents: 16438
diff changeset
121
17884
766ad9be2966 Prompt for non-existent new file when using edit.m from GUI (bug #40450)
Torsten <ttl@justmail.de>
parents: 17824
diff changeset
122 bool
766ad9be2966 Prompt for non-existent new file when using edit.m from GUI (bug #40450)
Torsten <ttl@justmail.de>
parents: 17824
diff changeset
123 octave_qt_link::do_prompt_new_edit_file (const std::string& file)
766ad9be2966 Prompt for non-existent new file when using edit.m from GUI (bug #40450)
Torsten <ttl@justmail.de>
parents: 17824
diff changeset
124 {
766ad9be2966 Prompt for non-existent new file when using edit.m from GUI (bug #40450)
Torsten <ttl@justmail.de>
parents: 17824
diff changeset
125 QSettings *settings = resource_manager::get_settings ();
766ad9be2966 Prompt for non-existent new file when using edit.m from GUI (bug #40450)
Torsten <ttl@justmail.de>
parents: 17824
diff changeset
126
766ad9be2966 Prompt for non-existent new file when using edit.m from GUI (bug #40450)
Torsten <ttl@justmail.de>
parents: 17824
diff changeset
127 if (settings->value ("editor/create_new_file",false).toBool ())
766ad9be2966 Prompt for non-existent new file when using edit.m from GUI (bug #40450)
Torsten <ttl@justmail.de>
parents: 17824
diff changeset
128 return true;
766ad9be2966 Prompt for non-existent new file when using edit.m from GUI (bug #40450)
Torsten <ttl@justmail.de>
parents: 17824
diff changeset
129
766ad9be2966 Prompt for non-existent new file when using edit.m from GUI (bug #40450)
Torsten <ttl@justmail.de>
parents: 17824
diff changeset
130 QFileInfo file_info (QString::fromStdString (file));
766ad9be2966 Prompt for non-existent new file when using edit.m from GUI (bug #40450)
Torsten <ttl@justmail.de>
parents: 17824
diff changeset
131 QStringList btn;
766ad9be2966 Prompt for non-existent new file when using edit.m from GUI (bug #40450)
Torsten <ttl@justmail.de>
parents: 17824
diff changeset
132 QStringList role;
19314
2b708273548d button order in dialog for creating a non-existing file (bug #43537)
Torsten <ttl@justmail.de>
parents: 18345
diff changeset
133 role << "YesRole" << "RejectRole";
2b708273548d button order in dialog for creating a non-existing file (bug #43537)
Torsten <ttl@justmail.de>
parents: 18345
diff changeset
134 btn << tr ("Create") << tr ("Cancel");
17884
766ad9be2966 Prompt for non-existent new file when using edit.m from GUI (bug #40450)
Torsten <ttl@justmail.de>
parents: 17824
diff changeset
135
20091
89d843d6de14 Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19970
diff changeset
136 // Lock mutex before signaling.
89d843d6de14 Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19970
diff changeset
137 uiwidget_creator.mutex.lock ();
89d843d6de14 Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19970
diff changeset
138
17884
766ad9be2966 Prompt for non-existent new file when using edit.m from GUI (bug #40450)
Torsten <ttl@justmail.de>
parents: 17824
diff changeset
139 uiwidget_creator.signal_dialog (
766ad9be2966 Prompt for non-existent new file when using edit.m from GUI (bug #40450)
Torsten <ttl@justmail.de>
parents: 17824
diff changeset
140 tr ("File\n%1\ndoes not exist. Do you want to create it?").
766ad9be2966 Prompt for non-existent new file when using edit.m from GUI (bug #40450)
Torsten <ttl@justmail.de>
parents: 17824
diff changeset
141 arg (QDir::currentPath () + QDir::separator ()
766ad9be2966 Prompt for non-existent new file when using edit.m from GUI (bug #40450)
Torsten <ttl@justmail.de>
parents: 17824
diff changeset
142 + QString::fromStdString (file)),
19314
2b708273548d button order in dialog for creating a non-existing file (bug #43537)
Torsten <ttl@justmail.de>
parents: 18345
diff changeset
143 tr ("Octave Editor"), "quest", btn, tr ("Create"), role );
17884
766ad9be2966 Prompt for non-existent new file when using edit.m from GUI (bug #40450)
Torsten <ttl@justmail.de>
parents: 17824
diff changeset
144
766ad9be2966 Prompt for non-existent new file when using edit.m from GUI (bug #40450)
Torsten <ttl@justmail.de>
parents: 17824
diff changeset
145 // Wait while the user is responding to message box.
20091
89d843d6de14 Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19970
diff changeset
146 uiwidget_creator.waitcondition.wait (&uiwidget_creator.mutex);
89d843d6de14 Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19970
diff changeset
147
89d843d6de14 Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19970
diff changeset
148 // The GUI has sent a signal and the thread has been awakened.
89d843d6de14 Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19970
diff changeset
149
17884
766ad9be2966 Prompt for non-existent new file when using edit.m from GUI (bug #40450)
Torsten <ttl@justmail.de>
parents: 17824
diff changeset
150 QString answer = uiwidget_creator.get_dialog_button ();
766ad9be2966 Prompt for non-existent new file when using edit.m from GUI (bug #40450)
Torsten <ttl@justmail.de>
parents: 17824
diff changeset
151
20091
89d843d6de14 Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19970
diff changeset
152 uiwidget_creator.mutex.unlock ();
89d843d6de14 Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19970
diff changeset
153
19314
2b708273548d button order in dialog for creating a non-existing file (bug #43537)
Torsten <ttl@justmail.de>
parents: 18345
diff changeset
154 return (answer == tr ("Create"));
17884
766ad9be2966 Prompt for non-existent new file when using edit.m from GUI (bug #40450)
Torsten <ttl@justmail.de>
parents: 17824
diff changeset
155 }
766ad9be2966 Prompt for non-existent new file when using edit.m from GUI (bug #40450)
Torsten <ttl@justmail.de>
parents: 17824
diff changeset
156
16512
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
157 int
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
158 octave_qt_link::do_message_dialog (const std::string& dlg,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
159 const std::string& msg,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
160 const std::string& title)
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
161 {
20091
89d843d6de14 Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19970
diff changeset
162 // Lock mutex before signaling.
89d843d6de14 Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19970
diff changeset
163 uiwidget_creator.mutex.lock ();
89d843d6de14 Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19970
diff changeset
164
16512
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
165 uiwidget_creator.signal_dialog (QString::fromStdString (msg),
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
166 QString::fromStdString (title),
16551
6ae555fc8c43 Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16547
diff changeset
167 QString::fromStdString (dlg),
6ae555fc8c43 Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16547
diff changeset
168 QStringList (), QString (),
6ae555fc8c43 Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16547
diff changeset
169 QStringList ());
16512
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
170
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
171 // Wait while the user is responding to message box.
20091
89d843d6de14 Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19970
diff changeset
172 uiwidget_creator.waitcondition.wait (&uiwidget_creator.mutex);
89d843d6de14 Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19970
diff changeset
173
89d843d6de14 Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19970
diff changeset
174 // The GUI has sent a signal and the thread has been awakened.
16512
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
175
20091
89d843d6de14 Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19970
diff changeset
176 int answer = uiwidget_creator.get_dialog_result ();
89d843d6de14 Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19970
diff changeset
177
89d843d6de14 Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19970
diff changeset
178 uiwidget_creator.mutex.unlock ();
89d843d6de14 Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19970
diff changeset
179
89d843d6de14 Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19970
diff changeset
180 return answer;
16512
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
181 }
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
182
16551
6ae555fc8c43 Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16547
diff changeset
183 std::string
6ae555fc8c43 Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16547
diff changeset
184 octave_qt_link::do_question_dialog (const std::string& msg,
6ae555fc8c43 Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16547
diff changeset
185 const std::string& title,
6ae555fc8c43 Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16547
diff changeset
186 const std::string& btn1,
6ae555fc8c43 Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16547
diff changeset
187 const std::string& btn2,
6ae555fc8c43 Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16547
diff changeset
188 const std::string& btn3,
6ae555fc8c43 Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16547
diff changeset
189 const std::string& btndef)
6ae555fc8c43 Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16547
diff changeset
190 {
6ae555fc8c43 Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16547
diff changeset
191 QStringList btn;
6ae555fc8c43 Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16547
diff changeset
192 QStringList role;
6ae555fc8c43 Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16547
diff changeset
193 role << "AcceptRole" << "AcceptRole" << "AcceptRole";
6ae555fc8c43 Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16547
diff changeset
194 btn << QString::fromStdString (btn1);
6ae555fc8c43 Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16547
diff changeset
195 if (btn2 == "")
6ae555fc8c43 Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16547
diff changeset
196 role.removeAt (0);
6ae555fc8c43 Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16547
diff changeset
197 else
6ae555fc8c43 Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16547
diff changeset
198 btn << QString::fromStdString (btn2);
6ae555fc8c43 Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16547
diff changeset
199 btn << QString::fromStdString (btn3);
6ae555fc8c43 Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16547
diff changeset
200
20091
89d843d6de14 Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19970
diff changeset
201 // Lock mutex before signaling.
89d843d6de14 Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19970
diff changeset
202 uiwidget_creator.mutex.lock ();
89d843d6de14 Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19970
diff changeset
203
16551
6ae555fc8c43 Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16547
diff changeset
204 uiwidget_creator.signal_dialog (QString::fromStdString (msg),
6ae555fc8c43 Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16547
diff changeset
205 QString::fromStdString (title),
6ae555fc8c43 Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16547
diff changeset
206 "quest",
6ae555fc8c43 Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16547
diff changeset
207 btn,
6ae555fc8c43 Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16547
diff changeset
208 QString::fromStdString (btndef),
6ae555fc8c43 Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16547
diff changeset
209 role);
6ae555fc8c43 Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16547
diff changeset
210
6ae555fc8c43 Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16547
diff changeset
211 // Wait while the user is responding to message box.
20091
89d843d6de14 Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19970
diff changeset
212 uiwidget_creator.waitcondition.wait (&uiwidget_creator.mutex);
89d843d6de14 Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19970
diff changeset
213
89d843d6de14 Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19970
diff changeset
214 // The GUI has sent a signal and the thread has been awakened.
16551
6ae555fc8c43 Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16547
diff changeset
215
20091
89d843d6de14 Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19970
diff changeset
216 std::string answer = uiwidget_creator.get_dialog_button ().toStdString ();
89d843d6de14 Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19970
diff changeset
217
89d843d6de14 Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19970
diff changeset
218 uiwidget_creator.mutex.unlock ();
89d843d6de14 Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19970
diff changeset
219
89d843d6de14 Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19970
diff changeset
220 return answer;
16551
6ae555fc8c43 Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16547
diff changeset
221 }
6ae555fc8c43 Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16547
diff changeset
222
16512
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
223 static QStringList
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
224 make_qstring_list (const std::list<std::string>& lst)
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
225 {
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
226 QStringList retval;
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
227
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
228 for (std::list<std::string>::const_iterator it = lst.begin ();
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
229 it != lst.end (); it++)
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
230 {
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
231 retval.append (QString::fromStdString (*it));
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
232 }
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
233
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
234 return retval;
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
235 }
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
236
16579
7f8db1942dc0 Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents: 16570
diff changeset
237 static QStringList
16580
adc150db1809 style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents: 16579
diff changeset
238 make_filter_list (const octave_link::filter_list& lst)
16579
7f8db1942dc0 Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents: 16570
diff changeset
239 {
7f8db1942dc0 Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents: 16570
diff changeset
240 QStringList retval;
7f8db1942dc0 Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents: 16570
diff changeset
241
16580
adc150db1809 style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents: 16579
diff changeset
242 // We have pairs of data, first being the list of extensions
adc150db1809 style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents: 16579
diff changeset
243 // exta;exb;extc etc second the name to use as filter name
adc150db1809 style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents: 16579
diff changeset
244 // (optional). Qt wants a a list of filters in the format of
adc150db1809 style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents: 16579
diff changeset
245 // 'FilterName (space separated exts)'.
16579
7f8db1942dc0 Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents: 16570
diff changeset
246
16580
adc150db1809 style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents: 16579
diff changeset
247 for (octave_link::filter_list::const_iterator it = lst.begin ();
16579
7f8db1942dc0 Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents: 16570
diff changeset
248 it != lst.end (); it++)
7f8db1942dc0 Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents: 16570
diff changeset
249 {
16580
adc150db1809 style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents: 16579
diff changeset
250 QString ext = QString::fromStdString (it->first);
adc150db1809 style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents: 16579
diff changeset
251 QString name = QString::fromStdString (it->second);
16579
7f8db1942dc0 Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents: 16570
diff changeset
252
16580
adc150db1809 style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents: 16579
diff changeset
253 // Strip out extensions from name and replace ';' with spaces in
adc150db1809 style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents: 16579
diff changeset
254 // list.
adc150db1809 style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents: 16579
diff changeset
255
adc150db1809 style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents: 16579
diff changeset
256 name.replace (QRegExp ("\\(.*\\)"), "");
adc150db1809 style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents: 16579
diff changeset
257 ext.replace (";", " ");
16579
7f8db1942dc0 Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents: 16570
diff changeset
258
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
259 if (name.length () == 0)
16579
7f8db1942dc0 Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents: 16570
diff changeset
260 {
16580
adc150db1809 style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents: 16579
diff changeset
261 // No name field. Build one from the extensions.
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
262 name = ext.toUpper () + " Files";
16579
7f8db1942dc0 Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents: 16570
diff changeset
263 }
7f8db1942dc0 Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents: 16570
diff changeset
264
7f8db1942dc0 Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents: 16570
diff changeset
265 retval.append (name + " (" + ext + ")");
7f8db1942dc0 Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents: 16570
diff changeset
266 }
7f8db1942dc0 Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents: 16570
diff changeset
267
7f8db1942dc0 Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents: 16570
diff changeset
268 return retval;
7f8db1942dc0 Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents: 16570
diff changeset
269 }
16512
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
270
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
271 std::pair<std::list<int>, int>
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
272 octave_qt_link::do_list_dialog (const std::list<std::string>& list,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
273 const std::string& mode,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
274 int width, int height,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
275 const std::list<int>& initial,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
276 const std::string& name,
16551
6ae555fc8c43 Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16547
diff changeset
277 const std::list<std::string>& prompt,
16512
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
278 const std::string& ok_string,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
279 const std::string& cancel_string)
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
280 {
20091
89d843d6de14 Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19970
diff changeset
281 // Lock mutex before signaling.
89d843d6de14 Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19970
diff changeset
282 uiwidget_creator.mutex.lock ();
89d843d6de14 Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19970
diff changeset
283
16512
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
284 uiwidget_creator.signal_listview (make_qstring_list (list),
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
285 QString::fromStdString (mode),
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
286 width, height,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
287 QList<int>::fromStdList (initial),
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
288 QString::fromStdString (name),
16551
6ae555fc8c43 Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16547
diff changeset
289 make_qstring_list (prompt),
16512
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
290 QString::fromStdString (ok_string),
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
291 QString::fromStdString (cancel_string));
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
292
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
293 // Wait while the user is responding to message box.
20091
89d843d6de14 Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19970
diff changeset
294 uiwidget_creator.waitcondition.wait (&uiwidget_creator.mutex);
16512
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
295
20091
89d843d6de14 Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19970
diff changeset
296 // The GUI has sent a signal and the thread has been awakened.
89d843d6de14 Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19970
diff changeset
297
16512
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
298 const QIntList *selected = uiwidget_creator.get_list_index ();
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
299 int ok = uiwidget_creator.get_dialog_result ();
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
300
20091
89d843d6de14 Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19970
diff changeset
301 uiwidget_creator.mutex.unlock ();
89d843d6de14 Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19970
diff changeset
302
16512
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
303 return std::pair<std::list<int>, int> (selected->toStdList (), ok);
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
304 }
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
305
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
306 std::list<std::string>
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
307 octave_qt_link::do_input_dialog (const std::list<std::string>& prompt,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
308 const std::string& title,
16551
6ae555fc8c43 Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16547
diff changeset
309 const std::list<float>& nr,
6ae555fc8c43 Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16547
diff changeset
310 const std::list<float>& nc,
16512
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
311 const std::list<std::string>& defaults)
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
312 {
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
313 std::list<std::string> retval;
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
314
20091
89d843d6de14 Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19970
diff changeset
315 // Lock mutex before signaling.
89d843d6de14 Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19970
diff changeset
316 uiwidget_creator.mutex.lock ();
89d843d6de14 Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19970
diff changeset
317
16512
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
318 uiwidget_creator.signal_inputlayout (make_qstring_list (prompt),
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
319 QString::fromStdString (title),
16551
6ae555fc8c43 Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16547
diff changeset
320 QFloatList::fromStdList (nr),
6ae555fc8c43 Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16547
diff changeset
321 QFloatList::fromStdList (nc),
16512
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
322 make_qstring_list (defaults));
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
323
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
324 // Wait while the user is responding to message box.
20091
89d843d6de14 Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19970
diff changeset
325 uiwidget_creator.waitcondition.wait (&uiwidget_creator.mutex);
89d843d6de14 Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19970
diff changeset
326
89d843d6de14 Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19970
diff changeset
327 // The GUI has sent a signal and the thread has been awakened.
16512
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
328
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
329 const QStringList *inputLine = uiwidget_creator.get_string_list ();
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
330
20091
89d843d6de14 Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19970
diff changeset
331 uiwidget_creator.mutex.unlock ();
89d843d6de14 Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19970
diff changeset
332
16512
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
333 for (QStringList::const_iterator it = inputLine->begin ();
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
334 it != inputLine->end (); it++)
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
335 {
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
336 retval.push_back (it->toStdString ());
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
337 }
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
338
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
339 return retval;
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
340 }
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
341
16579
7f8db1942dc0 Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents: 16570
diff changeset
342 std::list<std::string>
16580
adc150db1809 style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents: 16579
diff changeset
343 octave_qt_link::do_file_dialog (const filter_list& filter,
16579
7f8db1942dc0 Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents: 16570
diff changeset
344 const std::string& title,
7f8db1942dc0 Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents: 16570
diff changeset
345 const std::string& filename,
7f8db1942dc0 Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents: 16570
diff changeset
346 const std::string& dirname,
16581
fa4a035e0cf4 Add octave_link uiputfile implementation
John Donoghue <john.donoghue@ieee.org>
parents: 16580
diff changeset
347 const std::string& multimode)
16579
7f8db1942dc0 Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents: 16570
diff changeset
348 {
7f8db1942dc0 Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents: 16570
diff changeset
349 std::list<std::string> retval;
7f8db1942dc0 Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents: 16570
diff changeset
350
20091
89d843d6de14 Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19970
diff changeset
351 // Lock mutex before signaling.
89d843d6de14 Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19970
diff changeset
352 uiwidget_creator.mutex.lock ();
89d843d6de14 Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19970
diff changeset
353
16580
adc150db1809 style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents: 16579
diff changeset
354 uiwidget_creator.signal_filedialog (make_filter_list (filter),
adc150db1809 style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents: 16579
diff changeset
355 QString::fromStdString (title),
adc150db1809 style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents: 16579
diff changeset
356 QString::fromStdString (filename),
adc150db1809 style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents: 16579
diff changeset
357 QString::fromStdString (dirname),
16581
fa4a035e0cf4 Add octave_link uiputfile implementation
John Donoghue <john.donoghue@ieee.org>
parents: 16580
diff changeset
358 QString::fromStdString (multimode));
16579
7f8db1942dc0 Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents: 16570
diff changeset
359
7f8db1942dc0 Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents: 16570
diff changeset
360 // Wait while the user is responding to dialog.
20091
89d843d6de14 Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19970
diff changeset
361 uiwidget_creator.waitcondition.wait (&uiwidget_creator.mutex);
89d843d6de14 Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19970
diff changeset
362
89d843d6de14 Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19970
diff changeset
363 // The GUI has sent a signal and the thread has been awakened.
16579
7f8db1942dc0 Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents: 16570
diff changeset
364
16580
adc150db1809 style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents: 16579
diff changeset
365 // Add all the file dialog results to a string list.
16579
7f8db1942dc0 Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents: 16570
diff changeset
366 const QStringList *inputLine = uiwidget_creator.get_string_list ();
7f8db1942dc0 Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents: 16570
diff changeset
367
7f8db1942dc0 Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents: 16570
diff changeset
368 for (QStringList::const_iterator it = inputLine->begin ();
7f8db1942dc0 Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents: 16570
diff changeset
369 it != inputLine->end (); it++)
16580
adc150db1809 style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents: 16579
diff changeset
370 retval.push_back (it->toStdString ());
16579
7f8db1942dc0 Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents: 16570
diff changeset
371
7f8db1942dc0 Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents: 16570
diff changeset
372 retval.push_back (uiwidget_creator.get_dialog_path ()->toStdString ());
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
373 retval.push_back ((QString ("%1").arg (
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
374 uiwidget_creator.get_dialog_result ())).toStdString ());
16579
7f8db1942dc0 Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents: 16570
diff changeset
375
20091
89d843d6de14 Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19970
diff changeset
376 uiwidget_creator.mutex.unlock ();
89d843d6de14 Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19970
diff changeset
377
16579
7f8db1942dc0 Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents: 16570
diff changeset
378 return retval;
7f8db1942dc0 Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents: 16570
diff changeset
379 }
7f8db1942dc0 Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents: 16570
diff changeset
380
21158
65827e9cccb8 Gui support for enhancement of dbstop.
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21148
diff changeset
381 // Prompt to allow file to be run by setting cwd (or if addpath_option==true,
65827e9cccb8 Gui support for enhancement of dbstop.
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21148
diff changeset
382 // alternatively setting the path).
65827e9cccb8 Gui support for enhancement of dbstop.
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21148
diff changeset
383 // This uses a QMessageBox unlike other functions in this file,
65827e9cccb8 Gui support for enhancement of dbstop.
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21148
diff changeset
384 // because uiwidget_creator.waitcondition.wait hangs when called from
21578
683a1beee538 maint: Use "FIXME:" for all code blocks needing further attention.
Rik <rik@octave.org>
parents: 21440
diff changeset
385 // file_editor_tab::handle_context_menu_break_condition(). (FIXME: why hang?)
16547
3cd80afc3509 improve debugging with the GUI
John W. Eaton <jwe@octave.org>
parents: 16528
diff changeset
386 int
3cd80afc3509 improve debugging with the GUI
John W. Eaton <jwe@octave.org>
parents: 16528
diff changeset
387 octave_qt_link::do_debug_cd_or_addpath_error (const std::string& file,
3cd80afc3509 improve debugging with the GUI
John W. Eaton <jwe@octave.org>
parents: 16528
diff changeset
388 const std::string& dir,
3cd80afc3509 improve debugging with the GUI
John W. Eaton <jwe@octave.org>
parents: 16528
diff changeset
389 bool addpath_option)
3cd80afc3509 improve debugging with the GUI
John W. Eaton <jwe@octave.org>
parents: 16528
diff changeset
390 {
16565
e4b94abfeb96 use generic dialog for cd or addpath question
John W. Eaton <jwe@octave.org>
parents: 16551
diff changeset
391 int retval = -1;
e4b94abfeb96 use generic dialog for cd or addpath question
John W. Eaton <jwe@octave.org>
parents: 16551
diff changeset
392
e4b94abfeb96 use generic dialog for cd or addpath question
John W. Eaton <jwe@octave.org>
parents: 16551
diff changeset
393 QString qdir = QString::fromStdString (dir);
e4b94abfeb96 use generic dialog for cd or addpath question
John W. Eaton <jwe@octave.org>
parents: 16551
diff changeset
394 QString qfile = QString::fromStdString (file);
21311
718332a58d35 Fix left mouse button in editor margin bug from cset 65827e9cccb8
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21310
diff changeset
395 QString msg
718332a58d35 Fix left mouse button in editor margin bug from cset 65827e9cccb8
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21310
diff changeset
396 = (addpath_option
718332a58d35 Fix left mouse button in editor margin bug from cset 65827e9cccb8
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21310
diff changeset
397 ? tr ("The file %1 does not exist in the load path. To run or debug the function you are editing, you must either change to the directory %2 or add that directory to the load path.").arg (qfile).arg (qdir)
718332a58d35 Fix left mouse button in editor margin bug from cset 65827e9cccb8
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21310
diff changeset
398 : tr ("The file %1 is shadowed by a file with the same name in the load path. To run or debug the function you are editing, change to the directory %2.").arg (qfile).arg (qdir));
16565
e4b94abfeb96 use generic dialog for cd or addpath question
John W. Eaton <jwe@octave.org>
parents: 16551
diff changeset
399
21311
718332a58d35 Fix left mouse button in editor margin bug from cset 65827e9cccb8
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21310
diff changeset
400 QString title = tr ("Change Directory or Add Directory to Load Path");
16565
e4b94abfeb96 use generic dialog for cd or addpath question
John W. Eaton <jwe@octave.org>
parents: 16551
diff changeset
401
21311
718332a58d35 Fix left mouse button in editor margin bug from cset 65827e9cccb8
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21310
diff changeset
402 QString cd_txt = tr ("Change Directory");
718332a58d35 Fix left mouse button in editor margin bug from cset 65827e9cccb8
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21310
diff changeset
403 QString addpath_txt = tr ("Add Directory to Load Path");
718332a58d35 Fix left mouse button in editor margin bug from cset 65827e9cccb8
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21310
diff changeset
404 QString cancel_txt = tr ("Cancel");
16547
3cd80afc3509 improve debugging with the GUI
John W. Eaton <jwe@octave.org>
parents: 16528
diff changeset
405
21311
718332a58d35 Fix left mouse button in editor margin bug from cset 65827e9cccb8
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21310
diff changeset
406 QStringList btn;
718332a58d35 Fix left mouse button in editor margin bug from cset 65827e9cccb8
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21310
diff changeset
407 QStringList role;
718332a58d35 Fix left mouse button in editor margin bug from cset 65827e9cccb8
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21310
diff changeset
408 btn << cd_txt;
718332a58d35 Fix left mouse button in editor margin bug from cset 65827e9cccb8
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21310
diff changeset
409 role << "YesRole";
16565
e4b94abfeb96 use generic dialog for cd or addpath question
John W. Eaton <jwe@octave.org>
parents: 16551
diff changeset
410 if (addpath_option)
e4b94abfeb96 use generic dialog for cd or addpath question
John W. Eaton <jwe@octave.org>
parents: 16551
diff changeset
411 {
21311
718332a58d35 Fix left mouse button in editor margin bug from cset 65827e9cccb8
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21310
diff changeset
412 btn << addpath_txt;
718332a58d35 Fix left mouse button in editor margin bug from cset 65827e9cccb8
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21310
diff changeset
413 role << "AcceptRole";
718332a58d35 Fix left mouse button in editor margin bug from cset 65827e9cccb8
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21310
diff changeset
414 }
718332a58d35 Fix left mouse button in editor margin bug from cset 65827e9cccb8
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21310
diff changeset
415 btn << cancel_txt;
718332a58d35 Fix left mouse button in editor margin bug from cset 65827e9cccb8
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21310
diff changeset
416 role << "RejectRole";
718332a58d35 Fix left mouse button in editor margin bug from cset 65827e9cccb8
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21310
diff changeset
417
718332a58d35 Fix left mouse button in editor margin bug from cset 65827e9cccb8
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21310
diff changeset
418 // Lock mutex before signaling.
718332a58d35 Fix left mouse button in editor margin bug from cset 65827e9cccb8
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21310
diff changeset
419 uiwidget_creator.mutex.lock ();
718332a58d35 Fix left mouse button in editor margin bug from cset 65827e9cccb8
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21310
diff changeset
420
718332a58d35 Fix left mouse button in editor margin bug from cset 65827e9cccb8
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21310
diff changeset
421 uiwidget_creator.signal_dialog (msg, title, "quest", btn, cancel_txt, role);
16565
e4b94abfeb96 use generic dialog for cd or addpath question
John W. Eaton <jwe@octave.org>
parents: 16551
diff changeset
422
21311
718332a58d35 Fix left mouse button in editor margin bug from cset 65827e9cccb8
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21310
diff changeset
423 // Wait while the user is responding to message box.
718332a58d35 Fix left mouse button in editor margin bug from cset 65827e9cccb8
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21310
diff changeset
424 uiwidget_creator.waitcondition.wait (&uiwidget_creator.mutex);
718332a58d35 Fix left mouse button in editor margin bug from cset 65827e9cccb8
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21310
diff changeset
425
718332a58d35 Fix left mouse button in editor margin bug from cset 65827e9cccb8
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21310
diff changeset
426 // The GUI has sent a signal and the thread has been awakened.
16547
3cd80afc3509 improve debugging with the GUI
John W. Eaton <jwe@octave.org>
parents: 16528
diff changeset
427
21311
718332a58d35 Fix left mouse button in editor margin bug from cset 65827e9cccb8
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21310
diff changeset
428 QString result = uiwidget_creator.get_dialog_button ();
718332a58d35 Fix left mouse button in editor margin bug from cset 65827e9cccb8
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21310
diff changeset
429
718332a58d35 Fix left mouse button in editor margin bug from cset 65827e9cccb8
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21310
diff changeset
430 uiwidget_creator.mutex.unlock ();
718332a58d35 Fix left mouse button in editor margin bug from cset 65827e9cccb8
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21310
diff changeset
431
718332a58d35 Fix left mouse button in editor margin bug from cset 65827e9cccb8
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21310
diff changeset
432 if (result == cd_txt)
718332a58d35 Fix left mouse button in editor margin bug from cset 65827e9cccb8
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21310
diff changeset
433 retval = 1;
718332a58d35 Fix left mouse button in editor margin bug from cset 65827e9cccb8
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21310
diff changeset
434 else if (result == addpath_txt)
16565
e4b94abfeb96 use generic dialog for cd or addpath question
John W. Eaton <jwe@octave.org>
parents: 16551
diff changeset
435 retval = 2;
e4b94abfeb96 use generic dialog for cd or addpath question
John W. Eaton <jwe@octave.org>
parents: 16551
diff changeset
436
e4b94abfeb96 use generic dialog for cd or addpath question
John W. Eaton <jwe@octave.org>
parents: 16551
diff changeset
437 return retval;
16547
3cd80afc3509 improve debugging with the GUI
John W. Eaton <jwe@octave.org>
parents: 16528
diff changeset
438 }
3cd80afc3509 improve debugging with the GUI
John W. Eaton <jwe@octave.org>
parents: 16528
diff changeset
439
16415
70032fc70bee move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
440 void
16437
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
441 octave_qt_link::do_change_directory (const std::string& dir)
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
442 {
20132
d7bea5b11fc3 only update file browser and dir selection box when on top-level (bug #44622)
Torsten <ttl@justmail.de>
parents: 20113
diff changeset
443 _current_directory = QString::fromStdString (dir);
d7bea5b11fc3 only update file browser and dir selection box when on top-level (bug #44622)
Torsten <ttl@justmail.de>
parents: 20113
diff changeset
444 _new_dir = true;
d7bea5b11fc3 only update file browser and dir selection box when on top-level (bug #44622)
Torsten <ttl@justmail.de>
parents: 20113
diff changeset
445 }
d7bea5b11fc3 only update file browser and dir selection box when on top-level (bug #44622)
Torsten <ttl@justmail.de>
parents: 20113
diff changeset
446
d7bea5b11fc3 only update file browser and dir selection box when on top-level (bug #44622)
Torsten <ttl@justmail.de>
parents: 20113
diff changeset
447 void
d7bea5b11fc3 only update file browser and dir selection box when on top-level (bug #44622)
Torsten <ttl@justmail.de>
parents: 20113
diff changeset
448 octave_qt_link::update_directory ()
d7bea5b11fc3 only update file browser and dir selection box when on top-level (bug #44622)
Torsten <ttl@justmail.de>
parents: 20113
diff changeset
449 {
d7bea5b11fc3 only update file browser and dir selection box when on top-level (bug #44622)
Torsten <ttl@justmail.de>
parents: 20113
diff changeset
450 emit change_directory_signal (_current_directory);
d7bea5b11fc3 only update file browser and dir selection box when on top-level (bug #44622)
Torsten <ttl@justmail.de>
parents: 20113
diff changeset
451 _new_dir = false;
16437
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
452 }
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
453
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
454 void
16570
d5ae5aa80d42 preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
455 octave_qt_link::do_execute_command_in_terminal (const std::string& command)
d5ae5aa80d42 preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
456 {
d5ae5aa80d42 preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
457 emit execute_command_in_terminal_signal (QString::fromStdString (command));
d5ae5aa80d42 preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
458 }
d5ae5aa80d42 preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
459
d5ae5aa80d42 preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
460 void
20181
aa36fb998a4d maint: Remove unnecessary whitespace at end of lines.
Rik <rik@octave.org>
parents: 20136
diff changeset
461 octave_qt_link::do_set_workspace (bool top_level, bool debug,
16502
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16485
diff changeset
462 const std::list<workspace_element>& ws)
16415
70032fc70bee move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
463 {
19970
f7846f0ea6db GUI: enable workspace update when debugging (Bug #44455)
John Donoghue
parents: 19904
diff changeset
464 if (! top_level && ! debug)
19904
793230bb81d4 don't update workspace viewer unless at top level (bug #44156)
John W. Eaton <jwe@octave.org>
parents: 19714
diff changeset
465 return;
793230bb81d4 don't update workspace viewer unless at top level (bug #44156)
John W. Eaton <jwe@octave.org>
parents: 19714
diff changeset
466
20132
d7bea5b11fc3 only update file browser and dir selection box when on top-level (bug #44622)
Torsten <ttl@justmail.de>
parents: 20113
diff changeset
467 if (_new_dir)
d7bea5b11fc3 only update file browser and dir selection box when on top-level (bug #44622)
Torsten <ttl@justmail.de>
parents: 20113
diff changeset
468 update_directory ();
d7bea5b11fc3 only update file browser and dir selection box when on top-level (bug #44622)
Torsten <ttl@justmail.de>
parents: 20113
diff changeset
469
16468
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16443
diff changeset
470 QString scopes;
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16443
diff changeset
471 QStringList symbols;
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16443
diff changeset
472 QStringList class_names;
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16443
diff changeset
473 QStringList dimensions;
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16443
diff changeset
474 QStringList values;
17824
86e8dbccf7c7 show when variables are complex in workspace view (bug #40445)
John W. Eaton <jwe@octave.org>
parents: 17790
diff changeset
475 QIntList complex_flags;
16468
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16443
diff changeset
476
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16443
diff changeset
477 for (std::list<workspace_element>::const_iterator it = ws.begin ();
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16443
diff changeset
478 it != ws.end (); it++)
16415
70032fc70bee move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
479 {
16468
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16443
diff changeset
480 scopes.append (it->scope ());
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16443
diff changeset
481 symbols.append (QString::fromStdString (it->symbol ()));
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16443
diff changeset
482 class_names.append (QString::fromStdString (it->class_name ()));
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16443
diff changeset
483 dimensions.append (QString::fromStdString (it->dimension ()));
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16443
diff changeset
484 values.append (QString::fromStdString (it->value ()));
17824
86e8dbccf7c7 show when variables are complex in workspace view (bug #40445)
John W. Eaton <jwe@octave.org>
parents: 17790
diff changeset
485 complex_flags.append (it->complex_flag ());
16468
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16443
diff changeset
486 }
16415
70032fc70bee move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
487
19970
f7846f0ea6db GUI: enable workspace update when debugging (Bug #44455)
John Donoghue
parents: 19904
diff changeset
488 emit set_workspace_signal (top_level, debug, scopes, symbols, class_names,
17824
86e8dbccf7c7 show when variables are complex in workspace view (bug #40445)
John W. Eaton <jwe@octave.org>
parents: 17790
diff changeset
489 dimensions, values, complex_flags);
16468
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16443
diff changeset
490 }
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16443
diff changeset
491
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16443
diff changeset
492 void
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16443
diff changeset
493 octave_qt_link::do_clear_workspace (void)
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16443
diff changeset
494 {
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16443
diff changeset
495 emit clear_workspace_signal ();
16415
70032fc70bee move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
496 }
70032fc70bee move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
497
70032fc70bee move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
498 void
16431
5982d469f79b use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents: 16426
diff changeset
499 octave_qt_link::do_set_history (const string_vector& hist)
16415
70032fc70bee move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
500 {
16431
5982d469f79b use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents: 16426
diff changeset
501 QStringList qt_hist;
5982d469f79b use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents: 16426
diff changeset
502
20232
a9574e3c6e9e Deprecate Array::length() and Sparse::length() in favour of ::numel().
Carnë Draug <carandraug@octave.org>
parents: 20181
diff changeset
503 for (octave_idx_type i = 0; i < hist.numel (); i++)
16431
5982d469f79b use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents: 16426
diff changeset
504 qt_hist.append (QString::fromStdString (hist[i]));
5982d469f79b use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents: 16426
diff changeset
505
5982d469f79b use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents: 16426
diff changeset
506 emit set_history_signal (qt_hist);
5982d469f79b use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents: 16426
diff changeset
507 }
16415
70032fc70bee move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
508
16431
5982d469f79b use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents: 16426
diff changeset
509 void
5982d469f79b use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents: 16426
diff changeset
510 octave_qt_link::do_append_history (const std::string& hist_entry)
5982d469f79b use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents: 16426
diff changeset
511 {
5982d469f79b use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents: 16426
diff changeset
512 emit append_history_signal (QString::fromStdString (hist_entry));
5982d469f79b use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents: 16426
diff changeset
513 }
5982d469f79b use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents: 16426
diff changeset
514
5982d469f79b use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents: 16426
diff changeset
515 void
5982d469f79b use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents: 16426
diff changeset
516 octave_qt_link::do_clear_history (void)
5982d469f79b use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents: 16426
diff changeset
517 {
5982d469f79b use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents: 16426
diff changeset
518 emit clear_history_signal ();
16415
70032fc70bee move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
519 }
70032fc70bee move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
520
70032fc70bee move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
521 void
70032fc70bee move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
522 octave_qt_link::do_pre_input_event (void)
70032fc70bee move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
523 {
70032fc70bee move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
524 }
70032fc70bee move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
525
70032fc70bee move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
526 void
70032fc70bee move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
527 octave_qt_link::do_post_input_event (void)
70032fc70bee move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
528 {
70032fc70bee move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
529 }
70032fc70bee move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
530
70032fc70bee move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
531 void
16419
16bfbf9136d3 avoid creating unnecessary octave_value objects for octave_link calls
John W. Eaton <jwe@octave.org>
parents: 16415
diff changeset
532 octave_qt_link::do_enter_debugger_event (const std::string& file, int line)
16415
70032fc70bee move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
533 {
16419
16bfbf9136d3 avoid creating unnecessary octave_value objects for octave_link calls
John W. Eaton <jwe@octave.org>
parents: 16415
diff changeset
534 do_insert_debugger_pointer (file, line);
16438
a971d8bdaadc use signals instead of event queue for entering/leaving debug mode
John W. Eaton <jwe@octave.org>
parents: 16437
diff changeset
535
a971d8bdaadc use signals instead of event queue for entering/leaving debug mode
John W. Eaton <jwe@octave.org>
parents: 16437
diff changeset
536 emit enter_debugger_signal ();
16415
70032fc70bee move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
537 }
70032fc70bee move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
538
70032fc70bee move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
539 void
16438
a971d8bdaadc use signals instead of event queue for entering/leaving debug mode
John W. Eaton <jwe@octave.org>
parents: 16437
diff changeset
540 octave_qt_link::do_execute_in_debugger_event (const std::string& file, int line)
16415
70032fc70bee move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
541 {
16419
16bfbf9136d3 avoid creating unnecessary octave_value objects for octave_link calls
John W. Eaton <jwe@octave.org>
parents: 16415
diff changeset
542 do_delete_debugger_pointer (file, line);
16415
70032fc70bee move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
543 }
70032fc70bee move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
544
70032fc70bee move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
545 void
16438
a971d8bdaadc use signals instead of event queue for entering/leaving debug mode
John W. Eaton <jwe@octave.org>
parents: 16437
diff changeset
546 octave_qt_link::do_exit_debugger_event (void)
a971d8bdaadc use signals instead of event queue for entering/leaving debug mode
John W. Eaton <jwe@octave.org>
parents: 16437
diff changeset
547 {
a971d8bdaadc use signals instead of event queue for entering/leaving debug mode
John W. Eaton <jwe@octave.org>
parents: 16437
diff changeset
548 emit exit_debugger_signal ();
a971d8bdaadc use signals instead of event queue for entering/leaving debug mode
John W. Eaton <jwe@octave.org>
parents: 16437
diff changeset
549 }
a971d8bdaadc use signals instead of event queue for entering/leaving debug mode
John W. Eaton <jwe@octave.org>
parents: 16437
diff changeset
550
21158
65827e9cccb8 Gui support for enhancement of dbstop.
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21148
diff changeset
551 // Display (if @insert true) or remove the appropriate symbol for a breakpoint
65827e9cccb8 Gui support for enhancement of dbstop.
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21148
diff changeset
552 // in @file at @line with condition @cond.
16438
a971d8bdaadc use signals instead of event queue for entering/leaving debug mode
John W. Eaton <jwe@octave.org>
parents: 16437
diff changeset
553 void
16415
70032fc70bee move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
554 octave_qt_link::do_update_breakpoint (bool insert,
21158
65827e9cccb8 Gui support for enhancement of dbstop.
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21148
diff changeset
555 const std::string& file, int line,
65827e9cccb8 Gui support for enhancement of dbstop.
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21148
diff changeset
556 const std::string& cond)
16415
70032fc70bee move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
557 {
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
558 emit update_breakpoint_marker_signal (insert, QString::fromStdString (file),
21158
65827e9cccb8 Gui support for enhancement of dbstop.
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21148
diff changeset
559 line, QString::fromStdString (cond));
16415
70032fc70bee move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
560 }
16426
203976ae18d1 use signals for octave_link::enter_debugger_event and octave_link::exit_debugger_event
John W. Eaton <jwe@octave.org>
parents: 16424
diff changeset
561
203976ae18d1 use signals for octave_link::enter_debugger_event and octave_link::exit_debugger_event
John W. Eaton <jwe@octave.org>
parents: 16424
diff changeset
562 void
16528
9bc1f8278966 allow GUI to customize prompts at startup
John W. Eaton <jwe@octave.org>
parents: 16512
diff changeset
563 octave_qt_link::do_set_default_prompts (std::string& ps1, std::string& ps2,
9bc1f8278966 allow GUI to customize prompts at startup
John W. Eaton <jwe@octave.org>
parents: 16512
diff changeset
564 std::string& ps4)
9bc1f8278966 allow GUI to customize prompts at startup
John W. Eaton <jwe@octave.org>
parents: 16512
diff changeset
565 {
9bc1f8278966 allow GUI to customize prompts at startup
John W. Eaton <jwe@octave.org>
parents: 16512
diff changeset
566 ps1 = ">> ";
9bc1f8278966 allow GUI to customize prompts at startup
John W. Eaton <jwe@octave.org>
parents: 16512
diff changeset
567 ps2 = "";
9bc1f8278966 allow GUI to customize prompts at startup
John W. Eaton <jwe@octave.org>
parents: 16512
diff changeset
568 ps4 = "";
9bc1f8278966 allow GUI to customize prompts at startup
John W. Eaton <jwe@octave.org>
parents: 16512
diff changeset
569 }
9bc1f8278966 allow GUI to customize prompts at startup
John W. Eaton <jwe@octave.org>
parents: 16512
diff changeset
570
9bc1f8278966 allow GUI to customize prompts at startup
John W. Eaton <jwe@octave.org>
parents: 16512
diff changeset
571
9bc1f8278966 allow GUI to customize prompts at startup
John W. Eaton <jwe@octave.org>
parents: 16512
diff changeset
572 void
16426
203976ae18d1 use signals for octave_link::enter_debugger_event and octave_link::exit_debugger_event
John W. Eaton <jwe@octave.org>
parents: 16424
diff changeset
573 octave_qt_link::do_insert_debugger_pointer (const std::string& file, int line)
203976ae18d1 use signals for octave_link::enter_debugger_event and octave_link::exit_debugger_event
John W. Eaton <jwe@octave.org>
parents: 16424
diff changeset
574 {
203976ae18d1 use signals for octave_link::enter_debugger_event and octave_link::exit_debugger_event
John W. Eaton <jwe@octave.org>
parents: 16424
diff changeset
575 emit insert_debugger_pointer_signal (QString::fromStdString (file), line);
203976ae18d1 use signals for octave_link::enter_debugger_event and octave_link::exit_debugger_event
John W. Eaton <jwe@octave.org>
parents: 16424
diff changeset
576 }
203976ae18d1 use signals for octave_link::enter_debugger_event and octave_link::exit_debugger_event
John W. Eaton <jwe@octave.org>
parents: 16424
diff changeset
577
203976ae18d1 use signals for octave_link::enter_debugger_event and octave_link::exit_debugger_event
John W. Eaton <jwe@octave.org>
parents: 16424
diff changeset
578 void
203976ae18d1 use signals for octave_link::enter_debugger_event and octave_link::exit_debugger_event
John W. Eaton <jwe@octave.org>
parents: 16424
diff changeset
579 octave_qt_link::do_delete_debugger_pointer (const std::string& file, int line)
203976ae18d1 use signals for octave_link::enter_debugger_event and octave_link::exit_debugger_event
John W. Eaton <jwe@octave.org>
parents: 16424
diff changeset
580 {
203976ae18d1 use signals for octave_link::enter_debugger_event and octave_link::exit_debugger_event
John W. Eaton <jwe@octave.org>
parents: 16424
diff changeset
581 emit delete_debugger_pointer_signal (QString::fromStdString (file), line);
203976ae18d1 use signals for octave_link::enter_debugger_event and octave_link::exit_debugger_event
John W. Eaton <jwe@octave.org>
parents: 16424
diff changeset
582 }
16635
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16581
diff changeset
583
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16581
diff changeset
584
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16581
diff changeset
585 bool
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16581
diff changeset
586 octave_qt_link::file_in_path (const std::string& file, const std::string& dir)
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16581
diff changeset
587 {
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16581
diff changeset
588
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16581
diff changeset
589 bool ok = false;
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16581
diff changeset
590 bool addpath_option = true;
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16581
diff changeset
591
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16581
diff changeset
592 std::string curr_dir = octave_env::get_current_directory ();
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16581
diff changeset
593
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16581
diff changeset
594 if (same_file (curr_dir, dir))
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16581
diff changeset
595 ok = true;
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16581
diff changeset
596 else
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16581
diff changeset
597 {
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16581
diff changeset
598 bool dir_in_load_path = load_path::contains_canonical (dir);
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16581
diff changeset
599
21717
efdf6424003a Allow GUI to set breakpoints in @class/method (bug #41514).
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21578
diff changeset
600 // get base name, allowing "@class/method.m" (bug #41514)
efdf6424003a Allow GUI to set breakpoints in @class/method (bug #41514).
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21578
diff changeset
601 std::string base_file = (file.length () > dir.length ())
efdf6424003a Allow GUI to set breakpoints in @class/method (bug #41514).
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21578
diff changeset
602 ? file.substr (dir.length () + 1)
efdf6424003a Allow GUI to set breakpoints in @class/method (bug #41514).
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21578
diff changeset
603 : octave_env::base_pathname (file);
efdf6424003a Allow GUI to set breakpoints in @class/method (bug #41514).
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21578
diff changeset
604
16635
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16581
diff changeset
605 std::string lp_file = load_path::find_file (base_file);
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16581
diff changeset
606
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16581
diff changeset
607 if (dir_in_load_path)
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16581
diff changeset
608 {
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16581
diff changeset
609 if (same_file (lp_file, file))
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16581
diff changeset
610 ok = true;
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16581
diff changeset
611 }
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16581
diff changeset
612 else
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16581
diff changeset
613 {
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16581
diff changeset
614 // File directory is not in path. Is the file in the path in
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16581
diff changeset
615 // the current directory? If so, then changing the current
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16581
diff changeset
616 // directory will be needed. Adding directory to path is
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16581
diff changeset
617 // not enough because the file in the current directory would
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16581
diff changeset
618 // still be found.
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16581
diff changeset
619
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16581
diff changeset
620 if (same_file (lp_file, base_file))
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16581
diff changeset
621 {
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16581
diff changeset
622 if (same_file (curr_dir, dir))
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16581
diff changeset
623 ok = true;
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16581
diff changeset
624 else
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16581
diff changeset
625 addpath_option = false;
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16581
diff changeset
626 }
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16581
diff changeset
627 }
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16581
diff changeset
628 }
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16581
diff changeset
629
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16581
diff changeset
630 if (! ok)
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16581
diff changeset
631 {
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16581
diff changeset
632 int action = debug_cd_or_addpath_error (file, dir, addpath_option);
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16581
diff changeset
633 switch (action)
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16581
diff changeset
634 {
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16581
diff changeset
635 case 1:
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16581
diff changeset
636 Fcd (ovl (dir));
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16581
diff changeset
637 ok = true;
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16581
diff changeset
638 break;
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16581
diff changeset
639
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16581
diff changeset
640 case 2:
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16581
diff changeset
641 load_path::prepend (dir);
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16581
diff changeset
642 ok = true;
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16581
diff changeset
643 break;
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16581
diff changeset
644
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16581
diff changeset
645 default:
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16581
diff changeset
646 break;
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16581
diff changeset
647 }
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16581
diff changeset
648 }
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16581
diff changeset
649
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16581
diff changeset
650 return ok;
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16581
diff changeset
651 }
17010
c50ee84842a9 Add preferences and prefdir functions
John Donoghue <john.donoghue@ieee.org>
parents: 16658
diff changeset
652
c50ee84842a9 Add preferences and prefdir functions
John Donoghue <john.donoghue@ieee.org>
parents: 16658
diff changeset
653 void
c50ee84842a9 Add preferences and prefdir functions
John Donoghue <john.donoghue@ieee.org>
parents: 16658
diff changeset
654 octave_qt_link::do_show_preferences ()
c50ee84842a9 Add preferences and prefdir functions
John Donoghue <john.donoghue@ieee.org>
parents: 16658
diff changeset
655 {
c50ee84842a9 Add preferences and prefdir functions
John Donoghue <john.donoghue@ieee.org>
parents: 16658
diff changeset
656 emit show_preferences_signal ();
c50ee84842a9 Add preferences and prefdir functions
John Donoghue <john.donoghue@ieee.org>
parents: 16658
diff changeset
657 }
c50ee84842a9 Add preferences and prefdir functions
John Donoghue <john.donoghue@ieee.org>
parents: 16658
diff changeset
658
17029
359c5ca795cd Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents: 17010
diff changeset
659 void
359c5ca795cd Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents: 17010
diff changeset
660 octave_qt_link::do_show_doc (const std::string& file)
359c5ca795cd Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents: 17010
diff changeset
661 {
359c5ca795cd Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents: 17010
diff changeset
662 emit show_doc_signal (QString::fromStdString (file));
359c5ca795cd Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents: 17010
diff changeset
663 }
17010
c50ee84842a9 Add preferences and prefdir functions
John Donoghue <john.donoghue@ieee.org>
parents: 16658
diff changeset
664
17920
5c3f22dd0bbb raise SIGINT in octave_interpreter instead of in QTerminal
John W. Eaton <jwe@octave.org>
parents: 17919
diff changeset
665 void
5c3f22dd0bbb raise SIGINT in octave_interpreter instead of in QTerminal
John W. Eaton <jwe@octave.org>
parents: 17919
diff changeset
666 octave_qt_link::terminal_interrupt (void)
5c3f22dd0bbb raise SIGINT in octave_interpreter instead of in QTerminal
John W. Eaton <jwe@octave.org>
parents: 17919
diff changeset
667 {
19593
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 17920
diff changeset
668 command_interpreter->interrupt ();
17920
5c3f22dd0bbb raise SIGINT in octave_interpreter instead of in QTerminal
John W. Eaton <jwe@octave.org>
parents: 17919
diff changeset
669 }