Mercurial > octave-nkf
annotate libgui/qterminal/libqterminal/QTerminal.h @ 16639:ba808cd9d86c
simplify QTerminal inheritance scheme
* Qterminal.h, Qterminal.cc: Merge QTerminalInterface class into
QTerminal.
(QTerminal::create): New function.
(QTerminal::Qterminal): Now protected.
* QUnixTerminal.h, QUnixTerminal.cpp, QWinTerminal.h,
QWinTerminal.cpp: Derive from QTerminal, not QTerminalInterface.
* QTerminalInterface.h: Delete.
* libgui/qterminal-module.mk: Update file lists.
* terminal-dock-widget.cc
(terminal_dock_widget::terminal_dock_widget): Use QTerminal::create to
create terminal object.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Sun, 12 May 2013 15:23:14 -0400 |
parents | d5ae5aa80d42 |
children | 64f9a3e301d3 |
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> |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
29 #include <QColor> |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
30 #include <QMenu> |
15662
5758e0013246
Enable compilation on Win32-native platform.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
15658
diff
changeset
|
31 |
16639
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
32 class QTerminal : public QWidget |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
33 { |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
34 Q_OBJECT |
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 public: |
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 static QTerminal *create (QWidget *xparent = 0); |
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 virtual ~QTerminal (void) { } |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
41 |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
42 virtual void setTerminalFont(const QFont& font) = 0; |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
43 |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
44 virtual void setSize(int h, int v) = 0; |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
45 |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
46 virtual void sendText(const QString& text) = 0; |
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 enum CursorType |
15658
eaa7da75d202
Added QTerminalInteface class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
15652
diff
changeset
|
49 { |
16639
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
50 UnderlineCursor, |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
51 BlockCursor, |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
52 IBeamCursor |
15658
eaa7da75d202
Added QTerminalInteface class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
15652
diff
changeset
|
53 }; |
16639
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
54 |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
55 virtual void setCursorType (CursorType type, bool blinking) |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
56 { |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
57 // 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
|
58 // win impl. |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
59 |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
60 Q_UNUSED (type); |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
61 Q_UNUSED (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 |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
64 virtual void setBackgroundColor (const QColor& color) = 0; |
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 virtual void setForegroundColor (const QColor& color) = 0; |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
67 |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
68 virtual void setSelectionColor (const QColor& color) = 0; |
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 setCursorColor (bool useForegroundColor, |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
71 const QColor& color) = 0; |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
72 |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
73 public slots: |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
74 |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
75 virtual void copyClipboard (void) = 0; |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
76 |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
77 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
|
78 |
16639
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
79 virtual void handleCustomContextMenuRequested (const QPoint& at) |
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 _contextMenu->move (mapToGlobal (at)); |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
82 _contextMenu->show (); |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
83 } |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
84 |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
85 void notice_settings (const QSettings *settings); |
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 protected: |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
88 |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
89 QTerminal (QWidget *xparent = 0) : QWidget (xparent) |
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 connect (this, SIGNAL (customContextMenuRequested (QPoint)), |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
92 this, SLOT (handleCustomContextMenuRequested (QPoint))); |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
93 |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
94 setContextMenuPolicy (Qt::CustomContextMenu); |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
95 |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
96 _contextMenu = new QMenu (this); |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
97 |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
98 QAction *copyAction = _contextMenu->addAction ("Copy"); |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
99 QAction *pasteAction = _contextMenu->addAction ("Paste"); |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
100 |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
101 connect (copyAction, SIGNAL (triggered()), this, SLOT (copyClipboard())); |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
102 connect (pasteAction, SIGNAL (triggered()), this, SLOT (pasteClipboard())); |
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 |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
105 private: |
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 QMenu *_contextMenu; |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
108 }; |
15631 | 109 |
15651
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
15650
diff
changeset
|
110 #endif // QTERMINAL_H |