annotate libgui/qterminal/libqterminal/unix/QUnixTerminalImpl.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 818eef7b2618
children 1d1f02e0f6b4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15651
845cebf281aa Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
1 /* Copyright (C) 2008 e_k (e_k@users.sourceforge.net)
845cebf281aa Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
2 Copyright (C) 2012 Jacob Dawid <jacob.dawid@googlemail.com>
845cebf281aa Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
3
845cebf281aa Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
4 This library is free software; you can redistribute it and/or
845cebf281aa Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
5 modify it under the terms of the GNU Library General Public
845cebf281aa Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
6 License as published by the Free Software Foundation; either
845cebf281aa Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
7 version 2 of the License, or (at your option) any later version.
845cebf281aa Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
8
845cebf281aa Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
9 This library is distributed in the hope that it will be useful,
845cebf281aa Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
845cebf281aa Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
845cebf281aa Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
12 Library General Public License for more details.
845cebf281aa Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
13
845cebf281aa Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
14 You should have received a copy of the GNU Library General Public License
845cebf281aa Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
15 along with this library; see the file COPYING.LIB. If not, write to
845cebf281aa Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
845cebf281aa Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
17 Boston, MA 02110-1301, USA.
845cebf281aa Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
18 */
845cebf281aa Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
19
845cebf281aa Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
20
15658
eaa7da75d202 Added QTerminalInteface class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 15656
diff changeset
21 #ifndef Q_UNIXTERMINALIMPL
eaa7da75d202 Added QTerminalInteface class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 15656
diff changeset
22 #define Q_UNIXTERMINALIMPL
15651
845cebf281aa Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
23
845cebf281aa Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
24 #include <QtGui>
15653
35c891dce299 Removed INCLUDEPATH.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 15651
diff changeset
25 #include "unix/kpty.h"
35c891dce299 Removed INCLUDEPATH.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 15651
diff changeset
26 #include "unix/TerminalModel.h"
35c891dce299 Removed INCLUDEPATH.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 15651
diff changeset
27 #include "unix/TerminalView.h"
16639
ba808cd9d86c simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents: 16620
diff changeset
28 #include "QTerminal.h"
15651
845cebf281aa Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
29
16639
ba808cd9d86c simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents: 16620
diff changeset
30 class QUnixTerminalImpl : public QTerminal
15651
845cebf281aa Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
31 {
845cebf281aa Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
32 Q_OBJECT
16484
fa842e78f491 Restore STDERR stream pipe before exit to capture error messages.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15681
diff changeset
33
fa842e78f491 Restore STDERR stream pipe before exit to capture error messages.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15681
diff changeset
34 int fdstderr;
fa842e78f491 Restore STDERR stream pipe before exit to capture error messages.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15681
diff changeset
35
15651
845cebf281aa Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
36 public:
15658
eaa7da75d202 Added QTerminalInteface class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 15656
diff changeset
37 QUnixTerminalImpl(QWidget *parent = 0);
eaa7da75d202 Added QTerminalInteface class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 15656
diff changeset
38 virtual ~QUnixTerminalImpl();
16484
fa842e78f491 Restore STDERR stream pipe before exit to capture error messages.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15681
diff changeset
39
15662
5758e0013246 Enable compilation on Win32-native platform.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 15659
diff changeset
40 void setTerminalFont(const QFont &font);
15651
845cebf281aa Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
41 void setSize(int h, int v);
15662
5758e0013246 Enable compilation on Win32-native platform.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 15659
diff changeset
42 void sendText(const QString& text);
15651
845cebf281aa Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
43
15677
f620ecde2566 Added support for changing the cursor.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 15662
diff changeset
44 void setCursorType(CursorType type, bool blinking);
f620ecde2566 Added support for changing the cursor.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 15662
diff changeset
45
16620
818eef7b2618 allow terminal colors to be set from preferences dialog
John W. Eaton <jwe@octave.org>
parents: 16609
diff changeset
46 void setBackgroundColor (const QColor& color);
818eef7b2618 allow terminal colors to be set from preferences dialog
John W. Eaton <jwe@octave.org>
parents: 16609
diff changeset
47 void setForegroundColor (const QColor& color);
818eef7b2618 allow terminal colors to be set from preferences dialog
John W. Eaton <jwe@octave.org>
parents: 16609
diff changeset
48 void setSelectionColor (const QColor& color);
818eef7b2618 allow terminal colors to be set from preferences dialog
John W. Eaton <jwe@octave.org>
parents: 16609
diff changeset
49 void setCursorColor (bool useForegroundColor, const QColor& color);
818eef7b2618 allow terminal colors to be set from preferences dialog
John W. Eaton <jwe@octave.org>
parents: 16609
diff changeset
50
15651
845cebf281aa Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
51 public slots:
845cebf281aa Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
52 void copyClipboard();
845cebf281aa Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
53 void pasteClipboard();
16484
fa842e78f491 Restore STDERR stream pipe before exit to capture error messages.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15681
diff changeset
54
15651
845cebf281aa Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
55 protected:
845cebf281aa Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
56 void showEvent(QShowEvent *);
15658
eaa7da75d202 Added QTerminalInteface class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 15656
diff changeset
57 virtual void resizeEvent(QResizeEvent *);
16484
fa842e78f491 Restore STDERR stream pipe before exit to capture error messages.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15681
diff changeset
58
15651
845cebf281aa Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
59 private:
845cebf281aa Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
60 void initialize();
845cebf281aa Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
61 void connectToPty();
845cebf281aa Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
62
15659
739f0f73e772 Cleanup.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 15658
diff changeset
63 TerminalView *m_terminalView;
739f0f73e772 Cleanup.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 15658
diff changeset
64 TerminalModel *m_terminalModel;
15651
845cebf281aa Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
65 KPty *m_kpty;
845cebf281aa Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
66 };
845cebf281aa Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
67
15658
eaa7da75d202 Added QTerminalInteface class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 15656
diff changeset
68 #endif // Q_UNIXTERMINALIMPL