Mercurial > octave-nkf
comparison libgui/qterminal/libqterminal/QTerminal.h @ 16648:b04413e5a811
improve handling of interrupts, copy and paste shortcuts
* QTerminal.h (QTerminal::report_status_message): New signal.
(QTerminal::QTerminal): Set shortcuts for copy and paste actions.
Add copy and paste actions to QTerminal widget.
Connect settings_changed, report_status_message, copyClipboard_signal,
and pasteClipboard_signal.
* QWinTerminalImpl.cpp (QWinTerminalImpl::copyClipboard): If selection
is set, copy it and report status message. Otherwise, interrupt.
* TerminalView.cpp (TerminalView::copyClipboard): Likewise.
* main-window.cc (main_menu::construct_file_menu): Don't set shortcut
for open action.
(main_window::construct_edit_menu): Delete unimplemented cut, select
all, and delete actions.
Connect copy and paste actions to signals.
(main_window::copyClipboard_signal,
main_window::pasteClipboard_signal): New signals.
(main_window::copyClipboard, main_window::pasteClipboard): New slots.
(main_window::_cut_action): Delete member variable.
* octave-qt-link.cc (octave_qt_link::do_pre_input_event):
Disable input processing by the windows console.
(octave_qt_link::do_post_input_event):
Enable input processing by the windows console.
* terminal-dock-widget.h, terminal-dock-widget.cc:
Delete notice_settings, copyClipboard, and pasteClipboard signals,
slots, and connections.
(terminal_dock_widget::terminal_dock_widget):
Don't connect visibilityChanged signal.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 13 May 2013 07:26:37 -0400 |
parents | 64f9a3e301d3 |
children | de1f8e4b6b9b |
comparison
equal
deleted
inserted
replaced
16647:d446e99f89f7 | 16648:b04413e5a811 |
---|---|
22 | 22 |
23 #ifndef QTERMINAL_H | 23 #ifndef QTERMINAL_H |
24 #define QTERMINAL_H | 24 #define QTERMINAL_H |
25 | 25 |
26 #include <QSettings> | 26 #include <QSettings> |
27 #include <QtGlobal> | 27 #include <QKeySequence> |
28 #include <QWidget> | 28 #include <QWidget> |
29 #include <QStringList> | 29 #include <QStringList> |
30 #include <QColor> | 30 #include <QColor> |
31 #include <QList> | 31 #include <QList> |
32 #include <QMenu> | 32 #include <QMenu> |
74 virtual void setSelectionColor (const QColor& color) = 0; | 74 virtual void setSelectionColor (const QColor& color) = 0; |
75 | 75 |
76 virtual void setCursorColor (bool useForegroundColor, | 76 virtual void setCursorColor (bool useForegroundColor, |
77 const QColor& color) = 0; | 77 const QColor& color) = 0; |
78 | 78 |
79 signals: | |
80 | |
81 void report_status_message (const QString&); | |
82 | |
79 public slots: | 83 public slots: |
80 | 84 |
81 virtual void copyClipboard (void) = 0; | 85 virtual void copyClipboard (void) = 0; |
82 | 86 |
83 virtual void pasteClipboard (void) = 0; | 87 virtual void pasteClipboard (void) = 0; |
92 | 96 |
93 protected: | 97 protected: |
94 | 98 |
95 QTerminal (QWidget *xparent = 0) : QWidget (xparent) | 99 QTerminal (QWidget *xparent = 0) : QWidget (xparent) |
96 { | 100 { |
97 connect (this, SIGNAL (customContextMenuRequested (QPoint)), | |
98 this, SLOT (handleCustomContextMenuRequested (QPoint))); | |
99 | |
100 setContextMenuPolicy (Qt::CustomContextMenu); | 101 setContextMenuPolicy (Qt::CustomContextMenu); |
101 | 102 |
102 _contextMenu = new QMenu (this); | 103 _contextMenu = new QMenu (this); |
103 | 104 |
104 QAction *copyAction = _contextMenu->addAction ("Copy"); | 105 QAction *copyAction = _contextMenu->addAction ("Copy"); |
105 QAction *pasteAction = _contextMenu->addAction ("Paste"); | 106 QAction *pasteAction = _contextMenu->addAction ("Paste"); |
106 | 107 |
107 connect (copyAction, SIGNAL (triggered()), this, SLOT (copyClipboard())); | 108 copyAction->setShortcut (QKeySequence::Copy); |
108 connect (pasteAction, SIGNAL (triggered()), this, SLOT (pasteClipboard())); | 109 pasteAction->setShortcut (QKeySequence::Paste); |
110 | |
111 addAction (copyAction); | |
112 addAction (pasteAction); | |
113 | |
114 connect (copyAction, SIGNAL (triggered()), | |
115 this, SLOT (copyClipboard ())); | |
116 | |
117 connect (pasteAction, SIGNAL (triggered()), | |
118 this, SLOT (pasteClipboard ())); | |
119 | |
120 connect (this, SIGNAL (customContextMenuRequested (QPoint)), | |
121 this, SLOT (handleCustomContextMenuRequested (QPoint))); | |
122 | |
123 connect (this, SIGNAL (report_status_message (const QString&)), | |
124 xparent, SLOT (report_status_message (const QString&))); | |
125 | |
126 connect (xparent, SIGNAL (settings_changed (const QSettings *)), | |
127 this, SLOT (notice_settings (const QSettings *))); | |
128 | |
129 connect (xparent, SIGNAL (copyClipboard_signal ()), | |
130 this, SLOT (copyClipboard ())); | |
131 | |
132 connect (xparent, SIGNAL (pasteClipboard_signal ()), | |
133 this, SLOT (pasteClipboard ())); | |
109 } | 134 } |
110 | 135 |
111 private: | 136 private: |
112 | 137 |
113 QMenu *_contextMenu; | 138 QMenu *_contextMenu; |