Mercurial > octave
annotate libgui/qterminal/libqterminal/QTerminal.h @ 16641:64f9a3e301d3
don't store default values in resource manager class
* QTerminal.h, QTerminal.cc (QTerminal::default_colors,
QTerminal::color_names): New functions.
(QTerminal::notice_settings): Call default_colors.
* workspace-model.h, workspace-model.cc
(workspace_model::storage_class_default_colors,
workspace_model::storage_class_names): New functions.
* resource-manager.cc (resource_manager::storage_class_names,
resource_manager::storage_class_default_colors): Get values from
workspace_model.
(resource_manager::terminal_color_names,
resource_manager::terminal_default_colors): Get values from QTerminal.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Sun, 12 May 2013 16:17:48 -0400 |
parents | ba808cd9d86c |
children | b04413e5a811 |
rev | line source |
---|---|
15651
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
15650
diff
changeset
|
1 /* |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
15650
diff
changeset
|
2 |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
15650
diff
changeset
|
3 Copyright (C) 2012 Michael Goffioul. |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
15650
diff
changeset
|
4 Copyright (C) 2012 Jacob Dawid. |
15647
a044a259c423
Renamed SessionModel in TerminalModel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
15646
diff
changeset
|
5 |
15651
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
15650
diff
changeset
|
6 This file is part of QTerminal. |
15631 | 7 |
15651
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
15650
diff
changeset
|
8 Foobar is free software: you can redistribute it and/or modify |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
15650
diff
changeset
|
9 it under the terms of the GNU General Public License as published by |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
15650
diff
changeset
|
10 the Free Software Foundation, either version 3 of the License, or |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
15650
diff
changeset
|
11 (at your option) any later version. |
15631 | 12 |
15651
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
15650
diff
changeset
|
13 QTerminal is distributed in the hope that it will be useful, |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
15650
diff
changeset
|
14 but WITHOUT ANY WARRANTY; without even the implied warranty of |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
15650
diff
changeset
|
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
15650
diff
changeset
|
16 GNU General Public License for more details. |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
15650
diff
changeset
|
17 |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
15650
diff
changeset
|
18 You should have received a copy of the GNU General Public License |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
15650
diff
changeset
|
19 along with Foobar. If not, see <http://www.gnu.org/licenses/>. |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
15650
diff
changeset
|
20 |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
15650
diff
changeset
|
21 */ |
15631 | 22 |
15651
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
15650
diff
changeset
|
23 #ifndef QTERMINAL_H |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
15650
diff
changeset
|
24 #define QTERMINAL_H |
15649
c22fa57226b2
Fixed bug with ECHOCTL.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
15648
diff
changeset
|
25 |
16469
c89699ca005a
ensure QSettings is declared for QTerminal.h
John W. Eaton <jwe@octave.org>
parents:
16413
diff
changeset
|
26 #include <QSettings> |
15662
5758e0013246
Enable compilation on Win32-native platform.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
15658
diff
changeset
|
27 #include <QtGlobal> |
16639
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
28 #include <QWidget> |
16641
64f9a3e301d3
don't store default values in resource manager class
John W. Eaton <jwe@octave.org>
parents:
16639
diff
changeset
|
29 #include <QStringList> |
16639
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
30 #include <QColor> |
16641
64f9a3e301d3
don't store default values in resource manager class
John W. Eaton <jwe@octave.org>
parents:
16639
diff
changeset
|
31 #include <QList> |
16639
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
32 #include <QMenu> |
15662
5758e0013246
Enable compilation on Win32-native platform.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
15658
diff
changeset
|
33 |
16639
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
34 class QTerminal : public QWidget |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
35 { |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
36 Q_OBJECT |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
37 |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
38 public: |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
39 |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
40 static QTerminal *create (QWidget *xparent = 0); |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
41 |
16641
64f9a3e301d3
don't store default values in resource manager class
John W. Eaton <jwe@octave.org>
parents:
16639
diff
changeset
|
42 static QList<QColor> default_colors (void); |
64f9a3e301d3
don't store default values in resource manager class
John W. Eaton <jwe@octave.org>
parents:
16639
diff
changeset
|
43 |
64f9a3e301d3
don't store default values in resource manager class
John W. Eaton <jwe@octave.org>
parents:
16639
diff
changeset
|
44 static QStringList color_names (void); |
64f9a3e301d3
don't store default values in resource manager class
John W. Eaton <jwe@octave.org>
parents:
16639
diff
changeset
|
45 |
16639
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
46 virtual ~QTerminal (void) { } |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
47 |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
48 virtual void setTerminalFont(const QFont& font) = 0; |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
49 |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
50 virtual void setSize(int h, int v) = 0; |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
51 |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
52 virtual void sendText(const QString& text) = 0; |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
53 |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
54 enum CursorType |
15658
eaa7da75d202
Added QTerminalInteface class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
15652
diff
changeset
|
55 { |
16639
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
56 UnderlineCursor, |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
57 BlockCursor, |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
58 IBeamCursor |
15658
eaa7da75d202
Added QTerminalInteface class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
15652
diff
changeset
|
59 }; |
16639
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
60 |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
61 virtual void setCursorType (CursorType type, bool blinking) |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
62 { |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
63 // Provide empty default impl in order to avoid conflicts with the |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
64 // win impl. |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
65 |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
66 Q_UNUSED (type); |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
67 Q_UNUSED (blinking); |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
68 } |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
69 |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
70 virtual void setBackgroundColor (const QColor& color) = 0; |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
71 |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
72 virtual void setForegroundColor (const QColor& color) = 0; |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
73 |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
74 virtual void setSelectionColor (const QColor& color) = 0; |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
75 |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
76 virtual void setCursorColor (bool useForegroundColor, |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
77 const QColor& color) = 0; |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
78 |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
79 public slots: |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
80 |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
81 virtual void copyClipboard (void) = 0; |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
82 |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
83 virtual void pasteClipboard (void) = 0; |
16413
28136851099a
remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15894
diff
changeset
|
84 |
16639
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
85 virtual void handleCustomContextMenuRequested (const QPoint& at) |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
86 { |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
87 _contextMenu->move (mapToGlobal (at)); |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
88 _contextMenu->show (); |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
89 } |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
90 |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
91 void notice_settings (const QSettings *settings); |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
92 |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
93 protected: |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
94 |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
95 QTerminal (QWidget *xparent = 0) : QWidget (xparent) |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
96 { |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
97 connect (this, SIGNAL (customContextMenuRequested (QPoint)), |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
98 this, SLOT (handleCustomContextMenuRequested (QPoint))); |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
99 |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
100 setContextMenuPolicy (Qt::CustomContextMenu); |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
101 |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
102 _contextMenu = new QMenu (this); |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
103 |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
104 QAction *copyAction = _contextMenu->addAction ("Copy"); |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
105 QAction *pasteAction = _contextMenu->addAction ("Paste"); |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
106 |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
107 connect (copyAction, SIGNAL (triggered()), this, SLOT (copyClipboard())); |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
108 connect (pasteAction, SIGNAL (triggered()), this, SLOT (pasteClipboard())); |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
109 } |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
110 |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
111 private: |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
112 |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
113 QMenu *_contextMenu; |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
114 }; |
15631 | 115 |
15651
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
15650
diff
changeset
|
116 #endif // QTERMINAL_H |