annotate libgui/src/command-widget.h @ 29525:d6b2d9f9e1e0

use terminal settings for the experimental command widget * QTerminal.cc (construct): do not connect settings signal here * command-widget.cc: include gui-preferences-cs.h, gui-preferences-global.h, and gui-utils.h; (command_widget): initialize class variable for input color, move input widget to the bottom, line edit gets focus proxy; (accept_input_line): style input and output text, (notice_settings): new function for reading terminal font and colors from the settings file * command-widget.h: include gui-settings.h, new slot notice:settings, new class variable for the input color * terminal-dock-widget.cc (terminal_dock_widget): connect main windows settings signal with the related slot in QTerminal or command_widget
author Torsten Lilge <ttl-octave@mailbox.org>
date Mon, 12 Apr 2021 23:03:11 +0200
parents 3bfec185c9e2
children 63c515ff762f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
29503
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1 ////////////////////////////////////////////////////////////////////////
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
diff changeset
2 //
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
diff changeset
3 // Copyright (C) 2021 The Octave Project Developers
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
diff changeset
4 //
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
diff changeset
5 // See the file COPYRIGHT.md in the top-level directory of this
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
diff changeset
6 // distribution or <https://octave.org/copyright/>.
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
diff changeset
7 //
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
diff changeset
8 // This file is part of Octave.
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
diff changeset
9 //
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
diff changeset
10 // Octave is free software: you can redistribute it and/or modify it
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
diff changeset
11 // under the terms of the GNU General Public License as published by
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
diff changeset
12 // the Free Software Foundation, either version 3 of the License, or
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
diff changeset
13 // (at your option) any later version.
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
diff changeset
14 //
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
diff changeset
15 // Octave is distributed in the hope that it will be useful, but
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
diff changeset
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
diff changeset
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
diff changeset
18 // GNU General Public License for more details.
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
diff changeset
19 //
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
diff changeset
20 // You should have received a copy of the GNU General Public License
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
diff changeset
21 // along with Octave; see the file COPYING. If not, see
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
diff changeset
22 // <https://www.gnu.org/licenses/>.
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
diff changeset
23 //
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
diff changeset
24 ////////////////////////////////////////////////////////////////////////
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
diff changeset
25
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
diff changeset
26 #if ! defined (octave_command_widget_h)
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
diff changeset
27 #define octave_command_widget_h 1
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
diff changeset
28
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
diff changeset
29 #include <QWidget>
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
diff changeset
30
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
diff changeset
31 #include "octave-qobject.h"
29525
d6b2d9f9e1e0 use terminal settings for the experimental command widget
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29503
diff changeset
32 #include "gui-settings.h"
29503
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
diff changeset
33
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
diff changeset
34 class QLabel;
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
diff changeset
35 class QLineEdit;
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
diff changeset
36 class QStrung;
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
diff changeset
37 class QTextBrowser;
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
diff changeset
38
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
diff changeset
39 namespace octave
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
diff changeset
40 {
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
diff changeset
41 class base_qobject;
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
diff changeset
42
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
diff changeset
43 class command_widget : public QWidget
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
diff changeset
44 {
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
diff changeset
45 Q_OBJECT
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
diff changeset
46
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
diff changeset
47 public:
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
diff changeset
48
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
diff changeset
49 command_widget (base_qobject& oct_qobj, QWidget *p);
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
diff changeset
50
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
diff changeset
51 signals:
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
diff changeset
52
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
diff changeset
53 void clear_line_edit (void);
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
diff changeset
54
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
diff changeset
55 void interpreter_event (const fcn_callback& fcn);
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
diff changeset
56 void interpreter_event (const meth_callback& meth);
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
diff changeset
57
29525
d6b2d9f9e1e0 use terminal settings for the experimental command widget
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29503
diff changeset
58 public slots:
d6b2d9f9e1e0 use terminal settings for the experimental command widget
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29503
diff changeset
59
d6b2d9f9e1e0 use terminal settings for the experimental command widget
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29503
diff changeset
60 void notice_settings (const gui_settings *settings);
d6b2d9f9e1e0 use terminal settings for the experimental command widget
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29503
diff changeset
61
29503
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
diff changeset
62 protected slots:
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
diff changeset
63
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
diff changeset
64 void accept_input_line (void);
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
diff changeset
65
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
diff changeset
66 void insert_interpreter_output (const QString& msg);
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
diff changeset
67
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
diff changeset
68 private:
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
diff changeset
69
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
diff changeset
70 bool m_incomplete_parse;
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
diff changeset
71 QLabel *m_prompt;
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
diff changeset
72 QLineEdit *m_line_edit;
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
diff changeset
73 QTextBrowser *m_output_display;
29525
d6b2d9f9e1e0 use terminal settings for the experimental command widget
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29503
diff changeset
74 QColor m_input_color;
29503
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
diff changeset
75 };
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
diff changeset
76 }
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
diff changeset
77
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
diff changeset
78 #endif