Adding upstream version 0.6.0+20151225.

upstream/0.6.0+20151225
Alf Gaida 9 years ago
parent 3d7ff0b035
commit f0e1c32f49

@ -2,8 +2,6 @@ cmake_minimum_required( VERSION 2.8 )
project(qtermwidget) project(qtermwidget)
option(BUILD_DESIGNER_PLUGIN "Build Qt4 designer plugin" ON)
option(USE_QT5 "Build using Qt5. Default OFF." OFF)
option(BUILD_TEST "Build test application. Default OFF." OFF) option(BUILD_TEST "Build test application. Default OFF." OFF)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake") set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
@ -26,13 +24,8 @@ include_directories(
add_definitions(-Wall) add_definitions(-Wall)
if(USE_QT5) set(QTERMWIDGET_LIBRARY_NAME qtermwidget5)
set(QTERMWIDGET_LIBRARY_NAME qtermwidget5) include(qtermwidget5_use)
include(qtermwidget5_use)
else()
include(qtermwidget4_use)
set(QTERMWIDGET_LIBRARY_NAME qtermwidget4)
endif()
# main library # main library
@ -111,17 +104,9 @@ if(HAVE_UPDWTMPX)
add_definitions(-DHAVE_UPDWTMPX) add_definitions(-DHAVE_UPDWTMPX)
endif() endif()
qt5_wrap_cpp(MOCS ${HDRS})
if(USE_QT5) qt5_wrap_ui(UI_SRCS ${UI})
qt5_wrap_cpp(MOCS ${HDRS}) set(PKG_CONFIG_REQ "Qt5Core, Qt5Xml, Qt5Widgets")
qt5_wrap_ui(UI_SRCS ${UI})
set(PKG_CONFIG_REQ "Qt5Core, Qt5Xml, Qt5Widgets")
else()
qt4_wrap_cpp(MOCS ${HDRS})
qt4_wrap_ui(UI_SRCS ${UI})
set(PKG_CONFIG_REQ "QtCore, QtXml")
endif()
add_library(${QTERMWIDGET_LIBRARY_NAME} SHARED ${SRCS} ${MOCS} ${UI_SRCS}) add_library(${QTERMWIDGET_LIBRARY_NAME} SHARED ${SRCS} ${MOCS} ${UI_SRCS})
target_link_libraries(${QTERMWIDGET_LIBRARY_NAME} ${QTERMWIDGET_QT_LIBRARIES}) target_link_libraries(${QTERMWIDGET_LIBRARY_NAME} ${QTERMWIDGET_QT_LIBRARIES})
@ -163,47 +148,6 @@ install(FILES
# end of main library # end of main library
# designer plugin
if (BUILD_DESIGNER_PLUGIN)
if(USE_QT5)
message(FATAL_ERROR "Building Qt designer plugin is not supported for Qt5 yet. Use -DBUILD_DESIGNER_PLUGIN=0")
endif()
message(STATUS "Building Qt designer plugin")
include_directories(designer "${QT_QTDESIGNER_INCLUDE_DIR}")
set(DESIGNER_SRC lib/designer/qtermwidgetplugin.cpp)
qt4_wrap_cpp(DESIGNER_MOC lib/designer/qtermwidgetplugin.h)
qt4_add_resources(DESIGNER_QRC lib/designer/qtermwidgetplugin.qrc)
link_directories(${CMAKE_BINARY_DIR})
add_library(qtermwidget4plugin SHARED
${DESIGNER_MOC}
${DESIGNER_QRC}
${DESIGNER_SRC}
)
add_dependencies(qtermwidget4plugin qtermwidget4)
target_link_libraries(qtermwidget4plugin
${QT_QTCORE_LIBRARY}
${QT_QTDESIGNER_LIBRARY}
${QT_QTDESIGNERCOMPONENTS_LIBRARY}
${QTERMWIDGET_LIBRARY_NAME}
)
if(APPLE)
# this is a must to load the lib correctly
set_target_properties(qtermwidget4plugin PROPERTIES
INSTALL_NAME_DIR "${CMAKE_INSTALL_FULL_LIBDIR}/qt4/plugins/designer"
)
endif()
install(TARGETS qtermwidget4plugin DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}/qt4/plugins/designer")
endif (BUILD_DESIGNER_PLUGIN)
# end of designer plugin
# test application # test application
if(BUILD_TEST) if(BUILD_TEST)
set(TEST_SRC src/main.cpp) set(TEST_SRC src/main.cpp)

@ -1,27 +0,0 @@
0.6.0 (2014-10-21)
* Full Qt4 + Qt5 support
* Fixed Ctrl+Arrows in Linux emulation
* Fixed Drag & Drop support
## Old changelog
31.07.2008
Interface class from c-style conversions rewritten with pimpl support.
16.07.2008
Added optional scrollbar
06.06.2008
Some artefacts were removed, some added...
Also added support for color schemes, and 3 color schemes provided (classical - white on black, green on black, black on light yellow). Is it enough or not?
26.05.2008
Added file release as an archive with source code. But preferrable way is still getting code from CVS, cause file release can be outdated.
11.05.2008
Initial CVS import - first version comes with number 0.0.1

@ -1,23 +0,0 @@
Requirements:
Qt4 or Qt5
cmake
Supported (tested) platforms:
Linux
*BSD
Mac OS X
Build:
A shadow build (out of source) is strongly recommended
http://www.cmake.org/Wiki/CMake_FAQ#Out-of-source_build_trees
1) mkdir -p build && cd build
2a) cmake path/to/source -DUSE_QT5=true # Qt 5
2b) cmake path/to/source # Qt 4 only
3) make
4) optional: make install
Read cmake docs to fine tune the build process (CMAKE_INSTALL_PREFIX, etc...)

@ -278,62 +278,3 @@ PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES. POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program 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 2 of the License, or
(at your option) any later version.
This program 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 this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

@ -1,10 +0,0 @@
QTermWidget is an opensource project originally based on KDE4 Konsole application,
but it took its own direction later.
The main goal of this project is to provide unicode-enabled, embeddable
Qt widget for using as a built-in console (or terminal emulation widget).
Current maintainer: Petr Vanek <petr@yarpen.cz>
License: GPLv2+

@ -0,0 +1,34 @@
# QTermWidget
A terminal emulator widget for Qt 5.
QTermWidget is an opensource project originally based on KDE4 Konsole application,
but it took its own direction later.
The main goal of this project is to provide unicode-enabled, embeddable
Qt widget for using as a built-in console (or terminal emulation widget).
# Installation
Requirements:
* Qt >= 5.4
* cmake >= 3.0
Supported platforms:
* Linux
* BSD
* OS X
Building
1. `mkdir -p build && cd build`
2. `cmake `<path/to/source>`
3. make
Run `make install` to install.
# License
This project is licensed under the terms of the
[GPLv2](https://www.gnu.org/licenses/gpl-2.0.en.html) or any later version.
See the LICENSE file for the full text of the license.

@ -1,47 +0,0 @@
# - Find the QTermWidget include and library dirs and define a some macros
#
# The module defines the following variables
# QTERMWIDGET_FOUND - Set to TRUE if all of the above has been found
#
# QTERMWIDGET_INCLUDE_DIR - The QTermWidget include directory
#
# QTERMWIDGET_INCLUDE_DIRS - The QTermWidget include directory
#
# QTERMWIDGET_LIBRARIES - The libraries needed to use QTermWidget
#
# QTERMWIDGET_USE_FILE - The variable QTERMWIDGET_USE_FILE is set which is the path
# to a CMake file that can be included to compile qtermwidget
# applications and libraries. It sets up the compilation
# environment for include directories and populates a
# QTERMWIDGET_LIBRARIES variable.
#
# QTERMWIDGET_QT_LIBRARIES - The Qt libraries needed by QTermWidget
#
# Typical usage:
# option(USE_QT5 "Build using Qt5. Default off" OFF)
# if (USE_QT5)
# find_package(QTERMWIDGET4)
# else()
# find_package(QTERMWIDGET5)
# endif()
#
# include(${QTERMWIDGET_USE_FILE})
# add_executable(foo main.cpp)
# target_link_libraries(foo ${QTERMWIDGET_QT_LIBRARIES} ${QTERMWIDGET_LIBRARIES})
set(QTERMWIDGET_INCLUDE_DIR @QTERMWIDGET_INCLUDE_DIR@)
set(QTERMWIDGET_LIBRARY @QTERMWIDGET_LIBRARY_NAME@)
set(QTERMWIDGET_LIBRARIES ${QTERMWIDGET_LIBRARY})
set(QTERMWIDGET_INCLUDE_DIRS "${QTERMWIDGET_INCLUDE_DIR}")
set(QTERMWIDGET_USE_FILE "${CMAKE_CURRENT_LIST_DIR}/qtermwidget4_use.cmake")
set(QTERMWIDGET_FOUND 1)
set(QTERMWIDGET_VERSION_MAJOR @QTERMWIDGET_VERSION_MAJOR@)
set(QTERMWIDGET_VERSION_MINOR @QTERMWIDGET_VERSION_MINOR@)
set(QTERMWIDGET_VERSION_PATCH @QTERMWIDGET_VERSION_PATCH@)
set(QTERMWIDGET_VERSION @QTERMWIDGET_VERSION@)
mark_as_advanced(QTERMWIDGET_LIBRARY QTERMWIDGET_INCLUDE_DIR)

@ -18,12 +18,7 @@
# QTERMWIDGET_QT_LIBRARIES - The Qt libraries needed by QTermWidget # QTERMWIDGET_QT_LIBRARIES - The Qt libraries needed by QTermWidget
# #
# Typical usage: # Typical usage:
# option(USE_QT5 "Build using Qt5. Default off" OFF)
# if (USE_QT5)
# find_package(QTERMWIDGET4)
# else()
# find_package(QTERMWIDGET5) # find_package(QTERMWIDGET5)
# endif()
# #
# include(${QTERMWIDGET_USE_FILE}) # include(${QTERMWIDGET_USE_FILE})
# add_executable(foo main.cpp) # add_executable(foo main.cpp)
@ -44,4 +39,3 @@ set(QTERMWIDGET_VERSION_PATCH @QTERMWIDGET_VERSION_PATCH@)
set(QTERMWIDGET_VERSION @QTERMWIDGET_VERSION@) set(QTERMWIDGET_VERSION @QTERMWIDGET_VERSION@)
mark_as_advanced(QTERMWIDGET_LIBRARY QTERMWIDGET_INCLUDE_DIR) mark_as_advanced(QTERMWIDGET_LIBRARY QTERMWIDGET_INCLUDE_DIR)

@ -45,8 +45,9 @@ static const int LINE_DOUBLEHEIGHT = (1 << 2);
#define RE_UNDERLINE (1 << 2) #define RE_UNDERLINE (1 << 2)
#define RE_REVERSE (1 << 3) // Screen only #define RE_REVERSE (1 << 3) // Screen only
#define RE_INTENSIVE (1 << 3) // Widget only #define RE_INTENSIVE (1 << 3) // Widget only
#define RE_CURSOR (1 << 4) #define RE_ITALIC (1 << 4)
#define RE_EXTENDED_CHAR (1 << 5) #define RE_CURSOR (1 << 5)
#define RE_EXTENDED_CHAR (1 << 6)
/** /**
* A single character in the terminal which consists of a unicode character * A single character in the terminal which consists of a unicode character

@ -379,6 +379,18 @@ signals:
*/ */
void imageSizeChanged(int lineCount , int columnCount); void imageSizeChanged(int lineCount , int columnCount);
/**
* Emitted when the setImageSize() is called on this emulation for
* the first time.
*/
void imageSizeInitialized();
/**
* Emitted after receiving the escape sequence which asks to change
* the terminal emulator's size
*/
void imageResizeRequest(const QSize& sizz);
/** /**
* Emitted when the terminal program requests to change various properties * Emitted when the terminal program requests to change various properties
* of the terminal display. * of the terminal display.

@ -94,9 +94,11 @@ Session::Session(QObject* parent) :
this, SIGNAL( changeTabTextColorRequest( int ) ) ); this, SIGNAL( changeTabTextColorRequest( int ) ) );
connect( _emulation, SIGNAL(profileChangeCommandReceived(const QString &)), connect( _emulation, SIGNAL(profileChangeCommandReceived(const QString &)),
this, SIGNAL( profileChangeCommandReceived(const QString &)) ); this, SIGNAL( profileChangeCommandReceived(const QString &)) );
// TODO
// connect( _emulation,SIGNAL(imageSizeChanged(int,int)) , this , connect(_emulation, SIGNAL(imageResizeRequest(QSize)),
// SLOT(onEmulationSizeChange(int,int)) ); this, SLOT(onEmulationSizeChange(QSize)));
connect(_emulation, SIGNAL(imageSizeChanged(int, int)),
this, SLOT(onViewSizeChange(int, int)));
//connect teletype to emulation backend //connect teletype to emulation backend
_shellProcess->setUtf8Mode(_emulation->utf8()); _shellProcess->setUtf8Mode(_emulation->utf8());
@ -119,42 +121,11 @@ Session::Session(QObject* parent) :
WId Session::windowId() const WId Session::windowId() const
{ {
// Returns a window ID for this session which is used
// to set the WINDOWID environment variable in the shell
// process.
//
// Sessions can have multiple views or no views, which means
// that a single ID is not always going to be accurate.
//
// If there are no views, the window ID is just 0. If
// there are multiple views, then the window ID for the
// top-level window which contains the first view is
// returned
//
// On Qt5, requesting window IDs breaks QQuickWidget and the likes, // On Qt5, requesting window IDs breaks QQuickWidget and the likes,
// for example, see the following bug reports: // for example, see the following bug reports:
// // https://bugreports.qt.io/browse/QTBUG-40765
// https://bugreports.qt-project.org/browse/QTBUG-41779 // https://codereview.qt-project.org/#/c/94880/
// https://bugreports.qt-project.org/browse/QTBUG-40765
// https://bugreports.qt-project.org/browse/QTBUG-41942
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
return 0;
#else
if ( _views.count() == 0 ) {
return 0; return 0;
} else {
QWidget * window = _views.first();
Q_ASSERT( window );
while ( window->parentWidget() != 0 ) {
window = window->parentWidget();
}
return window->winId();
}
#endif
} }
void Session::setDarkBackground(bool darkBackground) void Session::setDarkBackground(bool darkBackground)
@ -517,9 +488,9 @@ void Session::onViewSizeChange(int /*height*/, int /*width*/)
{ {
updateTerminalSize(); updateTerminalSize();
} }
void Session::onEmulationSizeChange(int lines , int columns) void Session::onEmulationSizeChange(QSize size)
{ {
setSize( QSize(lines,columns) ); setSize(size);
} }
void Session::updateTerminalSize() void Session::updateTerminalSize()

@ -486,7 +486,7 @@ private slots:
void monitorTimerDone(); void monitorTimerDone();
void onViewSizeChange(int height, int width); void onViewSizeChange(int height, int width);
void onEmulationSizeChange(int lines , int columns); void onEmulationSizeChange(QSize);
void activityStateSet(int); void activityStateSet(int);

@ -312,6 +312,7 @@ TerminalDisplay::TerminalDisplay(QWidget *parent)
,_terminalSizeHint(false) ,_terminalSizeHint(false)
,_terminalSizeStartup(true) ,_terminalSizeStartup(true)
,_bidiEnabled(false) ,_bidiEnabled(false)
,_mouseMarks(false)
,_actSel(0) ,_actSel(0)
,_wordSelectionMode(false) ,_wordSelectionMode(false)
,_lineSelectionMode(false) ,_lineSelectionMode(false)
@ -730,11 +731,7 @@ void TerminalDisplay::drawCharacters(QPainter& painter,
if (_bidiEnabled) if (_bidiEnabled)
painter.drawText(rect,0,text); painter.drawText(rect,0,text);
else else
#if QT_VERSION >= 0x040800
painter.drawText(rect, Qt::AlignBottom, LTR_OVERRIDE_CHAR + text); painter.drawText(rect, Qt::AlignBottom, LTR_OVERRIDE_CHAR + text);
#else
painter.drawText(rect, 0, LTR_OVERRIDE_CHAR + text);
#endif
} }
} }
@ -1804,7 +1801,7 @@ void TerminalDisplay::mousePressEvent(QMouseEvent* ev)
} }
else if ( ev->button() == Qt::MidButton ) else if ( ev->button() == Qt::MidButton )
{ {
if ( _mouseMarks || (!_mouseMarks && (ev->modifiers() & Qt::ShiftModifier)) ) if ( _mouseMarks || (ev->modifiers() & Qt::ShiftModifier) )
emitSelection(true,ev->modifiers() & Qt::ControlModifier); emitSelection(true,ev->modifiers() & Qt::ControlModifier);
else else
emit mouseSignal( 1, charColumn +1, charLine +1 +_scrollBar->value() -_scrollBar->maximum() , 0); emit mouseSignal( 1, charColumn +1, charLine +1 +_scrollBar->value() -_scrollBar->maximum() , 0);

@ -60,7 +60,8 @@ using namespace Konsole;
Vt102Emulation::Vt102Emulation() Vt102Emulation::Vt102Emulation()
: Emulation(), : Emulation(),
_titleUpdateTimer(new QTimer(this)) _titleUpdateTimer(new QTimer(this)),
_reportFocusEvents(false)
{ {
_titleUpdateTimer->setSingleShot(true); _titleUpdateTimer->setSingleShot(true);
QObject::connect(_titleUpdateTimer , SIGNAL(timeout()) , this , SLOT(updateTitle())); QObject::connect(_titleUpdateTimer , SIGNAL(timeout()) , this , SLOT(updateTitle()));
@ -531,7 +532,9 @@ void Vt102Emulation::processToken(int token, int p, int q)
case TY_ESC_DE('8' ) : _currentScreen->helpAlign ( ); break; case TY_ESC_DE('8' ) : _currentScreen->helpAlign ( ); break;
// resize = \e[8;<row>;<col>t // resize = \e[8;<row>;<col>t
case TY_CSI_PS('t', 8) : setImageSize( q /* columns */, p /* lines */ ); break; case TY_CSI_PS('t', 8) : setImageSize( q /* columns */, p /* lines */ );
emit imageResizeRequest(QSize(q, p));
break;
// change tab text color : \e[28;<color>t color: 0-16,777,215 // change tab text color : \e[28;<color>t color: 0-16,777,215
case TY_CSI_PS('t', 28) : emit changeTabTextColorRequest ( p ); break; case TY_CSI_PS('t', 28) : emit changeTabTextColorRequest ( p ); break;
@ -555,6 +558,7 @@ void Vt102Emulation::processToken(int token, int p, int q)
case TY_CSI_PS('m', 0) : _currentScreen->setDefaultRendition ( ); break; case TY_CSI_PS('m', 0) : _currentScreen->setDefaultRendition ( ); break;
case TY_CSI_PS('m', 1) : _currentScreen-> setRendition (RE_BOLD ); break; //VT100 case TY_CSI_PS('m', 1) : _currentScreen-> setRendition (RE_BOLD ); break; //VT100
case TY_CSI_PS('m', 3) : _currentScreen-> setRendition (RE_ITALIC ); break; //VT100
case TY_CSI_PS('m', 4) : _currentScreen-> setRendition (RE_UNDERLINE); break; //VT100 case TY_CSI_PS('m', 4) : _currentScreen-> setRendition (RE_UNDERLINE); break; //VT100
case TY_CSI_PS('m', 5) : _currentScreen-> setRendition (RE_BLINK ); break; //VT100 case TY_CSI_PS('m', 5) : _currentScreen-> setRendition (RE_BLINK ); break; //VT100
case TY_CSI_PS('m', 7) : _currentScreen-> setRendition (RE_REVERSE ); break; case TY_CSI_PS('m', 7) : _currentScreen-> setRendition (RE_REVERSE ); break;
@ -562,6 +566,7 @@ void Vt102Emulation::processToken(int token, int p, int q)
case TY_CSI_PS('m', 11) : /* IGNORED: mapping related */ break; //LINUX case TY_CSI_PS('m', 11) : /* IGNORED: mapping related */ break; //LINUX
case TY_CSI_PS('m', 12) : /* IGNORED: mapping related */ break; //LINUX case TY_CSI_PS('m', 12) : /* IGNORED: mapping related */ break; //LINUX
case TY_CSI_PS('m', 22) : _currentScreen->resetRendition (RE_BOLD ); break; case TY_CSI_PS('m', 22) : _currentScreen->resetRendition (RE_BOLD ); break;
case TY_CSI_PS('m', 23) : _currentScreen->resetRendition (RE_ITALIC ); break; //VT100
case TY_CSI_PS('m', 24) : _currentScreen->resetRendition (RE_UNDERLINE); break; case TY_CSI_PS('m', 24) : _currentScreen->resetRendition (RE_UNDERLINE); break;
case TY_CSI_PS('m', 25) : _currentScreen->resetRendition (RE_BLINK ); break; case TY_CSI_PS('m', 25) : _currentScreen->resetRendition (RE_BLINK ); break;
case TY_CSI_PS('m', 27) : _currentScreen->resetRendition (RE_REVERSE ); break; case TY_CSI_PS('m', 27) : _currentScreen->resetRendition (RE_REVERSE ); break;
@ -625,6 +630,8 @@ void Vt102Emulation::processToken(int token, int p, int q)
case TY_CSI_PN('B' ) : _currentScreen->cursorDown (p ); break; //VT100 case TY_CSI_PN('B' ) : _currentScreen->cursorDown (p ); break; //VT100
case TY_CSI_PN('C' ) : _currentScreen->cursorRight (p ); break; //VT100 case TY_CSI_PN('C' ) : _currentScreen->cursorRight (p ); break; //VT100
case TY_CSI_PN('D' ) : _currentScreen->cursorLeft (p ); break; //VT100 case TY_CSI_PN('D' ) : _currentScreen->cursorLeft (p ); break; //VT100
case TY_CSI_PN('E' ) : /* Not implemented: cursor next p lines */ break; //VT100
case TY_CSI_PN('F' ) : /* Not implemented: cursor preceding p lines */ break; //VT100
case TY_CSI_PN('G' ) : _currentScreen->setCursorX (p ); break; //LINUX case TY_CSI_PN('G' ) : _currentScreen->setCursorX (p ); break; //LINUX
case TY_CSI_PN('H' ) : _currentScreen->setCursorYX (p, q); break; //VT100 case TY_CSI_PN('H' ) : _currentScreen->setCursorYX (p, q); break; //VT100
case TY_CSI_PN('I' ) : _currentScreen->tab (p ); break; case TY_CSI_PN('I' ) : _currentScreen->tab (p ); break;
@ -739,6 +746,24 @@ void Vt102Emulation::processToken(int token, int p, int q)
case TY_CSI_PR('s', 1003) : saveMode (MODE_Mouse1003); break; //XTERM case TY_CSI_PR('s', 1003) : saveMode (MODE_Mouse1003); break; //XTERM
case TY_CSI_PR('r', 1003) : restoreMode (MODE_Mouse1003); break; //XTERM case TY_CSI_PR('r', 1003) : restoreMode (MODE_Mouse1003); break; //XTERM
case TY_CSI_PR('h', 1004) : _reportFocusEvents = true; break;
case TY_CSI_PR('l', 1004) : _reportFocusEvents = false; break;
case TY_CSI_PR('h', 1005) : setMode (MODE_Mouse1005); break; //XTERM
case TY_CSI_PR('l', 1005) : resetMode (MODE_Mouse1005); break; //XTERM
case TY_CSI_PR('s', 1005) : saveMode (MODE_Mouse1005); break; //XTERM
case TY_CSI_PR('r', 1005) : restoreMode (MODE_Mouse1005); break; //XTERM
case TY_CSI_PR('h', 1006) : setMode (MODE_Mouse1006); break; //XTERM
case TY_CSI_PR('l', 1006) : resetMode (MODE_Mouse1006); break; //XTERM
case TY_CSI_PR('s', 1006) : saveMode (MODE_Mouse1006); break; //XTERM
case TY_CSI_PR('r', 1006) : restoreMode (MODE_Mouse1006); break; //XTERM
case TY_CSI_PR('h', 1015) : setMode (MODE_Mouse1015); break; //URXVT
case TY_CSI_PR('l', 1015) : resetMode (MODE_Mouse1015); break; //URXVT
case TY_CSI_PR('s', 1015) : saveMode (MODE_Mouse1015); break; //URXVT
case TY_CSI_PR('r', 1015) : restoreMode (MODE_Mouse1015); break; //URXVT
case TY_CSI_PR('h', 1034) : /* IGNORED: 8bitinput activation */ break; //XTERM case TY_CSI_PR('h', 1034) : /* IGNORED: 8bitinput activation */ break; //XTERM
case TY_CSI_PR('h', 1047) : setMode (MODE_AppScreen); break; //XTERM case TY_CSI_PR('h', 1047) : setMode (MODE_AppScreen); break; //XTERM
@ -757,6 +782,11 @@ void Vt102Emulation::processToken(int token, int p, int q)
case TY_CSI_PR('h', 1049) : saveCursor(); _screen[1]->clearEntireScreen(); setMode(MODE_AppScreen); break; //XTERM case TY_CSI_PR('h', 1049) : saveCursor(); _screen[1]->clearEntireScreen(); setMode(MODE_AppScreen); break; //XTERM
case TY_CSI_PR('l', 1049) : resetMode(MODE_AppScreen); restoreCursor(); break; //XTERM case TY_CSI_PR('l', 1049) : resetMode(MODE_AppScreen); restoreCursor(); break; //XTERM
case TY_CSI_PR('h', 2004) : setMode (MODE_BracketedPaste); break; //XTERM
case TY_CSI_PR('l', 2004) : resetMode (MODE_BracketedPaste); break; //XTERM
case TY_CSI_PR('s', 2004) : saveMode (MODE_BracketedPaste); break; //XTERM
case TY_CSI_PR('r', 2004) : restoreMode (MODE_BracketedPaste); break; //XTERM
//FIXME: weird DEC reset sequence //FIXME: weird DEC reset sequence
case TY_CSI_PE('p' ) : /* IGNORED: reset ( ) */ break; case TY_CSI_PE('p' ) : /* IGNORED: reset ( ) */ break;
@ -883,6 +913,32 @@ void Vt102Emulation::sendMouseEvent( int cb, int cx, int cy , int eventType )
sendString(command); sendString(command);
} }
/**
* The focus lost event can be used by Vim (or other terminal applications)
* to recognize that the konsole window has lost focus.
* The escape sequence is also used by iTerm2.
* Vim needs the following plugin to be installed to convert the escape
* sequence into the FocusLost autocmd: https://github.com/sjl/vitality.vim
*/
void Vt102Emulation::focusLost(void)
{
if (_reportFocusEvents)
sendString("\033[O");
}
/**
* The focus gained event can be used by Vim (or other terminal applications)
* to recognize that the konsole window has gained focus again.
* The escape sequence is also used by iTerm2.
* Vim needs the following plugin to be installed to convert the escape
* sequence into the FocusGained autocmd: https://github.com/sjl/vitality.vim
*/
void Vt102Emulation::focusGained(void)
{
if (_reportFocusEvents)
sendString("\033[I");
}
void Vt102Emulation::sendText( const QString& text ) void Vt102Emulation::sendText( const QString& text )
{ {
if (!text.isEmpty()) if (!text.isEmpty())

@ -42,10 +42,14 @@
#define MODE_Mouse1001 (MODES_SCREEN+4) // Use Hilight mouse tracking #define MODE_Mouse1001 (MODES_SCREEN+4) // Use Hilight mouse tracking
#define MODE_Mouse1002 (MODES_SCREEN+5) // Use cell motion mouse tracking #define MODE_Mouse1002 (MODES_SCREEN+5) // Use cell motion mouse tracking
#define MODE_Mouse1003 (MODES_SCREEN+6) // Use all motion mouse tracking #define MODE_Mouse1003 (MODES_SCREEN+6) // Use all motion mouse tracking
#define MODE_Ansi (MODES_SCREEN+7) // Use US Ascii for character sets G0-G3 (DECANM) #define MODE_Mouse1005 (MODES_SCREEN+7) // Xterm-style extended coordinates
#define MODE_132Columns (MODES_SCREEN+8) // 80 <-> 132 column mode switch (DECCOLM) #define MODE_Mouse1006 (MODES_SCREEN+8) // 2nd Xterm-style extended coordinates
#define MODE_Allow132Columns (MODES_SCREEN+9) // Allow DECCOLM mode #define MODE_Mouse1015 (MODES_SCREEN+9) // Urxvt-style extended coordinates
#define MODE_total (MODES_SCREEN+10) #define MODE_Ansi (MODES_SCREEN+10) // Use US Ascii for character sets G0-G3 (DECANM)
#define MODE_132Columns (MODES_SCREEN+11) // 80 <-> 132 column mode switch (DECCOLM)
#define MODE_Allow132Columns (MODES_SCREEN+12) // Allow DECCOLM mode
#define MODE_BracketedPaste (MODES_SCREEN+13) // Xterm-style bracketed paste mode
#define MODE_total (MODES_SCREEN+14)
namespace Konsole namespace Konsole
{ {
@ -91,6 +95,8 @@ public slots:
virtual void sendText(const QString& text); virtual void sendText(const QString& text);
virtual void sendKeyEvent(QKeyEvent*); virtual void sendKeyEvent(QKeyEvent*);
virtual void sendMouseEvent(int buttons, int column, int line, int eventType); virtual void sendMouseEvent(int buttons, int column, int line, int eventType);
virtual void focusLost() Q_DECL_OVERRIDE;
virtual void focusGained() Q_DECL_OVERRIDE;
protected: protected:
// reimplemented from Emulation // reimplemented from Emulation
@ -184,6 +190,8 @@ private:
//output from the terminal //output from the terminal
QHash<int,QString> _pendingTitleUpdates; QHash<int,QString> _pendingTitleUpdates;
QTimer* _titleUpdateTimer; QTimer* _titleUpdateTimer;
bool _reportFocusEvents;
}; };
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

@ -1,102 +0,0 @@
#include "qtermwidgetplugin.h"
#include <QtPlugin>
#include "qtermwidget.h"
QTermWidgetPlugin::QTermWidgetPlugin(QObject *parent)
: QObject(parent), initialized(false)
{
Q_INIT_RESOURCE(qtermwidgetplugin);
}
QTermWidgetPlugin::~QTermWidgetPlugin()
{
}
void QTermWidgetPlugin::initialize(QDesignerFormEditorInterface * /* core */)
{
initialized = true;
}
bool QTermWidgetPlugin::isInitialized() const
{
return initialized;
}
QWidget *QTermWidgetPlugin::createWidget(QWidget *parent)
{
return new QTermWidget(0, parent);
}
QString QTermWidgetPlugin::name() const
{
return "QTermWidget";
}
QString QTermWidgetPlugin::group() const
{
return "Input Widgets";
}
QIcon QTermWidgetPlugin::icon() const
{
return QIcon(":qtermwidget.png");
}
QString QTermWidgetPlugin::toolTip() const
{
return "QTermWidget component/widget";
}
QString QTermWidgetPlugin::whatsThis() const
{
return "Qt based terminal emulator";
}
bool QTermWidgetPlugin::isContainer() const
{
return false;
}
QString QTermWidgetPlugin::domXml() const
{
return "<widget class=\"QTermWidget\" name=\"termWidget\">\n"
" <property name=\"geometry\">\n"
" <rect>\n"
" <x>0</x>\n"
" <y>0</y>\n"
" <width>400</width>\n"
" <height>200</height>\n"
" </rect>\n"
" </property>\n"
" <property name=\"toolTip\" >\n"
" <string></string>\n"
" </property>\n"
" <property name=\"whatsThis\" >\n"
" <string></string>\n"
" </property>\n"
"</widget>\n";
}
QString QTermWidgetPlugin::includeFile() const
{
return "qtermwidget.h";
}
Q_EXPORT_PLUGIN2(QTermWidgetPlugin, QTermWidgetPlugin)

@ -1,33 +0,0 @@
#ifndef QTERMWIDGETPLUGIN_H
#define QTERMWIDGETPLUGIN_H
#include <QDesignerCustomWidgetInterface>
class QTermWidgetPlugin : public QObject, public QDesignerCustomWidgetInterface
{
Q_OBJECT
Q_INTERFACES(QDesignerCustomWidgetInterface)
public:
QTermWidgetPlugin(QObject *parent = 0);
virtual ~QTermWidgetPlugin();
bool isContainer() const;
bool isInitialized() const;
QIcon icon() const;
QString domXml() const;
QString group() const;
QString includeFile() const;
QString name() const;
QString toolTip() const;
QString whatsThis() const;
QWidget *createWidget(QWidget *parent);
void initialize(QDesignerFormEditorInterface *core);
private:
bool initialized;
};
#endif

@ -1,6 +0,0 @@
<!DOCTYPE RCC>
<RCC version="1.0">
<qresource>
<file>qtermwidget.png</file>
</qresource>
</RCC>

@ -299,6 +299,7 @@ void QTermWidget::init(int startnow)
m_impl->m_session->addView(m_impl->m_terminalDisplay); m_impl->m_session->addView(m_impl->m_terminalDisplay);
connect(m_impl->m_session, SIGNAL(resizeRequest(QSize)), this, SLOT(setSize(QSize)));
connect(m_impl->m_session, SIGNAL(finished()), this, SLOT(sessionFinished())); connect(m_impl->m_session, SIGNAL(finished()), this, SLOT(sessionFinished()));
} }
@ -431,11 +432,11 @@ QStringList QTermWidget::availableColorSchemes()
return ret; return ret;
} }
void QTermWidget::setSize(int h, int v) void QTermWidget::setSize(const QSize &size)
{ {
if (!m_impl->m_terminalDisplay) if (!m_impl->m_terminalDisplay)
return; return;
m_impl->m_terminalDisplay->setSize(h, v); m_impl->m_terminalDisplay->setSize(size.width(), size.height());
} }
void QTermWidget::setHistorySize(int lines) void QTermWidget::setHistorySize(int lines)

@ -99,9 +99,6 @@ public:
void setColorScheme(const QString & name); void setColorScheme(const QString & name);
static QStringList availableColorSchemes(); static QStringList availableColorSchemes();
//set size
void setSize(int h, int v);
// History size for scrolling // History size for scrolling
void setHistorySize(int lines); //infinite if lines < 0 void setHistorySize(int lines); //infinite if lines < 0
@ -216,6 +213,9 @@ public slots:
void zoomIn(); void zoomIn();
void zoomOut(); void zoomOut();
// Set size
void setSize(const QSize &);
/*! Set named key binding for given widget /*! Set named key binding for given widget
*/ */
void setKeyBindings(const QString & kb); void setKeyBindings(const QString & kb);

@ -1,23 +0,0 @@
PyQt4 Bindings for QTermWidget
By Piotr "Riklaunim" Maliński <riklaunim@gmail.com>,
Alexander Slesarev <alex.slesarev@gmail.com>
PyQt4 QTermWidget Bindings License: GPL3
INSTALL:
1. Download QTermWidget from http://qtermwidget.sourceforge.net/.
2. Compile and install it:
$ cmake .
$ make
$ sudo make install
If `make install` command will not work just copy the qtermwidget.so* files to /usr/lib directory.
3. Install PyQt4 and PyQt4-devel if not yet installed.
4. Configure, compile and install bindings. Execute in terminal in the qtermwidget bindings folder:
$ python config.py
$ make
$ sudo make install
5. You can run ./test.py to test the installed module.

@ -1,85 +0,0 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# PyQt4 bindings for th QTermWidget project.
#
# Copyright (C) 2009 Piotr "Riklaunim" Maliński <riklaunim@gmail.com>,
# Alexander Slesarev <alex.slesarev@gmail.com>
#
# This program 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.
#
# This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
import os
import sipconfig
from PyQt4 import pyqtconfig
# The name of the SIP build file generated by SIP and used by the build
# system.
build_file = "qtermwidget.sbf"
# Get the PyQt configuration information.
config = pyqtconfig.Configuration()
# Get the extra SIP flags needed by the imported qt module. Note that
# this normally only includes those flags (-x and -t) that relate to SIP's
# versioning system.
qt_sip_flags = config.pyqt_sip_flags
# Run SIP to generate the code. Note that we tell SIP where to find the qt
# module's specification files using the -I flag.
os.system(" ".join([config.sip_bin, "-c", ".", "-b", build_file, "-I",
config.pyqt_sip_dir, qt_sip_flags, "qtermwidget.sip"]))
# We are going to install the SIP specification file for this module and
# its configuration module.
installs = []
installs.append(["qtermwidget.sip", os.path.join(config.default_sip_dir,
"qtermwidget")])
installs.append(["qtermwidgetconfig.py", config.default_mod_dir])
# Create the Makefile. The QtModuleMakefile class provided by the
# pyqtconfig module takes care of all the extra preprocessor, compiler and
# linker flags needed by the Qt library.
makefile = pyqtconfig.QtGuiModuleMakefile(
configuration = config,
build_file = build_file,
installs = installs)
# Add the library we are wrapping. The name doesn't include any platform
# specific prefixes or extensions (e.g. the "lib" prefix on UNIX, or the
# ".dll" extension on Windows).
makefile.extra_lib_dirs.append("..")
makefile.extra_libs = ["qtermwidget4"]
# Generate the Makefile itself.
makefile.generate()
# Now we create the configuration module. This is done by merging a Python
# dictionary (whose values are normally determined dynamically) with a
# (static) template.
content = {
# Publish where the SIP specifications for this module will be
# installed.
"qtermwidget_sip_dir": config.default_sip_dir,
# Publish the set of SIP flags needed by this module. As these are the
# same flags needed by the qt module we could leave it out, but this
# allows us to change the flags at a later date without breaking
# scripts that import the configuration module.
"qtermwidget_sip_flags": qt_sip_flags}
# This creates the qtermwidgetconfig.py module from the qtermwidgetconfig.py.in
# template and the dictionary.
sipconfig.create_config_module("qtermwidgetconfig.py", "config.py.in", content)

@ -1,83 +0,0 @@
%Module QTermWidget 0
%Import QtCore/QtCoremod.sip
%Import QtGui/QtGuimod.sip
class QTermWidget : QWidget {
%TypeHeaderCode
#include <../lib/qtermwidget.h>
%End
public:
enum ScrollBarPosition
{
NoScrollBar=0,
ScrollBarLeft=1,
ScrollBarRight=2
};
QTermWidget(int startnow = 1, QWidget *parent = 0);
~QTermWidget();
QSize sizeHint() const;
void startShellProgram();
int getShellPID();
void changeDir(const QString & dir);
void setTerminalFont(QFont &font);
QFont getTerminalFont();
void setTerminalOpacity(qreal level);
void setEnvironment(const QStringList & environment);
void setShellProgram(const QString & progname);
void setWorkingDirectory(const QString & dir);
QString workingDirectory();
void setArgs(QStringList &args);
void setTextCodec(QTextCodec *codec);
void setColorScheme(const QString & name);
static QStringList availableColorSchemes();
void setSize(int h, int v);
void setHistorySize(int lines);
void setScrollBarPosition(ScrollBarPosition);
void scrollToEnd();
void sendText(QString &text);
void setFlowControlEnabled(bool enabled);
bool flowControlEnabled();
void setFlowControlWarningEnabled(bool enabled);
static QStringList availableKeyBindings();
QString keyBindings();
void setMotionAfterPasting(int);
int historyLinesCount();
int screenColumnsCount();
void setSelectionStart(int row, int column);
void setSelectionEnd(int row, int column);
void getSelectionStart(int& row, int& column);
void getSelectionEnd(int& row, int& column);
QString selectedText(bool preserveLineBreaks = true);
void setMonitorActivity(bool);
void setMonitorSilence(bool);
void setSilenceTimeout(int seconds);
signals:
void finished();
void copyAvailable(bool);
void termGetFocus();
void termLostFocus();
void termKeyPressed(QKeyEvent *);
void urlActivated(const QUrl&);
void bell(const QString& message);
void activity();
void silence();
public slots:
void copyClipboard();
void pasteClipboard();
void pasteSelection();
void zoomIn();
void zoomOut();
void setKeyBindings(const QString & kb);
void clear();
void toggleShowSearchBar();
protected:
void resizeEvent(QResizeEvent *e);
private:
void *createTermWidget(int startnow, void *parent);
};

@ -1,34 +0,0 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# PyQt4 bindings for th QTermWidget project.
#
# Copyright (C) 2009 Piotr "Riklaunim" Maliński <riklaunim@gmail.com>,
# Alexander Slesarev <alex.slesarev@gmail.com>
#
# This program 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.
#
# This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
import sys, signal
from PyQt4 import Qt
from PyQt4.QtCore import SIGNAL, SLOT
import QTermWidget
signal.signal(signal.SIGINT, signal.SIG_DFL)
a = Qt.QApplication(sys.argv)
w = QTermWidget.QTermWidget()
w.show()
w.connect(w, SIGNAL('finished()'), a, SLOT('quit()'))
a.exec_()

@ -50,8 +50,7 @@ Summary: Qt4 terminal widget - development package
Group: "Development/Libraries/CandC++" Group: "Development/Libraries/CandC++"
Requires: %{libname} Requires: %{libname}
%description devel %description devel
Development package for QTermWidget. Contains headers, dev-libs, Development package for QTermWidget. Contains headers and dev-libs.
and Qt4 designer plugin.
%prep %prep
%setup %setup
@ -82,7 +81,7 @@ ldconfig
%files -n %{libname} %files -n %{libname}
%defattr(-,root,root,-) %defattr(-,root,root,-)
%doc AUTHORS COPYING Changelog INSTALL README %doc AUTHORS LICENSE Changelog INSTALL README
%{_libdir}/lib%{name}.so.%{version} %{_libdir}/lib%{name}.so.%{version}
%{_datadir}/%{name} %{_datadir}/%{name}
%{_datadir}/%{name}/* %{_datadir}/%{name}/*
@ -92,7 +91,6 @@ ldconfig
%{_includedir}/*.h %{_includedir}/*.h
%{_libdir}/*.so %{_libdir}/*.so
%{_libdir}/*.so.0 %{_libdir}/*.so.0
%{_libdir}/qt4/plugins/designer/lib%{name}plugin.so
%changelog %changelog
* Mon Oct 29 2010 Petr Vanek <petr@scribus.info> 0.2 * Mon Oct 29 2010 Petr Vanek <petr@scribus.info> 0.2

Loading…
Cancel
Save