annotate libgui/qterminal/libqterminal/unix/QUnixTerminalImpl.cpp @ 18568:2d5d0d86432e gui-release

gui: Add select all menu (Bug #41797) * libgui//qterminal/libqterminal/QTerminal.h: Add selectAll popup menu and virtual function. * libgui/qterminal/libqterminal/unix/QUnixTerminalImpl.cpp,h: Add selectAll function. * libgui/qterminal/libqterminal/unix/TerminalView.cpp,h: add selectAll function. * libgui/qterminal/libqterminal/win32/QWinTerminalImpl.cpp,h: Add selectAll function. * libgui/src/documentation-dock-widget.cc,h: Add selectAll function. * libgui/src/files-dock-widget.cc,h: Add selectAll function. * libgui/src/history-dock-widget.cc,h: Add selectAll function. * libgui/src/m-editor/file-editor-tab.cc,h: Add select_all function and signal. * libgui/src/m-editor/file-editor.cc,h: Add request_selectall and selectAll function, add Edit->select all menu. * libgui/src/main-window.cc: add selectAll function, selectAll menu. * libgui/src/octave-dock-widget.cc,h: Add virtual selectAll function and connect to mainwindow selectall signal. * libgui/src/qtinfo/webinfo.cc,h: Add selectAll function. * libgui/src/workspace-view.cc,h: Add selectAll function.
author John Donoghue <john.donoghue@ieee.org>
date Tue, 11 Mar 2014 19:27:23 -0400
parents 155d8e90ee1f
children 6e81b59d657c
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)
17744
d63878346099 maint: Update copyright notices for release.
John W. Eaton <jwe@octave.org>
parents: 16794
diff changeset
2 Copyright (C) 2012-2013 Jacob Dawid <jacob.dawid@googlemail.com>
15651
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
739f0f73e772 Cleanup.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 15658
diff changeset
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
739f0f73e772 Cleanup.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 15658
diff changeset
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
739f0f73e772 Cleanup.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 15658
diff changeset
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
739f0f73e772 Cleanup.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 15658
diff changeset
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
739f0f73e772 Cleanup.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 15658
diff changeset
38 m_terminalView->setBellMode(TerminalView::NotifyBell);
739f0f73e772 Cleanup.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 15658
diff changeset
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
739f0f73e772 Cleanup.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 15658
diff changeset
41 m_terminalView->setTripleClickMode(TerminalView::SelectWholeLine);
739f0f73e772 Cleanup.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 15658
diff changeset
42 m_terminalView->setTerminalSizeStartup(true);
739f0f73e772 Cleanup.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 15658
diff changeset
43 m_terminalView->setSize(80, 40);
739f0f73e772 Cleanup.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 15658
diff changeset
44 m_terminalView->setScrollBarPosition(TerminalView::ScrollBarRight);
739f0f73e772 Cleanup.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 15658
diff changeset
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
17920
5c3f22dd0bbb raise SIGINT in octave_interpreter instead of in QTerminal
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
49 connect (m_terminalView, SIGNAL (interrupt_signal (void)),
5c3f22dd0bbb raise SIGINT in octave_interpreter instead of in QTerminal
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
50 this, SLOT (terminal_interrupt ()));
5c3f22dd0bbb raise SIGINT in octave_interpreter instead of in QTerminal
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
51
15659
739f0f73e772 Cleanup.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 15658
diff changeset
52 #ifdef Q_OS_MAC
739f0f73e772 Cleanup.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 15658
diff changeset
53 QFont font = QFont("Monaco");
739f0f73e772 Cleanup.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 15658
diff changeset
54 font.setStyleHint(QFont::TypeWriter);
739f0f73e772 Cleanup.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 15658
diff changeset
55 font.setPointSize(11);
739f0f73e772 Cleanup.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 15658
diff changeset
56 #else
739f0f73e772 Cleanup.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 15658
diff changeset
57 QFont font = QFont("Monospace");
739f0f73e772 Cleanup.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 15658
diff changeset
58 font.setStyleHint(QFont::TypeWriter);
739f0f73e772 Cleanup.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 15658
diff changeset
59 font.setPointSize(10);
739f0f73e772 Cleanup.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 15658
diff changeset
60 #endif
739f0f73e772 Cleanup.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 15658
diff changeset
61 setTerminalFont(font);
18431
155d8e90ee1f improve focus of terminal widget (partial fix of bug #40823)
Torsten <ttl@justmail.de>
parents: 17920
diff changeset
62 setFocusPolicy (Qt::StrongFocus);
15659
739f0f73e772 Cleanup.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 15658
diff changeset
63 setFocusProxy(m_terminalView);
739f0f73e772 Cleanup.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 15658
diff changeset
64 setFocus(Qt::OtherFocusReason);
739f0f73e772 Cleanup.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 15658
diff changeset
65
15651
845cebf281aa Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
66 m_kpty = new KPty();
845cebf281aa Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
67 m_kpty->open();
845cebf281aa Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
68
15659
739f0f73e772 Cleanup.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 15658
diff changeset
69 m_terminalModel = new TerminalModel(m_kpty);
739f0f73e772 Cleanup.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 15658
diff changeset
70 m_terminalModel->setAutoClose(true);
739f0f73e772 Cleanup.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 15658
diff changeset
71 m_terminalModel->setCodec(QTextCodec::codecForName("UTF-8"));
739f0f73e772 Cleanup.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 15658
diff changeset
72 m_terminalModel->setHistoryType(HistoryTypeBuffer(1000));
739f0f73e772 Cleanup.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 15658
diff changeset
73 m_terminalModel->setDarkBackground(true);
739f0f73e772 Cleanup.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 15658
diff changeset
74 m_terminalModel->setKeyBindings("");
739f0f73e772 Cleanup.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 15658
diff changeset
75 m_terminalModel->run();
739f0f73e772 Cleanup.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 15658
diff changeset
76 m_terminalModel->addView(m_terminalView);
15651
845cebf281aa Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
77 connectToPty();
845cebf281aa Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
78 }
845cebf281aa Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
79
15658
eaa7da75d202 Added QTerminalInteface class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 15656
diff changeset
80 void QUnixTerminalImpl::connectToPty()
15651
845cebf281aa Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
81 {
16484
fa842e78f491 Restore STDERR stream pipe before exit to capture error messages.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15862
diff changeset
82 // 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
83 // 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
84 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
85
15651
845cebf281aa Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
86 int fds = m_kpty->slaveFd();
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 dup2 (fds, STDIN_FILENO);
845cebf281aa Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
89 dup2 (fds, STDOUT_FILENO);
845cebf281aa Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
90 dup2 (fds, STDERR_FILENO);
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(STDIN_FILENO)) {
845cebf281aa Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
93 qDebug("Error: stdin 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(STDOUT_FILENO)) {
845cebf281aa Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
97 qDebug("Error: stdout 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 if(!isatty(STDERR_FILENO)) {
845cebf281aa Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
101 qDebug("Error: stderr is not a tty.");
845cebf281aa Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
102 }
845cebf281aa Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
103 }
845cebf281aa Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
104
15658
eaa7da75d202 Added QTerminalInteface class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 15656
diff changeset
105 QUnixTerminalImpl::~QUnixTerminalImpl()
15651
845cebf281aa Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
106 {
16484
fa842e78f491 Restore STDERR stream pipe before exit to capture error messages.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15862
diff changeset
107 // 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
108 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
109
15651
845cebf281aa Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
110 emit destroyed();
845cebf281aa Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
111 }
845cebf281aa Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
112
15662
5758e0013246 Enable compilation on Win32-native platform.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 15659
diff changeset
113 void QUnixTerminalImpl::setTerminalFont(const QFont &font)
15651
845cebf281aa Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
114 {
15659
739f0f73e772 Cleanup.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 15658
diff changeset
115 if(!m_terminalView)
739f0f73e772 Cleanup.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 15658
diff changeset
116 return;
739f0f73e772 Cleanup.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 15658
diff changeset
117 m_terminalView->setVTFont(font);
15651
845cebf281aa Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
118 }
845cebf281aa Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
119
15658
eaa7da75d202 Added QTerminalInteface class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 15656
diff changeset
120 void QUnixTerminalImpl::setSize(int h, int v)
15651
845cebf281aa Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
121 {
15659
739f0f73e772 Cleanup.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 15658
diff changeset
122 if(!m_terminalView)
739f0f73e772 Cleanup.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 15658
diff changeset
123 return;
739f0f73e772 Cleanup.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 15658
diff changeset
124 m_terminalView->setSize(h, v);
15651
845cebf281aa Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
125 }
845cebf281aa Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
126
15662
5758e0013246 Enable compilation on Win32-native platform.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 15659
diff changeset
127 void QUnixTerminalImpl::sendText(const QString& text)
15656
c05926c0657d Added sendText method again.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 15653
diff changeset
128 {
15659
739f0f73e772 Cleanup.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 15658
diff changeset
129 m_terminalModel->sendText(text);
15656
c05926c0657d Added sendText method again.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 15653
diff changeset
130 }
c05926c0657d Added sendText method again.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 15653
diff changeset
131
15677
f620ecde2566 Added support for changing the cursor.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 15675
diff changeset
132 void QUnixTerminalImpl::setCursorType(CursorType type, bool blinking)
f620ecde2566 Added support for changing the cursor.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 15675
diff changeset
133 {
f620ecde2566 Added support for changing the cursor.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 15675
diff changeset
134 switch(type) {
15680
6b1369106141 Fix error in setting the terminal cursor shape
Mike Miller <mtmiller@ieee.org>
parents: 15677
diff changeset
135 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
136 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
137 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
138 }
f620ecde2566 Added support for changing the cursor.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 15675
diff changeset
139 m_terminalView->setBlinkingCursor(blinking);
f620ecde2566 Added support for changing the cursor.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 15675
diff changeset
140 }
f620ecde2566 Added support for changing the cursor.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 15675
diff changeset
141
16620
818eef7b2618 allow terminal colors to be set from preferences dialog
John W. Eaton <jwe@octave.org>
parents: 16609
diff changeset
142 // 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
143 // 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
144 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
145 {
c19cc8c158b3 Allow setting background/forground terminal colors in Unix (bug #39016)
John Donoghue <john.donoghue@ieee.org>
parents: 16639
diff changeset
146 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
147
c19cc8c158b3 Allow setting background/forground terminal colors in Unix (bug #39016)
John Donoghue <john.donoghue@ieee.org>
parents: 16639
diff changeset
148 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
149 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
150 {
c19cc8c158b3 Allow setting background/forground terminal colors in Unix (bug #39016)
John Donoghue <john.donoghue@ieee.org>
parents: 16639
diff changeset
151 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
152 }
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 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
155
c19cc8c158b3 Allow setting background/forground terminal colors in Unix (bug #39016)
John Donoghue <john.donoghue@ieee.org>
parents: 16639
diff changeset
156 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
157
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 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
160 {
c19cc8c158b3 Allow setting background/forground terminal colors in Unix (bug #39016)
John Donoghue <john.donoghue@ieee.org>
parents: 16639
diff changeset
161 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
162
c19cc8c158b3 Allow setting background/forground terminal colors in Unix (bug #39016)
John Donoghue <john.donoghue@ieee.org>
parents: 16639
diff changeset
163 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
164 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
165 {
c19cc8c158b3 Allow setting background/forground terminal colors in Unix (bug #39016)
John Donoghue <john.donoghue@ieee.org>
parents: 16639
diff changeset
166 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
167 }
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 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
170
c19cc8c158b3 Allow setting background/forground terminal colors in Unix (bug #39016)
John Donoghue <john.donoghue@ieee.org>
parents: 16639
diff changeset
171 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
172
c19cc8c158b3 Allow setting background/forground terminal colors in Unix (bug #39016)
John Donoghue <john.donoghue@ieee.org>
parents: 16639
diff changeset
173
c19cc8c158b3 Allow setting background/forground terminal colors in Unix (bug #39016)
John Donoghue <john.donoghue@ieee.org>
parents: 16639
diff changeset
174 }
16620
818eef7b2618 allow terminal colors to be set from preferences dialog
John W. Eaton <jwe@octave.org>
parents: 16609
diff changeset
175 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
176
818eef7b2618 allow terminal colors to be set from preferences dialog
John W. Eaton <jwe@octave.org>
parents: 16609
diff changeset
177 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
178 const QColor& color)
818eef7b2618 allow terminal colors to be set from preferences dialog
John W. Eaton <jwe@octave.org>
parents: 16609
diff changeset
179 {
818eef7b2618 allow terminal colors to be set from preferences dialog
John W. Eaton <jwe@octave.org>
parents: 16609
diff changeset
180 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
181 }
818eef7b2618 allow terminal colors to be set from preferences dialog
John W. Eaton <jwe@octave.org>
parents: 16609
diff changeset
182
15658
eaa7da75d202 Added QTerminalInteface class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 15656
diff changeset
183 void QUnixTerminalImpl::showEvent(QShowEvent *)
15651
845cebf281aa Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
184 {
15659
739f0f73e772 Cleanup.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 15658
diff changeset
185 m_terminalView->updateImage();
739f0f73e772 Cleanup.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 15658
diff changeset
186 m_terminalView->repaint();
739f0f73e772 Cleanup.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 15658
diff changeset
187 m_terminalView->update();
15651
845cebf281aa Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
188 }
845cebf281aa Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
189
15658
eaa7da75d202 Added QTerminalInteface class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 15656
diff changeset
190 void QUnixTerminalImpl::resizeEvent(QResizeEvent*)
15651
845cebf281aa Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
191 {
15659
739f0f73e772 Cleanup.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 15658
diff changeset
192 m_terminalView->resize(this->size());
739f0f73e772 Cleanup.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 15658
diff changeset
193 m_terminalView->updateImage();
739f0f73e772 Cleanup.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 15658
diff changeset
194 m_terminalView->repaint();
739f0f73e772 Cleanup.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 15658
diff changeset
195 m_terminalView->update();
15651
845cebf281aa Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
196 }
845cebf281aa Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
197
15658
eaa7da75d202 Added QTerminalInteface class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 15656
diff changeset
198 void QUnixTerminalImpl::copyClipboard()
15651
845cebf281aa Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
199 {
15659
739f0f73e772 Cleanup.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 15658
diff changeset
200 m_terminalView->copyClipboard();
15651
845cebf281aa Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
201 }
845cebf281aa Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
202
15658
eaa7da75d202 Added QTerminalInteface class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 15656
diff changeset
203 void QUnixTerminalImpl::pasteClipboard()
15651
845cebf281aa Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
204 {
15659
739f0f73e772 Cleanup.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 15658
diff changeset
205 m_terminalView->pasteClipboard();
15651
845cebf281aa Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
206 }
845cebf281aa Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
207
18568
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18431
diff changeset
208 void QUnixTerminalImpl::selectAll()
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18431
diff changeset
209 {
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18431
diff changeset
210 m_terminalView->selectAll();
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18431
diff changeset
211 }
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18431
diff changeset
212
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18431
diff changeset
213
16794
1d1f02e0f6b4 GUI: enable clipboard content detection for terminal window context menu
John Donoghue <john.donoghue@ieee.org>
parents: 16688
diff changeset
214 QString QUnixTerminalImpl::selectedText ()
1d1f02e0f6b4 GUI: enable clipboard content detection for terminal window context menu
John Donoghue <john.donoghue@ieee.org>
parents: 16688
diff changeset
215 {
1d1f02e0f6b4 GUI: enable clipboard content detection for terminal window context menu
John Donoghue <john.donoghue@ieee.org>
parents: 16688
diff changeset
216 return m_terminalView->selectedText ();
1d1f02e0f6b4 GUI: enable clipboard content detection for terminal window context menu
John Donoghue <john.donoghue@ieee.org>
parents: 16688
diff changeset
217 }