Mercurial > hg > octave-nkf
annotate libgui/qterminal/libqterminal/unix/QUnixTerminalImpl.cpp @ 16688:c19cc8c158b3
Allow setting background/forground terminal colors in Unix (bug #39016)
* libgui/qterminal/libqterminal/unix/QUnixTerminalImpl.cpp
(QUnixTerminalImpl::setBackgroundColor): Provided function body.
(QUnixTerminalImpl::setForegroundColor): Provided function body.
author | John Donoghue <john.donoghue@ieee.org> |
---|---|
date | Sat, 18 May 2013 23:00:19 -0400 |
parents | ba808cd9d86c |
children | 1d1f02e0f6b4 |
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. |
15659 | 8 |
15651
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. |
15659 | 13 |
15651
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 */ |
15659 | 19 |
15651
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
20 #include <QDebug> |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
21 |
15653
35c891dce299
Removed INCLUDEPATH.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
15652
diff
changeset
|
22 #include "unix/QUnixTerminalImpl.h" |
35c891dce299
Removed INCLUDEPATH.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
15652
diff
changeset
|
23 #include "unix/kpty.h" |
15651
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
24 |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
25 #include <termios.h> |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
26 |
15658
eaa7da75d202
Added QTerminalInteface class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
15656
diff
changeset
|
27 QUnixTerminalImpl::QUnixTerminalImpl(QWidget *parent) |
16639
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16620
diff
changeset
|
28 : QTerminal(parent) { |
15862
98902367c781
gui: smaller minimal size of the command widget (bug #37038)
Torsten <ttl@justmail.de>
parents:
15681
diff
changeset
|
29 setMinimumSize(300, 200); |
15651
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
30 initialize(); |
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 |
15658
eaa7da75d202
Added QTerminalInteface class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
15656
diff
changeset
|
33 void QUnixTerminalImpl::initialize() |
15651
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
34 { |
15659 | 35 m_terminalView = new TerminalView(this); |
15674
2318531b7880
Changed cursor to underline cursor.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15669
diff
changeset
|
36 m_terminalView->setKeyboardCursorShape(TerminalView::UnderlineCursor); |
15675
22bd268429d3
Cursor is now blinking in the terminal.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15674
diff
changeset
|
37 m_terminalView->setBlinkingCursor(true); |
15659 | 38 m_terminalView->setBellMode(TerminalView::NotifyBell); |
39 m_terminalView->setTerminalSizeHint(true); | |
15669
a8ff19a82906
Added copy&paste context menu in the unix implementation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
15662
diff
changeset
|
40 m_terminalView->setContextMenuPolicy(Qt::CustomContextMenu); |
15659 | 41 m_terminalView->setTripleClickMode(TerminalView::SelectWholeLine); |
42 m_terminalView->setTerminalSizeStartup(true); | |
43 m_terminalView->setSize(80, 40); | |
44 m_terminalView->setScrollBarPosition(TerminalView::ScrollBarRight); | |
45 | |
15669
a8ff19a82906
Added copy&paste context menu in the unix implementation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
15662
diff
changeset
|
46 connect(m_terminalView, SIGNAL(customContextMenuRequested(QPoint)), |
a8ff19a82906
Added copy&paste context menu in the unix implementation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
15662
diff
changeset
|
47 this, SLOT(handleCustomContextMenuRequested(QPoint))); |
a8ff19a82906
Added copy&paste context menu in the unix implementation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
15662
diff
changeset
|
48 |
15659 | 49 #ifdef Q_OS_MAC |
50 QFont font = QFont("Monaco"); | |
51 font.setStyleHint(QFont::TypeWriter); | |
52 font.setPointSize(11); | |
53 #else | |
54 QFont font = QFont("Monospace"); | |
55 font.setStyleHint(QFont::TypeWriter); | |
56 font.setPointSize(10); | |
57 #endif | |
58 setTerminalFont(font); | |
59 setFocusProxy(m_terminalView); | |
60 setFocus(Qt::OtherFocusReason); | |
61 | |
15651
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
62 m_kpty = new KPty(); |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
63 m_kpty->open(); |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
64 |
15659 | 65 m_terminalModel = new TerminalModel(m_kpty); |
66 m_terminalModel->setAutoClose(true); | |
67 m_terminalModel->setCodec(QTextCodec::codecForName("UTF-8")); | |
68 m_terminalModel->setHistoryType(HistoryTypeBuffer(1000)); | |
69 m_terminalModel->setDarkBackground(true); | |
70 m_terminalModel->setKeyBindings(""); | |
71 m_terminalModel->run(); | |
72 m_terminalModel->addView(m_terminalView); | |
15651
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
73 connectToPty(); |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
74 } |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
75 |
15658
eaa7da75d202
Added QTerminalInteface class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
15656
diff
changeset
|
76 void QUnixTerminalImpl::connectToPty() |
15651
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
77 { |
16484
fa842e78f491
Restore STDERR stream pipe before exit to capture error messages.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15862
diff
changeset
|
78 // Store the file descriptor associated with the STDERR stream onto |
fa842e78f491
Restore STDERR stream pipe before exit to capture error messages.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15862
diff
changeset
|
79 // another temporary file descriptor for reconnect in the destructor. |
fa842e78f491
Restore STDERR stream pipe before exit to capture error messages.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15862
diff
changeset
|
80 fdstderr = dup (STDERR_FILENO); |
fa842e78f491
Restore STDERR stream pipe before exit to capture error messages.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15862
diff
changeset
|
81 |
15651
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
82 int fds = m_kpty->slaveFd(); |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
83 |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
84 dup2 (fds, STDIN_FILENO); |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
85 dup2 (fds, STDOUT_FILENO); |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
86 dup2 (fds, STDERR_FILENO); |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
87 |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
88 if(!isatty(STDIN_FILENO)) { |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
89 qDebug("Error: stdin is not a tty."); |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
90 } |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
91 |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
92 if(!isatty(STDOUT_FILENO)) { |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
93 qDebug("Error: stdout is not a tty."); |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
94 } |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
95 |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
96 if(!isatty(STDERR_FILENO)) { |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
97 qDebug("Error: stderr is not a tty."); |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
98 } |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
99 } |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
100 |
15658
eaa7da75d202
Added QTerminalInteface class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
15656
diff
changeset
|
101 QUnixTerminalImpl::~QUnixTerminalImpl() |
15651
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
102 { |
16484
fa842e78f491
Restore STDERR stream pipe before exit to capture error messages.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15862
diff
changeset
|
103 // Restore stderr so that any errors at exit might appear somewhere. |
fa842e78f491
Restore STDERR stream pipe before exit to capture error messages.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15862
diff
changeset
|
104 dup2 (fdstderr, STDERR_FILENO); |
fa842e78f491
Restore STDERR stream pipe before exit to capture error messages.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15862
diff
changeset
|
105 |
15651
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
106 emit destroyed(); |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
107 } |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
108 |
15662
5758e0013246
Enable compilation on Win32-native platform.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
15659
diff
changeset
|
109 void QUnixTerminalImpl::setTerminalFont(const QFont &font) |
15651
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
110 { |
15659 | 111 if(!m_terminalView) |
112 return; | |
113 m_terminalView->setVTFont(font); | |
15651
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
114 } |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
115 |
15658
eaa7da75d202
Added QTerminalInteface class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
15656
diff
changeset
|
116 void QUnixTerminalImpl::setSize(int h, int v) |
15651
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
117 { |
15659 | 118 if(!m_terminalView) |
119 return; | |
120 m_terminalView->setSize(h, v); | |
15651
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
121 } |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
122 |
15662
5758e0013246
Enable compilation on Win32-native platform.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
15659
diff
changeset
|
123 void QUnixTerminalImpl::sendText(const QString& text) |
15656
c05926c0657d
Added sendText method again.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
15653
diff
changeset
|
124 { |
15659 | 125 m_terminalModel->sendText(text); |
15656
c05926c0657d
Added sendText method again.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
15653
diff
changeset
|
126 } |
c05926c0657d
Added sendText method again.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
15653
diff
changeset
|
127 |
15677
f620ecde2566
Added support for changing the cursor.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15675
diff
changeset
|
128 void QUnixTerminalImpl::setCursorType(CursorType type, bool blinking) |
f620ecde2566
Added support for changing the cursor.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15675
diff
changeset
|
129 { |
f620ecde2566
Added support for changing the cursor.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15675
diff
changeset
|
130 switch(type) { |
15680
6b1369106141
Fix error in setting the terminal cursor shape
Mike Miller <mtmiller@ieee.org>
parents:
15677
diff
changeset
|
131 case UnderlineCursor: m_terminalView->setKeyboardCursorShape(TerminalView::UnderlineCursor); break; |
6b1369106141
Fix error in setting the terminal cursor shape
Mike Miller <mtmiller@ieee.org>
parents:
15677
diff
changeset
|
132 case BlockCursor: m_terminalView->setKeyboardCursorShape(TerminalView::BlockCursor); break; |
6b1369106141
Fix error in setting the terminal cursor shape
Mike Miller <mtmiller@ieee.org>
parents:
15677
diff
changeset
|
133 case IBeamCursor: m_terminalView->setKeyboardCursorShape(TerminalView::IBeamCursor); break; |
15677
f620ecde2566
Added support for changing the cursor.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15675
diff
changeset
|
134 } |
f620ecde2566
Added support for changing the cursor.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15675
diff
changeset
|
135 m_terminalView->setBlinkingCursor(blinking); |
f620ecde2566
Added support for changing the cursor.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15675
diff
changeset
|
136 } |
f620ecde2566
Added support for changing the cursor.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15675
diff
changeset
|
137 |
16620
818eef7b2618
allow terminal colors to be set from preferences dialog
John W. Eaton <jwe@octave.org>
parents:
16609
diff
changeset
|
138 // FIXME -- not sure how to make these work properly given the way the |
818eef7b2618
allow terminal colors to be set from preferences dialog
John W. Eaton <jwe@octave.org>
parents:
16609
diff
changeset
|
139 // Unix terminal handles colors. |
16688
c19cc8c158b3
Allow setting background/forground terminal colors in Unix (bug #39016)
John Donoghue <john.donoghue@ieee.org>
parents:
16639
diff
changeset
|
140 void QUnixTerminalImpl::setBackgroundColor (const QColor& color) |
c19cc8c158b3
Allow setting background/forground terminal colors in Unix (bug #39016)
John Donoghue <john.donoghue@ieee.org>
parents:
16639
diff
changeset
|
141 { |
c19cc8c158b3
Allow setting background/forground terminal colors in Unix (bug #39016)
John Donoghue <john.donoghue@ieee.org>
parents:
16639
diff
changeset
|
142 ColorEntry cols[TABLE_COLORS]; |
c19cc8c158b3
Allow setting background/forground terminal colors in Unix (bug #39016)
John Donoghue <john.donoghue@ieee.org>
parents:
16639
diff
changeset
|
143 |
c19cc8c158b3
Allow setting background/forground terminal colors in Unix (bug #39016)
John Donoghue <john.donoghue@ieee.org>
parents:
16639
diff
changeset
|
144 const ColorEntry * curr_cols = m_terminalView->colorTable(); |
c19cc8c158b3
Allow setting background/forground terminal colors in Unix (bug #39016)
John Donoghue <john.donoghue@ieee.org>
parents:
16639
diff
changeset
|
145 for(int i=0;i<TABLE_COLORS;i++) |
c19cc8c158b3
Allow setting background/forground terminal colors in Unix (bug #39016)
John Donoghue <john.donoghue@ieee.org>
parents:
16639
diff
changeset
|
146 { |
c19cc8c158b3
Allow setting background/forground terminal colors in Unix (bug #39016)
John Donoghue <john.donoghue@ieee.org>
parents:
16639
diff
changeset
|
147 cols[i] = curr_cols[i]; |
c19cc8c158b3
Allow setting background/forground terminal colors in Unix (bug #39016)
John Donoghue <john.donoghue@ieee.org>
parents:
16639
diff
changeset
|
148 } |
c19cc8c158b3
Allow setting background/forground terminal colors in Unix (bug #39016)
John Donoghue <john.donoghue@ieee.org>
parents:
16639
diff
changeset
|
149 |
c19cc8c158b3
Allow setting background/forground terminal colors in Unix (bug #39016)
John Donoghue <john.donoghue@ieee.org>
parents:
16639
diff
changeset
|
150 cols[DEFAULT_BACK_COLOR].color = color; |
c19cc8c158b3
Allow setting background/forground terminal colors in Unix (bug #39016)
John Donoghue <john.donoghue@ieee.org>
parents:
16639
diff
changeset
|
151 |
c19cc8c158b3
Allow setting background/forground terminal colors in Unix (bug #39016)
John Donoghue <john.donoghue@ieee.org>
parents:
16639
diff
changeset
|
152 m_terminalView->setColorTable(cols); |
c19cc8c158b3
Allow setting background/forground terminal colors in Unix (bug #39016)
John Donoghue <john.donoghue@ieee.org>
parents:
16639
diff
changeset
|
153 |
c19cc8c158b3
Allow setting background/forground terminal colors in Unix (bug #39016)
John Donoghue <john.donoghue@ieee.org>
parents:
16639
diff
changeset
|
154 } |
c19cc8c158b3
Allow setting background/forground terminal colors in Unix (bug #39016)
John Donoghue <john.donoghue@ieee.org>
parents:
16639
diff
changeset
|
155 void QUnixTerminalImpl::setForegroundColor (const QColor& color) |
c19cc8c158b3
Allow setting background/forground terminal colors in Unix (bug #39016)
John Donoghue <john.donoghue@ieee.org>
parents:
16639
diff
changeset
|
156 { |
c19cc8c158b3
Allow setting background/forground terminal colors in Unix (bug #39016)
John Donoghue <john.donoghue@ieee.org>
parents:
16639
diff
changeset
|
157 ColorEntry cols[TABLE_COLORS]; |
c19cc8c158b3
Allow setting background/forground terminal colors in Unix (bug #39016)
John Donoghue <john.donoghue@ieee.org>
parents:
16639
diff
changeset
|
158 |
c19cc8c158b3
Allow setting background/forground terminal colors in Unix (bug #39016)
John Donoghue <john.donoghue@ieee.org>
parents:
16639
diff
changeset
|
159 const ColorEntry * curr_cols = m_terminalView->colorTable(); |
c19cc8c158b3
Allow setting background/forground terminal colors in Unix (bug #39016)
John Donoghue <john.donoghue@ieee.org>
parents:
16639
diff
changeset
|
160 for(int i=0;i<TABLE_COLORS;i++) |
c19cc8c158b3
Allow setting background/forground terminal colors in Unix (bug #39016)
John Donoghue <john.donoghue@ieee.org>
parents:
16639
diff
changeset
|
161 { |
c19cc8c158b3
Allow setting background/forground terminal colors in Unix (bug #39016)
John Donoghue <john.donoghue@ieee.org>
parents:
16639
diff
changeset
|
162 cols[i] = curr_cols[i]; |
c19cc8c158b3
Allow setting background/forground terminal colors in Unix (bug #39016)
John Donoghue <john.donoghue@ieee.org>
parents:
16639
diff
changeset
|
163 } |
c19cc8c158b3
Allow setting background/forground terminal colors in Unix (bug #39016)
John Donoghue <john.donoghue@ieee.org>
parents:
16639
diff
changeset
|
164 |
c19cc8c158b3
Allow setting background/forground terminal colors in Unix (bug #39016)
John Donoghue <john.donoghue@ieee.org>
parents:
16639
diff
changeset
|
165 cols[DEFAULT_FORE_COLOR].color = color; |
c19cc8c158b3
Allow setting background/forground terminal colors in Unix (bug #39016)
John Donoghue <john.donoghue@ieee.org>
parents:
16639
diff
changeset
|
166 |
c19cc8c158b3
Allow setting background/forground terminal colors in Unix (bug #39016)
John Donoghue <john.donoghue@ieee.org>
parents:
16639
diff
changeset
|
167 m_terminalView->setColorTable(cols); |
c19cc8c158b3
Allow setting background/forground terminal colors in Unix (bug #39016)
John Donoghue <john.donoghue@ieee.org>
parents:
16639
diff
changeset
|
168 |
c19cc8c158b3
Allow setting background/forground terminal colors in Unix (bug #39016)
John Donoghue <john.donoghue@ieee.org>
parents:
16639
diff
changeset
|
169 |
c19cc8c158b3
Allow setting background/forground terminal colors in Unix (bug #39016)
John Donoghue <john.donoghue@ieee.org>
parents:
16639
diff
changeset
|
170 } |
16620
818eef7b2618
allow terminal colors to be set from preferences dialog
John W. Eaton <jwe@octave.org>
parents:
16609
diff
changeset
|
171 void QUnixTerminalImpl::setSelectionColor (const QColor& color) { } |
818eef7b2618
allow terminal colors to be set from preferences dialog
John W. Eaton <jwe@octave.org>
parents:
16609
diff
changeset
|
172 |
818eef7b2618
allow terminal colors to be set from preferences dialog
John W. Eaton <jwe@octave.org>
parents:
16609
diff
changeset
|
173 void QUnixTerminalImpl::setCursorColor (bool useForegroundColor, |
818eef7b2618
allow terminal colors to be set from preferences dialog
John W. Eaton <jwe@octave.org>
parents:
16609
diff
changeset
|
174 const QColor& color) |
818eef7b2618
allow terminal colors to be set from preferences dialog
John W. Eaton <jwe@octave.org>
parents:
16609
diff
changeset
|
175 { |
818eef7b2618
allow terminal colors to be set from preferences dialog
John W. Eaton <jwe@octave.org>
parents:
16609
diff
changeset
|
176 m_terminalView->setKeyboardCursorColor (useForegroundColor, color); |
818eef7b2618
allow terminal colors to be set from preferences dialog
John W. Eaton <jwe@octave.org>
parents:
16609
diff
changeset
|
177 } |
818eef7b2618
allow terminal colors to be set from preferences dialog
John W. Eaton <jwe@octave.org>
parents:
16609
diff
changeset
|
178 |
15658
eaa7da75d202
Added QTerminalInteface class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
15656
diff
changeset
|
179 void QUnixTerminalImpl::showEvent(QShowEvent *) |
15651
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
180 { |
15659 | 181 m_terminalView->updateImage(); |
182 m_terminalView->repaint(); | |
183 m_terminalView->update(); | |
15651
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
184 } |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
185 |
15658
eaa7da75d202
Added QTerminalInteface class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
15656
diff
changeset
|
186 void QUnixTerminalImpl::resizeEvent(QResizeEvent*) |
15651
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
187 { |
15659 | 188 m_terminalView->resize(this->size()); |
189 m_terminalView->updateImage(); | |
190 m_terminalView->repaint(); | |
191 m_terminalView->update(); | |
15651
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
192 } |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
193 |
15658
eaa7da75d202
Added QTerminalInteface class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
15656
diff
changeset
|
194 void QUnixTerminalImpl::copyClipboard() |
15651
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
195 { |
15659 | 196 m_terminalView->copyClipboard(); |
15651
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
197 } |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
198 |
15658
eaa7da75d202
Added QTerminalInteface class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
15656
diff
changeset
|
199 void QUnixTerminalImpl::pasteClipboard() |
15651
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
200 { |
15659 | 201 m_terminalView->pasteClipboard(); |
15651
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
202 } |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
203 |