view libgui/src/terminal-dock-widget.cc @ 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 ba808cd9d86c
children d749c9b588e5
line wrap: on
line source

/*

Copyright (C) 2013 John W. Eaton
Copyright (C) 2011-2012 Jacob Dawid

This file is part of Octave.

Octave is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3 of the License, or (at your
option) any later version.

Octave is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
for more details.

You should have received a copy of the GNU General Public License
along with Octave; see the file COPYING.  If not, see
<http://www.gnu.org/licenses/>.

*/

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include "terminal-dock-widget.h"

terminal_dock_widget::terminal_dock_widget (QWidget *p)
  : octave_dock_widget (p), terminal (QTerminal::create (p))
{
  terminal->setObjectName ("OctaveTerminal");
  terminal->setFocusPolicy (Qt::StrongFocus);

  setObjectName ("TerminalDockWidget");
  setWindowIcon (QIcon(":/actions/icons/logo.png"));
  setWindowTitle (tr ("Command Window"));

  setWidget (terminal);
}

bool
terminal_dock_widget::has_focus (void) const
{
  QWidget *w = widget ();

  return w->hasFocus ();
}

void
terminal_dock_widget::focus (void)
{
  octave_dock_widget::focus ();

  QWidget *w = widget ();

  w->setFocus ();
  w->activateWindow ();
  w->raise ();
}