diff --git a/README.md b/README.md index e37acc8..3ec6009 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,15 @@ cool-old-term is a terminal emulator which tries to mimic the look and feel of the old cathode tube screens. It has been designed to be eye-candy, customizable, and reasonably lightweight. -It is a fork of another qt5 terminal emulator: https://github.com/jorgen/yat +It now uses the konsole engine which is powerful and stable. To build and launch it (Qt5.2 are required): - git clone https://github.com/Swordifish90/cool-old-term + git clone https://github.com/Swordifish90/cool-old-term.git cd cool-old-term - qmake - make + cd konsole-qml-plugin + qmake && make && make install + cd .. ./cool-old-term This is still an eary release, but you are free to test it and tell me what do you think. diff --git a/qml/cool-old-term/ColorButton.qml b/app/ColorButton.qml similarity index 100% rename from qml/cool-old-term/ColorButton.qml rename to app/ColorButton.qml diff --git a/qml/cool-old-term/HighlightArea.qml b/app/HighlightArea.qml similarity index 100% rename from qml/cool-old-term/HighlightArea.qml rename to app/HighlightArea.qml diff --git a/qml/cool-old-term/SettingComponent.qml b/app/SettingComponent.qml similarity index 100% rename from qml/cool-old-term/SettingComponent.qml rename to app/SettingComponent.qml diff --git a/qml/cool-old-term/SettingsWindow.qml b/app/SettingsWindow.qml similarity index 100% rename from qml/cool-old-term/SettingsWindow.qml rename to app/SettingsWindow.qml diff --git a/qml/cool-old-term/ShaderManager.qml b/app/ShaderManager.qml similarity index 100% rename from qml/cool-old-term/ShaderManager.qml rename to app/ShaderManager.qml diff --git a/qml/cool-old-term/ShaderSettings.qml b/app/ShaderSettings.qml similarity index 100% rename from qml/cool-old-term/ShaderSettings.qml rename to app/ShaderSettings.qml diff --git a/qml/cool-old-term/Storage.qml b/app/Storage.qml similarity index 100% rename from qml/cool-old-term/Storage.qml rename to app/Storage.qml diff --git a/qml/cool-old-term/TerminalWindow.qml b/app/TerminalWindow.qml similarity index 86% rename from qml/cool-old-term/TerminalWindow.qml rename to app/TerminalWindow.qml index 7b1927f..8b5db42 100644 --- a/qml/cool-old-term/TerminalWindow.qml +++ b/app/TerminalWindow.qml @@ -23,6 +23,7 @@ import QtQuick.Window 2.0 import QtQuick.Controls 1.0 import QtGraphicalEffects 1.0 +import org.kde.konsole 0.1 ApplicationWindow{ id: terminalWindow @@ -95,15 +96,29 @@ ApplicationWindow{ source: shadersettings.frame_source } - TerminalScreen { + KTerminal { id: terminal - anchors.fill: parent - //FIXME: Ugly forced clear terminal at the beginning + font.pointSize: 15 + font.family: "Pet Me" + + colorScheme: "WhiteOnBlack" + width: parent.width + height: parent.height + + session: KSession { + id: ksession + kbScheme: "linux" + + onFinished: { + Qt.quit() + } + } + Component.onCompleted: { - terminal.screen.sendKey("l", 76, 67108864); - terminal.setTerminalHeight(); - terminal.setTerminalWidth(); + font.pointSize = 15; + font.family = "Pet Me"; + } } diff --git a/app/app.qmlproject.user b/app/app.qmlproject.user new file mode 100644 index 0000000..c73232a --- /dev/null +++ b/app/app.qmlproject.user @@ -0,0 +1,139 @@ + + + + + + ProjectExplorer.Project.ActiveTarget + 0 + + + ProjectExplorer.Project.EditorSettings + + true + false + true + + Cpp + + CppGlobal + + + + QmlJS + + QmlJSGlobal + + + 2 + UTF-8 + false + 4 + false + true + 1 + true + 0 + true + 0 + 8 + true + 1 + true + true + true + false + + + + ProjectExplorer.Project.PluginSettings + + + + ProjectExplorer.Project.Target.0 + + Desktop Qt 5.2.0 GCC 64bit + Desktop Qt 5.2.0 GCC 64bit + qt.520.gcc_64.essentials_kit + -1 + 0 + 0 + 0 + + + 0 + Deploy + + ProjectExplorer.BuildSteps.Deploy + + 1 + Deploy locally + + ProjectExplorer.DefaultDeployConfiguration + + 1 + + + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 0 + + + QML Scene + QmlProjectManager.QmlRunConfiguration.QmlScene + CurrentFile + + 3768 + false + true + false + true + false + + 1 + + + + ProjectExplorer.Project.TargetCount + 1 + + + ProjectExplorer.Project.Updater.EnvironmentId + {76aa359f-2663-43c5-a318-565e5b679f49} + + + ProjectExplorer.Project.Updater.FileVersion + 15 + + diff --git a/qml/cool-old-term/fonts/Atari8bit/ATARI400800_original.TTF b/app/fonts/Atari8bit/ATARI400800_original.TTF similarity index 100% rename from qml/cool-old-term/fonts/Atari8bit/ATARI400800_original.TTF rename to app/fonts/Atari8bit/ATARI400800_original.TTF diff --git a/qml/cool-old-term/fonts/Atari8bit/ATARI400800_rounded.TTF b/app/fonts/Atari8bit/ATARI400800_rounded.TTF similarity index 100% rename from qml/cool-old-term/fonts/Atari8bit/ATARI400800_rounded.TTF rename to app/fonts/Atari8bit/ATARI400800_rounded.TTF diff --git a/qml/cool-old-term/fonts/Atari8bit/ATARI400800_squared.TTF b/app/fonts/Atari8bit/ATARI400800_squared.TTF similarity index 100% rename from qml/cool-old-term/fonts/Atari8bit/ATARI400800_squared.TTF rename to app/fonts/Atari8bit/ATARI400800_squared.TTF diff --git a/qml/cool-old-term/fonts/Atari8bit/ReadMe.rtf b/app/fonts/Atari8bit/ReadMe.rtf similarity index 100% rename from qml/cool-old-term/fonts/Atari8bit/ReadMe.rtf rename to app/fonts/Atari8bit/ReadMe.rtf diff --git a/qml/cool-old-term/fonts/Commodore64/C64_Elite_Mono_v1.0-STYLE.ttf b/app/fonts/Commodore64/C64_Elite_Mono_v1.0-STYLE.ttf similarity index 100% rename from qml/cool-old-term/fonts/Commodore64/C64_Elite_Mono_v1.0-STYLE.ttf rename to app/fonts/Commodore64/C64_Elite_Mono_v1.0-STYLE.ttf diff --git a/qml/cool-old-term/fonts/Commodore64/C64_Pro_Mono_v1.0-STYLE.ttf b/app/fonts/Commodore64/C64_Pro_Mono_v1.0-STYLE.ttf similarity index 100% rename from qml/cool-old-term/fonts/Commodore64/C64_Pro_Mono_v1.0-STYLE.ttf rename to app/fonts/Commodore64/C64_Pro_Mono_v1.0-STYLE.ttf diff --git a/qml/cool-old-term/fonts/Commodore64/C64_Pro_v1.0-STYLE.ttf b/app/fonts/Commodore64/C64_Pro_v1.0-STYLE.ttf similarity index 100% rename from qml/cool-old-term/fonts/Commodore64/C64_Pro_v1.0-STYLE.ttf rename to app/fonts/Commodore64/C64_Pro_v1.0-STYLE.ttf diff --git a/qml/cool-old-term/fonts/Commodore64/C64_User_Mono_v1.0-STYLE.ttf b/app/fonts/Commodore64/C64_User_Mono_v1.0-STYLE.ttf similarity index 100% rename from qml/cool-old-term/fonts/Commodore64/C64_User_Mono_v1.0-STYLE.ttf rename to app/fonts/Commodore64/C64_User_Mono_v1.0-STYLE.ttf diff --git a/qml/cool-old-term/fonts/Commodore64/C64_User_v1.0-STYLE.ttf b/app/fonts/Commodore64/C64_User_v1.0-STYLE.ttf similarity index 100% rename from qml/cool-old-term/fonts/Commodore64/C64_User_v1.0-STYLE.ttf rename to app/fonts/Commodore64/C64_User_v1.0-STYLE.ttf diff --git a/qml/cool-old-term/fonts/Commodore64/license.txt b/app/fonts/Commodore64/license.txt similarity index 100% rename from qml/cool-old-term/fonts/Commodore64/license.txt rename to app/fonts/Commodore64/license.txt diff --git a/qml/cool-old-term/fonts/CommodorePET/COMMODORE_PET.ttf b/app/fonts/CommodorePET/COMMODORE_PET.ttf similarity index 100% rename from qml/cool-old-term/fonts/CommodorePET/COMMODORE_PET.ttf rename to app/fonts/CommodorePET/COMMODORE_PET.ttf diff --git a/qml/cool-old-term/fonts/CommodorePET/COMMODORE_PET_128.ttf b/app/fonts/CommodorePET/COMMODORE_PET_128.ttf similarity index 100% rename from qml/cool-old-term/fonts/CommodorePET/COMMODORE_PET_128.ttf rename to app/fonts/CommodorePET/COMMODORE_PET_128.ttf diff --git a/qml/cool-old-term/fonts/CommodorePET/COMMODORE_PET_128_2y.ttf b/app/fonts/CommodorePET/COMMODORE_PET_128_2y.ttf similarity index 100% rename from qml/cool-old-term/fonts/CommodorePET/COMMODORE_PET_128_2y.ttf rename to app/fonts/CommodorePET/COMMODORE_PET_128_2y.ttf diff --git a/qml/cool-old-term/fonts/CommodorePET/COMMODORE_PET_2x.ttf b/app/fonts/CommodorePET/COMMODORE_PET_2x.ttf similarity index 100% rename from qml/cool-old-term/fonts/CommodorePET/COMMODORE_PET_2x.ttf rename to app/fonts/CommodorePET/COMMODORE_PET_2x.ttf diff --git a/qml/cool-old-term/fonts/CommodorePET/COMMODORE_PET_2y.ttf b/app/fonts/CommodorePET/COMMODORE_PET_2y.ttf similarity index 100% rename from qml/cool-old-term/fonts/CommodorePET/COMMODORE_PET_2y.ttf rename to app/fonts/CommodorePET/COMMODORE_PET_2y.ttf diff --git a/qml/cool-old-term/fonts/CommodorePET/COMMODORE_PET_64.ttf b/app/fonts/CommodorePET/COMMODORE_PET_64.ttf similarity index 100% rename from qml/cool-old-term/fonts/CommodorePET/COMMODORE_PET_64.ttf rename to app/fonts/CommodorePET/COMMODORE_PET_64.ttf diff --git a/qml/cool-old-term/fonts/CommodorePET/COMMODORE_PET_64_2y.ttf b/app/fonts/CommodorePET/COMMODORE_PET_64_2y.ttf similarity index 100% rename from qml/cool-old-term/fonts/CommodorePET/COMMODORE_PET_64_2y.ttf rename to app/fonts/CommodorePET/COMMODORE_PET_64_2y.ttf diff --git a/qml/cool-old-term/fonts/CommodorePET/FreeLicense.txt b/app/fonts/CommodorePET/FreeLicense.txt similarity index 100% rename from qml/cool-old-term/fonts/CommodorePET/FreeLicense.txt rename to app/fonts/CommodorePET/FreeLicense.txt diff --git a/qml/cool-old-term/fonts/Dos/Perfect DOS VGA 437 Win.ttf b/app/fonts/Dos/Perfect DOS VGA 437 Win.ttf similarity index 100% rename from qml/cool-old-term/fonts/Dos/Perfect DOS VGA 437 Win.ttf rename to app/fonts/Dos/Perfect DOS VGA 437 Win.ttf diff --git a/qml/cool-old-term/fonts/Dos/Perfect DOS VGA 437.ttf b/app/fonts/Dos/Perfect DOS VGA 437.ttf similarity index 100% rename from qml/cool-old-term/fonts/Dos/Perfect DOS VGA 437.ttf rename to app/fonts/Dos/Perfect DOS VGA 437.ttf diff --git a/qml/cool-old-term/fonts/Dos/dos437.txt b/app/fonts/Dos/dos437.txt similarity index 100% rename from qml/cool-old-term/fonts/Dos/dos437.txt rename to app/fonts/Dos/dos437.txt diff --git a/qml/cool-old-term/frames/BlackRoughFrame.qml b/app/frames/BlackRoughFrame.qml similarity index 100% rename from qml/cool-old-term/frames/BlackRoughFrame.qml rename to app/frames/BlackRoughFrame.qml diff --git a/qml/cool-old-term/frames/NoFrame.qml b/app/frames/NoFrame.qml similarity index 100% rename from qml/cool-old-term/frames/NoFrame.qml rename to app/frames/NoFrame.qml diff --git a/qml/cool-old-term/frames/WhiteSimpleFrame.qml b/app/frames/WhiteSimpleFrame.qml similarity index 100% rename from qml/cool-old-term/frames/WhiteSimpleFrame.qml rename to app/frames/WhiteSimpleFrame.qml diff --git a/qml/cool-old-term/frames/images/black-frame-normals.png b/app/frames/images/black-frame-normals.png similarity index 100% rename from qml/cool-old-term/frames/images/black-frame-normals.png rename to app/frames/images/black-frame-normals.png diff --git a/qml/cool-old-term/frames/images/black-frame.png b/app/frames/images/black-frame.png similarity index 100% rename from qml/cool-old-term/frames/images/black-frame.png rename to app/frames/images/black-frame.png diff --git a/qml/cool-old-term/frames/images/screen-frame-normals.png b/app/frames/images/screen-frame-normals.png similarity index 100% rename from qml/cool-old-term/frames/images/screen-frame-normals.png rename to app/frames/images/screen-frame-normals.png diff --git a/qml/cool-old-term/frames/images/screen-frame.png b/app/frames/images/screen-frame.png similarity index 100% rename from qml/cool-old-term/frames/images/screen-frame.png rename to app/frames/images/screen-frame.png diff --git a/qml/cool-old-term/frames/utils/NoFrameShader.qml b/app/frames/utils/NoFrameShader.qml similarity index 100% rename from qml/cool-old-term/frames/utils/NoFrameShader.qml rename to app/frames/utils/NoFrameShader.qml diff --git a/qml/cool-old-term/frames/utils/TerminalFrame.qml b/app/frames/utils/TerminalFrame.qml similarity index 100% rename from qml/cool-old-term/frames/utils/TerminalFrame.qml rename to app/frames/utils/TerminalFrame.qml diff --git a/qml/cool-old-term/frames/utils/WhiteFrameShader.qml b/app/frames/utils/WhiteFrameShader.qml similarity index 100% rename from qml/cool-old-term/frames/utils/WhiteFrameShader.qml rename to app/frames/utils/WhiteFrameShader.qml diff --git a/qml/cool-old-term/main.qml b/app/main.qml similarity index 97% rename from qml/cool-old-term/main.qml rename to app/main.qml index ffabe48..0ef3762 100644 --- a/qml/cool-old-term/main.qml +++ b/app/main.qml @@ -21,6 +21,9 @@ import QtQuick 2.1 import QtQuick.Window 2.0 import QtQuick.Controls 1.0 + +import org.kde.konsole 0.1 + Item{ ShaderSettings{ id: shadersettings diff --git a/cool-old-term b/cool-old-term new file mode 100755 index 0000000..1ecde91 --- /dev/null +++ b/cool-old-term @@ -0,0 +1,2 @@ +#!/bin/bash +qmlscene -I imports app/main.qml diff --git a/cool-old-term.pro b/cool-old-term.pro index 05ef0d0..a478cea 100644 --- a/cool-old-term.pro +++ b/cool-old-term.pro @@ -1,52 +1,4 @@ -QT += widgets quick core-private gui-private qml-private quick quick-private - -include(yat/yat_declarative/yat_declarative.pro) - -# If your application uses the Qt Mobility libraries, uncomment the following -# lines and add the respective components to the MOBILITY variable. -# CONFIG += mobility -# MOBILITY += - -# The .cpp file which was generated for your project. Feel free to hack it. -SOURCES += main.cpp - -# Installation path -# target.path = - -OTHER_FILES += \ - $$PWD/qml/cool-old-term/main.qml \ - $$PWD/qml/cool-old-term/TerminalLine.qml \ - $$PWD/qml/cool-old-term/TerminalScreen.qml \ - $$PWD/qml/cool-old-term/TerminalText.qml \ - $$PWD/qml/cool-old-term/HighlightArea.qml \ - $$PWD/qml/cool-old-term/ShaderSettings.qml \ - $$PWD/qml/images/frame.png \ - $$PWD/qml/cool-old-term/SettingsWindow.qml \ - $$PWD/qml/cool-old-term/SettingComponent.qml \ - $$PWD/qml/cool-old-term/ColorButton.qml \ - $$PWD/qml/cool-old-term/TerminalFrame.qml \ - $$PWD/qml/cool-old-term/WhiteFrameShader.qml \ - $$PWD/qml/cool-old-term/NoFrameShader.qml \ - $$PWD/qml/cool-old-term/WhiteSimpleFrame.qml \ - qml/cool-old-term/BlackRoughFrame.qml \ - qml/cool-old-term/Frames/BlackRoughFrame.qml \ - qml/cool-old-term/Frames/NoFrameShader.qml \ - qml/cool-old-term/Frames/WhiteFrameShader.qml \ - qml/cool-old-term/Frames/WhiteSimpleFrame.qml \ - qml/cool-old-term/Frames/TerminalFrame.qml \ - qml/cool-old-term/Frames/utils/NoFrameShader.qml \ - qml/cool-old-term/Frames/utils/TerminalFrame.qml \ - qml/cool-old-term/Frames/utils/WhiteFrameShader.qml \ - qml/cool-old-term/frames/WhiteSimpleFrame.qml \ - qml/cool-old-term/frames/BlackRoughFrame.qml \ - qml/cool-old-term/frames/utils/NoFrameShader.qml \ - qml/cool-old-term/frames/utils/TerminalFrame.qml \ - qml/cool-old-term/frames/utils/WhiteFrameShader.qml \ - qml/cool-old-term/frames/images/screen-frame.png \ - qml/cool-old-term/frames/images/screen-frame-normals.png \ - qml/cool-old-term/frames/images/black-frame.png \ - qml/cool-old-term/frames/images/black-frame-normals.png \ - qml/cool-old-term/frames/NoFrame.qml \ - qml/cool-old-term/TerminalWindow.qml \ - qml/cool-old-term/Storage.qml \ - qml/cool-old-term/ShaderManager.qml +TEMPLATE =subdirs +CONFIG += ordered +SUBDIRS= konsole-qml-plugin\ + app diff --git a/konsole-qml-plugin/Makefile b/konsole-qml-plugin/Makefile new file mode 100644 index 0000000..c78ed92 --- /dev/null +++ b/konsole-qml-plugin/Makefile @@ -0,0 +1,5523 @@ +############################################################################# +# Makefile for building: libkdekonsole.so +# Generated by qmake (3.0) (Qt 5.2.1) +# Project: konsole-qml-plugin.pro +# Template: lib +# Command: /usr/lib/x86_64-linux-gnu/qt5/bin/qmake -o Makefile konsole-qml-plugin.pro +############################################################################# + +MAKEFILE = Makefile + +####### Compiler, tools and options + +CC = gcc +CXX = g++ +DEFINES = -DHAVE_POSIX_OPENPT -DHAVE_SYS_TIME_H -DHAVE_UPDWTMPX -DQ_WS_UBUNTU -DQT_NO_DEBUG -DQT_PLUGIN -DQT_QUICK_LIB -DQT_QML_LIB -DQT_WIDGETS_LIB -DQT_NETWORK_LIB -DQT_GUI_LIB -DQT_CORE_LIB +CFLAGS = -m64 -pipe -O2 -fvisibility=hidden -D_REENTRANT -Wall -W -fPIC $(DEFINES) +CXXFLAGS = -m64 -pipe -O2 -fvisibility=hidden -fvisibility-inlines-hidden -D_REENTRANT -Wall -W -fPIC $(DEFINES) +INCPATH = -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++-64 -I. -I/usr/include/qt5 -I/usr/include/qt5/QtQuick -I/usr/include/qt5/QtQml -I/usr/include/qt5/QtWidgets -I/usr/include/qt5/QtNetwork -I/usr/include/qt5/QtGui -I/usr/include/qt5/QtCore -I.moc +LINK = g++ +LFLAGS = -m64 -Wl,-O1 -shared +LIBS = $(SUBLIBS) -L/usr/X11R6/lib64 -lQt5Quick -L/usr/lib/x86_64-linux-gnu -lQt5Qml -lQt5Widgets -lQt5Network -lQt5Gui -lQt5Core -lGL -lpthread +AR = ar cqs +RANLIB = +QMAKE = /usr/lib/x86_64-linux-gnu/qt5/bin/qmake +TAR = tar -cf +COMPRESS = gzip -9f +COPY = cp -f +SED = sed +COPY_FILE = cp -f +COPY_DIR = cp -f -R +STRIP = strip +INSTALL_FILE = install -m 644 -p +INSTALL_DIR = $(COPY_DIR) +INSTALL_PROGRAM = install -m 755 -p +DEL_FILE = rm -f +SYMLINK = ln -f -s +DEL_DIR = rmdir +MOVE = mv -f +CHK_DIR_EXISTS= test -d +MKDIR = mkdir -p + +####### Output directory + +OBJECTS_DIR = .obj/ + +####### Files + +SOURCES = src/plugin.cpp \ + src/Pty.cpp \ + src/kptyprocess.cpp \ + src/kptydevice.cpp \ + src/kpty.cpp \ + src/kprocess.cpp \ + src/ShellCommand.cpp \ + src/Vt102Emulation.cpp \ + src/tools.cpp \ + src/Session.cpp \ + src/Screen.cpp \ + src/KeyboardTranslator.cpp \ + src/Emulation.cpp \ + src/History.cpp \ + src/BlockArray.cpp \ + src/TerminalCharacterDecoder.cpp \ + src/konsole_wcwidth.cpp \ + src/ScreenWindow.cpp \ + src/Filter.cpp \ + src/ColorScheme.cpp \ + src/TerminalDisplay.cpp \ + src/ksession.cpp .moc/moc_plugin.cpp \ + .moc/moc_Pty.cpp \ + .moc/moc_kptyprocess.cpp \ + .moc/moc_kptydevice.cpp \ + .moc/moc_kprocess.cpp \ + .moc/moc_Vt102Emulation.cpp \ + .moc/moc_Session.cpp \ + .moc/moc_Emulation.cpp \ + .moc/moc_ScreenWindow.cpp \ + .moc/moc_Filter.cpp \ + .moc/moc_TerminalDisplay.cpp \ + .moc/moc_ksession.cpp +OBJECTS = .obj/plugin.o \ + .obj/Pty.o \ + .obj/kptyprocess.o \ + .obj/kptydevice.o \ + .obj/kpty.o \ + .obj/kprocess.o \ + .obj/ShellCommand.o \ + .obj/Vt102Emulation.o \ + .obj/tools.o \ + .obj/Session.o \ + .obj/Screen.o \ + .obj/KeyboardTranslator.o \ + .obj/Emulation.o \ + .obj/History.o \ + .obj/BlockArray.o \ + .obj/TerminalCharacterDecoder.o \ + .obj/konsole_wcwidth.o \ + .obj/ScreenWindow.o \ + .obj/Filter.o \ + .obj/ColorScheme.o \ + .obj/TerminalDisplay.o \ + .obj/ksession.o \ + .obj/moc_plugin.o \ + .obj/moc_Pty.o \ + .obj/moc_kptyprocess.o \ + .obj/moc_kptydevice.o \ + .obj/moc_kprocess.o \ + .obj/moc_Vt102Emulation.o \ + .obj/moc_Session.o \ + .obj/moc_Emulation.o \ + .obj/moc_ScreenWindow.o \ + .obj/moc_Filter.o \ + .obj/moc_TerminalDisplay.o \ + .obj/moc_ksession.o +DIST = /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/spec_pre.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/shell-unix.conf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/unix.conf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/linux.conf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/gcc-base.conf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/gcc-base-unix.conf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/g++-base.conf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/g++-unix.conf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/qconfig.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_3d.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_3d_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_3dquick.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_3dquick_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_bootstrap_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_concurrent.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_concurrent_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_core.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_core_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_dbus.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_dbus_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_designer.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_gui.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_gui_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_help.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_location.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_multimedia.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_multimediawidgets.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_network.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_network_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_opengl.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_opengl_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_openglextensions.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_openglextensions_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_platformsupport_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_positioning.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_printsupport.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_printsupport_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_qml.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_qml_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_qmldevtools_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_qmltest.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_qmltest_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_quick.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_quick_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_quickparticles_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_script.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_scripttools.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_sensors.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_sql.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_sql_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_svg.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_testlib.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_testlib_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_uitools.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_webkit.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_webkit_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_webkitwidgets.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_webkitwidgets_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_widgets.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_widgets_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_xml.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_xml_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_xmlpatterns.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt_functions.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt_config.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++-64/qmake.conf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/spec_post.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/exclusive_builds.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/default_pre.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/resolve_config.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/default_post.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/unix/hide_symbols.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/resources.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/moc.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/unix/opengl.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/uic.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/unix/thread.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/unix/gdb_dwarf_index.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/warn_on.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/testcase_targets.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/exceptions.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/yacc.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/lex.prf \ + konsole-qml-plugin.pro \ + konsole-qml-plugin.pro +QMAKE_TARGET = kdekonsole +DESTDIR = #avoid trailing-slash linebreak +TARGET = libkdekonsole.so +TARGETD = libkdekonsole.so + + +first: all +####### Implicit rules + +.SUFFIXES: .o .c .cpp .cc .cxx .C + +.cpp.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" + +.cc.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" + +.cxx.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" + +.C.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" + +.c.o: + $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<" + +####### Build rules + +all: Makefile $(TARGET) + +$(TARGET): $(OBJECTS) $(SUBLIBS) $(OBJCOMP) + -$(DEL_FILE) $(TARGET) + $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(LIBS) $(OBJCOMP) + + + +Makefile: konsole-qml-plugin.pro /usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++-64/qmake.conf /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/spec_pre.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/shell-unix.conf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/unix.conf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/linux.conf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/gcc-base.conf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/gcc-base-unix.conf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/g++-base.conf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/g++-unix.conf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/qconfig.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_3d.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_3d_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_3dquick.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_3dquick_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_bootstrap_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_concurrent.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_concurrent_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_core.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_core_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_dbus.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_dbus_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_designer.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_gui.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_gui_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_help.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_location.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_multimedia.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_multimediawidgets.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_network.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_network_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_opengl.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_opengl_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_openglextensions.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_openglextensions_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_platformsupport_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_positioning.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_printsupport.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_printsupport_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_qml.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_qml_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_qmldevtools_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_qmltest.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_qmltest_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_quick.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_quick_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_quickparticles_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_script.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_scripttools.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_sensors.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_sql.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_sql_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_svg.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_testlib.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_testlib_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_uitools.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_webkit.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_webkit_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_webkitwidgets.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_webkitwidgets_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_widgets.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_widgets_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_xml.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_xml_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_xmlpatterns.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt_functions.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt_config.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++-64/qmake.conf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/spec_post.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/exclusive_builds.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/default_pre.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/resolve_config.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/default_post.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/unix/hide_symbols.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/resources.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/moc.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/unix/opengl.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/uic.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/unix/thread.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/unix/gdb_dwarf_index.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/warn_on.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/testcase_targets.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/exceptions.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/yacc.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/lex.prf \ + konsole-qml-plugin.pro \ + /usr/lib/x86_64-linux-gnu/libQt5Quick.prl \ + /usr/lib/x86_64-linux-gnu/libQt5Qml.prl \ + /usr/lib/x86_64-linux-gnu/libQt5Network.prl \ + /usr/lib/x86_64-linux-gnu/libQt5Core.prl \ + /usr/lib/x86_64-linux-gnu/libQt5Gui.prl \ + /usr/lib/x86_64-linux-gnu/libQt5Widgets.prl + $(QMAKE) -o Makefile konsole-qml-plugin.pro +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/spec_pre.prf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/shell-unix.conf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/unix.conf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/linux.conf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/gcc-base.conf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/gcc-base-unix.conf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/g++-base.conf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/g++-unix.conf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/qconfig.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_3d.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_3d_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_3dquick.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_3dquick_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_bootstrap_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_concurrent.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_concurrent_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_core.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_core_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_dbus.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_dbus_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_designer.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_gui.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_gui_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_help.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_location.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_multimedia.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_multimediawidgets.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_network.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_network_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_opengl.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_opengl_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_openglextensions.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_openglextensions_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_platformsupport_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_positioning.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_printsupport.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_printsupport_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_qml.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_qml_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_qmldevtools_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_qmltest.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_qmltest_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_quick.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_quick_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_quickparticles_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_script.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_scripttools.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_sensors.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_sql.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_sql_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_svg.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_testlib.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_testlib_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_uitools.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_webkit.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_webkit_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_webkitwidgets.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_webkitwidgets_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_widgets.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_widgets_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_xml.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_xml_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_xmlpatterns.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt_functions.prf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt_config.prf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++-64/qmake.conf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/spec_post.prf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/exclusive_builds.prf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/default_pre.prf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/resolve_config.prf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/default_post.prf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/unix/hide_symbols.prf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt.prf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/resources.prf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/moc.prf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/unix/opengl.prf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/uic.prf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/unix/thread.prf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/unix/gdb_dwarf_index.prf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/warn_on.prf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/testcase_targets.prf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/exceptions.prf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/yacc.prf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/lex.prf: +konsole-qml-plugin.pro: +/usr/lib/x86_64-linux-gnu/libQt5Quick.prl: +/usr/lib/x86_64-linux-gnu/libQt5Qml.prl: +/usr/lib/x86_64-linux-gnu/libQt5Network.prl: +/usr/lib/x86_64-linux-gnu/libQt5Core.prl: +/usr/lib/x86_64-linux-gnu/libQt5Gui.prl: +/usr/lib/x86_64-linux-gnu/libQt5Widgets.prl: +qmake: FORCE + @$(QMAKE) -o Makefile konsole-qml-plugin.pro + +qmake_all: FORCE + +dist: + @test -d .obj/kdekonsole1.0.0 || mkdir -p .obj/kdekonsole1.0.0 + $(COPY_FILE) --parents $(SOURCES) $(DIST) .obj/kdekonsole1.0.0/ && $(COPY_FILE) --parents src/plugin.h src/Pty.h src/kptyprocess.h src/kptydevice.h src/kpty.h src/kpty_p.h src/kprocess.h src/ShellCommand.h src/Vt102Emulation.h src/tools.h src/Session.h src/Screen.h src/KeyboardTranslator.h src/Emulation.h src/Character.h src/History.h src/CharacterColor.h src/BlockArray.h src/TerminalCharacterDecoder.h src/konsole_wcwidth.h src/ScreenWindow.h src/DefaultTranslatorText.h src/LineFont.h src/Filter.h src/ExtendedDefaultTranslator.h src/ColorTables.h src/ColorScheme.h src/TerminalDisplay.h src/ksession.h .obj/kdekonsole1.0.0/ && $(COPY_FILE) --parents src/plugin.cpp src/Pty.cpp src/kptyprocess.cpp src/kptydevice.cpp src/kpty.cpp src/kprocess.cpp src/ShellCommand.cpp src/Vt102Emulation.cpp src/tools.cpp src/Session.cpp src/Screen.cpp src/KeyboardTranslator.cpp src/Emulation.cpp src/History.cpp src/BlockArray.cpp src/TerminalCharacterDecoder.cpp src/konsole_wcwidth.cpp src/ScreenWindow.cpp src/Filter.cpp src/ColorScheme.cpp src/TerminalDisplay.cpp src/ksession.cpp .obj/kdekonsole1.0.0/ && (cd `dirname .obj/kdekonsole1.0.0` && $(TAR) kdekonsole1.0.0.tar kdekonsole1.0.0 && $(COMPRESS) kdekonsole1.0.0.tar) && $(MOVE) `dirname .obj/kdekonsole1.0.0`/kdekonsole1.0.0.tar.gz . && $(DEL_FILE) -r .obj/kdekonsole1.0.0 + + +clean:compiler_clean + -$(DEL_FILE) $(OBJECTS) + -$(DEL_FILE) *~ core *.core + + +####### Sub-libraries + +distclean: clean + -$(DEL_FILE) $(TARGET) + -$(DEL_FILE) Makefile + + +mocclean: compiler_moc_header_clean compiler_moc_source_clean + +mocables: compiler_moc_header_make_all compiler_moc_source_make_all + +check: first + +compiler_rcc_make_all: +compiler_rcc_clean: +compiler_moc_header_make_all: .moc/moc_plugin.cpp .moc/moc_Pty.cpp .moc/moc_kptyprocess.cpp .moc/moc_kptydevice.cpp .moc/moc_kprocess.cpp .moc/moc_Vt102Emulation.cpp .moc/moc_Session.cpp .moc/moc_Emulation.cpp .moc/moc_ScreenWindow.cpp .moc/moc_Filter.cpp .moc/moc_TerminalDisplay.cpp .moc/moc_ksession.cpp +compiler_moc_header_clean: + -$(DEL_FILE) .moc/moc_plugin.cpp .moc/moc_Pty.cpp .moc/moc_kptyprocess.cpp .moc/moc_kptydevice.cpp .moc/moc_kprocess.cpp .moc/moc_Vt102Emulation.cpp .moc/moc_Session.cpp .moc/moc_Emulation.cpp .moc/moc_ScreenWindow.cpp .moc/moc_Filter.cpp .moc/moc_TerminalDisplay.cpp .moc/moc_ksession.cpp +.moc/moc_plugin.cpp: src/TerminalDisplay.h \ + /usr/include/qt5/QtGui/QColor \ + /usr/include/qt5/QtGui/qcolor.h \ + /usr/include/qt5/QtGui/qrgb.h \ + /usr/include/qt5/QtCore/qglobal.h \ + /usr/include/qt5/QtCore/qconfig.h \ + /usr/include/qt5/QtCore/qfeatures.h \ + /usr/include/qt5/QtCore/qsystemdetection.h \ + /usr/include/qt5/QtCore/qprocessordetection.h \ + /usr/include/qt5/QtCore/qcompilerdetection.h \ + /usr/include/qt5/QtCore/qglobalstatic.h \ + /usr/include/qt5/QtCore/qatomic.h \ + /usr/include/qt5/QtCore/qbasicatomic.h \ + /usr/include/qt5/QtCore/qatomic_bootstrap.h \ + /usr/include/qt5/QtCore/qgenericatomic.h \ + /usr/include/qt5/QtCore/qatomic_msvc.h \ + /usr/include/qt5/QtCore/qatomic_integrity.h \ + /usr/include/qt5/QtCore/qoldbasicatomic.h \ + /usr/include/qt5/QtCore/qatomic_vxworks.h \ + /usr/include/qt5/QtCore/qatomic_power.h \ + /usr/include/qt5/QtCore/qatomic_alpha.h \ + /usr/include/qt5/QtCore/qatomic_armv7.h \ + /usr/include/qt5/QtCore/qatomic_armv6.h \ + /usr/include/qt5/QtCore/qatomic_armv5.h \ + /usr/include/qt5/QtCore/qatomic_bfin.h \ + /usr/include/qt5/QtCore/qatomic_ia64.h \ + /usr/include/qt5/QtCore/qatomic_mips.h \ + /usr/include/qt5/QtCore/qatomic_s390.h \ + /usr/include/qt5/QtCore/qatomic_sh4a.h \ + /usr/include/qt5/QtCore/qatomic_sparc.h \ + /usr/include/qt5/QtCore/qatomic_gcc.h \ + /usr/include/qt5/QtCore/qatomic_x86.h \ + /usr/include/qt5/QtCore/qatomic_cxx11.h \ + /usr/include/qt5/QtCore/qatomic_unix.h \ + /usr/include/qt5/QtCore/qmutex.h \ + /usr/include/qt5/QtCore/qlogging.h \ + /usr/include/qt5/QtCore/qflags.h \ + /usr/include/qt5/QtCore/qtypeinfo.h \ + /usr/include/qt5/QtCore/qtypetraits.h \ + /usr/include/qt5/QtCore/qsysinfo.h \ + /usr/include/qt5/QtCore/qnamespace.h \ + /usr/include/qt5/QtCore/qstringlist.h \ + /usr/include/qt5/QtCore/qalgorithms.h \ + /usr/include/qt5/QtCore/qdatastream.h \ + /usr/include/qt5/QtCore/qscopedpointer.h \ + /usr/include/qt5/QtCore/qiodevice.h \ + /usr/include/qt5/QtCore/qobject.h \ + /usr/include/qt5/QtCore/qobjectdefs.h \ + /usr/include/qt5/QtCore/qobjectdefs_impl.h \ + /usr/include/qt5/QtCore/qstring.h \ + /usr/include/qt5/QtCore/qchar.h \ + /usr/include/qt5/QtCore/qbytearray.h \ + /usr/include/qt5/QtCore/qrefcount.h \ + /usr/include/qt5/QtCore/qarraydata.h \ + /usr/include/qt5/QtCore/qstringbuilder.h \ + /usr/include/qt5/QtCore/qlist.h \ + /usr/include/qt5/QtCore/qiterator.h \ + /usr/include/qt5/QtCore/qcoreevent.h \ + /usr/include/qt5/QtCore/qmetatype.h \ + /usr/include/qt5/QtCore/qvarlengtharray.h \ + /usr/include/qt5/QtCore/qcontainerfwd.h \ + /usr/include/qt5/QtCore/qisenum.h \ + /usr/include/qt5/QtCore/qobject_impl.h \ + /usr/include/qt5/QtCore/qpair.h \ + /usr/include/qt5/QtCore/qregexp.h \ + /usr/include/qt5/QtCore/qstringmatcher.h \ + /usr/include/qt5/QtCore/QPointer \ + /usr/include/qt5/QtCore/qpointer.h \ + /usr/include/qt5/QtCore/qsharedpointer.h \ + /usr/include/qt5/QtCore/qshareddata.h \ + /usr/include/qt5/QtCore/qsharedpointer_impl.h \ + /usr/include/qt5/QtCore/qhash.h \ + src/Filter.h \ + /usr/include/qt5/QtWidgets/QAction \ + /usr/include/qt5/QtWidgets/qaction.h \ + /usr/include/qt5/QtGui/qkeysequence.h \ + /usr/include/qt5/QtWidgets/qwidget.h \ + /usr/include/qt5/QtGui/qwindowdefs.h \ + /usr/include/qt5/QtGui/qwindowdefs_win.h \ + /usr/include/qt5/QtCore/qmargins.h \ + /usr/include/qt5/QtCore/qrect.h \ + /usr/include/qt5/QtCore/qsize.h \ + /usr/include/qt5/QtCore/qpoint.h \ + /usr/include/qt5/QtGui/qpaintdevice.h \ + /usr/include/qt5/QtGui/qpalette.h \ + /usr/include/qt5/QtGui/qbrush.h \ + /usr/include/qt5/QtCore/qvector.h \ + /usr/include/qt5/QtGui/qmatrix.h \ + /usr/include/qt5/QtGui/qpolygon.h \ + /usr/include/qt5/QtGui/qregion.h \ + /usr/include/qt5/QtCore/qline.h \ + /usr/include/qt5/QtGui/qtransform.h \ + /usr/include/qt5/QtGui/qpainterpath.h \ + /usr/include/qt5/QtGui/qimage.h \ + /usr/include/qt5/QtGui/qpixmap.h \ + /usr/include/qt5/QtGui/qfont.h \ + /usr/include/qt5/QtGui/qfontmetrics.h \ + /usr/include/qt5/QtGui/qfontinfo.h \ + /usr/include/qt5/QtWidgets/qsizepolicy.h \ + /usr/include/qt5/QtGui/qcursor.h \ + /usr/include/qt5/QtGui/qevent.h \ + /usr/include/qt5/QtCore/qvariant.h \ + /usr/include/qt5/QtCore/qmap.h \ + /usr/include/qt5/QtCore/qdebug.h \ + /usr/include/qt5/QtCore/qtextstream.h \ + /usr/include/qt5/QtCore/qlocale.h \ + /usr/include/qt5/QtCore/qset.h \ + /usr/include/qt5/QtCore/qcontiguouscache.h \ + /usr/include/qt5/QtCore/qurl.h \ + /usr/include/qt5/QtCore/qurlquery.h \ + /usr/include/qt5/QtCore/qfile.h \ + /usr/include/qt5/QtCore/qfiledevice.h \ + /usr/include/qt5/QtGui/qvector2d.h \ + /usr/include/qt5/QtGui/qtouchdevice.h \ + /usr/include/qt5/QtGui/qicon.h \ + /usr/include/qt5/QtWidgets/qactiongroup.h \ + /usr/include/qt5/QtCore/QList \ + /usr/include/qt5/QtCore/QObject \ + /usr/include/qt5/QtCore/QStringList \ + /usr/include/qt5/QtCore/QHash \ + /usr/include/qt5/QtCore/QRegExp \ + src/Character.h \ + src/CharacterColor.h \ + src/ksession.h \ + src/Session.h \ + /usr/include/qt5/QtCore/QTimer \ + /usr/include/qt5/QtCore/qtimer.h \ + /usr/include/qt5/QtCore/qbasictimer.h \ + /usr/include/qt5/QtGui/QWindow \ + /usr/include/qt5/QtGui/qwindow.h \ + /usr/include/qt5/QtCore/QEvent \ + /usr/include/qt5/QtCore/QMargins \ + /usr/include/qt5/QtCore/QRect \ + /usr/include/qt5/QtGui/qsurface.h \ + /usr/include/qt5/QtGui/qsurfaceformat.h \ + src/History.h \ + /usr/include/qt5/QtCore/QBitRef \ + /usr/include/qt5/QtCore/qbitarray.h \ + /usr/include/qt5/QtCore/QVector \ + /usr/include/qt5/QtCore/QTemporaryFile \ + /usr/include/qt5/QtCore/qtemporaryfile.h \ + src/BlockArray.h \ + /usr/include/qt5/QtQuick/QQuickItem \ + /usr/include/qt5/QtQuick/qquickitem.h \ + /usr/include/qt5/QtQuick/qtquickglobal.h \ + /usr/include/qt5/QtQml/qqml.h \ + /usr/include/qt5/QtQml/qqmlprivate.h \ + /usr/include/qt5/QtQml/qtqmlglobal.h \ + /usr/include/qt5/QtQml/qqmlparserstatus.h \ + /usr/include/qt5/QtQml/qqmlpropertyvaluesource.h \ + /usr/include/qt5/QtQml/qqmllist.h \ + /usr/include/qt5/QtCore/qmetaobject.h \ + /usr/include/qt5/QtQml/qqmlcomponent.h \ + /usr/include/qt5/QtQml/qqmlerror.h \ + /usr/include/qt5/QtQml/qjsvalue.h \ + /usr/include/qt5/QtGui/qaccessible.h \ + /usr/include/qt5/QtCore/qcoreapplication.h \ + /usr/include/qt5/QtCore/qeventloop.h \ + /usr/include/qt5/QtQuick/QQuickPaintedItem \ + /usr/include/qt5/QtQuick/qquickpainteditem.h \ + /usr/include/qt5/QtQml/QQmlEngine \ + /usr/include/qt5/QtQml/qqmlengine.h \ + /usr/include/qt5/QtQml/qjsengine.h \ + /usr/include/qt5/QtQml/qqmldebug.h \ + /usr/include/qt5/QtQml/QQmlExtensionPlugin \ + /usr/include/qt5/QtQml/qqmlextensionplugin.h \ + /usr/include/qt5/QtCore/qplugin.h \ + /usr/include/qt5/QtCore/qjsonobject.h \ + /usr/include/qt5/QtCore/qjsonvalue.h \ + /usr/include/qt5/QtCore/QUrl \ + /usr/include/qt5/QtQml/qqmlextensioninterface.h \ + src/plugin.h + /usr/lib/x86_64-linux-gnu/qt5/bin/moc $(DEFINES) $(INCPATH) -I/usr/include/c++/4.8 -I/usr/include/x86_64-linux-gnu/c++/4.8 -I/usr/include/c++/4.8/backward -I/usr/lib/gcc/x86_64-linux-gnu/4.8/include -I/usr/local/include -I/usr/lib/gcc/x86_64-linux-gnu/4.8/include-fixed -I/usr/include/x86_64-linux-gnu -I/usr/include src/plugin.h -o .moc/moc_plugin.cpp + +.moc/moc_Pty.cpp: /usr/include/qt5/QtCore/QStringList \ + /usr/include/qt5/QtCore/qstringlist.h \ + /usr/include/qt5/QtCore/qalgorithms.h \ + /usr/include/qt5/QtCore/qglobal.h \ + /usr/include/qt5/QtCore/qconfig.h \ + /usr/include/qt5/QtCore/qfeatures.h \ + /usr/include/qt5/QtCore/qsystemdetection.h \ + /usr/include/qt5/QtCore/qprocessordetection.h \ + /usr/include/qt5/QtCore/qcompilerdetection.h \ + /usr/include/qt5/QtCore/qglobalstatic.h \ + /usr/include/qt5/QtCore/qatomic.h \ + /usr/include/qt5/QtCore/qbasicatomic.h \ + /usr/include/qt5/QtCore/qatomic_bootstrap.h \ + /usr/include/qt5/QtCore/qgenericatomic.h \ + /usr/include/qt5/QtCore/qatomic_msvc.h \ + /usr/include/qt5/QtCore/qatomic_integrity.h \ + /usr/include/qt5/QtCore/qoldbasicatomic.h \ + /usr/include/qt5/QtCore/qatomic_vxworks.h \ + /usr/include/qt5/QtCore/qatomic_power.h \ + /usr/include/qt5/QtCore/qatomic_alpha.h \ + /usr/include/qt5/QtCore/qatomic_armv7.h \ + /usr/include/qt5/QtCore/qatomic_armv6.h \ + /usr/include/qt5/QtCore/qatomic_armv5.h \ + /usr/include/qt5/QtCore/qatomic_bfin.h \ + /usr/include/qt5/QtCore/qatomic_ia64.h \ + /usr/include/qt5/QtCore/qatomic_mips.h \ + /usr/include/qt5/QtCore/qatomic_s390.h \ + /usr/include/qt5/QtCore/qatomic_sh4a.h \ + /usr/include/qt5/QtCore/qatomic_sparc.h \ + /usr/include/qt5/QtCore/qatomic_gcc.h \ + /usr/include/qt5/QtCore/qatomic_x86.h \ + /usr/include/qt5/QtCore/qatomic_cxx11.h \ + /usr/include/qt5/QtCore/qatomic_unix.h \ + /usr/include/qt5/QtCore/qmutex.h \ + /usr/include/qt5/QtCore/qlogging.h \ + /usr/include/qt5/QtCore/qflags.h \ + /usr/include/qt5/QtCore/qtypeinfo.h \ + /usr/include/qt5/QtCore/qtypetraits.h \ + /usr/include/qt5/QtCore/qsysinfo.h \ + /usr/include/qt5/QtCore/qdatastream.h \ + /usr/include/qt5/QtCore/qscopedpointer.h \ + /usr/include/qt5/QtCore/qiodevice.h \ + /usr/include/qt5/QtCore/qobject.h \ + /usr/include/qt5/QtCore/qobjectdefs.h \ + /usr/include/qt5/QtCore/qnamespace.h \ + /usr/include/qt5/QtCore/qobjectdefs_impl.h \ + /usr/include/qt5/QtCore/qstring.h \ + /usr/include/qt5/QtCore/qchar.h \ + /usr/include/qt5/QtCore/qbytearray.h \ + /usr/include/qt5/QtCore/qrefcount.h \ + /usr/include/qt5/QtCore/qarraydata.h \ + /usr/include/qt5/QtCore/qstringbuilder.h \ + /usr/include/qt5/QtCore/qlist.h \ + /usr/include/qt5/QtCore/qiterator.h \ + /usr/include/qt5/QtCore/qcoreevent.h \ + /usr/include/qt5/QtCore/qmetatype.h \ + /usr/include/qt5/QtCore/qvarlengtharray.h \ + /usr/include/qt5/QtCore/qcontainerfwd.h \ + /usr/include/qt5/QtCore/qisenum.h \ + /usr/include/qt5/QtCore/qobject_impl.h \ + /usr/include/qt5/QtCore/qpair.h \ + /usr/include/qt5/QtCore/qregexp.h \ + /usr/include/qt5/QtCore/qstringmatcher.h \ + /usr/include/qt5/QtCore/QVector \ + /usr/include/qt5/QtCore/qvector.h \ + /usr/include/qt5/QtCore/qpoint.h \ + /usr/include/qt5/QtCore/QList \ + /usr/include/qt5/QtCore/QSize \ + /usr/include/qt5/QtCore/qsize.h \ + src/kptyprocess.h \ + src/kprocess.h \ + /usr/include/qt5/QtCore/QProcess \ + /usr/include/qt5/QtCore/qprocess.h \ + /usr/include/qt5/QtCore/qshareddata.h \ + src/kptydevice.h \ + src/kpty_p.h \ + src/kpty.h \ + /usr/include/qt5/QtCore/QtCore \ + /usr/include/qt5/QtCore/QtCoreDepends \ + /usr/include/qt5/QtCore/qabstractanimation.h \ + /usr/include/qt5/QtCore/qanimationgroup.h \ + /usr/include/qt5/QtCore/qparallelanimationgroup.h \ + /usr/include/qt5/QtCore/qpauseanimation.h \ + /usr/include/qt5/QtCore/qpropertyanimation.h \ + /usr/include/qt5/QtCore/qvariantanimation.h \ + /usr/include/qt5/QtCore/qeasingcurve.h \ + /usr/include/qt5/QtCore/qvariant.h \ + /usr/include/qt5/QtCore/qmap.h \ + /usr/include/qt5/QtCore/qdebug.h \ + /usr/include/qt5/QtCore/qhash.h \ + /usr/include/qt5/QtCore/qtextstream.h \ + /usr/include/qt5/QtCore/qlocale.h \ + /usr/include/qt5/QtCore/qset.h \ + /usr/include/qt5/QtCore/qcontiguouscache.h \ + /usr/include/qt5/QtCore/qsequentialanimationgroup.h \ + /usr/include/qt5/QtCore/qtextcodec.h \ + /usr/include/qt5/QtCore/qendian.h \ + /usr/include/qt5/QtCore/qlibraryinfo.h \ + /usr/include/qt5/QtCore/qdatetime.h \ + /usr/include/qt5/QtCore/qsharedpointer.h \ + /usr/include/qt5/QtCore/qsharedpointer_impl.h \ + /usr/include/qt5/QtCore/qnumeric.h \ + /usr/include/qt5/QtCore/qbuffer.h \ + /usr/include/qt5/QtCore/qdir.h \ + /usr/include/qt5/QtCore/qfileinfo.h \ + /usr/include/qt5/QtCore/qfile.h \ + /usr/include/qt5/QtCore/qfiledevice.h \ + /usr/include/qt5/QtCore/qdiriterator.h \ + /usr/include/qt5/QtCore/qfileselector.h \ + /usr/include/qt5/QtCore/QObject \ + /usr/include/qt5/QtCore/qfilesystemwatcher.h \ + /usr/include/qt5/QtCore/qlockfile.h \ + /usr/include/qt5/QtCore/qloggingcategory.h \ + /usr/include/qt5/QtCore/qresource.h \ + /usr/include/qt5/QtCore/qsavefile.h \ + /usr/include/qt5/QtCore/qsettings.h \ + /usr/include/qt5/QtCore/qstandardpaths.h \ + /usr/include/qt5/QtCore/qtemporarydir.h \ + /usr/include/qt5/QtCore/QScopedPointer \ + /usr/include/qt5/QtCore/qtemporaryfile.h \ + /usr/include/qt5/QtCore/qurl.h \ + /usr/include/qt5/QtCore/qurlquery.h \ + /usr/include/qt5/QtCore/qabstractitemmodel.h \ + /usr/include/qt5/QtCore/qabstractproxymodel.h \ + /usr/include/qt5/QtCore/qidentityproxymodel.h \ + /usr/include/qt5/QtCore/qitemselectionmodel.h \ + /usr/include/qt5/QtCore/qsortfilterproxymodel.h \ + /usr/include/qt5/QtCore/qstringlistmodel.h \ + /usr/include/qt5/QtCore/qjsonarray.h \ + /usr/include/qt5/QtCore/qjsonvalue.h \ + /usr/include/qt5/QtCore/qjsondocument.h \ + /usr/include/qt5/QtCore/qjsonobject.h \ + /usr/include/qt5/QtCore/qabstracteventdispatcher.h \ + /usr/include/qt5/QtCore/qeventloop.h \ + /usr/include/qt5/QtCore/qabstractnativeeventfilter.h \ + /usr/include/qt5/QtCore/qbasictimer.h \ + /usr/include/qt5/QtCore/qcoreapplication.h \ + /usr/include/qt5/QtCore/qmath.h \ + /usr/include/qt5/QtCore/qmetaobject.h \ + /usr/include/qt5/QtCore/qmimedata.h \ + /usr/include/qt5/QtCore/qobjectcleanuphandler.h \ + /usr/include/qt5/QtCore/qpointer.h \ + /usr/include/qt5/QtCore/qsharedmemory.h \ + /usr/include/qt5/QtCore/qsignalmapper.h \ + /usr/include/qt5/QtCore/qsocketnotifier.h \ + /usr/include/qt5/QtCore/qsystemsemaphore.h \ + /usr/include/qt5/QtCore/qtimer.h \ + /usr/include/qt5/QtCore/qtranslator.h \ + /usr/include/qt5/QtCore/qwineventnotifier.h \ + /usr/include/qt5/QtCore/qmimedatabase.h \ + /usr/include/qt5/QtCore/qmimetype.h \ + /usr/include/qt5/QtCore/qfactoryinterface.h \ + /usr/include/qt5/QtCore/qlibrary.h \ + /usr/include/qt5/QtCore/qplugin.h \ + /usr/include/qt5/QtCore/qpluginloader.h \ + /usr/include/qt5/QtCore/quuid.h \ + /usr/include/qt5/QtCore/qabstractstate.h \ + /usr/include/qt5/QtCore/qabstracttransition.h \ + /usr/include/qt5/QtCore/qeventtransition.h \ + /usr/include/qt5/QtCore/qfinalstate.h \ + /usr/include/qt5/QtCore/qhistorystate.h \ + /usr/include/qt5/QtCore/qsignaltransition.h \ + /usr/include/qt5/QtCore/qstate.h \ + /usr/include/qt5/QtCore/qstatemachine.h \ + /usr/include/qt5/QtCore/qexception.h \ + /usr/include/qt5/QtCore/qfuture.h \ + /usr/include/qt5/QtCore/qfutureinterface.h \ + /usr/include/qt5/QtCore/qrunnable.h \ + /usr/include/qt5/QtCore/qresultstore.h \ + /usr/include/qt5/QtCore/qfuturesynchronizer.h \ + /usr/include/qt5/QtCore/qfuturewatcher.h \ + /usr/include/qt5/QtCore/qreadwritelock.h \ + /usr/include/qt5/QtCore/qsemaphore.h \ + /usr/include/qt5/QtCore/qthread.h \ + /usr/include/qt5/QtCore/qthreadpool.h \ + /usr/include/qt5/QtCore/qthreadstorage.h \ + /usr/include/qt5/QtCore/qwaitcondition.h \ + /usr/include/qt5/QtCore/qarraydataops.h \ + /usr/include/qt5/QtCore/qarraydatapointer.h \ + /usr/include/qt5/QtCore/qbitarray.h \ + /usr/include/qt5/QtCore/qbytearraymatcher.h \ + /usr/include/qt5/QtCore/qcache.h \ + /usr/include/qt5/QtCore/qcollator.h \ + /usr/include/qt5/QtCore/qcommandlineoption.h \ + /usr/include/qt5/QtCore/qcommandlineparser.h \ + /usr/include/qt5/QtCore/qcryptographichash.h \ + /usr/include/qt5/QtCore/qelapsedtimer.h \ + /usr/include/qt5/QtCore/qline.h \ + /usr/include/qt5/QtCore/qlinkedlist.h \ + /usr/include/qt5/QtCore/qmargins.h \ + /usr/include/qt5/QtCore/qrect.h \ + /usr/include/qt5/QtCore/qmessageauthenticationcode.h \ + /usr/include/qt5/QtCore/qqueue.h \ + /usr/include/qt5/QtCore/qregularexpression.h \ + /usr/include/qt5/QtCore/qscopedvaluerollback.h \ + /usr/include/qt5/QtCore/qstack.h \ + /usr/include/qt5/QtCore/qtextboundaryfinder.h \ + /usr/include/qt5/QtCore/qtimeline.h \ + /usr/include/qt5/QtCore/qtimezone.h \ + /usr/include/qt5/QtCore/qxmlstream.h \ + /usr/include/qt5/QtCore/qtcoreversion.h \ + /usr/include/qt5/QtCore/QByteArray \ + /usr/include/qt5/QtCore/QIODevice \ + src/Pty.h + /usr/lib/x86_64-linux-gnu/qt5/bin/moc $(DEFINES) $(INCPATH) -I/usr/include/c++/4.8 -I/usr/include/x86_64-linux-gnu/c++/4.8 -I/usr/include/c++/4.8/backward -I/usr/lib/gcc/x86_64-linux-gnu/4.8/include -I/usr/local/include -I/usr/lib/gcc/x86_64-linux-gnu/4.8/include-fixed -I/usr/include/x86_64-linux-gnu -I/usr/include src/Pty.h -o .moc/moc_Pty.cpp + +.moc/moc_kptyprocess.cpp: src/kprocess.h \ + /usr/include/qt5/QtCore/QProcess \ + /usr/include/qt5/QtCore/qprocess.h \ + /usr/include/qt5/QtCore/qiodevice.h \ + /usr/include/qt5/QtCore/qglobal.h \ + /usr/include/qt5/QtCore/qconfig.h \ + /usr/include/qt5/QtCore/qfeatures.h \ + /usr/include/qt5/QtCore/qsystemdetection.h \ + /usr/include/qt5/QtCore/qprocessordetection.h \ + /usr/include/qt5/QtCore/qcompilerdetection.h \ + /usr/include/qt5/QtCore/qglobalstatic.h \ + /usr/include/qt5/QtCore/qatomic.h \ + /usr/include/qt5/QtCore/qbasicatomic.h \ + /usr/include/qt5/QtCore/qatomic_bootstrap.h \ + /usr/include/qt5/QtCore/qgenericatomic.h \ + /usr/include/qt5/QtCore/qatomic_msvc.h \ + /usr/include/qt5/QtCore/qatomic_integrity.h \ + /usr/include/qt5/QtCore/qoldbasicatomic.h \ + /usr/include/qt5/QtCore/qatomic_vxworks.h \ + /usr/include/qt5/QtCore/qatomic_power.h \ + /usr/include/qt5/QtCore/qatomic_alpha.h \ + /usr/include/qt5/QtCore/qatomic_armv7.h \ + /usr/include/qt5/QtCore/qatomic_armv6.h \ + /usr/include/qt5/QtCore/qatomic_armv5.h \ + /usr/include/qt5/QtCore/qatomic_bfin.h \ + /usr/include/qt5/QtCore/qatomic_ia64.h \ + /usr/include/qt5/QtCore/qatomic_mips.h \ + /usr/include/qt5/QtCore/qatomic_s390.h \ + /usr/include/qt5/QtCore/qatomic_sh4a.h \ + /usr/include/qt5/QtCore/qatomic_sparc.h \ + /usr/include/qt5/QtCore/qatomic_gcc.h \ + /usr/include/qt5/QtCore/qatomic_x86.h \ + /usr/include/qt5/QtCore/qatomic_cxx11.h \ + /usr/include/qt5/QtCore/qatomic_unix.h \ + /usr/include/qt5/QtCore/qmutex.h \ + /usr/include/qt5/QtCore/qlogging.h \ + /usr/include/qt5/QtCore/qflags.h \ + /usr/include/qt5/QtCore/qtypeinfo.h \ + /usr/include/qt5/QtCore/qtypetraits.h \ + /usr/include/qt5/QtCore/qsysinfo.h \ + /usr/include/qt5/QtCore/qobject.h \ + /usr/include/qt5/QtCore/qobjectdefs.h \ + /usr/include/qt5/QtCore/qnamespace.h \ + /usr/include/qt5/QtCore/qobjectdefs_impl.h \ + /usr/include/qt5/QtCore/qstring.h \ + /usr/include/qt5/QtCore/qchar.h \ + /usr/include/qt5/QtCore/qbytearray.h \ + /usr/include/qt5/QtCore/qrefcount.h \ + /usr/include/qt5/QtCore/qarraydata.h \ + /usr/include/qt5/QtCore/qstringbuilder.h \ + /usr/include/qt5/QtCore/qlist.h \ + /usr/include/qt5/QtCore/qalgorithms.h \ + /usr/include/qt5/QtCore/qiterator.h \ + /usr/include/qt5/QtCore/qcoreevent.h \ + /usr/include/qt5/QtCore/qscopedpointer.h \ + /usr/include/qt5/QtCore/qmetatype.h \ + /usr/include/qt5/QtCore/qvarlengtharray.h \ + /usr/include/qt5/QtCore/qcontainerfwd.h \ + /usr/include/qt5/QtCore/qisenum.h \ + /usr/include/qt5/QtCore/qobject_impl.h \ + /usr/include/qt5/QtCore/qstringlist.h \ + /usr/include/qt5/QtCore/qdatastream.h \ + /usr/include/qt5/QtCore/qpair.h \ + /usr/include/qt5/QtCore/qregexp.h \ + /usr/include/qt5/QtCore/qstringmatcher.h \ + /usr/include/qt5/QtCore/qshareddata.h \ + src/kptydevice.h \ + src/kpty_p.h \ + src/kpty.h \ + /usr/include/qt5/QtCore/QtCore \ + /usr/include/qt5/QtCore/QtCoreDepends \ + /usr/include/qt5/QtCore/qabstractanimation.h \ + /usr/include/qt5/QtCore/qanimationgroup.h \ + /usr/include/qt5/QtCore/qparallelanimationgroup.h \ + /usr/include/qt5/QtCore/qpauseanimation.h \ + /usr/include/qt5/QtCore/qpropertyanimation.h \ + /usr/include/qt5/QtCore/qvariantanimation.h \ + /usr/include/qt5/QtCore/qeasingcurve.h \ + /usr/include/qt5/QtCore/qvector.h \ + /usr/include/qt5/QtCore/qpoint.h \ + /usr/include/qt5/QtCore/qvariant.h \ + /usr/include/qt5/QtCore/qmap.h \ + /usr/include/qt5/QtCore/qdebug.h \ + /usr/include/qt5/QtCore/qhash.h \ + /usr/include/qt5/QtCore/qtextstream.h \ + /usr/include/qt5/QtCore/qlocale.h \ + /usr/include/qt5/QtCore/qset.h \ + /usr/include/qt5/QtCore/qcontiguouscache.h \ + /usr/include/qt5/QtCore/qsequentialanimationgroup.h \ + /usr/include/qt5/QtCore/qtextcodec.h \ + /usr/include/qt5/QtCore/qendian.h \ + /usr/include/qt5/QtCore/qlibraryinfo.h \ + /usr/include/qt5/QtCore/qdatetime.h \ + /usr/include/qt5/QtCore/qsharedpointer.h \ + /usr/include/qt5/QtCore/qsharedpointer_impl.h \ + /usr/include/qt5/QtCore/qnumeric.h \ + /usr/include/qt5/QtCore/qbuffer.h \ + /usr/include/qt5/QtCore/qdir.h \ + /usr/include/qt5/QtCore/qfileinfo.h \ + /usr/include/qt5/QtCore/qfile.h \ + /usr/include/qt5/QtCore/qfiledevice.h \ + /usr/include/qt5/QtCore/qdiriterator.h \ + /usr/include/qt5/QtCore/qfileselector.h \ + /usr/include/qt5/QtCore/QObject \ + /usr/include/qt5/QtCore/QStringList \ + /usr/include/qt5/QtCore/qfilesystemwatcher.h \ + /usr/include/qt5/QtCore/qlockfile.h \ + /usr/include/qt5/QtCore/qloggingcategory.h \ + /usr/include/qt5/QtCore/qresource.h \ + /usr/include/qt5/QtCore/qsavefile.h \ + /usr/include/qt5/QtCore/qsettings.h \ + /usr/include/qt5/QtCore/qstandardpaths.h \ + /usr/include/qt5/QtCore/qtemporarydir.h \ + /usr/include/qt5/QtCore/QScopedPointer \ + /usr/include/qt5/QtCore/qtemporaryfile.h \ + /usr/include/qt5/QtCore/qurl.h \ + /usr/include/qt5/QtCore/qurlquery.h \ + /usr/include/qt5/QtCore/qabstractitemmodel.h \ + /usr/include/qt5/QtCore/qabstractproxymodel.h \ + /usr/include/qt5/QtCore/qidentityproxymodel.h \ + /usr/include/qt5/QtCore/qitemselectionmodel.h \ + /usr/include/qt5/QtCore/qsortfilterproxymodel.h \ + /usr/include/qt5/QtCore/qstringlistmodel.h \ + /usr/include/qt5/QtCore/qjsonarray.h \ + /usr/include/qt5/QtCore/qjsonvalue.h \ + /usr/include/qt5/QtCore/qjsondocument.h \ + /usr/include/qt5/QtCore/qjsonobject.h \ + /usr/include/qt5/QtCore/qabstracteventdispatcher.h \ + /usr/include/qt5/QtCore/qeventloop.h \ + /usr/include/qt5/QtCore/qabstractnativeeventfilter.h \ + /usr/include/qt5/QtCore/qbasictimer.h \ + /usr/include/qt5/QtCore/qcoreapplication.h \ + /usr/include/qt5/QtCore/qmath.h \ + /usr/include/qt5/QtCore/qmetaobject.h \ + /usr/include/qt5/QtCore/qmimedata.h \ + /usr/include/qt5/QtCore/qobjectcleanuphandler.h \ + /usr/include/qt5/QtCore/qpointer.h \ + /usr/include/qt5/QtCore/qsharedmemory.h \ + /usr/include/qt5/QtCore/qsignalmapper.h \ + /usr/include/qt5/QtCore/qsocketnotifier.h \ + /usr/include/qt5/QtCore/qsystemsemaphore.h \ + /usr/include/qt5/QtCore/qtimer.h \ + /usr/include/qt5/QtCore/qtranslator.h \ + /usr/include/qt5/QtCore/qwineventnotifier.h \ + /usr/include/qt5/QtCore/qmimedatabase.h \ + /usr/include/qt5/QtCore/qmimetype.h \ + /usr/include/qt5/QtCore/qfactoryinterface.h \ + /usr/include/qt5/QtCore/qlibrary.h \ + /usr/include/qt5/QtCore/qplugin.h \ + /usr/include/qt5/QtCore/qpluginloader.h \ + /usr/include/qt5/QtCore/quuid.h \ + /usr/include/qt5/QtCore/qabstractstate.h \ + /usr/include/qt5/QtCore/qabstracttransition.h \ + /usr/include/qt5/QtCore/qeventtransition.h \ + /usr/include/qt5/QtCore/qfinalstate.h \ + /usr/include/qt5/QtCore/qhistorystate.h \ + /usr/include/qt5/QtCore/qsignaltransition.h \ + /usr/include/qt5/QtCore/qstate.h \ + /usr/include/qt5/QtCore/qstatemachine.h \ + /usr/include/qt5/QtCore/qexception.h \ + /usr/include/qt5/QtCore/qfuture.h \ + /usr/include/qt5/QtCore/qfutureinterface.h \ + /usr/include/qt5/QtCore/qrunnable.h \ + /usr/include/qt5/QtCore/qresultstore.h \ + /usr/include/qt5/QtCore/qfuturesynchronizer.h \ + /usr/include/qt5/QtCore/qfuturewatcher.h \ + /usr/include/qt5/QtCore/qreadwritelock.h \ + /usr/include/qt5/QtCore/qsemaphore.h \ + /usr/include/qt5/QtCore/qthread.h \ + /usr/include/qt5/QtCore/qthreadpool.h \ + /usr/include/qt5/QtCore/qthreadstorage.h \ + /usr/include/qt5/QtCore/qwaitcondition.h \ + /usr/include/qt5/QtCore/qarraydataops.h \ + /usr/include/qt5/QtCore/qarraydatapointer.h \ + /usr/include/qt5/QtCore/qbitarray.h \ + /usr/include/qt5/QtCore/qbytearraymatcher.h \ + /usr/include/qt5/QtCore/qcache.h \ + /usr/include/qt5/QtCore/qcollator.h \ + /usr/include/qt5/QtCore/qcommandlineoption.h \ + /usr/include/qt5/QtCore/qcommandlineparser.h \ + /usr/include/qt5/QtCore/qcryptographichash.h \ + /usr/include/qt5/QtCore/qelapsedtimer.h \ + /usr/include/qt5/QtCore/qline.h \ + /usr/include/qt5/QtCore/qlinkedlist.h \ + /usr/include/qt5/QtCore/qmargins.h \ + /usr/include/qt5/QtCore/qrect.h \ + /usr/include/qt5/QtCore/qsize.h \ + /usr/include/qt5/QtCore/qmessageauthenticationcode.h \ + /usr/include/qt5/QtCore/qqueue.h \ + /usr/include/qt5/QtCore/qregularexpression.h \ + /usr/include/qt5/QtCore/qscopedvaluerollback.h \ + /usr/include/qt5/QtCore/qstack.h \ + /usr/include/qt5/QtCore/qtextboundaryfinder.h \ + /usr/include/qt5/QtCore/qtimeline.h \ + /usr/include/qt5/QtCore/qtimezone.h \ + /usr/include/qt5/QtCore/qxmlstream.h \ + /usr/include/qt5/QtCore/qtcoreversion.h \ + /usr/include/qt5/QtCore/QByteArray \ + /usr/include/qt5/QtCore/QIODevice \ + src/kptyprocess.h + /usr/lib/x86_64-linux-gnu/qt5/bin/moc $(DEFINES) $(INCPATH) -I/usr/include/c++/4.8 -I/usr/include/x86_64-linux-gnu/c++/4.8 -I/usr/include/c++/4.8/backward -I/usr/lib/gcc/x86_64-linux-gnu/4.8/include -I/usr/local/include -I/usr/lib/gcc/x86_64-linux-gnu/4.8/include-fixed -I/usr/include/x86_64-linux-gnu -I/usr/include src/kptyprocess.h -o .moc/moc_kptyprocess.cpp + +.moc/moc_kptydevice.cpp: src/kpty_p.h \ + src/kpty.h \ + /usr/include/qt5/QtCore/QtCore \ + /usr/include/qt5/QtCore/QtCoreDepends \ + /usr/include/qt5/QtCore/qabstractanimation.h \ + /usr/include/qt5/QtCore/qobject.h \ + /usr/include/qt5/QtCore/qobjectdefs.h \ + /usr/include/qt5/QtCore/qnamespace.h \ + /usr/include/qt5/QtCore/qglobal.h \ + /usr/include/qt5/QtCore/qconfig.h \ + /usr/include/qt5/QtCore/qfeatures.h \ + /usr/include/qt5/QtCore/qsystemdetection.h \ + /usr/include/qt5/QtCore/qprocessordetection.h \ + /usr/include/qt5/QtCore/qcompilerdetection.h \ + /usr/include/qt5/QtCore/qglobalstatic.h \ + /usr/include/qt5/QtCore/qatomic.h \ + /usr/include/qt5/QtCore/qbasicatomic.h \ + /usr/include/qt5/QtCore/qatomic_bootstrap.h \ + /usr/include/qt5/QtCore/qgenericatomic.h \ + /usr/include/qt5/QtCore/qatomic_msvc.h \ + /usr/include/qt5/QtCore/qatomic_integrity.h \ + /usr/include/qt5/QtCore/qoldbasicatomic.h \ + /usr/include/qt5/QtCore/qatomic_vxworks.h \ + /usr/include/qt5/QtCore/qatomic_power.h \ + /usr/include/qt5/QtCore/qatomic_alpha.h \ + /usr/include/qt5/QtCore/qatomic_armv7.h \ + /usr/include/qt5/QtCore/qatomic_armv6.h \ + /usr/include/qt5/QtCore/qatomic_armv5.h \ + /usr/include/qt5/QtCore/qatomic_bfin.h \ + /usr/include/qt5/QtCore/qatomic_ia64.h \ + /usr/include/qt5/QtCore/qatomic_mips.h \ + /usr/include/qt5/QtCore/qatomic_s390.h \ + /usr/include/qt5/QtCore/qatomic_sh4a.h \ + /usr/include/qt5/QtCore/qatomic_sparc.h \ + /usr/include/qt5/QtCore/qatomic_gcc.h \ + /usr/include/qt5/QtCore/qatomic_x86.h \ + /usr/include/qt5/QtCore/qatomic_cxx11.h \ + /usr/include/qt5/QtCore/qatomic_unix.h \ + /usr/include/qt5/QtCore/qmutex.h \ + /usr/include/qt5/QtCore/qlogging.h \ + /usr/include/qt5/QtCore/qflags.h \ + /usr/include/qt5/QtCore/qtypeinfo.h \ + /usr/include/qt5/QtCore/qtypetraits.h \ + /usr/include/qt5/QtCore/qsysinfo.h \ + /usr/include/qt5/QtCore/qobjectdefs_impl.h \ + /usr/include/qt5/QtCore/qstring.h \ + /usr/include/qt5/QtCore/qchar.h \ + /usr/include/qt5/QtCore/qbytearray.h \ + /usr/include/qt5/QtCore/qrefcount.h \ + /usr/include/qt5/QtCore/qarraydata.h \ + /usr/include/qt5/QtCore/qstringbuilder.h \ + /usr/include/qt5/QtCore/qlist.h \ + /usr/include/qt5/QtCore/qalgorithms.h \ + /usr/include/qt5/QtCore/qiterator.h \ + /usr/include/qt5/QtCore/qcoreevent.h \ + /usr/include/qt5/QtCore/qscopedpointer.h \ + /usr/include/qt5/QtCore/qmetatype.h \ + /usr/include/qt5/QtCore/qvarlengtharray.h \ + /usr/include/qt5/QtCore/qcontainerfwd.h \ + /usr/include/qt5/QtCore/qisenum.h \ + /usr/include/qt5/QtCore/qobject_impl.h \ + /usr/include/qt5/QtCore/qanimationgroup.h \ + /usr/include/qt5/QtCore/qparallelanimationgroup.h \ + /usr/include/qt5/QtCore/qpauseanimation.h \ + /usr/include/qt5/QtCore/qpropertyanimation.h \ + /usr/include/qt5/QtCore/qvariantanimation.h \ + /usr/include/qt5/QtCore/qeasingcurve.h \ + /usr/include/qt5/QtCore/qvector.h \ + /usr/include/qt5/QtCore/qpoint.h \ + /usr/include/qt5/QtCore/qvariant.h \ + /usr/include/qt5/QtCore/qmap.h \ + /usr/include/qt5/QtCore/qpair.h \ + /usr/include/qt5/QtCore/qdebug.h \ + /usr/include/qt5/QtCore/qhash.h \ + /usr/include/qt5/QtCore/qtextstream.h \ + /usr/include/qt5/QtCore/qiodevice.h \ + /usr/include/qt5/QtCore/qlocale.h \ + /usr/include/qt5/QtCore/qshareddata.h \ + /usr/include/qt5/QtCore/qset.h \ + /usr/include/qt5/QtCore/qcontiguouscache.h \ + /usr/include/qt5/QtCore/qstringlist.h \ + /usr/include/qt5/QtCore/qdatastream.h \ + /usr/include/qt5/QtCore/qregexp.h \ + /usr/include/qt5/QtCore/qstringmatcher.h \ + /usr/include/qt5/QtCore/qsequentialanimationgroup.h \ + /usr/include/qt5/QtCore/qtextcodec.h \ + /usr/include/qt5/QtCore/qendian.h \ + /usr/include/qt5/QtCore/qlibraryinfo.h \ + /usr/include/qt5/QtCore/qdatetime.h \ + /usr/include/qt5/QtCore/qsharedpointer.h \ + /usr/include/qt5/QtCore/qsharedpointer_impl.h \ + /usr/include/qt5/QtCore/qnumeric.h \ + /usr/include/qt5/QtCore/qbuffer.h \ + /usr/include/qt5/QtCore/qdir.h \ + /usr/include/qt5/QtCore/qfileinfo.h \ + /usr/include/qt5/QtCore/qfile.h \ + /usr/include/qt5/QtCore/qfiledevice.h \ + /usr/include/qt5/QtCore/qdiriterator.h \ + /usr/include/qt5/QtCore/qfileselector.h \ + /usr/include/qt5/QtCore/QObject \ + /usr/include/qt5/QtCore/QStringList \ + /usr/include/qt5/QtCore/qfilesystemwatcher.h \ + /usr/include/qt5/QtCore/qlockfile.h \ + /usr/include/qt5/QtCore/qloggingcategory.h \ + /usr/include/qt5/QtCore/qprocess.h \ + /usr/include/qt5/QtCore/qresource.h \ + /usr/include/qt5/QtCore/qsavefile.h \ + /usr/include/qt5/QtCore/qsettings.h \ + /usr/include/qt5/QtCore/qstandardpaths.h \ + /usr/include/qt5/QtCore/qtemporarydir.h \ + /usr/include/qt5/QtCore/QScopedPointer \ + /usr/include/qt5/QtCore/qtemporaryfile.h \ + /usr/include/qt5/QtCore/qurl.h \ + /usr/include/qt5/QtCore/qurlquery.h \ + /usr/include/qt5/QtCore/qabstractitemmodel.h \ + /usr/include/qt5/QtCore/qabstractproxymodel.h \ + /usr/include/qt5/QtCore/qidentityproxymodel.h \ + /usr/include/qt5/QtCore/qitemselectionmodel.h \ + /usr/include/qt5/QtCore/qsortfilterproxymodel.h \ + /usr/include/qt5/QtCore/qstringlistmodel.h \ + /usr/include/qt5/QtCore/qjsonarray.h \ + /usr/include/qt5/QtCore/qjsonvalue.h \ + /usr/include/qt5/QtCore/qjsondocument.h \ + /usr/include/qt5/QtCore/qjsonobject.h \ + /usr/include/qt5/QtCore/qabstracteventdispatcher.h \ + /usr/include/qt5/QtCore/qeventloop.h \ + /usr/include/qt5/QtCore/qabstractnativeeventfilter.h \ + /usr/include/qt5/QtCore/qbasictimer.h \ + /usr/include/qt5/QtCore/qcoreapplication.h \ + /usr/include/qt5/QtCore/qmath.h \ + /usr/include/qt5/QtCore/qmetaobject.h \ + /usr/include/qt5/QtCore/qmimedata.h \ + /usr/include/qt5/QtCore/qobjectcleanuphandler.h \ + /usr/include/qt5/QtCore/qpointer.h \ + /usr/include/qt5/QtCore/qsharedmemory.h \ + /usr/include/qt5/QtCore/qsignalmapper.h \ + /usr/include/qt5/QtCore/qsocketnotifier.h \ + /usr/include/qt5/QtCore/qsystemsemaphore.h \ + /usr/include/qt5/QtCore/qtimer.h \ + /usr/include/qt5/QtCore/qtranslator.h \ + /usr/include/qt5/QtCore/qwineventnotifier.h \ + /usr/include/qt5/QtCore/qmimedatabase.h \ + /usr/include/qt5/QtCore/qmimetype.h \ + /usr/include/qt5/QtCore/qfactoryinterface.h \ + /usr/include/qt5/QtCore/qlibrary.h \ + /usr/include/qt5/QtCore/qplugin.h \ + /usr/include/qt5/QtCore/qpluginloader.h \ + /usr/include/qt5/QtCore/quuid.h \ + /usr/include/qt5/QtCore/qabstractstate.h \ + /usr/include/qt5/QtCore/qabstracttransition.h \ + /usr/include/qt5/QtCore/qeventtransition.h \ + /usr/include/qt5/QtCore/qfinalstate.h \ + /usr/include/qt5/QtCore/qhistorystate.h \ + /usr/include/qt5/QtCore/qsignaltransition.h \ + /usr/include/qt5/QtCore/qstate.h \ + /usr/include/qt5/QtCore/qstatemachine.h \ + /usr/include/qt5/QtCore/qexception.h \ + /usr/include/qt5/QtCore/qfuture.h \ + /usr/include/qt5/QtCore/qfutureinterface.h \ + /usr/include/qt5/QtCore/qrunnable.h \ + /usr/include/qt5/QtCore/qresultstore.h \ + /usr/include/qt5/QtCore/qfuturesynchronizer.h \ + /usr/include/qt5/QtCore/qfuturewatcher.h \ + /usr/include/qt5/QtCore/qreadwritelock.h \ + /usr/include/qt5/QtCore/qsemaphore.h \ + /usr/include/qt5/QtCore/qthread.h \ + /usr/include/qt5/QtCore/qthreadpool.h \ + /usr/include/qt5/QtCore/qthreadstorage.h \ + /usr/include/qt5/QtCore/qwaitcondition.h \ + /usr/include/qt5/QtCore/qarraydataops.h \ + /usr/include/qt5/QtCore/qarraydatapointer.h \ + /usr/include/qt5/QtCore/qbitarray.h \ + /usr/include/qt5/QtCore/qbytearraymatcher.h \ + /usr/include/qt5/QtCore/qcache.h \ + /usr/include/qt5/QtCore/qcollator.h \ + /usr/include/qt5/QtCore/qcommandlineoption.h \ + /usr/include/qt5/QtCore/qcommandlineparser.h \ + /usr/include/qt5/QtCore/qcryptographichash.h \ + /usr/include/qt5/QtCore/qelapsedtimer.h \ + /usr/include/qt5/QtCore/qline.h \ + /usr/include/qt5/QtCore/qlinkedlist.h \ + /usr/include/qt5/QtCore/qmargins.h \ + /usr/include/qt5/QtCore/qrect.h \ + /usr/include/qt5/QtCore/qsize.h \ + /usr/include/qt5/QtCore/qmessageauthenticationcode.h \ + /usr/include/qt5/QtCore/qqueue.h \ + /usr/include/qt5/QtCore/qregularexpression.h \ + /usr/include/qt5/QtCore/qscopedvaluerollback.h \ + /usr/include/qt5/QtCore/qstack.h \ + /usr/include/qt5/QtCore/qtextboundaryfinder.h \ + /usr/include/qt5/QtCore/qtimeline.h \ + /usr/include/qt5/QtCore/qtimezone.h \ + /usr/include/qt5/QtCore/qxmlstream.h \ + /usr/include/qt5/QtCore/qtcoreversion.h \ + /usr/include/qt5/QtCore/QByteArray \ + /usr/include/qt5/QtCore/QIODevice \ + src/kptydevice.h + /usr/lib/x86_64-linux-gnu/qt5/bin/moc $(DEFINES) $(INCPATH) -I/usr/include/c++/4.8 -I/usr/include/x86_64-linux-gnu/c++/4.8 -I/usr/include/c++/4.8/backward -I/usr/lib/gcc/x86_64-linux-gnu/4.8/include -I/usr/local/include -I/usr/lib/gcc/x86_64-linux-gnu/4.8/include-fixed -I/usr/include/x86_64-linux-gnu -I/usr/include src/kptydevice.h -o .moc/moc_kptydevice.cpp + +.moc/moc_kprocess.cpp: /usr/include/qt5/QtCore/QProcess \ + /usr/include/qt5/QtCore/qprocess.h \ + /usr/include/qt5/QtCore/qiodevice.h \ + /usr/include/qt5/QtCore/qglobal.h \ + /usr/include/qt5/QtCore/qconfig.h \ + /usr/include/qt5/QtCore/qfeatures.h \ + /usr/include/qt5/QtCore/qsystemdetection.h \ + /usr/include/qt5/QtCore/qprocessordetection.h \ + /usr/include/qt5/QtCore/qcompilerdetection.h \ + /usr/include/qt5/QtCore/qglobalstatic.h \ + /usr/include/qt5/QtCore/qatomic.h \ + /usr/include/qt5/QtCore/qbasicatomic.h \ + /usr/include/qt5/QtCore/qatomic_bootstrap.h \ + /usr/include/qt5/QtCore/qgenericatomic.h \ + /usr/include/qt5/QtCore/qatomic_msvc.h \ + /usr/include/qt5/QtCore/qatomic_integrity.h \ + /usr/include/qt5/QtCore/qoldbasicatomic.h \ + /usr/include/qt5/QtCore/qatomic_vxworks.h \ + /usr/include/qt5/QtCore/qatomic_power.h \ + /usr/include/qt5/QtCore/qatomic_alpha.h \ + /usr/include/qt5/QtCore/qatomic_armv7.h \ + /usr/include/qt5/QtCore/qatomic_armv6.h \ + /usr/include/qt5/QtCore/qatomic_armv5.h \ + /usr/include/qt5/QtCore/qatomic_bfin.h \ + /usr/include/qt5/QtCore/qatomic_ia64.h \ + /usr/include/qt5/QtCore/qatomic_mips.h \ + /usr/include/qt5/QtCore/qatomic_s390.h \ + /usr/include/qt5/QtCore/qatomic_sh4a.h \ + /usr/include/qt5/QtCore/qatomic_sparc.h \ + /usr/include/qt5/QtCore/qatomic_gcc.h \ + /usr/include/qt5/QtCore/qatomic_x86.h \ + /usr/include/qt5/QtCore/qatomic_cxx11.h \ + /usr/include/qt5/QtCore/qatomic_unix.h \ + /usr/include/qt5/QtCore/qmutex.h \ + /usr/include/qt5/QtCore/qlogging.h \ + /usr/include/qt5/QtCore/qflags.h \ + /usr/include/qt5/QtCore/qtypeinfo.h \ + /usr/include/qt5/QtCore/qtypetraits.h \ + /usr/include/qt5/QtCore/qsysinfo.h \ + /usr/include/qt5/QtCore/qobject.h \ + /usr/include/qt5/QtCore/qobjectdefs.h \ + /usr/include/qt5/QtCore/qnamespace.h \ + /usr/include/qt5/QtCore/qobjectdefs_impl.h \ + /usr/include/qt5/QtCore/qstring.h \ + /usr/include/qt5/QtCore/qchar.h \ + /usr/include/qt5/QtCore/qbytearray.h \ + /usr/include/qt5/QtCore/qrefcount.h \ + /usr/include/qt5/QtCore/qarraydata.h \ + /usr/include/qt5/QtCore/qstringbuilder.h \ + /usr/include/qt5/QtCore/qlist.h \ + /usr/include/qt5/QtCore/qalgorithms.h \ + /usr/include/qt5/QtCore/qiterator.h \ + /usr/include/qt5/QtCore/qcoreevent.h \ + /usr/include/qt5/QtCore/qscopedpointer.h \ + /usr/include/qt5/QtCore/qmetatype.h \ + /usr/include/qt5/QtCore/qvarlengtharray.h \ + /usr/include/qt5/QtCore/qcontainerfwd.h \ + /usr/include/qt5/QtCore/qisenum.h \ + /usr/include/qt5/QtCore/qobject_impl.h \ + /usr/include/qt5/QtCore/qstringlist.h \ + /usr/include/qt5/QtCore/qdatastream.h \ + /usr/include/qt5/QtCore/qpair.h \ + /usr/include/qt5/QtCore/qregexp.h \ + /usr/include/qt5/QtCore/qstringmatcher.h \ + /usr/include/qt5/QtCore/qshareddata.h \ + src/kprocess.h + /usr/lib/x86_64-linux-gnu/qt5/bin/moc $(DEFINES) $(INCPATH) -I/usr/include/c++/4.8 -I/usr/include/x86_64-linux-gnu/c++/4.8 -I/usr/include/c++/4.8/backward -I/usr/lib/gcc/x86_64-linux-gnu/4.8/include -I/usr/local/include -I/usr/lib/gcc/x86_64-linux-gnu/4.8/include-fixed -I/usr/include/x86_64-linux-gnu -I/usr/include src/kprocess.h -o .moc/moc_kprocess.cpp + +.moc/moc_Vt102Emulation.cpp: /usr/include/qt5/QtGui/QKeyEvent \ + /usr/include/qt5/QtGui/qevent.h \ + /usr/include/qt5/QtGui/qwindowdefs.h \ + /usr/include/qt5/QtCore/qglobal.h \ + /usr/include/qt5/QtCore/qconfig.h \ + /usr/include/qt5/QtCore/qfeatures.h \ + /usr/include/qt5/QtCore/qsystemdetection.h \ + /usr/include/qt5/QtCore/qprocessordetection.h \ + /usr/include/qt5/QtCore/qcompilerdetection.h \ + /usr/include/qt5/QtCore/qglobalstatic.h \ + /usr/include/qt5/QtCore/qatomic.h \ + /usr/include/qt5/QtCore/qbasicatomic.h \ + /usr/include/qt5/QtCore/qatomic_bootstrap.h \ + /usr/include/qt5/QtCore/qgenericatomic.h \ + /usr/include/qt5/QtCore/qatomic_msvc.h \ + /usr/include/qt5/QtCore/qatomic_integrity.h \ + /usr/include/qt5/QtCore/qoldbasicatomic.h \ + /usr/include/qt5/QtCore/qatomic_vxworks.h \ + /usr/include/qt5/QtCore/qatomic_power.h \ + /usr/include/qt5/QtCore/qatomic_alpha.h \ + /usr/include/qt5/QtCore/qatomic_armv7.h \ + /usr/include/qt5/QtCore/qatomic_armv6.h \ + /usr/include/qt5/QtCore/qatomic_armv5.h \ + /usr/include/qt5/QtCore/qatomic_bfin.h \ + /usr/include/qt5/QtCore/qatomic_ia64.h \ + /usr/include/qt5/QtCore/qatomic_mips.h \ + /usr/include/qt5/QtCore/qatomic_s390.h \ + /usr/include/qt5/QtCore/qatomic_sh4a.h \ + /usr/include/qt5/QtCore/qatomic_sparc.h \ + /usr/include/qt5/QtCore/qatomic_gcc.h \ + /usr/include/qt5/QtCore/qatomic_x86.h \ + /usr/include/qt5/QtCore/qatomic_cxx11.h \ + /usr/include/qt5/QtCore/qatomic_unix.h \ + /usr/include/qt5/QtCore/qmutex.h \ + /usr/include/qt5/QtCore/qlogging.h \ + /usr/include/qt5/QtCore/qflags.h \ + /usr/include/qt5/QtCore/qtypeinfo.h \ + /usr/include/qt5/QtCore/qtypetraits.h \ + /usr/include/qt5/QtCore/qsysinfo.h \ + /usr/include/qt5/QtCore/qobjectdefs.h \ + /usr/include/qt5/QtCore/qnamespace.h \ + /usr/include/qt5/QtCore/qobjectdefs_impl.h \ + /usr/include/qt5/QtGui/qwindowdefs_win.h \ + /usr/include/qt5/QtCore/qobject.h \ + /usr/include/qt5/QtCore/qstring.h \ + /usr/include/qt5/QtCore/qchar.h \ + /usr/include/qt5/QtCore/qbytearray.h \ + /usr/include/qt5/QtCore/qrefcount.h \ + /usr/include/qt5/QtCore/qarraydata.h \ + /usr/include/qt5/QtCore/qstringbuilder.h \ + /usr/include/qt5/QtCore/qlist.h \ + /usr/include/qt5/QtCore/qalgorithms.h \ + /usr/include/qt5/QtCore/qiterator.h \ + /usr/include/qt5/QtCore/qcoreevent.h \ + /usr/include/qt5/QtCore/qscopedpointer.h \ + /usr/include/qt5/QtCore/qmetatype.h \ + /usr/include/qt5/QtCore/qvarlengtharray.h \ + /usr/include/qt5/QtCore/qcontainerfwd.h \ + /usr/include/qt5/QtCore/qisenum.h \ + /usr/include/qt5/QtCore/qobject_impl.h \ + /usr/include/qt5/QtGui/qregion.h \ + /usr/include/qt5/QtCore/qrect.h \ + /usr/include/qt5/QtCore/qsize.h \ + /usr/include/qt5/QtCore/qpoint.h \ + /usr/include/qt5/QtCore/qdatastream.h \ + /usr/include/qt5/QtCore/qiodevice.h \ + /usr/include/qt5/QtCore/qpair.h \ + /usr/include/qt5/QtGui/qkeysequence.h \ + /usr/include/qt5/QtCore/qvariant.h \ + /usr/include/qt5/QtCore/qmap.h \ + /usr/include/qt5/QtCore/qdebug.h \ + /usr/include/qt5/QtCore/qhash.h \ + /usr/include/qt5/QtCore/qtextstream.h \ + /usr/include/qt5/QtCore/qlocale.h \ + /usr/include/qt5/QtCore/qshareddata.h \ + /usr/include/qt5/QtCore/qvector.h \ + /usr/include/qt5/QtCore/qset.h \ + /usr/include/qt5/QtCore/qcontiguouscache.h \ + /usr/include/qt5/QtCore/qstringlist.h \ + /usr/include/qt5/QtCore/qregexp.h \ + /usr/include/qt5/QtCore/qstringmatcher.h \ + /usr/include/qt5/QtCore/qurl.h \ + /usr/include/qt5/QtCore/qurlquery.h \ + /usr/include/qt5/QtCore/qfile.h \ + /usr/include/qt5/QtCore/qfiledevice.h \ + /usr/include/qt5/QtGui/qvector2d.h \ + /usr/include/qt5/QtGui/qtouchdevice.h \ + /usr/include/qt5/QtCore/QHash \ + /usr/include/qt5/QtCore/QTimer \ + /usr/include/qt5/QtCore/qtimer.h \ + /usr/include/qt5/QtCore/qbasictimer.h \ + src/Emulation.h \ + /usr/include/qt5/QtCore/QTextCodec \ + /usr/include/qt5/QtCore/qtextcodec.h \ + /usr/include/qt5/QtCore/QTextStream \ + src/Screen.h \ + /usr/include/qt5/QtCore/QRect \ + /usr/include/qt5/QtCore/QVarLengthArray \ + src/Character.h \ + src/CharacterColor.h \ + /usr/include/qt5/QtGui/QColor \ + /usr/include/qt5/QtGui/qcolor.h \ + /usr/include/qt5/QtGui/qrgb.h \ + src/History.h \ + /usr/include/qt5/QtCore/QBitRef \ + /usr/include/qt5/QtCore/qbitarray.h \ + /usr/include/qt5/QtCore/QVector \ + /usr/include/qt5/QtCore/QTemporaryFile \ + /usr/include/qt5/QtCore/qtemporaryfile.h \ + src/BlockArray.h \ + src/Vt102Emulation.h + /usr/lib/x86_64-linux-gnu/qt5/bin/moc $(DEFINES) $(INCPATH) -I/usr/include/c++/4.8 -I/usr/include/x86_64-linux-gnu/c++/4.8 -I/usr/include/c++/4.8/backward -I/usr/lib/gcc/x86_64-linux-gnu/4.8/include -I/usr/local/include -I/usr/lib/gcc/x86_64-linux-gnu/4.8/include-fixed -I/usr/include/x86_64-linux-gnu -I/usr/include src/Vt102Emulation.h -o .moc/moc_Vt102Emulation.cpp + +.moc/moc_Session.cpp: /usr/include/qt5/QtCore/QStringList \ + /usr/include/qt5/QtCore/qstringlist.h \ + /usr/include/qt5/QtCore/qalgorithms.h \ + /usr/include/qt5/QtCore/qglobal.h \ + /usr/include/qt5/QtCore/qconfig.h \ + /usr/include/qt5/QtCore/qfeatures.h \ + /usr/include/qt5/QtCore/qsystemdetection.h \ + /usr/include/qt5/QtCore/qprocessordetection.h \ + /usr/include/qt5/QtCore/qcompilerdetection.h \ + /usr/include/qt5/QtCore/qglobalstatic.h \ + /usr/include/qt5/QtCore/qatomic.h \ + /usr/include/qt5/QtCore/qbasicatomic.h \ + /usr/include/qt5/QtCore/qatomic_bootstrap.h \ + /usr/include/qt5/QtCore/qgenericatomic.h \ + /usr/include/qt5/QtCore/qatomic_msvc.h \ + /usr/include/qt5/QtCore/qatomic_integrity.h \ + /usr/include/qt5/QtCore/qoldbasicatomic.h \ + /usr/include/qt5/QtCore/qatomic_vxworks.h \ + /usr/include/qt5/QtCore/qatomic_power.h \ + /usr/include/qt5/QtCore/qatomic_alpha.h \ + /usr/include/qt5/QtCore/qatomic_armv7.h \ + /usr/include/qt5/QtCore/qatomic_armv6.h \ + /usr/include/qt5/QtCore/qatomic_armv5.h \ + /usr/include/qt5/QtCore/qatomic_bfin.h \ + /usr/include/qt5/QtCore/qatomic_ia64.h \ + /usr/include/qt5/QtCore/qatomic_mips.h \ + /usr/include/qt5/QtCore/qatomic_s390.h \ + /usr/include/qt5/QtCore/qatomic_sh4a.h \ + /usr/include/qt5/QtCore/qatomic_sparc.h \ + /usr/include/qt5/QtCore/qatomic_gcc.h \ + /usr/include/qt5/QtCore/qatomic_x86.h \ + /usr/include/qt5/QtCore/qatomic_cxx11.h \ + /usr/include/qt5/QtCore/qatomic_unix.h \ + /usr/include/qt5/QtCore/qmutex.h \ + /usr/include/qt5/QtCore/qlogging.h \ + /usr/include/qt5/QtCore/qflags.h \ + /usr/include/qt5/QtCore/qtypeinfo.h \ + /usr/include/qt5/QtCore/qtypetraits.h \ + /usr/include/qt5/QtCore/qsysinfo.h \ + /usr/include/qt5/QtCore/qdatastream.h \ + /usr/include/qt5/QtCore/qscopedpointer.h \ + /usr/include/qt5/QtCore/qiodevice.h \ + /usr/include/qt5/QtCore/qobject.h \ + /usr/include/qt5/QtCore/qobjectdefs.h \ + /usr/include/qt5/QtCore/qnamespace.h \ + /usr/include/qt5/QtCore/qobjectdefs_impl.h \ + /usr/include/qt5/QtCore/qstring.h \ + /usr/include/qt5/QtCore/qchar.h \ + /usr/include/qt5/QtCore/qbytearray.h \ + /usr/include/qt5/QtCore/qrefcount.h \ + /usr/include/qt5/QtCore/qarraydata.h \ + /usr/include/qt5/QtCore/qstringbuilder.h \ + /usr/include/qt5/QtCore/qlist.h \ + /usr/include/qt5/QtCore/qiterator.h \ + /usr/include/qt5/QtCore/qcoreevent.h \ + /usr/include/qt5/QtCore/qmetatype.h \ + /usr/include/qt5/QtCore/qvarlengtharray.h \ + /usr/include/qt5/QtCore/qcontainerfwd.h \ + /usr/include/qt5/QtCore/qisenum.h \ + /usr/include/qt5/QtCore/qobject_impl.h \ + /usr/include/qt5/QtCore/qpair.h \ + /usr/include/qt5/QtCore/qregexp.h \ + /usr/include/qt5/QtCore/qstringmatcher.h \ + /usr/include/qt5/QtCore/QTimer \ + /usr/include/qt5/QtCore/qtimer.h \ + /usr/include/qt5/QtCore/qbasictimer.h \ + /usr/include/qt5/QtGui/QWindow \ + /usr/include/qt5/QtGui/qwindow.h \ + /usr/include/qt5/QtCore/QObject \ + /usr/include/qt5/QtCore/QEvent \ + /usr/include/qt5/QtCore/QMargins \ + /usr/include/qt5/QtCore/qmargins.h \ + /usr/include/qt5/QtCore/qrect.h \ + /usr/include/qt5/QtCore/qsize.h \ + /usr/include/qt5/QtCore/qpoint.h \ + /usr/include/qt5/QtCore/QRect \ + /usr/include/qt5/QtGui/qsurface.h \ + /usr/include/qt5/QtGui/qsurfaceformat.h \ + /usr/include/qt5/QtGui/qwindowdefs.h \ + /usr/include/qt5/QtGui/qwindowdefs_win.h \ + /usr/include/qt5/QtGui/qicon.h \ + /usr/include/qt5/QtGui/qpixmap.h \ + /usr/include/qt5/QtGui/qpaintdevice.h \ + /usr/include/qt5/QtGui/qcolor.h \ + /usr/include/qt5/QtGui/qrgb.h \ + /usr/include/qt5/QtCore/qsharedpointer.h \ + /usr/include/qt5/QtCore/qshareddata.h \ + /usr/include/qt5/QtCore/qsharedpointer_impl.h \ + /usr/include/qt5/QtCore/qhash.h \ + /usr/include/qt5/QtGui/qimage.h \ + /usr/include/qt5/QtGui/qtransform.h \ + /usr/include/qt5/QtGui/qmatrix.h \ + /usr/include/qt5/QtGui/qpolygon.h \ + /usr/include/qt5/QtCore/qvector.h \ + /usr/include/qt5/QtGui/qregion.h \ + /usr/include/qt5/QtCore/qline.h \ + /usr/include/qt5/QtGui/qpainterpath.h \ + /usr/include/qt5/QtGui/qcursor.h \ + src/History.h \ + /usr/include/qt5/QtCore/QBitRef \ + /usr/include/qt5/QtCore/qbitarray.h \ + /usr/include/qt5/QtCore/QHash \ + /usr/include/qt5/QtCore/QVector \ + /usr/include/qt5/QtCore/QTemporaryFile \ + /usr/include/qt5/QtCore/qtemporaryfile.h \ + /usr/include/qt5/QtCore/qfile.h \ + /usr/include/qt5/QtCore/qfiledevice.h \ + src/BlockArray.h \ + src/Character.h \ + src/CharacterColor.h \ + /usr/include/qt5/QtGui/QColor \ + src/Session.h + /usr/lib/x86_64-linux-gnu/qt5/bin/moc $(DEFINES) $(INCPATH) -I/usr/include/c++/4.8 -I/usr/include/x86_64-linux-gnu/c++/4.8 -I/usr/include/c++/4.8/backward -I/usr/lib/gcc/x86_64-linux-gnu/4.8/include -I/usr/local/include -I/usr/lib/gcc/x86_64-linux-gnu/4.8/include-fixed -I/usr/include/x86_64-linux-gnu -I/usr/include src/Session.h -o .moc/moc_Session.cpp + +.moc/moc_Emulation.cpp: /usr/include/qt5/QtGui/QKeyEvent \ + /usr/include/qt5/QtGui/qevent.h \ + /usr/include/qt5/QtGui/qwindowdefs.h \ + /usr/include/qt5/QtCore/qglobal.h \ + /usr/include/qt5/QtCore/qconfig.h \ + /usr/include/qt5/QtCore/qfeatures.h \ + /usr/include/qt5/QtCore/qsystemdetection.h \ + /usr/include/qt5/QtCore/qprocessordetection.h \ + /usr/include/qt5/QtCore/qcompilerdetection.h \ + /usr/include/qt5/QtCore/qglobalstatic.h \ + /usr/include/qt5/QtCore/qatomic.h \ + /usr/include/qt5/QtCore/qbasicatomic.h \ + /usr/include/qt5/QtCore/qatomic_bootstrap.h \ + /usr/include/qt5/QtCore/qgenericatomic.h \ + /usr/include/qt5/QtCore/qatomic_msvc.h \ + /usr/include/qt5/QtCore/qatomic_integrity.h \ + /usr/include/qt5/QtCore/qoldbasicatomic.h \ + /usr/include/qt5/QtCore/qatomic_vxworks.h \ + /usr/include/qt5/QtCore/qatomic_power.h \ + /usr/include/qt5/QtCore/qatomic_alpha.h \ + /usr/include/qt5/QtCore/qatomic_armv7.h \ + /usr/include/qt5/QtCore/qatomic_armv6.h \ + /usr/include/qt5/QtCore/qatomic_armv5.h \ + /usr/include/qt5/QtCore/qatomic_bfin.h \ + /usr/include/qt5/QtCore/qatomic_ia64.h \ + /usr/include/qt5/QtCore/qatomic_mips.h \ + /usr/include/qt5/QtCore/qatomic_s390.h \ + /usr/include/qt5/QtCore/qatomic_sh4a.h \ + /usr/include/qt5/QtCore/qatomic_sparc.h \ + /usr/include/qt5/QtCore/qatomic_gcc.h \ + /usr/include/qt5/QtCore/qatomic_x86.h \ + /usr/include/qt5/QtCore/qatomic_cxx11.h \ + /usr/include/qt5/QtCore/qatomic_unix.h \ + /usr/include/qt5/QtCore/qmutex.h \ + /usr/include/qt5/QtCore/qlogging.h \ + /usr/include/qt5/QtCore/qflags.h \ + /usr/include/qt5/QtCore/qtypeinfo.h \ + /usr/include/qt5/QtCore/qtypetraits.h \ + /usr/include/qt5/QtCore/qsysinfo.h \ + /usr/include/qt5/QtCore/qobjectdefs.h \ + /usr/include/qt5/QtCore/qnamespace.h \ + /usr/include/qt5/QtCore/qobjectdefs_impl.h \ + /usr/include/qt5/QtGui/qwindowdefs_win.h \ + /usr/include/qt5/QtCore/qobject.h \ + /usr/include/qt5/QtCore/qstring.h \ + /usr/include/qt5/QtCore/qchar.h \ + /usr/include/qt5/QtCore/qbytearray.h \ + /usr/include/qt5/QtCore/qrefcount.h \ + /usr/include/qt5/QtCore/qarraydata.h \ + /usr/include/qt5/QtCore/qstringbuilder.h \ + /usr/include/qt5/QtCore/qlist.h \ + /usr/include/qt5/QtCore/qalgorithms.h \ + /usr/include/qt5/QtCore/qiterator.h \ + /usr/include/qt5/QtCore/qcoreevent.h \ + /usr/include/qt5/QtCore/qscopedpointer.h \ + /usr/include/qt5/QtCore/qmetatype.h \ + /usr/include/qt5/QtCore/qvarlengtharray.h \ + /usr/include/qt5/QtCore/qcontainerfwd.h \ + /usr/include/qt5/QtCore/qisenum.h \ + /usr/include/qt5/QtCore/qobject_impl.h \ + /usr/include/qt5/QtGui/qregion.h \ + /usr/include/qt5/QtCore/qrect.h \ + /usr/include/qt5/QtCore/qsize.h \ + /usr/include/qt5/QtCore/qpoint.h \ + /usr/include/qt5/QtCore/qdatastream.h \ + /usr/include/qt5/QtCore/qiodevice.h \ + /usr/include/qt5/QtCore/qpair.h \ + /usr/include/qt5/QtGui/qkeysequence.h \ + /usr/include/qt5/QtCore/qvariant.h \ + /usr/include/qt5/QtCore/qmap.h \ + /usr/include/qt5/QtCore/qdebug.h \ + /usr/include/qt5/QtCore/qhash.h \ + /usr/include/qt5/QtCore/qtextstream.h \ + /usr/include/qt5/QtCore/qlocale.h \ + /usr/include/qt5/QtCore/qshareddata.h \ + /usr/include/qt5/QtCore/qvector.h \ + /usr/include/qt5/QtCore/qset.h \ + /usr/include/qt5/QtCore/qcontiguouscache.h \ + /usr/include/qt5/QtCore/qstringlist.h \ + /usr/include/qt5/QtCore/qregexp.h \ + /usr/include/qt5/QtCore/qstringmatcher.h \ + /usr/include/qt5/QtCore/qurl.h \ + /usr/include/qt5/QtCore/qurlquery.h \ + /usr/include/qt5/QtCore/qfile.h \ + /usr/include/qt5/QtCore/qfiledevice.h \ + /usr/include/qt5/QtGui/qvector2d.h \ + /usr/include/qt5/QtGui/qtouchdevice.h \ + /usr/include/qt5/QtCore/QTextCodec \ + /usr/include/qt5/QtCore/qtextcodec.h \ + /usr/include/qt5/QtCore/QTextStream \ + /usr/include/qt5/QtCore/QTimer \ + /usr/include/qt5/QtCore/qtimer.h \ + /usr/include/qt5/QtCore/qbasictimer.h \ + src/Emulation.h + /usr/lib/x86_64-linux-gnu/qt5/bin/moc $(DEFINES) $(INCPATH) -I/usr/include/c++/4.8 -I/usr/include/x86_64-linux-gnu/c++/4.8 -I/usr/include/c++/4.8/backward -I/usr/lib/gcc/x86_64-linux-gnu/4.8/include -I/usr/local/include -I/usr/lib/gcc/x86_64-linux-gnu/4.8/include-fixed -I/usr/include/x86_64-linux-gnu -I/usr/include src/Emulation.h -o .moc/moc_Emulation.cpp + +.moc/moc_ScreenWindow.cpp: /usr/include/qt5/QtCore/QObject \ + /usr/include/qt5/QtCore/qobject.h \ + /usr/include/qt5/QtCore/qobjectdefs.h \ + /usr/include/qt5/QtCore/qnamespace.h \ + /usr/include/qt5/QtCore/qglobal.h \ + /usr/include/qt5/QtCore/qconfig.h \ + /usr/include/qt5/QtCore/qfeatures.h \ + /usr/include/qt5/QtCore/qsystemdetection.h \ + /usr/include/qt5/QtCore/qprocessordetection.h \ + /usr/include/qt5/QtCore/qcompilerdetection.h \ + /usr/include/qt5/QtCore/qglobalstatic.h \ + /usr/include/qt5/QtCore/qatomic.h \ + /usr/include/qt5/QtCore/qbasicatomic.h \ + /usr/include/qt5/QtCore/qatomic_bootstrap.h \ + /usr/include/qt5/QtCore/qgenericatomic.h \ + /usr/include/qt5/QtCore/qatomic_msvc.h \ + /usr/include/qt5/QtCore/qatomic_integrity.h \ + /usr/include/qt5/QtCore/qoldbasicatomic.h \ + /usr/include/qt5/QtCore/qatomic_vxworks.h \ + /usr/include/qt5/QtCore/qatomic_power.h \ + /usr/include/qt5/QtCore/qatomic_alpha.h \ + /usr/include/qt5/QtCore/qatomic_armv7.h \ + /usr/include/qt5/QtCore/qatomic_armv6.h \ + /usr/include/qt5/QtCore/qatomic_armv5.h \ + /usr/include/qt5/QtCore/qatomic_bfin.h \ + /usr/include/qt5/QtCore/qatomic_ia64.h \ + /usr/include/qt5/QtCore/qatomic_mips.h \ + /usr/include/qt5/QtCore/qatomic_s390.h \ + /usr/include/qt5/QtCore/qatomic_sh4a.h \ + /usr/include/qt5/QtCore/qatomic_sparc.h \ + /usr/include/qt5/QtCore/qatomic_gcc.h \ + /usr/include/qt5/QtCore/qatomic_x86.h \ + /usr/include/qt5/QtCore/qatomic_cxx11.h \ + /usr/include/qt5/QtCore/qatomic_unix.h \ + /usr/include/qt5/QtCore/qmutex.h \ + /usr/include/qt5/QtCore/qlogging.h \ + /usr/include/qt5/QtCore/qflags.h \ + /usr/include/qt5/QtCore/qtypeinfo.h \ + /usr/include/qt5/QtCore/qtypetraits.h \ + /usr/include/qt5/QtCore/qsysinfo.h \ + /usr/include/qt5/QtCore/qobjectdefs_impl.h \ + /usr/include/qt5/QtCore/qstring.h \ + /usr/include/qt5/QtCore/qchar.h \ + /usr/include/qt5/QtCore/qbytearray.h \ + /usr/include/qt5/QtCore/qrefcount.h \ + /usr/include/qt5/QtCore/qarraydata.h \ + /usr/include/qt5/QtCore/qstringbuilder.h \ + /usr/include/qt5/QtCore/qlist.h \ + /usr/include/qt5/QtCore/qalgorithms.h \ + /usr/include/qt5/QtCore/qiterator.h \ + /usr/include/qt5/QtCore/qcoreevent.h \ + /usr/include/qt5/QtCore/qscopedpointer.h \ + /usr/include/qt5/QtCore/qmetatype.h \ + /usr/include/qt5/QtCore/qvarlengtharray.h \ + /usr/include/qt5/QtCore/qcontainerfwd.h \ + /usr/include/qt5/QtCore/qisenum.h \ + /usr/include/qt5/QtCore/qobject_impl.h \ + /usr/include/qt5/QtCore/QPoint \ + /usr/include/qt5/QtCore/qpoint.h \ + /usr/include/qt5/QtCore/QRect \ + /usr/include/qt5/QtCore/qrect.h \ + /usr/include/qt5/QtCore/qsize.h \ + src/Character.h \ + /usr/include/qt5/QtCore/QHash \ + /usr/include/qt5/QtCore/qhash.h \ + /usr/include/qt5/QtCore/qpair.h \ + src/CharacterColor.h \ + /usr/include/qt5/QtGui/QColor \ + /usr/include/qt5/QtGui/qcolor.h \ + /usr/include/qt5/QtGui/qrgb.h \ + /usr/include/qt5/QtCore/qstringlist.h \ + /usr/include/qt5/QtCore/qdatastream.h \ + /usr/include/qt5/QtCore/qiodevice.h \ + /usr/include/qt5/QtCore/qregexp.h \ + /usr/include/qt5/QtCore/qstringmatcher.h \ + src/ScreenWindow.h + /usr/lib/x86_64-linux-gnu/qt5/bin/moc $(DEFINES) $(INCPATH) -I/usr/include/c++/4.8 -I/usr/include/x86_64-linux-gnu/c++/4.8 -I/usr/include/c++/4.8/backward -I/usr/lib/gcc/x86_64-linux-gnu/4.8/include -I/usr/local/include -I/usr/lib/gcc/x86_64-linux-gnu/4.8/include-fixed -I/usr/include/x86_64-linux-gnu -I/usr/include src/ScreenWindow.h -o .moc/moc_ScreenWindow.cpp + +.moc/moc_Filter.cpp: /usr/include/qt5/QtWidgets/QAction \ + /usr/include/qt5/QtWidgets/qaction.h \ + /usr/include/qt5/QtGui/qkeysequence.h \ + /usr/include/qt5/QtCore/qnamespace.h \ + /usr/include/qt5/QtCore/qglobal.h \ + /usr/include/qt5/QtCore/qconfig.h \ + /usr/include/qt5/QtCore/qfeatures.h \ + /usr/include/qt5/QtCore/qsystemdetection.h \ + /usr/include/qt5/QtCore/qprocessordetection.h \ + /usr/include/qt5/QtCore/qcompilerdetection.h \ + /usr/include/qt5/QtCore/qglobalstatic.h \ + /usr/include/qt5/QtCore/qatomic.h \ + /usr/include/qt5/QtCore/qbasicatomic.h \ + /usr/include/qt5/QtCore/qatomic_bootstrap.h \ + /usr/include/qt5/QtCore/qgenericatomic.h \ + /usr/include/qt5/QtCore/qatomic_msvc.h \ + /usr/include/qt5/QtCore/qatomic_integrity.h \ + /usr/include/qt5/QtCore/qoldbasicatomic.h \ + /usr/include/qt5/QtCore/qatomic_vxworks.h \ + /usr/include/qt5/QtCore/qatomic_power.h \ + /usr/include/qt5/QtCore/qatomic_alpha.h \ + /usr/include/qt5/QtCore/qatomic_armv7.h \ + /usr/include/qt5/QtCore/qatomic_armv6.h \ + /usr/include/qt5/QtCore/qatomic_armv5.h \ + /usr/include/qt5/QtCore/qatomic_bfin.h \ + /usr/include/qt5/QtCore/qatomic_ia64.h \ + /usr/include/qt5/QtCore/qatomic_mips.h \ + /usr/include/qt5/QtCore/qatomic_s390.h \ + /usr/include/qt5/QtCore/qatomic_sh4a.h \ + /usr/include/qt5/QtCore/qatomic_sparc.h \ + /usr/include/qt5/QtCore/qatomic_gcc.h \ + /usr/include/qt5/QtCore/qatomic_x86.h \ + /usr/include/qt5/QtCore/qatomic_cxx11.h \ + /usr/include/qt5/QtCore/qatomic_unix.h \ + /usr/include/qt5/QtCore/qmutex.h \ + /usr/include/qt5/QtCore/qlogging.h \ + /usr/include/qt5/QtCore/qflags.h \ + /usr/include/qt5/QtCore/qtypeinfo.h \ + /usr/include/qt5/QtCore/qtypetraits.h \ + /usr/include/qt5/QtCore/qsysinfo.h \ + /usr/include/qt5/QtCore/qstring.h \ + /usr/include/qt5/QtCore/qchar.h \ + /usr/include/qt5/QtCore/qbytearray.h \ + /usr/include/qt5/QtCore/qrefcount.h \ + /usr/include/qt5/QtCore/qarraydata.h \ + /usr/include/qt5/QtCore/qstringbuilder.h \ + /usr/include/qt5/QtCore/qobjectdefs.h \ + /usr/include/qt5/QtCore/qobjectdefs_impl.h \ + /usr/include/qt5/QtWidgets/qwidget.h \ + /usr/include/qt5/QtGui/qwindowdefs.h \ + /usr/include/qt5/QtGui/qwindowdefs_win.h \ + /usr/include/qt5/QtCore/qobject.h \ + /usr/include/qt5/QtCore/qlist.h \ + /usr/include/qt5/QtCore/qalgorithms.h \ + /usr/include/qt5/QtCore/qiterator.h \ + /usr/include/qt5/QtCore/qcoreevent.h \ + /usr/include/qt5/QtCore/qscopedpointer.h \ + /usr/include/qt5/QtCore/qmetatype.h \ + /usr/include/qt5/QtCore/qvarlengtharray.h \ + /usr/include/qt5/QtCore/qcontainerfwd.h \ + /usr/include/qt5/QtCore/qisenum.h \ + /usr/include/qt5/QtCore/qobject_impl.h \ + /usr/include/qt5/QtCore/qmargins.h \ + /usr/include/qt5/QtCore/qrect.h \ + /usr/include/qt5/QtCore/qsize.h \ + /usr/include/qt5/QtCore/qpoint.h \ + /usr/include/qt5/QtGui/qpaintdevice.h \ + /usr/include/qt5/QtGui/qpalette.h \ + /usr/include/qt5/QtGui/qcolor.h \ + /usr/include/qt5/QtGui/qrgb.h \ + /usr/include/qt5/QtCore/qstringlist.h \ + /usr/include/qt5/QtCore/qdatastream.h \ + /usr/include/qt5/QtCore/qiodevice.h \ + /usr/include/qt5/QtCore/qpair.h \ + /usr/include/qt5/QtCore/qregexp.h \ + /usr/include/qt5/QtCore/qstringmatcher.h \ + /usr/include/qt5/QtGui/qbrush.h \ + /usr/include/qt5/QtCore/qvector.h \ + /usr/include/qt5/QtGui/qmatrix.h \ + /usr/include/qt5/QtGui/qpolygon.h \ + /usr/include/qt5/QtGui/qregion.h \ + /usr/include/qt5/QtCore/qline.h \ + /usr/include/qt5/QtGui/qtransform.h \ + /usr/include/qt5/QtGui/qpainterpath.h \ + /usr/include/qt5/QtGui/qimage.h \ + /usr/include/qt5/QtGui/qpixmap.h \ + /usr/include/qt5/QtCore/qsharedpointer.h \ + /usr/include/qt5/QtCore/qshareddata.h \ + /usr/include/qt5/QtCore/qsharedpointer_impl.h \ + /usr/include/qt5/QtCore/qhash.h \ + /usr/include/qt5/QtGui/qfont.h \ + /usr/include/qt5/QtGui/qfontmetrics.h \ + /usr/include/qt5/QtGui/qfontinfo.h \ + /usr/include/qt5/QtWidgets/qsizepolicy.h \ + /usr/include/qt5/QtGui/qcursor.h \ + /usr/include/qt5/QtGui/qevent.h \ + /usr/include/qt5/QtCore/qvariant.h \ + /usr/include/qt5/QtCore/qmap.h \ + /usr/include/qt5/QtCore/qdebug.h \ + /usr/include/qt5/QtCore/qtextstream.h \ + /usr/include/qt5/QtCore/qlocale.h \ + /usr/include/qt5/QtCore/qset.h \ + /usr/include/qt5/QtCore/qcontiguouscache.h \ + /usr/include/qt5/QtCore/qurl.h \ + /usr/include/qt5/QtCore/qurlquery.h \ + /usr/include/qt5/QtCore/qfile.h \ + /usr/include/qt5/QtCore/qfiledevice.h \ + /usr/include/qt5/QtGui/qvector2d.h \ + /usr/include/qt5/QtGui/qtouchdevice.h \ + /usr/include/qt5/QtGui/qicon.h \ + /usr/include/qt5/QtWidgets/qactiongroup.h \ + /usr/include/qt5/QtCore/QList \ + /usr/include/qt5/QtCore/QObject \ + /usr/include/qt5/QtCore/QStringList \ + /usr/include/qt5/QtCore/QHash \ + /usr/include/qt5/QtCore/QRegExp \ + src/Character.h \ + src/CharacterColor.h \ + /usr/include/qt5/QtGui/QColor \ + src/Filter.h + /usr/lib/x86_64-linux-gnu/qt5/bin/moc $(DEFINES) $(INCPATH) -I/usr/include/c++/4.8 -I/usr/include/x86_64-linux-gnu/c++/4.8 -I/usr/include/c++/4.8/backward -I/usr/lib/gcc/x86_64-linux-gnu/4.8/include -I/usr/local/include -I/usr/lib/gcc/x86_64-linux-gnu/4.8/include-fixed -I/usr/include/x86_64-linux-gnu -I/usr/include src/Filter.h -o .moc/moc_Filter.cpp + +.moc/moc_TerminalDisplay.cpp: /usr/include/qt5/QtGui/QColor \ + /usr/include/qt5/QtGui/qcolor.h \ + /usr/include/qt5/QtGui/qrgb.h \ + /usr/include/qt5/QtCore/qglobal.h \ + /usr/include/qt5/QtCore/qconfig.h \ + /usr/include/qt5/QtCore/qfeatures.h \ + /usr/include/qt5/QtCore/qsystemdetection.h \ + /usr/include/qt5/QtCore/qprocessordetection.h \ + /usr/include/qt5/QtCore/qcompilerdetection.h \ + /usr/include/qt5/QtCore/qglobalstatic.h \ + /usr/include/qt5/QtCore/qatomic.h \ + /usr/include/qt5/QtCore/qbasicatomic.h \ + /usr/include/qt5/QtCore/qatomic_bootstrap.h \ + /usr/include/qt5/QtCore/qgenericatomic.h \ + /usr/include/qt5/QtCore/qatomic_msvc.h \ + /usr/include/qt5/QtCore/qatomic_integrity.h \ + /usr/include/qt5/QtCore/qoldbasicatomic.h \ + /usr/include/qt5/QtCore/qatomic_vxworks.h \ + /usr/include/qt5/QtCore/qatomic_power.h \ + /usr/include/qt5/QtCore/qatomic_alpha.h \ + /usr/include/qt5/QtCore/qatomic_armv7.h \ + /usr/include/qt5/QtCore/qatomic_armv6.h \ + /usr/include/qt5/QtCore/qatomic_armv5.h \ + /usr/include/qt5/QtCore/qatomic_bfin.h \ + /usr/include/qt5/QtCore/qatomic_ia64.h \ + /usr/include/qt5/QtCore/qatomic_mips.h \ + /usr/include/qt5/QtCore/qatomic_s390.h \ + /usr/include/qt5/QtCore/qatomic_sh4a.h \ + /usr/include/qt5/QtCore/qatomic_sparc.h \ + /usr/include/qt5/QtCore/qatomic_gcc.h \ + /usr/include/qt5/QtCore/qatomic_x86.h \ + /usr/include/qt5/QtCore/qatomic_cxx11.h \ + /usr/include/qt5/QtCore/qatomic_unix.h \ + /usr/include/qt5/QtCore/qmutex.h \ + /usr/include/qt5/QtCore/qlogging.h \ + /usr/include/qt5/QtCore/qflags.h \ + /usr/include/qt5/QtCore/qtypeinfo.h \ + /usr/include/qt5/QtCore/qtypetraits.h \ + /usr/include/qt5/QtCore/qsysinfo.h \ + /usr/include/qt5/QtCore/qnamespace.h \ + /usr/include/qt5/QtCore/qstringlist.h \ + /usr/include/qt5/QtCore/qalgorithms.h \ + /usr/include/qt5/QtCore/qdatastream.h \ + /usr/include/qt5/QtCore/qscopedpointer.h \ + /usr/include/qt5/QtCore/qiodevice.h \ + /usr/include/qt5/QtCore/qobject.h \ + /usr/include/qt5/QtCore/qobjectdefs.h \ + /usr/include/qt5/QtCore/qobjectdefs_impl.h \ + /usr/include/qt5/QtCore/qstring.h \ + /usr/include/qt5/QtCore/qchar.h \ + /usr/include/qt5/QtCore/qbytearray.h \ + /usr/include/qt5/QtCore/qrefcount.h \ + /usr/include/qt5/QtCore/qarraydata.h \ + /usr/include/qt5/QtCore/qstringbuilder.h \ + /usr/include/qt5/QtCore/qlist.h \ + /usr/include/qt5/QtCore/qiterator.h \ + /usr/include/qt5/QtCore/qcoreevent.h \ + /usr/include/qt5/QtCore/qmetatype.h \ + /usr/include/qt5/QtCore/qvarlengtharray.h \ + /usr/include/qt5/QtCore/qcontainerfwd.h \ + /usr/include/qt5/QtCore/qisenum.h \ + /usr/include/qt5/QtCore/qobject_impl.h \ + /usr/include/qt5/QtCore/qpair.h \ + /usr/include/qt5/QtCore/qregexp.h \ + /usr/include/qt5/QtCore/qstringmatcher.h \ + /usr/include/qt5/QtCore/QPointer \ + /usr/include/qt5/QtCore/qpointer.h \ + /usr/include/qt5/QtCore/qsharedpointer.h \ + /usr/include/qt5/QtCore/qshareddata.h \ + /usr/include/qt5/QtCore/qsharedpointer_impl.h \ + /usr/include/qt5/QtCore/qhash.h \ + src/Filter.h \ + /usr/include/qt5/QtWidgets/QAction \ + /usr/include/qt5/QtWidgets/qaction.h \ + /usr/include/qt5/QtGui/qkeysequence.h \ + /usr/include/qt5/QtWidgets/qwidget.h \ + /usr/include/qt5/QtGui/qwindowdefs.h \ + /usr/include/qt5/QtGui/qwindowdefs_win.h \ + /usr/include/qt5/QtCore/qmargins.h \ + /usr/include/qt5/QtCore/qrect.h \ + /usr/include/qt5/QtCore/qsize.h \ + /usr/include/qt5/QtCore/qpoint.h \ + /usr/include/qt5/QtGui/qpaintdevice.h \ + /usr/include/qt5/QtGui/qpalette.h \ + /usr/include/qt5/QtGui/qbrush.h \ + /usr/include/qt5/QtCore/qvector.h \ + /usr/include/qt5/QtGui/qmatrix.h \ + /usr/include/qt5/QtGui/qpolygon.h \ + /usr/include/qt5/QtGui/qregion.h \ + /usr/include/qt5/QtCore/qline.h \ + /usr/include/qt5/QtGui/qtransform.h \ + /usr/include/qt5/QtGui/qpainterpath.h \ + /usr/include/qt5/QtGui/qimage.h \ + /usr/include/qt5/QtGui/qpixmap.h \ + /usr/include/qt5/QtGui/qfont.h \ + /usr/include/qt5/QtGui/qfontmetrics.h \ + /usr/include/qt5/QtGui/qfontinfo.h \ + /usr/include/qt5/QtWidgets/qsizepolicy.h \ + /usr/include/qt5/QtGui/qcursor.h \ + /usr/include/qt5/QtGui/qevent.h \ + /usr/include/qt5/QtCore/qvariant.h \ + /usr/include/qt5/QtCore/qmap.h \ + /usr/include/qt5/QtCore/qdebug.h \ + /usr/include/qt5/QtCore/qtextstream.h \ + /usr/include/qt5/QtCore/qlocale.h \ + /usr/include/qt5/QtCore/qset.h \ + /usr/include/qt5/QtCore/qcontiguouscache.h \ + /usr/include/qt5/QtCore/qurl.h \ + /usr/include/qt5/QtCore/qurlquery.h \ + /usr/include/qt5/QtCore/qfile.h \ + /usr/include/qt5/QtCore/qfiledevice.h \ + /usr/include/qt5/QtGui/qvector2d.h \ + /usr/include/qt5/QtGui/qtouchdevice.h \ + /usr/include/qt5/QtGui/qicon.h \ + /usr/include/qt5/QtWidgets/qactiongroup.h \ + /usr/include/qt5/QtCore/QList \ + /usr/include/qt5/QtCore/QObject \ + /usr/include/qt5/QtCore/QStringList \ + /usr/include/qt5/QtCore/QHash \ + /usr/include/qt5/QtCore/QRegExp \ + src/Character.h \ + src/CharacterColor.h \ + src/ksession.h \ + src/Session.h \ + /usr/include/qt5/QtCore/QTimer \ + /usr/include/qt5/QtCore/qtimer.h \ + /usr/include/qt5/QtCore/qbasictimer.h \ + /usr/include/qt5/QtGui/QWindow \ + /usr/include/qt5/QtGui/qwindow.h \ + /usr/include/qt5/QtCore/QEvent \ + /usr/include/qt5/QtCore/QMargins \ + /usr/include/qt5/QtCore/QRect \ + /usr/include/qt5/QtGui/qsurface.h \ + /usr/include/qt5/QtGui/qsurfaceformat.h \ + src/History.h \ + /usr/include/qt5/QtCore/QBitRef \ + /usr/include/qt5/QtCore/qbitarray.h \ + /usr/include/qt5/QtCore/QVector \ + /usr/include/qt5/QtCore/QTemporaryFile \ + /usr/include/qt5/QtCore/qtemporaryfile.h \ + src/BlockArray.h \ + /usr/include/qt5/QtQuick/QQuickItem \ + /usr/include/qt5/QtQuick/qquickitem.h \ + /usr/include/qt5/QtQuick/qtquickglobal.h \ + /usr/include/qt5/QtQml/qqml.h \ + /usr/include/qt5/QtQml/qqmlprivate.h \ + /usr/include/qt5/QtQml/qtqmlglobal.h \ + /usr/include/qt5/QtQml/qqmlparserstatus.h \ + /usr/include/qt5/QtQml/qqmlpropertyvaluesource.h \ + /usr/include/qt5/QtQml/qqmllist.h \ + /usr/include/qt5/QtCore/qmetaobject.h \ + /usr/include/qt5/QtQml/qqmlcomponent.h \ + /usr/include/qt5/QtQml/qqmlerror.h \ + /usr/include/qt5/QtQml/qjsvalue.h \ + /usr/include/qt5/QtGui/qaccessible.h \ + /usr/include/qt5/QtCore/qcoreapplication.h \ + /usr/include/qt5/QtCore/qeventloop.h \ + /usr/include/qt5/QtQuick/QQuickPaintedItem \ + /usr/include/qt5/QtQuick/qquickpainteditem.h \ + src/TerminalDisplay.h + /usr/lib/x86_64-linux-gnu/qt5/bin/moc $(DEFINES) $(INCPATH) -I/usr/include/c++/4.8 -I/usr/include/x86_64-linux-gnu/c++/4.8 -I/usr/include/c++/4.8/backward -I/usr/lib/gcc/x86_64-linux-gnu/4.8/include -I/usr/local/include -I/usr/lib/gcc/x86_64-linux-gnu/4.8/include-fixed -I/usr/include/x86_64-linux-gnu -I/usr/include src/TerminalDisplay.h -o .moc/moc_TerminalDisplay.cpp + +.moc/moc_ksession.cpp: /usr/include/qt5/QtCore/QObject \ + /usr/include/qt5/QtCore/qobject.h \ + /usr/include/qt5/QtCore/qobjectdefs.h \ + /usr/include/qt5/QtCore/qnamespace.h \ + /usr/include/qt5/QtCore/qglobal.h \ + /usr/include/qt5/QtCore/qconfig.h \ + /usr/include/qt5/QtCore/qfeatures.h \ + /usr/include/qt5/QtCore/qsystemdetection.h \ + /usr/include/qt5/QtCore/qprocessordetection.h \ + /usr/include/qt5/QtCore/qcompilerdetection.h \ + /usr/include/qt5/QtCore/qglobalstatic.h \ + /usr/include/qt5/QtCore/qatomic.h \ + /usr/include/qt5/QtCore/qbasicatomic.h \ + /usr/include/qt5/QtCore/qatomic_bootstrap.h \ + /usr/include/qt5/QtCore/qgenericatomic.h \ + /usr/include/qt5/QtCore/qatomic_msvc.h \ + /usr/include/qt5/QtCore/qatomic_integrity.h \ + /usr/include/qt5/QtCore/qoldbasicatomic.h \ + /usr/include/qt5/QtCore/qatomic_vxworks.h \ + /usr/include/qt5/QtCore/qatomic_power.h \ + /usr/include/qt5/QtCore/qatomic_alpha.h \ + /usr/include/qt5/QtCore/qatomic_armv7.h \ + /usr/include/qt5/QtCore/qatomic_armv6.h \ + /usr/include/qt5/QtCore/qatomic_armv5.h \ + /usr/include/qt5/QtCore/qatomic_bfin.h \ + /usr/include/qt5/QtCore/qatomic_ia64.h \ + /usr/include/qt5/QtCore/qatomic_mips.h \ + /usr/include/qt5/QtCore/qatomic_s390.h \ + /usr/include/qt5/QtCore/qatomic_sh4a.h \ + /usr/include/qt5/QtCore/qatomic_sparc.h \ + /usr/include/qt5/QtCore/qatomic_gcc.h \ + /usr/include/qt5/QtCore/qatomic_x86.h \ + /usr/include/qt5/QtCore/qatomic_cxx11.h \ + /usr/include/qt5/QtCore/qatomic_unix.h \ + /usr/include/qt5/QtCore/qmutex.h \ + /usr/include/qt5/QtCore/qlogging.h \ + /usr/include/qt5/QtCore/qflags.h \ + /usr/include/qt5/QtCore/qtypeinfo.h \ + /usr/include/qt5/QtCore/qtypetraits.h \ + /usr/include/qt5/QtCore/qsysinfo.h \ + /usr/include/qt5/QtCore/qobjectdefs_impl.h \ + /usr/include/qt5/QtCore/qstring.h \ + /usr/include/qt5/QtCore/qchar.h \ + /usr/include/qt5/QtCore/qbytearray.h \ + /usr/include/qt5/QtCore/qrefcount.h \ + /usr/include/qt5/QtCore/qarraydata.h \ + /usr/include/qt5/QtCore/qstringbuilder.h \ + /usr/include/qt5/QtCore/qlist.h \ + /usr/include/qt5/QtCore/qalgorithms.h \ + /usr/include/qt5/QtCore/qiterator.h \ + /usr/include/qt5/QtCore/qcoreevent.h \ + /usr/include/qt5/QtCore/qscopedpointer.h \ + /usr/include/qt5/QtCore/qmetatype.h \ + /usr/include/qt5/QtCore/qvarlengtharray.h \ + /usr/include/qt5/QtCore/qcontainerfwd.h \ + /usr/include/qt5/QtCore/qisenum.h \ + /usr/include/qt5/QtCore/qobject_impl.h \ + src/Session.h \ + /usr/include/qt5/QtCore/QStringList \ + /usr/include/qt5/QtCore/qstringlist.h \ + /usr/include/qt5/QtCore/qdatastream.h \ + /usr/include/qt5/QtCore/qiodevice.h \ + /usr/include/qt5/QtCore/qpair.h \ + /usr/include/qt5/QtCore/qregexp.h \ + /usr/include/qt5/QtCore/qstringmatcher.h \ + /usr/include/qt5/QtCore/QTimer \ + /usr/include/qt5/QtCore/qtimer.h \ + /usr/include/qt5/QtCore/qbasictimer.h \ + /usr/include/qt5/QtGui/QWindow \ + /usr/include/qt5/QtGui/qwindow.h \ + /usr/include/qt5/QtCore/QEvent \ + /usr/include/qt5/QtCore/QMargins \ + /usr/include/qt5/QtCore/qmargins.h \ + /usr/include/qt5/QtCore/qrect.h \ + /usr/include/qt5/QtCore/qsize.h \ + /usr/include/qt5/QtCore/qpoint.h \ + /usr/include/qt5/QtCore/QRect \ + /usr/include/qt5/QtGui/qsurface.h \ + /usr/include/qt5/QtGui/qsurfaceformat.h \ + /usr/include/qt5/QtGui/qwindowdefs.h \ + /usr/include/qt5/QtGui/qwindowdefs_win.h \ + /usr/include/qt5/QtGui/qicon.h \ + /usr/include/qt5/QtGui/qpixmap.h \ + /usr/include/qt5/QtGui/qpaintdevice.h \ + /usr/include/qt5/QtGui/qcolor.h \ + /usr/include/qt5/QtGui/qrgb.h \ + /usr/include/qt5/QtCore/qsharedpointer.h \ + /usr/include/qt5/QtCore/qshareddata.h \ + /usr/include/qt5/QtCore/qsharedpointer_impl.h \ + /usr/include/qt5/QtCore/qhash.h \ + /usr/include/qt5/QtGui/qimage.h \ + /usr/include/qt5/QtGui/qtransform.h \ + /usr/include/qt5/QtGui/qmatrix.h \ + /usr/include/qt5/QtGui/qpolygon.h \ + /usr/include/qt5/QtCore/qvector.h \ + /usr/include/qt5/QtGui/qregion.h \ + /usr/include/qt5/QtCore/qline.h \ + /usr/include/qt5/QtGui/qpainterpath.h \ + /usr/include/qt5/QtGui/qcursor.h \ + src/History.h \ + /usr/include/qt5/QtCore/QBitRef \ + /usr/include/qt5/QtCore/qbitarray.h \ + /usr/include/qt5/QtCore/QHash \ + /usr/include/qt5/QtCore/QVector \ + /usr/include/qt5/QtCore/QTemporaryFile \ + /usr/include/qt5/QtCore/qtemporaryfile.h \ + /usr/include/qt5/QtCore/qfile.h \ + /usr/include/qt5/QtCore/qfiledevice.h \ + src/BlockArray.h \ + src/Character.h \ + src/CharacterColor.h \ + /usr/include/qt5/QtGui/QColor \ + src/ksession.h + /usr/lib/x86_64-linux-gnu/qt5/bin/moc $(DEFINES) $(INCPATH) -I/usr/include/c++/4.8 -I/usr/include/x86_64-linux-gnu/c++/4.8 -I/usr/include/c++/4.8/backward -I/usr/lib/gcc/x86_64-linux-gnu/4.8/include -I/usr/local/include -I/usr/lib/gcc/x86_64-linux-gnu/4.8/include-fixed -I/usr/include/x86_64-linux-gnu -I/usr/include src/ksession.h -o .moc/moc_ksession.cpp + +compiler_moc_source_make_all: +compiler_moc_source_clean: +compiler_uic_make_all: +compiler_uic_clean: +compiler_yacc_decl_make_all: +compiler_yacc_decl_clean: +compiler_yacc_impl_make_all: +compiler_yacc_impl_clean: +compiler_lex_make_all: +compiler_lex_clean: +compiler_clean: compiler_moc_header_clean + +####### Compile + +.obj/plugin.o: src/plugin.cpp /usr/include/qt5/QtCore/QString \ + /usr/include/qt5/QtCore/qstring.h \ + /usr/include/qt5/QtCore/qchar.h \ + /usr/include/qt5/QtCore/qglobal.h \ + /usr/include/qt5/QtCore/qconfig.h \ + /usr/include/qt5/QtCore/qfeatures.h \ + /usr/include/qt5/QtCore/qsystemdetection.h \ + /usr/include/qt5/QtCore/qprocessordetection.h \ + /usr/include/qt5/QtCore/qcompilerdetection.h \ + /usr/include/qt5/QtCore/qglobalstatic.h \ + /usr/include/qt5/QtCore/qatomic.h \ + /usr/include/qt5/QtCore/qbasicatomic.h \ + /usr/include/qt5/QtCore/qatomic_bootstrap.h \ + /usr/include/qt5/QtCore/qgenericatomic.h \ + /usr/include/qt5/QtCore/qatomic_msvc.h \ + /usr/include/qt5/QtCore/qatomic_integrity.h \ + /usr/include/qt5/QtCore/qoldbasicatomic.h \ + /usr/include/qt5/QtCore/qatomic_vxworks.h \ + /usr/include/qt5/QtCore/qatomic_power.h \ + /usr/include/qt5/QtCore/qatomic_alpha.h \ + /usr/include/qt5/QtCore/qatomic_armv7.h \ + /usr/include/qt5/QtCore/qatomic_armv6.h \ + /usr/include/qt5/QtCore/qatomic_armv5.h \ + /usr/include/qt5/QtCore/qatomic_bfin.h \ + /usr/include/qt5/QtCore/qatomic_ia64.h \ + /usr/include/qt5/QtCore/qatomic_mips.h \ + /usr/include/qt5/QtCore/qatomic_s390.h \ + /usr/include/qt5/QtCore/qatomic_sh4a.h \ + /usr/include/qt5/QtCore/qatomic_sparc.h \ + /usr/include/qt5/QtCore/qatomic_gcc.h \ + /usr/include/qt5/QtCore/qatomic_x86.h \ + /usr/include/qt5/QtCore/qatomic_cxx11.h \ + /usr/include/qt5/QtCore/qatomic_unix.h \ + /usr/include/qt5/QtCore/qmutex.h \ + /usr/include/qt5/QtCore/qlogging.h \ + /usr/include/qt5/QtCore/qflags.h \ + /usr/include/qt5/QtCore/qtypeinfo.h \ + /usr/include/qt5/QtCore/qtypetraits.h \ + /usr/include/qt5/QtCore/qsysinfo.h \ + /usr/include/qt5/QtCore/qbytearray.h \ + /usr/include/qt5/QtCore/qrefcount.h \ + /usr/include/qt5/QtCore/qnamespace.h \ + /usr/include/qt5/QtCore/qarraydata.h \ + /usr/include/qt5/QtCore/qstringbuilder.h \ + /usr/include/qt5/QtCore/QDir \ + /usr/include/qt5/QtCore/qdir.h \ + /usr/include/qt5/QtCore/qfileinfo.h \ + /usr/include/qt5/QtCore/qfile.h \ + /usr/include/qt5/QtCore/qfiledevice.h \ + /usr/include/qt5/QtCore/qiodevice.h \ + /usr/include/qt5/QtCore/qobject.h \ + /usr/include/qt5/QtCore/qobjectdefs.h \ + /usr/include/qt5/QtCore/qobjectdefs_impl.h \ + /usr/include/qt5/QtCore/qlist.h \ + /usr/include/qt5/QtCore/qalgorithms.h \ + /usr/include/qt5/QtCore/qiterator.h \ + /usr/include/qt5/QtCore/qcoreevent.h \ + /usr/include/qt5/QtCore/qscopedpointer.h \ + /usr/include/qt5/QtCore/qmetatype.h \ + /usr/include/qt5/QtCore/qvarlengtharray.h \ + /usr/include/qt5/QtCore/qcontainerfwd.h \ + /usr/include/qt5/QtCore/qisenum.h \ + /usr/include/qt5/QtCore/qobject_impl.h \ + /usr/include/qt5/QtCore/qshareddata.h \ + /usr/include/qt5/QtCore/qstringlist.h \ + /usr/include/qt5/QtCore/qdatastream.h \ + /usr/include/qt5/QtCore/qpair.h \ + /usr/include/qt5/QtCore/qregexp.h \ + /usr/include/qt5/QtCore/qstringmatcher.h \ + src/plugin.h \ + src/TerminalDisplay.h \ + /usr/include/qt5/QtGui/QColor \ + /usr/include/qt5/QtGui/qcolor.h \ + /usr/include/qt5/QtGui/qrgb.h \ + /usr/include/qt5/QtCore/QPointer \ + /usr/include/qt5/QtCore/qpointer.h \ + /usr/include/qt5/QtCore/qsharedpointer.h \ + /usr/include/qt5/QtCore/qsharedpointer_impl.h \ + /usr/include/qt5/QtCore/qhash.h \ + src/Filter.h \ + /usr/include/qt5/QtWidgets/QAction \ + /usr/include/qt5/QtWidgets/qaction.h \ + /usr/include/qt5/QtGui/qkeysequence.h \ + /usr/include/qt5/QtWidgets/qwidget.h \ + /usr/include/qt5/QtGui/qwindowdefs.h \ + /usr/include/qt5/QtGui/qwindowdefs_win.h \ + /usr/include/qt5/QtCore/qmargins.h \ + /usr/include/qt5/QtCore/qrect.h \ + /usr/include/qt5/QtCore/qsize.h \ + /usr/include/qt5/QtCore/qpoint.h \ + /usr/include/qt5/QtGui/qpaintdevice.h \ + /usr/include/qt5/QtGui/qpalette.h \ + /usr/include/qt5/QtGui/qbrush.h \ + /usr/include/qt5/QtCore/qvector.h \ + /usr/include/qt5/QtGui/qmatrix.h \ + /usr/include/qt5/QtGui/qpolygon.h \ + /usr/include/qt5/QtGui/qregion.h \ + /usr/include/qt5/QtCore/qline.h \ + /usr/include/qt5/QtGui/qtransform.h \ + /usr/include/qt5/QtGui/qpainterpath.h \ + /usr/include/qt5/QtGui/qimage.h \ + /usr/include/qt5/QtGui/qpixmap.h \ + /usr/include/qt5/QtGui/qfont.h \ + /usr/include/qt5/QtGui/qfontmetrics.h \ + /usr/include/qt5/QtGui/qfontinfo.h \ + /usr/include/qt5/QtWidgets/qsizepolicy.h \ + /usr/include/qt5/QtGui/qcursor.h \ + /usr/include/qt5/QtGui/qevent.h \ + /usr/include/qt5/QtCore/qvariant.h \ + /usr/include/qt5/QtCore/qmap.h \ + /usr/include/qt5/QtCore/qdebug.h \ + /usr/include/qt5/QtCore/qtextstream.h \ + /usr/include/qt5/QtCore/qlocale.h \ + /usr/include/qt5/QtCore/qset.h \ + /usr/include/qt5/QtCore/qcontiguouscache.h \ + /usr/include/qt5/QtCore/qurl.h \ + /usr/include/qt5/QtCore/qurlquery.h \ + /usr/include/qt5/QtGui/qvector2d.h \ + /usr/include/qt5/QtGui/qtouchdevice.h \ + /usr/include/qt5/QtGui/qicon.h \ + /usr/include/qt5/QtWidgets/qactiongroup.h \ + /usr/include/qt5/QtCore/QList \ + /usr/include/qt5/QtCore/QObject \ + /usr/include/qt5/QtCore/QStringList \ + /usr/include/qt5/QtCore/QHash \ + /usr/include/qt5/QtCore/QRegExp \ + src/Character.h \ + src/CharacterColor.h \ + src/ksession.h \ + src/Session.h \ + /usr/include/qt5/QtCore/QTimer \ + /usr/include/qt5/QtCore/qtimer.h \ + /usr/include/qt5/QtCore/qbasictimer.h \ + /usr/include/qt5/QtGui/QWindow \ + /usr/include/qt5/QtGui/qwindow.h \ + /usr/include/qt5/QtCore/QEvent \ + /usr/include/qt5/QtCore/QMargins \ + /usr/include/qt5/QtCore/QRect \ + /usr/include/qt5/QtGui/qsurface.h \ + /usr/include/qt5/QtGui/qsurfaceformat.h \ + src/History.h \ + /usr/include/qt5/QtCore/QBitRef \ + /usr/include/qt5/QtCore/qbitarray.h \ + /usr/include/qt5/QtCore/QVector \ + /usr/include/qt5/QtCore/QTemporaryFile \ + /usr/include/qt5/QtCore/qtemporaryfile.h \ + src/BlockArray.h \ + /usr/include/qt5/QtQuick/QQuickItem \ + /usr/include/qt5/QtQuick/qquickitem.h \ + /usr/include/qt5/QtQuick/qtquickglobal.h \ + /usr/include/qt5/QtQml/qqml.h \ + /usr/include/qt5/QtQml/qqmlprivate.h \ + /usr/include/qt5/QtQml/qtqmlglobal.h \ + /usr/include/qt5/QtQml/qqmlparserstatus.h \ + /usr/include/qt5/QtQml/qqmlpropertyvaluesource.h \ + /usr/include/qt5/QtQml/qqmllist.h \ + /usr/include/qt5/QtCore/qmetaobject.h \ + /usr/include/qt5/QtQml/qqmlcomponent.h \ + /usr/include/qt5/QtQml/qqmlerror.h \ + /usr/include/qt5/QtQml/qjsvalue.h \ + /usr/include/qt5/QtGui/qaccessible.h \ + /usr/include/qt5/QtCore/qcoreapplication.h \ + /usr/include/qt5/QtCore/qeventloop.h \ + /usr/include/qt5/QtQuick/QQuickPaintedItem \ + /usr/include/qt5/QtQuick/qquickpainteditem.h \ + /usr/include/qt5/QtQml/QQmlEngine \ + /usr/include/qt5/QtQml/qqmlengine.h \ + /usr/include/qt5/QtQml/qjsengine.h \ + /usr/include/qt5/QtQml/qqmldebug.h \ + /usr/include/qt5/QtQml/QQmlExtensionPlugin \ + /usr/include/qt5/QtQml/qqmlextensionplugin.h \ + /usr/include/qt5/QtCore/qplugin.h \ + /usr/include/qt5/QtCore/qjsonobject.h \ + /usr/include/qt5/QtCore/qjsonvalue.h \ + /usr/include/qt5/QtCore/QUrl \ + /usr/include/qt5/QtQml/qqmlextensioninterface.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o .obj/plugin.o src/plugin.cpp + +.obj/Pty.o: src/Pty.cpp src/Pty.h \ + /usr/include/qt5/QtCore/QStringList \ + /usr/include/qt5/QtCore/qstringlist.h \ + /usr/include/qt5/QtCore/qalgorithms.h \ + /usr/include/qt5/QtCore/qglobal.h \ + /usr/include/qt5/QtCore/qconfig.h \ + /usr/include/qt5/QtCore/qfeatures.h \ + /usr/include/qt5/QtCore/qsystemdetection.h \ + /usr/include/qt5/QtCore/qprocessordetection.h \ + /usr/include/qt5/QtCore/qcompilerdetection.h \ + /usr/include/qt5/QtCore/qglobalstatic.h \ + /usr/include/qt5/QtCore/qatomic.h \ + /usr/include/qt5/QtCore/qbasicatomic.h \ + /usr/include/qt5/QtCore/qatomic_bootstrap.h \ + /usr/include/qt5/QtCore/qgenericatomic.h \ + /usr/include/qt5/QtCore/qatomic_msvc.h \ + /usr/include/qt5/QtCore/qatomic_integrity.h \ + /usr/include/qt5/QtCore/qoldbasicatomic.h \ + /usr/include/qt5/QtCore/qatomic_vxworks.h \ + /usr/include/qt5/QtCore/qatomic_power.h \ + /usr/include/qt5/QtCore/qatomic_alpha.h \ + /usr/include/qt5/QtCore/qatomic_armv7.h \ + /usr/include/qt5/QtCore/qatomic_armv6.h \ + /usr/include/qt5/QtCore/qatomic_armv5.h \ + /usr/include/qt5/QtCore/qatomic_bfin.h \ + /usr/include/qt5/QtCore/qatomic_ia64.h \ + /usr/include/qt5/QtCore/qatomic_mips.h \ + /usr/include/qt5/QtCore/qatomic_s390.h \ + /usr/include/qt5/QtCore/qatomic_sh4a.h \ + /usr/include/qt5/QtCore/qatomic_sparc.h \ + /usr/include/qt5/QtCore/qatomic_gcc.h \ + /usr/include/qt5/QtCore/qatomic_x86.h \ + /usr/include/qt5/QtCore/qatomic_cxx11.h \ + /usr/include/qt5/QtCore/qatomic_unix.h \ + /usr/include/qt5/QtCore/qmutex.h \ + /usr/include/qt5/QtCore/qlogging.h \ + /usr/include/qt5/QtCore/qflags.h \ + /usr/include/qt5/QtCore/qtypeinfo.h \ + /usr/include/qt5/QtCore/qtypetraits.h \ + /usr/include/qt5/QtCore/qsysinfo.h \ + /usr/include/qt5/QtCore/qdatastream.h \ + /usr/include/qt5/QtCore/qscopedpointer.h \ + /usr/include/qt5/QtCore/qiodevice.h \ + /usr/include/qt5/QtCore/qobject.h \ + /usr/include/qt5/QtCore/qobjectdefs.h \ + /usr/include/qt5/QtCore/qnamespace.h \ + /usr/include/qt5/QtCore/qobjectdefs_impl.h \ + /usr/include/qt5/QtCore/qstring.h \ + /usr/include/qt5/QtCore/qchar.h \ + /usr/include/qt5/QtCore/qbytearray.h \ + /usr/include/qt5/QtCore/qrefcount.h \ + /usr/include/qt5/QtCore/qarraydata.h \ + /usr/include/qt5/QtCore/qstringbuilder.h \ + /usr/include/qt5/QtCore/qlist.h \ + /usr/include/qt5/QtCore/qiterator.h \ + /usr/include/qt5/QtCore/qcoreevent.h \ + /usr/include/qt5/QtCore/qmetatype.h \ + /usr/include/qt5/QtCore/qvarlengtharray.h \ + /usr/include/qt5/QtCore/qcontainerfwd.h \ + /usr/include/qt5/QtCore/qisenum.h \ + /usr/include/qt5/QtCore/qobject_impl.h \ + /usr/include/qt5/QtCore/qpair.h \ + /usr/include/qt5/QtCore/qregexp.h \ + /usr/include/qt5/QtCore/qstringmatcher.h \ + /usr/include/qt5/QtCore/QVector \ + /usr/include/qt5/QtCore/qvector.h \ + /usr/include/qt5/QtCore/qpoint.h \ + /usr/include/qt5/QtCore/QList \ + /usr/include/qt5/QtCore/QSize \ + /usr/include/qt5/QtCore/qsize.h \ + src/kptyprocess.h \ + src/kprocess.h \ + /usr/include/qt5/QtCore/QProcess \ + /usr/include/qt5/QtCore/qprocess.h \ + /usr/include/qt5/QtCore/qshareddata.h \ + src/kptydevice.h \ + src/kpty_p.h \ + src/kpty.h \ + /usr/include/qt5/QtCore/QtCore \ + /usr/include/qt5/QtCore/QtCoreDepends \ + /usr/include/qt5/QtCore/qabstractanimation.h \ + /usr/include/qt5/QtCore/qanimationgroup.h \ + /usr/include/qt5/QtCore/qparallelanimationgroup.h \ + /usr/include/qt5/QtCore/qpauseanimation.h \ + /usr/include/qt5/QtCore/qpropertyanimation.h \ + /usr/include/qt5/QtCore/qvariantanimation.h \ + /usr/include/qt5/QtCore/qeasingcurve.h \ + /usr/include/qt5/QtCore/qvariant.h \ + /usr/include/qt5/QtCore/qmap.h \ + /usr/include/qt5/QtCore/qdebug.h \ + /usr/include/qt5/QtCore/qhash.h \ + /usr/include/qt5/QtCore/qtextstream.h \ + /usr/include/qt5/QtCore/qlocale.h \ + /usr/include/qt5/QtCore/qset.h \ + /usr/include/qt5/QtCore/qcontiguouscache.h \ + /usr/include/qt5/QtCore/qsequentialanimationgroup.h \ + /usr/include/qt5/QtCore/qtextcodec.h \ + /usr/include/qt5/QtCore/qendian.h \ + /usr/include/qt5/QtCore/qlibraryinfo.h \ + /usr/include/qt5/QtCore/qdatetime.h \ + /usr/include/qt5/QtCore/qsharedpointer.h \ + /usr/include/qt5/QtCore/qsharedpointer_impl.h \ + /usr/include/qt5/QtCore/qnumeric.h \ + /usr/include/qt5/QtCore/qbuffer.h \ + /usr/include/qt5/QtCore/qdir.h \ + /usr/include/qt5/QtCore/qfileinfo.h \ + /usr/include/qt5/QtCore/qfile.h \ + /usr/include/qt5/QtCore/qfiledevice.h \ + /usr/include/qt5/QtCore/qdiriterator.h \ + /usr/include/qt5/QtCore/qfileselector.h \ + /usr/include/qt5/QtCore/QObject \ + /usr/include/qt5/QtCore/qfilesystemwatcher.h \ + /usr/include/qt5/QtCore/qlockfile.h \ + /usr/include/qt5/QtCore/qloggingcategory.h \ + /usr/include/qt5/QtCore/qresource.h \ + /usr/include/qt5/QtCore/qsavefile.h \ + /usr/include/qt5/QtCore/qsettings.h \ + /usr/include/qt5/QtCore/qstandardpaths.h \ + /usr/include/qt5/QtCore/qtemporarydir.h \ + /usr/include/qt5/QtCore/QScopedPointer \ + /usr/include/qt5/QtCore/qtemporaryfile.h \ + /usr/include/qt5/QtCore/qurl.h \ + /usr/include/qt5/QtCore/qurlquery.h \ + /usr/include/qt5/QtCore/qabstractitemmodel.h \ + /usr/include/qt5/QtCore/qabstractproxymodel.h \ + /usr/include/qt5/QtCore/qidentityproxymodel.h \ + /usr/include/qt5/QtCore/qitemselectionmodel.h \ + /usr/include/qt5/QtCore/qsortfilterproxymodel.h \ + /usr/include/qt5/QtCore/qstringlistmodel.h \ + /usr/include/qt5/QtCore/qjsonarray.h \ + /usr/include/qt5/QtCore/qjsonvalue.h \ + /usr/include/qt5/QtCore/qjsondocument.h \ + /usr/include/qt5/QtCore/qjsonobject.h \ + /usr/include/qt5/QtCore/qabstracteventdispatcher.h \ + /usr/include/qt5/QtCore/qeventloop.h \ + /usr/include/qt5/QtCore/qabstractnativeeventfilter.h \ + /usr/include/qt5/QtCore/qbasictimer.h \ + /usr/include/qt5/QtCore/qcoreapplication.h \ + /usr/include/qt5/QtCore/qmath.h \ + /usr/include/qt5/QtCore/qmetaobject.h \ + /usr/include/qt5/QtCore/qmimedata.h \ + /usr/include/qt5/QtCore/qobjectcleanuphandler.h \ + /usr/include/qt5/QtCore/qpointer.h \ + /usr/include/qt5/QtCore/qsharedmemory.h \ + /usr/include/qt5/QtCore/qsignalmapper.h \ + /usr/include/qt5/QtCore/qsocketnotifier.h \ + /usr/include/qt5/QtCore/qsystemsemaphore.h \ + /usr/include/qt5/QtCore/qtimer.h \ + /usr/include/qt5/QtCore/qtranslator.h \ + /usr/include/qt5/QtCore/qwineventnotifier.h \ + /usr/include/qt5/QtCore/qmimedatabase.h \ + /usr/include/qt5/QtCore/qmimetype.h \ + /usr/include/qt5/QtCore/qfactoryinterface.h \ + /usr/include/qt5/QtCore/qlibrary.h \ + /usr/include/qt5/QtCore/qplugin.h \ + /usr/include/qt5/QtCore/qpluginloader.h \ + /usr/include/qt5/QtCore/quuid.h \ + /usr/include/qt5/QtCore/qabstractstate.h \ + /usr/include/qt5/QtCore/qabstracttransition.h \ + /usr/include/qt5/QtCore/qeventtransition.h \ + /usr/include/qt5/QtCore/qfinalstate.h \ + /usr/include/qt5/QtCore/qhistorystate.h \ + /usr/include/qt5/QtCore/qsignaltransition.h \ + /usr/include/qt5/QtCore/qstate.h \ + /usr/include/qt5/QtCore/qstatemachine.h \ + /usr/include/qt5/QtCore/qexception.h \ + /usr/include/qt5/QtCore/qfuture.h \ + /usr/include/qt5/QtCore/qfutureinterface.h \ + /usr/include/qt5/QtCore/qrunnable.h \ + /usr/include/qt5/QtCore/qresultstore.h \ + /usr/include/qt5/QtCore/qfuturesynchronizer.h \ + /usr/include/qt5/QtCore/qfuturewatcher.h \ + /usr/include/qt5/QtCore/qreadwritelock.h \ + /usr/include/qt5/QtCore/qsemaphore.h \ + /usr/include/qt5/QtCore/qthread.h \ + /usr/include/qt5/QtCore/qthreadpool.h \ + /usr/include/qt5/QtCore/qthreadstorage.h \ + /usr/include/qt5/QtCore/qwaitcondition.h \ + /usr/include/qt5/QtCore/qarraydataops.h \ + /usr/include/qt5/QtCore/qarraydatapointer.h \ + /usr/include/qt5/QtCore/qbitarray.h \ + /usr/include/qt5/QtCore/qbytearraymatcher.h \ + /usr/include/qt5/QtCore/qcache.h \ + /usr/include/qt5/QtCore/qcollator.h \ + /usr/include/qt5/QtCore/qcommandlineoption.h \ + /usr/include/qt5/QtCore/qcommandlineparser.h \ + /usr/include/qt5/QtCore/qcryptographichash.h \ + /usr/include/qt5/QtCore/qelapsedtimer.h \ + /usr/include/qt5/QtCore/qline.h \ + /usr/include/qt5/QtCore/qlinkedlist.h \ + /usr/include/qt5/QtCore/qmargins.h \ + /usr/include/qt5/QtCore/qrect.h \ + /usr/include/qt5/QtCore/qmessageauthenticationcode.h \ + /usr/include/qt5/QtCore/qqueue.h \ + /usr/include/qt5/QtCore/qregularexpression.h \ + /usr/include/qt5/QtCore/qscopedvaluerollback.h \ + /usr/include/qt5/QtCore/qstack.h \ + /usr/include/qt5/QtCore/qtextboundaryfinder.h \ + /usr/include/qt5/QtCore/qtimeline.h \ + /usr/include/qt5/QtCore/qtimezone.h \ + /usr/include/qt5/QtCore/qxmlstream.h \ + /usr/include/qt5/QtCore/qtcoreversion.h \ + /usr/include/qt5/QtCore/QByteArray \ + /usr/include/qt5/QtCore/QIODevice + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o .obj/Pty.o src/Pty.cpp + +.obj/kptyprocess.o: src/kptyprocess.cpp src/kptyprocess.h \ + src/kprocess.h \ + /usr/include/qt5/QtCore/QProcess \ + /usr/include/qt5/QtCore/qprocess.h \ + /usr/include/qt5/QtCore/qiodevice.h \ + /usr/include/qt5/QtCore/qglobal.h \ + /usr/include/qt5/QtCore/qconfig.h \ + /usr/include/qt5/QtCore/qfeatures.h \ + /usr/include/qt5/QtCore/qsystemdetection.h \ + /usr/include/qt5/QtCore/qprocessordetection.h \ + /usr/include/qt5/QtCore/qcompilerdetection.h \ + /usr/include/qt5/QtCore/qglobalstatic.h \ + /usr/include/qt5/QtCore/qatomic.h \ + /usr/include/qt5/QtCore/qbasicatomic.h \ + /usr/include/qt5/QtCore/qatomic_bootstrap.h \ + /usr/include/qt5/QtCore/qgenericatomic.h \ + /usr/include/qt5/QtCore/qatomic_msvc.h \ + /usr/include/qt5/QtCore/qatomic_integrity.h \ + /usr/include/qt5/QtCore/qoldbasicatomic.h \ + /usr/include/qt5/QtCore/qatomic_vxworks.h \ + /usr/include/qt5/QtCore/qatomic_power.h \ + /usr/include/qt5/QtCore/qatomic_alpha.h \ + /usr/include/qt5/QtCore/qatomic_armv7.h \ + /usr/include/qt5/QtCore/qatomic_armv6.h \ + /usr/include/qt5/QtCore/qatomic_armv5.h \ + /usr/include/qt5/QtCore/qatomic_bfin.h \ + /usr/include/qt5/QtCore/qatomic_ia64.h \ + /usr/include/qt5/QtCore/qatomic_mips.h \ + /usr/include/qt5/QtCore/qatomic_s390.h \ + /usr/include/qt5/QtCore/qatomic_sh4a.h \ + /usr/include/qt5/QtCore/qatomic_sparc.h \ + /usr/include/qt5/QtCore/qatomic_gcc.h \ + /usr/include/qt5/QtCore/qatomic_x86.h \ + /usr/include/qt5/QtCore/qatomic_cxx11.h \ + /usr/include/qt5/QtCore/qatomic_unix.h \ + /usr/include/qt5/QtCore/qmutex.h \ + /usr/include/qt5/QtCore/qlogging.h \ + /usr/include/qt5/QtCore/qflags.h \ + /usr/include/qt5/QtCore/qtypeinfo.h \ + /usr/include/qt5/QtCore/qtypetraits.h \ + /usr/include/qt5/QtCore/qsysinfo.h \ + /usr/include/qt5/QtCore/qobject.h \ + /usr/include/qt5/QtCore/qobjectdefs.h \ + /usr/include/qt5/QtCore/qnamespace.h \ + /usr/include/qt5/QtCore/qobjectdefs_impl.h \ + /usr/include/qt5/QtCore/qstring.h \ + /usr/include/qt5/QtCore/qchar.h \ + /usr/include/qt5/QtCore/qbytearray.h \ + /usr/include/qt5/QtCore/qrefcount.h \ + /usr/include/qt5/QtCore/qarraydata.h \ + /usr/include/qt5/QtCore/qstringbuilder.h \ + /usr/include/qt5/QtCore/qlist.h \ + /usr/include/qt5/QtCore/qalgorithms.h \ + /usr/include/qt5/QtCore/qiterator.h \ + /usr/include/qt5/QtCore/qcoreevent.h \ + /usr/include/qt5/QtCore/qscopedpointer.h \ + /usr/include/qt5/QtCore/qmetatype.h \ + /usr/include/qt5/QtCore/qvarlengtharray.h \ + /usr/include/qt5/QtCore/qcontainerfwd.h \ + /usr/include/qt5/QtCore/qisenum.h \ + /usr/include/qt5/QtCore/qobject_impl.h \ + /usr/include/qt5/QtCore/qstringlist.h \ + /usr/include/qt5/QtCore/qdatastream.h \ + /usr/include/qt5/QtCore/qpair.h \ + /usr/include/qt5/QtCore/qregexp.h \ + /usr/include/qt5/QtCore/qstringmatcher.h \ + /usr/include/qt5/QtCore/qshareddata.h \ + src/kptydevice.h \ + src/kpty_p.h \ + src/kpty.h \ + /usr/include/qt5/QtCore/QtCore \ + /usr/include/qt5/QtCore/QtCoreDepends \ + /usr/include/qt5/QtCore/qabstractanimation.h \ + /usr/include/qt5/QtCore/qanimationgroup.h \ + /usr/include/qt5/QtCore/qparallelanimationgroup.h \ + /usr/include/qt5/QtCore/qpauseanimation.h \ + /usr/include/qt5/QtCore/qpropertyanimation.h \ + /usr/include/qt5/QtCore/qvariantanimation.h \ + /usr/include/qt5/QtCore/qeasingcurve.h \ + /usr/include/qt5/QtCore/qvector.h \ + /usr/include/qt5/QtCore/qpoint.h \ + /usr/include/qt5/QtCore/qvariant.h \ + /usr/include/qt5/QtCore/qmap.h \ + /usr/include/qt5/QtCore/qdebug.h \ + /usr/include/qt5/QtCore/qhash.h \ + /usr/include/qt5/QtCore/qtextstream.h \ + /usr/include/qt5/QtCore/qlocale.h \ + /usr/include/qt5/QtCore/qset.h \ + /usr/include/qt5/QtCore/qcontiguouscache.h \ + /usr/include/qt5/QtCore/qsequentialanimationgroup.h \ + /usr/include/qt5/QtCore/qtextcodec.h \ + /usr/include/qt5/QtCore/qendian.h \ + /usr/include/qt5/QtCore/qlibraryinfo.h \ + /usr/include/qt5/QtCore/qdatetime.h \ + /usr/include/qt5/QtCore/qsharedpointer.h \ + /usr/include/qt5/QtCore/qsharedpointer_impl.h \ + /usr/include/qt5/QtCore/qnumeric.h \ + /usr/include/qt5/QtCore/qbuffer.h \ + /usr/include/qt5/QtCore/qdir.h \ + /usr/include/qt5/QtCore/qfileinfo.h \ + /usr/include/qt5/QtCore/qfile.h \ + /usr/include/qt5/QtCore/qfiledevice.h \ + /usr/include/qt5/QtCore/qdiriterator.h \ + /usr/include/qt5/QtCore/qfileselector.h \ + /usr/include/qt5/QtCore/QObject \ + /usr/include/qt5/QtCore/QStringList \ + /usr/include/qt5/QtCore/qfilesystemwatcher.h \ + /usr/include/qt5/QtCore/qlockfile.h \ + /usr/include/qt5/QtCore/qloggingcategory.h \ + /usr/include/qt5/QtCore/qresource.h \ + /usr/include/qt5/QtCore/qsavefile.h \ + /usr/include/qt5/QtCore/qsettings.h \ + /usr/include/qt5/QtCore/qstandardpaths.h \ + /usr/include/qt5/QtCore/qtemporarydir.h \ + /usr/include/qt5/QtCore/QScopedPointer \ + /usr/include/qt5/QtCore/qtemporaryfile.h \ + /usr/include/qt5/QtCore/qurl.h \ + /usr/include/qt5/QtCore/qurlquery.h \ + /usr/include/qt5/QtCore/qabstractitemmodel.h \ + /usr/include/qt5/QtCore/qabstractproxymodel.h \ + /usr/include/qt5/QtCore/qidentityproxymodel.h \ + /usr/include/qt5/QtCore/qitemselectionmodel.h \ + /usr/include/qt5/QtCore/qsortfilterproxymodel.h \ + /usr/include/qt5/QtCore/qstringlistmodel.h \ + /usr/include/qt5/QtCore/qjsonarray.h \ + /usr/include/qt5/QtCore/qjsonvalue.h \ + /usr/include/qt5/QtCore/qjsondocument.h \ + /usr/include/qt5/QtCore/qjsonobject.h \ + /usr/include/qt5/QtCore/qabstracteventdispatcher.h \ + /usr/include/qt5/QtCore/qeventloop.h \ + /usr/include/qt5/QtCore/qabstractnativeeventfilter.h \ + /usr/include/qt5/QtCore/qbasictimer.h \ + /usr/include/qt5/QtCore/qcoreapplication.h \ + /usr/include/qt5/QtCore/qmath.h \ + /usr/include/qt5/QtCore/qmetaobject.h \ + /usr/include/qt5/QtCore/qmimedata.h \ + /usr/include/qt5/QtCore/qobjectcleanuphandler.h \ + /usr/include/qt5/QtCore/qpointer.h \ + /usr/include/qt5/QtCore/qsharedmemory.h \ + /usr/include/qt5/QtCore/qsignalmapper.h \ + /usr/include/qt5/QtCore/qsocketnotifier.h \ + /usr/include/qt5/QtCore/qsystemsemaphore.h \ + /usr/include/qt5/QtCore/qtimer.h \ + /usr/include/qt5/QtCore/qtranslator.h \ + /usr/include/qt5/QtCore/qwineventnotifier.h \ + /usr/include/qt5/QtCore/qmimedatabase.h \ + /usr/include/qt5/QtCore/qmimetype.h \ + /usr/include/qt5/QtCore/qfactoryinterface.h \ + /usr/include/qt5/QtCore/qlibrary.h \ + /usr/include/qt5/QtCore/qplugin.h \ + /usr/include/qt5/QtCore/qpluginloader.h \ + /usr/include/qt5/QtCore/quuid.h \ + /usr/include/qt5/QtCore/qabstractstate.h \ + /usr/include/qt5/QtCore/qabstracttransition.h \ + /usr/include/qt5/QtCore/qeventtransition.h \ + /usr/include/qt5/QtCore/qfinalstate.h \ + /usr/include/qt5/QtCore/qhistorystate.h \ + /usr/include/qt5/QtCore/qsignaltransition.h \ + /usr/include/qt5/QtCore/qstate.h \ + /usr/include/qt5/QtCore/qstatemachine.h \ + /usr/include/qt5/QtCore/qexception.h \ + /usr/include/qt5/QtCore/qfuture.h \ + /usr/include/qt5/QtCore/qfutureinterface.h \ + /usr/include/qt5/QtCore/qrunnable.h \ + /usr/include/qt5/QtCore/qresultstore.h \ + /usr/include/qt5/QtCore/qfuturesynchronizer.h \ + /usr/include/qt5/QtCore/qfuturewatcher.h \ + /usr/include/qt5/QtCore/qreadwritelock.h \ + /usr/include/qt5/QtCore/qsemaphore.h \ + /usr/include/qt5/QtCore/qthread.h \ + /usr/include/qt5/QtCore/qthreadpool.h \ + /usr/include/qt5/QtCore/qthreadstorage.h \ + /usr/include/qt5/QtCore/qwaitcondition.h \ + /usr/include/qt5/QtCore/qarraydataops.h \ + /usr/include/qt5/QtCore/qarraydatapointer.h \ + /usr/include/qt5/QtCore/qbitarray.h \ + /usr/include/qt5/QtCore/qbytearraymatcher.h \ + /usr/include/qt5/QtCore/qcache.h \ + /usr/include/qt5/QtCore/qcollator.h \ + /usr/include/qt5/QtCore/qcommandlineoption.h \ + /usr/include/qt5/QtCore/qcommandlineparser.h \ + /usr/include/qt5/QtCore/qcryptographichash.h \ + /usr/include/qt5/QtCore/qelapsedtimer.h \ + /usr/include/qt5/QtCore/qline.h \ + /usr/include/qt5/QtCore/qlinkedlist.h \ + /usr/include/qt5/QtCore/qmargins.h \ + /usr/include/qt5/QtCore/qrect.h \ + /usr/include/qt5/QtCore/qsize.h \ + /usr/include/qt5/QtCore/qmessageauthenticationcode.h \ + /usr/include/qt5/QtCore/qqueue.h \ + /usr/include/qt5/QtCore/qregularexpression.h \ + /usr/include/qt5/QtCore/qscopedvaluerollback.h \ + /usr/include/qt5/QtCore/qstack.h \ + /usr/include/qt5/QtCore/qtextboundaryfinder.h \ + /usr/include/qt5/QtCore/qtimeline.h \ + /usr/include/qt5/QtCore/qtimezone.h \ + /usr/include/qt5/QtCore/qxmlstream.h \ + /usr/include/qt5/QtCore/qtcoreversion.h \ + /usr/include/qt5/QtCore/QByteArray \ + /usr/include/qt5/QtCore/QIODevice + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o .obj/kptyprocess.o src/kptyprocess.cpp + +.obj/kptydevice.o: src/kptydevice.cpp src/kptydevice.h \ + src/kpty_p.h \ + src/kpty.h \ + /usr/include/qt5/QtCore/QtCore \ + /usr/include/qt5/QtCore/QtCoreDepends \ + /usr/include/qt5/QtCore/qabstractanimation.h \ + /usr/include/qt5/QtCore/qobject.h \ + /usr/include/qt5/QtCore/qobjectdefs.h \ + /usr/include/qt5/QtCore/qnamespace.h \ + /usr/include/qt5/QtCore/qglobal.h \ + /usr/include/qt5/QtCore/qconfig.h \ + /usr/include/qt5/QtCore/qfeatures.h \ + /usr/include/qt5/QtCore/qsystemdetection.h \ + /usr/include/qt5/QtCore/qprocessordetection.h \ + /usr/include/qt5/QtCore/qcompilerdetection.h \ + /usr/include/qt5/QtCore/qglobalstatic.h \ + /usr/include/qt5/QtCore/qatomic.h \ + /usr/include/qt5/QtCore/qbasicatomic.h \ + /usr/include/qt5/QtCore/qatomic_bootstrap.h \ + /usr/include/qt5/QtCore/qgenericatomic.h \ + /usr/include/qt5/QtCore/qatomic_msvc.h \ + /usr/include/qt5/QtCore/qatomic_integrity.h \ + /usr/include/qt5/QtCore/qoldbasicatomic.h \ + /usr/include/qt5/QtCore/qatomic_vxworks.h \ + /usr/include/qt5/QtCore/qatomic_power.h \ + /usr/include/qt5/QtCore/qatomic_alpha.h \ + /usr/include/qt5/QtCore/qatomic_armv7.h \ + /usr/include/qt5/QtCore/qatomic_armv6.h \ + /usr/include/qt5/QtCore/qatomic_armv5.h \ + /usr/include/qt5/QtCore/qatomic_bfin.h \ + /usr/include/qt5/QtCore/qatomic_ia64.h \ + /usr/include/qt5/QtCore/qatomic_mips.h \ + /usr/include/qt5/QtCore/qatomic_s390.h \ + /usr/include/qt5/QtCore/qatomic_sh4a.h \ + /usr/include/qt5/QtCore/qatomic_sparc.h \ + /usr/include/qt5/QtCore/qatomic_gcc.h \ + /usr/include/qt5/QtCore/qatomic_x86.h \ + /usr/include/qt5/QtCore/qatomic_cxx11.h \ + /usr/include/qt5/QtCore/qatomic_unix.h \ + /usr/include/qt5/QtCore/qmutex.h \ + /usr/include/qt5/QtCore/qlogging.h \ + /usr/include/qt5/QtCore/qflags.h \ + /usr/include/qt5/QtCore/qtypeinfo.h \ + /usr/include/qt5/QtCore/qtypetraits.h \ + /usr/include/qt5/QtCore/qsysinfo.h \ + /usr/include/qt5/QtCore/qobjectdefs_impl.h \ + /usr/include/qt5/QtCore/qstring.h \ + /usr/include/qt5/QtCore/qchar.h \ + /usr/include/qt5/QtCore/qbytearray.h \ + /usr/include/qt5/QtCore/qrefcount.h \ + /usr/include/qt5/QtCore/qarraydata.h \ + /usr/include/qt5/QtCore/qstringbuilder.h \ + /usr/include/qt5/QtCore/qlist.h \ + /usr/include/qt5/QtCore/qalgorithms.h \ + /usr/include/qt5/QtCore/qiterator.h \ + /usr/include/qt5/QtCore/qcoreevent.h \ + /usr/include/qt5/QtCore/qscopedpointer.h \ + /usr/include/qt5/QtCore/qmetatype.h \ + /usr/include/qt5/QtCore/qvarlengtharray.h \ + /usr/include/qt5/QtCore/qcontainerfwd.h \ + /usr/include/qt5/QtCore/qisenum.h \ + /usr/include/qt5/QtCore/qobject_impl.h \ + /usr/include/qt5/QtCore/qanimationgroup.h \ + /usr/include/qt5/QtCore/qparallelanimationgroup.h \ + /usr/include/qt5/QtCore/qpauseanimation.h \ + /usr/include/qt5/QtCore/qpropertyanimation.h \ + /usr/include/qt5/QtCore/qvariantanimation.h \ + /usr/include/qt5/QtCore/qeasingcurve.h \ + /usr/include/qt5/QtCore/qvector.h \ + /usr/include/qt5/QtCore/qpoint.h \ + /usr/include/qt5/QtCore/qvariant.h \ + /usr/include/qt5/QtCore/qmap.h \ + /usr/include/qt5/QtCore/qpair.h \ + /usr/include/qt5/QtCore/qdebug.h \ + /usr/include/qt5/QtCore/qhash.h \ + /usr/include/qt5/QtCore/qtextstream.h \ + /usr/include/qt5/QtCore/qiodevice.h \ + /usr/include/qt5/QtCore/qlocale.h \ + /usr/include/qt5/QtCore/qshareddata.h \ + /usr/include/qt5/QtCore/qset.h \ + /usr/include/qt5/QtCore/qcontiguouscache.h \ + /usr/include/qt5/QtCore/qstringlist.h \ + /usr/include/qt5/QtCore/qdatastream.h \ + /usr/include/qt5/QtCore/qregexp.h \ + /usr/include/qt5/QtCore/qstringmatcher.h \ + /usr/include/qt5/QtCore/qsequentialanimationgroup.h \ + /usr/include/qt5/QtCore/qtextcodec.h \ + /usr/include/qt5/QtCore/qendian.h \ + /usr/include/qt5/QtCore/qlibraryinfo.h \ + /usr/include/qt5/QtCore/qdatetime.h \ + /usr/include/qt5/QtCore/qsharedpointer.h \ + /usr/include/qt5/QtCore/qsharedpointer_impl.h \ + /usr/include/qt5/QtCore/qnumeric.h \ + /usr/include/qt5/QtCore/qbuffer.h \ + /usr/include/qt5/QtCore/qdir.h \ + /usr/include/qt5/QtCore/qfileinfo.h \ + /usr/include/qt5/QtCore/qfile.h \ + /usr/include/qt5/QtCore/qfiledevice.h \ + /usr/include/qt5/QtCore/qdiriterator.h \ + /usr/include/qt5/QtCore/qfileselector.h \ + /usr/include/qt5/QtCore/QObject \ + /usr/include/qt5/QtCore/QStringList \ + /usr/include/qt5/QtCore/qfilesystemwatcher.h \ + /usr/include/qt5/QtCore/qlockfile.h \ + /usr/include/qt5/QtCore/qloggingcategory.h \ + /usr/include/qt5/QtCore/qprocess.h \ + /usr/include/qt5/QtCore/qresource.h \ + /usr/include/qt5/QtCore/qsavefile.h \ + /usr/include/qt5/QtCore/qsettings.h \ + /usr/include/qt5/QtCore/qstandardpaths.h \ + /usr/include/qt5/QtCore/qtemporarydir.h \ + /usr/include/qt5/QtCore/QScopedPointer \ + /usr/include/qt5/QtCore/qtemporaryfile.h \ + /usr/include/qt5/QtCore/qurl.h \ + /usr/include/qt5/QtCore/qurlquery.h \ + /usr/include/qt5/QtCore/qabstractitemmodel.h \ + /usr/include/qt5/QtCore/qabstractproxymodel.h \ + /usr/include/qt5/QtCore/qidentityproxymodel.h \ + /usr/include/qt5/QtCore/qitemselectionmodel.h \ + /usr/include/qt5/QtCore/qsortfilterproxymodel.h \ + /usr/include/qt5/QtCore/qstringlistmodel.h \ + /usr/include/qt5/QtCore/qjsonarray.h \ + /usr/include/qt5/QtCore/qjsonvalue.h \ + /usr/include/qt5/QtCore/qjsondocument.h \ + /usr/include/qt5/QtCore/qjsonobject.h \ + /usr/include/qt5/QtCore/qabstracteventdispatcher.h \ + /usr/include/qt5/QtCore/qeventloop.h \ + /usr/include/qt5/QtCore/qabstractnativeeventfilter.h \ + /usr/include/qt5/QtCore/qbasictimer.h \ + /usr/include/qt5/QtCore/qcoreapplication.h \ + /usr/include/qt5/QtCore/qmath.h \ + /usr/include/qt5/QtCore/qmetaobject.h \ + /usr/include/qt5/QtCore/qmimedata.h \ + /usr/include/qt5/QtCore/qobjectcleanuphandler.h \ + /usr/include/qt5/QtCore/qpointer.h \ + /usr/include/qt5/QtCore/qsharedmemory.h \ + /usr/include/qt5/QtCore/qsignalmapper.h \ + /usr/include/qt5/QtCore/qsocketnotifier.h \ + /usr/include/qt5/QtCore/qsystemsemaphore.h \ + /usr/include/qt5/QtCore/qtimer.h \ + /usr/include/qt5/QtCore/qtranslator.h \ + /usr/include/qt5/QtCore/qwineventnotifier.h \ + /usr/include/qt5/QtCore/qmimedatabase.h \ + /usr/include/qt5/QtCore/qmimetype.h \ + /usr/include/qt5/QtCore/qfactoryinterface.h \ + /usr/include/qt5/QtCore/qlibrary.h \ + /usr/include/qt5/QtCore/qplugin.h \ + /usr/include/qt5/QtCore/qpluginloader.h \ + /usr/include/qt5/QtCore/quuid.h \ + /usr/include/qt5/QtCore/qabstractstate.h \ + /usr/include/qt5/QtCore/qabstracttransition.h \ + /usr/include/qt5/QtCore/qeventtransition.h \ + /usr/include/qt5/QtCore/qfinalstate.h \ + /usr/include/qt5/QtCore/qhistorystate.h \ + /usr/include/qt5/QtCore/qsignaltransition.h \ + /usr/include/qt5/QtCore/qstate.h \ + /usr/include/qt5/QtCore/qstatemachine.h \ + /usr/include/qt5/QtCore/qexception.h \ + /usr/include/qt5/QtCore/qfuture.h \ + /usr/include/qt5/QtCore/qfutureinterface.h \ + /usr/include/qt5/QtCore/qrunnable.h \ + /usr/include/qt5/QtCore/qresultstore.h \ + /usr/include/qt5/QtCore/qfuturesynchronizer.h \ + /usr/include/qt5/QtCore/qfuturewatcher.h \ + /usr/include/qt5/QtCore/qreadwritelock.h \ + /usr/include/qt5/QtCore/qsemaphore.h \ + /usr/include/qt5/QtCore/qthread.h \ + /usr/include/qt5/QtCore/qthreadpool.h \ + /usr/include/qt5/QtCore/qthreadstorage.h \ + /usr/include/qt5/QtCore/qwaitcondition.h \ + /usr/include/qt5/QtCore/qarraydataops.h \ + /usr/include/qt5/QtCore/qarraydatapointer.h \ + /usr/include/qt5/QtCore/qbitarray.h \ + /usr/include/qt5/QtCore/qbytearraymatcher.h \ + /usr/include/qt5/QtCore/qcache.h \ + /usr/include/qt5/QtCore/qcollator.h \ + /usr/include/qt5/QtCore/qcommandlineoption.h \ + /usr/include/qt5/QtCore/qcommandlineparser.h \ + /usr/include/qt5/QtCore/qcryptographichash.h \ + /usr/include/qt5/QtCore/qelapsedtimer.h \ + /usr/include/qt5/QtCore/qline.h \ + /usr/include/qt5/QtCore/qlinkedlist.h \ + /usr/include/qt5/QtCore/qmargins.h \ + /usr/include/qt5/QtCore/qrect.h \ + /usr/include/qt5/QtCore/qsize.h \ + /usr/include/qt5/QtCore/qmessageauthenticationcode.h \ + /usr/include/qt5/QtCore/qqueue.h \ + /usr/include/qt5/QtCore/qregularexpression.h \ + /usr/include/qt5/QtCore/qscopedvaluerollback.h \ + /usr/include/qt5/QtCore/qstack.h \ + /usr/include/qt5/QtCore/qtextboundaryfinder.h \ + /usr/include/qt5/QtCore/qtimeline.h \ + /usr/include/qt5/QtCore/qtimezone.h \ + /usr/include/qt5/QtCore/qxmlstream.h \ + /usr/include/qt5/QtCore/qtcoreversion.h \ + /usr/include/qt5/QtCore/QByteArray \ + /usr/include/qt5/QtCore/QIODevice \ + /usr/include/qt5/QtCore/QSocketNotifier + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o .obj/kptydevice.o src/kptydevice.cpp + +.obj/kpty.o: src/kpty.cpp src/kpty_p.h \ + src/kpty.h \ + /usr/include/qt5/QtCore/QtCore \ + /usr/include/qt5/QtCore/QtCoreDepends \ + /usr/include/qt5/QtCore/qabstractanimation.h \ + /usr/include/qt5/QtCore/qobject.h \ + /usr/include/qt5/QtCore/qobjectdefs.h \ + /usr/include/qt5/QtCore/qnamespace.h \ + /usr/include/qt5/QtCore/qglobal.h \ + /usr/include/qt5/QtCore/qconfig.h \ + /usr/include/qt5/QtCore/qfeatures.h \ + /usr/include/qt5/QtCore/qsystemdetection.h \ + /usr/include/qt5/QtCore/qprocessordetection.h \ + /usr/include/qt5/QtCore/qcompilerdetection.h \ + /usr/include/qt5/QtCore/qglobalstatic.h \ + /usr/include/qt5/QtCore/qatomic.h \ + /usr/include/qt5/QtCore/qbasicatomic.h \ + /usr/include/qt5/QtCore/qatomic_bootstrap.h \ + /usr/include/qt5/QtCore/qgenericatomic.h \ + /usr/include/qt5/QtCore/qatomic_msvc.h \ + /usr/include/qt5/QtCore/qatomic_integrity.h \ + /usr/include/qt5/QtCore/qoldbasicatomic.h \ + /usr/include/qt5/QtCore/qatomic_vxworks.h \ + /usr/include/qt5/QtCore/qatomic_power.h \ + /usr/include/qt5/QtCore/qatomic_alpha.h \ + /usr/include/qt5/QtCore/qatomic_armv7.h \ + /usr/include/qt5/QtCore/qatomic_armv6.h \ + /usr/include/qt5/QtCore/qatomic_armv5.h \ + /usr/include/qt5/QtCore/qatomic_bfin.h \ + /usr/include/qt5/QtCore/qatomic_ia64.h \ + /usr/include/qt5/QtCore/qatomic_mips.h \ + /usr/include/qt5/QtCore/qatomic_s390.h \ + /usr/include/qt5/QtCore/qatomic_sh4a.h \ + /usr/include/qt5/QtCore/qatomic_sparc.h \ + /usr/include/qt5/QtCore/qatomic_gcc.h \ + /usr/include/qt5/QtCore/qatomic_x86.h \ + /usr/include/qt5/QtCore/qatomic_cxx11.h \ + /usr/include/qt5/QtCore/qatomic_unix.h \ + /usr/include/qt5/QtCore/qmutex.h \ + /usr/include/qt5/QtCore/qlogging.h \ + /usr/include/qt5/QtCore/qflags.h \ + /usr/include/qt5/QtCore/qtypeinfo.h \ + /usr/include/qt5/QtCore/qtypetraits.h \ + /usr/include/qt5/QtCore/qsysinfo.h \ + /usr/include/qt5/QtCore/qobjectdefs_impl.h \ + /usr/include/qt5/QtCore/qstring.h \ + /usr/include/qt5/QtCore/qchar.h \ + /usr/include/qt5/QtCore/qbytearray.h \ + /usr/include/qt5/QtCore/qrefcount.h \ + /usr/include/qt5/QtCore/qarraydata.h \ + /usr/include/qt5/QtCore/qstringbuilder.h \ + /usr/include/qt5/QtCore/qlist.h \ + /usr/include/qt5/QtCore/qalgorithms.h \ + /usr/include/qt5/QtCore/qiterator.h \ + /usr/include/qt5/QtCore/qcoreevent.h \ + /usr/include/qt5/QtCore/qscopedpointer.h \ + /usr/include/qt5/QtCore/qmetatype.h \ + /usr/include/qt5/QtCore/qvarlengtharray.h \ + /usr/include/qt5/QtCore/qcontainerfwd.h \ + /usr/include/qt5/QtCore/qisenum.h \ + /usr/include/qt5/QtCore/qobject_impl.h \ + /usr/include/qt5/QtCore/qanimationgroup.h \ + /usr/include/qt5/QtCore/qparallelanimationgroup.h \ + /usr/include/qt5/QtCore/qpauseanimation.h \ + /usr/include/qt5/QtCore/qpropertyanimation.h \ + /usr/include/qt5/QtCore/qvariantanimation.h \ + /usr/include/qt5/QtCore/qeasingcurve.h \ + /usr/include/qt5/QtCore/qvector.h \ + /usr/include/qt5/QtCore/qpoint.h \ + /usr/include/qt5/QtCore/qvariant.h \ + /usr/include/qt5/QtCore/qmap.h \ + /usr/include/qt5/QtCore/qpair.h \ + /usr/include/qt5/QtCore/qdebug.h \ + /usr/include/qt5/QtCore/qhash.h \ + /usr/include/qt5/QtCore/qtextstream.h \ + /usr/include/qt5/QtCore/qiodevice.h \ + /usr/include/qt5/QtCore/qlocale.h \ + /usr/include/qt5/QtCore/qshareddata.h \ + /usr/include/qt5/QtCore/qset.h \ + /usr/include/qt5/QtCore/qcontiguouscache.h \ + /usr/include/qt5/QtCore/qstringlist.h \ + /usr/include/qt5/QtCore/qdatastream.h \ + /usr/include/qt5/QtCore/qregexp.h \ + /usr/include/qt5/QtCore/qstringmatcher.h \ + /usr/include/qt5/QtCore/qsequentialanimationgroup.h \ + /usr/include/qt5/QtCore/qtextcodec.h \ + /usr/include/qt5/QtCore/qendian.h \ + /usr/include/qt5/QtCore/qlibraryinfo.h \ + /usr/include/qt5/QtCore/qdatetime.h \ + /usr/include/qt5/QtCore/qsharedpointer.h \ + /usr/include/qt5/QtCore/qsharedpointer_impl.h \ + /usr/include/qt5/QtCore/qnumeric.h \ + /usr/include/qt5/QtCore/qbuffer.h \ + /usr/include/qt5/QtCore/qdir.h \ + /usr/include/qt5/QtCore/qfileinfo.h \ + /usr/include/qt5/QtCore/qfile.h \ + /usr/include/qt5/QtCore/qfiledevice.h \ + /usr/include/qt5/QtCore/qdiriterator.h \ + /usr/include/qt5/QtCore/qfileselector.h \ + /usr/include/qt5/QtCore/QObject \ + /usr/include/qt5/QtCore/QStringList \ + /usr/include/qt5/QtCore/qfilesystemwatcher.h \ + /usr/include/qt5/QtCore/qlockfile.h \ + /usr/include/qt5/QtCore/qloggingcategory.h \ + /usr/include/qt5/QtCore/qprocess.h \ + /usr/include/qt5/QtCore/qresource.h \ + /usr/include/qt5/QtCore/qsavefile.h \ + /usr/include/qt5/QtCore/qsettings.h \ + /usr/include/qt5/QtCore/qstandardpaths.h \ + /usr/include/qt5/QtCore/qtemporarydir.h \ + /usr/include/qt5/QtCore/QScopedPointer \ + /usr/include/qt5/QtCore/qtemporaryfile.h \ + /usr/include/qt5/QtCore/qurl.h \ + /usr/include/qt5/QtCore/qurlquery.h \ + /usr/include/qt5/QtCore/qabstractitemmodel.h \ + /usr/include/qt5/QtCore/qabstractproxymodel.h \ + /usr/include/qt5/QtCore/qidentityproxymodel.h \ + /usr/include/qt5/QtCore/qitemselectionmodel.h \ + /usr/include/qt5/QtCore/qsortfilterproxymodel.h \ + /usr/include/qt5/QtCore/qstringlistmodel.h \ + /usr/include/qt5/QtCore/qjsonarray.h \ + /usr/include/qt5/QtCore/qjsonvalue.h \ + /usr/include/qt5/QtCore/qjsondocument.h \ + /usr/include/qt5/QtCore/qjsonobject.h \ + /usr/include/qt5/QtCore/qabstracteventdispatcher.h \ + /usr/include/qt5/QtCore/qeventloop.h \ + /usr/include/qt5/QtCore/qabstractnativeeventfilter.h \ + /usr/include/qt5/QtCore/qbasictimer.h \ + /usr/include/qt5/QtCore/qcoreapplication.h \ + /usr/include/qt5/QtCore/qmath.h \ + /usr/include/qt5/QtCore/qmetaobject.h \ + /usr/include/qt5/QtCore/qmimedata.h \ + /usr/include/qt5/QtCore/qobjectcleanuphandler.h \ + /usr/include/qt5/QtCore/qpointer.h \ + /usr/include/qt5/QtCore/qsharedmemory.h \ + /usr/include/qt5/QtCore/qsignalmapper.h \ + /usr/include/qt5/QtCore/qsocketnotifier.h \ + /usr/include/qt5/QtCore/qsystemsemaphore.h \ + /usr/include/qt5/QtCore/qtimer.h \ + /usr/include/qt5/QtCore/qtranslator.h \ + /usr/include/qt5/QtCore/qwineventnotifier.h \ + /usr/include/qt5/QtCore/qmimedatabase.h \ + /usr/include/qt5/QtCore/qmimetype.h \ + /usr/include/qt5/QtCore/qfactoryinterface.h \ + /usr/include/qt5/QtCore/qlibrary.h \ + /usr/include/qt5/QtCore/qplugin.h \ + /usr/include/qt5/QtCore/qpluginloader.h \ + /usr/include/qt5/QtCore/quuid.h \ + /usr/include/qt5/QtCore/qabstractstate.h \ + /usr/include/qt5/QtCore/qabstracttransition.h \ + /usr/include/qt5/QtCore/qeventtransition.h \ + /usr/include/qt5/QtCore/qfinalstate.h \ + /usr/include/qt5/QtCore/qhistorystate.h \ + /usr/include/qt5/QtCore/qsignaltransition.h \ + /usr/include/qt5/QtCore/qstate.h \ + /usr/include/qt5/QtCore/qstatemachine.h \ + /usr/include/qt5/QtCore/qexception.h \ + /usr/include/qt5/QtCore/qfuture.h \ + /usr/include/qt5/QtCore/qfutureinterface.h \ + /usr/include/qt5/QtCore/qrunnable.h \ + /usr/include/qt5/QtCore/qresultstore.h \ + /usr/include/qt5/QtCore/qfuturesynchronizer.h \ + /usr/include/qt5/QtCore/qfuturewatcher.h \ + /usr/include/qt5/QtCore/qreadwritelock.h \ + /usr/include/qt5/QtCore/qsemaphore.h \ + /usr/include/qt5/QtCore/qthread.h \ + /usr/include/qt5/QtCore/qthreadpool.h \ + /usr/include/qt5/QtCore/qthreadstorage.h \ + /usr/include/qt5/QtCore/qwaitcondition.h \ + /usr/include/qt5/QtCore/qarraydataops.h \ + /usr/include/qt5/QtCore/qarraydatapointer.h \ + /usr/include/qt5/QtCore/qbitarray.h \ + /usr/include/qt5/QtCore/qbytearraymatcher.h \ + /usr/include/qt5/QtCore/qcache.h \ + /usr/include/qt5/QtCore/qcollator.h \ + /usr/include/qt5/QtCore/qcommandlineoption.h \ + /usr/include/qt5/QtCore/qcommandlineparser.h \ + /usr/include/qt5/QtCore/qcryptographichash.h \ + /usr/include/qt5/QtCore/qelapsedtimer.h \ + /usr/include/qt5/QtCore/qline.h \ + /usr/include/qt5/QtCore/qlinkedlist.h \ + /usr/include/qt5/QtCore/qmargins.h \ + /usr/include/qt5/QtCore/qrect.h \ + /usr/include/qt5/QtCore/qsize.h \ + /usr/include/qt5/QtCore/qmessageauthenticationcode.h \ + /usr/include/qt5/QtCore/qqueue.h \ + /usr/include/qt5/QtCore/qregularexpression.h \ + /usr/include/qt5/QtCore/qscopedvaluerollback.h \ + /usr/include/qt5/QtCore/qstack.h \ + /usr/include/qt5/QtCore/qtextboundaryfinder.h \ + /usr/include/qt5/QtCore/qtimeline.h \ + /usr/include/qt5/QtCore/qtimezone.h \ + /usr/include/qt5/QtCore/qxmlstream.h \ + /usr/include/qt5/QtCore/qtcoreversion.h \ + /usr/include/qt5/QtCore/QByteArray + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o .obj/kpty.o src/kpty.cpp + +.obj/kprocess.o: src/kprocess.cpp src/kprocess.h \ + /usr/include/qt5/QtCore/QProcess \ + /usr/include/qt5/QtCore/qprocess.h \ + /usr/include/qt5/QtCore/qiodevice.h \ + /usr/include/qt5/QtCore/qglobal.h \ + /usr/include/qt5/QtCore/qconfig.h \ + /usr/include/qt5/QtCore/qfeatures.h \ + /usr/include/qt5/QtCore/qsystemdetection.h \ + /usr/include/qt5/QtCore/qprocessordetection.h \ + /usr/include/qt5/QtCore/qcompilerdetection.h \ + /usr/include/qt5/QtCore/qglobalstatic.h \ + /usr/include/qt5/QtCore/qatomic.h \ + /usr/include/qt5/QtCore/qbasicatomic.h \ + /usr/include/qt5/QtCore/qatomic_bootstrap.h \ + /usr/include/qt5/QtCore/qgenericatomic.h \ + /usr/include/qt5/QtCore/qatomic_msvc.h \ + /usr/include/qt5/QtCore/qatomic_integrity.h \ + /usr/include/qt5/QtCore/qoldbasicatomic.h \ + /usr/include/qt5/QtCore/qatomic_vxworks.h \ + /usr/include/qt5/QtCore/qatomic_power.h \ + /usr/include/qt5/QtCore/qatomic_alpha.h \ + /usr/include/qt5/QtCore/qatomic_armv7.h \ + /usr/include/qt5/QtCore/qatomic_armv6.h \ + /usr/include/qt5/QtCore/qatomic_armv5.h \ + /usr/include/qt5/QtCore/qatomic_bfin.h \ + /usr/include/qt5/QtCore/qatomic_ia64.h \ + /usr/include/qt5/QtCore/qatomic_mips.h \ + /usr/include/qt5/QtCore/qatomic_s390.h \ + /usr/include/qt5/QtCore/qatomic_sh4a.h \ + /usr/include/qt5/QtCore/qatomic_sparc.h \ + /usr/include/qt5/QtCore/qatomic_gcc.h \ + /usr/include/qt5/QtCore/qatomic_x86.h \ + /usr/include/qt5/QtCore/qatomic_cxx11.h \ + /usr/include/qt5/QtCore/qatomic_unix.h \ + /usr/include/qt5/QtCore/qmutex.h \ + /usr/include/qt5/QtCore/qlogging.h \ + /usr/include/qt5/QtCore/qflags.h \ + /usr/include/qt5/QtCore/qtypeinfo.h \ + /usr/include/qt5/QtCore/qtypetraits.h \ + /usr/include/qt5/QtCore/qsysinfo.h \ + /usr/include/qt5/QtCore/qobject.h \ + /usr/include/qt5/QtCore/qobjectdefs.h \ + /usr/include/qt5/QtCore/qnamespace.h \ + /usr/include/qt5/QtCore/qobjectdefs_impl.h \ + /usr/include/qt5/QtCore/qstring.h \ + /usr/include/qt5/QtCore/qchar.h \ + /usr/include/qt5/QtCore/qbytearray.h \ + /usr/include/qt5/QtCore/qrefcount.h \ + /usr/include/qt5/QtCore/qarraydata.h \ + /usr/include/qt5/QtCore/qstringbuilder.h \ + /usr/include/qt5/QtCore/qlist.h \ + /usr/include/qt5/QtCore/qalgorithms.h \ + /usr/include/qt5/QtCore/qiterator.h \ + /usr/include/qt5/QtCore/qcoreevent.h \ + /usr/include/qt5/QtCore/qscopedpointer.h \ + /usr/include/qt5/QtCore/qmetatype.h \ + /usr/include/qt5/QtCore/qvarlengtharray.h \ + /usr/include/qt5/QtCore/qcontainerfwd.h \ + /usr/include/qt5/QtCore/qisenum.h \ + /usr/include/qt5/QtCore/qobject_impl.h \ + /usr/include/qt5/QtCore/qstringlist.h \ + /usr/include/qt5/QtCore/qdatastream.h \ + /usr/include/qt5/QtCore/qpair.h \ + /usr/include/qt5/QtCore/qregexp.h \ + /usr/include/qt5/QtCore/qstringmatcher.h \ + /usr/include/qt5/QtCore/qshareddata.h \ + /usr/include/qt5/QtCore/qfile.h \ + /usr/include/qt5/QtCore/qfiledevice.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o .obj/kprocess.o src/kprocess.cpp + +.obj/ShellCommand.o: src/ShellCommand.cpp src/ShellCommand.h \ + /usr/include/qt5/QtCore/QStringList \ + /usr/include/qt5/QtCore/qstringlist.h \ + /usr/include/qt5/QtCore/qalgorithms.h \ + /usr/include/qt5/QtCore/qglobal.h \ + /usr/include/qt5/QtCore/qconfig.h \ + /usr/include/qt5/QtCore/qfeatures.h \ + /usr/include/qt5/QtCore/qsystemdetection.h \ + /usr/include/qt5/QtCore/qprocessordetection.h \ + /usr/include/qt5/QtCore/qcompilerdetection.h \ + /usr/include/qt5/QtCore/qglobalstatic.h \ + /usr/include/qt5/QtCore/qatomic.h \ + /usr/include/qt5/QtCore/qbasicatomic.h \ + /usr/include/qt5/QtCore/qatomic_bootstrap.h \ + /usr/include/qt5/QtCore/qgenericatomic.h \ + /usr/include/qt5/QtCore/qatomic_msvc.h \ + /usr/include/qt5/QtCore/qatomic_integrity.h \ + /usr/include/qt5/QtCore/qoldbasicatomic.h \ + /usr/include/qt5/QtCore/qatomic_vxworks.h \ + /usr/include/qt5/QtCore/qatomic_power.h \ + /usr/include/qt5/QtCore/qatomic_alpha.h \ + /usr/include/qt5/QtCore/qatomic_armv7.h \ + /usr/include/qt5/QtCore/qatomic_armv6.h \ + /usr/include/qt5/QtCore/qatomic_armv5.h \ + /usr/include/qt5/QtCore/qatomic_bfin.h \ + /usr/include/qt5/QtCore/qatomic_ia64.h \ + /usr/include/qt5/QtCore/qatomic_mips.h \ + /usr/include/qt5/QtCore/qatomic_s390.h \ + /usr/include/qt5/QtCore/qatomic_sh4a.h \ + /usr/include/qt5/QtCore/qatomic_sparc.h \ + /usr/include/qt5/QtCore/qatomic_gcc.h \ + /usr/include/qt5/QtCore/qatomic_x86.h \ + /usr/include/qt5/QtCore/qatomic_cxx11.h \ + /usr/include/qt5/QtCore/qatomic_unix.h \ + /usr/include/qt5/QtCore/qmutex.h \ + /usr/include/qt5/QtCore/qlogging.h \ + /usr/include/qt5/QtCore/qflags.h \ + /usr/include/qt5/QtCore/qtypeinfo.h \ + /usr/include/qt5/QtCore/qtypetraits.h \ + /usr/include/qt5/QtCore/qsysinfo.h \ + /usr/include/qt5/QtCore/qdatastream.h \ + /usr/include/qt5/QtCore/qscopedpointer.h \ + /usr/include/qt5/QtCore/qiodevice.h \ + /usr/include/qt5/QtCore/qobject.h \ + /usr/include/qt5/QtCore/qobjectdefs.h \ + /usr/include/qt5/QtCore/qnamespace.h \ + /usr/include/qt5/QtCore/qobjectdefs_impl.h \ + /usr/include/qt5/QtCore/qstring.h \ + /usr/include/qt5/QtCore/qchar.h \ + /usr/include/qt5/QtCore/qbytearray.h \ + /usr/include/qt5/QtCore/qrefcount.h \ + /usr/include/qt5/QtCore/qarraydata.h \ + /usr/include/qt5/QtCore/qstringbuilder.h \ + /usr/include/qt5/QtCore/qlist.h \ + /usr/include/qt5/QtCore/qiterator.h \ + /usr/include/qt5/QtCore/qcoreevent.h \ + /usr/include/qt5/QtCore/qmetatype.h \ + /usr/include/qt5/QtCore/qvarlengtharray.h \ + /usr/include/qt5/QtCore/qcontainerfwd.h \ + /usr/include/qt5/QtCore/qisenum.h \ + /usr/include/qt5/QtCore/qobject_impl.h \ + /usr/include/qt5/QtCore/qpair.h \ + /usr/include/qt5/QtCore/qregexp.h \ + /usr/include/qt5/QtCore/qstringmatcher.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o .obj/ShellCommand.o src/ShellCommand.cpp + +.obj/Vt102Emulation.o: src/Vt102Emulation.cpp src/Vt102Emulation.h \ + /usr/include/qt5/QtGui/QKeyEvent \ + /usr/include/qt5/QtGui/qevent.h \ + /usr/include/qt5/QtGui/qwindowdefs.h \ + /usr/include/qt5/QtCore/qglobal.h \ + /usr/include/qt5/QtCore/qconfig.h \ + /usr/include/qt5/QtCore/qfeatures.h \ + /usr/include/qt5/QtCore/qsystemdetection.h \ + /usr/include/qt5/QtCore/qprocessordetection.h \ + /usr/include/qt5/QtCore/qcompilerdetection.h \ + /usr/include/qt5/QtCore/qglobalstatic.h \ + /usr/include/qt5/QtCore/qatomic.h \ + /usr/include/qt5/QtCore/qbasicatomic.h \ + /usr/include/qt5/QtCore/qatomic_bootstrap.h \ + /usr/include/qt5/QtCore/qgenericatomic.h \ + /usr/include/qt5/QtCore/qatomic_msvc.h \ + /usr/include/qt5/QtCore/qatomic_integrity.h \ + /usr/include/qt5/QtCore/qoldbasicatomic.h \ + /usr/include/qt5/QtCore/qatomic_vxworks.h \ + /usr/include/qt5/QtCore/qatomic_power.h \ + /usr/include/qt5/QtCore/qatomic_alpha.h \ + /usr/include/qt5/QtCore/qatomic_armv7.h \ + /usr/include/qt5/QtCore/qatomic_armv6.h \ + /usr/include/qt5/QtCore/qatomic_armv5.h \ + /usr/include/qt5/QtCore/qatomic_bfin.h \ + /usr/include/qt5/QtCore/qatomic_ia64.h \ + /usr/include/qt5/QtCore/qatomic_mips.h \ + /usr/include/qt5/QtCore/qatomic_s390.h \ + /usr/include/qt5/QtCore/qatomic_sh4a.h \ + /usr/include/qt5/QtCore/qatomic_sparc.h \ + /usr/include/qt5/QtCore/qatomic_gcc.h \ + /usr/include/qt5/QtCore/qatomic_x86.h \ + /usr/include/qt5/QtCore/qatomic_cxx11.h \ + /usr/include/qt5/QtCore/qatomic_unix.h \ + /usr/include/qt5/QtCore/qmutex.h \ + /usr/include/qt5/QtCore/qlogging.h \ + /usr/include/qt5/QtCore/qflags.h \ + /usr/include/qt5/QtCore/qtypeinfo.h \ + /usr/include/qt5/QtCore/qtypetraits.h \ + /usr/include/qt5/QtCore/qsysinfo.h \ + /usr/include/qt5/QtCore/qobjectdefs.h \ + /usr/include/qt5/QtCore/qnamespace.h \ + /usr/include/qt5/QtCore/qobjectdefs_impl.h \ + /usr/include/qt5/QtGui/qwindowdefs_win.h \ + /usr/include/qt5/QtCore/qobject.h \ + /usr/include/qt5/QtCore/qstring.h \ + /usr/include/qt5/QtCore/qchar.h \ + /usr/include/qt5/QtCore/qbytearray.h \ + /usr/include/qt5/QtCore/qrefcount.h \ + /usr/include/qt5/QtCore/qarraydata.h \ + /usr/include/qt5/QtCore/qstringbuilder.h \ + /usr/include/qt5/QtCore/qlist.h \ + /usr/include/qt5/QtCore/qalgorithms.h \ + /usr/include/qt5/QtCore/qiterator.h \ + /usr/include/qt5/QtCore/qcoreevent.h \ + /usr/include/qt5/QtCore/qscopedpointer.h \ + /usr/include/qt5/QtCore/qmetatype.h \ + /usr/include/qt5/QtCore/qvarlengtharray.h \ + /usr/include/qt5/QtCore/qcontainerfwd.h \ + /usr/include/qt5/QtCore/qisenum.h \ + /usr/include/qt5/QtCore/qobject_impl.h \ + /usr/include/qt5/QtGui/qregion.h \ + /usr/include/qt5/QtCore/qrect.h \ + /usr/include/qt5/QtCore/qsize.h \ + /usr/include/qt5/QtCore/qpoint.h \ + /usr/include/qt5/QtCore/qdatastream.h \ + /usr/include/qt5/QtCore/qiodevice.h \ + /usr/include/qt5/QtCore/qpair.h \ + /usr/include/qt5/QtGui/qkeysequence.h \ + /usr/include/qt5/QtCore/qvariant.h \ + /usr/include/qt5/QtCore/qmap.h \ + /usr/include/qt5/QtCore/qdebug.h \ + /usr/include/qt5/QtCore/qhash.h \ + /usr/include/qt5/QtCore/qtextstream.h \ + /usr/include/qt5/QtCore/qlocale.h \ + /usr/include/qt5/QtCore/qshareddata.h \ + /usr/include/qt5/QtCore/qvector.h \ + /usr/include/qt5/QtCore/qset.h \ + /usr/include/qt5/QtCore/qcontiguouscache.h \ + /usr/include/qt5/QtCore/qstringlist.h \ + /usr/include/qt5/QtCore/qregexp.h \ + /usr/include/qt5/QtCore/qstringmatcher.h \ + /usr/include/qt5/QtCore/qurl.h \ + /usr/include/qt5/QtCore/qurlquery.h \ + /usr/include/qt5/QtCore/qfile.h \ + /usr/include/qt5/QtCore/qfiledevice.h \ + /usr/include/qt5/QtGui/qvector2d.h \ + /usr/include/qt5/QtGui/qtouchdevice.h \ + /usr/include/qt5/QtCore/QHash \ + /usr/include/qt5/QtCore/QTimer \ + /usr/include/qt5/QtCore/qtimer.h \ + /usr/include/qt5/QtCore/qbasictimer.h \ + src/Emulation.h \ + /usr/include/qt5/QtCore/QTextCodec \ + /usr/include/qt5/QtCore/qtextcodec.h \ + /usr/include/qt5/QtCore/QTextStream \ + src/Screen.h \ + /usr/include/qt5/QtCore/QRect \ + /usr/include/qt5/QtCore/QVarLengthArray \ + src/Character.h \ + src/CharacterColor.h \ + /usr/include/qt5/QtGui/QColor \ + /usr/include/qt5/QtGui/qcolor.h \ + /usr/include/qt5/QtGui/qrgb.h \ + src/History.h \ + /usr/include/qt5/QtCore/QBitRef \ + /usr/include/qt5/QtCore/qbitarray.h \ + /usr/include/qt5/QtCore/QVector \ + /usr/include/qt5/QtCore/QTemporaryFile \ + /usr/include/qt5/QtCore/qtemporaryfile.h \ + src/BlockArray.h \ + /usr/include/qt5/QtCore/QEvent \ + /usr/include/qt5/QtCore/QByteRef \ + src/KeyboardTranslator.h \ + /usr/include/qt5/QtCore/QList \ + /usr/include/qt5/QtGui/QKeySequence \ + /usr/include/qt5/QtCore/QMetaType + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o .obj/Vt102Emulation.o src/Vt102Emulation.cpp + +.obj/tools.o: src/tools.cpp src/tools.h \ + /usr/include/qt5/QtCore/QString \ + /usr/include/qt5/QtCore/qstring.h \ + /usr/include/qt5/QtCore/qchar.h \ + /usr/include/qt5/QtCore/qglobal.h \ + /usr/include/qt5/QtCore/qconfig.h \ + /usr/include/qt5/QtCore/qfeatures.h \ + /usr/include/qt5/QtCore/qsystemdetection.h \ + /usr/include/qt5/QtCore/qprocessordetection.h \ + /usr/include/qt5/QtCore/qcompilerdetection.h \ + /usr/include/qt5/QtCore/qglobalstatic.h \ + /usr/include/qt5/QtCore/qatomic.h \ + /usr/include/qt5/QtCore/qbasicatomic.h \ + /usr/include/qt5/QtCore/qatomic_bootstrap.h \ + /usr/include/qt5/QtCore/qgenericatomic.h \ + /usr/include/qt5/QtCore/qatomic_msvc.h \ + /usr/include/qt5/QtCore/qatomic_integrity.h \ + /usr/include/qt5/QtCore/qoldbasicatomic.h \ + /usr/include/qt5/QtCore/qatomic_vxworks.h \ + /usr/include/qt5/QtCore/qatomic_power.h \ + /usr/include/qt5/QtCore/qatomic_alpha.h \ + /usr/include/qt5/QtCore/qatomic_armv7.h \ + /usr/include/qt5/QtCore/qatomic_armv6.h \ + /usr/include/qt5/QtCore/qatomic_armv5.h \ + /usr/include/qt5/QtCore/qatomic_bfin.h \ + /usr/include/qt5/QtCore/qatomic_ia64.h \ + /usr/include/qt5/QtCore/qatomic_mips.h \ + /usr/include/qt5/QtCore/qatomic_s390.h \ + /usr/include/qt5/QtCore/qatomic_sh4a.h \ + /usr/include/qt5/QtCore/qatomic_sparc.h \ + /usr/include/qt5/QtCore/qatomic_gcc.h \ + /usr/include/qt5/QtCore/qatomic_x86.h \ + /usr/include/qt5/QtCore/qatomic_cxx11.h \ + /usr/include/qt5/QtCore/qatomic_unix.h \ + /usr/include/qt5/QtCore/qmutex.h \ + /usr/include/qt5/QtCore/qlogging.h \ + /usr/include/qt5/QtCore/qflags.h \ + /usr/include/qt5/QtCore/qtypeinfo.h \ + /usr/include/qt5/QtCore/qtypetraits.h \ + /usr/include/qt5/QtCore/qsysinfo.h \ + /usr/include/qt5/QtCore/qbytearray.h \ + /usr/include/qt5/QtCore/qrefcount.h \ + /usr/include/qt5/QtCore/qnamespace.h \ + /usr/include/qt5/QtCore/qarraydata.h \ + /usr/include/qt5/QtCore/qstringbuilder.h \ + /usr/include/qt5/QtCore/QCoreApplication \ + /usr/include/qt5/QtCore/qcoreapplication.h \ + /usr/include/qt5/QtCore/qobject.h \ + /usr/include/qt5/QtCore/qobjectdefs.h \ + /usr/include/qt5/QtCore/qobjectdefs_impl.h \ + /usr/include/qt5/QtCore/qlist.h \ + /usr/include/qt5/QtCore/qalgorithms.h \ + /usr/include/qt5/QtCore/qiterator.h \ + /usr/include/qt5/QtCore/qcoreevent.h \ + /usr/include/qt5/QtCore/qscopedpointer.h \ + /usr/include/qt5/QtCore/qmetatype.h \ + /usr/include/qt5/QtCore/qvarlengtharray.h \ + /usr/include/qt5/QtCore/qcontainerfwd.h \ + /usr/include/qt5/QtCore/qisenum.h \ + /usr/include/qt5/QtCore/qobject_impl.h \ + /usr/include/qt5/QtCore/qeventloop.h \ + /usr/include/qt5/QtCore/QDir \ + /usr/include/qt5/QtCore/qdir.h \ + /usr/include/qt5/QtCore/qfileinfo.h \ + /usr/include/qt5/QtCore/qfile.h \ + /usr/include/qt5/QtCore/qfiledevice.h \ + /usr/include/qt5/QtCore/qiodevice.h \ + /usr/include/qt5/QtCore/qshareddata.h \ + /usr/include/qt5/QtCore/qstringlist.h \ + /usr/include/qt5/QtCore/qdatastream.h \ + /usr/include/qt5/QtCore/qpair.h \ + /usr/include/qt5/QtCore/qregexp.h \ + /usr/include/qt5/QtCore/qstringmatcher.h \ + /usr/include/qt5/QtCore/QtDebug \ + /usr/include/qt5/QtCore/qdebug.h \ + /usr/include/qt5/QtCore/qhash.h \ + /usr/include/qt5/QtCore/qmap.h \ + /usr/include/qt5/QtCore/qtextstream.h \ + /usr/include/qt5/QtCore/qlocale.h \ + /usr/include/qt5/QtCore/qvariant.h \ + /usr/include/qt5/QtCore/qvector.h \ + /usr/include/qt5/QtCore/qpoint.h \ + /usr/include/qt5/QtCore/qset.h \ + /usr/include/qt5/QtCore/qcontiguouscache.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o .obj/tools.o src/tools.cpp + +.obj/Session.o: src/Session.cpp src/Session.h \ + /usr/include/qt5/QtCore/QStringList \ + /usr/include/qt5/QtCore/qstringlist.h \ + /usr/include/qt5/QtCore/qalgorithms.h \ + /usr/include/qt5/QtCore/qglobal.h \ + /usr/include/qt5/QtCore/qconfig.h \ + /usr/include/qt5/QtCore/qfeatures.h \ + /usr/include/qt5/QtCore/qsystemdetection.h \ + /usr/include/qt5/QtCore/qprocessordetection.h \ + /usr/include/qt5/QtCore/qcompilerdetection.h \ + /usr/include/qt5/QtCore/qglobalstatic.h \ + /usr/include/qt5/QtCore/qatomic.h \ + /usr/include/qt5/QtCore/qbasicatomic.h \ + /usr/include/qt5/QtCore/qatomic_bootstrap.h \ + /usr/include/qt5/QtCore/qgenericatomic.h \ + /usr/include/qt5/QtCore/qatomic_msvc.h \ + /usr/include/qt5/QtCore/qatomic_integrity.h \ + /usr/include/qt5/QtCore/qoldbasicatomic.h \ + /usr/include/qt5/QtCore/qatomic_vxworks.h \ + /usr/include/qt5/QtCore/qatomic_power.h \ + /usr/include/qt5/QtCore/qatomic_alpha.h \ + /usr/include/qt5/QtCore/qatomic_armv7.h \ + /usr/include/qt5/QtCore/qatomic_armv6.h \ + /usr/include/qt5/QtCore/qatomic_armv5.h \ + /usr/include/qt5/QtCore/qatomic_bfin.h \ + /usr/include/qt5/QtCore/qatomic_ia64.h \ + /usr/include/qt5/QtCore/qatomic_mips.h \ + /usr/include/qt5/QtCore/qatomic_s390.h \ + /usr/include/qt5/QtCore/qatomic_sh4a.h \ + /usr/include/qt5/QtCore/qatomic_sparc.h \ + /usr/include/qt5/QtCore/qatomic_gcc.h \ + /usr/include/qt5/QtCore/qatomic_x86.h \ + /usr/include/qt5/QtCore/qatomic_cxx11.h \ + /usr/include/qt5/QtCore/qatomic_unix.h \ + /usr/include/qt5/QtCore/qmutex.h \ + /usr/include/qt5/QtCore/qlogging.h \ + /usr/include/qt5/QtCore/qflags.h \ + /usr/include/qt5/QtCore/qtypeinfo.h \ + /usr/include/qt5/QtCore/qtypetraits.h \ + /usr/include/qt5/QtCore/qsysinfo.h \ + /usr/include/qt5/QtCore/qdatastream.h \ + /usr/include/qt5/QtCore/qscopedpointer.h \ + /usr/include/qt5/QtCore/qiodevice.h \ + /usr/include/qt5/QtCore/qobject.h \ + /usr/include/qt5/QtCore/qobjectdefs.h \ + /usr/include/qt5/QtCore/qnamespace.h \ + /usr/include/qt5/QtCore/qobjectdefs_impl.h \ + /usr/include/qt5/QtCore/qstring.h \ + /usr/include/qt5/QtCore/qchar.h \ + /usr/include/qt5/QtCore/qbytearray.h \ + /usr/include/qt5/QtCore/qrefcount.h \ + /usr/include/qt5/QtCore/qarraydata.h \ + /usr/include/qt5/QtCore/qstringbuilder.h \ + /usr/include/qt5/QtCore/qlist.h \ + /usr/include/qt5/QtCore/qiterator.h \ + /usr/include/qt5/QtCore/qcoreevent.h \ + /usr/include/qt5/QtCore/qmetatype.h \ + /usr/include/qt5/QtCore/qvarlengtharray.h \ + /usr/include/qt5/QtCore/qcontainerfwd.h \ + /usr/include/qt5/QtCore/qisenum.h \ + /usr/include/qt5/QtCore/qobject_impl.h \ + /usr/include/qt5/QtCore/qpair.h \ + /usr/include/qt5/QtCore/qregexp.h \ + /usr/include/qt5/QtCore/qstringmatcher.h \ + /usr/include/qt5/QtCore/QTimer \ + /usr/include/qt5/QtCore/qtimer.h \ + /usr/include/qt5/QtCore/qbasictimer.h \ + /usr/include/qt5/QtGui/QWindow \ + /usr/include/qt5/QtGui/qwindow.h \ + /usr/include/qt5/QtCore/QObject \ + /usr/include/qt5/QtCore/QEvent \ + /usr/include/qt5/QtCore/QMargins \ + /usr/include/qt5/QtCore/qmargins.h \ + /usr/include/qt5/QtCore/qrect.h \ + /usr/include/qt5/QtCore/qsize.h \ + /usr/include/qt5/QtCore/qpoint.h \ + /usr/include/qt5/QtCore/QRect \ + /usr/include/qt5/QtGui/qsurface.h \ + /usr/include/qt5/QtGui/qsurfaceformat.h \ + /usr/include/qt5/QtGui/qwindowdefs.h \ + /usr/include/qt5/QtGui/qwindowdefs_win.h \ + /usr/include/qt5/QtGui/qicon.h \ + /usr/include/qt5/QtGui/qpixmap.h \ + /usr/include/qt5/QtGui/qpaintdevice.h \ + /usr/include/qt5/QtGui/qcolor.h \ + /usr/include/qt5/QtGui/qrgb.h \ + /usr/include/qt5/QtCore/qsharedpointer.h \ + /usr/include/qt5/QtCore/qshareddata.h \ + /usr/include/qt5/QtCore/qsharedpointer_impl.h \ + /usr/include/qt5/QtCore/qhash.h \ + /usr/include/qt5/QtGui/qimage.h \ + /usr/include/qt5/QtGui/qtransform.h \ + /usr/include/qt5/QtGui/qmatrix.h \ + /usr/include/qt5/QtGui/qpolygon.h \ + /usr/include/qt5/QtCore/qvector.h \ + /usr/include/qt5/QtGui/qregion.h \ + /usr/include/qt5/QtCore/qline.h \ + /usr/include/qt5/QtGui/qpainterpath.h \ + /usr/include/qt5/QtGui/qcursor.h \ + src/History.h \ + /usr/include/qt5/QtCore/QBitRef \ + /usr/include/qt5/QtCore/qbitarray.h \ + /usr/include/qt5/QtCore/QHash \ + /usr/include/qt5/QtCore/QVector \ + /usr/include/qt5/QtCore/QTemporaryFile \ + /usr/include/qt5/QtCore/qtemporaryfile.h \ + /usr/include/qt5/QtCore/qfile.h \ + /usr/include/qt5/QtCore/qfiledevice.h \ + src/BlockArray.h \ + src/Character.h \ + src/CharacterColor.h \ + /usr/include/qt5/QtGui/QColor \ + /usr/include/qt5/QtGui/QGuiApplication \ + /usr/include/qt5/QtGui/qguiapplication.h \ + /usr/include/qt5/QtCore/qcoreapplication.h \ + /usr/include/qt5/QtCore/qeventloop.h \ + /usr/include/qt5/QtGui/qinputmethod.h \ + /usr/include/qt5/QtCore/qlocale.h \ + /usr/include/qt5/QtCore/qvariant.h \ + /usr/include/qt5/QtCore/qmap.h \ + /usr/include/qt5/QtCore/qdebug.h \ + /usr/include/qt5/QtCore/qtextstream.h \ + /usr/include/qt5/QtCore/qset.h \ + /usr/include/qt5/QtCore/qcontiguouscache.h \ + /usr/include/qt5/QtCore/QByteRef \ + /usr/include/qt5/QtCore/QDir \ + /usr/include/qt5/QtCore/qdir.h \ + /usr/include/qt5/QtCore/qfileinfo.h \ + /usr/include/qt5/QtCore/QFile \ + /usr/include/qt5/QtCore/QRegExp \ + /usr/include/qt5/QtCore/QtCore \ + /usr/include/qt5/QtCore/QtCoreDepends \ + /usr/include/qt5/QtCore/qabstractanimation.h \ + /usr/include/qt5/QtCore/qanimationgroup.h \ + /usr/include/qt5/QtCore/qparallelanimationgroup.h \ + /usr/include/qt5/QtCore/qpauseanimation.h \ + /usr/include/qt5/QtCore/qpropertyanimation.h \ + /usr/include/qt5/QtCore/qvariantanimation.h \ + /usr/include/qt5/QtCore/qeasingcurve.h \ + /usr/include/qt5/QtCore/qsequentialanimationgroup.h \ + /usr/include/qt5/QtCore/qtextcodec.h \ + /usr/include/qt5/QtCore/qendian.h \ + /usr/include/qt5/QtCore/qlibraryinfo.h \ + /usr/include/qt5/QtCore/qdatetime.h \ + /usr/include/qt5/QtCore/qnumeric.h \ + /usr/include/qt5/QtCore/qbuffer.h \ + /usr/include/qt5/QtCore/qdiriterator.h \ + /usr/include/qt5/QtCore/qfileselector.h \ + /usr/include/qt5/QtCore/qfilesystemwatcher.h \ + /usr/include/qt5/QtCore/qlockfile.h \ + /usr/include/qt5/QtCore/qloggingcategory.h \ + /usr/include/qt5/QtCore/qprocess.h \ + /usr/include/qt5/QtCore/qresource.h \ + /usr/include/qt5/QtCore/qsavefile.h \ + /usr/include/qt5/QtCore/qsettings.h \ + /usr/include/qt5/QtCore/qstandardpaths.h \ + /usr/include/qt5/QtCore/qtemporarydir.h \ + /usr/include/qt5/QtCore/QScopedPointer \ + /usr/include/qt5/QtCore/qurl.h \ + /usr/include/qt5/QtCore/qurlquery.h \ + /usr/include/qt5/QtCore/qabstractitemmodel.h \ + /usr/include/qt5/QtCore/qabstractproxymodel.h \ + /usr/include/qt5/QtCore/qidentityproxymodel.h \ + /usr/include/qt5/QtCore/qitemselectionmodel.h \ + /usr/include/qt5/QtCore/qsortfilterproxymodel.h \ + /usr/include/qt5/QtCore/qstringlistmodel.h \ + /usr/include/qt5/QtCore/qjsonarray.h \ + /usr/include/qt5/QtCore/qjsonvalue.h \ + /usr/include/qt5/QtCore/qjsondocument.h \ + /usr/include/qt5/QtCore/qjsonobject.h \ + /usr/include/qt5/QtCore/qabstracteventdispatcher.h \ + /usr/include/qt5/QtCore/qabstractnativeeventfilter.h \ + /usr/include/qt5/QtCore/qmath.h \ + /usr/include/qt5/QtCore/qmetaobject.h \ + /usr/include/qt5/QtCore/qmimedata.h \ + /usr/include/qt5/QtCore/qobjectcleanuphandler.h \ + /usr/include/qt5/QtCore/qpointer.h \ + /usr/include/qt5/QtCore/qsharedmemory.h \ + /usr/include/qt5/QtCore/qsignalmapper.h \ + /usr/include/qt5/QtCore/qsocketnotifier.h \ + /usr/include/qt5/QtCore/qsystemsemaphore.h \ + /usr/include/qt5/QtCore/qtranslator.h \ + /usr/include/qt5/QtCore/qwineventnotifier.h \ + /usr/include/qt5/QtCore/qmimedatabase.h \ + /usr/include/qt5/QtCore/qmimetype.h \ + /usr/include/qt5/QtCore/qfactoryinterface.h \ + /usr/include/qt5/QtCore/qlibrary.h \ + /usr/include/qt5/QtCore/qplugin.h \ + /usr/include/qt5/QtCore/qpluginloader.h \ + /usr/include/qt5/QtCore/quuid.h \ + /usr/include/qt5/QtCore/qabstractstate.h \ + /usr/include/qt5/QtCore/qabstracttransition.h \ + /usr/include/qt5/QtCore/qeventtransition.h \ + /usr/include/qt5/QtCore/qfinalstate.h \ + /usr/include/qt5/QtCore/qhistorystate.h \ + /usr/include/qt5/QtCore/qsignaltransition.h \ + /usr/include/qt5/QtCore/qstate.h \ + /usr/include/qt5/QtCore/qstatemachine.h \ + /usr/include/qt5/QtCore/qexception.h \ + /usr/include/qt5/QtCore/qfuture.h \ + /usr/include/qt5/QtCore/qfutureinterface.h \ + /usr/include/qt5/QtCore/qrunnable.h \ + /usr/include/qt5/QtCore/qresultstore.h \ + /usr/include/qt5/QtCore/qfuturesynchronizer.h \ + /usr/include/qt5/QtCore/qfuturewatcher.h \ + /usr/include/qt5/QtCore/qreadwritelock.h \ + /usr/include/qt5/QtCore/qsemaphore.h \ + /usr/include/qt5/QtCore/qthread.h \ + /usr/include/qt5/QtCore/qthreadpool.h \ + /usr/include/qt5/QtCore/qthreadstorage.h \ + /usr/include/qt5/QtCore/qwaitcondition.h \ + /usr/include/qt5/QtCore/qarraydataops.h \ + /usr/include/qt5/QtCore/qarraydatapointer.h \ + /usr/include/qt5/QtCore/qbytearraymatcher.h \ + /usr/include/qt5/QtCore/qcache.h \ + /usr/include/qt5/QtCore/qcollator.h \ + /usr/include/qt5/QtCore/qcommandlineoption.h \ + /usr/include/qt5/QtCore/qcommandlineparser.h \ + /usr/include/qt5/QtCore/qcryptographichash.h \ + /usr/include/qt5/QtCore/qelapsedtimer.h \ + /usr/include/qt5/QtCore/qlinkedlist.h \ + /usr/include/qt5/QtCore/qmessageauthenticationcode.h \ + /usr/include/qt5/QtCore/qqueue.h \ + /usr/include/qt5/QtCore/qregularexpression.h \ + /usr/include/qt5/QtCore/qscopedvaluerollback.h \ + /usr/include/qt5/QtCore/qstack.h \ + /usr/include/qt5/QtCore/qtextboundaryfinder.h \ + /usr/include/qt5/QtCore/qtimeline.h \ + /usr/include/qt5/QtCore/qtimezone.h \ + /usr/include/qt5/QtCore/qxmlstream.h \ + /usr/include/qt5/QtCore/qtcoreversion.h \ + src/Pty.h \ + /usr/include/qt5/QtCore/QList \ + /usr/include/qt5/QtCore/QSize \ + src/kptyprocess.h \ + src/kprocess.h \ + /usr/include/qt5/QtCore/QProcess \ + src/kptydevice.h \ + src/kpty_p.h \ + src/kpty.h \ + /usr/include/qt5/QtCore/QByteArray \ + /usr/include/qt5/QtCore/QIODevice \ + src/TerminalDisplay.h \ + /usr/include/qt5/QtCore/QPointer \ + src/Filter.h \ + /usr/include/qt5/QtWidgets/QAction \ + /usr/include/qt5/QtWidgets/qaction.h \ + /usr/include/qt5/QtGui/qkeysequence.h \ + /usr/include/qt5/QtWidgets/qwidget.h \ + /usr/include/qt5/QtGui/qpalette.h \ + /usr/include/qt5/QtGui/qbrush.h \ + /usr/include/qt5/QtGui/qfont.h \ + /usr/include/qt5/QtGui/qfontmetrics.h \ + /usr/include/qt5/QtGui/qfontinfo.h \ + /usr/include/qt5/QtWidgets/qsizepolicy.h \ + /usr/include/qt5/QtGui/qevent.h \ + /usr/include/qt5/QtGui/qvector2d.h \ + /usr/include/qt5/QtGui/qtouchdevice.h \ + /usr/include/qt5/QtWidgets/qactiongroup.h \ + src/ksession.h \ + /usr/include/qt5/QtQuick/QQuickItem \ + /usr/include/qt5/QtQuick/qquickitem.h \ + /usr/include/qt5/QtQuick/qtquickglobal.h \ + /usr/include/qt5/QtQml/qqml.h \ + /usr/include/qt5/QtQml/qqmlprivate.h \ + /usr/include/qt5/QtQml/qtqmlglobal.h \ + /usr/include/qt5/QtQml/qqmlparserstatus.h \ + /usr/include/qt5/QtQml/qqmlpropertyvaluesource.h \ + /usr/include/qt5/QtQml/qqmllist.h \ + /usr/include/qt5/QtQml/qqmlcomponent.h \ + /usr/include/qt5/QtQml/qqmlerror.h \ + /usr/include/qt5/QtQml/qjsvalue.h \ + /usr/include/qt5/QtGui/qaccessible.h \ + /usr/include/qt5/QtQuick/QQuickPaintedItem \ + /usr/include/qt5/QtQuick/qquickpainteditem.h \ + src/ShellCommand.h \ + src/Vt102Emulation.h \ + /usr/include/qt5/QtGui/QKeyEvent \ + src/Emulation.h \ + /usr/include/qt5/QtCore/QTextCodec \ + /usr/include/qt5/QtCore/QTextStream \ + src/Screen.h \ + /usr/include/qt5/QtCore/QVarLengthArray + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o .obj/Session.o src/Session.cpp + +.obj/Screen.o: src/Screen.cpp src/Screen.h \ + /usr/include/qt5/QtCore/QRect \ + /usr/include/qt5/QtCore/qrect.h \ + /usr/include/qt5/QtCore/qsize.h \ + /usr/include/qt5/QtCore/qnamespace.h \ + /usr/include/qt5/QtCore/qglobal.h \ + /usr/include/qt5/QtCore/qconfig.h \ + /usr/include/qt5/QtCore/qfeatures.h \ + /usr/include/qt5/QtCore/qsystemdetection.h \ + /usr/include/qt5/QtCore/qprocessordetection.h \ + /usr/include/qt5/QtCore/qcompilerdetection.h \ + /usr/include/qt5/QtCore/qglobalstatic.h \ + /usr/include/qt5/QtCore/qatomic.h \ + /usr/include/qt5/QtCore/qbasicatomic.h \ + /usr/include/qt5/QtCore/qatomic_bootstrap.h \ + /usr/include/qt5/QtCore/qgenericatomic.h \ + /usr/include/qt5/QtCore/qatomic_msvc.h \ + /usr/include/qt5/QtCore/qatomic_integrity.h \ + /usr/include/qt5/QtCore/qoldbasicatomic.h \ + /usr/include/qt5/QtCore/qatomic_vxworks.h \ + /usr/include/qt5/QtCore/qatomic_power.h \ + /usr/include/qt5/QtCore/qatomic_alpha.h \ + /usr/include/qt5/QtCore/qatomic_armv7.h \ + /usr/include/qt5/QtCore/qatomic_armv6.h \ + /usr/include/qt5/QtCore/qatomic_armv5.h \ + /usr/include/qt5/QtCore/qatomic_bfin.h \ + /usr/include/qt5/QtCore/qatomic_ia64.h \ + /usr/include/qt5/QtCore/qatomic_mips.h \ + /usr/include/qt5/QtCore/qatomic_s390.h \ + /usr/include/qt5/QtCore/qatomic_sh4a.h \ + /usr/include/qt5/QtCore/qatomic_sparc.h \ + /usr/include/qt5/QtCore/qatomic_gcc.h \ + /usr/include/qt5/QtCore/qatomic_x86.h \ + /usr/include/qt5/QtCore/qatomic_cxx11.h \ + /usr/include/qt5/QtCore/qatomic_unix.h \ + /usr/include/qt5/QtCore/qmutex.h \ + /usr/include/qt5/QtCore/qlogging.h \ + /usr/include/qt5/QtCore/qflags.h \ + /usr/include/qt5/QtCore/qtypeinfo.h \ + /usr/include/qt5/QtCore/qtypetraits.h \ + /usr/include/qt5/QtCore/qsysinfo.h \ + /usr/include/qt5/QtCore/qpoint.h \ + /usr/include/qt5/QtCore/QTextStream \ + /usr/include/qt5/QtCore/qtextstream.h \ + /usr/include/qt5/QtCore/qiodevice.h \ + /usr/include/qt5/QtCore/qobject.h \ + /usr/include/qt5/QtCore/qobjectdefs.h \ + /usr/include/qt5/QtCore/qobjectdefs_impl.h \ + /usr/include/qt5/QtCore/qstring.h \ + /usr/include/qt5/QtCore/qchar.h \ + /usr/include/qt5/QtCore/qbytearray.h \ + /usr/include/qt5/QtCore/qrefcount.h \ + /usr/include/qt5/QtCore/qarraydata.h \ + /usr/include/qt5/QtCore/qstringbuilder.h \ + /usr/include/qt5/QtCore/qlist.h \ + /usr/include/qt5/QtCore/qalgorithms.h \ + /usr/include/qt5/QtCore/qiterator.h \ + /usr/include/qt5/QtCore/qcoreevent.h \ + /usr/include/qt5/QtCore/qscopedpointer.h \ + /usr/include/qt5/QtCore/qmetatype.h \ + /usr/include/qt5/QtCore/qvarlengtharray.h \ + /usr/include/qt5/QtCore/qcontainerfwd.h \ + /usr/include/qt5/QtCore/qisenum.h \ + /usr/include/qt5/QtCore/qobject_impl.h \ + /usr/include/qt5/QtCore/qlocale.h \ + /usr/include/qt5/QtCore/qvariant.h \ + /usr/include/qt5/QtCore/qmap.h \ + /usr/include/qt5/QtCore/qpair.h \ + /usr/include/qt5/QtCore/qdebug.h \ + /usr/include/qt5/QtCore/qhash.h \ + /usr/include/qt5/QtCore/qvector.h \ + /usr/include/qt5/QtCore/qset.h \ + /usr/include/qt5/QtCore/qcontiguouscache.h \ + /usr/include/qt5/QtCore/qstringlist.h \ + /usr/include/qt5/QtCore/qdatastream.h \ + /usr/include/qt5/QtCore/qregexp.h \ + /usr/include/qt5/QtCore/qstringmatcher.h \ + /usr/include/qt5/QtCore/qshareddata.h \ + /usr/include/qt5/QtCore/QVarLengthArray \ + src/Character.h \ + /usr/include/qt5/QtCore/QHash \ + src/CharacterColor.h \ + /usr/include/qt5/QtGui/QColor \ + /usr/include/qt5/QtGui/qcolor.h \ + /usr/include/qt5/QtGui/qrgb.h \ + src/History.h \ + /usr/include/qt5/QtCore/QBitRef \ + /usr/include/qt5/QtCore/qbitarray.h \ + /usr/include/qt5/QtCore/QVector \ + /usr/include/qt5/QtCore/QTemporaryFile \ + /usr/include/qt5/QtCore/qtemporaryfile.h \ + /usr/include/qt5/QtCore/qfile.h \ + /usr/include/qt5/QtCore/qfiledevice.h \ + src/BlockArray.h \ + /usr/include/qt5/QtCore/QDate \ + /usr/include/qt5/QtCore/qdatetime.h \ + /usr/include/qt5/QtCore/qsharedpointer.h \ + /usr/include/qt5/QtCore/qsharedpointer_impl.h \ + src/konsole_wcwidth.h \ + /usr/include/qt5/QtCore/QString \ + src/TerminalCharacterDecoder.h \ + /usr/include/qt5/QtCore/QList + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o .obj/Screen.o src/Screen.cpp + +.obj/KeyboardTranslator.o: src/KeyboardTranslator.cpp src/KeyboardTranslator.h \ + /usr/include/qt5/QtCore/QHash \ + /usr/include/qt5/QtCore/qhash.h \ + /usr/include/qt5/QtCore/qchar.h \ + /usr/include/qt5/QtCore/qglobal.h \ + /usr/include/qt5/QtCore/qconfig.h \ + /usr/include/qt5/QtCore/qfeatures.h \ + /usr/include/qt5/QtCore/qsystemdetection.h \ + /usr/include/qt5/QtCore/qprocessordetection.h \ + /usr/include/qt5/QtCore/qcompilerdetection.h \ + /usr/include/qt5/QtCore/qglobalstatic.h \ + /usr/include/qt5/QtCore/qatomic.h \ + /usr/include/qt5/QtCore/qbasicatomic.h \ + /usr/include/qt5/QtCore/qatomic_bootstrap.h \ + /usr/include/qt5/QtCore/qgenericatomic.h \ + /usr/include/qt5/QtCore/qatomic_msvc.h \ + /usr/include/qt5/QtCore/qatomic_integrity.h \ + /usr/include/qt5/QtCore/qoldbasicatomic.h \ + /usr/include/qt5/QtCore/qatomic_vxworks.h \ + /usr/include/qt5/QtCore/qatomic_power.h \ + /usr/include/qt5/QtCore/qatomic_alpha.h \ + /usr/include/qt5/QtCore/qatomic_armv7.h \ + /usr/include/qt5/QtCore/qatomic_armv6.h \ + /usr/include/qt5/QtCore/qatomic_armv5.h \ + /usr/include/qt5/QtCore/qatomic_bfin.h \ + /usr/include/qt5/QtCore/qatomic_ia64.h \ + /usr/include/qt5/QtCore/qatomic_mips.h \ + /usr/include/qt5/QtCore/qatomic_s390.h \ + /usr/include/qt5/QtCore/qatomic_sh4a.h \ + /usr/include/qt5/QtCore/qatomic_sparc.h \ + /usr/include/qt5/QtCore/qatomic_gcc.h \ + /usr/include/qt5/QtCore/qatomic_x86.h \ + /usr/include/qt5/QtCore/qatomic_cxx11.h \ + /usr/include/qt5/QtCore/qatomic_unix.h \ + /usr/include/qt5/QtCore/qmutex.h \ + /usr/include/qt5/QtCore/qlogging.h \ + /usr/include/qt5/QtCore/qflags.h \ + /usr/include/qt5/QtCore/qtypeinfo.h \ + /usr/include/qt5/QtCore/qtypetraits.h \ + /usr/include/qt5/QtCore/qsysinfo.h \ + /usr/include/qt5/QtCore/qiterator.h \ + /usr/include/qt5/QtCore/qlist.h \ + /usr/include/qt5/QtCore/qalgorithms.h \ + /usr/include/qt5/QtCore/qrefcount.h \ + /usr/include/qt5/QtCore/qpair.h \ + /usr/include/qt5/QtCore/QList \ + /usr/include/qt5/QtGui/QKeySequence \ + /usr/include/qt5/QtGui/qkeysequence.h \ + /usr/include/qt5/QtCore/qnamespace.h \ + /usr/include/qt5/QtCore/qstring.h \ + /usr/include/qt5/QtCore/qbytearray.h \ + /usr/include/qt5/QtCore/qarraydata.h \ + /usr/include/qt5/QtCore/qstringbuilder.h \ + /usr/include/qt5/QtCore/qobjectdefs.h \ + /usr/include/qt5/QtCore/qobjectdefs_impl.h \ + /usr/include/qt5/QtCore/QMetaType \ + /usr/include/qt5/QtCore/qmetatype.h \ + /usr/include/qt5/QtCore/qvarlengtharray.h \ + /usr/include/qt5/QtCore/qcontainerfwd.h \ + /usr/include/qt5/QtCore/qisenum.h \ + /usr/include/qt5/QtCore/QVarLengthArray \ + /usr/include/qt5/QtCore/QBuffer \ + /usr/include/qt5/QtCore/qbuffer.h \ + /usr/include/qt5/QtCore/qiodevice.h \ + /usr/include/qt5/QtCore/qobject.h \ + /usr/include/qt5/QtCore/qcoreevent.h \ + /usr/include/qt5/QtCore/qscopedpointer.h \ + /usr/include/qt5/QtCore/qobject_impl.h \ + /usr/include/qt5/QtCore/QFile \ + /usr/include/qt5/QtCore/qfile.h \ + /usr/include/qt5/QtCore/qfiledevice.h \ + /usr/include/qt5/QtCore/QFileInfo \ + /usr/include/qt5/QtCore/qfileinfo.h \ + /usr/include/qt5/QtCore/qshareddata.h \ + /usr/include/qt5/QtCore/QTextStream \ + /usr/include/qt5/QtCore/qtextstream.h \ + /usr/include/qt5/QtCore/qlocale.h \ + /usr/include/qt5/QtCore/qvariant.h \ + /usr/include/qt5/QtCore/qmap.h \ + /usr/include/qt5/QtCore/qdebug.h \ + /usr/include/qt5/QtCore/qvector.h \ + /usr/include/qt5/QtCore/qpoint.h \ + /usr/include/qt5/QtCore/qset.h \ + /usr/include/qt5/QtCore/qcontiguouscache.h \ + /usr/include/qt5/QtCore/qstringlist.h \ + /usr/include/qt5/QtCore/qdatastream.h \ + /usr/include/qt5/QtCore/qregexp.h \ + /usr/include/qt5/QtCore/qstringmatcher.h \ + /usr/include/qt5/QtCore/QDir \ + /usr/include/qt5/QtCore/qdir.h \ + /usr/include/qt5/QtCore/QtDebug \ + src/tools.h \ + /usr/include/qt5/QtCore/QString + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o .obj/KeyboardTranslator.o src/KeyboardTranslator.cpp + +.obj/Emulation.o: src/Emulation.cpp src/Emulation.h \ + /usr/include/qt5/QtGui/QKeyEvent \ + /usr/include/qt5/QtGui/qevent.h \ + /usr/include/qt5/QtGui/qwindowdefs.h \ + /usr/include/qt5/QtCore/qglobal.h \ + /usr/include/qt5/QtCore/qconfig.h \ + /usr/include/qt5/QtCore/qfeatures.h \ + /usr/include/qt5/QtCore/qsystemdetection.h \ + /usr/include/qt5/QtCore/qprocessordetection.h \ + /usr/include/qt5/QtCore/qcompilerdetection.h \ + /usr/include/qt5/QtCore/qglobalstatic.h \ + /usr/include/qt5/QtCore/qatomic.h \ + /usr/include/qt5/QtCore/qbasicatomic.h \ + /usr/include/qt5/QtCore/qatomic_bootstrap.h \ + /usr/include/qt5/QtCore/qgenericatomic.h \ + /usr/include/qt5/QtCore/qatomic_msvc.h \ + /usr/include/qt5/QtCore/qatomic_integrity.h \ + /usr/include/qt5/QtCore/qoldbasicatomic.h \ + /usr/include/qt5/QtCore/qatomic_vxworks.h \ + /usr/include/qt5/QtCore/qatomic_power.h \ + /usr/include/qt5/QtCore/qatomic_alpha.h \ + /usr/include/qt5/QtCore/qatomic_armv7.h \ + /usr/include/qt5/QtCore/qatomic_armv6.h \ + /usr/include/qt5/QtCore/qatomic_armv5.h \ + /usr/include/qt5/QtCore/qatomic_bfin.h \ + /usr/include/qt5/QtCore/qatomic_ia64.h \ + /usr/include/qt5/QtCore/qatomic_mips.h \ + /usr/include/qt5/QtCore/qatomic_s390.h \ + /usr/include/qt5/QtCore/qatomic_sh4a.h \ + /usr/include/qt5/QtCore/qatomic_sparc.h \ + /usr/include/qt5/QtCore/qatomic_gcc.h \ + /usr/include/qt5/QtCore/qatomic_x86.h \ + /usr/include/qt5/QtCore/qatomic_cxx11.h \ + /usr/include/qt5/QtCore/qatomic_unix.h \ + /usr/include/qt5/QtCore/qmutex.h \ + /usr/include/qt5/QtCore/qlogging.h \ + /usr/include/qt5/QtCore/qflags.h \ + /usr/include/qt5/QtCore/qtypeinfo.h \ + /usr/include/qt5/QtCore/qtypetraits.h \ + /usr/include/qt5/QtCore/qsysinfo.h \ + /usr/include/qt5/QtCore/qobjectdefs.h \ + /usr/include/qt5/QtCore/qnamespace.h \ + /usr/include/qt5/QtCore/qobjectdefs_impl.h \ + /usr/include/qt5/QtGui/qwindowdefs_win.h \ + /usr/include/qt5/QtCore/qobject.h \ + /usr/include/qt5/QtCore/qstring.h \ + /usr/include/qt5/QtCore/qchar.h \ + /usr/include/qt5/QtCore/qbytearray.h \ + /usr/include/qt5/QtCore/qrefcount.h \ + /usr/include/qt5/QtCore/qarraydata.h \ + /usr/include/qt5/QtCore/qstringbuilder.h \ + /usr/include/qt5/QtCore/qlist.h \ + /usr/include/qt5/QtCore/qalgorithms.h \ + /usr/include/qt5/QtCore/qiterator.h \ + /usr/include/qt5/QtCore/qcoreevent.h \ + /usr/include/qt5/QtCore/qscopedpointer.h \ + /usr/include/qt5/QtCore/qmetatype.h \ + /usr/include/qt5/QtCore/qvarlengtharray.h \ + /usr/include/qt5/QtCore/qcontainerfwd.h \ + /usr/include/qt5/QtCore/qisenum.h \ + /usr/include/qt5/QtCore/qobject_impl.h \ + /usr/include/qt5/QtGui/qregion.h \ + /usr/include/qt5/QtCore/qrect.h \ + /usr/include/qt5/QtCore/qsize.h \ + /usr/include/qt5/QtCore/qpoint.h \ + /usr/include/qt5/QtCore/qdatastream.h \ + /usr/include/qt5/QtCore/qiodevice.h \ + /usr/include/qt5/QtCore/qpair.h \ + /usr/include/qt5/QtGui/qkeysequence.h \ + /usr/include/qt5/QtCore/qvariant.h \ + /usr/include/qt5/QtCore/qmap.h \ + /usr/include/qt5/QtCore/qdebug.h \ + /usr/include/qt5/QtCore/qhash.h \ + /usr/include/qt5/QtCore/qtextstream.h \ + /usr/include/qt5/QtCore/qlocale.h \ + /usr/include/qt5/QtCore/qshareddata.h \ + /usr/include/qt5/QtCore/qvector.h \ + /usr/include/qt5/QtCore/qset.h \ + /usr/include/qt5/QtCore/qcontiguouscache.h \ + /usr/include/qt5/QtCore/qstringlist.h \ + /usr/include/qt5/QtCore/qregexp.h \ + /usr/include/qt5/QtCore/qstringmatcher.h \ + /usr/include/qt5/QtCore/qurl.h \ + /usr/include/qt5/QtCore/qurlquery.h \ + /usr/include/qt5/QtCore/qfile.h \ + /usr/include/qt5/QtCore/qfiledevice.h \ + /usr/include/qt5/QtGui/qvector2d.h \ + /usr/include/qt5/QtGui/qtouchdevice.h \ + /usr/include/qt5/QtCore/QTextCodec \ + /usr/include/qt5/QtCore/qtextcodec.h \ + /usr/include/qt5/QtCore/QTextStream \ + /usr/include/qt5/QtCore/QTimer \ + /usr/include/qt5/QtCore/qtimer.h \ + /usr/include/qt5/QtCore/qbasictimer.h \ + /usr/include/qt5/QtGui/QGuiApplication \ + /usr/include/qt5/QtGui/qguiapplication.h \ + /usr/include/qt5/QtCore/qcoreapplication.h \ + /usr/include/qt5/QtCore/qeventloop.h \ + /usr/include/qt5/QtGui/qinputmethod.h \ + /usr/include/qt5/QtGui/QClipboard \ + /usr/include/qt5/QtGui/qclipboard.h \ + /usr/include/qt5/QtCore/QHash \ + /usr/include/qt5/QtCore/QRegExp \ + /usr/include/qt5/QtCore/QThread \ + /usr/include/qt5/QtCore/qthread.h \ + /usr/include/qt5/QtCore/QTime \ + /usr/include/qt5/QtCore/qdatetime.h \ + /usr/include/qt5/QtCore/qsharedpointer.h \ + /usr/include/qt5/QtCore/qsharedpointer_impl.h \ + src/KeyboardTranslator.h \ + /usr/include/qt5/QtCore/QList \ + /usr/include/qt5/QtGui/QKeySequence \ + /usr/include/qt5/QtCore/QMetaType \ + /usr/include/qt5/QtCore/QVarLengthArray \ + src/Screen.h \ + /usr/include/qt5/QtCore/QRect \ + src/Character.h \ + src/CharacterColor.h \ + /usr/include/qt5/QtGui/QColor \ + /usr/include/qt5/QtGui/qcolor.h \ + /usr/include/qt5/QtGui/qrgb.h \ + src/History.h \ + /usr/include/qt5/QtCore/QBitRef \ + /usr/include/qt5/QtCore/qbitarray.h \ + /usr/include/qt5/QtCore/QVector \ + /usr/include/qt5/QtCore/QTemporaryFile \ + /usr/include/qt5/QtCore/qtemporaryfile.h \ + src/BlockArray.h \ + src/TerminalCharacterDecoder.h \ + src/ScreenWindow.h \ + /usr/include/qt5/QtCore/QObject \ + /usr/include/qt5/QtCore/QPoint + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o .obj/Emulation.o src/Emulation.cpp + +.obj/History.o: src/History.cpp src/History.h \ + /usr/include/qt5/QtCore/QBitRef \ + /usr/include/qt5/QtCore/qbitarray.h \ + /usr/include/qt5/QtCore/qbytearray.h \ + /usr/include/qt5/QtCore/qrefcount.h \ + /usr/include/qt5/QtCore/qatomic.h \ + /usr/include/qt5/QtCore/qglobal.h \ + /usr/include/qt5/QtCore/qconfig.h \ + /usr/include/qt5/QtCore/qfeatures.h \ + /usr/include/qt5/QtCore/qsystemdetection.h \ + /usr/include/qt5/QtCore/qprocessordetection.h \ + /usr/include/qt5/QtCore/qcompilerdetection.h \ + /usr/include/qt5/QtCore/qglobalstatic.h \ + /usr/include/qt5/QtCore/qmutex.h \ + /usr/include/qt5/QtCore/qlogging.h \ + /usr/include/qt5/QtCore/qflags.h \ + /usr/include/qt5/QtCore/qtypeinfo.h \ + /usr/include/qt5/QtCore/qtypetraits.h \ + /usr/include/qt5/QtCore/qsysinfo.h \ + /usr/include/qt5/QtCore/qbasicatomic.h \ + /usr/include/qt5/QtCore/qatomic_bootstrap.h \ + /usr/include/qt5/QtCore/qgenericatomic.h \ + /usr/include/qt5/QtCore/qatomic_msvc.h \ + /usr/include/qt5/QtCore/qatomic_integrity.h \ + /usr/include/qt5/QtCore/qoldbasicatomic.h \ + /usr/include/qt5/QtCore/qatomic_vxworks.h \ + /usr/include/qt5/QtCore/qatomic_power.h \ + /usr/include/qt5/QtCore/qatomic_alpha.h \ + /usr/include/qt5/QtCore/qatomic_armv7.h \ + /usr/include/qt5/QtCore/qatomic_armv6.h \ + /usr/include/qt5/QtCore/qatomic_armv5.h \ + /usr/include/qt5/QtCore/qatomic_bfin.h \ + /usr/include/qt5/QtCore/qatomic_ia64.h \ + /usr/include/qt5/QtCore/qatomic_mips.h \ + /usr/include/qt5/QtCore/qatomic_s390.h \ + /usr/include/qt5/QtCore/qatomic_sh4a.h \ + /usr/include/qt5/QtCore/qatomic_sparc.h \ + /usr/include/qt5/QtCore/qatomic_gcc.h \ + /usr/include/qt5/QtCore/qatomic_x86.h \ + /usr/include/qt5/QtCore/qatomic_cxx11.h \ + /usr/include/qt5/QtCore/qatomic_unix.h \ + /usr/include/qt5/QtCore/qnamespace.h \ + /usr/include/qt5/QtCore/qarraydata.h \ + /usr/include/qt5/QtCore/qstring.h \ + /usr/include/qt5/QtCore/qchar.h \ + /usr/include/qt5/QtCore/qstringbuilder.h \ + /usr/include/qt5/QtCore/QHash \ + /usr/include/qt5/QtCore/qhash.h \ + /usr/include/qt5/QtCore/qiterator.h \ + /usr/include/qt5/QtCore/qlist.h \ + /usr/include/qt5/QtCore/qalgorithms.h \ + /usr/include/qt5/QtCore/qpair.h \ + /usr/include/qt5/QtCore/QVector \ + /usr/include/qt5/QtCore/qvector.h \ + /usr/include/qt5/QtCore/qpoint.h \ + /usr/include/qt5/QtCore/QTemporaryFile \ + /usr/include/qt5/QtCore/qtemporaryfile.h \ + /usr/include/qt5/QtCore/qiodevice.h \ + /usr/include/qt5/QtCore/qobject.h \ + /usr/include/qt5/QtCore/qobjectdefs.h \ + /usr/include/qt5/QtCore/qobjectdefs_impl.h \ + /usr/include/qt5/QtCore/qcoreevent.h \ + /usr/include/qt5/QtCore/qscopedpointer.h \ + /usr/include/qt5/QtCore/qmetatype.h \ + /usr/include/qt5/QtCore/qvarlengtharray.h \ + /usr/include/qt5/QtCore/qcontainerfwd.h \ + /usr/include/qt5/QtCore/qisenum.h \ + /usr/include/qt5/QtCore/qobject_impl.h \ + /usr/include/qt5/QtCore/qfile.h \ + /usr/include/qt5/QtCore/qfiledevice.h \ + src/BlockArray.h \ + src/Character.h \ + src/CharacterColor.h \ + /usr/include/qt5/QtGui/QColor \ + /usr/include/qt5/QtGui/qcolor.h \ + /usr/include/qt5/QtGui/qrgb.h \ + /usr/include/qt5/QtCore/qstringlist.h \ + /usr/include/qt5/QtCore/qdatastream.h \ + /usr/include/qt5/QtCore/qregexp.h \ + /usr/include/qt5/QtCore/qstringmatcher.h \ + /usr/include/qt5/QtCore/QtDebug \ + /usr/include/qt5/QtCore/qdebug.h \ + /usr/include/qt5/QtCore/qmap.h \ + /usr/include/qt5/QtCore/qtextstream.h \ + /usr/include/qt5/QtCore/qlocale.h \ + /usr/include/qt5/QtCore/qvariant.h \ + /usr/include/qt5/QtCore/qshareddata.h \ + /usr/include/qt5/QtCore/qset.h \ + /usr/include/qt5/QtCore/qcontiguouscache.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o .obj/History.o src/History.cpp + +.obj/BlockArray.o: src/BlockArray.cpp src/BlockArray.h \ + /usr/include/qt5/QtCore/QtCore \ + /usr/include/qt5/QtCore/QtCoreDepends \ + /usr/include/qt5/QtCore/qabstractanimation.h \ + /usr/include/qt5/QtCore/qobject.h \ + /usr/include/qt5/QtCore/qobjectdefs.h \ + /usr/include/qt5/QtCore/qnamespace.h \ + /usr/include/qt5/QtCore/qglobal.h \ + /usr/include/qt5/QtCore/qconfig.h \ + /usr/include/qt5/QtCore/qfeatures.h \ + /usr/include/qt5/QtCore/qsystemdetection.h \ + /usr/include/qt5/QtCore/qprocessordetection.h \ + /usr/include/qt5/QtCore/qcompilerdetection.h \ + /usr/include/qt5/QtCore/qglobalstatic.h \ + /usr/include/qt5/QtCore/qatomic.h \ + /usr/include/qt5/QtCore/qbasicatomic.h \ + /usr/include/qt5/QtCore/qatomic_bootstrap.h \ + /usr/include/qt5/QtCore/qgenericatomic.h \ + /usr/include/qt5/QtCore/qatomic_msvc.h \ + /usr/include/qt5/QtCore/qatomic_integrity.h \ + /usr/include/qt5/QtCore/qoldbasicatomic.h \ + /usr/include/qt5/QtCore/qatomic_vxworks.h \ + /usr/include/qt5/QtCore/qatomic_power.h \ + /usr/include/qt5/QtCore/qatomic_alpha.h \ + /usr/include/qt5/QtCore/qatomic_armv7.h \ + /usr/include/qt5/QtCore/qatomic_armv6.h \ + /usr/include/qt5/QtCore/qatomic_armv5.h \ + /usr/include/qt5/QtCore/qatomic_bfin.h \ + /usr/include/qt5/QtCore/qatomic_ia64.h \ + /usr/include/qt5/QtCore/qatomic_mips.h \ + /usr/include/qt5/QtCore/qatomic_s390.h \ + /usr/include/qt5/QtCore/qatomic_sh4a.h \ + /usr/include/qt5/QtCore/qatomic_sparc.h \ + /usr/include/qt5/QtCore/qatomic_gcc.h \ + /usr/include/qt5/QtCore/qatomic_x86.h \ + /usr/include/qt5/QtCore/qatomic_cxx11.h \ + /usr/include/qt5/QtCore/qatomic_unix.h \ + /usr/include/qt5/QtCore/qmutex.h \ + /usr/include/qt5/QtCore/qlogging.h \ + /usr/include/qt5/QtCore/qflags.h \ + /usr/include/qt5/QtCore/qtypeinfo.h \ + /usr/include/qt5/QtCore/qtypetraits.h \ + /usr/include/qt5/QtCore/qsysinfo.h \ + /usr/include/qt5/QtCore/qobjectdefs_impl.h \ + /usr/include/qt5/QtCore/qstring.h \ + /usr/include/qt5/QtCore/qchar.h \ + /usr/include/qt5/QtCore/qbytearray.h \ + /usr/include/qt5/QtCore/qrefcount.h \ + /usr/include/qt5/QtCore/qarraydata.h \ + /usr/include/qt5/QtCore/qstringbuilder.h \ + /usr/include/qt5/QtCore/qlist.h \ + /usr/include/qt5/QtCore/qalgorithms.h \ + /usr/include/qt5/QtCore/qiterator.h \ + /usr/include/qt5/QtCore/qcoreevent.h \ + /usr/include/qt5/QtCore/qscopedpointer.h \ + /usr/include/qt5/QtCore/qmetatype.h \ + /usr/include/qt5/QtCore/qvarlengtharray.h \ + /usr/include/qt5/QtCore/qcontainerfwd.h \ + /usr/include/qt5/QtCore/qisenum.h \ + /usr/include/qt5/QtCore/qobject_impl.h \ + /usr/include/qt5/QtCore/qanimationgroup.h \ + /usr/include/qt5/QtCore/qparallelanimationgroup.h \ + /usr/include/qt5/QtCore/qpauseanimation.h \ + /usr/include/qt5/QtCore/qpropertyanimation.h \ + /usr/include/qt5/QtCore/qvariantanimation.h \ + /usr/include/qt5/QtCore/qeasingcurve.h \ + /usr/include/qt5/QtCore/qvector.h \ + /usr/include/qt5/QtCore/qpoint.h \ + /usr/include/qt5/QtCore/qvariant.h \ + /usr/include/qt5/QtCore/qmap.h \ + /usr/include/qt5/QtCore/qpair.h \ + /usr/include/qt5/QtCore/qdebug.h \ + /usr/include/qt5/QtCore/qhash.h \ + /usr/include/qt5/QtCore/qtextstream.h \ + /usr/include/qt5/QtCore/qiodevice.h \ + /usr/include/qt5/QtCore/qlocale.h \ + /usr/include/qt5/QtCore/qshareddata.h \ + /usr/include/qt5/QtCore/qset.h \ + /usr/include/qt5/QtCore/qcontiguouscache.h \ + /usr/include/qt5/QtCore/qstringlist.h \ + /usr/include/qt5/QtCore/qdatastream.h \ + /usr/include/qt5/QtCore/qregexp.h \ + /usr/include/qt5/QtCore/qstringmatcher.h \ + /usr/include/qt5/QtCore/qsequentialanimationgroup.h \ + /usr/include/qt5/QtCore/qtextcodec.h \ + /usr/include/qt5/QtCore/qendian.h \ + /usr/include/qt5/QtCore/qlibraryinfo.h \ + /usr/include/qt5/QtCore/qdatetime.h \ + /usr/include/qt5/QtCore/qsharedpointer.h \ + /usr/include/qt5/QtCore/qsharedpointer_impl.h \ + /usr/include/qt5/QtCore/qnumeric.h \ + /usr/include/qt5/QtCore/qbuffer.h \ + /usr/include/qt5/QtCore/qdir.h \ + /usr/include/qt5/QtCore/qfileinfo.h \ + /usr/include/qt5/QtCore/qfile.h \ + /usr/include/qt5/QtCore/qfiledevice.h \ + /usr/include/qt5/QtCore/qdiriterator.h \ + /usr/include/qt5/QtCore/qfileselector.h \ + /usr/include/qt5/QtCore/QObject \ + /usr/include/qt5/QtCore/QStringList \ + /usr/include/qt5/QtCore/qfilesystemwatcher.h \ + /usr/include/qt5/QtCore/qlockfile.h \ + /usr/include/qt5/QtCore/qloggingcategory.h \ + /usr/include/qt5/QtCore/qprocess.h \ + /usr/include/qt5/QtCore/qresource.h \ + /usr/include/qt5/QtCore/qsavefile.h \ + /usr/include/qt5/QtCore/qsettings.h \ + /usr/include/qt5/QtCore/qstandardpaths.h \ + /usr/include/qt5/QtCore/qtemporarydir.h \ + /usr/include/qt5/QtCore/QScopedPointer \ + /usr/include/qt5/QtCore/qtemporaryfile.h \ + /usr/include/qt5/QtCore/qurl.h \ + /usr/include/qt5/QtCore/qurlquery.h \ + /usr/include/qt5/QtCore/qabstractitemmodel.h \ + /usr/include/qt5/QtCore/qabstractproxymodel.h \ + /usr/include/qt5/QtCore/qidentityproxymodel.h \ + /usr/include/qt5/QtCore/qitemselectionmodel.h \ + /usr/include/qt5/QtCore/qsortfilterproxymodel.h \ + /usr/include/qt5/QtCore/qstringlistmodel.h \ + /usr/include/qt5/QtCore/qjsonarray.h \ + /usr/include/qt5/QtCore/qjsonvalue.h \ + /usr/include/qt5/QtCore/qjsondocument.h \ + /usr/include/qt5/QtCore/qjsonobject.h \ + /usr/include/qt5/QtCore/qabstracteventdispatcher.h \ + /usr/include/qt5/QtCore/qeventloop.h \ + /usr/include/qt5/QtCore/qabstractnativeeventfilter.h \ + /usr/include/qt5/QtCore/qbasictimer.h \ + /usr/include/qt5/QtCore/qcoreapplication.h \ + /usr/include/qt5/QtCore/qmath.h \ + /usr/include/qt5/QtCore/qmetaobject.h \ + /usr/include/qt5/QtCore/qmimedata.h \ + /usr/include/qt5/QtCore/qobjectcleanuphandler.h \ + /usr/include/qt5/QtCore/qpointer.h \ + /usr/include/qt5/QtCore/qsharedmemory.h \ + /usr/include/qt5/QtCore/qsignalmapper.h \ + /usr/include/qt5/QtCore/qsocketnotifier.h \ + /usr/include/qt5/QtCore/qsystemsemaphore.h \ + /usr/include/qt5/QtCore/qtimer.h \ + /usr/include/qt5/QtCore/qtranslator.h \ + /usr/include/qt5/QtCore/qwineventnotifier.h \ + /usr/include/qt5/QtCore/qmimedatabase.h \ + /usr/include/qt5/QtCore/qmimetype.h \ + /usr/include/qt5/QtCore/qfactoryinterface.h \ + /usr/include/qt5/QtCore/qlibrary.h \ + /usr/include/qt5/QtCore/qplugin.h \ + /usr/include/qt5/QtCore/qpluginloader.h \ + /usr/include/qt5/QtCore/quuid.h \ + /usr/include/qt5/QtCore/qabstractstate.h \ + /usr/include/qt5/QtCore/qabstracttransition.h \ + /usr/include/qt5/QtCore/qeventtransition.h \ + /usr/include/qt5/QtCore/qfinalstate.h \ + /usr/include/qt5/QtCore/qhistorystate.h \ + /usr/include/qt5/QtCore/qsignaltransition.h \ + /usr/include/qt5/QtCore/qstate.h \ + /usr/include/qt5/QtCore/qstatemachine.h \ + /usr/include/qt5/QtCore/qexception.h \ + /usr/include/qt5/QtCore/qfuture.h \ + /usr/include/qt5/QtCore/qfutureinterface.h \ + /usr/include/qt5/QtCore/qrunnable.h \ + /usr/include/qt5/QtCore/qresultstore.h \ + /usr/include/qt5/QtCore/qfuturesynchronizer.h \ + /usr/include/qt5/QtCore/qfuturewatcher.h \ + /usr/include/qt5/QtCore/qreadwritelock.h \ + /usr/include/qt5/QtCore/qsemaphore.h \ + /usr/include/qt5/QtCore/qthread.h \ + /usr/include/qt5/QtCore/qthreadpool.h \ + /usr/include/qt5/QtCore/qthreadstorage.h \ + /usr/include/qt5/QtCore/qwaitcondition.h \ + /usr/include/qt5/QtCore/qarraydataops.h \ + /usr/include/qt5/QtCore/qarraydatapointer.h \ + /usr/include/qt5/QtCore/qbitarray.h \ + /usr/include/qt5/QtCore/qbytearraymatcher.h \ + /usr/include/qt5/QtCore/qcache.h \ + /usr/include/qt5/QtCore/qcollator.h \ + /usr/include/qt5/QtCore/qcommandlineoption.h \ + /usr/include/qt5/QtCore/qcommandlineparser.h \ + /usr/include/qt5/QtCore/qcryptographichash.h \ + /usr/include/qt5/QtCore/qelapsedtimer.h \ + /usr/include/qt5/QtCore/qline.h \ + /usr/include/qt5/QtCore/qlinkedlist.h \ + /usr/include/qt5/QtCore/qmargins.h \ + /usr/include/qt5/QtCore/qrect.h \ + /usr/include/qt5/QtCore/qsize.h \ + /usr/include/qt5/QtCore/qmessageauthenticationcode.h \ + /usr/include/qt5/QtCore/qqueue.h \ + /usr/include/qt5/QtCore/qregularexpression.h \ + /usr/include/qt5/QtCore/qscopedvaluerollback.h \ + /usr/include/qt5/QtCore/qstack.h \ + /usr/include/qt5/QtCore/qtextboundaryfinder.h \ + /usr/include/qt5/QtCore/qtimeline.h \ + /usr/include/qt5/QtCore/qtimezone.h \ + /usr/include/qt5/QtCore/qxmlstream.h \ + /usr/include/qt5/QtCore/qtcoreversion.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o .obj/BlockArray.o src/BlockArray.cpp + +.obj/TerminalCharacterDecoder.o: src/TerminalCharacterDecoder.cpp src/TerminalCharacterDecoder.h \ + src/Character.h \ + /usr/include/qt5/QtCore/QHash \ + /usr/include/qt5/QtCore/qhash.h \ + /usr/include/qt5/QtCore/qchar.h \ + /usr/include/qt5/QtCore/qglobal.h \ + /usr/include/qt5/QtCore/qconfig.h \ + /usr/include/qt5/QtCore/qfeatures.h \ + /usr/include/qt5/QtCore/qsystemdetection.h \ + /usr/include/qt5/QtCore/qprocessordetection.h \ + /usr/include/qt5/QtCore/qcompilerdetection.h \ + /usr/include/qt5/QtCore/qglobalstatic.h \ + /usr/include/qt5/QtCore/qatomic.h \ + /usr/include/qt5/QtCore/qbasicatomic.h \ + /usr/include/qt5/QtCore/qatomic_bootstrap.h \ + /usr/include/qt5/QtCore/qgenericatomic.h \ + /usr/include/qt5/QtCore/qatomic_msvc.h \ + /usr/include/qt5/QtCore/qatomic_integrity.h \ + /usr/include/qt5/QtCore/qoldbasicatomic.h \ + /usr/include/qt5/QtCore/qatomic_vxworks.h \ + /usr/include/qt5/QtCore/qatomic_power.h \ + /usr/include/qt5/QtCore/qatomic_alpha.h \ + /usr/include/qt5/QtCore/qatomic_armv7.h \ + /usr/include/qt5/QtCore/qatomic_armv6.h \ + /usr/include/qt5/QtCore/qatomic_armv5.h \ + /usr/include/qt5/QtCore/qatomic_bfin.h \ + /usr/include/qt5/QtCore/qatomic_ia64.h \ + /usr/include/qt5/QtCore/qatomic_mips.h \ + /usr/include/qt5/QtCore/qatomic_s390.h \ + /usr/include/qt5/QtCore/qatomic_sh4a.h \ + /usr/include/qt5/QtCore/qatomic_sparc.h \ + /usr/include/qt5/QtCore/qatomic_gcc.h \ + /usr/include/qt5/QtCore/qatomic_x86.h \ + /usr/include/qt5/QtCore/qatomic_cxx11.h \ + /usr/include/qt5/QtCore/qatomic_unix.h \ + /usr/include/qt5/QtCore/qmutex.h \ + /usr/include/qt5/QtCore/qlogging.h \ + /usr/include/qt5/QtCore/qflags.h \ + /usr/include/qt5/QtCore/qtypeinfo.h \ + /usr/include/qt5/QtCore/qtypetraits.h \ + /usr/include/qt5/QtCore/qsysinfo.h \ + /usr/include/qt5/QtCore/qiterator.h \ + /usr/include/qt5/QtCore/qlist.h \ + /usr/include/qt5/QtCore/qalgorithms.h \ + /usr/include/qt5/QtCore/qrefcount.h \ + /usr/include/qt5/QtCore/qpair.h \ + src/CharacterColor.h \ + /usr/include/qt5/QtGui/QColor \ + /usr/include/qt5/QtGui/qcolor.h \ + /usr/include/qt5/QtGui/qrgb.h \ + /usr/include/qt5/QtCore/qnamespace.h \ + /usr/include/qt5/QtCore/qstringlist.h \ + /usr/include/qt5/QtCore/qdatastream.h \ + /usr/include/qt5/QtCore/qscopedpointer.h \ + /usr/include/qt5/QtCore/qiodevice.h \ + /usr/include/qt5/QtCore/qobject.h \ + /usr/include/qt5/QtCore/qobjectdefs.h \ + /usr/include/qt5/QtCore/qobjectdefs_impl.h \ + /usr/include/qt5/QtCore/qstring.h \ + /usr/include/qt5/QtCore/qbytearray.h \ + /usr/include/qt5/QtCore/qarraydata.h \ + /usr/include/qt5/QtCore/qstringbuilder.h \ + /usr/include/qt5/QtCore/qcoreevent.h \ + /usr/include/qt5/QtCore/qmetatype.h \ + /usr/include/qt5/QtCore/qvarlengtharray.h \ + /usr/include/qt5/QtCore/qcontainerfwd.h \ + /usr/include/qt5/QtCore/qisenum.h \ + /usr/include/qt5/QtCore/qobject_impl.h \ + /usr/include/qt5/QtCore/qregexp.h \ + /usr/include/qt5/QtCore/qstringmatcher.h \ + /usr/include/qt5/QtCore/QList \ + /usr/include/qt5/QtCore/QTextStream \ + /usr/include/qt5/QtCore/qtextstream.h \ + /usr/include/qt5/QtCore/qlocale.h \ + /usr/include/qt5/QtCore/qvariant.h \ + /usr/include/qt5/QtCore/qmap.h \ + /usr/include/qt5/QtCore/qdebug.h \ + /usr/include/qt5/QtCore/qvector.h \ + /usr/include/qt5/QtCore/qpoint.h \ + /usr/include/qt5/QtCore/qset.h \ + /usr/include/qt5/QtCore/qcontiguouscache.h \ + /usr/include/qt5/QtCore/qshareddata.h \ + src/konsole_wcwidth.h \ + /usr/include/qt5/QtCore/QString + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o .obj/TerminalCharacterDecoder.o src/TerminalCharacterDecoder.cpp + +.obj/konsole_wcwidth.o: src/konsole_wcwidth.cpp src/konsole_wcwidth.h \ + /usr/include/qt5/QtCore/QString \ + /usr/include/qt5/QtCore/qstring.h \ + /usr/include/qt5/QtCore/qchar.h \ + /usr/include/qt5/QtCore/qglobal.h \ + /usr/include/qt5/QtCore/qconfig.h \ + /usr/include/qt5/QtCore/qfeatures.h \ + /usr/include/qt5/QtCore/qsystemdetection.h \ + /usr/include/qt5/QtCore/qprocessordetection.h \ + /usr/include/qt5/QtCore/qcompilerdetection.h \ + /usr/include/qt5/QtCore/qglobalstatic.h \ + /usr/include/qt5/QtCore/qatomic.h \ + /usr/include/qt5/QtCore/qbasicatomic.h \ + /usr/include/qt5/QtCore/qatomic_bootstrap.h \ + /usr/include/qt5/QtCore/qgenericatomic.h \ + /usr/include/qt5/QtCore/qatomic_msvc.h \ + /usr/include/qt5/QtCore/qatomic_integrity.h \ + /usr/include/qt5/QtCore/qoldbasicatomic.h \ + /usr/include/qt5/QtCore/qatomic_vxworks.h \ + /usr/include/qt5/QtCore/qatomic_power.h \ + /usr/include/qt5/QtCore/qatomic_alpha.h \ + /usr/include/qt5/QtCore/qatomic_armv7.h \ + /usr/include/qt5/QtCore/qatomic_armv6.h \ + /usr/include/qt5/QtCore/qatomic_armv5.h \ + /usr/include/qt5/QtCore/qatomic_bfin.h \ + /usr/include/qt5/QtCore/qatomic_ia64.h \ + /usr/include/qt5/QtCore/qatomic_mips.h \ + /usr/include/qt5/QtCore/qatomic_s390.h \ + /usr/include/qt5/QtCore/qatomic_sh4a.h \ + /usr/include/qt5/QtCore/qatomic_sparc.h \ + /usr/include/qt5/QtCore/qatomic_gcc.h \ + /usr/include/qt5/QtCore/qatomic_x86.h \ + /usr/include/qt5/QtCore/qatomic_cxx11.h \ + /usr/include/qt5/QtCore/qatomic_unix.h \ + /usr/include/qt5/QtCore/qmutex.h \ + /usr/include/qt5/QtCore/qlogging.h \ + /usr/include/qt5/QtCore/qflags.h \ + /usr/include/qt5/QtCore/qtypeinfo.h \ + /usr/include/qt5/QtCore/qtypetraits.h \ + /usr/include/qt5/QtCore/qsysinfo.h \ + /usr/include/qt5/QtCore/qbytearray.h \ + /usr/include/qt5/QtCore/qrefcount.h \ + /usr/include/qt5/QtCore/qnamespace.h \ + /usr/include/qt5/QtCore/qarraydata.h \ + /usr/include/qt5/QtCore/qstringbuilder.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o .obj/konsole_wcwidth.o src/konsole_wcwidth.cpp + +.obj/ScreenWindow.o: src/ScreenWindow.cpp src/ScreenWindow.h \ + /usr/include/qt5/QtCore/QObject \ + /usr/include/qt5/QtCore/qobject.h \ + /usr/include/qt5/QtCore/qobjectdefs.h \ + /usr/include/qt5/QtCore/qnamespace.h \ + /usr/include/qt5/QtCore/qglobal.h \ + /usr/include/qt5/QtCore/qconfig.h \ + /usr/include/qt5/QtCore/qfeatures.h \ + /usr/include/qt5/QtCore/qsystemdetection.h \ + /usr/include/qt5/QtCore/qprocessordetection.h \ + /usr/include/qt5/QtCore/qcompilerdetection.h \ + /usr/include/qt5/QtCore/qglobalstatic.h \ + /usr/include/qt5/QtCore/qatomic.h \ + /usr/include/qt5/QtCore/qbasicatomic.h \ + /usr/include/qt5/QtCore/qatomic_bootstrap.h \ + /usr/include/qt5/QtCore/qgenericatomic.h \ + /usr/include/qt5/QtCore/qatomic_msvc.h \ + /usr/include/qt5/QtCore/qatomic_integrity.h \ + /usr/include/qt5/QtCore/qoldbasicatomic.h \ + /usr/include/qt5/QtCore/qatomic_vxworks.h \ + /usr/include/qt5/QtCore/qatomic_power.h \ + /usr/include/qt5/QtCore/qatomic_alpha.h \ + /usr/include/qt5/QtCore/qatomic_armv7.h \ + /usr/include/qt5/QtCore/qatomic_armv6.h \ + /usr/include/qt5/QtCore/qatomic_armv5.h \ + /usr/include/qt5/QtCore/qatomic_bfin.h \ + /usr/include/qt5/QtCore/qatomic_ia64.h \ + /usr/include/qt5/QtCore/qatomic_mips.h \ + /usr/include/qt5/QtCore/qatomic_s390.h \ + /usr/include/qt5/QtCore/qatomic_sh4a.h \ + /usr/include/qt5/QtCore/qatomic_sparc.h \ + /usr/include/qt5/QtCore/qatomic_gcc.h \ + /usr/include/qt5/QtCore/qatomic_x86.h \ + /usr/include/qt5/QtCore/qatomic_cxx11.h \ + /usr/include/qt5/QtCore/qatomic_unix.h \ + /usr/include/qt5/QtCore/qmutex.h \ + /usr/include/qt5/QtCore/qlogging.h \ + /usr/include/qt5/QtCore/qflags.h \ + /usr/include/qt5/QtCore/qtypeinfo.h \ + /usr/include/qt5/QtCore/qtypetraits.h \ + /usr/include/qt5/QtCore/qsysinfo.h \ + /usr/include/qt5/QtCore/qobjectdefs_impl.h \ + /usr/include/qt5/QtCore/qstring.h \ + /usr/include/qt5/QtCore/qchar.h \ + /usr/include/qt5/QtCore/qbytearray.h \ + /usr/include/qt5/QtCore/qrefcount.h \ + /usr/include/qt5/QtCore/qarraydata.h \ + /usr/include/qt5/QtCore/qstringbuilder.h \ + /usr/include/qt5/QtCore/qlist.h \ + /usr/include/qt5/QtCore/qalgorithms.h \ + /usr/include/qt5/QtCore/qiterator.h \ + /usr/include/qt5/QtCore/qcoreevent.h \ + /usr/include/qt5/QtCore/qscopedpointer.h \ + /usr/include/qt5/QtCore/qmetatype.h \ + /usr/include/qt5/QtCore/qvarlengtharray.h \ + /usr/include/qt5/QtCore/qcontainerfwd.h \ + /usr/include/qt5/QtCore/qisenum.h \ + /usr/include/qt5/QtCore/qobject_impl.h \ + /usr/include/qt5/QtCore/QPoint \ + /usr/include/qt5/QtCore/qpoint.h \ + /usr/include/qt5/QtCore/QRect \ + /usr/include/qt5/QtCore/qrect.h \ + /usr/include/qt5/QtCore/qsize.h \ + src/Character.h \ + /usr/include/qt5/QtCore/QHash \ + /usr/include/qt5/QtCore/qhash.h \ + /usr/include/qt5/QtCore/qpair.h \ + src/CharacterColor.h \ + /usr/include/qt5/QtGui/QColor \ + /usr/include/qt5/QtGui/qcolor.h \ + /usr/include/qt5/QtGui/qrgb.h \ + /usr/include/qt5/QtCore/qstringlist.h \ + /usr/include/qt5/QtCore/qdatastream.h \ + /usr/include/qt5/QtCore/qiodevice.h \ + /usr/include/qt5/QtCore/qregexp.h \ + /usr/include/qt5/QtCore/qstringmatcher.h \ + /usr/include/qt5/QtCore/QtDebug \ + /usr/include/qt5/QtCore/qdebug.h \ + /usr/include/qt5/QtCore/qmap.h \ + /usr/include/qt5/QtCore/qtextstream.h \ + /usr/include/qt5/QtCore/qlocale.h \ + /usr/include/qt5/QtCore/qvariant.h \ + /usr/include/qt5/QtCore/qshareddata.h \ + /usr/include/qt5/QtCore/qvector.h \ + /usr/include/qt5/QtCore/qset.h \ + /usr/include/qt5/QtCore/qcontiguouscache.h \ + src/Screen.h \ + /usr/include/qt5/QtCore/QTextStream \ + /usr/include/qt5/QtCore/QVarLengthArray \ + src/History.h \ + /usr/include/qt5/QtCore/QBitRef \ + /usr/include/qt5/QtCore/qbitarray.h \ + /usr/include/qt5/QtCore/QVector \ + /usr/include/qt5/QtCore/QTemporaryFile \ + /usr/include/qt5/QtCore/qtemporaryfile.h \ + /usr/include/qt5/QtCore/qfile.h \ + /usr/include/qt5/QtCore/qfiledevice.h \ + src/BlockArray.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o .obj/ScreenWindow.o src/ScreenWindow.cpp + +.obj/Filter.o: src/Filter.cpp src/Filter.h \ + /usr/include/qt5/QtWidgets/QAction \ + /usr/include/qt5/QtWidgets/qaction.h \ + /usr/include/qt5/QtGui/qkeysequence.h \ + /usr/include/qt5/QtCore/qnamespace.h \ + /usr/include/qt5/QtCore/qglobal.h \ + /usr/include/qt5/QtCore/qconfig.h \ + /usr/include/qt5/QtCore/qfeatures.h \ + /usr/include/qt5/QtCore/qsystemdetection.h \ + /usr/include/qt5/QtCore/qprocessordetection.h \ + /usr/include/qt5/QtCore/qcompilerdetection.h \ + /usr/include/qt5/QtCore/qglobalstatic.h \ + /usr/include/qt5/QtCore/qatomic.h \ + /usr/include/qt5/QtCore/qbasicatomic.h \ + /usr/include/qt5/QtCore/qatomic_bootstrap.h \ + /usr/include/qt5/QtCore/qgenericatomic.h \ + /usr/include/qt5/QtCore/qatomic_msvc.h \ + /usr/include/qt5/QtCore/qatomic_integrity.h \ + /usr/include/qt5/QtCore/qoldbasicatomic.h \ + /usr/include/qt5/QtCore/qatomic_vxworks.h \ + /usr/include/qt5/QtCore/qatomic_power.h \ + /usr/include/qt5/QtCore/qatomic_alpha.h \ + /usr/include/qt5/QtCore/qatomic_armv7.h \ + /usr/include/qt5/QtCore/qatomic_armv6.h \ + /usr/include/qt5/QtCore/qatomic_armv5.h \ + /usr/include/qt5/QtCore/qatomic_bfin.h \ + /usr/include/qt5/QtCore/qatomic_ia64.h \ + /usr/include/qt5/QtCore/qatomic_mips.h \ + /usr/include/qt5/QtCore/qatomic_s390.h \ + /usr/include/qt5/QtCore/qatomic_sh4a.h \ + /usr/include/qt5/QtCore/qatomic_sparc.h \ + /usr/include/qt5/QtCore/qatomic_gcc.h \ + /usr/include/qt5/QtCore/qatomic_x86.h \ + /usr/include/qt5/QtCore/qatomic_cxx11.h \ + /usr/include/qt5/QtCore/qatomic_unix.h \ + /usr/include/qt5/QtCore/qmutex.h \ + /usr/include/qt5/QtCore/qlogging.h \ + /usr/include/qt5/QtCore/qflags.h \ + /usr/include/qt5/QtCore/qtypeinfo.h \ + /usr/include/qt5/QtCore/qtypetraits.h \ + /usr/include/qt5/QtCore/qsysinfo.h \ + /usr/include/qt5/QtCore/qstring.h \ + /usr/include/qt5/QtCore/qchar.h \ + /usr/include/qt5/QtCore/qbytearray.h \ + /usr/include/qt5/QtCore/qrefcount.h \ + /usr/include/qt5/QtCore/qarraydata.h \ + /usr/include/qt5/QtCore/qstringbuilder.h \ + /usr/include/qt5/QtCore/qobjectdefs.h \ + /usr/include/qt5/QtCore/qobjectdefs_impl.h \ + /usr/include/qt5/QtWidgets/qwidget.h \ + /usr/include/qt5/QtGui/qwindowdefs.h \ + /usr/include/qt5/QtGui/qwindowdefs_win.h \ + /usr/include/qt5/QtCore/qobject.h \ + /usr/include/qt5/QtCore/qlist.h \ + /usr/include/qt5/QtCore/qalgorithms.h \ + /usr/include/qt5/QtCore/qiterator.h \ + /usr/include/qt5/QtCore/qcoreevent.h \ + /usr/include/qt5/QtCore/qscopedpointer.h \ + /usr/include/qt5/QtCore/qmetatype.h \ + /usr/include/qt5/QtCore/qvarlengtharray.h \ + /usr/include/qt5/QtCore/qcontainerfwd.h \ + /usr/include/qt5/QtCore/qisenum.h \ + /usr/include/qt5/QtCore/qobject_impl.h \ + /usr/include/qt5/QtCore/qmargins.h \ + /usr/include/qt5/QtCore/qrect.h \ + /usr/include/qt5/QtCore/qsize.h \ + /usr/include/qt5/QtCore/qpoint.h \ + /usr/include/qt5/QtGui/qpaintdevice.h \ + /usr/include/qt5/QtGui/qpalette.h \ + /usr/include/qt5/QtGui/qcolor.h \ + /usr/include/qt5/QtGui/qrgb.h \ + /usr/include/qt5/QtCore/qstringlist.h \ + /usr/include/qt5/QtCore/qdatastream.h \ + /usr/include/qt5/QtCore/qiodevice.h \ + /usr/include/qt5/QtCore/qpair.h \ + /usr/include/qt5/QtCore/qregexp.h \ + /usr/include/qt5/QtCore/qstringmatcher.h \ + /usr/include/qt5/QtGui/qbrush.h \ + /usr/include/qt5/QtCore/qvector.h \ + /usr/include/qt5/QtGui/qmatrix.h \ + /usr/include/qt5/QtGui/qpolygon.h \ + /usr/include/qt5/QtGui/qregion.h \ + /usr/include/qt5/QtCore/qline.h \ + /usr/include/qt5/QtGui/qtransform.h \ + /usr/include/qt5/QtGui/qpainterpath.h \ + /usr/include/qt5/QtGui/qimage.h \ + /usr/include/qt5/QtGui/qpixmap.h \ + /usr/include/qt5/QtCore/qsharedpointer.h \ + /usr/include/qt5/QtCore/qshareddata.h \ + /usr/include/qt5/QtCore/qsharedpointer_impl.h \ + /usr/include/qt5/QtCore/qhash.h \ + /usr/include/qt5/QtGui/qfont.h \ + /usr/include/qt5/QtGui/qfontmetrics.h \ + /usr/include/qt5/QtGui/qfontinfo.h \ + /usr/include/qt5/QtWidgets/qsizepolicy.h \ + /usr/include/qt5/QtGui/qcursor.h \ + /usr/include/qt5/QtGui/qevent.h \ + /usr/include/qt5/QtCore/qvariant.h \ + /usr/include/qt5/QtCore/qmap.h \ + /usr/include/qt5/QtCore/qdebug.h \ + /usr/include/qt5/QtCore/qtextstream.h \ + /usr/include/qt5/QtCore/qlocale.h \ + /usr/include/qt5/QtCore/qset.h \ + /usr/include/qt5/QtCore/qcontiguouscache.h \ + /usr/include/qt5/QtCore/qurl.h \ + /usr/include/qt5/QtCore/qurlquery.h \ + /usr/include/qt5/QtCore/qfile.h \ + /usr/include/qt5/QtCore/qfiledevice.h \ + /usr/include/qt5/QtGui/qvector2d.h \ + /usr/include/qt5/QtGui/qtouchdevice.h \ + /usr/include/qt5/QtGui/qicon.h \ + /usr/include/qt5/QtWidgets/qactiongroup.h \ + /usr/include/qt5/QtCore/QList \ + /usr/include/qt5/QtCore/QObject \ + /usr/include/qt5/QtCore/QStringList \ + /usr/include/qt5/QtCore/QHash \ + /usr/include/qt5/QtCore/QRegExp \ + src/Character.h \ + src/CharacterColor.h \ + /usr/include/qt5/QtGui/QColor \ + /usr/include/qt5/QtWidgets/QApplication \ + /usr/include/qt5/QtWidgets/qapplication.h \ + /usr/include/qt5/QtCore/qcoreapplication.h \ + /usr/include/qt5/QtCore/qeventloop.h \ + /usr/include/qt5/QtWidgets/qdesktopwidget.h \ + /usr/include/qt5/QtGui/qguiapplication.h \ + /usr/include/qt5/QtGui/qinputmethod.h \ + /usr/include/qt5/QtGui/QClipboard \ + /usr/include/qt5/QtGui/qclipboard.h \ + /usr/include/qt5/QtCore/QString \ + /usr/include/qt5/QtCore/QTextStream \ + /usr/include/qt5/QtCore/QSharedData \ + /usr/include/qt5/QtCore/QFile \ + /usr/include/qt5/QtGui/QDesktopServices \ + /usr/include/qt5/QtGui/qdesktopservices.h \ + /usr/include/qt5/QtCore/qstandardpaths.h \ + /usr/include/qt5/QtCore/QUrl \ + src/TerminalCharacterDecoder.h \ + src/konsole_wcwidth.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o .obj/Filter.o src/Filter.cpp + +.obj/ColorScheme.o: src/ColorScheme.cpp src/ColorScheme.h \ + /usr/include/qt5/QtCore/QHash \ + /usr/include/qt5/QtCore/qhash.h \ + /usr/include/qt5/QtCore/qchar.h \ + /usr/include/qt5/QtCore/qglobal.h \ + /usr/include/qt5/QtCore/qconfig.h \ + /usr/include/qt5/QtCore/qfeatures.h \ + /usr/include/qt5/QtCore/qsystemdetection.h \ + /usr/include/qt5/QtCore/qprocessordetection.h \ + /usr/include/qt5/QtCore/qcompilerdetection.h \ + /usr/include/qt5/QtCore/qglobalstatic.h \ + /usr/include/qt5/QtCore/qatomic.h \ + /usr/include/qt5/QtCore/qbasicatomic.h \ + /usr/include/qt5/QtCore/qatomic_bootstrap.h \ + /usr/include/qt5/QtCore/qgenericatomic.h \ + /usr/include/qt5/QtCore/qatomic_msvc.h \ + /usr/include/qt5/QtCore/qatomic_integrity.h \ + /usr/include/qt5/QtCore/qoldbasicatomic.h \ + /usr/include/qt5/QtCore/qatomic_vxworks.h \ + /usr/include/qt5/QtCore/qatomic_power.h \ + /usr/include/qt5/QtCore/qatomic_alpha.h \ + /usr/include/qt5/QtCore/qatomic_armv7.h \ + /usr/include/qt5/QtCore/qatomic_armv6.h \ + /usr/include/qt5/QtCore/qatomic_armv5.h \ + /usr/include/qt5/QtCore/qatomic_bfin.h \ + /usr/include/qt5/QtCore/qatomic_ia64.h \ + /usr/include/qt5/QtCore/qatomic_mips.h \ + /usr/include/qt5/QtCore/qatomic_s390.h \ + /usr/include/qt5/QtCore/qatomic_sh4a.h \ + /usr/include/qt5/QtCore/qatomic_sparc.h \ + /usr/include/qt5/QtCore/qatomic_gcc.h \ + /usr/include/qt5/QtCore/qatomic_x86.h \ + /usr/include/qt5/QtCore/qatomic_cxx11.h \ + /usr/include/qt5/QtCore/qatomic_unix.h \ + /usr/include/qt5/QtCore/qmutex.h \ + /usr/include/qt5/QtCore/qlogging.h \ + /usr/include/qt5/QtCore/qflags.h \ + /usr/include/qt5/QtCore/qtypeinfo.h \ + /usr/include/qt5/QtCore/qtypetraits.h \ + /usr/include/qt5/QtCore/qsysinfo.h \ + /usr/include/qt5/QtCore/qiterator.h \ + /usr/include/qt5/QtCore/qlist.h \ + /usr/include/qt5/QtCore/qalgorithms.h \ + /usr/include/qt5/QtCore/qrefcount.h \ + /usr/include/qt5/QtCore/qpair.h \ + /usr/include/qt5/QtCore/QList \ + /usr/include/qt5/QtCore/QMetaType \ + /usr/include/qt5/QtCore/qmetatype.h \ + /usr/include/qt5/QtCore/qbytearray.h \ + /usr/include/qt5/QtCore/qnamespace.h \ + /usr/include/qt5/QtCore/qarraydata.h \ + /usr/include/qt5/QtCore/qstring.h \ + /usr/include/qt5/QtCore/qstringbuilder.h \ + /usr/include/qt5/QtCore/qvarlengtharray.h \ + /usr/include/qt5/QtCore/qcontainerfwd.h \ + /usr/include/qt5/QtCore/qisenum.h \ + /usr/include/qt5/QtCore/qobjectdefs.h \ + /usr/include/qt5/QtCore/qobjectdefs_impl.h \ + /usr/include/qt5/QtCore/QIODevice \ + /usr/include/qt5/QtCore/qiodevice.h \ + /usr/include/qt5/QtCore/qobject.h \ + /usr/include/qt5/QtCore/qcoreevent.h \ + /usr/include/qt5/QtCore/qscopedpointer.h \ + /usr/include/qt5/QtCore/qobject_impl.h \ + /usr/include/qt5/QtCore/QSet \ + /usr/include/qt5/QtCore/qset.h \ + /usr/include/qt5/QtCore/QSettings \ + /usr/include/qt5/QtCore/qsettings.h \ + /usr/include/qt5/QtCore/qvariant.h \ + /usr/include/qt5/QtCore/qmap.h \ + /usr/include/qt5/QtCore/qdebug.h \ + /usr/include/qt5/QtCore/qtextstream.h \ + /usr/include/qt5/QtCore/qlocale.h \ + /usr/include/qt5/QtCore/qshareddata.h \ + /usr/include/qt5/QtCore/qvector.h \ + /usr/include/qt5/QtCore/qpoint.h \ + /usr/include/qt5/QtCore/qcontiguouscache.h \ + /usr/include/qt5/QtCore/qstringlist.h \ + /usr/include/qt5/QtCore/qdatastream.h \ + /usr/include/qt5/QtCore/qregexp.h \ + /usr/include/qt5/QtCore/qstringmatcher.h \ + src/CharacterColor.h \ + /usr/include/qt5/QtGui/QColor \ + /usr/include/qt5/QtGui/qcolor.h \ + /usr/include/qt5/QtGui/qrgb.h \ + src/tools.h \ + /usr/include/qt5/QtCore/QString \ + /usr/include/qt5/QtGui/QBrush \ + /usr/include/qt5/QtGui/qbrush.h \ + /usr/include/qt5/QtGui/qmatrix.h \ + /usr/include/qt5/QtGui/qpolygon.h \ + /usr/include/qt5/QtCore/qrect.h \ + /usr/include/qt5/QtCore/qsize.h \ + /usr/include/qt5/QtGui/qregion.h \ + /usr/include/qt5/QtGui/qwindowdefs.h \ + /usr/include/qt5/QtGui/qwindowdefs_win.h \ + /usr/include/qt5/QtCore/qline.h \ + /usr/include/qt5/QtGui/qtransform.h \ + /usr/include/qt5/QtGui/qpainterpath.h \ + /usr/include/qt5/QtGui/qimage.h \ + /usr/include/qt5/QtGui/qpaintdevice.h \ + /usr/include/qt5/QtGui/qpixmap.h \ + /usr/include/qt5/QtCore/qsharedpointer.h \ + /usr/include/qt5/QtCore/qsharedpointer_impl.h \ + /usr/include/qt5/QtCore/QFile \ + /usr/include/qt5/QtCore/qfile.h \ + /usr/include/qt5/QtCore/qfiledevice.h \ + /usr/include/qt5/QtCore/QFileInfo \ + /usr/include/qt5/QtCore/qfileinfo.h \ + /usr/include/qt5/QtCore/QtDebug \ + /usr/include/qt5/QtCore/QDir \ + /usr/include/qt5/QtCore/qdir.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o .obj/ColorScheme.o src/ColorScheme.cpp + +.obj/TerminalDisplay.o: src/TerminalDisplay.cpp src/TerminalDisplay.h \ + /usr/include/qt5/QtGui/QColor \ + /usr/include/qt5/QtGui/qcolor.h \ + /usr/include/qt5/QtGui/qrgb.h \ + /usr/include/qt5/QtCore/qglobal.h \ + /usr/include/qt5/QtCore/qconfig.h \ + /usr/include/qt5/QtCore/qfeatures.h \ + /usr/include/qt5/QtCore/qsystemdetection.h \ + /usr/include/qt5/QtCore/qprocessordetection.h \ + /usr/include/qt5/QtCore/qcompilerdetection.h \ + /usr/include/qt5/QtCore/qglobalstatic.h \ + /usr/include/qt5/QtCore/qatomic.h \ + /usr/include/qt5/QtCore/qbasicatomic.h \ + /usr/include/qt5/QtCore/qatomic_bootstrap.h \ + /usr/include/qt5/QtCore/qgenericatomic.h \ + /usr/include/qt5/QtCore/qatomic_msvc.h \ + /usr/include/qt5/QtCore/qatomic_integrity.h \ + /usr/include/qt5/QtCore/qoldbasicatomic.h \ + /usr/include/qt5/QtCore/qatomic_vxworks.h \ + /usr/include/qt5/QtCore/qatomic_power.h \ + /usr/include/qt5/QtCore/qatomic_alpha.h \ + /usr/include/qt5/QtCore/qatomic_armv7.h \ + /usr/include/qt5/QtCore/qatomic_armv6.h \ + /usr/include/qt5/QtCore/qatomic_armv5.h \ + /usr/include/qt5/QtCore/qatomic_bfin.h \ + /usr/include/qt5/QtCore/qatomic_ia64.h \ + /usr/include/qt5/QtCore/qatomic_mips.h \ + /usr/include/qt5/QtCore/qatomic_s390.h \ + /usr/include/qt5/QtCore/qatomic_sh4a.h \ + /usr/include/qt5/QtCore/qatomic_sparc.h \ + /usr/include/qt5/QtCore/qatomic_gcc.h \ + /usr/include/qt5/QtCore/qatomic_x86.h \ + /usr/include/qt5/QtCore/qatomic_cxx11.h \ + /usr/include/qt5/QtCore/qatomic_unix.h \ + /usr/include/qt5/QtCore/qmutex.h \ + /usr/include/qt5/QtCore/qlogging.h \ + /usr/include/qt5/QtCore/qflags.h \ + /usr/include/qt5/QtCore/qtypeinfo.h \ + /usr/include/qt5/QtCore/qtypetraits.h \ + /usr/include/qt5/QtCore/qsysinfo.h \ + /usr/include/qt5/QtCore/qnamespace.h \ + /usr/include/qt5/QtCore/qstringlist.h \ + /usr/include/qt5/QtCore/qalgorithms.h \ + /usr/include/qt5/QtCore/qdatastream.h \ + /usr/include/qt5/QtCore/qscopedpointer.h \ + /usr/include/qt5/QtCore/qiodevice.h \ + /usr/include/qt5/QtCore/qobject.h \ + /usr/include/qt5/QtCore/qobjectdefs.h \ + /usr/include/qt5/QtCore/qobjectdefs_impl.h \ + /usr/include/qt5/QtCore/qstring.h \ + /usr/include/qt5/QtCore/qchar.h \ + /usr/include/qt5/QtCore/qbytearray.h \ + /usr/include/qt5/QtCore/qrefcount.h \ + /usr/include/qt5/QtCore/qarraydata.h \ + /usr/include/qt5/QtCore/qstringbuilder.h \ + /usr/include/qt5/QtCore/qlist.h \ + /usr/include/qt5/QtCore/qiterator.h \ + /usr/include/qt5/QtCore/qcoreevent.h \ + /usr/include/qt5/QtCore/qmetatype.h \ + /usr/include/qt5/QtCore/qvarlengtharray.h \ + /usr/include/qt5/QtCore/qcontainerfwd.h \ + /usr/include/qt5/QtCore/qisenum.h \ + /usr/include/qt5/QtCore/qobject_impl.h \ + /usr/include/qt5/QtCore/qpair.h \ + /usr/include/qt5/QtCore/qregexp.h \ + /usr/include/qt5/QtCore/qstringmatcher.h \ + /usr/include/qt5/QtCore/QPointer \ + /usr/include/qt5/QtCore/qpointer.h \ + /usr/include/qt5/QtCore/qsharedpointer.h \ + /usr/include/qt5/QtCore/qshareddata.h \ + /usr/include/qt5/QtCore/qsharedpointer_impl.h \ + /usr/include/qt5/QtCore/qhash.h \ + src/Filter.h \ + /usr/include/qt5/QtWidgets/QAction \ + /usr/include/qt5/QtWidgets/qaction.h \ + /usr/include/qt5/QtGui/qkeysequence.h \ + /usr/include/qt5/QtWidgets/qwidget.h \ + /usr/include/qt5/QtGui/qwindowdefs.h \ + /usr/include/qt5/QtGui/qwindowdefs_win.h \ + /usr/include/qt5/QtCore/qmargins.h \ + /usr/include/qt5/QtCore/qrect.h \ + /usr/include/qt5/QtCore/qsize.h \ + /usr/include/qt5/QtCore/qpoint.h \ + /usr/include/qt5/QtGui/qpaintdevice.h \ + /usr/include/qt5/QtGui/qpalette.h \ + /usr/include/qt5/QtGui/qbrush.h \ + /usr/include/qt5/QtCore/qvector.h \ + /usr/include/qt5/QtGui/qmatrix.h \ + /usr/include/qt5/QtGui/qpolygon.h \ + /usr/include/qt5/QtGui/qregion.h \ + /usr/include/qt5/QtCore/qline.h \ + /usr/include/qt5/QtGui/qtransform.h \ + /usr/include/qt5/QtGui/qpainterpath.h \ + /usr/include/qt5/QtGui/qimage.h \ + /usr/include/qt5/QtGui/qpixmap.h \ + /usr/include/qt5/QtGui/qfont.h \ + /usr/include/qt5/QtGui/qfontmetrics.h \ + /usr/include/qt5/QtGui/qfontinfo.h \ + /usr/include/qt5/QtWidgets/qsizepolicy.h \ + /usr/include/qt5/QtGui/qcursor.h \ + /usr/include/qt5/QtGui/qevent.h \ + /usr/include/qt5/QtCore/qvariant.h \ + /usr/include/qt5/QtCore/qmap.h \ + /usr/include/qt5/QtCore/qdebug.h \ + /usr/include/qt5/QtCore/qtextstream.h \ + /usr/include/qt5/QtCore/qlocale.h \ + /usr/include/qt5/QtCore/qset.h \ + /usr/include/qt5/QtCore/qcontiguouscache.h \ + /usr/include/qt5/QtCore/qurl.h \ + /usr/include/qt5/QtCore/qurlquery.h \ + /usr/include/qt5/QtCore/qfile.h \ + /usr/include/qt5/QtCore/qfiledevice.h \ + /usr/include/qt5/QtGui/qvector2d.h \ + /usr/include/qt5/QtGui/qtouchdevice.h \ + /usr/include/qt5/QtGui/qicon.h \ + /usr/include/qt5/QtWidgets/qactiongroup.h \ + /usr/include/qt5/QtCore/QList \ + /usr/include/qt5/QtCore/QObject \ + /usr/include/qt5/QtCore/QStringList \ + /usr/include/qt5/QtCore/QHash \ + /usr/include/qt5/QtCore/QRegExp \ + src/Character.h \ + src/CharacterColor.h \ + src/ksession.h \ + src/Session.h \ + /usr/include/qt5/QtCore/QTimer \ + /usr/include/qt5/QtCore/qtimer.h \ + /usr/include/qt5/QtCore/qbasictimer.h \ + /usr/include/qt5/QtGui/QWindow \ + /usr/include/qt5/QtGui/qwindow.h \ + /usr/include/qt5/QtCore/QEvent \ + /usr/include/qt5/QtCore/QMargins \ + /usr/include/qt5/QtCore/QRect \ + /usr/include/qt5/QtGui/qsurface.h \ + /usr/include/qt5/QtGui/qsurfaceformat.h \ + src/History.h \ + /usr/include/qt5/QtCore/QBitRef \ + /usr/include/qt5/QtCore/qbitarray.h \ + /usr/include/qt5/QtCore/QVector \ + /usr/include/qt5/QtCore/QTemporaryFile \ + /usr/include/qt5/QtCore/qtemporaryfile.h \ + src/BlockArray.h \ + /usr/include/qt5/QtQuick/QQuickItem \ + /usr/include/qt5/QtQuick/qquickitem.h \ + /usr/include/qt5/QtQuick/qtquickglobal.h \ + /usr/include/qt5/QtQml/qqml.h \ + /usr/include/qt5/QtQml/qqmlprivate.h \ + /usr/include/qt5/QtQml/qtqmlglobal.h \ + /usr/include/qt5/QtQml/qqmlparserstatus.h \ + /usr/include/qt5/QtQml/qqmlpropertyvaluesource.h \ + /usr/include/qt5/QtQml/qqmllist.h \ + /usr/include/qt5/QtCore/qmetaobject.h \ + /usr/include/qt5/QtQml/qqmlcomponent.h \ + /usr/include/qt5/QtQml/qqmlerror.h \ + /usr/include/qt5/QtQml/qjsvalue.h \ + /usr/include/qt5/QtGui/qaccessible.h \ + /usr/include/qt5/QtCore/qcoreapplication.h \ + /usr/include/qt5/QtCore/qeventloop.h \ + /usr/include/qt5/QtQuick/QQuickPaintedItem \ + /usr/include/qt5/QtQuick/qquickpainteditem.h \ + /usr/include/qt5/QtQuick/QtQuick \ + /usr/include/qt5/QtQuick/QtQuickDepends \ + /usr/include/qt5/QtCore/QtCore \ + /usr/include/qt5/QtCore/QtCoreDepends \ + /usr/include/qt5/QtCore/qabstractanimation.h \ + /usr/include/qt5/QtCore/qanimationgroup.h \ + /usr/include/qt5/QtCore/qparallelanimationgroup.h \ + /usr/include/qt5/QtCore/qpauseanimation.h \ + /usr/include/qt5/QtCore/qpropertyanimation.h \ + /usr/include/qt5/QtCore/qvariantanimation.h \ + /usr/include/qt5/QtCore/qeasingcurve.h \ + /usr/include/qt5/QtCore/qsequentialanimationgroup.h \ + /usr/include/qt5/QtCore/qtextcodec.h \ + /usr/include/qt5/QtCore/qendian.h \ + /usr/include/qt5/QtCore/qlibraryinfo.h \ + /usr/include/qt5/QtCore/qdatetime.h \ + /usr/include/qt5/QtCore/qnumeric.h \ + /usr/include/qt5/QtCore/qbuffer.h \ + /usr/include/qt5/QtCore/qdir.h \ + /usr/include/qt5/QtCore/qfileinfo.h \ + /usr/include/qt5/QtCore/qdiriterator.h \ + /usr/include/qt5/QtCore/qfileselector.h \ + /usr/include/qt5/QtCore/qfilesystemwatcher.h \ + /usr/include/qt5/QtCore/qlockfile.h \ + /usr/include/qt5/QtCore/qloggingcategory.h \ + /usr/include/qt5/QtCore/qprocess.h \ + /usr/include/qt5/QtCore/qresource.h \ + /usr/include/qt5/QtCore/qsavefile.h \ + /usr/include/qt5/QtCore/qsettings.h \ + /usr/include/qt5/QtCore/qstandardpaths.h \ + /usr/include/qt5/QtCore/qtemporarydir.h \ + /usr/include/qt5/QtCore/QScopedPointer \ + /usr/include/qt5/QtCore/qabstractitemmodel.h \ + /usr/include/qt5/QtCore/qabstractproxymodel.h \ + /usr/include/qt5/QtCore/qidentityproxymodel.h \ + /usr/include/qt5/QtCore/qitemselectionmodel.h \ + /usr/include/qt5/QtCore/qsortfilterproxymodel.h \ + /usr/include/qt5/QtCore/qstringlistmodel.h \ + /usr/include/qt5/QtCore/qjsonarray.h \ + /usr/include/qt5/QtCore/qjsonvalue.h \ + /usr/include/qt5/QtCore/qjsondocument.h \ + /usr/include/qt5/QtCore/qjsonobject.h \ + /usr/include/qt5/QtCore/qabstracteventdispatcher.h \ + /usr/include/qt5/QtCore/qabstractnativeeventfilter.h \ + /usr/include/qt5/QtCore/qmath.h \ + /usr/include/qt5/QtCore/qmimedata.h \ + /usr/include/qt5/QtCore/qobjectcleanuphandler.h \ + /usr/include/qt5/QtCore/qsharedmemory.h \ + /usr/include/qt5/QtCore/qsignalmapper.h \ + /usr/include/qt5/QtCore/qsocketnotifier.h \ + /usr/include/qt5/QtCore/qsystemsemaphore.h \ + /usr/include/qt5/QtCore/qtranslator.h \ + /usr/include/qt5/QtCore/qwineventnotifier.h \ + /usr/include/qt5/QtCore/qmimedatabase.h \ + /usr/include/qt5/QtCore/qmimetype.h \ + /usr/include/qt5/QtCore/qfactoryinterface.h \ + /usr/include/qt5/QtCore/qlibrary.h \ + /usr/include/qt5/QtCore/qplugin.h \ + /usr/include/qt5/QtCore/qpluginloader.h \ + /usr/include/qt5/QtCore/quuid.h \ + /usr/include/qt5/QtCore/qabstractstate.h \ + /usr/include/qt5/QtCore/qabstracttransition.h \ + /usr/include/qt5/QtCore/qeventtransition.h \ + /usr/include/qt5/QtCore/qfinalstate.h \ + /usr/include/qt5/QtCore/qhistorystate.h \ + /usr/include/qt5/QtCore/qsignaltransition.h \ + /usr/include/qt5/QtCore/qstate.h \ + /usr/include/qt5/QtCore/qstatemachine.h \ + /usr/include/qt5/QtCore/qexception.h \ + /usr/include/qt5/QtCore/qfuture.h \ + /usr/include/qt5/QtCore/qfutureinterface.h \ + /usr/include/qt5/QtCore/qrunnable.h \ + /usr/include/qt5/QtCore/qresultstore.h \ + /usr/include/qt5/QtCore/qfuturesynchronizer.h \ + /usr/include/qt5/QtCore/qfuturewatcher.h \ + /usr/include/qt5/QtCore/qreadwritelock.h \ + /usr/include/qt5/QtCore/qsemaphore.h \ + /usr/include/qt5/QtCore/qthread.h \ + /usr/include/qt5/QtCore/qthreadpool.h \ + /usr/include/qt5/QtCore/qthreadstorage.h \ + /usr/include/qt5/QtCore/qwaitcondition.h \ + /usr/include/qt5/QtCore/qarraydataops.h \ + /usr/include/qt5/QtCore/qarraydatapointer.h \ + /usr/include/qt5/QtCore/qbytearraymatcher.h \ + /usr/include/qt5/QtCore/qcache.h \ + /usr/include/qt5/QtCore/qcollator.h \ + /usr/include/qt5/QtCore/qcommandlineoption.h \ + /usr/include/qt5/QtCore/qcommandlineparser.h \ + /usr/include/qt5/QtCore/qcryptographichash.h \ + /usr/include/qt5/QtCore/qelapsedtimer.h \ + /usr/include/qt5/QtCore/qlinkedlist.h \ + /usr/include/qt5/QtCore/qmessageauthenticationcode.h \ + /usr/include/qt5/QtCore/qqueue.h \ + /usr/include/qt5/QtCore/qregularexpression.h \ + /usr/include/qt5/QtCore/qscopedvaluerollback.h \ + /usr/include/qt5/QtCore/qstack.h \ + /usr/include/qt5/QtCore/qtextboundaryfinder.h \ + /usr/include/qt5/QtCore/qtimeline.h \ + /usr/include/qt5/QtCore/qtimezone.h \ + /usr/include/qt5/QtCore/qxmlstream.h \ + /usr/include/qt5/QtCore/qtcoreversion.h \ + /usr/include/qt5/QtGui/QtGui \ + /usr/include/qt5/QtGui/QtGuiDepends \ + /usr/include/qt5/QtGui/qaccessiblebridge.h \ + /usr/include/qt5/QtGui/qaccessibleobject.h \ + /usr/include/qt5/QtGui/qaccessibleplugin.h \ + /usr/include/qt5/QtGui/qbitmap.h \ + /usr/include/qt5/QtGui/qiconengine.h \ + /usr/include/qt5/QtGui/qiconengineplugin.h \ + /usr/include/qt5/QtGui/qimageiohandler.h \ + /usr/include/qt5/QtGui/qimagereader.h \ + /usr/include/qt5/QtGui/qimagewriter.h \ + /usr/include/qt5/QtGui/qmovie.h \ + /usr/include/qt5/QtGui/qpicture.h \ + /usr/include/qt5/QtGui/qpictureformatplugin.h \ + /usr/include/qt5/QtGui/qpixmapcache.h \ + /usr/include/qt5/QtGui/qstandarditemmodel.h \ + /usr/include/qt5/QtGui/qclipboard.h \ + /usr/include/qt5/QtGui/qdrag.h \ + /usr/include/qt5/QtGui/qgenericplugin.h \ + /usr/include/qt5/QtGui/qgenericpluginfactory.h \ + /usr/include/qt5/QtGui/qguiapplication.h \ + /usr/include/qt5/QtGui/qinputmethod.h \ + /usr/include/qt5/QtGui/qoffscreensurface.h \ + /usr/include/qt5/QtGui/qopenglcontext.h \ + /usr/include/qt5/QtGui/QSurfaceFormat \ + /usr/include/qt5/QtGui/qopengl.h \ + /usr/include/qt5/QtCore/qt_windows.h \ + /usr/include/qt5/QtGui/qopengles2ext.h \ + /usr/include/qt5/QtGui/qopenglext.h \ + /usr/include/qt5/QtGui/qopenglversionfunctions.h \ + /usr/include/qt5/QtGui/qscreen.h \ + /usr/include/qt5/QtCore/QSize \ + /usr/include/qt5/QtCore/QSizeF \ + /usr/include/qt5/QtGui/QTransform \ + /usr/include/qt5/QtGui/qsessionmanager.h \ + /usr/include/qt5/QtGui/qstylehints.h \ + /usr/include/qt5/QtGui/qgenericmatrix.h \ + /usr/include/qt5/QtGui/qmatrix4x4.h \ + /usr/include/qt5/QtGui/qvector3d.h \ + /usr/include/qt5/QtGui/qvector4d.h \ + /usr/include/qt5/QtGui/qquaternion.h \ + /usr/include/qt5/QtGui/qopenglbuffer.h \ + /usr/include/qt5/QtGui/qopengldebug.h \ + /usr/include/qt5/QtGui/qopenglframebufferobject.h \ + /usr/include/qt5/QtGui/qopenglfunctions.h \ + /usr/include/qt5/QtGui/qopenglpaintdevice.h \ + /usr/include/qt5/QtGui/qopenglpixeltransferoptions.h \ + /usr/include/qt5/QtCore/QSharedDataPointer \ + /usr/include/qt5/QtGui/qopenglshaderprogram.h \ + /usr/include/qt5/QtGui/qopengltexture.h \ + /usr/include/qt5/QtGui/qopengltimerquery.h \ + /usr/include/qt5/QtGui/qopenglvertexarrayobject.h \ + /usr/include/qt5/QtGui/qbackingstore.h \ + /usr/include/qt5/QtGui/qpagedpaintdevice.h \ + /usr/include/qt5/QtGui/qpaintengine.h \ + /usr/include/qt5/QtGui/qpainter.h \ + /usr/include/qt5/QtGui/qtextoption.h \ + /usr/include/qt5/QtGui/qpen.h \ + /usr/include/qt5/QtGui/qpdfwriter.h \ + /usr/include/qt5/QtGui/qabstracttextdocumentlayout.h \ + /usr/include/qt5/QtGui/qtextlayout.h \ + /usr/include/qt5/QtGui/qtextformat.h \ + /usr/include/qt5/QtGui/qglyphrun.h \ + /usr/include/qt5/QtGui/qrawfont.h \ + /usr/include/qt5/QtGui/qfontdatabase.h \ + /usr/include/qt5/QtGui/qtextcursor.h \ + /usr/include/qt5/QtGui/qtextdocument.h \ + /usr/include/qt5/QtGui/qstatictext.h \ + /usr/include/qt5/QtGui/qsyntaxhighlighter.h \ + /usr/include/qt5/QtGui/qtextobject.h \ + /usr/include/qt5/QtGui/qtextdocumentfragment.h \ + /usr/include/qt5/QtGui/qtextdocumentwriter.h \ + /usr/include/qt5/QtGui/qtextlist.h \ + /usr/include/qt5/QtGui/qtexttable.h \ + /usr/include/qt5/QtGui/qdesktopservices.h \ + /usr/include/qt5/QtGui/qvalidator.h \ + /usr/include/qt5/QtGui/qtguiversion.h \ + /usr/include/qt5/QtQml/QtQml \ + /usr/include/qt5/QtQml/QtQmlDepends \ + /usr/include/qt5/QtNetwork/QtNetwork \ + /usr/include/qt5/QtNetwork/QtNetworkDepends \ + /usr/include/qt5/QtNetwork/qabstractnetworkcache.h \ + /usr/include/qt5/QtNetwork/qnetworkrequest.h \ + /usr/include/qt5/QtCore/QString \ + /usr/include/qt5/QtCore/QUrl \ + /usr/include/qt5/QtCore/QVariant \ + /usr/include/qt5/QtNetwork/qhttpmultipart.h \ + /usr/include/qt5/QtCore/QByteArray \ + /usr/include/qt5/QtCore/QIODevice \ + /usr/include/qt5/QtNetwork/QNetworkRequest \ + /usr/include/qt5/QtNetwork/qnetworkaccessmanager.h \ + /usr/include/qt5/QtNetwork/QSslConfiguration \ + /usr/include/qt5/QtNetwork/qsslconfiguration.h \ + /usr/include/qt5/QtNetwork/qsslsocket.h \ + /usr/include/qt5/QtNetwork/qtcpsocket.h \ + /usr/include/qt5/QtNetwork/qabstractsocket.h \ + /usr/include/qt5/QtNetwork/qsslerror.h \ + /usr/include/qt5/QtNetwork/qsslcertificate.h \ + /usr/include/qt5/QtNetwork/qssl.h \ + /usr/include/qt5/QtCore/QFlags \ + /usr/include/qt5/QtNetwork/qnetworkcookie.h \ + /usr/include/qt5/QtCore/QMetaType \ + /usr/include/qt5/QtNetwork/qnetworkcookiejar.h \ + /usr/include/qt5/QtNetwork/qnetworkdiskcache.h \ + /usr/include/qt5/QtNetwork/qnetworkreply.h \ + /usr/include/qt5/QtNetwork/QNetworkAccessManager \ + /usr/include/qt5/QtNetwork/qnetworkconfigmanager.h \ + /usr/include/qt5/QtNetwork/qnetworkconfiguration.h \ + /usr/include/qt5/QtNetwork/qnetworksession.h \ + /usr/include/qt5/QtNetwork/qnetworkinterface.h \ + /usr/include/qt5/QtNetwork/qhostaddress.h \ + /usr/include/qt5/QtNetwork/qauthenticator.h \ + /usr/include/qt5/QtNetwork/qdnslookup.h \ + /usr/include/qt5/QtNetwork/qhostinfo.h \ + /usr/include/qt5/QtNetwork/qnetworkproxy.h \ + /usr/include/qt5/QtNetwork/qlocalserver.h \ + /usr/include/qt5/QtNetwork/qlocalsocket.h \ + /usr/include/qt5/QtNetwork/qtcpserver.h \ + /usr/include/qt5/QtNetwork/qudpsocket.h \ + /usr/include/qt5/QtNetwork/qsslcertificateextension.h \ + /usr/include/qt5/QtNetwork/qsslcipher.h \ + /usr/include/qt5/QtNetwork/qsslkey.h \ + /usr/include/qt5/QtNetwork/qtnetworkversion.h \ + /usr/include/qt5/QtQml/qqmldebug.h \ + /usr/include/qt5/QtQml/qjsengine.h \ + /usr/include/qt5/QtQml/qjsvalueiterator.h \ + /usr/include/qt5/QtQml/qqmlabstracturlinterceptor.h \ + /usr/include/qt5/QtQml/qqmlapplicationengine.h \ + /usr/include/qt5/QtQml/qqmlengine.h \ + /usr/include/qt5/QtQml/qqmlcontext.h \ + /usr/include/qt5/QtQml/qqmlexpression.h \ + /usr/include/qt5/QtQml/qqmlscriptstring.h \ + /usr/include/qt5/QtQml/qqmlextensioninterface.h \ + /usr/include/qt5/QtQml/qqmlextensionplugin.h \ + /usr/include/qt5/QtQml/qqmlfile.h \ + /usr/include/qt5/QtQml/qqmlfileselector.h \ + /usr/include/qt5/QtQml/QQmlEngine \ + /usr/include/qt5/QtQml/qqmlincubator.h \ + /usr/include/qt5/QtQml/qqmlinfo.h \ + /usr/include/qt5/QtQml/qqmlnetworkaccessmanagerfactory.h \ + /usr/include/qt5/QtQml/qqmlproperty.h \ + /usr/include/qt5/QtQml/qqmlpropertymap.h \ + /usr/include/qt5/QtQml/qtqmlversion.h \ + /usr/include/qt5/QtQuick/designersupport.h \ + /usr/include/qt5/QtCore/QtGlobal \ + /usr/include/qt5/QtCore/QRectF \ + /usr/include/qt5/QtQuick/qquickframebufferobject.h \ + /usr/include/qt5/QtQuick/qquicktextdocument.h \ + /usr/include/qt5/QtGui/QTextDocument \ + /usr/include/qt5/QtQuick/qquickview.h \ + /usr/include/qt5/QtQuick/qquickwindow.h \ + /usr/include/qt5/QtQuick/qquickimageprovider.h \ + /usr/include/qt5/QtQuick/qsggeometry.h \ + /usr/include/qt5/QtQuick/qsgmaterial.h \ + /usr/include/qt5/QtQuick/qsgnode.h \ + /usr/include/qt5/QtGui/QMatrix4x4 \ + /usr/include/qt5/QtQuick/qsgflatcolormaterial.h \ + /usr/include/qt5/QtQuick/qsgsimplematerial.h \ + /usr/include/qt5/QtQuick/qsgsimplerectnode.h \ + /usr/include/qt5/QtQuick/qsgsimpletexturenode.h \ + /usr/include/qt5/QtQuick/qsgtexturematerial.h \ + /usr/include/qt5/QtQuick/qsgtexture.h \ + /usr/include/qt5/QtGui/QImage \ + /usr/include/qt5/QtQuick/qsgtextureprovider.h \ + /usr/include/qt5/QtQuick/qsgvertexcolormaterial.h \ + /usr/include/qt5/QtQuick/qtquickversion.h \ + /usr/include/qt5/QtGui/QGuiApplication \ + /usr/include/qt5/QtGui/QStyleHints \ + /usr/include/qt5/QtGui/QInputMethod \ + /usr/include/qt5/QtGui/QPainter \ + /usr/include/qt5/QtGui/QPixmap \ + /usr/include/qt5/QtGui/QClipboard \ + /usr/include/qt5/QtGui/QKeyEvent \ + /usr/include/qt5/QtCore/QTime \ + /usr/include/qt5/QtCore/QFile \ + /usr/include/qt5/QtCore/QtDebug \ + src/konsole_wcwidth.h \ + src/ScreenWindow.h \ + /usr/include/qt5/QtCore/QPoint \ + src/ColorScheme.h \ + /usr/include/qt5/QtCore/QSet \ + /usr/include/qt5/QtCore/QSettings \ + src/ColorTables.h \ + src/TerminalCharacterDecoder.h \ + src/LineFont.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o .obj/TerminalDisplay.o src/TerminalDisplay.cpp + +.obj/ksession.o: src/ksession.cpp src/ksession.h \ + /usr/include/qt5/QtCore/QObject \ + /usr/include/qt5/QtCore/qobject.h \ + /usr/include/qt5/QtCore/qobjectdefs.h \ + /usr/include/qt5/QtCore/qnamespace.h \ + /usr/include/qt5/QtCore/qglobal.h \ + /usr/include/qt5/QtCore/qconfig.h \ + /usr/include/qt5/QtCore/qfeatures.h \ + /usr/include/qt5/QtCore/qsystemdetection.h \ + /usr/include/qt5/QtCore/qprocessordetection.h \ + /usr/include/qt5/QtCore/qcompilerdetection.h \ + /usr/include/qt5/QtCore/qglobalstatic.h \ + /usr/include/qt5/QtCore/qatomic.h \ + /usr/include/qt5/QtCore/qbasicatomic.h \ + /usr/include/qt5/QtCore/qatomic_bootstrap.h \ + /usr/include/qt5/QtCore/qgenericatomic.h \ + /usr/include/qt5/QtCore/qatomic_msvc.h \ + /usr/include/qt5/QtCore/qatomic_integrity.h \ + /usr/include/qt5/QtCore/qoldbasicatomic.h \ + /usr/include/qt5/QtCore/qatomic_vxworks.h \ + /usr/include/qt5/QtCore/qatomic_power.h \ + /usr/include/qt5/QtCore/qatomic_alpha.h \ + /usr/include/qt5/QtCore/qatomic_armv7.h \ + /usr/include/qt5/QtCore/qatomic_armv6.h \ + /usr/include/qt5/QtCore/qatomic_armv5.h \ + /usr/include/qt5/QtCore/qatomic_bfin.h \ + /usr/include/qt5/QtCore/qatomic_ia64.h \ + /usr/include/qt5/QtCore/qatomic_mips.h \ + /usr/include/qt5/QtCore/qatomic_s390.h \ + /usr/include/qt5/QtCore/qatomic_sh4a.h \ + /usr/include/qt5/QtCore/qatomic_sparc.h \ + /usr/include/qt5/QtCore/qatomic_gcc.h \ + /usr/include/qt5/QtCore/qatomic_x86.h \ + /usr/include/qt5/QtCore/qatomic_cxx11.h \ + /usr/include/qt5/QtCore/qatomic_unix.h \ + /usr/include/qt5/QtCore/qmutex.h \ + /usr/include/qt5/QtCore/qlogging.h \ + /usr/include/qt5/QtCore/qflags.h \ + /usr/include/qt5/QtCore/qtypeinfo.h \ + /usr/include/qt5/QtCore/qtypetraits.h \ + /usr/include/qt5/QtCore/qsysinfo.h \ + /usr/include/qt5/QtCore/qobjectdefs_impl.h \ + /usr/include/qt5/QtCore/qstring.h \ + /usr/include/qt5/QtCore/qchar.h \ + /usr/include/qt5/QtCore/qbytearray.h \ + /usr/include/qt5/QtCore/qrefcount.h \ + /usr/include/qt5/QtCore/qarraydata.h \ + /usr/include/qt5/QtCore/qstringbuilder.h \ + /usr/include/qt5/QtCore/qlist.h \ + /usr/include/qt5/QtCore/qalgorithms.h \ + /usr/include/qt5/QtCore/qiterator.h \ + /usr/include/qt5/QtCore/qcoreevent.h \ + /usr/include/qt5/QtCore/qscopedpointer.h \ + /usr/include/qt5/QtCore/qmetatype.h \ + /usr/include/qt5/QtCore/qvarlengtharray.h \ + /usr/include/qt5/QtCore/qcontainerfwd.h \ + /usr/include/qt5/QtCore/qisenum.h \ + /usr/include/qt5/QtCore/qobject_impl.h \ + src/Session.h \ + /usr/include/qt5/QtCore/QStringList \ + /usr/include/qt5/QtCore/qstringlist.h \ + /usr/include/qt5/QtCore/qdatastream.h \ + /usr/include/qt5/QtCore/qiodevice.h \ + /usr/include/qt5/QtCore/qpair.h \ + /usr/include/qt5/QtCore/qregexp.h \ + /usr/include/qt5/QtCore/qstringmatcher.h \ + /usr/include/qt5/QtCore/QTimer \ + /usr/include/qt5/QtCore/qtimer.h \ + /usr/include/qt5/QtCore/qbasictimer.h \ + /usr/include/qt5/QtGui/QWindow \ + /usr/include/qt5/QtGui/qwindow.h \ + /usr/include/qt5/QtCore/QEvent \ + /usr/include/qt5/QtCore/QMargins \ + /usr/include/qt5/QtCore/qmargins.h \ + /usr/include/qt5/QtCore/qrect.h \ + /usr/include/qt5/QtCore/qsize.h \ + /usr/include/qt5/QtCore/qpoint.h \ + /usr/include/qt5/QtCore/QRect \ + /usr/include/qt5/QtGui/qsurface.h \ + /usr/include/qt5/QtGui/qsurfaceformat.h \ + /usr/include/qt5/QtGui/qwindowdefs.h \ + /usr/include/qt5/QtGui/qwindowdefs_win.h \ + /usr/include/qt5/QtGui/qicon.h \ + /usr/include/qt5/QtGui/qpixmap.h \ + /usr/include/qt5/QtGui/qpaintdevice.h \ + /usr/include/qt5/QtGui/qcolor.h \ + /usr/include/qt5/QtGui/qrgb.h \ + /usr/include/qt5/QtCore/qsharedpointer.h \ + /usr/include/qt5/QtCore/qshareddata.h \ + /usr/include/qt5/QtCore/qsharedpointer_impl.h \ + /usr/include/qt5/QtCore/qhash.h \ + /usr/include/qt5/QtGui/qimage.h \ + /usr/include/qt5/QtGui/qtransform.h \ + /usr/include/qt5/QtGui/qmatrix.h \ + /usr/include/qt5/QtGui/qpolygon.h \ + /usr/include/qt5/QtCore/qvector.h \ + /usr/include/qt5/QtGui/qregion.h \ + /usr/include/qt5/QtCore/qline.h \ + /usr/include/qt5/QtGui/qpainterpath.h \ + /usr/include/qt5/QtGui/qcursor.h \ + src/History.h \ + /usr/include/qt5/QtCore/QBitRef \ + /usr/include/qt5/QtCore/qbitarray.h \ + /usr/include/qt5/QtCore/QHash \ + /usr/include/qt5/QtCore/QVector \ + /usr/include/qt5/QtCore/QTemporaryFile \ + /usr/include/qt5/QtCore/qtemporaryfile.h \ + /usr/include/qt5/QtCore/qfile.h \ + /usr/include/qt5/QtCore/qfiledevice.h \ + src/BlockArray.h \ + src/Character.h \ + src/CharacterColor.h \ + /usr/include/qt5/QtGui/QColor \ + /usr/include/qt5/QtCore/QTextCodec \ + /usr/include/qt5/QtCore/qtextcodec.h \ + src/KeyboardTranslator.h \ + /usr/include/qt5/QtCore/QList \ + /usr/include/qt5/QtGui/QKeySequence \ + /usr/include/qt5/QtGui/qkeysequence.h \ + /usr/include/qt5/QtCore/QMetaType \ + /usr/include/qt5/QtCore/QVarLengthArray \ + src/TerminalDisplay.h \ + /usr/include/qt5/QtCore/QPointer \ + /usr/include/qt5/QtCore/qpointer.h \ + src/Filter.h \ + /usr/include/qt5/QtWidgets/QAction \ + /usr/include/qt5/QtWidgets/qaction.h \ + /usr/include/qt5/QtWidgets/qwidget.h \ + /usr/include/qt5/QtGui/qpalette.h \ + /usr/include/qt5/QtGui/qbrush.h \ + /usr/include/qt5/QtGui/qfont.h \ + /usr/include/qt5/QtGui/qfontmetrics.h \ + /usr/include/qt5/QtGui/qfontinfo.h \ + /usr/include/qt5/QtWidgets/qsizepolicy.h \ + /usr/include/qt5/QtGui/qevent.h \ + /usr/include/qt5/QtCore/qvariant.h \ + /usr/include/qt5/QtCore/qmap.h \ + /usr/include/qt5/QtCore/qdebug.h \ + /usr/include/qt5/QtCore/qtextstream.h \ + /usr/include/qt5/QtCore/qlocale.h \ + /usr/include/qt5/QtCore/qset.h \ + /usr/include/qt5/QtCore/qcontiguouscache.h \ + /usr/include/qt5/QtCore/qurl.h \ + /usr/include/qt5/QtCore/qurlquery.h \ + /usr/include/qt5/QtGui/qvector2d.h \ + /usr/include/qt5/QtGui/qtouchdevice.h \ + /usr/include/qt5/QtWidgets/qactiongroup.h \ + /usr/include/qt5/QtCore/QRegExp \ + /usr/include/qt5/QtQuick/QQuickItem \ + /usr/include/qt5/QtQuick/qquickitem.h \ + /usr/include/qt5/QtQuick/qtquickglobal.h \ + /usr/include/qt5/QtQml/qqml.h \ + /usr/include/qt5/QtQml/qqmlprivate.h \ + /usr/include/qt5/QtQml/qtqmlglobal.h \ + /usr/include/qt5/QtQml/qqmlparserstatus.h \ + /usr/include/qt5/QtQml/qqmlpropertyvaluesource.h \ + /usr/include/qt5/QtQml/qqmllist.h \ + /usr/include/qt5/QtCore/qmetaobject.h \ + /usr/include/qt5/QtQml/qqmlcomponent.h \ + /usr/include/qt5/QtQml/qqmlerror.h \ + /usr/include/qt5/QtQml/qjsvalue.h \ + /usr/include/qt5/QtGui/qaccessible.h \ + /usr/include/qt5/QtCore/qcoreapplication.h \ + /usr/include/qt5/QtCore/qeventloop.h \ + /usr/include/qt5/QtQuick/QQuickPaintedItem \ + /usr/include/qt5/QtQuick/qquickpainteditem.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o .obj/ksession.o src/ksession.cpp + +.obj/moc_plugin.o: .moc/moc_plugin.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o .obj/moc_plugin.o .moc/moc_plugin.cpp + +.obj/moc_Pty.o: .moc/moc_Pty.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o .obj/moc_Pty.o .moc/moc_Pty.cpp + +.obj/moc_kptyprocess.o: .moc/moc_kptyprocess.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o .obj/moc_kptyprocess.o .moc/moc_kptyprocess.cpp + +.obj/moc_kptydevice.o: .moc/moc_kptydevice.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o .obj/moc_kptydevice.o .moc/moc_kptydevice.cpp + +.obj/moc_kprocess.o: .moc/moc_kprocess.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o .obj/moc_kprocess.o .moc/moc_kprocess.cpp + +.obj/moc_Vt102Emulation.o: .moc/moc_Vt102Emulation.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o .obj/moc_Vt102Emulation.o .moc/moc_Vt102Emulation.cpp + +.obj/moc_Session.o: .moc/moc_Session.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o .obj/moc_Session.o .moc/moc_Session.cpp + +.obj/moc_Emulation.o: .moc/moc_Emulation.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o .obj/moc_Emulation.o .moc/moc_Emulation.cpp + +.obj/moc_ScreenWindow.o: .moc/moc_ScreenWindow.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o .obj/moc_ScreenWindow.o .moc/moc_ScreenWindow.cpp + +.obj/moc_Filter.o: .moc/moc_Filter.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o .obj/moc_Filter.o .moc/moc_Filter.cpp + +.obj/moc_TerminalDisplay.o: .moc/moc_TerminalDisplay.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o .obj/moc_TerminalDisplay.o .moc/moc_TerminalDisplay.cpp + +.obj/moc_ksession.o: .moc/moc_ksession.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o .obj/moc_ksession.o .moc/moc_ksession.cpp + +####### Install + +install_target: first FORCE + @test -d $(INSTALL_ROOT)/tmp/cool/konsole-qml-plugin/../imports/org/kde/konsole || mkdir -p $(INSTALL_ROOT)/tmp/cool/konsole-qml-plugin/../imports/org/kde/konsole + -$(INSTALL_PROGRAM) "$(TARGET)" "$(INSTALL_ROOT)/tmp/cool/imports/org/kde/konsole/$(TARGET)" + -$(STRIP) --strip-unneeded "$(INSTALL_ROOT)/tmp/cool/imports/org/kde/konsole/$(TARGET)" + +uninstall_target: FORCE + -$(DEL_FILE) "$(INSTALL_ROOT)/tmp/cool/imports/org/kde/konsole/$(TARGET)" + -$(DEL_DIR) $(INSTALL_ROOT)/tmp/cool/konsole-qml-plugin/../imports/org/kde/konsole/ + + +install_qmldir: first FORCE + @test -d $(INSTALL_ROOT)/tmp/cool/konsole-qml-plugin/../imports/org/kde/konsole || mkdir -p $(INSTALL_ROOT)/tmp/cool/konsole-qml-plugin/../imports/org/kde/konsole + -$(INSTALL_FILE) /tmp/cool/konsole-qml-plugin/src/qmldir $(INSTALL_ROOT)/tmp/cool/konsole-qml-plugin/../imports/org/kde/konsole/ + -$(INSTALL_FILE) /tmp/cool/konsole-qml-plugin/src/plugins.qmltypes $(INSTALL_ROOT)/tmp/cool/konsole-qml-plugin/../imports/org/kde/konsole/ + +uninstall_qmldir: FORCE + -$(DEL_FILE) -r $(INSTALL_ROOT)/tmp/cool/konsole-qml-plugin/../imports/org/kde/konsole/plugins.qmltypes + -$(DEL_FILE) -r $(INSTALL_ROOT)/tmp/cool/konsole-qml-plugin/../imports/org/kde/konsole/qmldir + -$(DEL_DIR) $(INSTALL_ROOT)/tmp/cool/konsole-qml-plugin/../imports/org/kde/konsole/ + + +install_assets: first FORCE + @test -d $(INSTALL_ROOT)/tmp/cool/konsole-qml-plugin/../imports/org/kde/konsole || mkdir -p $(INSTALL_ROOT)/tmp/cool/konsole-qml-plugin/../imports/org/kde/konsole + -$(INSTALL_DIR) /tmp/cool/konsole-qml-plugin/assets/color-schemes $(INSTALL_ROOT)/tmp/cool/konsole-qml-plugin/../imports/org/kde/konsole/ + -$(INSTALL_DIR) /tmp/cool/konsole-qml-plugin/assets/kb-layouts $(INSTALL_ROOT)/tmp/cool/konsole-qml-plugin/../imports/org/kde/konsole/ + +uninstall_assets: FORCE + -$(DEL_FILE) -r $(INSTALL_ROOT)/tmp/cool/konsole-qml-plugin/../imports/org/kde/konsole/kb-layouts + -$(DEL_FILE) -r $(INSTALL_ROOT)/tmp/cool/konsole-qml-plugin/../imports/org/kde/konsole/color-schemes + -$(DEL_DIR) $(INSTALL_ROOT)/tmp/cool/konsole-qml-plugin/../imports/org/kde/konsole/ + + +install: install_target install_qmldir install_assets FORCE + +uninstall: uninstall_target uninstall_qmldir uninstall_assets FORCE + +FORCE: + diff --git a/konsole-qml-plugin/README b/konsole-qml-plugin/README new file mode 100644 index 0000000..69a57a4 --- /dev/null +++ b/konsole-qml-plugin/README @@ -0,0 +1,15 @@ +this is a repository for shared C++ QML plugin, offering access to +terminal sessions. + +if you want to add something, please ask the maintainer of this library first to +make sure it's a good fit + +the current maintainer is: Dmitry Zagnoyko + +current plugin consist: +- KTerminal: offers access to terminal session from qml +- KSessions: offers access to pty(s) from C++ layer + +Branched from: +https://code.launchpad.net/~ubuntu-terminal-dev/ubuntu-terminal-app/plugin +At revision 14 diff --git a/konsole-qml-plugin/assets/color-schemes/BlackOnLightYellow.schema b/konsole-qml-plugin/assets/color-schemes/BlackOnLightYellow.schema new file mode 100644 index 0000000..251a696 --- /dev/null +++ b/konsole-qml-plugin/assets/color-schemes/BlackOnLightYellow.schema @@ -0,0 +1,42 @@ +# example scheme for konsole + +# the title is to appear in the menu. + +title Black on Light Yellow + +# foreground colors + +# note that the default background color is flagged +# to become transparent when an image is present. + +# slot transparent bold +# | | | +# V V--color--V V V + +color 0 0 0 0 0 0 # regular foreground color (Black) +color 1 255 255 221 1 0 # regular background color (Light Yellow) + +color 2 0 0 0 0 0 # regular color 0 Black +color 3 178 24 24 0 0 # regular color 1 Red +color 4 24 178 24 0 0 # regular color 2 Green +color 5 178 104 24 0 0 # regular color 3 Yellow +color 6 24 24 178 0 0 # regular color 4 Blue +color 7 178 24 178 0 0 # regular color 5 Magenta +color 8 24 178 178 0 0 # regular color 6 Cyan +color 9 178 178 178 0 0 # regular color 7 White + +# intensive colors + +# instead of changing the colors, we've flaged the text to become bold + +color 10 0 0 0 0 1 # intensive foreground color +color 11 255 255 221 1 0 # intensive background color + +color 12 104 104 104 0 0 # intensive color 0 +color 13 255 84 84 0 0 # intensive color 1 +color 14 84 255 84 0 0 # intensive color 2 +color 15 255 255 84 0 0 # intensive color 3 +color 16 84 84 255 0 0 # intensive color 4 +color 17 255 84 255 0 0 # intensive color 5 +color 18 84 255 255 0 0 # intensive color 6 +color 19 255 255 255 0 0 # intensive color 7 diff --git a/konsole-qml-plugin/assets/color-schemes/BlackOnRandomLight.colorscheme b/konsole-qml-plugin/assets/color-schemes/BlackOnRandomLight.colorscheme new file mode 100644 index 0000000..4d6f831 --- /dev/null +++ b/konsole-qml-plugin/assets/color-schemes/BlackOnRandomLight.colorscheme @@ -0,0 +1,104 @@ +[Background] +Bold=false +Color=247,247,214 +Transparency=true +MaxRandomHue=340 + +[BackgroundIntense] +Bold=false +Color=255,255,221 +Transparency=true + +[Color0] +Bold=false +Color=0,0,0 +Transparency=false + +[Color0Intense] +Bold=false +Color=104,104,104 +Transparency=false + +[Color1] +Bold=false +Color=178,24,24 +Transparency=false + +[Color1Intense] +Bold=false +Color=255,84,84 +Transparency=false + +[Color2] +Bold=false +Color=24,178,24 +Transparency=false + +[Color2Intense] +Bold=false +Color=84,255,84 +Transparency=false + +[Color3] +Bold=false +Color=178,104,24 +Transparency=false + +[Color3Intense] +Bold=false +Color=255,255,84 +Transparency=false + +[Color4] +Bold=false +Color=24,24,178 +Transparency=false + +[Color4Intense] +Bold=false +Color=84,84,255 +Transparency=false + +[Color5] +Bold=false +Color=178,24,178 +Transparency=false + +[Color5Intense] +Bold=false +Color=255,84,255 +Transparency=false + +[Color6] +Bold=false +Color=24,178,178 +Transparency=false + +[Color6Intense] +Bold=false +Color=84,255,255 +Transparency=false + +[Color7] +Bold=false +Color=178,178,178 +Transparency=false + +[Color7Intense] +Bold=false +Color=255,255,255 +Transparency=false + +[Foreground] +Bold=false +Color=0,0,0 +Transparency=false + +[ForegroundIntense] +Bold=true +Color=0,0,0 +Transparency=false + +[General] +Description=Black on Random Light +Opacity=1 diff --git a/konsole-qml-plugin/assets/color-schemes/BlackOnWhite.schema b/konsole-qml-plugin/assets/color-schemes/BlackOnWhite.schema new file mode 100644 index 0000000..11853e6 --- /dev/null +++ b/konsole-qml-plugin/assets/color-schemes/BlackOnWhite.schema @@ -0,0 +1,42 @@ +# example scheme for konsole + +# the title is to appear in the menu. + +title Black on White + +# foreground colors + +# note that the default background color is flagged +# to become transparent when an image is present. + +# slot transparent bold +# | | | +# V V--color--V V V + +color 0 0 0 0 0 0 # regular foreground color (Black) +color 1 255 255 255 1 0 # regular background color (White) + +color 2 0 0 0 0 0 # regular color 0 Black +color 3 178 24 24 0 0 # regular color 1 Red +color 4 24 178 24 0 0 # regular color 2 Green +color 5 178 104 24 0 0 # regular color 3 Yellow +color 6 24 24 178 0 0 # regular color 4 Blue +color 7 178 24 178 0 0 # regular color 5 Magenta +color 8 24 178 178 0 0 # regular color 6 Cyan +color 9 178 178 178 0 0 # regular color 7 White + +# intensive colors + +# instead of changing the colors, we've flaged the text to become bold + +color 10 0 0 0 0 1 # intensive foreground color +color 11 255 255 255 1 0 # intensive background color + +color 12 104 104 104 0 0 # intensive color 0 +color 13 255 84 84 0 0 # intensive color 1 +color 14 84 255 84 0 0 # intensive color 2 +color 15 255 255 84 0 0 # intensive color 3 +color 16 84 84 255 0 0 # intensive color 4 +color 17 255 84 255 0 0 # intensive color 5 +color 18 84 255 255 0 0 # intensive color 6 +color 19 255 255 255 0 0 # intensive color 7 diff --git a/konsole-qml-plugin/assets/color-schemes/DarkPastels.colorscheme b/konsole-qml-plugin/assets/color-schemes/DarkPastels.colorscheme new file mode 100644 index 0000000..fdcb02a --- /dev/null +++ b/konsole-qml-plugin/assets/color-schemes/DarkPastels.colorscheme @@ -0,0 +1,103 @@ +[Background] +Bold=false +Color=44,44,44 +Transparency=false + +[BackgroundIntense] +Bold=true +Color=44,44,44 +Transparency=false + +[Color0] +Bold=false +Color=63,63,63 +Transparency=false + +[Color0Intense] +Bold=true +Color=112,144,128 +Transparency=false + +[Color1] +Bold=false +Color=112,80,80 +Transparency=false + +[Color1Intense] +Bold=true +Color=220,163,163 +Transparency=false + +[Color2] +Bold=false +Color=96,180,138 +Transparency=false + +[Color2Intense] +Bold=true +Color=114,213,163 +Transparency=false + +[Color3] +Bold=false +Color=223,175,143 +Transparency=false + +[Color3Intense] +Bold=true +Color=240,223,175 +Transparency=false + +[Color4] +Bold=false +Color=154,184,215 +Transparency=false + +[Color4Intense] +Bold=true +Color=148,191,243 +Transparency=false + +[Color5] +Bold=false +Color=220,140,195 +Transparency=false + +[Color5Intense] +Bold=true +Color=236,147,211 +Transparency=false + +[Color6] +Bold=false +Color=140,208,211 +Transparency=false + +[Color6Intense] +Bold=true +Color=147,224,227 +Transparency=false + +[Color7] +Bold=false +Color=220,220,204 +Transparency=false + +[Color7Intense] +Bold=true +Color=255,255,255 +Transparency=false + +[Foreground] +Bold=false +Color=220,220,204 +Transparency=false + +[ForegroundIntense] +Bold=true +Color=220,220,204 +Transparency=false + +[General] +Description=Dark Pastels +Opacity=1 diff --git a/konsole-qml-plugin/assets/color-schemes/GreenOnBlack.colorscheme b/konsole-qml-plugin/assets/color-schemes/GreenOnBlack.colorscheme new file mode 100644 index 0000000..4d55b3a --- /dev/null +++ b/konsole-qml-plugin/assets/color-schemes/GreenOnBlack.colorscheme @@ -0,0 +1,104 @@ + +[Background] +Bold=false +Color=0,0,0 +Transparency=false + +[BackgroundIntense] +Bold=false +Color=0,0,0 +Transparency=false + +[Color0] +Bold=false +Color=0,0,0 +Transparency=false + +[Color0Intense] +Bold=false +Color=104,104,104 +Transparency=false + +[Color1] +Bold=false +Color=250,75,75 +Transparency=false + +[Color1Intense] +Bold=false +Color=255,84,84 +Transparency=false + +[Color2] +Bold=false +Color=24,178,24 +Transparency=false + +[Color2Intense] +Bold=false +Color=84,255,84 +Transparency=false + +[Color3] +Bold=false +Color=178,104,24 +Transparency=false + +[Color3Intense] +Bold=false +Color=255,255,84 +Transparency=false + +[Color4] +Bold=false +Color=92,167,251 +Transparency=false + +[Color4Intense] +Bold=false +Color=84,84,255 +Transparency=false + +[Color5] +Bold=false +Color=225,30,225 +Transparency=false + +[Color5Intense] +Bold=false +Color=255,84,255 +Transparency=false + +[Color6] +Bold=false +Color=24,178,178 +Transparency=false + +[Color6Intense] +Bold=false +Color=84,255,255 +Transparency=false + +[Color7] +Bold=false +Color=178,178,178 +Transparency=false + +[Color7Intense] +Bold=false +Color=255,255,255 +Transparency=false + +[Foreground] +Bold=false +Color=24,240,24 +Transparency=false + +[ForegroundIntense] +Bold=true +Color=24,240,24 +Transparency=false + +[General] +Description=Green on Black +Opacity=1 diff --git a/konsole-qml-plugin/assets/color-schemes/Linux.colorscheme b/konsole-qml-plugin/assets/color-schemes/Linux.colorscheme new file mode 100644 index 0000000..c9afb14 --- /dev/null +++ b/konsole-qml-plugin/assets/color-schemes/Linux.colorscheme @@ -0,0 +1,100 @@ +[Background] +Bold=false +Color=0,0,0 + +[BackgroundIntense] +Bold=false +Color=104,104,104 + +[Color0] +Bold=false +Color=0,0,0 + + +[Color0Intense] +Bold=false +Color=104,104,104 + + +[Color1] +Bold=false +Color=178,24,24 + + +[Color1Intense] +Bold=false +Color=255,84,84 + + +[Color2] +Bold=false +Color=24,178,24 + + +[Color2Intense] +Bold=false +Color=84,255,84 + + +[Color3] +Bold=false +Color=178,104,24 + + +[Color3Intense] +Bold=false +Color=255,255,84 + + +[Color4] +Bold=false +Color=24,24,178 + + +[Color4Intense] +Bold=false +Color=84,84,255 + + +[Color5] +Bold=false +Color=178,24,178 + + +[Color5Intense] +Bold=false +Color=255,84,255 + + +[Color6] +Bold=false +Color=24,178,178 + + +[Color6Intense] +Bold=false +Color=84,255,255 + + +[Color7] +Bold=false +Color=178,178,178 + + +[Color7Intense] +Bold=false +Color=255,255,255 + + +[Foreground] +Bold=false +Color=178,178,178 + + +[ForegroundIntense] +Bold=false +Color=255,255,255 + + +[General] +Description=Linux Colors diff --git a/konsole-qml-plugin/assets/color-schemes/WhiteOnBlack.schema b/konsole-qml-plugin/assets/color-schemes/WhiteOnBlack.schema new file mode 100644 index 0000000..05c5bc0 --- /dev/null +++ b/konsole-qml-plugin/assets/color-schemes/WhiteOnBlack.schema @@ -0,0 +1,42 @@ +# example scheme for konsole + +# the title is to appear in the menu. + +title White on Black + +# foreground colors + +# note that the default background color is flagged +# to become transparent when an image is present. + +# slot transparent bold +# | | | +# V V--color--V V V + +color 0 255 255 255 0 0 # regular foreground color (White) +color 1 0 0 0 1 0 # regular background color (Black) + +color 2 0 0 0 0 0 # regular color 0 Black +color 3 178 24 24 0 0 # regular color 1 Red +color 4 24 178 24 0 0 # regular color 2 Green +color 5 178 104 24 0 0 # regular color 3 Yellow +color 6 24 24 178 0 0 # regular color 4 Blue +color 7 178 24 178 0 0 # regular color 5 Magenta +color 8 24 178 178 0 0 # regular color 6 Cyan +color 9 178 178 178 0 0 # regular color 7 White + +# intensive colors + +# instead of changing the colors, we've flaged the text to become bold + +color 10 255 255 255 0 1 # intensive foreground color +color 11 0 0 0 1 0 # intensive background color + +color 12 104 104 104 0 0 # intensive color 0 +color 13 255 84 84 0 0 # intensive color 1 +color 14 84 255 84 0 0 # intensive color 2 +color 15 255 255 84 0 0 # intensive color 3 +color 16 84 84 255 0 0 # intensive color 4 +color 17 255 84 255 0 0 # intensive color 5 +color 18 84 255 255 0 0 # intensive color 6 +color 19 255 255 255 0 0 # intensive color 7 diff --git a/konsole-qml-plugin/assets/color-schemes/historic/BlackOnLightColor.schema b/konsole-qml-plugin/assets/color-schemes/historic/BlackOnLightColor.schema new file mode 100644 index 0000000..92e598a --- /dev/null +++ b/konsole-qml-plugin/assets/color-schemes/historic/BlackOnLightColor.schema @@ -0,0 +1,42 @@ +# example scheme for konsole + +# the title is to appear in the menu. + +title Black on Light Color + +# foreground colors + +# note that the default background color is flagged +# to become transparent when an image is present. + +# slot transparent bold +# | | | +# V V--color--V V V + +color 0 0 0 0 0 0 # regular foreground color (Black) +rcolor 1 30 255 1 0 # regular background color (Light Color) + +color 2 0 0 0 0 0 # regular color 0 Black +color 3 178 24 24 0 0 # regular color 1 Red +color 4 24 178 24 0 0 # regular color 2 Green +color 5 178 104 24 0 0 # regular color 3 Yellow +color 6 24 24 178 0 0 # regular color 4 Blue +color 7 178 24 178 0 0 # regular color 5 Magenta +color 8 24 178 178 0 0 # regular color 6 Cyan +color 9 178 178 178 0 0 # regular color 7 White + +# intensive colors + +# instead of changing the colors, we've flaged the text to become bold + +color 10 0 0 0 0 1 # intensive foreground color +color 11 255 255 221 1 0 # intensive background color + +color 12 104 104 104 0 0 # intensive color 0 +color 13 255 84 84 0 0 # intensive color 1 +color 14 84 255 84 0 0 # intensive color 2 +color 15 255 255 84 0 0 # intensive color 3 +color 16 84 84 255 0 0 # intensive color 4 +color 17 255 84 255 0 0 # intensive color 5 +color 18 84 255 255 0 0 # intensive color 6 +color 19 255 255 255 0 0 # intensive color 7 diff --git a/konsole-qml-plugin/assets/color-schemes/historic/DarkPicture.schema b/konsole-qml-plugin/assets/color-schemes/historic/DarkPicture.schema new file mode 100644 index 0000000..78ab3df --- /dev/null +++ b/konsole-qml-plugin/assets/color-schemes/historic/DarkPicture.schema @@ -0,0 +1,44 @@ +# example scheme for konsole + +# the title is to appear in the menu. + +title Marble + +image tile Blkmarble.jpg + +# foreground colors + +# note that the default background color is flagged +# to become transparent when an image is present. + +# slot transparent bold +# | | | +# V V--color--V V V + +color 0 255 255 255 0 0 # regular foreground color (White) +color 1 0 0 0 1 0 # regular background color (Black) + +color 2 0 0 0 0 0 # regular color 0 Black +color 3 178 24 24 0 0 # regular color 1 Red +color 4 24 178 24 0 0 # regular color 2 Green +color 5 178 104 24 0 0 # regular color 3 Yellow +color 6 24 24 178 0 0 # regular color 4 Blue +color 7 178 24 178 0 0 # regular color 5 Magenta +color 8 24 178 178 0 0 # regular color 6 Cyan +color 9 178 178 178 0 0 # regular color 7 White + +# intensive colors + +# instead of changing the colors, we've flaged the text to become bold + +color 10 255 255 255 0 1 # intensive foreground color +color 11 0 0 0 1 0 # intensive background color + +color 12 104 104 104 0 0 # intensive color 0 +color 13 255 84 84 0 0 # intensive color 1 +color 14 84 255 84 0 0 # intensive color 2 +color 15 255 255 84 0 0 # intensive color 3 +color 16 84 84 255 0 0 # intensive color 4 +color 17 255 84 255 0 0 # intensive color 5 +color 18 84 255 255 0 0 # intensive color 6 +color 19 255 255 255 0 0 # intensive color 7 diff --git a/konsole-qml-plugin/assets/color-schemes/historic/Example.Schema b/konsole-qml-plugin/assets/color-schemes/historic/Example.Schema new file mode 100644 index 0000000..8611d44 --- /dev/null +++ b/konsole-qml-plugin/assets/color-schemes/historic/Example.Schema @@ -0,0 +1,47 @@ +# example scheme for konsole + +# the title is to appear in the menu. + +title Ugly 1 + +# add a wallpaper, if you like. Second word one of { tile,center,full } + +image tile /opt/kde/share/wallpapers/dancy_pants.jpg + + +# foreground colors + +# note that the default background color is flagged +# to become transparent when an image is present. + +# slot transparent bold +# | | | +# V V--color--V V V + +color 0 0 0 0 0 0 # regular foreground color (Black) +color 1 255 255 255 1 0 # regular background color (White) + +color 2 0 0 0 0 0 # regular color 0 Black +color 3 255 0 0 0 0 # regular color 1 Red +color 4 0 255 0 0 0 # regular color 2 Green +color 5 255 255 0 0 0 # regular color 3 Yellow +color 6 0 0 255 0 0 # regular color 4 Blue +color 7 255 0 255 0 0 # regular color 5 Magenta +color 8 0 255 255 0 0 # regular color 6 Cyan +color 9 255 255 255 0 0 # regular color 7 White + +# intensive colors + +# instead of changing the colors, we've flaged the text to become bold + +color 10 0 0 0 0 1 # intensive foreground color +color 11 255 255 255 1 1 # intensive background color + +color 12 0 0 0 0 1 # intensive color 0 +color 13 255 0 0 0 1 # intensive color 1 +color 14 0 255 0 0 1 # intensive color 2 +color 15 255 255 0 0 1 # intensive color 3 +color 16 0 0 255 0 1 # intensive color 4 +color 17 255 0 255 0 1 # intensive color 5 +color 18 0 255 255 0 1 # intensive color 6 +color 19 255 255 255 0 1 # intensive color 7 diff --git a/konsole-qml-plugin/assets/color-schemes/historic/GreenOnBlack.schema b/konsole-qml-plugin/assets/color-schemes/historic/GreenOnBlack.schema new file mode 100644 index 0000000..8f19c5b --- /dev/null +++ b/konsole-qml-plugin/assets/color-schemes/historic/GreenOnBlack.schema @@ -0,0 +1,42 @@ +# example scheme for konsole + +# the title is to appear in the menu. + +title Green on Black + +# foreground colors + +# note that the default background color is flagged +# to become transparent when an image is present. + +# slot transparent bold +# | | | +# V V--color--V V V + +color 0 24 240 24 0 0 # regular foreground color (Green) +color 1 0 0 0 1 0 # regular background color (Black) + +color 2 0 0 0 0 0 # regular color 0 Black +color 3 178 24 24 0 0 # regular color 1 Red +color 4 24 178 24 0 0 # regular color 2 Green +color 5 178 104 24 0 0 # regular color 3 Yellow +color 6 24 24 178 0 0 # regular color 4 Blue +color 7 178 24 178 0 0 # regular color 5 Magenta +color 8 24 178 178 0 0 # regular color 6 Cyan +color 9 178 178 178 0 0 # regular color 7 White + +# intensive colors + +# instead of changing the colors, we've flaged the text to become bold + +color 10 24 240 24 0 1 # intensive foreground color +color 11 0 0 0 1 0 # intensive background color + +color 12 104 104 104 0 0 # intensive color 0 +color 13 255 84 84 0 0 # intensive color 1 +color 14 84 255 84 0 0 # intensive color 2 +color 15 255 255 84 0 0 # intensive color 3 +color 16 84 84 255 0 0 # intensive color 4 +color 17 255 84 255 0 0 # intensive color 5 +color 18 84 255 255 0 0 # intensive color 6 +color 19 255 255 255 0 0 # intensive color 7 diff --git a/konsole-qml-plugin/assets/color-schemes/historic/GreenTint.schema b/konsole-qml-plugin/assets/color-schemes/historic/GreenTint.schema new file mode 100644 index 0000000..2786678 --- /dev/null +++ b/konsole-qml-plugin/assets/color-schemes/historic/GreenTint.schema @@ -0,0 +1,49 @@ +# linux color schema for konsole + +title Green Tint + +transparency 0.3 0 150 0 + +# FIXME +# +# The flaw in this schema is that "blick" comes out on the +# Linux console as intensive background, really. +# Since this is not used in clients you'll hardly notice +# it in practice. + +# foreground colors + +# note that the default background color is flagged +# to become transparent when an image is present. + +# slot transparent bold +# | red grn blu | | +# V V--color--V V V + +color 0 178 178 178 0 0 # regular foreground color (White) +color 1 0 0 0 1 0 # regular background color (Black) + +color 2 0 0 0 0 0 # regular color 0 Black +color 3 178 24 24 0 0 # regular color 1 Red +color 4 24 178 24 0 0 # regular color 2 Green +color 5 178 104 24 0 0 # regular color 3 Yellow +color 6 24 24 178 0 0 # regular color 4 Blue +color 7 178 24 178 0 0 # regular color 5 Magenta +color 8 24 178 178 0 0 # regular color 6 Cyan +color 9 178 178 178 0 0 # regular color 7 White + +# intensive colors + +# instead of changing the colors, we've flaged the text to become bold + +color 10 255 255 255 0 0 # intensive foreground color +color 11 104 104 104 1 0 # intensive background color + +color 12 104 104 104 0 0 # intensive color 0 +color 13 255 84 84 0 0 # intensive color 1 +color 14 84 255 84 0 0 # intensive color 2 +color 15 255 255 84 0 0 # intensive color 3 +color 16 84 84 255 0 0 # intensive color 4 +color 17 255 84 255 0 0 # intensive color 5 +color 18 84 255 255 0 0 # intensive color 6 +color 19 255 255 255 0 0 # intensive color 7 diff --git a/konsole-qml-plugin/assets/color-schemes/historic/GreenTint_MC.schema b/konsole-qml-plugin/assets/color-schemes/historic/GreenTint_MC.schema new file mode 100644 index 0000000..954755e --- /dev/null +++ b/konsole-qml-plugin/assets/color-schemes/historic/GreenTint_MC.schema @@ -0,0 +1,49 @@ +# linux color schema for konsole + +title Green Tint with Transparent MC + +transparency 0.3 0 150 0 + +# FIXME +# +# The flaw in this schema is that "blick" comes out on the +# Linux console as intensive background, really. +# Since this is not used in clients you'll hardly notice +# it in practice. + +# foreground colors + +# note that the default background color is flagged +# to become transparent when an image is present. + +# slot transparent bold +# | red grn blu | | +# V V--color--V V V + +color 0 178 178 178 0 0 # regular foreground color (White) +color 1 0 0 0 1 0 # regular background color (Black) + +color 2 0 0 0 0 0 # regular color 0 Black +color 3 178 24 24 0 0 # regular color 1 Red +color 4 24 178 24 0 0 # regular color 2 Green +color 5 178 104 24 0 0 # regular color 3 Yellow +color 6 0 0 0 1 0 # regular color 4 Blue +color 7 178 24 178 0 0 # regular color 5 Magenta +color 8 24 178 178 0 0 # regular color 6 Cyan +color 9 178 178 178 0 0 # regular color 7 White + +# intensive colors + +# instead of changing the colors, we've flaged the text to become bold + +color 10 255 255 255 0 0 # intensive foreground color +color 11 104 104 104 1 0 # intensive background color + +color 12 104 104 104 0 0 # intensive color 0 +color 13 255 84 84 0 0 # intensive color 1 +color 14 84 255 84 0 0 # intensive color 2 +color 15 255 255 84 0 0 # intensive color 3 +color 16 84 84 255 0 0 # intensive color 4 +color 17 255 84 255 0 0 # intensive color 5 +color 18 84 255 255 0 0 # intensive color 6 +color 19 255 255 255 0 0 # intensive color 7 diff --git a/konsole-qml-plugin/assets/color-schemes/historic/LightPicture.schema b/konsole-qml-plugin/assets/color-schemes/historic/LightPicture.schema new file mode 100644 index 0000000..6acd7a8 --- /dev/null +++ b/konsole-qml-plugin/assets/color-schemes/historic/LightPicture.schema @@ -0,0 +1,44 @@ +# example scheme for konsole + +# the title is to appear in the menu. + +title Paper + +image tile Paper01.jpg + +# foreground colors + +# note that the default background color is flagged +# to become transparent when an image is present. + +# slot transparent bold +# | | | +# V V--color--V V V + +color 0 0 0 0 0 0 # regular foreground color (Black) +color 1 255 255 255 1 0 # regular background color (White) + +color 2 0 0 0 0 0 # regular color 0 Black +color 3 178 24 24 0 0 # regular color 1 Red +color 4 24 178 24 0 0 # regular color 2 Green +color 5 178 104 24 0 0 # regular color 3 Yellow +color 6 24 24 178 0 0 # regular color 4 Blue +color 7 178 24 178 0 0 # regular color 5 Magenta +color 8 24 178 178 0 0 # regular color 6 Cyan +color 9 178 178 178 0 0 # regular color 7 White + +# intensive colors + +# instead of changing the colors, we've flaged the text to become bold + +color 10 0 0 0 0 1 # intensive foreground color +color 11 255 255 255 1 0 # intensive background color + +color 12 104 104 104 0 0 # intensive color 0 +color 13 255 84 84 0 0 # intensive color 1 +color 14 84 255 84 0 0 # intensive color 2 +color 15 255 255 84 0 0 # intensive color 3 +color 16 84 84 255 0 0 # intensive color 4 +color 17 255 84 255 0 0 # intensive color 5 +color 18 84 255 255 0 0 # intensive color 6 +color 19 255 255 255 0 0 # intensive color 7 diff --git a/konsole-qml-plugin/assets/color-schemes/historic/Linux.schema b/konsole-qml-plugin/assets/color-schemes/historic/Linux.schema new file mode 100644 index 0000000..a2515d9 --- /dev/null +++ b/konsole-qml-plugin/assets/color-schemes/historic/Linux.schema @@ -0,0 +1,47 @@ +# linux color schema for konsole + +title Linux Colors + +# FIXME +# +# The flaw in this schema is that "blick" comes out on the +# Linux console as intensive background, really. +# Since this is not used in clients you'll hardly notice +# it in practice. + +# foreground colors + +# note that the default background color is flagged +# to become transparent when an image is present. + +# slot transparent bold +# | red grn blu | | +# V V--color--V V V + +color 0 178 178 178 0 0 # regular foreground color (White) +color 1 0 0 0 1 0 # regular background color (Black) + +color 2 0 0 0 0 0 # regular color 0 Black +color 3 178 24 24 0 0 # regular color 1 Red +color 4 24 178 24 0 0 # regular color 2 Green +color 5 178 104 24 0 0 # regular color 3 Yellow +color 6 24 24 178 0 0 # regular color 4 Blue +color 7 178 24 178 0 0 # regular color 5 Magenta +color 8 24 178 178 0 0 # regular color 6 Cyan +color 9 178 178 178 0 0 # regular color 7 White + +# intensive colors + +# instead of changing the colors, we've flaged the text to become bold + +color 10 255 255 255 0 0 # intensive foreground color +color 11 104 104 104 1 0 # intensive background color + +color 12 104 104 104 0 0 # intensive color 0 +color 13 255 84 84 0 0 # intensive color 1 +color 14 84 255 84 0 0 # intensive color 2 +color 15 255 255 84 0 0 # intensive color 3 +color 16 84 84 255 0 0 # intensive color 4 +color 17 255 84 255 0 0 # intensive color 5 +color 18 84 255 255 0 0 # intensive color 6 +color 19 255 255 255 0 0 # intensive color 7 diff --git a/konsole-qml-plugin/assets/color-schemes/historic/README.Schema b/konsole-qml-plugin/assets/color-schemes/historic/README.Schema new file mode 100644 index 0000000..f737c14 --- /dev/null +++ b/konsole-qml-plugin/assets/color-schemes/historic/README.Schema @@ -0,0 +1,132 @@ +[README.Schema] + +The schemata offered in the Options/Schema menu are +taken from from configurations files with a *.schema +pattern either located in $KDEDIR/share/apps/konsole +or ~/.kde/share/apps/konsole. + +Schemata allow to configure the color set that konsole +uses, together with some more information on rendition +processing. + +Syntax + + File + :: { [Line] ['#' Comment] '\n' } + + Line + :: "title" Title + :: "image" Usage PathToPictureFile + :: "transparency" Fade Red Green Blue + :: "color" Slot Red Green Blue Transparent Bold + :: "rcolor" Slot Saturation Value Transparent Bold + :: "sysfg" Slot Transparent Bold + :: "sysbg" Slot Transparent Bold + +Meaning + + - Title is the text to appear in the Option/Schema menu. + It should be unique among all other schemata therefore. + + - The "image" clause allows to place an image on the + konsole's background. + + - Usage can be either + - "tile" - the image is tilewise replicated. + - "center" - the image is centered. + - "full" - the image is stretched to fit the window size. + + - The Path of the picture can both be relative + (to kde wallpapers) or absolute. + + When a schema uses a background image (or transparency) + one has to make at least one color slot transparent to + achive any visible effect. Please read below about the + "Transparent" field in color,sysbg,sysfg. + + - The "transparency" clause picks and uses the background + of the desktop as if it where an image together with + a fade effect. This effect will fade the background + to the specified color. + + The "Fade" is a real value between 0 and 1, indicating + the strength of the fade. A value of 0 will not change + the image, a value of 1 will make it the fade color + everywhere, and in between. This will make the "glas" + of the window be of the color given in the clause and + being more(1) or less(0) intransparent. + + - The remaining clauses (color,sysbg,sysfg) are used + to setup konsoles rendition system. + + To this end, konsole offers 20 color slots. + + Slot Meaning + ----- -------------------------- + 0 regular foreground color + 1 regular background color + 2-9 regular bgr color 0-7 + 10 intensive foreground color + 11 intensive background color + 12-19 intensive bgr color 0-7 + + The traditional meaning of the "bgr" color codes + has a bitwise interpretation of an additive three + primary color scheme inherited from early EGA + color terminals. + + Color Bits Colors + ----- ---- ------- + 0 000 Black + 1 001 Red + 2 010 Green + 3 011 Yellow + 4 100 Blue + 5 101 Magenta + 6 110 Cyan + 7 111 White + + One may or may not stick to this tradition. + Konsole allows to assign colors freely to slots. + + The slots fall apart into two groups, regular + and intensive colors. The later are used when + BOLD rendition is used by the client. + + Each of the groups have a default fore- and + background color and the said bgr colors. + Normal terminal processing will simply use + the default colors. + + The color desired for a slot is indicated + in the Red Green Blue fields of the color + clause. Use the sysfg or the sysbg clause + to indicate the default fore and background + colors of the desktop. + + To specify randomized color for a slot use + the clause rcolor. The two parameters to it + being Saturation - the amount of colour, + and Value, the darkness of the colour. + + To use transparency/images and to simulate + the behavior of the xterm, one can supply + two additional tags to each slot: + - Transparent (0/1) meaning to show the + background picture, if any. + - Bold (0/1) to render characters bold. + + +If you know about the escape codes, you might have +noticed that intensive and bold rendition are sort +of confused. This is inherited by the xterm which +konsole is simulating. + +One can use the colortest.sh script supplied +with the konsole source distribution to test +a schema. + +The schema installed with konsole are more or +less demonstrations and not really beauty, +beside the Linux.schema, perhaps, which is +made after the VGA colors. diff --git a/konsole-qml-plugin/assets/color-schemes/historic/README.default.Schema b/konsole-qml-plugin/assets/color-schemes/historic/README.default.Schema new file mode 100644 index 0000000..e024e5a --- /dev/null +++ b/konsole-qml-plugin/assets/color-schemes/historic/README.default.Schema @@ -0,0 +1,44 @@ +# default scheme for konsole (only here for documentation purposes) + +# the title is to appear in the menu. + +title Konsole Defaults + +# image tile /opt/kde/share/wallpapers/gray2.jpg + +# foreground colors + +# note that the default background color is flagged +# to become transparent when an image is present. + +# slot transparent bold +# | | | +# V V--color--V V V + +color 0 0 0 0 0 0 # regular foreground color (Black) +color 1 255 255 255 1 0 # regular background color (White) + +color 2 0 0 0 0 0 # regular color 0 Black +color 3 178 24 24 0 0 # regular color 1 Red +color 4 24 178 24 0 0 # regular color 2 Green +color 5 178 104 24 0 0 # regular color 3 Yellow +color 6 24 24 178 0 0 # regular color 4 Blue +color 7 178 24 178 0 0 # regular color 5 Magenta +color 8 24 178 178 0 0 # regular color 6 Cyan +color 9 178 178 178 0 0 # regular color 7 White + +# intensive colors + +# instead of changing the colors, we've flaged the text to become bold + +color 10 0 0 0 0 1 # intensive foreground color +color 11 255 255 255 1 0 # intensive background color + +color 12 104 104 104 0 0 # intensive color 0 +color 13 255 84 84 0 0 # intensive color 1 +color 14 84 255 84 0 0 # intensive color 2 +color 15 255 255 84 0 0 # intensive color 3 +color 16 84 84 255 0 0 # intensive color 4 +color 17 255 84 255 0 0 # intensive color 5 +color 18 84 255 255 0 0 # intensive color 6 +color 19 255 255 255 0 0 # intensive color 7 diff --git a/konsole-qml-plugin/assets/color-schemes/historic/Transparent.schema b/konsole-qml-plugin/assets/color-schemes/historic/Transparent.schema new file mode 100644 index 0000000..41f8dc0 --- /dev/null +++ b/konsole-qml-plugin/assets/color-schemes/historic/Transparent.schema @@ -0,0 +1,49 @@ +# linux color schema for konsole + +title Transparent Konsole + +transparency 0.35 0 0 0 + +# FIXME +# +# The flaw in this schema is that "blick" comes out on the +# Linux console as intensive background, really. +# Since this is not used in clients you'll hardly notice +# it in practice. + +# foreground colors + +# note that the default background color is flagged +# to become transparent when an image is present. + +# slot transparent bold +# | red grn blu | | +# V V--color--V V V + +color 0 178 178 178 0 0 # regular foreground color (White) +color 1 0 0 0 1 0 # regular background color (Black) + +color 2 0 0 0 0 0 # regular color 0 Black +color 3 178 24 24 0 0 # regular color 1 Red +color 4 24 178 24 0 0 # regular color 2 Green +color 5 178 104 24 0 0 # regular color 3 Yellow +color 6 24 24 178 0 0 # regular color 4 Blue +color 7 178 24 178 0 0 # regular color 5 Magenta +color 8 24 178 178 0 0 # regular color 6 Cyan +color 9 178 178 178 0 0 # regular color 7 White + +# intensive colors + +# instead of changing the colors, we've flaged the text to become bold + +color 10 255 255 255 0 0 # intensive foreground color +color 11 104 104 104 1 0 # intensive background color + +color 12 104 104 104 0 0 # intensive color 0 +color 13 255 84 84 0 0 # intensive color 1 +color 14 84 255 84 0 0 # intensive color 2 +color 15 255 255 84 0 0 # intensive color 3 +color 16 84 84 255 0 0 # intensive color 4 +color 17 255 84 255 0 0 # intensive color 5 +color 18 84 255 255 0 0 # intensive color 6 +color 19 255 255 255 0 0 # intensive color 7 diff --git a/konsole-qml-plugin/assets/color-schemes/historic/Transparent_MC.schema b/konsole-qml-plugin/assets/color-schemes/historic/Transparent_MC.schema new file mode 100644 index 0000000..8991b9a --- /dev/null +++ b/konsole-qml-plugin/assets/color-schemes/historic/Transparent_MC.schema @@ -0,0 +1,51 @@ +# linux color schema for konsole + +title Transparent for MC + +transparency 0.35 0 0 0 + +# FIXME +# +# The flaw in this schema is that "blick" comes out on the +# Linux console as intensive background, really. +# Since this is not used in clients you'll hardly notice +# it in practice. + +# foreground colors + +# note that the default background color is flagged +# to become transparent when an image is present. + +# slot transparent bold +# | red grn blu | | +# V V--color--V V V + +color 0 178 178 178 0 0 # regular foreground color (White) +color 1 0 0 0 1 0 # regular background color (Black) + +color 2 0 0 0 0 0 # regular color 0 Black +color 3 178 24 24 0 0 # regular color 1 Red +color 4 24 178 24 0 0 # regular color 2 Green +color 5 178 104 24 0 0 # regular color 3 Yellow +#color 6 24 24 178 0 0 # regular color 4 Blue +color 6 0 0 0 1 0 # regular color 4 Blue + +color 7 178 24 178 0 0 # regular color 5 Magenta +color 8 24 178 178 0 0 # regular color 6 Cyan +color 9 178 178 178 0 0 # regular color 7 White + +# intensive colors + +# instead of changing the colors, we've flaged the text to become bold + +color 10 255 255 255 0 0 # intensive foreground color +color 11 104 104 104 1 0 # intensive background color + +color 12 104 104 104 0 0 # intensive color 0 +color 13 255 84 84 0 0 # intensive color 1 +color 14 84 255 84 0 0 # intensive color 2 +color 15 255 255 84 0 0 # intensive color 3 +color 16 84 84 255 0 0 # intensive color 4 +color 17 255 84 255 0 0 # intensive color 5 +color 18 84 255 255 0 0 # intensive color 6 +color 19 255 255 255 0 0 # intensive color 7 diff --git a/konsole-qml-plugin/assets/color-schemes/historic/Transparent_darkbg.schema b/konsole-qml-plugin/assets/color-schemes/historic/Transparent_darkbg.schema new file mode 100644 index 0000000..61792fa --- /dev/null +++ b/konsole-qml-plugin/assets/color-schemes/historic/Transparent_darkbg.schema @@ -0,0 +1,42 @@ +# linux color schema for konsole + +title Transparent, Dark Background + +transparency 0.75 0 0 0 + +# foreground colors + +# note that the default background color is flagged +# to become transparent when an image is present. + +# slot transparent bold +# | red grn blu | | +# V V--color--V V V + +color 0 255 255 255 0 0 # regular foreground color (White) +color 1 0 0 0 1 0 # regular background color (Black) + +color 2 0 0 0 0 0 # regular color 0 Black +color 3 178 24 24 0 0 # regular color 1 Red +color 4 24 178 24 0 0 # regular color 2 Green +color 5 178 104 24 0 0 # regular color 3 Yellow +color 6 24 24 178 0 0 # regular color 4 Blue +color 7 178 24 178 0 0 # regular color 5 Magenta +color 8 24 178 178 0 0 # regular color 6 Cyan +color 9 178 178 178 0 0 # regular color 7 White + +# intensive colors + +# instead of changing the colors, we've flaged the text to become bold + +color 10 255 255 255 0 0 # intensive foreground color +color 11 104 104 104 1 0 # intensive background color + +color 12 104 104 104 0 0 # intensive color 0 +color 13 255 84 84 0 0 # intensive color 1 +color 14 84 255 84 0 0 # intensive color 2 +color 15 255 255 84 0 0 # intensive color 3 +color 16 84 84 255 0 0 # intensive color 4 +color 17 255 84 255 0 0 # intensive color 5 +color 18 84 255 255 0 0 # intensive color 6 +color 19 255 255 255 0 0 # intensive color 7 diff --git a/konsole-qml-plugin/assets/color-schemes/historic/Transparent_lightbg.schema b/konsole-qml-plugin/assets/color-schemes/historic/Transparent_lightbg.schema new file mode 100644 index 0000000..ce201f2 --- /dev/null +++ b/konsole-qml-plugin/assets/color-schemes/historic/Transparent_lightbg.schema @@ -0,0 +1,51 @@ +# linux color schema for konsole + +title Transparent, Light Background + +transparency 0.1 0 0 0 + +# This is a schema for very light backgrounds. It makes some +# hacks about the colors to make Midnight Commander transparent +# and with suitable colors. + +# foreground colors + +# note that the default background color is flagged +# to become transparent when an image is present. + +# slot transparent bold +# | red grn blu | | +# V V--color--V V V + +color 0 50 50 50 0 0 # regular foreground color (DarkGray) +color 1 200 200 200 1 0 # regular background color (White) + +# color 2 0 0 0 0 0 # regular color 0 Black +color 2 200 200 200 1 0 # regular background color (White) +color 3 178 24 24 0 0 # regular color 1 Red +color 4 24 178 24 0 0 # regular color 2 Green +color 5 178 104 24 0 0 # regular color 3 Yellow +#color 6 24 24 178 0 0 # regular color 4 Blue +color 6 0 0 0 1 0 # regular color 4 Blue +# Blue is transparent, to make MC transparent + +color 7 178 24 178 0 0 # regular color 5 Magenta +color 8 24 178 178 0 0 # regular color 6 Cyan +# color 9 178 178 178 0 0 # regular color 7 White +color 9 50 50 50 0 0 # regular foreground color (DarkGray) + +# intensive colors + +# instead of changing the colors, we've flaged the text to become bold + +color 10 0 0 0 0 0 # intensive foreground color +color 11 255 255 255 1 0 # intensive background color + +color 12 104 104 104 0 0 # intensive color 0 +color 13 255 84 84 0 0 # intensive color 1 +color 14 84 255 84 0 0 # intensive color 2 +color 15 255 255 84 0 0 # intensive color 3 +color 16 84 84 255 0 0 # intensive color 4 +color 17 255 84 255 0 0 # intensive color 5 +color 18 84 255 255 0 0 # intensive color 6 +color 19 255 255 255 0 0 # intensive color 7 diff --git a/konsole-qml-plugin/assets/color-schemes/historic/XTerm.schema b/konsole-qml-plugin/assets/color-schemes/historic/XTerm.schema new file mode 100644 index 0000000..3ff787d --- /dev/null +++ b/konsole-qml-plugin/assets/color-schemes/historic/XTerm.schema @@ -0,0 +1,46 @@ +# xterm color schema for konsole + +# xterm colors can be configured (almost) like +# konsole colors can. This is the uncustomized +# xterm schema. +# Please refere to your local xterm setup files +# if this schema differs. + +title XTerm Colors + +# foreground colors ------------------------------- + +# note that the default background color is flagged +# to become transparent when an image is present. + +# slot transparent bold +# | red grn blu | | +# V V--color--V V V + +color 0 0 0 0 0 0 # regular foreground color (Black) +color 1 255 255 255 1 0 # regular background color (White) + +color 2 0 0 0 0 0 # regular color 0 Black +color 3 205 0 0 0 0 # regular color 1 Red +color 4 0 205 0 0 0 # regular color 2 Green +color 5 205 205 0 0 0 # regular color 3 Yellow +color 6 0 0 205 0 0 # regular color 4 Blue +color 7 205 0 205 0 0 # regular color 5 Magenta +color 8 0 205 205 0 0 # regular color 6 Cyan +color 9 229 229 229 0 0 # regular color 7 White + +# intensive colors ------------------------------------------- + +# for some strange reason, intensive colors are bold, also. + +color 10 77 77 77 0 1 # intensive foreground color +color 11 255 255 255 1 1 # intensive background color + +color 12 77 77 77 0 1 # intensive color 0 +color 13 255 0 0 0 1 # intensive color 1 +color 14 0 255 0 0 1 # intensive color 2 +color 15 255 255 0 0 1 # intensive color 3 +color 16 0 0 255 0 1 # intensive color 4 +color 17 255 0 255 0 1 # intensive color 5 +color 18 0 255 255 0 1 # intensive color 6 +color 19 255 255 255 0 1 # intensive color 7 diff --git a/konsole-qml-plugin/assets/color-schemes/historic/syscolor.schema b/konsole-qml-plugin/assets/color-schemes/historic/syscolor.schema new file mode 100644 index 0000000..a9a65ea --- /dev/null +++ b/konsole-qml-plugin/assets/color-schemes/historic/syscolor.schema @@ -0,0 +1,44 @@ +# schema that uses system colors + +# the title is to appear in the menu. + +title System Colors + +# image none + +# foreground colors + +# note that the default background color is flagged +# to become transparent when an image is present. + +# slot transparent bold +# | | | +# V V--color--V V V + +sysfg 0 0 0 # regular foreground color (system) +sysbg 1 1 0 # regular background color (system) + +color 2 0 0 0 0 0 # regular color 0 Black +color 3 178 24 24 0 0 # regular color 1 Red +color 4 24 178 24 0 0 # regular color 2 Green +color 5 178 104 24 0 0 # regular color 3 Yellow +color 6 24 24 178 0 0 # regular color 4 Blue +color 7 178 24 178 0 0 # regular color 5 Magenta +color 8 24 178 178 0 0 # regular color 6 Cyan +color 9 178 178 178 0 0 # regular color 7 White + +# intensive colors + +# instead of changing the colors, we've flaged the text to become bold + +color 10 0 0 0 0 1 # intensive foreground color +color 11 255 255 255 1 0 # intensive background color + +color 12 104 104 104 0 0 # intensive color 0 +color 13 255 84 84 0 0 # intensive color 1 +color 14 84 255 84 0 0 # intensive color 2 +color 15 255 255 84 0 0 # intensive color 3 +color 16 84 84 255 0 0 # intensive color 4 +color 17 255 84 255 0 0 # intensive color 5 +color 18 84 255 255 0 0 # intensive color 6 +color 19 255 255 255 0 0 # intensive color 7 diff --git a/konsole-qml-plugin/assets/color-schemes/historic/vim.schema b/konsole-qml-plugin/assets/color-schemes/historic/vim.schema new file mode 100644 index 0000000..f29e3f7 --- /dev/null +++ b/konsole-qml-plugin/assets/color-schemes/historic/vim.schema @@ -0,0 +1,40 @@ +# VIM-recommended color schema for konsole + +# VIM (VI improved) in "help xiterm" recommends these colors for xterm. + +title VIM Colors + +# foreground colors ------------------------------- + +# note that the default background color is flagged +# to become transparent when an image is present. + +# slot transparent bold +# | red grn blu | | +# V V--color--V V V + +color 0 0 0 0 0 0 # regular foreground color (Black) +color 1 255 255 255 1 0 # regular background color (White) + +color 2 0 0 0 0 0 # regular color 0 Black +color 3 192 0 0 0 0 # regular color 1 Red +color 4 0 128 0 0 0 # regular color 2 Green +color 5 128 128 0 0 0 # regular color 3 Yellow +color 6 0 0 192 0 0 # regular color 4 Blue +color 7 192 0 192 0 0 # regular color 5 Magenta +color 8 0 128 128 0 0 # regular color 6 Cyan +color 9 192 192 192 0 0 # regular color 7 White + +# intensive colors ------------------------------------------- + +color 10 77 77 77 0 1 # intensive foreground color +color 11 255 255 255 1 1 # intensive background color + +color 12 128 128 128 0 0 # intensive color 0 +color 13 255 96 96 0 0 # intensive color 1 +color 14 0 255 0 0 0 # intensive color 2 +color 15 255 255 0 0 0 # intensive color 3 +color 16 128 128 255 0 0 # intensive color 4 +color 17 255 64 255 0 0 # intensive color 5 +color 18 0 255 255 0 0 # intensive color 6 +color 19 255 255 255 0 0 # intensive color 7 diff --git a/konsole-qml-plugin/assets/kb-layouts/README b/konsole-qml-plugin/assets/kb-layouts/README new file mode 100644 index 0000000..4e94e5e --- /dev/null +++ b/konsole-qml-plugin/assets/kb-layouts/README @@ -0,0 +1,72 @@ +[README.KeyTab] + +The keytabs offered in the Options/Keyboard menu are +taken from from configurations files with a *.keytab +pattern either located in $KDEDIR/share/apps/konsole +or ~/.kde/share/apps/konsole. + +Keytabs allow to configure the behavior of konsole +on keyboard events, especially for functions keys. +Please have a look into the README.keyboard file, too. + +The syntax is that each entry has the form : + + "key" Keyname { ("+"|"-") Modename } ":" (String|Operation) + +Keynames are those defined in with the +"Qt::Key_" prefix removed. + +Mode names are: + + - Shift : Shift Key pressed + - Alt : Alt Key pressed + - Control : Control Key pressed + + ( The VT100 emulation has modes that can affect the + sequences emitted by certain keys. These modes are + under control of the client program. + + - Newline : effects Return and Enter key. + - Application : effects Up and Down key. + - Ansi : effects Up and Down key (This is for VT52, really). + + Since sending a state to a program that has set the state + itself is positivly wrong and obsolete design, better forget + about this nasty detail. I may well remove this "feature" + in a future clean up round. ) + + A "+" preceeding a Modename means the Key is pressed. + A "-" preceeding a Modename means the Key is not pressed. + If no mode is given it means don't care. + + Note that the combination of Key and Modes (set/reset) + has to be unique. This means, that + + key A + Shift : "A" + key A : "a" + + will not accept the small letter "a" rule as expected, + one has to add a "- Shift" to the last clause. Use + the stdout/stderr dianostics of konsole when modifying + keytabs to find problems like this. + +Operations are + + - scrollUpLine : scroll up one line in the history log + - scrollUpPage : scroll up one page in the history log + - scrollDownLine : scroll down one line in the history log + - scrollDownPage : scroll down one page in the history log + - emitClipboard : "paste" the current clipboard + - emitSelection : "paste" the current selection + +Strings have the syntax of C strings, +one may use the following escapes: + + - \E - escape + - \\ - backslash + - \" - double quote + - \t - tab + - \r - return + - \n - newline + - \b - backspace + - \xHH - where HH are two hex digits diff --git a/konsole-qml-plugin/assets/kb-layouts/default.keytab b/konsole-qml-plugin/assets/kb-layouts/default.keytab new file mode 100644 index 0000000..aebd8cf --- /dev/null +++ b/konsole-qml-plugin/assets/kb-layouts/default.keytab @@ -0,0 +1,169 @@ +# [README.default.Keytab] Default Keyboard Table +# +# To customize your keyboard, copy this file to something +# ending with .keytab and change it to meet you needs. +# Please read the README.KeyTab and the README.keyboard +# in this case. +# +# -------------------------------------------------------------- + +keyboard "Default (XFree 4)" + +# -------------------------------------------------------------- +# +# Note that this particular table is a "risc" version made to +# ease customization without bothering with obsolete details. +# See VT100.keytab for the more hairy stuff. +# +# -------------------------------------------------------------- + +# common keys + +key Escape : "\E" + +key Tab -Shift : "\t" +key Tab +Shift+Ansi : "\E[Z" +key Tab +Shift-Ansi : "\t" +key Backtab +Ansi : "\E[Z" +key Backtab -Ansi : "\t" + +key Return-Shift-NewLine : "\r" +key Return-Shift+NewLine : "\r\n" + +key Return+Shift : "\EOM" + +# Backspace and Delete codes are preserving CTRL-H. + +key Backspace : "\x7f" + +# Arrow keys in VT52 mode +# shift up/down are reserved for scrolling. +# shift left/right are reserved for switching between tabs (this is hardcoded). + +key Up -Shift-Ansi : "\EA" +key Down -Shift-Ansi : "\EB" +key Right-Shift-Ansi : "\EC" +key Left -Shift-Ansi : "\ED" + +# Arrow keys in ANSI mode with Application - and Normal Cursor Mode) + +key Up -Shift-AnyMod+Ansi+AppCuKeys : "\EOA" +key Down -Shift-AnyMod+Ansi+AppCuKeys : "\EOB" +key Right -Shift-AnyMod+Ansi+AppCuKeys : "\EOC" +key Left -Shift-AnyMod+Ansi+AppCuKeys : "\EOD" + +key Up -Shift-AnyMod+Ansi-AppCuKeys : "\E[A" +key Down -Shift-AnyMod+Ansi-AppCuKeys : "\E[B" +key Right -Shift-AnyMod+Ansi-AppCuKeys : "\E[C" +key Left -Shift-AnyMod+Ansi-AppCuKeys : "\E[D" + +key Up -Shift+AnyMod+Ansi : "\E[1;*A" +key Down -Shift+AnyMod+Ansi : "\E[1;*B" +key Right -Shift+AnyMod+Ansi : "\E[1;*C" +key Left -Shift+AnyMod+Ansi : "\E[1;*D" + +# Keypad keys with NumLock ON +# (see "Numeric Keypad" section at http://www.nw.com/nw/WWW/products/wizcon/vt100.html ) +# +# Not enabled for now because it breaks the keypad in Vim. +# +#key 0 +KeyPad+AppKeyPad : "\EOp" +#key 1 +KeyPad+AppKeyPad : "\EOq" +#key 2 +KeyPad+AppKeyPad : "\EOr" +#key 3 +KeyPad+AppKeyPad : "\EOs" +#key 4 +KeyPad+AppKeyPad : "\EOt" +#key 5 +KeyPad+AppKeyPad : "\EOu" +#key 6 +KeyPad+AppKeyPad : "\EOv" +#key 7 +KeyPad+AppKeyPad : "\EOw" +#key 8 +KeyPad+AppKeyPad : "\EOx" +#key 9 +KeyPad+AppKeyPad : "\EOy" +#key + +KeyPad+AppKeyPad : "\EOl" +#key - +KeyPad+AppKeyPad : "\EOm" +#key . +KeyPad+AppKeyPad : "\EOn" +#key * +KeyPad+AppKeyPad : "\EOM" +#key Enter +KeyPad+AppKeyPad : "\r" + +# Keypad keys with NumLock Off +key Up -Shift+Ansi+AppCuKeys+KeyPad : "\EOA" +key Down -Shift+Ansi+AppCuKeys+KeyPad : "\EOB" +key Right -Shift+Ansi+AppCuKeys+KeyPad : "\EOC" +key Left -Shift+Ansi+AppCuKeys+KeyPad : "\EOD" + +key Up -Shift+Ansi-AppCuKeys+KeyPad : "\E[A" +key Down -Shift+Ansi-AppCuKeys+KeyPad : "\E[B" +key Right -Shift+Ansi-AppCuKeys+KeyPad : "\E[C" +key Left -Shift+Ansi-AppCuKeys+KeyPad : "\E[D" + +key Home +AppCuKeys+KeyPad : "\EOH" +key End +AppCuKeys+KeyPad : "\EOF" +key Home -AppCuKeys+KeyPad : "\E[H" +key End -AppCuKeys+KeyPad : "\E[F" + +key Insert +KeyPad : "\E[2~" +key Delete +KeyPad : "\E[3~" +key Prior -Shift+KeyPad : "\E[5~" +key Next -Shift+KeyPad : "\E[6~" + +# other grey PC keys + +key Enter+NewLine : "\r\n" +key Enter-NewLine : "\r" + +key Home -AnyMod-AppCuKeys : "\E[H" +key End -AnyMod-AppCuKeys : "\E[F" +key Home -AnyMod+AppCuKeys : "\EOH" +key End -AnyMod+AppCuKeys : "\EOF" +key Home +AnyMod : "\E[1;*H" +key End +AnyMod : "\E[1;*F" + +key Insert -AnyMod : "\E[2~" +key Delete -AnyMod : "\E[3~" +key Insert +AnyMod : "\E[2;*~" +key Delete +AnyMod : "\E[3;*~" + +key Prior -Shift-AnyMod : "\E[5~" +key Next -Shift-AnyMod : "\E[6~" +key Prior -Shift+AnyMod : "\E[5;*~" +key Next -Shift+AnyMod : "\E[6;*~" + +# Function keys +key F1 -AnyMod : "\EOP" +key F2 -AnyMod : "\EOQ" +key F3 -AnyMod : "\EOR" +key F4 -AnyMod : "\EOS" +key F5 -AnyMod : "\E[15~" +key F6 -AnyMod : "\E[17~" +key F7 -AnyMod : "\E[18~" +key F8 -AnyMod : "\E[19~" +key F9 -AnyMod : "\E[20~" +key F10 -AnyMod : "\E[21~" +key F11 -AnyMod : "\E[23~" +key F12 -AnyMod : "\E[24~" + +key F1 +AnyMod : "\EO*P" +key F2 +AnyMod : "\EO*Q" +key F3 +AnyMod : "\EO*R" +key F4 +AnyMod : "\EO*S" +key F5 +AnyMod : "\E[15;*~" +key F6 +AnyMod : "\E[17;*~" +key F7 +AnyMod : "\E[18;*~" +key F8 +AnyMod : "\E[19;*~" +key F9 +AnyMod : "\E[20;*~" +key F10 +AnyMod : "\E[21;*~" +key F11 +AnyMod : "\E[23;*~" +key F12 +AnyMod : "\E[24;*~" + +# Work around dead keys + +key Space +Control : "\x00" + +# Some keys are used by konsole to cause operations. +# The scroll* operations refer to the history buffer. + +key Up +Shift-AppScreen : scrollLineUp +key Prior +Shift-AppScreen : scrollPageUp +key Down +Shift-AppScreen : scrollLineDown +key Next +Shift-AppScreen : scrollPageDown + +key ScrollLock : scrollLock + diff --git a/konsole-qml-plugin/assets/kb-layouts/historic/vt100.keytab b/konsole-qml-plugin/assets/kb-layouts/historic/vt100.keytab new file mode 100644 index 0000000..dec49ba --- /dev/null +++ b/konsole-qml-plugin/assets/kb-layouts/historic/vt100.keytab @@ -0,0 +1,133 @@ +# [vt100.keytab] Konsole Keyboard Table (VT100 keys) +# +# -------------------------------------------------------------- + +keyboard "vt100 (historical)" + +# -------------------------------------------------------------- +# +# This configuration table allows to customize the +# meaning of the keys. +# +# The syntax is that each entry has the form : +# +# "key" Keyname { ("+"|"-") Modename } ":" (String|Operation) +# +# Keynames are those defined in with the +# "Qt::Key_" removed. (We'd better insert the list here) +# +# Mode names are : +# +# - Shift +# - Alt +# - Control +# +# The VT100 emulation has two modes that can affect the +# sequences emitted by certain keys. These modes are +# under control of the client program. +# +# - Newline : effects Return and Enter key. +# - Application : effects Up and Down key. +# +# - Ansi : effects Up and Down key (This is for VT52, really). +# +# Operations are +# +# - scrollUpLine +# - scrollUpPage +# - scrollDownLine +# - scrollDownPage +# +# - emitSelection +# +# If the key is not found here, the text of the +# key event as provided by QT is emitted, possibly +# preceeded by ESC if the Alt key is pressed. +# +# -------------------------------------------------------------- + +key Escape : "\E" +key Tab : "\t" + +# VT100 can add an extra \n after return. +# The NewLine mode is set by an escape sequence. + +key Return-NewLine : "\r" +key Return+NewLine : "\r\n" + +# Some desperately try to save the ^H. + +key Backspace : "\x7f" +key Delete : "\E[3~" + +# These codes are for the VT52 mode of VT100 +# The Ansi mode (i.e. VT100 mode) is set by +# an escape sequence + +key Up -Shift-Ansi : "\EA" +key Down -Shift-Ansi : "\EB" +key Right-Shift-Ansi : "\EC" +key Left -Shift-Ansi : "\ED" + +# VT100 emits a mode bit together +# with the arrow keys.The AppCuKeys +# mode is set by an escape sequence. + +key Up -Shift+Ansi+AppCuKeys : "\EOA" +key Down -Shift+Ansi+AppCuKeys : "\EOB" +key Right-Shift+Ansi+AppCuKeys : "\EOC" +key Left -Shift+Ansi+AppCuKeys : "\EOD" + +key Up -Shift+Ansi-AppCuKeys : "\E[A" +key Down -Shift+Ansi-AppCuKeys : "\E[B" +key Right-Shift+Ansi-AppCuKeys : "\E[C" +key Left -Shift+Ansi-AppCuKeys : "\E[D" + +# function keys (FIXME: make pf1-pf4) + +key F1 : "\E[11~" +key F2 : "\E[12~" +key F3 : "\E[13~" +key F4 : "\E[14~" +key F5 : "\E[15~" + +key F6 : "\E[17~" +key F7 : "\E[18~" +key F8 : "\E[19~" +key F9 : "\E[20~" +key F10 : "\E[21~" +key F11 : "\E[23~" +key F12 : "\E[24~" + +key Home : "\E[H" +key End : "\E[F" + +key Prior -Shift : "\E[5~" +key Next -Shift : "\E[6~" +key Insert-Shift : "\E[2~" + +# Keypad-Enter. See comment on Return above. + +key Enter+NewLine : "\r\n" +key Enter-NewLine : "\r" + +key Space +Control : "\x00" + +# some of keys are used by konsole. + +key Up +Shift : scrollLineUp +key Prior +Shift : scrollPageUp +key Down +Shift : scrollLineDown +key Next +Shift : scrollPageDown + +key ScrollLock : scrollLock + + +#---------------------------------------------------------- + +# keypad characters as offered by Qt +# cannot be recognized as such. + +#---------------------------------------------------------- + +# Following other strings as emitted by konsole. diff --git a/konsole-qml-plugin/assets/kb-layouts/historic/x11r5.keytab b/konsole-qml-plugin/assets/kb-layouts/historic/x11r5.keytab new file mode 100644 index 0000000..75ba06e --- /dev/null +++ b/konsole-qml-plugin/assets/kb-layouts/historic/x11r5.keytab @@ -0,0 +1,71 @@ +# [x11r5.Keytab] Keyboard Table for X11 R5 + +keyboard "XTerm (XFree 3.x.x)" + +# -------------------------------------------------------------- +# +# Note that this particular table is a "risc" version made to +# ease customization without bothering with obsolete details. +# See VT100.keytab for the more hairy stuff. +# +# -------------------------------------------------------------- + +# common keys + +key Escape : "\E" +key Tab : "\t" + +key Return : "\r" + +# Backspace and Delete codes are preserving CTRL-H. + +key Backspace : "\x7f" + +# cursor keys + +key Up -Shift : "\EOA" +key Down -Shift : "\EOB" +key Right -Shift : "\EOC" +key Left -Shift : "\EOD" + +# other grey PC keys + +key Enter : "\r" + +key Home : "\E[1~" +key Insert-Shift : "\E[2~" +key Delete : "\E[3~" +key End : "\E[4~" +key Prior -Shift : "\E[5~" +key Next -Shift : "\E[6~" + +# function keys + +key F1 : "\E[11~" +key F2 : "\E[12~" +key F3 : "\E[13~" +key F4 : "\E[14~" +key F5 : "\E[15~" +key F6 : "\E[17~" +key F7 : "\E[18~" +key F8 : "\E[19~" +key F9 : "\E[20~" +key F10 : "\E[21~" +key F11 : "\E[23~" +key F12 : "\E[24~" + +# Work around dead keys + +key Space +Control : "\x00" + +# Some keys are used by konsole to cause operations. +# The scroll* operations refer to the history buffer. + +key Up +Shift : scrollLineUp +key Prior +Shift : scrollPageUp +key Down +Shift : scrollLineDown +key Next +Shift : scrollPageDown + +key ScrollLock : scrollLock + +# keypad characters are not offered differently by Qt. diff --git a/konsole-qml-plugin/assets/kb-layouts/linux.keytab b/konsole-qml-plugin/assets/kb-layouts/linux.keytab new file mode 100644 index 0000000..b42f95c --- /dev/null +++ b/konsole-qml-plugin/assets/kb-layouts/linux.keytab @@ -0,0 +1,164 @@ +# [linux.keytab] Konsole Keyboard Table (Linux console keys) +# +# -------------------------------------------------------------- + +# NOT TESTED, MAY NEED SOME CLEANUPS +keyboard "Linux console" + +# -------------------------------------------------------------- +# +# This configuration table allows to customize the +# meaning of the keys. +# +# The syntax is that each entry has the form : +# +# "key" Keyname { ("+"|"-") Modename } ":" (String|Operation) +# +# Keynames are those defined in with the +# "Qt::Key_" removed. (We'd better insert the list here) +# +# Mode names are : +# +# - Shift +# - Alt +# - Control +# +# The VT100 emulation has two modes that can affect the +# sequences emitted by certain keys. These modes are +# under control of the client program. +# +# - Newline : effects Return and Enter key. +# - Application : effects Up and Down key. +# +# - Ansi : effects Up and Down key (This is for VT52, really). +# +# Operations are +# +# - scrollUpLine +# - scrollUpPage +# - scrollDownLine +# - scrollDownPage +# +# - emitSelection +# +# If the key is not found here, the text of the +# key event as provided by QT is emitted, possibly +# preceeded by ESC if the Alt key is pressed. +# +# -------------------------------------------------------------- + +key Escape : "\E" +key Tab : "\t" + +# VT100 can add an extra \n after return. +# The NewLine mode is set by an escape sequence. + +key Return-NewLine : "\r" +key Return+NewLine : "\r\n" + +# Some desperately try to save the ^H. + +key Backspace : "\x7f" +key Delete : "\E[3~" + +# These codes are for the VT52 mode of VT100 +# The Ansi mode (i.e. VT100 mode) is set by +# an escape sequence + +key Up -Shift-Ansi : "\EA" +key Down -Shift-Ansi : "\EB" +key Right-Shift-Ansi : "\EC" +key Left -Shift-Ansi : "\ED" + +# VT100 emits a mode bit together +# with the arrow keys.The AppCuKeys +# mode is set by an escape sequence. + +key Up -Shift+Ansi+AppCuKeys : "\EOA" +key Down -Shift+Ansi+AppCuKeys : "\EOB" +key Right-Shift+Ansi+AppCuKeys : "\EOC" +key Left -Shift+Ansi+AppCuKeys : "\EOD" + +key Up -Shift+Ansi-AppCuKeys : "\E[A" +key Down -Shift+Ansi-AppCuKeys : "\E[B" +key Right-Shift+Ansi-AppCuKeys : "\E[C" +key Left -Shift+Ansi-AppCuKeys : "\E[D" + +# linux functions keys F1-F5 differ from xterm + +key F1 : "\E[[A" +key F2 : "\E[[B" +key F3 : "\E[[C" +key F4 : "\E[[D" +key F5 : "\E[[E" + +key F6 : "\E[17~" +key F7 : "\E[18~" +key F8 : "\E[19~" +key F9 : "\E[20~" +key F10 : "\E[21~" +key F11 : "\E[23~" +key F12 : "\E[24~" + +key Home : "\E[1~" +key End : "\E[4~" + +key Prior -Shift : "\E[5~" +key Next -Shift : "\E[6~" +key Insert-Shift : "\E[2~" + +# Keypad-Enter. See comment on Return above. + +key Enter+NewLine : "\r\n" +key Enter-NewLine : "\r" + +key Space +Control : "\x00" + +# linux term ctrl seq + +key A +Control : "\x01" +key B +Control : "\x02" +key C +Control : "\x03" +key D +Control : "\x04" +key E +Control : "\x05" +key F +Control : "\x06" +key G +Control : "\x07" +key H +Control : "\x08" +key I +Control : "\x09" +key J +Control : "\x0a" +key K +Control : "\x0b" +key L +Control : "\x0c" +key M +Control : "\x0d" +key N +Control : "\x0e" +key O +Control : "\x0f" +key P +Control : "\x10" +key Q +Control : "\x11" +key R +Control : "\x12" +key S +Control : "\x13" +key T +Control : "\x14" +key U +Control : "\x15" +key V +Control : "\x16" +key W +Control : "\x17" +key X +Control : "\x18" +key Y +Control : "\x19" +key Z +Control : "\x1a" + + + +# some of keys are used by konsole. + +key Up +Shift : scrollLineUp +key Prior +Shift : scrollPageUp +key Down +Shift : scrollLineDown +key Next +Shift : scrollPageDown + +key ScrollLock : scrollLock + +#---------------------------------------------------------- + +# keypad characters as offered by Qt +# cannot be recognized as such. + +#---------------------------------------------------------- + +# Following other strings as emitted by konsole. diff --git a/konsole-qml-plugin/assets/kb-layouts/macbook.keytab b/konsole-qml-plugin/assets/kb-layouts/macbook.keytab new file mode 100644 index 0000000..adbc784 --- /dev/null +++ b/konsole-qml-plugin/assets/kb-layouts/macbook.keytab @@ -0,0 +1,175 @@ +# [README.default.Keytab] Buildin Keyboard Table +# +# To customize your keyboard, copy this file to something +# ending with .keytab and change it to meet you needs. +# Please read the README.KeyTab and the README.keyboard +# in this case. +# +# -------------------------------------------------------------- + +keyboard "Default (XFree 4)" + +# -------------------------------------------------------------- +# +# Note that this particular table is a "risc" version made to +# ease customization without bothering with obsolete details. +# See VT100.keytab for the more hairy stuff. +# +# -------------------------------------------------------------- + +# common keys + +key Escape : "\x1b" + +#key Control : "^" + +key Tab -Shift : "\t" +key Tab +Shift+Ansi : "\E[Z" +key Tab +Shift-Ansi : "\t" +key Backtab +Ansi : "\E[Z" +key Backtab -Ansi : "\t" + +key Return-Shift-NewLine : "\r" +key Return-Shift+NewLine : "\r\n" + +key Return+Shift : "\EOM" + +# Backspace and Delete codes are preserving CTRL-H. + +key Backspace : "\x7f" + +# Arrow keys in VT52 mode +# shift up/down are reserved for scrolling. +# shift left/right are reserved for switching between tabs (this is hardcoded). + + +# Command + C +# on mac - Control=Command, Meta=Ctrl +# do not use Control+C for interrupt signal - it's used for "Copy to clipboard" +#key Control +C : "\x03" +key Meta +C: "\x03" + + +# Arrow keys in ANSI mode with Application - and Normal Cursor Mode) + +key Up -Shift+Ansi-AppCuKeys : "\E[A" +key Down -Shift+Ansi-AppCuKeys : "\E[B" +key Right-Shift+Ansi-AppCuKeys : "\E[C" +key Left -Shift+Ansi-AppCuKeys : "\E[D" + +key Up -Ansi : "\E[1;*A" +key Down -Ansi : "\E[1;*B" +key Right -Ansi : "\E[1;*C" +key Left -Ansi : "\E[1;*D" + +#key Up -Shift-Ansi : "\EA" +#key Down -Shift-Ansi : "\EB" +#key Right-Shift-Ansi : "\EC" +#key Left -Shift-Ansi : "\ED" + +#key Up -Shift-AnyMod+Ansi-AppCuKeys : "\E[A" +#key Down -Shift-AnyMod+Ansi-AppCuKeys : "\E[B" +#key Right -Shift-AnyMod+Ansi-AppCuKeys : "\E[C" +#key Left -Shift-AnyMod+Ansi-AppCuKeys : "\E[D" + +#key Up -Shift-AnyMod+Ansi-AppCuKeys : "\EOA" +#key Down -Shift-AnyMod+Ansi-AppCuKeys : "\EOB" +#key Right -Shift-AnyMod+Ansi-AppCuKeys : "\EOC" +#key Left -Shift-AnyMod+Ansi-AppCuKeys : "\EOD" + +#key Up -Shift-AnyMod+Ansi : "\E[1;*A" +#key Down -Shift-AnyMod+Ansi : "\E[1;*B" +#key Right -Shift-AnyMod+Ansi : "\E[1;*C" +#key Left -Shift-AnyMod+Ansi : "\E[1;*D" + +# other grey PC keys + +key Enter+NewLine : "\r\n" +key Enter-NewLine : "\r" + +key Home -AnyMod -AppCuKeys : "\E[H" +key End -AnyMod -AppCuKeys : "\E[F" +key Home -AnyMod +AppCuKeys : "\EOH" +key End -AnyMod +AppCuKeys : "\EOF" +key Home +AnyMod : "\E[1;*H" +key End +AnyMod : "\E[1;*F" + +key Insert -AnyMod : "\E[2~" +key Delete -AnyMod : "\E[3~" +key Insert +AnyMod : "\E[2;*~" +key Delete +AnyMod : "\E[3;*~" + +key Prior -Shift-AnyMod : "\E[5~" +key Next -Shift-AnyMod : "\E[6~" +key Prior -Shift+AnyMod : "\E[5;*~" +key Next -Shift+AnyMod : "\E[6;*~" + +# Function keys +#key F1 -AnyMod : "\EOP" +#key F2 -AnyMod : "\EOQ" +#key F3 -AnyMod : "\EOR" +#key F4 -AnyMod : "\EOS" +#define ALT_KP_0 "\033Op" +#define ALT_KP_1 "\033Oq" +#define ALT_KP_2 "\033Or" +#define ALT_KP_3 "\033Os" +#define ALT_KP_4 "\033Ot" +#define ALT_KP_5 "\033Ou" +#define ALT_KP_6 "\033Ov" +#define ALT_KP_7 "\033Ow" +#define ALT_KP_8 "\033Ox" +#define ALT_KP_9 "\033Oy" + +key F1 -AnyMod : "\EOP" +key F2 -AnyMod : "\EOQ" +key F3 -AnyMod : "\EOR" +key F4 -AnyMod : "\EOS" +key F5 -AnyMod : "\EOT" +key F6 -AnyMod : "\EOU" +key F7 -AnyMod : "\EOV" +key F8 -AnyMod : "\EOW" +key F9 -AnyMod : "\EOX" +key F10 -AnyMod : "\EOY" + +#key F5 -AnyMod : "\E[15~" +#key F6 -AnyMod : "\E[17~" +#key F7 -AnyMod : "\E[18~" +#key F8 -AnyMod : "\E[19~" +#key F9 -AnyMod : "\E[20~" +#key F10 -AnyMod : "\E[21~" +#key F11 -AnyMod : "\E[23~" +#key F12 -AnyMod : "\E[24~" + +#key F1 +AnyMod : "\EO*P" +#key F2 +AnyMod : "\EO*Q" +#key F3 +AnyMod : "\EO*R" +#key F4 +AnyMod : "\EO*S" +#key F5 +AnyMod : "\E[15;*~" +#key F6 +AnyMod : "\E[17;*~" +#key F7 +AnyMod : "\E[18;*~" +#key F8 +AnyMod : "\E[19;*~" +#key F9 +AnyMod : "\E[20;*~" +#key F10 +AnyMod : "\E[21;*~" +#key F11 +AnyMod : "\E[23;*~" +#key F12 +AnyMod : "\E[24;*~" + +# Work around dead keys + +key Space +Control : "\x00" + +# Some keys are used by konsole to cause operations. +# The scroll* operations refer to the history buffer. + +key Up +Shift-AppScreen : scrollLineUp +key Prior +Shift-AppScreen : scrollPageUp +key Down +Shift-AppScreen : scrollLineDown +key Next +Shift-AppScreen : scrollPageDown + +#key Up +Shift : scrollLineUp +#key Prior +Shift : scrollPageUp +#key Down +Shift : scrollLineDown +#key Next +Shift : scrollPageDown + +key ScrollLock : scrollLock + +# keypad characters are not offered differently by Qt. diff --git a/konsole-qml-plugin/assets/kb-layouts/solaris.keytab b/konsole-qml-plugin/assets/kb-layouts/solaris.keytab new file mode 100644 index 0000000..0739edf --- /dev/null +++ b/konsole-qml-plugin/assets/kb-layouts/solaris.keytab @@ -0,0 +1,108 @@ +# [solaris.keytab] Konsole Keyboard Table +# + +keyboard "Solaris console" + +# -------------------------------------------------------------- +# +# This configuration table allows to customize the +# meaning of the keys. +# +# The syntax is that each entry has the form : +# +# "key" Keyname { ("+"|"-") Modename } ":" (String|Operation) +# +# Keynames are those defined in with the +# "Qt::Key_" removed. (We'd better insert the list here) +# +# Mode names are : +# +# - Shift +# - Alt +# - Control +# +# The VT100 emulation has two modes that can affect the +# sequences emitted by certain keys. These modes are +# under control of the client program. +# +# +# - Newline : effects Return and Enter key. +# - Application : effects Up and Down key. +# +# - Ansi : effects Up and Down key (This is for VT52, really). +# +# Operations are +# +# - scrollUpLine +# - scrollUpPage +# - scrollDownLine +# - scrollDownPage +# +# - emitSelection +# +# If the key is not found here, the text of the +# key event as provided by QT is emitted, possibly +# preceeded by ESC if the Alt key is pressed. +# +# -------------------------------------------------------------- + +key Escape : "\E" +key Tab : "\t" + +key Return-Alt : "\r" +key Return+Alt : "\E\r" + +# Backspace and Delete codes are preserving CTRL-H. + +key Backspace : "\x08" +#key Delete : "\x7F" + +# cursor keys + +key Up -Shift : "\EOA" +key Down -Shift : "\EOB" +key Right -Shift : "\EOC" +key Left -Shift : "\EOD" + +# other grey PC keys + +key Enter : "\r" + +key Home : "\E[1~" +key Insert-Shift : "\E[2~" +key Delete : "\E[3~" +key End : "\E[4~" +key Prior -Shift : "\E[5~" +key Next -Shift : "\E[6~" + +# function keys + +key F1 : "\E[11~" +key F2 : "\E[12~" +key F3 : "\E[13~" +key F4 : "\E[14~" +key F5 : "\E[15~" +key F6 : "\E[17~" +key F7 : "\E[18~" +key F8 : "\E[19~" +key F9 : "\E[20~" +key F10 : "\E[21~" +key F11 : "\E[23~" +key F12 : "\E[24~" + +# Work around dead keys + +key Space +Control : "\x00" + +# Some keys are used by konsole to cause operations. +# The scroll* operations refer to the history buffer. + +#key Left +Shift : prevSession +#key Right +Shift : nextSession +key Up +Shift : scrollLineUp +key Prior +Shift : scrollPageUp +key Down +Shift : scrollLineDown +key Next +Shift : scrollPageDown +#key Insert+Shift : emitSelection + +# keypad characters are not offered differently by Qt. diff --git a/konsole-qml-plugin/assets/kb-layouts/vt420pc.keytab b/konsole-qml-plugin/assets/kb-layouts/vt420pc.keytab new file mode 100644 index 0000000..ee6aa9a --- /dev/null +++ b/konsole-qml-plugin/assets/kb-layouts/vt420pc.keytab @@ -0,0 +1,168 @@ +# +# NOTE: This keyboard binding is not installed because it +# apparently doesn't work with actual VT420 systems +# (see BUG:170220) +# +# [vt420pc.keytab] Konsole Keyboard Table (VT420pc keys) +# adapted by ferdinand gassauer f.gassauer@aon.at +# Nov 2000 +# +################################################################ +# +# The escape sequences emmited by the +# keys Shift+F1 to Shift+F12 might not fit your needs +# +################# IMPORTANT NOTICE ############################# +# the key bindings (Kcontrol -> look and feel -> keybindgs) +# overrule the settings in this file. The key bindings might be +# changed by the user WITHOUT notification of the maintainer of +# the keytab file. Konsole will not work as expected by +# the maintainer of the keytab file. +################################################################ +# +# -------------------------------------------------------------- + +keyboard "DEC VT420 Terminal" + +# -------------------------------------------------------------- +# +# This configuration table allows to customize the +# meaning of the keys. +# +# The syntax is that each entry has the form : +# +# "key" Keyname { ("+"|"-") Modename } ":" (String|Operation) +# +# Keynames are those defined in with the +# "Qt::Key_" removed. (We'd better insert the list here) +# +# Mode names are : +# +# - Shift +# - Alt +# - Control +# +# The VT100 emulation has two modes that can affect the +# sequences emitted by certain keys. These modes are +# under control of the client program. +# +# - Newline : effects Return and Enter key. +# - Application : effects Up and Down key. +# +# - Ansi : effects Up and Down key (This is for VT52, really). +# +# Operations are +# +# - scrollUpLine +# - scrollUpPage +# - scrollDownLine +# - scrollDownPage +# +# - emitSelection +# +# If the key is not found here, the text of the +# key event as provided by QT is emitted, possibly +# preceeded by ESC if the Alt key is pressed. +# +# -------------------------------------------------------------- + +key Escape : "\E" +key Tab : "\t" +key Backtab: "\E[Z" + +# VT100 can add an extra \n after return. +# The NewLine mode is set by an escape sequence. + +key Return-NewLine : "\r" +key Return+NewLine : "\r\n" + +# Some desperately try to save the ^H. +# may be not everyone wants this + +key Backspace : "\x08" # Control H +key Delete : "\x7f" + +# These codes are for the VT420pc +# The Ansi mode (i.e. VT100 mode) is set by +# an escape sequence + +key Up -Shift-Ansi : "\EA" +key Down -Shift-Ansi : "\EB" +key Right-Shift-Ansi : "\EC" +key Left -Shift-Ansi : "\ED" + +# VT100 emits a mode bit together +# with the arrow keys.The AppCuKeys +# mode is set by an escape sequence. + +key Up -Shift+Ansi+AppCuKeys : "\EOA" +key Down -Shift+Ansi+AppCuKeys : "\EOB" +key Right-Shift+Ansi+AppCuKeys : "\EOC" +key Left -Shift+Ansi+AppCuKeys : "\EOD" + +key Up -Shift+Ansi-AppCuKeys : "\E[A" +key Down -Shift+Ansi-AppCuKeys : "\E[B" +key Right-Shift+Ansi-AppCuKeys : "\E[C" +key Left -Shift+Ansi-AppCuKeys : "\E[D" + +# function keys + +key F1 -Shift : "\E[11~" +key F2 -Shift : "\E[12~" +key F3 -Shift : "\E[13~" +key F4 -Shift : "\E[14~" +key F5 -Shift : "\E[15~" +key F6 -Shift : "\E[17~" +key F7 -Shift : "\E[18~" +key F8 -Shift : "\E[19~" +key F9 -Shift : "\E[20~" +key F10-Shift : "\E[21~" +key F11-Shift : "\E[23~" +key F12-Shift : "\E[24~" +# +# Shift F1-F12 +# +key F1 +Shift : "\E[11;2~" +key F2 +Shift : "\E[12;2~" +key F3 +Shift : "\E[13;2~" +key F4 +Shift : "\E[14;2~" +key F5 +Shift : "\E[15;2~" +key F6 +Shift : "\E[17;2~" +key F7 +Shift : "\E[18;2~" +key F8 +Shift : "\E[19;2~" +key F9 +Shift : "\E[20;2~" +key F10+Shift : "\E[21;2~" +key F11+Shift : "\E[23;2~" +key F12+Shift : "\E[24;2~" + +key Home : "\E[H" +key End : "\E[F" + +key Prior -Shift : "\E[5~" +key Next -Shift : "\E[6~" +key Insert-Shift : "\E[2~" + +# Keypad-Enter. See comment on Return above. + +key Enter+NewLine : "\r\n" +key Enter-NewLine : "\r" + +key Space +Control : "\x00" + +# some of keys are used by konsole. + +key Up +Shift : scrollLineUp +key Prior +Shift : scrollPageUp +key Down +Shift : scrollLineDown +key Next +Shift : scrollPageDown + +key ScrollLock : scrollLock + +#---------------------------------------------------------- + +# keypad characters as offered by Qt +# cannot be recognized as such. + +#---------------------------------------------------------- + +# Following other strings as emitted by konsole. diff --git a/konsole-qml-plugin/debian/changelog b/konsole-qml-plugin/debian/changelog new file mode 100644 index 0000000..a4a741d --- /dev/null +++ b/konsole-qml-plugin/debian/changelog @@ -0,0 +1,29 @@ +konsole-qml-plugin (0.1.2) raring; urgency=low + + * Fixed text display bug (LP:#1182503) + + -- Dmitry Zagnoyko Mon, 10 Jun 2013 09:49:02 +0300 + +konsole-qml-plugin (0.1.1) raring; urgency=low + + * Fixed issue with float values of widget size + * Added virtual key event for qml KSession component + + -- Dmitry Zagnoyko Mon, 06 May 2013 20:11:10 +0300 + +konsole-qml-plugin (0.1.0ubuntu1~quantal1~test2) quantal; urgency=low + + * Added qml properties for KTerminal + * Fixed visibility sope: removed konsole namespace + * Added qmltypes + * Fixed qml plugin path + * Added KSession class + + -- Dmitry Zagnoyko Sat, 20 Apr 2013 21:44:26 +0300 + +konsole-qml-plugin (0.1.0ubuntu1~quantal1~test1) quantal; urgency=low + + * Initial release + * Ported KDE Konsole + + -- Dmitry Zagnoyko Fri, 19 Apr 2013 20:22:12 +0300 diff --git a/konsole-qml-plugin/debian/compat b/konsole-qml-plugin/debian/compat new file mode 100644 index 0000000..ec63514 --- /dev/null +++ b/konsole-qml-plugin/debian/compat @@ -0,0 +1 @@ +9 diff --git a/konsole-qml-plugin/debian/control b/konsole-qml-plugin/debian/control new file mode 100644 index 0000000..576cf99 --- /dev/null +++ b/konsole-qml-plugin/debian/control @@ -0,0 +1,40 @@ +Source: konsole-qml-plugin +Section: libs +Priority: optional +Maintainer: Ubuntu Developers +Build-Depends: debhelper (>= 9.0.0), +# libgl1-mesa-dev | libgl-dev, +# libgles2-mesa-dev + qtbase5-dev, + qtdeclarative5-dev, + qt5-default, +Standards-Version: 3.9.4 +Homepage: http://konsole.kde.org/ + +Package: qtdeclarative5-konsole-qml-plugin +Architecture: any +Multi-Arch: same +Pre-Depends: ${misc:Pre-Depends} +Depends: ${misc:Depends}, ${shlibs:Depends}, +Description: KDE Konsole QML plugin - qml terminal plugin + Originaly, Konsole is a terminal emulator from KDE. This is ported + version and do not require KDE. + . + This package contains the Konsole terminal emulator plugin + for Qt Qml, which offers access to terminal by KTerminal and + KSession elements. KTerminal is used for displaying information + given by KSession. + + +#Package: konsole-qml-plugin-dbg +#Priority: extra +#Architecture: any +#Section: debug +#Depends: ${misc:Depends} +#Description: KDE Konsole QML plugin debugging symbols +# Originaly, Konsole is a terminal emulator from KDE. This is ported +# version without KDE tails and do not require KDE. +# . +# This package contains the debugging symbols for the KDE Konsole +# QML plugin. + diff --git a/konsole-qml-plugin/debian/copyright b/konsole-qml-plugin/debian/copyright new file mode 100644 index 0000000..d94b50b --- /dev/null +++ b/konsole-qml-plugin/debian/copyright @@ -0,0 +1,50 @@ +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/3.0/ +Upstream-Name: konsole-qml-plugin +Source: + +Files: * +Copyright: 2013 Dmitry Zagnoyko + 2008 e_k + 2006-2008 Robert Knight + 2003-2007 Oswald Buddenhagen + 2000 Stephan Kulow + 1997-1998 Lars Doelle +License: GPL-3 + +Files: debian/* +Copyright: 2013 Dmitry Zagnoyko +License: LGPL-3 + +License: GPL-3 + This package 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. + . + This package 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 . + . + On Debian systems, the complete text of the GNU General + Public License can be found in "/usr/share/common-licenses/GPL-3". + +License: LGPL-3 + This package is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 3 of the License. + . + This package 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 + Lesser 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 . + . + On Debian systems, the complete text of the GNU Lesser General + Public License can be found in "/usr/share/common-licenses/LGPL-3". diff --git a/konsole-qml-plugin/debian/rules b/konsole-qml-plugin/debian/rules new file mode 100755 index 0000000..63c23af --- /dev/null +++ b/konsole-qml-plugin/debian/rules @@ -0,0 +1,21 @@ +#!/usr/bin/make -f + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +#export CFLAGS := $(shell dpkg-buildflags --get CFLAGS) $(shell dpkg-buildflags --get CPPFLAGS) +#export CXXFLAGS := $(shell dpkg-buildflags --get CXXFLAGS) $(shell dpkg-buildflags --get CPPFLAGS) +#export LDFLAGS := $(shell dpkg-buildflags --get LDFLAGS) -Wl,--as-needed + +override_dh_auto_configure: + QT_SELECT=qt5 dh_auto_configure + +%: + dh $@ --list-missing --parallel +# WARN: currently, no pakgage +# --dbg-package=konsole-qml-plugin-dbg + + +#override_dh_builddeb: +# dh_builddeb -- -Zxz + diff --git a/konsole-qml-plugin/debian/source/format b/konsole-qml-plugin/debian/source/format new file mode 100644 index 0000000..89ae9db --- /dev/null +++ b/konsole-qml-plugin/debian/source/format @@ -0,0 +1 @@ +3.0 (native) diff --git a/konsole-qml-plugin/konsole-qml-plugin.pro b/konsole-qml-plugin/konsole-qml-plugin.pro new file mode 100644 index 0000000..3008d02 --- /dev/null +++ b/konsole-qml-plugin/konsole-qml-plugin.pro @@ -0,0 +1,99 @@ +######################################### +## CONFIGS +######################################### + +TEMPLATE = lib +CONFIG += qt plugin hide_symbols +QT += qml quick widgets + +DEFINES += HAVE_POSIX_OPENPT HAVE_SYS_TIME_H HAVE_UPDWTMPX + +#MANUALY DEFINED PLATFORM +DEFINES += Q_WS_UBUNTU + +TARGET = kdekonsole +PLUGIN_IMPORT_PATH = org/kde/konsole +PLUGIN_ASSETS = $$PWD/assets/* + +INSTALL_DIR = ../imports + +######################################### +## SOURCES +######################################### + +SOURCES += \ + $$PWD/src/plugin.cpp \ + $$PWD/src/Pty.cpp \ + $$PWD/src/kptyprocess.cpp \ + $$PWD/src/kptydevice.cpp \ + $$PWD/src/kpty.cpp \ + $$PWD/src/kprocess.cpp \ + $$PWD/src/ShellCommand.cpp \ + $$PWD/src/Vt102Emulation.cpp \ + $$PWD/src/tools.cpp \ + $$PWD/src/Session.cpp \ + $$PWD/src/Screen.cpp \ + $$PWD/src/KeyboardTranslator.cpp \ + $$PWD/src/Emulation.cpp \ + $$PWD/src/History.cpp \ + $$PWD/src/BlockArray.cpp \ + $$PWD/src/TerminalCharacterDecoder.cpp \ + $$PWD/src/konsole_wcwidth.cpp \ + $$PWD/src/ScreenWindow.cpp \ + $$PWD/src/Filter.cpp \ + $$PWD/src/ColorScheme.cpp \ + $$PWD/src/TerminalDisplay.cpp \ + $$PWD/src/ksession.cpp + +HEADERS += \ + $$PWD/src/plugin.h \ + $$PWD/src/Pty.h \ + $$PWD/src/kptyprocess.h \ + $$PWD/src/kptydevice.h \ + $$PWD/src/kpty.h \ + $$PWD/src/kpty_p.h \ + $$PWD/src/kprocess.h \ + $$PWD/src/ShellCommand.h \ + $$PWD/src/Vt102Emulation.h \ + $$PWD/src/tools.h \ + $$PWD/src/Session.h \ + $$PWD/src/Screen.h \ + $$PWD/src/KeyboardTranslator.h \ + $$PWD/src/Emulation.h \ + $$PWD/src/Character.h \ + $$PWD/src/History.h \ + $$PWD/src/CharacterColor.h \ + $$PWD/src/BlockArray.h \ + $$PWD/src/TerminalCharacterDecoder.h \ + $$PWD/src/konsole_wcwidth.h \ + $$PWD/src/ScreenWindow.h \ + $$PWD/src/DefaultTranslatorText.h \ + $$PWD/src/LineFont.h \ + $$PWD/src/Filter.h \ + $$PWD/src/ExtendedDefaultTranslator.h \ + $$PWD/src/ColorTables.h \ + $$PWD/src/ColorScheme.h \ + $$PWD/src/TerminalDisplay.h \ + $$PWD/src/ksession.h + +OTHER_FILES += \ + $$PWD/src/qmldir \ + $$PWD/src/plugins.qmltypes + +MOC_DIR = $$PWD/.moc +OBJECTS_DIR = $$PWD/.obj + +######################################### +## INTALLS +######################################### + +target.path = $$INSTALL_DIR/$$PLUGIN_IMPORT_PATH + +assets.files += $$PLUGIN_ASSETS +assets.path += $$INSTALL_DIR/$$PLUGIN_IMPORT_PATH + +qmldir.files += $$PWD/src/qmldir \ + $$PWD/src/plugins.qmltypes +qmldir.path += $$INSTALL_DIR/$$PLUGIN_IMPORT_PATH + +INSTALLS += target qmldir assets diff --git a/konsole-qml-plugin/src/BlockArray.cpp b/konsole-qml-plugin/src/BlockArray.cpp new file mode 100644 index 0000000..0cfa18b --- /dev/null +++ b/konsole-qml-plugin/src/BlockArray.cpp @@ -0,0 +1,377 @@ +/* + This file is part of Konsole, an X terminal. + Copyright (C) 2000 by Stephan Kulow + + Rewritten for QT4 by e_k , Copyright (C)2008 + + 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. + +*/ + +// Own +#include "BlockArray.h" + +#include + +// System +#include +#include +#include +#include +#include + + +static int blocksize = 0; + +BlockArray::BlockArray() + : size(0), + current(size_t(-1)), + index(size_t(-1)), + lastmap(0), + lastmap_index(size_t(-1)), + lastblock(0), ion(-1), + length(0) +{ + // lastmap_index = index = current = size_t(-1); + if (blocksize == 0) { + blocksize = ((sizeof(Block) / getpagesize()) + 1) * getpagesize(); + } + +} + +BlockArray::~BlockArray() +{ + setHistorySize(0); + assert(!lastblock); +} + +size_t BlockArray::append(Block * block) +{ + if (!size) { + return size_t(-1); + } + + ++current; + if (current >= size) { + current = 0; + } + + int rc; + rc = lseek(ion, current * blocksize, SEEK_SET); + if (rc < 0) { + perror("HistoryBuffer::add.seek"); + setHistorySize(0); + return size_t(-1); + } + rc = write(ion, block, blocksize); + if (rc < 0) { + perror("HistoryBuffer::add.write"); + setHistorySize(0); + return size_t(-1); + } + + length++; + if (length > size) { + length = size; + } + + ++index; + + delete block; + return current; +} + +size_t BlockArray::newBlock() +{ + if (!size) { + return size_t(-1); + } + append(lastblock); + + lastblock = new Block(); + return index + 1; +} + +Block * BlockArray::lastBlock() const +{ + return lastblock; +} + +bool BlockArray::has(size_t i) const +{ + if (i == index + 1) { + return true; + } + + if (i > index) { + return false; + } + if (index - i >= length) { + return false; + } + return true; +} + +const Block * BlockArray::at(size_t i) +{ + if (i == index + 1) { + return lastblock; + } + + if (i == lastmap_index) { + return lastmap; + } + + if (i > index) { + qDebug() << "BlockArray::at() i > index\n"; + return 0; + } + +// if (index - i >= length) { +// kDebug(1211) << "BlockArray::at() index - i >= length\n"; +// return 0; +// } + + size_t j = i; // (current - (index - i) + (index/size+1)*size) % size ; + + assert(j < size); + unmap(); + + Block * block = (Block *)mmap(0, blocksize, PROT_READ, MAP_PRIVATE, ion, j * blocksize); + + if (block == (Block *)-1) { + perror("mmap"); + return 0; + } + + lastmap = block; + lastmap_index = i; + + return block; +} + +void BlockArray::unmap() +{ + if (lastmap) { + int res = munmap((char *)lastmap, blocksize); + if (res < 0) { + perror("munmap"); + } + } + lastmap = 0; + lastmap_index = size_t(-1); +} + +bool BlockArray::setSize(size_t newsize) +{ + return setHistorySize(newsize * 1024 / blocksize); +} + +bool BlockArray::setHistorySize(size_t newsize) +{ +// kDebug(1211) << "setHistorySize " << size << " " << newsize; + + if (size == newsize) { + return false; + } + + unmap(); + + if (!newsize) { + delete lastblock; + lastblock = 0; + if (ion >= 0) { + close(ion); + } + ion = -1; + current = size_t(-1); + return true; + } + + if (!size) { + FILE * tmp = tmpfile(); + if (!tmp) { + perror("konsole: cannot open temp file.\n"); + } else { + ion = dup(fileno(tmp)); + if (ion<0) { + perror("konsole: cannot dup temp file.\n"); + fclose(tmp); + } + } + if (ion < 0) { + return false; + } + + assert(!lastblock); + + lastblock = new Block(); + size = newsize; + return false; + } + + if (newsize > size) { + increaseBuffer(); + size = newsize; + return false; + } else { + decreaseBuffer(newsize); + ftruncate(ion, length*blocksize); + size = newsize; + + return true; + } +} + +void moveBlock(FILE * fion, int cursor, int newpos, char * buffer2) +{ + int res = fseek(fion, cursor * blocksize, SEEK_SET); + if (res) { + perror("fseek"); + } + res = fread(buffer2, blocksize, 1, fion); + if (res != 1) { + perror("fread"); + } + + res = fseek(fion, newpos * blocksize, SEEK_SET); + if (res) { + perror("fseek"); + } + res = fwrite(buffer2, blocksize, 1, fion); + if (res != 1) { + perror("fwrite"); + } + // printf("moving block %d to %d\n", cursor, newpos); +} + +void BlockArray::decreaseBuffer(size_t newsize) +{ + if (index < newsize) { // still fits in whole + return; + } + + int offset = (current - (newsize - 1) + size) % size; + + if (!offset) { + return; + } + + // The Block constructor could do somthing in future... + char * buffer1 = new char[blocksize]; + + FILE * fion = fdopen(dup(ion), "w+b"); + if (!fion) { + delete [] buffer1; + perror("fdopen/dup"); + return; + } + + int firstblock; + if (current <= newsize) { + firstblock = current + 1; + } else { + firstblock = 0; + } + + size_t oldpos; + for (size_t i = 0, cursor=firstblock; i < newsize; i++) { + oldpos = (size + cursor + offset) % size; + moveBlock(fion, oldpos, cursor, buffer1); + if (oldpos < newsize) { + cursor = oldpos; + } else { + cursor++; + } + } + + current = newsize - 1; + length = newsize; + + delete [] buffer1; + + fclose(fion); + +} + +void BlockArray::increaseBuffer() +{ + if (index < size) { // not even wrapped once + return; + } + + int offset = (current + size + 1) % size; + if (!offset) { // no moving needed + return; + } + + // The Block constructor could do somthing in future... + char * buffer1 = new char[blocksize]; + char * buffer2 = new char[blocksize]; + + int runs = 1; + int bpr = size; // blocks per run + + if (size % offset == 0) { + bpr = size / offset; + runs = offset; + } + + FILE * fion = fdopen(dup(ion), "w+b"); + if (!fion) { + perror("fdopen/dup"); + delete [] buffer1; + delete [] buffer2; + return; + } + + int res; + for (int i = 0; i < runs; i++) { + // free one block in chain + int firstblock = (offset + i) % size; + res = fseek(fion, firstblock * blocksize, SEEK_SET); + if (res) { + perror("fseek"); + } + res = fread(buffer1, blocksize, 1, fion); + if (res != 1) { + perror("fread"); + } + int newpos = 0; + for (int j = 1, cursor=firstblock; j < bpr; j++) { + cursor = (cursor + offset) % size; + newpos = (cursor - offset + size) % size; + moveBlock(fion, cursor, newpos, buffer2); + } + res = fseek(fion, i * blocksize, SEEK_SET); + if (res) { + perror("fseek"); + } + res = fwrite(buffer1, blocksize, 1, fion); + if (res != 1) { + perror("fwrite"); + } + } + current = size - 1; + length = size; + + delete [] buffer1; + delete [] buffer2; + + fclose(fion); + +} + diff --git a/konsole-qml-plugin/src/BlockArray.h b/konsole-qml-plugin/src/BlockArray.h new file mode 100644 index 0000000..04a021a --- /dev/null +++ b/konsole-qml-plugin/src/BlockArray.h @@ -0,0 +1,126 @@ +/* + This file is part of Konsole, an X terminal. + Copyright (C) 2000 by Stephan Kulow + + Rewritten for QT4 by e_k , Copyright (C)2008 + + 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. +*/ + +#ifndef BLOCKARRAY_H +#define BLOCKARRAY_H + +#include + +//#error Do not use in KDE 2.1 + +#define BlockSize (1 << 12) +#define ENTRIES ((BlockSize - sizeof(size_t) ) / sizeof(unsigned char)) + +struct Block { + Block() { + size = 0; + } + unsigned char data[ENTRIES]; + size_t size; +}; + +// /////////////////////////////////////////////////////// + +class BlockArray { +public: + /** + * Creates a history file for holding + * maximal size blocks. If more blocks + * are requested, then it drops earlier + * added ones. + */ + BlockArray(); + + /// destructor + ~BlockArray(); + + /** + * adds the Block at the end of history. + * This may drop other blocks. + * + * The ownership on the block is transfered. + * An unique index number is returned for accessing + * it later (if not yet dropped then) + * + * Note, that the block may be dropped completely + * if history is turned off. + */ + size_t append(Block * block); + + /** + * gets the block at the index. Function may return + * 0 if the block isn't available any more. + * + * The returned block is strictly readonly as only + * maped in memory - and will be invalid on the next + * operation on this class. + */ + const Block * at(size_t index); + + /** + * reorders blocks as needed. If newsize is null, + * the history is emptied completely. The indices + * returned on append won't change their semantic, + * but they may not be valid after this call. + */ + bool setHistorySize(size_t newsize); + + size_t newBlock(); + + Block * lastBlock() const; + + /** + * Convenient function to set the size in KBytes + * instead of blocks + */ + bool setSize(size_t newsize); + + size_t len() const { + return length; + } + + bool has(size_t index) const; + + size_t getCurrent() const { + return current; + } + +private: + void unmap(); + void increaseBuffer(); + void decreaseBuffer(size_t newsize); + + size_t size; + // current always shows to the last inserted block + size_t current; + size_t index; + + Block * lastmap; + size_t lastmap_index; + Block * lastblock; + + int ion; + size_t length; + +}; + +#endif diff --git a/konsole-qml-plugin/src/Character.h b/konsole-qml-plugin/src/Character.h new file mode 100644 index 0000000..30fb0b8 --- /dev/null +++ b/konsole-qml-plugin/src/Character.h @@ -0,0 +1,221 @@ +/* + This file is part of Konsole, KDE's terminal. + + Copyright 2007-2008 by Robert Knight + Copyright 1997,1998 by Lars Doelle + + 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. +*/ + +#ifndef CHARACTER_H +#define CHARACTER_H + +// Qt +#include + +// Local +#include "CharacterColor.h" + +typedef unsigned char LineProperty; + +static const int LINE_DEFAULT = 0; +static const int LINE_WRAPPED = (1 << 0); +static const int LINE_DOUBLEWIDTH = (1 << 1); +static const int LINE_DOUBLEHEIGHT = (1 << 2); + +#define DEFAULT_RENDITION 0 +#define RE_BOLD (1 << 0) +#define RE_BLINK (1 << 1) +#define RE_UNDERLINE (1 << 2) +#define RE_REVERSE (1 << 3) // Screen only +#define RE_INTENSIVE (1 << 3) // Widget only +#define RE_CURSOR (1 << 4) +#define RE_EXTENDED_CHAR (1 << 5) + +/** + * A single character in the terminal which consists of a unicode character + * value, foreground and background colors and a set of rendition attributes + * which specify how it should be drawn. + */ +class Character +{ +public: + /** + * Constructs a new character. + * + * @param _c The unicode character value of this character. + * @param _f The foreground color used to draw the character. + * @param _b The color used to draw the character's background. + * @param _r A set of rendition flags which specify how this character is to be drawn. + */ + inline Character(quint16 _c = ' ', + CharacterColor _f = CharacterColor(COLOR_SPACE_DEFAULT,DEFAULT_FORE_COLOR), + CharacterColor _b = CharacterColor(COLOR_SPACE_DEFAULT,DEFAULT_BACK_COLOR), + quint8 _r = DEFAULT_RENDITION) + : character(_c), rendition(_r), foregroundColor(_f), backgroundColor(_b) {} + + union + { + /** The unicode character value for this character. */ + quint16 character; + /** + * Experimental addition which allows a single Character instance to contain more than + * one unicode character. + * + * charSequence is a hash code which can be used to look up the unicode + * character sequence in the ExtendedCharTable used to create the sequence. + */ + quint16 charSequence; + }; + + /** A combination of RENDITION flags which specify options for drawing the character. */ + quint8 rendition; + + /** The foreground color used to draw this character. */ + CharacterColor foregroundColor; + /** The color used to draw this character's background. */ + CharacterColor backgroundColor; + + /** + * Returns true if this character has a transparent background when + * it is drawn with the specified @p palette. + */ + bool isTransparent(const ColorEntry* palette) const; + /** + * Returns true if this character should always be drawn in bold when + * it is drawn with the specified @p palette, independent of whether + * or not the character has the RE_BOLD rendition flag. + */ + ColorEntry::FontWeight fontWeight(const ColorEntry* base) const; + + /** + * returns true if the format (color, rendition flag) of the compared characters is equal + */ + bool equalsFormat(const Character &other) const; + + /** + * Compares two characters and returns true if they have the same unicode character value, + * rendition and colors. + */ + friend bool operator == (const Character& a, const Character& b); + /** + * Compares two characters and returns true if they have different unicode character values, + * renditions or colors. + */ + friend bool operator != (const Character& a, const Character& b); +}; + +inline bool operator == (const Character& a, const Character& b) +{ + return a.character == b.character && + a.rendition == b.rendition && + a.foregroundColor == b.foregroundColor && + a.backgroundColor == b.backgroundColor; +} + +inline bool operator != (const Character& a, const Character& b) +{ + return a.character != b.character || + a.rendition != b.rendition || + a.foregroundColor != b.foregroundColor || + a.backgroundColor != b.backgroundColor; +} + +inline bool Character::isTransparent(const ColorEntry* base) const +{ + return ((backgroundColor._colorSpace == COLOR_SPACE_DEFAULT) && + base[backgroundColor._u+0+(backgroundColor._v?BASE_COLORS:0)].transparent) + || ((backgroundColor._colorSpace == COLOR_SPACE_SYSTEM) && + base[backgroundColor._u+2+(backgroundColor._v?BASE_COLORS:0)].transparent); +} + +inline bool Character::equalsFormat(const Character& other) const +{ + return + backgroundColor==other.backgroundColor && + foregroundColor==other.foregroundColor && + rendition==other.rendition; +} + +inline ColorEntry::FontWeight Character::fontWeight(const ColorEntry* base) const +{ + if (backgroundColor._colorSpace == COLOR_SPACE_DEFAULT) + return base[backgroundColor._u+0+(backgroundColor._v?BASE_COLORS:0)].fontWeight; + else if (backgroundColor._colorSpace == COLOR_SPACE_SYSTEM) + return base[backgroundColor._u+2+(backgroundColor._v?BASE_COLORS:0)].fontWeight; + else + return ColorEntry::UseCurrentFormat; +} + +extern unsigned short vt100_graphics[32]; + + +/** + * A table which stores sequences of unicode characters, referenced + * by hash keys. The hash key itself is the same size as a unicode + * character ( ushort ) so that it can occupy the same space in + * a structure. + */ +class ExtendedCharTable +{ +public: + /** Constructs a new character table. */ + ExtendedCharTable(); + ~ExtendedCharTable(); + + /** + * Adds a sequences of unicode characters to the table and returns + * a hash code which can be used later to look up the sequence + * using lookupExtendedChar() + * + * If the same sequence already exists in the table, the hash + * of the existing sequence will be returned. + * + * @param unicodePoints An array of unicode character points + * @param length Length of @p unicodePoints + */ + ushort createExtendedChar(ushort* unicodePoints , ushort length); + /** + * Looks up and returns a pointer to a sequence of unicode characters + * which was added to the table using createExtendedChar(). + * + * @param hash The hash key returned by createExtendedChar() + * @param length This variable is set to the length of the + * character sequence. + * + * @return A unicode character sequence of size @p length. + */ + ushort* lookupExtendedChar(ushort hash , ushort& length) const; + + /** The global ExtendedCharTable instance. */ + static ExtendedCharTable instance; +private: + // calculates the hash key of a sequence of unicode points of size 'length' + ushort extendedCharHash(ushort* unicodePoints , ushort length) const; + // tests whether the entry in the table specified by 'hash' matches the + // character sequence 'unicodePoints' of size 'length' + bool extendedCharMatch(ushort hash , ushort* unicodePoints , ushort length) const; + // internal, maps hash keys to character sequence buffers. The first ushort + // in each value is the length of the buffer, followed by the ushorts in the buffer + // themselves. + QHash extendedCharTable; +}; + + +Q_DECLARE_TYPEINFO(Character, Q_MOVABLE_TYPE); + +#endif // CHARACTER_H + diff --git a/konsole-qml-plugin/src/CharacterColor.h b/konsole-qml-plugin/src/CharacterColor.h new file mode 100644 index 0000000..33cf3ef --- /dev/null +++ b/konsole-qml-plugin/src/CharacterColor.h @@ -0,0 +1,294 @@ +/* + This file is part of Konsole, KDE's terminal. + + Copyright 2007-2008 by Robert Knight + Copyright 1997,1998 by Lars Doelle + + 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. +*/ + +#ifndef CHARACTERCOLOR_H +#define CHARACTERCOLOR_H + +// Qt +#include + +//#include +#define KDE_NO_EXPORT + +/** + * An entry in a terminal display's color palette. + * + * A color palette is an array of 16 ColorEntry instances which map + * system color indexes (from 0 to 15) into actual colors. + * + * Each entry can be set as bold, in which case any text + * drawn using the color should be drawn in bold. + * + * Each entry can also be transparent, in which case the terminal + * display should avoid drawing the background for any characters + * using the entry as a background. + */ +class ColorEntry +{ +public: + /** Specifies the weight to use when drawing text with this color. */ + enum FontWeight + { + /** Always draw text in this color with a bold weight. */ + Bold, + /** Always draw text in this color with a normal weight. */ + Normal, + /** + * Use the current font weight set by the terminal application. + * This is the default behavior. + */ + UseCurrentFormat + }; + + /** + * Constructs a new color palette entry. + * + * @param c The color value for this entry. + * @param tr Specifies that the color should be transparent when used as a background color. + * @param weight Specifies the font weight to use when drawing text with this color. + */ + ColorEntry(QColor c, bool tr, FontWeight weight = UseCurrentFormat) + : color(c), transparent(tr), fontWeight(weight) {} + + /** + * Constructs a new color palette entry with an undefined color, and + * with the transparent and bold flags set to false. + */ + ColorEntry() : transparent(false), fontWeight(UseCurrentFormat) {} + + /** + * Sets the color, transparency and boldness of this color to those of @p rhs. + */ + void operator=(const ColorEntry& rhs) + { + color = rhs.color; + transparent = rhs.transparent; + fontWeight = rhs.fontWeight; + } + + /** The color value of this entry for display. */ + QColor color; + + /** + * If true character backgrounds using this color should be transparent. + * This is not applicable when the color is used to render text. + */ + bool transparent; + /** + * Specifies the font weight to use when drawing text with this color. + * This is not applicable when the color is used to draw a character's background. + */ + FontWeight fontWeight; +}; + + +// Attributed Character Representations /////////////////////////////// + +// Colors + +#define BASE_COLORS (2+8) +#define INTENSITIES 2 +#define TABLE_COLORS (INTENSITIES*BASE_COLORS) + +#define DEFAULT_FORE_COLOR 0 +#define DEFAULT_BACK_COLOR 1 + +//a standard set of colors using black text on a white background. +//defined in TerminalDisplay.cpp + +extern const ColorEntry base_color_table[TABLE_COLORS] KDE_NO_EXPORT; + +/* CharacterColor is a union of the various color spaces. + + Assignment is as follows: + + Type - Space - Values + + 0 - Undefined - u: 0, v:0 w:0 + 1 - Default - u: 0..1 v:intense w:0 + 2 - System - u: 0..7 v:intense w:0 + 3 - Index(256) - u: 16..255 v:0 w:0 + 4 - RGB - u: 0..255 v:0..256 w:0..256 + + Default colour space has two separate colours, namely + default foreground and default background colour. +*/ + +#define COLOR_SPACE_UNDEFINED 0 +#define COLOR_SPACE_DEFAULT 1 +#define COLOR_SPACE_SYSTEM 2 +#define COLOR_SPACE_256 3 +#define COLOR_SPACE_RGB 4 + +/** + * Describes the color of a single character in the terminal. + */ +class CharacterColor +{ + friend class Character; + +public: + /** Constructs a new CharacterColor whoose color and color space are undefined. */ + CharacterColor() + : _colorSpace(COLOR_SPACE_UNDEFINED), + _u(0), + _v(0), + _w(0) + {} + + /** + * Constructs a new CharacterColor using the specified @p colorSpace and with + * color value @p co + * + * The meaning of @p co depends on the @p colorSpace used. + * + * TODO : Document how @p co relates to @p colorSpace + * + * TODO : Add documentation about available color spaces. + */ + CharacterColor(quint8 colorSpace, int co) + : _colorSpace(colorSpace), + _u(0), + _v(0), + _w(0) + { + switch (colorSpace) + { + case COLOR_SPACE_DEFAULT: + _u = co & 1; + break; + case COLOR_SPACE_SYSTEM: + _u = co & 7; + _v = (co >> 3) & 1; + break; + case COLOR_SPACE_256: + _u = co & 255; + break; + case COLOR_SPACE_RGB: + _u = co >> 16; + _v = co >> 8; + _w = co; + break; + default: + _colorSpace = COLOR_SPACE_UNDEFINED; + } + } + + /** + * Returns true if this character color entry is valid. + */ + bool isValid() + { + return _colorSpace != COLOR_SPACE_UNDEFINED; + } + + /** + * Toggles the value of this color between a normal system color and the corresponding intensive + * system color. + * + * This is only applicable if the color is using the COLOR_SPACE_DEFAULT or COLOR_SPACE_SYSTEM + * color spaces. + */ + void toggleIntensive(); + + /** + * Returns the color within the specified color @p palette + * + * The @p palette is only used if this color is one of the 16 system colors, otherwise + * it is ignored. + */ + QColor color(const ColorEntry* palette) const; + + /** + * Compares two colors and returns true if they represent the same color value and + * use the same color space. + */ + friend bool operator == (const CharacterColor& a, const CharacterColor& b); + /** + * Compares two colors and returns true if they represent different color values + * or use different color spaces. + */ + friend bool operator != (const CharacterColor& a, const CharacterColor& b); + +private: + quint8 _colorSpace; + + // bytes storing the character color + quint8 _u; + quint8 _v; + quint8 _w; +}; + +inline bool operator == (const CharacterColor& a, const CharacterColor& b) +{ + return a._colorSpace == b._colorSpace && + a._u == b._u && + a._v == b._v && + a._w == b._w; +} +inline bool operator != (const CharacterColor& a, const CharacterColor& b) +{ + return !operator==(a,b); +} + +inline const QColor color256(quint8 u, const ColorEntry* base) +{ + // 0.. 16: system colors + if (u < 8) return base[u+2 ].color; u -= 8; + if (u < 8) return base[u+2+BASE_COLORS].color; u -= 8; + + // 16..231: 6x6x6 rgb color cube + if (u < 216) return QColor(((u/36)%6) ? (40*((u/36)%6)+55) : 0, + ((u/ 6)%6) ? (40*((u/ 6)%6)+55) : 0, + ((u/ 1)%6) ? (40*((u/ 1)%6)+55) : 0); u -= 216; + + // 232..255: gray, leaving out black and white + int gray = u*10+8; return QColor(gray,gray,gray); +} + +inline QColor CharacterColor::color(const ColorEntry* base) const +{ + switch (_colorSpace) + { + case COLOR_SPACE_DEFAULT: return base[_u+0+(_v?BASE_COLORS:0)].color; + case COLOR_SPACE_SYSTEM: return base[_u+2+(_v?BASE_COLORS:0)].color; + case COLOR_SPACE_256: return color256(_u,base); + case COLOR_SPACE_RGB: return QColor(_u,_v,_w); + case COLOR_SPACE_UNDEFINED: return QColor(); + } + + Q_ASSERT(false); // invalid color space + + return QColor(); +} + +inline void CharacterColor::toggleIntensive() +{ + if (_colorSpace == COLOR_SPACE_SYSTEM || _colorSpace == COLOR_SPACE_DEFAULT) + { + _v = !_v; + } +} + + +#endif // CHARACTERCOLOR_H + diff --git a/konsole-qml-plugin/src/ColorScheme.cpp b/konsole-qml-plugin/src/ColorScheme.cpp new file mode 100644 index 0000000..7f38bf5 --- /dev/null +++ b/konsole-qml-plugin/src/ColorScheme.cpp @@ -0,0 +1,774 @@ +/* + This source file is part of Konsole, a terminal emulator. + + Copyright 2007-2008 by Robert Knight + + 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. +*/ + +// Own +#include "ColorScheme.h" +#include "tools.h" + +// Qt +#include +#include +#include +#include +#include +#include + + +// KDE +//#include +//#include +//#include +//#include +//#include +//#include + + +const ColorEntry ColorScheme::defaultTable[TABLE_COLORS] = + // The following are almost IBM standard color codes, with some slight + // gamma correction for the dim colors to compensate for bright X screens. + // It contains the 8 ansiterm/xterm colors in 2 intensities. +{ + ColorEntry( QColor(0x00,0x00,0x00), 0), ColorEntry( +QColor(0xFF,0xFF,0xFF), 1), // Dfore, Dback + ColorEntry( QColor(0x00,0x00,0x00), 0), ColorEntry( +QColor(0xB2,0x18,0x18), 0), // Black, Red + ColorEntry( QColor(0x18,0xB2,0x18), 0), ColorEntry( +QColor(0xB2,0x68,0x18), 0), // Green, Yellow + ColorEntry( QColor(0x18,0x18,0xB2), 0), ColorEntry( +QColor(0xB2,0x18,0xB2), 0), // Blue, Magenta + ColorEntry( QColor(0x18,0xB2,0xB2), 0), ColorEntry( +QColor(0xB2,0xB2,0xB2), 0), // Cyan, White + // intensive + ColorEntry( QColor(0x00,0x00,0x00), 0), ColorEntry( +QColor(0xFF,0xFF,0xFF), 1), + ColorEntry( QColor(0x68,0x68,0x68), 0), ColorEntry( +QColor(0xFF,0x54,0x54), 0), + ColorEntry( QColor(0x54,0xFF,0x54), 0), ColorEntry( +QColor(0xFF,0xFF,0x54), 0), + ColorEntry( QColor(0x54,0x54,0xFF), 0), ColorEntry( +QColor(0xFF,0x54,0xFF), 0), + ColorEntry( QColor(0x54,0xFF,0xFF), 0), ColorEntry( +QColor(0xFF,0xFF,0xFF), 0) +}; + +const char* const ColorScheme::colorNames[TABLE_COLORS] = +{ + "Foreground", + "Background", + "Color0", + "Color1", + "Color2", + "Color3", + "Color4", + "Color5", + "Color6", + "Color7", + "ForegroundIntense", + "BackgroundIntense", + "Color0Intense", + "Color1Intense", + "Color2Intense", + "Color3Intense", + "Color4Intense", + "Color5Intense", + "Color6Intense", + "Color7Intense" +}; +// dummy silently comment out the tr_NOOP +#define tr_NOOP +const char* const ColorScheme::translatedColorNames[TABLE_COLORS] = +{ + tr_NOOP("Foreground"), + tr_NOOP("Background"), + tr_NOOP("Color 1"), + tr_NOOP("Color 2"), + tr_NOOP("Color 3"), + tr_NOOP("Color 4"), + tr_NOOP("Color 5"), + tr_NOOP("Color 6"), + tr_NOOP("Color 7"), + tr_NOOP("Color 8"), + tr_NOOP("Foreground (Intense)"), + tr_NOOP("Background (Intense)"), + tr_NOOP("Color 1 (Intense)"), + tr_NOOP("Color 2 (Intense)"), + tr_NOOP("Color 3 (Intense)"), + tr_NOOP("Color 4 (Intense)"), + tr_NOOP("Color 5 (Intense)"), + tr_NOOP("Color 6 (Intense)"), + tr_NOOP("Color 7 (Intense)"), + tr_NOOP("Color 8 (Intense)") +}; + +ColorScheme::ColorScheme() +{ + _table = 0; + _randomTable = 0; + _opacity = 1.0; +} +ColorScheme::ColorScheme(const ColorScheme& other) + : _opacity(other._opacity) + ,_table(0) + ,_randomTable(0) +{ + setName(other.name()); + setDescription(other.description()); + + if ( other._table != 0 ) + { + for ( int i = 0 ; i < TABLE_COLORS ; i++ ) + setColorTableEntry(i,other._table[i]); + } + + if ( other._randomTable != 0 ) + { + for ( int i = 0 ; i < TABLE_COLORS ; i++ ) + { + const RandomizationRange& range = other._randomTable[i]; + setRandomizationRange(i,range.hue,range.saturation,range.value); + } + } +} +ColorScheme::~ColorScheme() +{ + delete[] _table; + delete[] _randomTable; +} + +void ColorScheme::setDescription(const QString& description) { _description = description; } +QString ColorScheme::description() const { return _description; } + +void ColorScheme::setName(const QString& name) { _name = name; } +QString ColorScheme::name() const { return _name; } + +void ColorScheme::setColorTableEntry(int index , const ColorEntry& entry) +{ + Q_ASSERT( index >= 0 && index < TABLE_COLORS ); + + if ( !_table ) + { + _table = new ColorEntry[TABLE_COLORS]; + + for (int i=0;i= 0 && index < TABLE_COLORS ); + + if ( randomSeed != 0 ) + qsrand(randomSeed); + + ColorEntry entry = colorTable()[index]; + + if ( randomSeed != 0 && + _randomTable != 0 && + !_randomTable[index].isNull() ) + { + const RandomizationRange& range = _randomTable[index]; + + + int hueDifference = range.hue ? (qrand() % range.hue) - range.hue/2 : 0; + int saturationDifference = range.saturation ? (qrand() % range.saturation) - range.saturation/2 : 0; + int valueDifference = range.value ? (qrand() % range.value) - range.value/2 : 0; + + QColor& color = entry.color; + + int newHue = qAbs( (color.hue() + hueDifference) % MAX_HUE ); + int newValue = qMin( qAbs(color.value() + valueDifference) , 255 ); + int newSaturation = qMin( qAbs(color.saturation() + saturationDifference) , 255 ); + + color.setHsv(newHue,newSaturation,newValue); + } + + return entry; +} +void ColorScheme::getColorTable(ColorEntry* table , uint randomSeed) const +{ + for ( int i = 0 ; i < TABLE_COLORS ; i++ ) + table[i] = colorEntry(i,randomSeed); +} +bool ColorScheme::randomizedBackgroundColor() const +{ + return _randomTable == 0 ? false : !_randomTable[1].isNull(); +} +void ColorScheme::setRandomizedBackgroundColor(bool randomize) +{ + // the hue of the background colour is allowed to be randomly + // adjusted as much as possible. + // + // the value and saturation are left alone to maintain read-ability + if ( randomize ) + { + setRandomizationRange( 1 /* background color index */ , MAX_HUE , 255 , 0 ); + } + else + { + if ( _randomTable ) + setRandomizationRange( 1 /* background color index */ , 0 , 0 , 0 ); + } +} + +void ColorScheme::setRandomizationRange( int index , quint16 hue , quint8 saturation , + quint8 value ) +{ + Q_ASSERT( hue <= MAX_HUE ); + Q_ASSERT( index >= 0 && index < TABLE_COLORS ); + + if ( _randomTable == 0 ) + _randomTable = new RandomizationRange[TABLE_COLORS]; + + _randomTable[index].hue = hue; + _randomTable[index].value = value; + _randomTable[index].saturation = saturation; +} + +const ColorEntry* ColorScheme::colorTable() const +{ + if ( _table ) + return _table; + else + return defaultTable; +} +QColor ColorScheme::foregroundColor() const +{ + return colorTable()[0].color; +} +QColor ColorScheme::backgroundColor() const +{ + return colorTable()[1].color; +} +bool ColorScheme::hasDarkBackground() const +{ + // value can range from 0 - 255, with larger values indicating higher brightness. + // so 127 is in the middle, anything less is deemed 'dark' + return backgroundColor().value() < 127; +} +void ColorScheme::setOpacity(qreal opacity) { _opacity = opacity; } +qreal ColorScheme::opacity() const { return _opacity; } + +void ColorScheme::read(const QString & fileName) +{ + QSettings s(fileName, QSettings::IniFormat); + s.beginGroup("General"); + + _description = s.value("Description", QObject::tr("Un-named Color Scheme")).toString(); + _opacity = s.value("Opacity",qreal(1.0)).toDouble(); + s.endGroup(); + + for (int i=0 ; i < TABLE_COLORS ; i++) + { + readColorEntry(&s, i); + } +} +#if 0 +// implemented upstream - user apps +void ColorScheme::read(KConfig& config) +{ + KConfigGroup configGroup = config.group("General"); + + QString description = configGroup.readEntry("Description", QObject::tr("Un-named Color Scheme")); + + _description = tr(description.toUtf8()); + _opacity = configGroup.readEntry("Opacity",qreal(1.0)); + + for (int i=0 ; i < TABLE_COLORS ; i++) + { + readColorEntry(config,i); + } +} +void ColorScheme::write(KConfig& config) const +{ + KConfigGroup configGroup = config.group("General"); + + configGroup.writeEntry("Description",_description); + configGroup.writeEntry("Opacity",_opacity); + + for (int i=0 ; i < TABLE_COLORS ; i++) + { + RandomizationRange random = _randomTable != 0 ? _randomTable[i] : RandomizationRange(); + writeColorEntry(config,colorNameForIndex(i),colorTable()[i],random); + } +} +#endif + +QString ColorScheme::colorNameForIndex(int index) +{ + Q_ASSERT( index >= 0 && index < TABLE_COLORS ); + + return QString(colorNames[index]); +} +QString ColorScheme::translatedColorNameForIndex(int index) +{ + Q_ASSERT( index >= 0 && index < TABLE_COLORS ); + + return translatedColorNames[index]; +} + +void ColorScheme::readColorEntry(QSettings * s , int index) +{ + s->beginGroup(colorNameForIndex(index)); + + ColorEntry entry; + + QStringList rgbList = s->value("Color", QStringList()).toStringList(); + if (rgbList.count() != 3) + { + Q_ASSERT(0); + } + int r, g, b; + r = rgbList[0].toInt(); + g = rgbList[1].toInt(); + b = rgbList[2].toInt(); + entry.color = QColor(r, g, b); + + entry.transparent = s->value("Transparent",false).toBool(); + + // Deprecated key from KDE 4.0 which set 'Bold' to true to force + // a color to be bold or false to use the current format + // + // TODO - Add a new tri-state key which allows for bold, normal or + // current format + if (s->contains("Bold")) + entry.fontWeight = s->value("Bold",false).toBool() ? ColorEntry::Bold : + ColorEntry::UseCurrentFormat; + + quint16 hue = s->value("MaxRandomHue",0).toInt(); + quint8 value = s->value("MaxRandomValue",0).toInt(); + quint8 saturation = s->value("MaxRandomSaturation",0).toInt(); + + setColorTableEntry( index , entry ); + + if ( hue != 0 || value != 0 || saturation != 0 ) + setRandomizationRange( index , hue , saturation , value ); + + s->endGroup(); +} +#if 0 +// implemented upstream - user apps +void ColorScheme::writeColorEntry(KConfig& config , const QString& colorName, const ColorEntry& entry , const RandomizationRange& random) const +{ + KConfigGroup configGroup(&config,colorName); + + configGroup.writeEntry("Color",entry.color); + configGroup.writeEntry("Transparency",(bool)entry.transparent); + if (entry.fontWeight != ColorEntry::UseCurrentFormat) + { + configGroup.writeEntry("Bold",entry.fontWeight == ColorEntry::Bold); + } + + // record randomization if this color has randomization or + // if one of the keys already exists + if ( !random.isNull() || configGroup.hasKey("MaxRandomHue") ) + { + configGroup.writeEntry("MaxRandomHue",(int)random.hue); + configGroup.writeEntry("MaxRandomValue",(int)random.value); + configGroup.writeEntry("MaxRandomSaturation",(int)random.saturation); + } +} +#endif + +// +// Work In Progress - A color scheme for use on KDE setups for users +// with visual disabilities which means that they may have trouble +// reading text with the supplied color schemes. +// +// This color scheme uses only the 'safe' colors defined by the +// KColorScheme class. +// +// A complication this introduces is that each color provided by +// KColorScheme is defined as a 'background' or 'foreground' color. +// Only foreground colors are allowed to be used to render text and +// only background colors are allowed to be used for backgrounds. +// +// The ColorEntry and TerminalDisplay classes do not currently +// support this restriction. +// +// Requirements: +// - A color scheme which uses only colors from the KColorScheme class +// - Ability to restrict which colors the TerminalDisplay widget +// uses as foreground and background color +// - Make use of KGlobalSettings::allowDefaultBackgroundImages() as +// a hint to determine whether this accessible color scheme should +// be used by default. +// +// +// -- Robert Knight 21/07/2007 +// +AccessibleColorScheme::AccessibleColorScheme() + : ColorScheme() +{ +#if 0 +// It's not finished in konsole and it breaks Qt4 compilation as well + // basic attributes + setName("accessible"); + setDescription(QObject::tr("Accessible Color Scheme")); + + // setup colors + const int ColorRoleCount = 8; + + const KColorScheme colorScheme(QPalette::Active); + + QBrush colors[ColorRoleCount] = + { + colorScheme.foreground( colorScheme.NormalText ), + colorScheme.background( colorScheme.NormalBackground ), + + colorScheme.foreground( colorScheme.InactiveText ), + colorScheme.foreground( colorScheme.ActiveText ), + colorScheme.foreground( colorScheme.LinkText ), + colorScheme.foreground( colorScheme.VisitedText ), + colorScheme.foreground( colorScheme.NegativeText ), + colorScheme.foreground( colorScheme.NeutralText ) + }; + + for ( int i = 0 ; i < TABLE_COLORS ; i++ ) + { + ColorEntry entry; + entry.color = colors[ i % ColorRoleCount ].color(); + + setColorTableEntry( i , entry ); + } +#endif +} + +KDE3ColorSchemeReader::KDE3ColorSchemeReader( QIODevice* device ) : + _device(device) +{ +} +ColorScheme* KDE3ColorSchemeReader::read() +{ + Q_ASSERT( _device->openMode() == QIODevice::ReadOnly || + _device->openMode() == QIODevice::ReadWrite ); + + ColorScheme* scheme = new ColorScheme(); + + QRegExp comment("#.*$"); + while ( !_device->atEnd() ) + { + QString line(_device->readLine()); + line.remove(comment); + line = line.simplified(); + + if ( line.isEmpty() ) + continue; + + if ( line.startsWith(QLatin1String("color")) ) + { + if (!readColorLine(line,scheme)) + qDebug() << "Failed to read KDE 3 color scheme line" << line; + } + else if ( line.startsWith(QLatin1String("title")) ) + { + if (!readTitleLine(line,scheme)) + qDebug() << "Failed to read KDE 3 color scheme title line" << line; + } + else + { + qDebug() << "KDE 3 color scheme contains an unsupported feature, '" << + line << "'"; + } + } + + return scheme; +} +bool KDE3ColorSchemeReader::readColorLine(const QString& line,ColorScheme* scheme) +{ + QStringList list = line.split(QChar(' ')); + + if (list.count() != 7) + return false; + if (list.first() != "color") + return false; + + int index = list[1].toInt(); + int red = list[2].toInt(); + int green = list[3].toInt(); + int blue = list[4].toInt(); + int transparent = list[5].toInt(); + int bold = list[6].toInt(); + + const int MAX_COLOR_VALUE = 255; + + if( (index < 0 || index >= TABLE_COLORS ) + || (red < 0 || red > MAX_COLOR_VALUE ) + || (blue < 0 || blue > MAX_COLOR_VALUE ) + || (green < 0 || green > MAX_COLOR_VALUE ) + || (transparent != 0 && transparent != 1 ) + || (bold != 0 && bold != 1) ) + return false; + + ColorEntry entry; + entry.color = QColor(red,green,blue); + entry.transparent = ( transparent != 0 ); + entry.fontWeight = ( bold != 0 ) ? ColorEntry::Bold : ColorEntry::UseCurrentFormat; + + scheme->setColorTableEntry(index,entry); + return true; +} +bool KDE3ColorSchemeReader::readTitleLine(const QString& line,ColorScheme* scheme) +{ + if( !line.startsWith(QLatin1String("title")) ) + return false; + + int spacePos = line.indexOf(' '); + if( spacePos == -1 ) + return false; + + QString description = line.mid(spacePos+1); + + scheme->setDescription(description.toUtf8()); + return true; +} +ColorSchemeManager::ColorSchemeManager() + : _haveLoadedAll(false) +{ +} +ColorSchemeManager::~ColorSchemeManager() +{ + QHashIterator iter(_colorSchemes); + while (iter.hasNext()) + { + iter.next(); + delete iter.value(); + } +} +void ColorSchemeManager::loadAllColorSchemes() +{ + qDebug() << "loadAllColorSchemes"; + int success = 0; + int failed = 0; + + QList nativeColorSchemes = listColorSchemes(); + + QListIterator nativeIter(nativeColorSchemes); + while ( nativeIter.hasNext() ) + { + if ( loadColorScheme( nativeIter.next() ) ) + success++; + else + failed++; + } + + QList kde3ColorSchemes = listKDE3ColorSchemes(); + QListIterator kde3Iter(kde3ColorSchemes); + while ( kde3Iter.hasNext() ) + { + if ( loadKDE3ColorScheme( kde3Iter.next() ) ) + success++; + else + failed++; + } + + if ( failed > 0 ) + qDebug() << "failed to load " << failed << " color schemes."; + + _haveLoadedAll = true; +} +QList ColorSchemeManager::allColorSchemes() +{ + if ( !_haveLoadedAll ) + { + loadAllColorSchemes(); + } + + return _colorSchemes.values(); +} +bool ColorSchemeManager::loadKDE3ColorScheme(const QString& filePath) +{ + QFile file(filePath); + if (!filePath.endsWith(QLatin1String(".schema")) || !file.open(QIODevice::ReadOnly)) + return false; + + KDE3ColorSchemeReader reader(&file); + ColorScheme* scheme = reader.read(); + scheme->setName(QFileInfo(file).baseName()); + file.close(); + + if (scheme->name().isEmpty()) + { + qDebug() << "color scheme name is not valid."; + delete scheme; + return false; + } + + QFileInfo info(filePath); + + if ( !_colorSchemes.contains(info.baseName()) ) + _colorSchemes.insert(scheme->name(),scheme); + else + { + qDebug() << "color scheme with name" << scheme->name() << "has already been" << + "found, ignoring."; + delete scheme; + } + + return true; +} +#if 0 +void ColorSchemeManager::addColorScheme(ColorScheme* scheme) +{ + _colorSchemes.insert(scheme->name(),scheme); + + // save changes to disk + QString path = KGlobal::dirs()->saveLocation("data","konsole/") + scheme->name() + ".colorscheme"; + KConfig config(path , KConfig::NoGlobals); + + scheme->write(config); +} +#endif +bool ColorSchemeManager::loadColorScheme(const QString& filePath) +{ + if ( !filePath.endsWith(QLatin1String(".colorscheme")) || !QFile::exists(filePath) ) + return false; + + QFileInfo info(filePath); + + ColorScheme* scheme = new ColorScheme(); + scheme->setName(info.baseName()); + scheme->read(filePath); + + if (scheme->name().isEmpty()) + { + qDebug() << "Color scheme in" << filePath << "does not have a valid name and was not loaded."; + delete scheme; + return false; + } + + if ( !_colorSchemes.contains(info.baseName()) ) + { + _colorSchemes.insert(scheme->name(),scheme); + } + else + { + qDebug() << "color scheme with name" << scheme->name() << "has already been" << + "found, ignoring."; + + delete scheme; + } + + return true; +} +QList ColorSchemeManager::listKDE3ColorSchemes() +{ + QString dname(get_color_schemes_dir()); + QDir dir(dname); + QStringList filters; + filters << "*.schema"; + dir.setNameFilters(filters); + QStringList list = dir.entryList(filters); + QStringList ret; + foreach(QString i, list) + ret << dname + "/" + i; + return ret; + //return KGlobal::dirs()->findAllResources("data", + // "konsole/*.schema", + // KStandardDirs::NoDuplicates); + // +} +QList ColorSchemeManager::listColorSchemes() +{ + QString dname(get_color_schemes_dir()); + QDir dir(dname); + QStringList filters; + filters << "*.colorscheme"; + dir.setNameFilters(filters); + QStringList list = dir.entryList(filters); + QStringList ret; + foreach(QString i, list) + ret << dname + "/" + i; + return ret; +// return KGlobal::dirs()->findAllResources("data", +// "konsole/*.colorscheme", +// KStandardDirs::NoDuplicates); +} +const ColorScheme ColorSchemeManager::_defaultColorScheme; +const ColorScheme* ColorSchemeManager::defaultColorScheme() const +{ + return &_defaultColorScheme; +} +bool ColorSchemeManager::deleteColorScheme(const QString& name) +{ + Q_ASSERT( _colorSchemes.contains(name) ); + + // lookup the path and delete + QString path = findColorSchemePath(name); + if ( QFile::remove(path) ) + { + _colorSchemes.remove(name); + return true; + } + else + { + qDebug() << "Failed to remove color scheme -" << path; + return false; + } +} +QString ColorSchemeManager::findColorSchemePath(const QString& name) const +{ +// QString path = KStandardDirs::locate("data","konsole/"+name+".colorscheme"); + QString path(get_color_schemes_dir() + "/"+ name + ".colorscheme"); + if ( !path.isEmpty() ) + return path; + + //path = KStandardDirs::locate("data","konsole/"+name+".schema"); + path = get_color_schemes_dir() + "/"+ name + ".schema"; + + return path; +} +const ColorScheme* ColorSchemeManager::findColorScheme(const QString& name) +{ + if ( name.isEmpty() ) + return defaultColorScheme(); + + if ( _colorSchemes.contains(name) ) + return _colorSchemes[name]; + else + { + // look for this color scheme + QString path = findColorSchemePath(name); + if ( !path.isEmpty() && loadColorScheme(path) ) + { + return findColorScheme(name); + } + else + { + if (!path.isEmpty() && loadKDE3ColorScheme(path)) + return findColorScheme(name); + } + + qDebug() << "Could not find color scheme - " << name; + + return 0; + } +} + +ColorSchemeManager* ColorSchemeManager::theColorSchemeManager = 0; +//K_GLOBAL_STATIC( ColorSchemeManager , theColorSchemeManager ) +ColorSchemeManager* ColorSchemeManager::instance() +{ + if (! theColorSchemeManager) + theColorSchemeManager = new ColorSchemeManager(); + return theColorSchemeManager; +} diff --git a/konsole-qml-plugin/src/ColorScheme.h b/konsole-qml-plugin/src/ColorScheme.h new file mode 100644 index 0000000..1da466e --- /dev/null +++ b/konsole-qml-plugin/src/ColorScheme.h @@ -0,0 +1,342 @@ +/* + This source file is part of Konsole, a terminal emulator. + + Copyright 2007-2008 by Robert Knight + + 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. +*/ + +#ifndef COLORSCHEME_H +#define COLORSCHEME_H + +// Qt +#include +#include +#include +#include +#include +#include + +// Konsole +#include "CharacterColor.h" + +class QIODevice; +//class KConfig; + + +/** + * Represents a color scheme for a terminal display. + * + * The color scheme includes the palette of colors used to draw the text and character backgrounds + * in the display and the opacity level of the display background. + */ +class ColorScheme +{ +public: + /** + * Constructs a new color scheme which is initialised to the default color set + * for Konsole. + */ + ColorScheme(); + ColorScheme(const ColorScheme& other); + ~ColorScheme(); + + /** Sets the descriptive name of the color scheme. */ + void setDescription(const QString& description); + /** Returns the descriptive name of the color scheme. */ + QString description() const; + + /** Sets the name of the color scheme */ + void setName(const QString& name); + /** Returns the name of the color scheme */ + QString name() const; + +#if 0 +// Implemented upstream - in user apps + /** Reads the color scheme from the specified configuration source */ + void read(KConfig& config); + /** Writes the color scheme to the specified configuration source */ + void write(KConfig& config) const; +#endif + void read(const QString & filename); + + /** Sets a single entry within the color palette. */ + void setColorTableEntry(int index , const ColorEntry& entry); + + /** + * Copies the color entries which form the palette for this color scheme + * into @p table. @p table should be an array with TABLE_COLORS entries. + * + * @param table Array into which the color entries for this color scheme + * are copied. + * @param randomSeed Color schemes may allow certain colors in their + * palette to be randomized. The seed is used to pick the random color. + */ + void getColorTable(ColorEntry* table, uint randomSeed = 0) const; + + /** + * Retrieves a single color entry from the table. + * + * See getColorTable() + */ + ColorEntry colorEntry(int index , uint randomSeed = 0) const; + + /** + * Convenience method. Returns the + * foreground color for this scheme, + * this is the primary color used to draw the + * text in this scheme. + */ + QColor foregroundColor() const; + /** + * Convenience method. Returns the background color for + * this scheme, this is the primary color used to + * draw the terminal background in this scheme. + */ + QColor backgroundColor() const; + + /** + * Returns true if this color scheme has a dark background. + * The background color is said to be dark if it has a value of less than 127 + * in the HSV color space. + */ + bool hasDarkBackground() const; + + /** + * Sets the opacity level of the display background. @p opacity ranges + * between 0 (completely transparent background) and 1 (completely + * opaque background). + * + * Defaults to 1. + * + * TODO: More documentation + */ + void setOpacity(qreal opacity); + /** + * Returns the opacity level for this color scheme, see setOpacity() + * TODO: More documentation + */ + qreal opacity() const; + + /** + * Enables randomization of the background color. This will cause + * the palette returned by getColorTable() and colorEntry() to + * be adjusted depending on the value of the random seed argument + * to them. + */ + void setRandomizedBackgroundColor(bool randomize); + + /** Returns true if the background color is randomized. */ + bool randomizedBackgroundColor() const; + + static QString colorNameForIndex(int index); + static QString translatedColorNameForIndex(int index); + +private: + // specifies how much a particular color can be randomized by + class RandomizationRange + { + public: + RandomizationRange() : hue(0) , saturation(0) , value(0) {} + + bool isNull() const + { + return ( hue == 0 && saturation == 0 && value == 0 ); + } + + quint16 hue; + quint8 saturation; + quint8 value; + }; + + // returns the active color table. if none has been set specifically, + // this is the default color table. + const ColorEntry* colorTable() const; + +#if 0 +// implemented upstream - user apps + // reads a single colour entry from a KConfig source + // and sets the palette entry at 'index' to the entry read. + void readColorEntry(KConfig& config , int index); + // writes a single colour entry to a KConfig source + void writeColorEntry(KConfig& config , const QString& colorName, const ColorEntry& entry,const RandomizationRange& range) const; +#endif + void readColorEntry(QSettings *s, int index); + + // sets the amount of randomization allowed for a particular color + // in the palette. creates the randomization table if + // it does not already exist + void setRandomizationRange( int index , quint16 hue , quint8 saturation , quint8 value ); + + QString _description; + QString _name; + qreal _opacity; + ColorEntry* _table; // pointer to custom color table or 0 if the default + // color scheme is being used + + + static const quint16 MAX_HUE = 340; + + RandomizationRange* _randomTable; // pointer to randomization table or 0 + // if no colors in the color scheme support + // randomization + + static const char* const colorNames[TABLE_COLORS]; + static const char* const translatedColorNames[TABLE_COLORS]; + + static const ColorEntry defaultTable[]; // table of default color entries +}; + +/** + * A color scheme which uses colors from the standard KDE color palette. + * + * This is designed primarily for the benefit of users who are using specially + * designed colors. + * + * TODO Implement and make it the default on systems with specialized KDE + * color schemes. + */ +class AccessibleColorScheme : public ColorScheme +{ +public: + AccessibleColorScheme(); +}; + +/** + * Reads a color scheme stored in the .schema format used in the KDE 3 incarnation + * of Konsole + * + * Only the basic essentials ( title and color palette entries ) are currently + * supported. Additional options such as background image and background + * blend colors are ignored. + */ +class KDE3ColorSchemeReader +{ +public: + /** + * Constructs a new reader which reads from the specified device. + * The device should be open in read-only mode. + */ + KDE3ColorSchemeReader( QIODevice* device ); + + /** + * Reads and parses the contents of the .schema file from the input + * device and returns the ColorScheme defined within it. + * + * Returns a null pointer if an error occurs whilst parsing + * the contents of the file. + */ + ColorScheme* read(); + +private: + // reads a line from the file specifying a colour palette entry + // format is: color [index] [red] [green] [blue] [transparent] [bold] + bool readColorLine(const QString& line , ColorScheme* scheme); + bool readTitleLine(const QString& line , ColorScheme* scheme); + + QIODevice* _device; +}; + +/** + * Manages the color schemes available for use by terminal displays. + * See ColorScheme + */ +class ColorSchemeManager +{ +public: + + /** + * Constructs a new ColorSchemeManager and loads the list + * of available color schemes. + * + * The color schemes themselves are not loaded until they are first + * requested via a call to findColorScheme() + */ + ColorSchemeManager(); + /** + * Destroys the ColorSchemeManager and saves any modified color schemes to disk. + */ + ~ColorSchemeManager(); + + /** + * Returns the default color scheme for Konsole + */ + const ColorScheme* defaultColorScheme() const; + + /** + * Returns the color scheme with the given name or 0 if no + * scheme with that name exists. If @p name is empty, the + * default color scheme is returned. + * + * The first time that a color scheme with a particular name is + * requested, the configuration information is loaded from disk. + */ + const ColorScheme* findColorScheme(const QString& name); + +#if 0 + /** + * Adds a new color scheme to the manager. If @p scheme has the same name as + * an existing color scheme, it replaces the existing scheme. + * + * TODO - Ensure the old color scheme gets deleted + */ + void addColorScheme(ColorScheme* scheme); +#endif + /** + * Deletes a color scheme. Returns true on successful deletion or false otherwise. + */ + bool deleteColorScheme(const QString& name); + + /** + * Returns a list of the all the available color schemes. + * This may be slow when first called because all of the color + * scheme resources on disk must be located, read and parsed. + * + * Subsequent calls will be inexpensive. + */ + QList allColorSchemes(); + + /** Returns the global color scheme manager instance. */ + static ColorSchemeManager* instance(); + +private: + // loads a color scheme from a KDE 4+ .colorscheme file + bool loadColorScheme(const QString& path); + // loads a color scheme from a KDE 3 .schema file + bool loadKDE3ColorScheme(const QString& path); + // returns a list of paths of color schemes in the KDE 4+ .colorscheme file format + QList listColorSchemes(); + // returns a list of paths of color schemes in the .schema file format + // used in KDE 3 + QList listKDE3ColorSchemes(); + // loads all of the color schemes + void loadAllColorSchemes(); + // finds the path of a color scheme + QString findColorSchemePath(const QString& name) const; + + QHash _colorSchemes; + QSet _modifiedSchemes; + + bool _haveLoadedAll; + + static const ColorScheme _defaultColorScheme; + + static ColorSchemeManager * theColorSchemeManager; +}; + +Q_DECLARE_METATYPE(const ColorScheme*) + +#endif //COLORSCHEME_H diff --git a/konsole-qml-plugin/src/ColorTables.h b/konsole-qml-plugin/src/ColorTables.h new file mode 100644 index 0000000..57b0bd1 --- /dev/null +++ b/konsole-qml-plugin/src/ColorTables.h @@ -0,0 +1,55 @@ +#ifndef _COLOR_TABLE_H +#define _COLOR_TABLE_H + +#include "CharacterColor.h" + +//using namespace Konsole; +#if 0 +static const ColorEntry whiteonblack_color_table[TABLE_COLORS] = { + // normal + ColorEntry(QColor(0xFF,0xFF,0xFF), false ), ColorEntry( QColor(0x00,0x00,0x00), true ), // Dfore, Dback + ColorEntry(QColor(0x00,0x00,0x00), false ), ColorEntry( QColor(0xB2,0x18,0x18), false ), // Black, Red + ColorEntry(QColor(0x18,0xB2,0x18), false ), ColorEntry( QColor(0xB2,0x68,0x18), false ), // Green, Yellow + ColorEntry(QColor(0x18,0x18,0xB2), false ), ColorEntry( QColor(0xB2,0x18,0xB2), false ), // Blue, Magenta + ColorEntry(QColor(0x18,0xB2,0xB2), false ), ColorEntry( QColor(0xB2,0xB2,0xB2), false ), // Cyan, White + // intensiv + ColorEntry(QColor(0x00,0x00,0x00), false ), ColorEntry( QColor(0xFF,0xFF,0xFF), true ), + ColorEntry(QColor(0x68,0x68,0x68), false ), ColorEntry( QColor(0xFF,0x54,0x54), false ), + ColorEntry(QColor(0x54,0xFF,0x54), false ), ColorEntry( QColor(0xFF,0xFF,0x54), false ), + ColorEntry(QColor(0x54,0x54,0xFF), false ), ColorEntry( QColor(0xFF,0x54,0xFF), false ), + ColorEntry(QColor(0x54,0xFF,0xFF), false ), ColorEntry( QColor(0xFF,0xFF,0xFF), false ) +}; + +static const ColorEntry greenonblack_color_table[TABLE_COLORS] = { + ColorEntry(QColor( 24, 240, 24), false), ColorEntry(QColor( 0, 0, 0), true), + ColorEntry(QColor( 0, 0, 0), false), ColorEntry(QColor( 178, 24, 24), false), + ColorEntry(QColor( 24, 178, 24), false), ColorEntry(QColor( 178, 104, 24), false), + ColorEntry(QColor( 24, 24, 178), false), ColorEntry(QColor( 178, 24, 178), false), + ColorEntry(QColor( 24, 178, 178), false), ColorEntry(QColor( 178, 178, 178), false), + // intensive colors + ColorEntry(QColor( 24, 240, 24), false ), ColorEntry(QColor( 0, 0, 0), true ), + ColorEntry(QColor( 104, 104, 104), false ), ColorEntry(QColor( 255, 84, 84), false ), + ColorEntry(QColor( 84, 255, 84), false ), ColorEntry(QColor( 255, 255, 84), false ), + ColorEntry(QColor( 84, 84, 255), false ), ColorEntry(QColor( 255, 84, 255), false ), + ColorEntry(QColor( 84, 255, 255), false ), ColorEntry(QColor( 255, 255, 255), false ) +}; + +static const ColorEntry blackonlightyellow_color_table[TABLE_COLORS] = { + ColorEntry(QColor( 0, 0, 0), false), ColorEntry(QColor( 255, 255, 221), true), + ColorEntry(QColor( 0, 0, 0), false), ColorEntry(QColor( 178, 24, 24), false), + ColorEntry(QColor( 24, 178, 24), false), ColorEntry(QColor( 178, 104, 24), false), + ColorEntry(QColor( 24, 24, 178), false), ColorEntry(QColor( 178, 24, 178), false), + ColorEntry(QColor( 24, 178, 178), false), ColorEntry(QColor( 178, 178, 178), false), + ColorEntry(QColor( 0, 0, 0), false), ColorEntry(QColor( 255, 255, 221), true), + ColorEntry(QColor(104, 104, 104), false), ColorEntry(QColor( 255, 84, 84), false), + ColorEntry(QColor( 84, 255, 84), false), ColorEntry(QColor( 255, 255, 84), false), + ColorEntry(QColor( 84, 84, 255), false), ColorEntry(QColor( 255, 84, 255), false), + ColorEntry(QColor( 84, 255, 255), false), ColorEntry(QColor( 255, 255, 255), false) +}; + + +#endif + + +#endif + diff --git a/konsole-qml-plugin/src/DefaultTranslatorText.h b/konsole-qml-plugin/src/DefaultTranslatorText.h new file mode 100644 index 0000000..e47417c --- /dev/null +++ b/konsole-qml-plugin/src/DefaultTranslatorText.h @@ -0,0 +1,2 @@ +"keyboard \"Fallback Key Translator\"\n" +"key Tab : \"\\t\" \0" diff --git a/konsole-qml-plugin/src/Emulation.cpp b/konsole-qml-plugin/src/Emulation.cpp new file mode 100644 index 0000000..00af010 --- /dev/null +++ b/konsole-qml-plugin/src/Emulation.cpp @@ -0,0 +1,458 @@ +/* + Copyright 2007-2008 Robert Knight + Copyright 1997,1998 by Lars Doelle + Copyright 1996 by Matthias Ettrich + + 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. +*/ + +// Own +#include "Emulation.h" + +// System +#include +#include +#include +#include + +// Qt +#include +#include +#include +#include +#include +#include +#include + +#include + +// KDE +//#include + +// Konsole +#include "KeyboardTranslator.h" +#include "Screen.h" +#include "TerminalCharacterDecoder.h" +#include "ScreenWindow.h" + +Emulation::Emulation() : + _currentScreen(0), + _codec(0), + _decoder(0), + _keyTranslator(0), + _usesMouse(false) +{ + // create screens with a default size + _screen[0] = new Screen(40,80); + _screen[1] = new Screen(40,80); + _currentScreen = _screen[0]; + + QObject::connect(&_bulkTimer1, SIGNAL(timeout()), this, SLOT(showBulk()) ); + QObject::connect(&_bulkTimer2, SIGNAL(timeout()), this, SLOT(showBulk()) ); + + // listen for mouse status changes + connect( this , SIGNAL(programUsesMouseChanged(bool)) , + SLOT(usesMouseChanged(bool)) ); +} + +bool Emulation::programUsesMouse() const +{ + return _usesMouse; +} + +void Emulation::usesMouseChanged(bool usesMouse) +{ + _usesMouse = usesMouse; +} + +ScreenWindow* Emulation::createWindow() +{ + ScreenWindow* window = new ScreenWindow(); + window->setScreen(_currentScreen); + _windows << window; + + connect(window , SIGNAL(selectionChanged()), + this , SLOT(bufferedUpdate())); + + connect(this , SIGNAL(outputChanged()), + window , SLOT(notifyOutputChanged()) ); + return window; +} + +Emulation::~Emulation() +{ + QListIterator windowIter(_windows); + + while (windowIter.hasNext()) + { + delete windowIter.next(); + } + + delete _screen[0]; + delete _screen[1]; + delete _decoder; +} + +void Emulation::setScreen(int n) +{ + Screen *old = _currentScreen; + _currentScreen = _screen[n & 1]; + if (_currentScreen != old) + { + // tell all windows onto this emulation to switch to the newly active screen + foreach(ScreenWindow* window,_windows) + window->setScreen(_currentScreen); + } +} + +void Emulation::clearHistory() +{ + _screen[0]->setScroll( _screen[0]->getScroll() , false ); +} +void Emulation::setHistory(const HistoryType& t) +{ + _screen[0]->setScroll(t); + + showBulk(); +} + +const HistoryType& Emulation::history() const +{ + return _screen[0]->getScroll(); +} + +void Emulation::setCodec(const QTextCodec * qtc) +{ + if (qtc) + _codec = qtc; + else + setCodec(LocaleCodec); + + delete _decoder; + _decoder = _codec->makeDecoder(); + + emit useUtf8Request(utf8()); +} + +void Emulation::setCodec(EmulationCodec codec) +{ + if ( codec == Utf8Codec ) + setCodec( QTextCodec::codecForName("utf8") ); + else if ( codec == LocaleCodec ) + setCodec( QTextCodec::codecForLocale() ); +} + +void Emulation::setKeyBindings(const QString& name) +{ + _keyTranslator = KeyboardTranslatorManager::instance()->findTranslator(name); + if (!_keyTranslator) + { + _keyTranslator = KeyboardTranslatorManager::instance()->defaultTranslator(); + } +} + +QString Emulation::keyBindings() const +{ + return _keyTranslator->name(); +} + +void Emulation::receiveChar(int c) +// process application unicode input to terminal +// this is a trivial scanner +{ + c &= 0xff; + switch (c) + { + case '\b' : _currentScreen->backspace(); break; + case '\t' : _currentScreen->tab(); break; + case '\n' : _currentScreen->newLine(); break; + case '\r' : _currentScreen->toStartOfLine(); break; + case 0x07 : emit stateSet(NOTIFYBELL); + break; + default : _currentScreen->displayCharacter(c); break; + }; +} + +void Emulation::sendKeyEvent( QKeyEvent* ev ) +{ + emit stateSet(NOTIFYNORMAL); + + if (!ev->text().isEmpty()) + { // A block of text + // Note that the text is proper unicode. + // We should do a conversion here + emit sendData(ev->text().toUtf8(),ev->text().length()); + } +} + +void Emulation::sendString(const char*,int) +{ + // default implementation does nothing +} + +void Emulation::sendMouseEvent(int /*buttons*/, int /*column*/, int /*row*/, int /*eventType*/) +{ + // default implementation does nothing +} + +/* + We are doing code conversion from locale to unicode first. +TODO: Character composition from the old code. See #96536 +*/ + +void Emulation::receiveData(const char* text, int length) +{ + emit stateSet(NOTIFYACTIVITY); + + bufferedUpdate(); + + QString unicodeText = _decoder->toUnicode(text,length); + + //send characters to terminal emulator + for (int i=0;i 3) && (strncmp(text+i+1, "B00", 3) == 0)) + emit zmodemDetected(); + } + } +} + +//OLDER VERSION +//This version of onRcvBlock was commented out because +// a) It decoded incoming characters one-by-one, which is slow in the current version of Qt (4.2 tech preview) +// b) It messed up decoding of non-ASCII characters, with the result that (for example) chinese characters +// were not printed properly. +// +//There is something about stopping the _decoder if "we get a control code halfway a multi-byte sequence" (see below) +//which hasn't been ported into the newer function (above). Hopefully someone who understands this better +//can find an alternative way of handling the check. + + +/*void Emulation::onRcvBlock(const char *s, int len) +{ + emit notifySessionState(NOTIFYACTIVITY); + + bufferedUpdate(); + for (int i = 0; i < len; i++) + { + + QString result = _decoder->toUnicode(&s[i],1); + int reslen = result.length(); + + // If we get a control code halfway a multi-byte sequence + // we flush the _decoder and continue with the control code. + if ((s[i] < 32) && (s[i] > 0)) + { + // Flush _decoder + while(!result.length()) + result = _decoder->toUnicode(&s[i],1); + reslen = 1; + result.resize(reslen); + result[0] = QChar(s[i]); + } + + for (int j = 0; j < reslen; j++) + { + if (result[j].characterategory() == QChar::Mark_NonSpacing) + _currentScreen->compose(result.mid(j,1)); + else + onRcvChar(result[j].unicode()); + } + if (s[i] == '\030') + { + if ((len-i-1 > 3) && (strncmp(s+i+1, "B00", 3) == 0)) + emit zmodemDetected(); + } + } +}*/ + +void Emulation::writeToStream( TerminalCharacterDecoder* _decoder , + int startLine , + int endLine) +{ + _currentScreen->writeLinesToStream(_decoder,startLine,endLine); +} + +int Emulation::lineCount() const +{ + // sum number of lines currently on _screen plus number of lines in history + return _currentScreen->getLines() + _currentScreen->getHistLines(); +} + +#define BULK_TIMEOUT1 10 +#define BULK_TIMEOUT2 40 + +void Emulation::showBulk() +{ + _bulkTimer1.stop(); + _bulkTimer2.stop(); + + emit outputChanged(); + + _currentScreen->resetScrolledLines(); + _currentScreen->resetDroppedLines(); +} + +void Emulation::bufferedUpdate() +{ + _bulkTimer1.setSingleShot(true); + _bulkTimer1.start(BULK_TIMEOUT1); + if (!_bulkTimer2.isActive()) + { + _bulkTimer2.setSingleShot(true); + _bulkTimer2.start(BULK_TIMEOUT2); + } +} + +char Emulation::eraseChar() const +{ + return '\b'; +} + +void Emulation::setImageSize(int lines, int columns) +{ + if ((lines < 1) || (columns < 1)) + return; + + QSize screenSize[2] = { QSize(_screen[0]->getColumns(), + _screen[0]->getLines()), + QSize(_screen[1]->getColumns(), + _screen[1]->getLines()) }; + QSize newSize(columns,lines); + + if (newSize == screenSize[0] && newSize == screenSize[1]) + return; + + _screen[0]->resizeImage(lines,columns); + _screen[1]->resizeImage(lines,columns); + + emit imageSizeChanged(lines,columns); + + bufferedUpdate(); +} + +QSize Emulation::imageSize() const +{ + return QSize(_currentScreen->getColumns(), _currentScreen->getLines()); +} + +ushort ExtendedCharTable::extendedCharHash(ushort* unicodePoints , ushort length) const +{ + ushort hash = 0; + for ( ushort i = 0 ; i < length ; i++ ) + { + hash = 31*hash + unicodePoints[i]; + } + return hash; +} +bool ExtendedCharTable::extendedCharMatch(ushort hash , ushort* unicodePoints , ushort length) const +{ + ushort* entry = extendedCharTable[hash]; + + // compare given length with stored sequence length ( given as the first ushort in the + // stored buffer ) + if ( entry == 0 || entry[0] != length ) + return false; + // if the lengths match, each character must be checked. the stored buffer starts at + // entry[1] + for ( int i = 0 ; i < length ; i++ ) + { + if ( entry[i+1] != unicodePoints[i] ) + return false; + } + return true; +} +ushort ExtendedCharTable::createExtendedChar(ushort* unicodePoints , ushort length) +{ + // look for this sequence of points in the table + ushort hash = extendedCharHash(unicodePoints,length); + + // check existing entry for match + while ( extendedCharTable.contains(hash) ) + { + if ( extendedCharMatch(hash,unicodePoints,length) ) + { + // this sequence already has an entry in the table, + // return its hash + return hash; + } + else + { + // if hash is already used by another, different sequence of unicode character + // points then try next hash + hash++; + } + } + + + // add the new sequence to the table and + // return that index + ushort* buffer = new ushort[length+1]; + buffer[0] = length; + for ( int i = 0 ; i < length ; i++ ) + buffer[i+1] = unicodePoints[i]; + + extendedCharTable.insert(hash,buffer); + + return hash; +} + +ushort* ExtendedCharTable::lookupExtendedChar(ushort hash , ushort& length) const +{ + // lookup index in table and if found, set the length + // argument and return a pointer to the character sequence + + ushort* buffer = extendedCharTable[hash]; + if ( buffer ) + { + length = buffer[0]; + return buffer+1; + } + else + { + length = 0; + return 0; + } +} + +ExtendedCharTable::ExtendedCharTable() +{ +} +ExtendedCharTable::~ExtendedCharTable() +{ + // free all allocated character buffers + QHashIterator iter(extendedCharTable); + while ( iter.hasNext() ) + { + iter.next(); + delete[] iter.value(); + } +} + +// global instance +ExtendedCharTable ExtendedCharTable::instance; + + +//#include "Emulation.moc" + diff --git a/konsole-qml-plugin/src/Emulation.h b/konsole-qml-plugin/src/Emulation.h new file mode 100644 index 0000000..49f707d --- /dev/null +++ b/konsole-qml-plugin/src/Emulation.h @@ -0,0 +1,467 @@ +/* + This file is part of Konsole, an X terminal. + + Copyright 2007-2008 by Robert Knight + Copyright 1997,1998 by Lars Doelle + + 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. +*/ + +#ifndef EMULATION_H +#define EMULATION_H + +// System +#include + +// Qt +#include +//#include +#include +#include +#include + +// Konsole +//#include "konsole_export.h" +#define KONSOLEPRIVATE_EXPORT + +class KeyboardTranslator; +class HistoryType; +class Screen; +class ScreenWindow; +class TerminalCharacterDecoder; + +/** + * This enum describes the available states which + * the terminal emulation may be set to. + * + * These are the values used by Emulation::stateChanged() + */ +enum +{ + /** The emulation is currently receiving user input. */ + NOTIFYNORMAL=0, + /** + * The terminal program has triggered a bell event + * to get the user's attention. + */ + NOTIFYBELL=1, + /** + * The emulation is currently receiving data from its + * terminal input. + */ + NOTIFYACTIVITY=2, + + // unused here? + NOTIFYSILENCE=3 +}; + +/** + * Base class for terminal emulation back-ends. + * + * The back-end is responsible for decoding an incoming character stream and + * producing an output image of characters. + * + * When input from the terminal is received, the receiveData() slot should be called with + * the data which has arrived. The emulation will process the data and update the + * screen image accordingly. The codec used to decode the incoming character stream + * into the unicode characters used internally can be specified using setCodec() + * + * The size of the screen image can be specified by calling setImageSize() with the + * desired number of lines and columns. When new lines are added, old content + * is moved into a history store, which can be set by calling setHistory(). + * + * The screen image can be accessed by creating a ScreenWindow onto this emulation + * by calling createWindow(). Screen windows provide access to a section of the + * output. Each screen window covers the same number of lines and columns as the + * image size returned by imageSize(). The screen window can be moved up and down + * and provides transparent access to both the current on-screen image and the + * previous output. The screen windows emit an outputChanged signal + * when the section of the image they are looking at changes. + * Graphical views can then render the contents of a screen window, listening for notifications + * of output changes from the screen window which they are associated with and updating + * accordingly. + * + * The emulation also is also responsible for converting input from the connected views such + * as keypresses and mouse activity into a character string which can be sent + * to the terminal program. Key presses can be processed by calling the sendKeyEvent() slot, + * while mouse events can be processed using the sendMouseEvent() slot. When the character + * stream has been produced, the emulation will emit a sendData() signal with a pointer + * to the character buffer. This data should be fed to the standard input of the terminal + * process. The translation of key presses into an output character stream is performed + * using a lookup in a set of key bindings which map key sequences to output + * character sequences. The name of the key bindings set used can be specified using + * setKeyBindings() + * + * The emulation maintains certain state information which changes depending on the + * input received. The emulation can be reset back to its starting state by calling + * reset(). + * + * The emulation also maintains an activity state, which specifies whether + * terminal is currently active ( when data is received ), normal + * ( when the terminal is idle or receiving user input ) or trying + * to alert the user ( also known as a "Bell" event ). The stateSet() signal + * is emitted whenever the activity state is set. This can be used to determine + * how long the emulation has been active/idle for and also respond to + * a 'bell' event in different ways. + */ +class KONSOLEPRIVATE_EXPORT Emulation : public QObject +{ +Q_OBJECT + +public: + + /** Constructs a new terminal emulation */ + Emulation(); + ~Emulation(); + + /** + * Creates a new window onto the output from this emulation. The contents + * of the window are then rendered by views which are set to use this window using the + * TerminalDisplay::setScreenWindow() method. + */ + ScreenWindow* createWindow(); + + /** Returns the size of the screen image which the emulation produces */ + QSize imageSize() const; + + /** + * Returns the total number of lines, including those stored in the history. + */ + int lineCount() const; + + /** + * Sets the history store used by this emulation. When new lines + * are added to the output, older lines at the top of the screen are transferred to a history + * store. + * + * The number of lines which are kept and the storage location depend on the + * type of store. + */ + void setHistory(const HistoryType&); + /** Returns the history store used by this emulation. See setHistory() */ + const HistoryType& history() const; + /** Clears the history scroll. */ + void clearHistory(); + + /** + * Copies the output history from @p startLine to @p endLine + * into @p stream, using @p decoder to convert the terminal + * characters into text. + * + * @param decoder A decoder which converts lines of terminal characters with + * appearance attributes into output text. PlainTextDecoder is the most commonly + * used decoder. + * @param startLine Index of first line to copy + * @param endLine Index of last line to copy + */ + virtual void writeToStream(TerminalCharacterDecoder* decoder,int startLine,int endLine); + + /** Returns the codec used to decode incoming characters. See setCodec() */ + const QTextCodec* codec() const { return _codec; } + /** Sets the codec used to decode incoming characters. */ + void setCodec(const QTextCodec*); + + /** + * Convenience method. + * Returns true if the current codec used to decode incoming + * characters is UTF-8 + */ + bool utf8() const + { Q_ASSERT(_codec); return _codec->mibEnum() == 106; } + + + /** TODO Document me */ + virtual char eraseChar() const; + + /** + * Sets the key bindings used to key events + * ( received through sendKeyEvent() ) into character + * streams to send to the terminal. + */ + void setKeyBindings(const QString& name); + /** + * Returns the name of the emulation's current key bindings. + * See setKeyBindings() + */ + QString keyBindings() const; + + /** + * Copies the current image into the history and clears the screen. + */ + virtual void clearEntireScreen() =0; + + /** Resets the state of the terminal. */ + virtual void reset() =0; + + /** + * Returns true if the active terminal program wants + * mouse input events. + * + * The programUsesMouseChanged() signal is emitted when this + * changes. + */ + bool programUsesMouse() const; + +public slots: + + /** Change the size of the emulation's image */ + virtual void setImageSize(int lines, int columns); + + /** + * Interprets a sequence of characters and sends the result to the terminal. + * This is equivalent to calling sendKeyEvent() for each character in @p text in succession. + */ + virtual void sendText(const QString& text) = 0; + + /** + * Interprets a key press event and emits the sendData() signal with + * the resulting character stream. + */ + virtual void sendKeyEvent(QKeyEvent*); + + /** + * Converts information about a mouse event into an xterm-compatible escape + * sequence and emits the character sequence via sendData() + */ + virtual void sendMouseEvent(int buttons, int column, int line, int eventType); + + /** + * Sends a string of characters to the foreground terminal process. + * + * @param string The characters to send. + * @param length Length of @p string or if set to a negative value, @p string will + * be treated as a null-terminated string and its length will be determined automatically. + */ + virtual void sendString(const char* string, int length = -1) = 0; + + /** + * Processes an incoming stream of characters. receiveData() decodes the incoming + * character buffer using the current codec(), and then calls receiveChar() for + * each unicode character in the resulting buffer. + * + * receiveData() also starts a timer which causes the outputChanged() signal + * to be emitted when it expires. The timer allows multiple updates in quick + * succession to be buffered into a single outputChanged() signal emission. + * + * @param buffer A string of characters received from the terminal program. + * @param len The length of @p buffer + */ + void receiveData(const char* buffer,int len); + +signals: + + /** + * Emitted when a buffer of data is ready to send to the + * standard input of the terminal. + * + * @param data The buffer of data ready to be sent + * @param len The length of @p data in bytes + */ + void sendData(const char* data,int len); + + /** + * Requests that sending of input to the emulation + * from the terminal process be suspended or resumed. + * + * @param suspend If true, requests that sending of + * input from the terminal process' stdout be + * suspended. Otherwise requests that sending of + * input be resumed. + */ + void lockPtyRequest(bool suspend); + + /** + * Requests that the pty used by the terminal process + * be set to UTF 8 mode. + * + * TODO: More documentation + */ + void useUtf8Request(bool); + + /** + * Emitted when the activity state of the emulation is set. + * + * @param state The new activity state, one of NOTIFYNORMAL, NOTIFYACTIVITY + * or NOTIFYBELL + */ + void stateSet(int state); + + /** TODO Document me */ + void zmodemDetected(); + + + /** + * Requests that the color of the text used + * to represent the tabs associated with this + * emulation be changed. This is a Konsole-specific + * extension from pre-KDE 4 times. + * + * TODO: Document how the parameter works. + */ + void changeTabTextColorRequest(int color); + + /** + * This is emitted when the program running in the shell indicates whether or + * not it is interested in mouse events. + * + * @param usesMouse This will be true if the program wants to be informed about + * mouse events or false otherwise. + */ + void programUsesMouseChanged(bool usesMouse); + + /** + * Emitted when the contents of the screen image change. + * The emulation buffers the updates from successive image changes, + * and only emits outputChanged() at sensible intervals when + * there is a lot of terminal activity. + * + * Normally there is no need for objects other than the screen windows + * created with createWindow() to listen for this signal. + * + * ScreenWindow objects created using createWindow() will emit their + * own outputChanged() signal in response to this signal. + */ + void outputChanged(); + + /** + * Emitted when the program running in the terminal wishes to update the + * session's title. This also allows terminal programs to customize other + * aspects of the terminal emulation display. + * + * This signal is emitted when the escape sequence "\033]ARG;VALUE\007" + * is received in the input string, where ARG is a number specifying what + * should change and VALUE is a string specifying the new value. + * + * TODO: The name of this method is not very accurate since this method + * is used to perform a whole range of tasks besides just setting + * the user-title of the session. + * + * @param title Specifies what to change. + *
    + *
  • 0 - Set window icon text and session title to @p newTitle
  • + *
  • 1 - Set window icon text to @p newTitle
  • + *
  • 2 - Set session title to @p newTitle
  • + *
  • 11 - Set the session's default background color to @p newTitle, + * where @p newTitle can be an HTML-style string ("#RRGGBB") or a named + * color (eg 'red', 'blue'). + * See http://doc.trolltech.com/4.2/qcolor.html#setNamedColor for more + * details. + *
  • + *
  • 31 - Supposedly treats @p newTitle as a URL and opens it (NOT IMPLEMENTED)
  • + *
  • 32 - Sets the icon associated with the session. @p newTitle is the name + * of the icon to use, which can be the name of any icon in the current KDE icon + * theme (eg: 'konsole', 'kate', 'folder_home')
  • + *
+ * @param newTitle Specifies the new title + */ + + void titleChanged(int title,const QString& newTitle); + + /** + * Emitted when the program running in the terminal changes the + * screen size. + */ + void imageSizeChanged(int lineCount , int columnCount); + + /** + * Emitted when the terminal program requests to change various properties + * of the terminal display. + * + * A profile change command occurs when a special escape sequence, followed + * by a string containing a series of name and value pairs is received. + * This string can be parsed using a ProfileCommandParser instance. + * + * @param text A string expected to contain a series of key and value pairs in + * the form: name=value;name2=value2 ... + */ + void profileChangeCommandReceived(const QString& text); + + /** + * Emitted when a flow control key combination ( Ctrl+S or Ctrl+Q ) is pressed. + * @param suspendKeyPressed True if Ctrl+S was pressed to suspend output or Ctrl+Q to + * resume output. + */ + void flowControlKeyPressed(bool suspendKeyPressed); + +protected: + virtual void setMode(int mode) = 0; + virtual void resetMode(int mode) = 0; + + /** + * Processes an incoming character. See receiveData() + * @p ch A unicode character code. + */ + virtual void receiveChar(int ch); + + /** + * Sets the active screen. The terminal has two screens, primary and alternate. + * The primary screen is used by default. When certain interactive programs such + * as Vim are run, they trigger a switch to the alternate screen. + * + * @param index 0 to switch to the primary screen, or 1 to switch to the alternate screen + */ + void setScreen(int index); + + enum EmulationCodec + { + LocaleCodec = 0, + Utf8Codec = 1 + }; + void setCodec(EmulationCodec codec); // codec number, 0 = locale, 1=utf8 + + + QList _windows; + + Screen* _currentScreen; // pointer to the screen which is currently active, + // this is one of the elements in the screen[] array + + Screen* _screen[2]; // 0 = primary screen ( used by most programs, including the shell + // scrollbars are enabled in this mode ) + // 1 = alternate ( used by vi , emacs etc. + // scrollbars are not enabled in this mode ) + + + //decodes an incoming C-style character stream into a unicode QString using + //the current text codec. (this allows for rendering of non-ASCII characters in text files etc.) + const QTextCodec* _codec; + QTextDecoder* _decoder; + const KeyboardTranslator* _keyTranslator; // the keyboard layout + +protected slots: + /** + * Schedules an update of attached views. + * Repeated calls to bufferedUpdate() in close succession will result in only a single update, + * much like the Qt buffered update of widgets. + */ + void bufferedUpdate(); + +private slots: + + // triggered by timer, causes the emulation to send an updated screen image to each + // view + void showBulk(); + + void usesMouseChanged(bool usesMouse); + +private: + bool _usesMouse; + QTimer _bulkTimer1; + QTimer _bulkTimer2; + +}; + + +#endif // ifndef EMULATION_H diff --git a/konsole-qml-plugin/src/ExtendedDefaultTranslator.h b/konsole-qml-plugin/src/ExtendedDefaultTranslator.h new file mode 100644 index 0000000..6403c72 --- /dev/null +++ b/konsole-qml-plugin/src/ExtendedDefaultTranslator.h @@ -0,0 +1,74 @@ +"keyboard \"Default (XFree 4)\"" +"key Escape : \"\\E\"" +"key Tab -Shift : \"\\t\"\n" +"key Tab +Shift+Ansi : \"\\E[Z\"\n" +"key Tab +Shift-Ansi : \"\\t\"\n" +"key Backtab +Ansi : \"\\E[Z\"\n" +"key Backtab -Ansi : \"\\t\"\n" +"key Return-Shift-NewLine : \"\\r\"\n" +"key Return-Shift+NewLine : \"\\r\\n\"\n" +"key Return+Shift : \"\\EOM\"\n" +"key Backspace : \"\\x7f\"\n" +"key Up -Shift-Ansi : \"\\EA\"\n" +"key Down -Shift-Ansi : \"\\EB\"\n" +"key Right-Shift-Ansi : \"\\EC\"\n" +"key Left -Shift-Ansi : \"\\ED\"\n" +"key Up -Shift-AnyMod+Ansi+AppCuKeys : \"\\EOA\"\n" +"key Down -Shift-AnyMod+Ansi+AppCuKeys : \"\\EOB\"\n" +"key Right -Shift-AnyMod+Ansi+AppCuKeys : \"\\EOC\"\n" +"key Left -Shift-AnyMod+Ansi+AppCuKeys : \"\\EOD\"\n" +"key Up -Shift-AnyMod+Ansi-AppCuKeys : \"\\E[A\"\n" +"key Down -Shift-AnyMod+Ansi-AppCuKeys : \"\\E[B\"\n" +"key Right -Shift-AnyMod+Ansi-AppCuKeys : \"\\E[C\"\n" +"key Left -Shift-AnyMod+Ansi-AppCuKeys : \"\\E[D\"\n" +"key Up -Shift+AnyMod+Ansi : \"\\E[1;*A\"\n" +"key Down -Shift+AnyMod+Ansi : \"\\E[1;*B\"\n" +"key Right -Shift+AnyMod+Ansi : \"\\E[1;*C\"\n" +"key Left -Shift+AnyMod+Ansi : \"\\E[1;*D\"\n" +"key Enter+NewLine : \"\\r\\n\"\n" +"key Enter-NewLine : \"\\r\"\n" +"key Home -AnyMod -AppCuKeys : \"\\E[H\" \n" +"key End -AnyMod -AppCuKeys : \"\\E[F\" \n" +"key Home -AnyMod +AppCuKeys : \"\\EOH\" \n" +"key End -AnyMod +AppCuKeys : \"\\EOF\" \n" +"key Home +AnyMod : \"\\E[1;*H\"\n" +"key End +AnyMod : \"\\E[1;*F\"\n" +"key Insert -AnyMod : \"\\E[2~\"\n" +"key Delete -AnyMod : \"\\E[3~\"\n" +"key Insert +AnyMod : \"\\E[2;*~\"\n" +"key Delete +AnyMod : \"\\E[3;*~\"\n" +"key Prior -Shift-AnyMod : \"\\E[5~\"\n" +"key Next -Shift-AnyMod : \"\\E[6~\"\n" +"key Prior -Shift+AnyMod : \"\\E[5;*~\"\n" +"key Next -Shift+AnyMod : \"\\E[6;*~\"\n" +"key F1 -AnyMod : \"\\EOP\"\n" +"key F2 -AnyMod : \"\\EOQ\"\n" +"key F3 -AnyMod : \"\\EOR\"\n" +"key F4 -AnyMod : \"\\EOS\"\n" +"key F5 -AnyMod : \"\\E[15~\"\n" +"key F6 -AnyMod : \"\\E[17~\"\n" +"key F7 -AnyMod : \"\\E[18~\"\n" +"key F8 -AnyMod : \"\\E[19~\"\n" +"key F9 -AnyMod : \"\\E[20~\"\n" +"key F10 -AnyMod : \"\\E[21~\"\n" +"key F11 -AnyMod : \"\\E[23~\"\n" +"key F12 -AnyMod : \"\\E[24~\"\n" +"key F1 +AnyMod : \"\\EO*P\"\n" +"key F2 +AnyMod : \"\\EO*Q\"\n" +"key F3 +AnyMod : \"\\EO*R\"\n" +"key F4 +AnyMod : \"\\EO*S\"\n" +"key F5 +AnyMod : \"\\E[15;*~\"\n" +"key F6 +AnyMod : \"\\E[17;*~\"\n" +"key F7 +AnyMod : \"\\E[18;*~\"\n" +"key F8 +AnyMod : \"\\E[19;*~\"\n" +"key F9 +AnyMod : \"\\E[20;*~\"\n" +"key F10 +AnyMod : \"\\E[21;*~\"\n" +"key F11 +AnyMod : \"\\E[23;*~\"\n" +"key F12 +AnyMod : \"\\E[24;*~\"\n" +"key Space +Control : \"\\x00\"\n" +"key Up +Shift-AppScreen : scrollLineUp\n" +"key Prior +Shift-AppScreen : scrollPageUp\n" +"key Down +Shift-AppScreen : scrollLineDown\n" +"key Next +Shift-AppScreen : scrollPageDown\n" +"key ScrollLock : scrollLock\n" +"\0" diff --git a/konsole-qml-plugin/src/Filter.cpp b/konsole-qml-plugin/src/Filter.cpp new file mode 100644 index 0000000..954b91f --- /dev/null +++ b/konsole-qml-plugin/src/Filter.cpp @@ -0,0 +1,542 @@ +/* + Copyright 2007-2008 by Robert Knight + + 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. +*/ + +// Own +#include "Filter.h" + +// System +#include + +// Qt +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// KDE +//#include +//#include + +// Konsole +#include "TerminalCharacterDecoder.h" +#include "konsole_wcwidth.h" + + +FilterChain::~FilterChain() +{ + QMutableListIterator iter(*this); + + while ( iter.hasNext() ) + { + Filter* filter = iter.next(); + iter.remove(); + delete filter; + } +} + +void FilterChain::addFilter(Filter* filter) +{ + append(filter); +} +void FilterChain::removeFilter(Filter* filter) +{ + removeAll(filter); +} +bool FilterChain::containsFilter(Filter* filter) +{ + return contains(filter); +} +void FilterChain::reset() +{ + QListIterator iter(*this); + while (iter.hasNext()) + iter.next()->reset(); +} +void FilterChain::setBuffer(const QString* buffer , const QList* linePositions) +{ + QListIterator iter(*this); + while (iter.hasNext()) + iter.next()->setBuffer(buffer,linePositions); +} +void FilterChain::process() +{ + QListIterator iter(*this); + while (iter.hasNext()) + iter.next()->process(); +} +void FilterChain::clear() +{ + QList::clear(); +} +Filter::HotSpot* FilterChain::hotSpotAt(int line , int column) const +{ + QListIterator iter(*this); + while (iter.hasNext()) + { + Filter* filter = iter.next(); + Filter::HotSpot* spot = filter->hotSpotAt(line,column); + if ( spot != 0 ) + { + return spot; + } + } + + return 0; +} + +QList FilterChain::hotSpots() const +{ + QList list; + QListIterator iter(*this); + while (iter.hasNext()) + { + Filter* filter = iter.next(); + list << filter->hotSpots(); + } + return list; +} +//QList FilterChain::hotSpotsAtLine(int line) const; + +TerminalImageFilterChain::TerminalImageFilterChain() +: _buffer(0) +, _linePositions(0) +{ +} + +TerminalImageFilterChain::~TerminalImageFilterChain() +{ + delete _buffer; + delete _linePositions; +} + +void TerminalImageFilterChain::setImage(const Character* const image , int lines , int columns, const QVector& lineProperties) +{ + if (empty()) + return; + + // reset all filters and hotspots + reset(); + + PlainTextDecoder decoder; + decoder.setTrailingWhitespace(false); + + // setup new shared buffers for the filters to process on + QString* newBuffer = new QString(); + QList* newLinePositions = new QList(); + setBuffer( newBuffer , newLinePositions ); + + // free the old buffers + delete _buffer; + delete _linePositions; + + _buffer = newBuffer; + _linePositions = newLinePositions; + + QTextStream lineStream(_buffer); + decoder.begin(&lineStream); + + for (int i=0 ; i < lines ; i++) + { + _linePositions->append(_buffer->length()); + decoder.decodeLine(image + i*columns,columns,LINE_DEFAULT); + + // pretend that each line ends with a newline character. + // this prevents a link that occurs at the end of one line + // being treated as part of a link that occurs at the start of the next line + // + // the downside is that links which are spread over more than one line are not + // highlighted. + // + // TODO - Use the "line wrapped" attribute associated with lines in a + // terminal image to avoid adding this imaginary character for wrapped + // lines + if ( !(lineProperties.value(i,LINE_DEFAULT) & LINE_WRAPPED) ) + lineStream << QChar('\n'); + } + decoder.end(); +} + +Filter::Filter() : +_linePositions(0), +_buffer(0) +{ +} + +Filter::~Filter() +{ + QListIterator iter(_hotspotList); + while (iter.hasNext()) + { + delete iter.next(); + } +} +void Filter::reset() +{ + _hotspots.clear(); + _hotspotList.clear(); +} + +void Filter::setBuffer(const QString* buffer , const QList* linePositions) +{ + _buffer = buffer; + _linePositions = linePositions; +} + +void Filter::getLineColumn(int position , int& startLine , int& startColumn) +{ + Q_ASSERT( _linePositions ); + Q_ASSERT( _buffer ); + + + for (int i = 0 ; i < _linePositions->count() ; i++) + { + int nextLine = 0; + + if ( i == _linePositions->count()-1 ) + nextLine = _buffer->length() + 1; + else + nextLine = _linePositions->value(i+1); + + if ( _linePositions->value(i) <= position && position < nextLine ) + { + startLine = i; + startColumn = string_width(buffer()->mid(_linePositions->value(i),position - _linePositions->value(i))); + return; + } + } +} + + +/*void Filter::addLine(const QString& text) +{ + _linePositions << _buffer.length(); + _buffer.append(text); +}*/ + +const QString* Filter::buffer() +{ + return _buffer; +} +Filter::HotSpot::~HotSpot() +{ +} +void Filter::addHotSpot(HotSpot* spot) +{ + _hotspotList << spot; + + for (int line = spot->startLine() ; line <= spot->endLine() ; line++) + { + _hotspots.insert(line,spot); + } +} +QList Filter::hotSpots() const +{ + return _hotspotList; +} +QList Filter::hotSpotsAtLine(int line) const +{ + return _hotspots.values(line); +} + +Filter::HotSpot* Filter::hotSpotAt(int line , int column) const +{ + QListIterator spotIter(_hotspots.values(line)); + + while (spotIter.hasNext()) + { + HotSpot* spot = spotIter.next(); + + if ( spot->startLine() == line && spot->startColumn() > column ) + continue; + if ( spot->endLine() == line && spot->endColumn() < column ) + continue; + + return spot; + } + + return 0; +} + +Filter::HotSpot::HotSpot(int startLine , int startColumn , int endLine , int endColumn) + : _startLine(startLine) + , _startColumn(startColumn) + , _endLine(endLine) + , _endColumn(endColumn) + , _type(NotSpecified) +{ +} +QString Filter::HotSpot::tooltip() const +{ + return QString(); +} +QList Filter::HotSpot::actions() +{ + return QList(); +} +int Filter::HotSpot::startLine() const +{ + return _startLine; +} +int Filter::HotSpot::endLine() const +{ + return _endLine; +} +int Filter::HotSpot::startColumn() const +{ + return _startColumn; +} +int Filter::HotSpot::endColumn() const +{ + return _endColumn; +} +Filter::HotSpot::Type Filter::HotSpot::type() const +{ + return _type; +} +void Filter::HotSpot::setType(Type type) +{ + _type = type; +} + +RegExpFilter::RegExpFilter() +{ +} + +RegExpFilter::HotSpot::HotSpot(int startLine,int startColumn,int endLine,int endColumn) + : Filter::HotSpot(startLine,startColumn,endLine,endColumn) +{ + setType(Marker); +} + +void RegExpFilter::HotSpot::activate(QObject*) +{ +} + +void RegExpFilter::HotSpot::setCapturedTexts(const QStringList& texts) +{ + _capturedTexts = texts; +} +QStringList RegExpFilter::HotSpot::capturedTexts() const +{ + return _capturedTexts; +} + +void RegExpFilter::setRegExp(const QRegExp& regExp) +{ + _searchText = regExp; +} +QRegExp RegExpFilter::regExp() const +{ + return _searchText; +} +/*void RegExpFilter::reset(int) +{ + _buffer = QString(); +}*/ +void RegExpFilter::process() +{ + int pos = 0; + const QString* text = buffer(); + + Q_ASSERT( text ); + + // ignore any regular expressions which match an empty string. + // otherwise the while loop below will run indefinitely + static const QString emptyString(""); + if ( _searchText.exactMatch(emptyString) ) + return; + + while(pos >= 0) + { + pos = _searchText.indexIn(*text,pos); + + if ( pos >= 0 ) + { + int startLine = 0; + int endLine = 0; + int startColumn = 0; + int endColumn = 0; + + getLineColumn(pos,startLine,startColumn); + getLineColumn(pos + _searchText.matchedLength(),endLine,endColumn); + + RegExpFilter::HotSpot* spot = newHotSpot(startLine,startColumn, + endLine,endColumn); + spot->setCapturedTexts(_searchText.capturedTexts()); + + addHotSpot( spot ); + pos += _searchText.matchedLength(); + + // if matchedLength == 0, the program will get stuck in an infinite loop + if ( _searchText.matchedLength() == 0 ) + pos = -1; + } + } +} + +RegExpFilter::HotSpot* RegExpFilter::newHotSpot(int startLine,int startColumn, + int endLine,int endColumn) +{ + return new RegExpFilter::HotSpot(startLine,startColumn, + endLine,endColumn); +} +RegExpFilter::HotSpot* UrlFilter::newHotSpot(int startLine,int startColumn,int endLine, + int endColumn) +{ + return new UrlFilter::HotSpot(startLine,startColumn, + endLine,endColumn); +} +UrlFilter::HotSpot::HotSpot(int startLine,int startColumn,int endLine,int endColumn) +: RegExpFilter::HotSpot(startLine,startColumn,endLine,endColumn) +, _urlObject(new FilterObject(this)) +{ + setType(Link); +} +QString UrlFilter::HotSpot::tooltip() const +{ + QString url = capturedTexts().first(); + + const UrlType kind = urlType(); + + if ( kind == StandardUrl ) + return QString(); + else if ( kind == Email ) + return QString(); + else + return QString(); +} +UrlFilter::HotSpot::UrlType UrlFilter::HotSpot::urlType() const +{ + QString url = capturedTexts().first(); + + if ( FullUrlRegExp.exactMatch(url) ) + return StandardUrl; + else if ( EmailAddressRegExp.exactMatch(url) ) + return Email; + else + return Unknown; +} + +void UrlFilter::HotSpot::activate(QObject* object) +{ + QString url = capturedTexts().first(); + + const UrlType kind = urlType(); + + const QString& actionName = object ? object->objectName() : QString(); + + if ( actionName == "copy-action" ) + { + QApplication::clipboard()->setText(url); + return; + } + + if ( !object || actionName == "open-action" ) + { + if ( kind == StandardUrl ) + { + // if the URL path does not include the protocol ( eg. "www.kde.org" ) then + // prepend http:// ( eg. "www.kde.org" --> "http://www.kde.org" ) + if (!url.contains("://")) + { + url.prepend("http://"); + } + } + else if ( kind == Email ) + { + url.prepend("mailto:"); + } + + QDesktopServices::openUrl(QUrl(url)); + //new KRun(url,QApplication::activeWindow()); + } +} + +// Note: Altering these regular expressions can have a major effect on the performance of the filters +// used for finding URLs in the text, especially if they are very general and could match very long +// pieces of text. +// Please be careful when altering them. + +//regexp matches: +// full url: +// protocolname:// or www. followed by anything other than whitespaces, <, >, ' or ", and ends before whitespaces, <, >, ', ", ], !, comma and dot +const QRegExp UrlFilter::FullUrlRegExp("(www\\.(?!\\.)|[a-z][a-z0-9+.-]*://)[^\\s<>'\"]+[^!,\\.\\s<>'\"\\]]"); +// email address: +// [word chars, dots or dashes]@[word chars, dots or dashes].[word chars] +const QRegExp UrlFilter::EmailAddressRegExp("\\b(\\w|\\.|-)+@(\\w|\\.|-)+\\.\\w+\\b"); + +// matches full url or email address +const QRegExp UrlFilter::CompleteUrlRegExp('('+FullUrlRegExp.pattern()+'|'+ + EmailAddressRegExp.pattern()+')'); + +UrlFilter::UrlFilter() +{ + setRegExp( CompleteUrlRegExp ); +} +UrlFilter::HotSpot::~HotSpot() +{ + delete _urlObject; +} +void FilterObject::activated() +{ + _filter->activate(sender()); +} +QList UrlFilter::HotSpot::actions() +{ + QList list; + + const UrlType kind = urlType(); + + QAction* openAction = new QAction(_urlObject); + QAction* copyAction = new QAction(_urlObject);; + + Q_ASSERT( kind == StandardUrl || kind == Email ); + + if ( kind == StandardUrl ) + { + openAction->setText(QObject::tr("Open Link")); + copyAction->setText(QObject::tr("Copy Link Address")); + } + else if ( kind == Email ) + { + openAction->setText(QObject::tr("Send Email To...")); + copyAction->setText(QObject::tr("Copy Email Address")); + } + + // object names are set here so that the hotspot performs the + // correct action when activated() is called with the triggered + // action passed as a parameter. + openAction->setObjectName( QLatin1String("open-action" )); + copyAction->setObjectName( QLatin1String("copy-action" )); + + QObject::connect( openAction , SIGNAL(triggered()) , _urlObject , SLOT(activated()) ); + QObject::connect( copyAction , SIGNAL(triggered()) , _urlObject , SLOT(activated()) ); + + list << openAction; + list << copyAction; + + return list; +} + +//#include "Filter.moc" diff --git a/konsole-qml-plugin/src/Filter.h b/konsole-qml-plugin/src/Filter.h new file mode 100644 index 0000000..6b269d4 --- /dev/null +++ b/konsole-qml-plugin/src/Filter.h @@ -0,0 +1,380 @@ +/* + Copyright 2007-2008 by Robert Knight + + 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. +*/ + +#ifndef FILTER_H +#define FILTER_H + +// Qt +#include +#include +#include +#include +#include +#include + +// Local +#include "Character.h" + + +/** + * A filter processes blocks of text looking for certain patterns (such as URLs or keywords from a list) + * and marks the areas which match the filter's patterns as 'hotspots'. + * + * Each hotspot has a type identifier associated with it ( such as a link or a highlighted section ), + * and an action. When the user performs some activity such as a mouse-click in a hotspot area ( the exact + * action will depend on what is displaying the block of text which the filter is processing ), the hotspot's + * activate() method should be called. Depending on the type of hotspot this will trigger a suitable response. + * + * For example, if a hotspot represents a URL then a suitable action would be opening that URL in a web browser. + * Hotspots may have more than one action, in which case the list of actions can be obtained using the + * actions() method. + * + * Different subclasses of filter will return different types of hotspot. + * Subclasses must reimplement the process() method to examine a block of text and identify sections of interest. + * When processing the text they should create instances of Filter::HotSpot subclasses for sections of interest + * and add them to the filter's list of hotspots using addHotSpot() + */ +class Filter +{ +public: + /** + * Represents an area of text which matched the pattern a particular filter has been looking for. + * + * Each hotspot has a type identifier associated with it ( such as a link or a highlighted section ), + * and an action. When the user performs some activity such as a mouse-click in a hotspot area ( the exact + * action will depend on what is displaying the block of text which the filter is processing ), the hotspot's + * activate() method should be called. Depending on the type of hotspot this will trigger a suitable response. + * + * For example, if a hotspot represents a URL then a suitable action would be opening that URL in a web browser. + * Hotspots may have more than one action, in which case the list of actions can be obtained using the + * actions() method. These actions may then be displayed in a popup menu or toolbar for example. + */ + class HotSpot + { + public: + /** + * Constructs a new hotspot which covers the area from (@p startLine,@p startColumn) to (@p endLine,@p endColumn) + * in a block of text. + */ + HotSpot(int startLine , int startColumn , int endLine , int endColumn); + virtual ~HotSpot(); + + enum Type + { + // the type of the hotspot is not specified + NotSpecified, + // this hotspot represents a clickable link + Link, + // this hotspot represents a marker + Marker + }; + + /** Returns the line when the hotspot area starts */ + int startLine() const; + /** Returns the line where the hotspot area ends */ + int endLine() const; + /** Returns the column on startLine() where the hotspot area starts */ + int startColumn() const; + /** Returns the column on endLine() where the hotspot area ends */ + int endColumn() const; + /** + * Returns the type of the hotspot. This is usually used as a hint for views on how to represent + * the hotspot graphically. eg. Link hotspots are typically underlined when the user mouses over them + */ + Type type() const; + /** + * Causes the an action associated with a hotspot to be triggered. + * + * @param object The object which caused the hotspot to be triggered. This is + * typically null ( in which case the default action should be performed ) or + * one of the objects from the actions() list. In which case the associated + * action should be performed. + */ + virtual void activate(QObject* object = 0) = 0; + /** + * Returns a list of actions associated with the hotspot which can be used in a + * menu or toolbar + */ + virtual QList actions(); + + /** + * Returns the text of a tooltip to be shown when the mouse moves over the hotspot, or + * an empty string if there is no tooltip associated with this hotspot. + * + * The default implementation returns an empty string. + */ + virtual QString tooltip() const; + + protected: + /** Sets the type of a hotspot. This should only be set once */ + void setType(Type type); + + private: + int _startLine; + int _startColumn; + int _endLine; + int _endColumn; + Type _type; + + }; + + /** Constructs a new filter. */ + Filter(); + virtual ~Filter(); + + /** Causes the filter to process the block of text currently in its internal buffer */ + virtual void process() = 0; + + /** + * Empties the filters internal buffer and resets the line count back to 0. + * All hotspots are deleted. + */ + void reset(); + + /** Adds a new line of text to the filter and increments the line count */ + //void addLine(const QString& string); + + /** Returns the hotspot which covers the given @p line and @p column, or 0 if no hotspot covers that area */ + HotSpot* hotSpotAt(int line , int column) const; + + /** Returns the list of hotspots identified by the filter */ + QList hotSpots() const; + + /** Returns the list of hotspots identified by the filter which occur on a given line */ + QList hotSpotsAtLine(int line) const; + + /** + * TODO: Document me + */ + void setBuffer(const QString* buffer , const QList* linePositions); + +protected: + /** Adds a new hotspot to the list */ + void addHotSpot(HotSpot*); + /** Returns the internal buffer */ + const QString* buffer(); + /** Converts a character position within buffer() to a line and column */ + void getLineColumn(int position , int& startLine , int& startColumn); + +private: + QMultiHash _hotspots; + QList _hotspotList; + + const QList* _linePositions; + const QString* _buffer; +}; + +/** + * A filter which searches for sections of text matching a regular expression and creates a new RegExpFilter::HotSpot + * instance for them. + * + * Subclasses can reimplement newHotSpot() to return custom hotspot types when matches for the regular expression + * are found. + */ +class RegExpFilter : public Filter +{ +public: + /** + * Type of hotspot created by RegExpFilter. The capturedTexts() method can be used to find the text + * matched by the filter's regular expression. + */ + class HotSpot : public Filter::HotSpot + { + public: + HotSpot(int startLine, int startColumn, int endLine , int endColumn); + virtual void activate(QObject* object = 0); + + /** Sets the captured texts associated with this hotspot */ + void setCapturedTexts(const QStringList& texts); + /** Returns the texts found by the filter when matching the filter's regular expression */ + QStringList capturedTexts() const; + private: + QStringList _capturedTexts; + }; + + /** Constructs a new regular expression filter */ + RegExpFilter(); + + /** + * Sets the regular expression which the filter searches for in blocks of text. + * + * Regular expressions which match the empty string are treated as not matching + * anything. + */ + void setRegExp(const QRegExp& text); + /** Returns the regular expression which the filter searches for in blocks of text */ + QRegExp regExp() const; + + /** + * Reimplemented to search the filter's text buffer for text matching regExp() + * + * If regexp matches the empty string, then process() will return immediately + * without finding results. + */ + virtual void process(); + +protected: + /** + * Called when a match for the regular expression is encountered. Subclasses should reimplement this + * to return custom hotspot types + */ + virtual RegExpFilter::HotSpot* newHotSpot(int startLine,int startColumn, + int endLine,int endColumn); + +private: + QRegExp _searchText; +}; + +class FilterObject; + +/** A filter which matches URLs in blocks of text */ +class UrlFilter : public RegExpFilter +{ +public: + /** + * Hotspot type created by UrlFilter instances. The activate() method opens a web browser + * at the given URL when called. + */ + class HotSpot : public RegExpFilter::HotSpot + { + public: + HotSpot(int startLine,int startColumn,int endLine,int endColumn); + virtual ~HotSpot(); + + virtual QList actions(); + + /** + * Open a web browser at the current URL. The url itself can be determined using + * the capturedTexts() method. + */ + virtual void activate(QObject* object = 0); + + virtual QString tooltip() const; + private: + enum UrlType + { + StandardUrl, + Email, + Unknown + }; + UrlType urlType() const; + + FilterObject* _urlObject; + }; + + UrlFilter(); + +protected: + virtual RegExpFilter::HotSpot* newHotSpot(int,int,int,int); + +private: + + static const QRegExp FullUrlRegExp; + static const QRegExp EmailAddressRegExp; + + // combined OR of FullUrlRegExp and EmailAddressRegExp + static const QRegExp CompleteUrlRegExp; +}; + +class FilterObject : public QObject +{ +Q_OBJECT +public: + FilterObject(Filter::HotSpot* filter) : _filter(filter) {} +private slots: + void activated(); +private: + Filter::HotSpot* _filter; +}; + +/** + * A chain which allows a group of filters to be processed as one. + * The chain owns the filters added to it and deletes them when the chain itself is destroyed. + * + * Use addFilter() to add a new filter to the chain. + * When new text to be filtered arrives, use addLine() to add each additional + * line of text which needs to be processed and then after adding the last line, use + * process() to cause each filter in the chain to process the text. + * + * After processing a block of text, the reset() method can be used to set the filter chain's + * internal cursor back to the first line. + * + * The hotSpotAt() method will return the first hotspot which covers a given position. + * + * The hotSpots() and hotSpotsAtLine() method return all of the hotspots in the text and on + * a given line respectively. + */ +class FilterChain : protected QList +{ +public: + virtual ~FilterChain(); + + /** Adds a new filter to the chain. The chain will delete this filter when it is destroyed */ + void addFilter(Filter* filter); + /** Removes a filter from the chain. The chain will no longer delete the filter when destroyed */ + void removeFilter(Filter* filter); + /** Returns true if the chain contains @p filter */ + bool containsFilter(Filter* filter); + /** Removes all filters from the chain */ + void clear(); + + /** Resets each filter in the chain */ + void reset(); + /** + * Processes each filter in the chain + */ + void process(); + + /** Sets the buffer for each filter in the chain to process. */ + void setBuffer(const QString* buffer , const QList* linePositions); + + /** Returns the first hotspot which occurs at @p line, @p column or 0 if no hotspot was found */ + Filter::HotSpot* hotSpotAt(int line , int column) const; + /** Returns a list of all the hotspots in all the chain's filters */ + QList hotSpots() const; + /** Returns a list of all hotspots at the given line in all the chain's filters */ + QList hotSpotsAtLine(int line) const; + +}; + +/** A filter chain which processes character images from terminal displays */ +class TerminalImageFilterChain : public FilterChain +{ +public: + TerminalImageFilterChain(); + virtual ~TerminalImageFilterChain(); + + /** + * Set the current terminal image to @p image. + * + * @param image The terminal image + * @param lines The number of lines in the terminal image + * @param columns The number of columns in the terminal image + * @param lineProperties The line properties to set for image + */ + void setImage(const Character* const image , int lines , int columns, + const QVector& lineProperties); + +private: + QString* _buffer; + QList* _linePositions; +}; + + +#endif //FILTER_H diff --git a/konsole-qml-plugin/src/History.cpp b/konsole-qml-plugin/src/History.cpp new file mode 100644 index 0000000..60426c9 --- /dev/null +++ b/konsole-qml-plugin/src/History.cpp @@ -0,0 +1,986 @@ +/* + This file is part of Konsole, an X terminal. + Copyright 1997,1998 by Lars Doelle + + 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. +*/ + +// Own +#include "History.h" + +// System +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +// KDE +//#include +//#include + +// Reasonable line size +#define LINE_SIZE 1024 +#define KDE_lseek lseek + + +/* + An arbitrary long scroll. + + One can modify the scroll only by adding either cells + or newlines, but access it randomly. + + The model is that of an arbitrary wide typewriter scroll + in that the scroll is a serie of lines and each line is + a serie of cells with no overwriting permitted. + + The implementation provides arbitrary length and numbers + of cells and line/column indexed read access to the scroll + at constant costs. + +KDE4: Can we use QTemporaryFile here, instead of KTempFile? + +FIXME: some complain about the history buffer comsuming the + memory of their machines. This problem is critical + since the history does not behave gracefully in cases + where the memory is used up completely. + + I put in a workaround that should handle it problem + now gracefully. I'm not satisfied with the solution. + +FIXME: Terminating the history is not properly indicated + in the menu. We should throw a signal. + +FIXME: There is noticeable decrease in speed, also. Perhaps, + there whole feature needs to be revisited therefore. + Disadvantage of a more elaborated, say block-oriented + scheme with wrap around would be it's complexity. +*/ + +//FIXME: tempory replacement for tmpfile +// this is here one for debugging purpose. + +//#define tmpfile xTmpFile + +// History File /////////////////////////////////////////// + +/* + A Row(X) data type which allows adding elements to the end. +*/ + +HistoryFile::HistoryFile() + : ion(-1), + length(0), + fileMap(0) +{ + if (tmpFile.open()) + { + tmpFile.setAutoRemove(true); + ion = tmpFile.handle(); + } +} + +HistoryFile::~HistoryFile() +{ + if (fileMap) + unmap(); +} + +//TODO: Mapping the entire file in will cause problems if the history file becomes exceedingly large, +//(ie. larger than available memory). HistoryFile::map() should only map in sections of the file at a time, +//to avoid this. +void HistoryFile::map() +{ + assert( fileMap == 0 ); + + fileMap = (char*)mmap( 0 , length , PROT_READ , MAP_PRIVATE , ion , 0 ); + + //if mmap'ing fails, fall back to the read-lseek combination + if ( fileMap == MAP_FAILED ) + { + readWriteBalance = 0; + fileMap = 0; + qDebug() << __FILE__ << __LINE__ << ": mmap'ing history failed. errno = " << errno; + } +} + +void HistoryFile::unmap() +{ + int result = munmap( fileMap , length ); + assert( result == 0 ); Q_UNUSED( result ); + + fileMap = 0; +} + +bool HistoryFile::isMapped() +{ + return (fileMap != 0); +} + +void HistoryFile::add(const unsigned char* bytes, int len) +{ + if ( fileMap ) + unmap(); + + readWriteBalance++; + + int rc = 0; + + rc = KDE_lseek(ion,length,SEEK_SET); if (rc < 0) { perror("HistoryFile::add.seek"); return; } + rc = write(ion,bytes,len); if (rc < 0) { perror("HistoryFile::add.write"); return; } + length += rc; +} + +void HistoryFile::get(unsigned char* bytes, int len, int loc) +{ + //count number of get() calls vs. number of add() calls. + //If there are many more get() calls compared with add() + //calls (decided by using MAP_THRESHOLD) then mmap the log + //file to improve performance. + readWriteBalance--; + if ( !fileMap && readWriteBalance < MAP_THRESHOLD ) + map(); + + if ( fileMap ) + { + for (int i=0;i length) + fprintf(stderr,"getHist(...,%d,%d): invalid args.\n",len,loc); + rc = KDE_lseek(ion,loc,SEEK_SET); if (rc < 0) { perror("HistoryFile::get.seek"); return; } + rc = read(ion,bytes,len); if (rc < 0) { perror("HistoryFile::get.read"); return; } + } +} + +int HistoryFile::len() +{ + return length; +} + + +// History Scroll abstract base class ////////////////////////////////////// + + +HistoryScroll::HistoryScroll(HistoryType* t) + : m_histType(t) +{ +} + +HistoryScroll::~HistoryScroll() +{ + delete m_histType; +} + +bool HistoryScroll::hasScroll() +{ + return true; +} + +// History Scroll File ////////////////////////////////////// + +/* + The history scroll makes a Row(Row(Cell)) from + two history buffers. The index buffer contains + start of line positions which refere to the cells + buffer. + + Note that index[0] addresses the second line + (line #1), while the first line (line #0) starts + at 0 in cells. +*/ + +HistoryScrollFile::HistoryScrollFile(const QString &logFileName) + : HistoryScroll(new HistoryTypeFile(logFileName)), + m_logFileName(logFileName) +{ +} + +HistoryScrollFile::~HistoryScrollFile() +{ +} + +int HistoryScrollFile::getLines() +{ + return index.len() / sizeof(int); +} + +int HistoryScrollFile::getLineLen(int lineno) +{ + return (startOfLine(lineno+1) - startOfLine(lineno)) / sizeof(Character); +} + +bool HistoryScrollFile::isWrappedLine(int lineno) +{ + if (lineno>=0 && lineno <= getLines()) { + unsigned char flag; + lineflags.get((unsigned char*)&flag,sizeof(unsigned char),(lineno)*sizeof(unsigned char)); + return flag; + } + return false; +} + +int HistoryScrollFile::startOfLine(int lineno) +{ + if (lineno <= 0) return 0; + if (lineno <= getLines()) + { + + if (!index.isMapped()) + index.map(); + + int res; + index.get((unsigned char*)&res,sizeof(int),(lineno-1)*sizeof(int)); + return res; + } + return cells.len(); +} + +void HistoryScrollFile::getCells(int lineno, int colno, int count, Character res[]) +{ + cells.get((unsigned char*)res,count*sizeof(Character),startOfLine(lineno)+colno*sizeof(Character)); +} + +void HistoryScrollFile::addCells(const Character text[], int count) +{ + cells.add((unsigned char*)text,count*sizeof(Character)); +} + +void HistoryScrollFile::addLine(bool previousWrapped) +{ + if (index.isMapped()) + index.unmap(); + + int locn = cells.len(); + index.add((unsigned char*)&locn,sizeof(int)); + unsigned char flags = previousWrapped ? 0x01 : 0x00; + lineflags.add((unsigned char*)&flags,sizeof(unsigned char)); +} + + +// History Scroll Buffer ////////////////////////////////////// +HistoryScrollBuffer::HistoryScrollBuffer(unsigned int maxLineCount) + : HistoryScroll(new HistoryTypeBuffer(maxLineCount)) + ,_historyBuffer() + ,_maxLineCount(0) + ,_usedLines(0) + ,_head(0) +{ + setMaxNbLines(maxLineCount); +} + +HistoryScrollBuffer::~HistoryScrollBuffer() +{ + delete[] _historyBuffer; +} + +void HistoryScrollBuffer::addCellsVector(const QVector& cells) +{ + _head++; + if ( _usedLines < _maxLineCount ) + _usedLines++; + + if ( _head >= _maxLineCount ) + { + _head = 0; + } + + _historyBuffer[bufferIndex(_usedLines-1)] = cells; + _wrappedLine[bufferIndex(_usedLines-1)] = false; +} +void HistoryScrollBuffer::addCells(const Character a[], int count) +{ + HistoryLine newLine(count); + qCopy(a,a+count,newLine.begin()); + + addCellsVector(newLine); +} + +void HistoryScrollBuffer::addLine(bool previousWrapped) +{ + _wrappedLine[bufferIndex(_usedLines-1)] = previousWrapped; +} + +int HistoryScrollBuffer::getLines() +{ + return _usedLines; +} + +int HistoryScrollBuffer::getLineLen(int lineNumber) +{ + Q_ASSERT( lineNumber >= 0 && lineNumber < _maxLineCount ); + + if ( lineNumber < _usedLines ) + { + return _historyBuffer[bufferIndex(lineNumber)].size(); + } + else + { + return 0; + } +} + +bool HistoryScrollBuffer::isWrappedLine(int lineNumber) +{ + Q_ASSERT( lineNumber >= 0 && lineNumber < _maxLineCount ); + + if (lineNumber < _usedLines) + { + //kDebug() << "Line" << lineNumber << "wrapped is" << _wrappedLine[bufferIndex(lineNumber)]; + return _wrappedLine[bufferIndex(lineNumber)]; + } + else + return false; +} + +void HistoryScrollBuffer::getCells(int lineNumber, int startColumn, int count, Character buffer[]) +{ + if ( count == 0 ) return; + + Q_ASSERT( lineNumber < _maxLineCount ); + + if (lineNumber >= _usedLines) + { + memset(buffer, 0, count * sizeof(Character)); + return; + } + + const HistoryLine& line = _historyBuffer[bufferIndex(lineNumber)]; + + //kDebug() << "startCol " << startColumn; + //kDebug() << "line.size() " << line.size(); + //kDebug() << "count " << count; + + Q_ASSERT( startColumn <= line.size() - count ); + + memcpy(buffer, line.constData() + startColumn , count * sizeof(Character)); +} + +void HistoryScrollBuffer::setMaxNbLines(unsigned int lineCount) +{ + HistoryLine* oldBuffer = _historyBuffer; + HistoryLine* newBuffer = new HistoryLine[lineCount]; + + for ( int i = 0 ; i < qMin(_usedLines,(int)lineCount) ; i++ ) + { + newBuffer[i] = oldBuffer[bufferIndex(i)]; + } + + _usedLines = qMin(_usedLines,(int)lineCount); + _maxLineCount = lineCount; + _head = ( _usedLines == _maxLineCount ) ? 0 : _usedLines-1; + + _historyBuffer = newBuffer; + delete[] oldBuffer; + + _wrappedLine.resize(lineCount); + dynamic_cast(m_histType)->m_nbLines = lineCount; +} + +int HistoryScrollBuffer::bufferIndex(int lineNumber) +{ + Q_ASSERT( lineNumber >= 0 ); + Q_ASSERT( lineNumber < _maxLineCount ); + Q_ASSERT( (_usedLines == _maxLineCount) || lineNumber <= _head ); + + if ( _usedLines == _maxLineCount ) + { + return (_head+lineNumber+1) % _maxLineCount; + } + else + { + return lineNumber; + } +} + + +// History Scroll None ////////////////////////////////////// + +HistoryScrollNone::HistoryScrollNone() + : HistoryScroll(new HistoryTypeNone()) +{ +} + +HistoryScrollNone::~HistoryScrollNone() +{ +} + +bool HistoryScrollNone::hasScroll() +{ + return false; +} + +int HistoryScrollNone::getLines() +{ + return 0; +} + +int HistoryScrollNone::getLineLen(int) +{ + return 0; +} + +bool HistoryScrollNone::isWrappedLine(int /*lineno*/) +{ + return false; +} + +void HistoryScrollNone::getCells(int, int, int, Character []) +{ +} + +void HistoryScrollNone::addCells(const Character [], int) +{ +} + +void HistoryScrollNone::addLine(bool) +{ +} + +// History Scroll BlockArray ////////////////////////////////////// + +HistoryScrollBlockArray::HistoryScrollBlockArray(size_t size) + : HistoryScroll(new HistoryTypeBlockArray(size)) +{ + m_blockArray.setHistorySize(size); // nb. of lines. +} + +HistoryScrollBlockArray::~HistoryScrollBlockArray() +{ +} + +int HistoryScrollBlockArray::getLines() +{ + return m_lineLengths.count(); +} + +int HistoryScrollBlockArray::getLineLen(int lineno) +{ + if ( m_lineLengths.contains(lineno) ) + return m_lineLengths[lineno]; + else + return 0; +} + +bool HistoryScrollBlockArray::isWrappedLine(int /*lineno*/) +{ + return false; +} + +void HistoryScrollBlockArray::getCells(int lineno, int colno, + int count, Character res[]) +{ + if (!count) return; + + const Block *b = m_blockArray.at(lineno); + + if (!b) { + memset(res, 0, count * sizeof(Character)); // still better than random data + return; + } + + assert(((colno + count) * sizeof(Character)) < ENTRIES); + memcpy(res, b->data + (colno * sizeof(Character)), count * sizeof(Character)); +} + +void HistoryScrollBlockArray::addCells(const Character a[], int count) +{ + Block *b = m_blockArray.lastBlock(); + + if (!b) return; + + // put cells in block's data + assert((count * sizeof(Character)) < ENTRIES); + + memset(b->data, 0, ENTRIES); + + memcpy(b->data, a, count * sizeof(Character)); + b->size = count * sizeof(Character); + + size_t res = m_blockArray.newBlock(); + assert (res > 0); + Q_UNUSED( res ); + + m_lineLengths.insert(m_blockArray.getCurrent(), count); +} + +void HistoryScrollBlockArray::addLine(bool) +{ +} + +//////////////////////////////////////////////////////////////// +// Compact History Scroll ////////////////////////////////////// +//////////////////////////////////////////////////////////////// +void* CompactHistoryBlock::allocate ( size_t length ) +{ + Q_ASSERT ( length > 0 ); + if ( tail-blockStart+length > blockLength ) + return NULL; + + void* block = tail; + tail += length; + //kDebug() << "allocated " << length << " bytes at address " << block; + allocCount++; + return block; +} + +void CompactHistoryBlock::deallocate ( ) +{ + allocCount--; + Q_ASSERT ( allocCount >= 0 ); +} + +void* CompactHistoryBlockList::allocate(size_t size) +{ + CompactHistoryBlock* block; + if ( list.isEmpty() || list.last()->remaining() < size) + { + block = new CompactHistoryBlock(); + list.append ( block ); + //kDebug() << "new block created, remaining " << block->remaining() << "number of blocks=" << list.size(); + } + else + { + block = list.last(); + //kDebug() << "old block used, remaining " << block->remaining(); + } + return block->allocate(size); +} + +void CompactHistoryBlockList::deallocate(void* ptr) +{ + Q_ASSERT( !list.isEmpty()); + + int i=0; + CompactHistoryBlock *block = list.at(i); + while ( icontains(ptr) ) + { + i++; + block=list.at(i); + } + + Q_ASSERT( ideallocate(); + + if (!block->isInUse()) + { + list.removeAt(i); + delete block; + //kDebug() << "block deleted, new size = " << list.size(); + } +} + +CompactHistoryBlockList::~CompactHistoryBlockList() +{ + qDeleteAll ( list.begin(), list.end() ); + list.clear(); +} + +void* CompactHistoryLine::operator new (size_t size, CompactHistoryBlockList& blockList) +{ + return blockList.allocate(size); +} + +CompactHistoryLine::CompactHistoryLine ( const TextLine& line, CompactHistoryBlockList& bList ) + : blockList(bList), + formatLength(0) +{ + length=line.size(); + + if (line.size() > 0) { + formatLength=1; + int k=1; + + // count number of different formats in this text line + Character c = line[0]; + while ( k0) { + blockList.deallocate(text); + blockList.deallocate(formatArray); + } + blockList.deallocate(this); +} + +void CompactHistoryLine::getCharacter ( int index, Character &r ) +{ + Q_ASSERT ( index < length ); + int formatPos=0; + while ( ( formatPos+1 ) < formatLength && index >= formatArray[formatPos+1].startPos ) + formatPos++; + + r.character=text[index]; + r.rendition = formatArray[formatPos].rendition; + r.foregroundColor = formatArray[formatPos].fgColor; + r.backgroundColor = formatArray[formatPos].bgColor; +} + +void CompactHistoryLine::getCharacters ( Character* array, int length, int startColumn ) +{ + Q_ASSERT ( startColumn >= 0 && length >= 0 ); + Q_ASSERT ( startColumn+length <= ( int ) getLength() ); + + for ( int i=startColumn; i ( int ) _maxLineCount ) + { + delete lines.takeAt ( 0 ); + } + lines.append ( line ); +} + +void CompactHistoryScroll::addCells ( const Character a[], int count ) +{ + TextLine newLine ( count ); + qCopy ( a,a+count,newLine.begin() ); + addCellsVector ( newLine ); +} + +void CompactHistoryScroll::addLine ( bool previousWrapped ) +{ + CompactHistoryLine *line = lines.last(); + //kDebug() << "last line at address " << line; + line->setWrapped(previousWrapped); +} + +int CompactHistoryScroll::getLines() +{ + return lines.size(); +} + +int CompactHistoryScroll::getLineLen ( int lineNumber ) +{ + Q_ASSERT ( lineNumber >= 0 && lineNumber < lines.size() ); + CompactHistoryLine* line = lines[lineNumber]; + //kDebug() << "request for line at address " << line; + return line->getLength(); +} + + +void CompactHistoryScroll::getCells ( int lineNumber, int startColumn, int count, Character buffer[] ) +{ + if ( count == 0 ) return; + Q_ASSERT ( lineNumber < lines.size() ); + CompactHistoryLine* line = lines[lineNumber]; + Q_ASSERT ( startColumn >= 0 ); + Q_ASSERT ( (unsigned int)startColumn <= line->getLength() - count ); + line->getCharacters ( buffer, count, startColumn ); +} + +void CompactHistoryScroll::setMaxNbLines ( unsigned int lineCount ) +{ + _maxLineCount = lineCount; + + while (lines.size() > (int) lineCount) { + delete lines.takeAt(0); + } + //kDebug() << "set max lines to: " << _maxLineCount; +} + +bool CompactHistoryScroll::isWrappedLine ( int lineNumber ) +{ + Q_ASSERT ( lineNumber < lines.size() ); + return lines[lineNumber]->isWrapped(); +} + + +////////////////////////////////////////////////////////////////////// +// History Types +////////////////////////////////////////////////////////////////////// + +HistoryType::HistoryType() +{ +} + +HistoryType::~HistoryType() +{ +} + +////////////////////////////// + +HistoryTypeNone::HistoryTypeNone() +{ +} + +bool HistoryTypeNone::isEnabled() const +{ + return false; +} + +HistoryScroll* HistoryTypeNone::scroll(HistoryScroll *old) const +{ + delete old; + return new HistoryScrollNone(); +} + +int HistoryTypeNone::maximumLineCount() const +{ + return 0; +} + +////////////////////////////// + +HistoryTypeBlockArray::HistoryTypeBlockArray(size_t size) + : m_size(size) +{ +} + +bool HistoryTypeBlockArray::isEnabled() const +{ + return true; +} + +int HistoryTypeBlockArray::maximumLineCount() const +{ + return m_size; +} + +HistoryScroll* HistoryTypeBlockArray::scroll(HistoryScroll *old) const +{ + delete old; + return new HistoryScrollBlockArray(m_size); +} + + +////////////////////////////// + +HistoryTypeBuffer::HistoryTypeBuffer(unsigned int nbLines) + : m_nbLines(nbLines) +{ +} + +bool HistoryTypeBuffer::isEnabled() const +{ + return true; +} + +int HistoryTypeBuffer::maximumLineCount() const +{ + return m_nbLines; +} + +HistoryScroll* HistoryTypeBuffer::scroll(HistoryScroll *old) const +{ + if (old) + { + HistoryScrollBuffer *oldBuffer = dynamic_cast(old); + if (oldBuffer) + { + oldBuffer->setMaxNbLines(m_nbLines); + return oldBuffer; + } + + HistoryScroll *newScroll = new HistoryScrollBuffer(m_nbLines); + int lines = old->getLines(); + int startLine = 0; + if (lines > (int) m_nbLines) + startLine = lines - m_nbLines; + + Character line[LINE_SIZE]; + for(int i = startLine; i < lines; i++) + { + int size = old->getLineLen(i); + if (size > LINE_SIZE) + { + Character *tmp_line = new Character[size]; + old->getCells(i, 0, size, tmp_line); + newScroll->addCells(tmp_line, size); + newScroll->addLine(old->isWrappedLine(i)); + delete [] tmp_line; + } + else + { + old->getCells(i, 0, size, line); + newScroll->addCells(line, size); + newScroll->addLine(old->isWrappedLine(i)); + } + } + delete old; + return newScroll; + } + return new HistoryScrollBuffer(m_nbLines); +} + +////////////////////////////// + +HistoryTypeFile::HistoryTypeFile(const QString& fileName) + : m_fileName(fileName) +{ +} + +bool HistoryTypeFile::isEnabled() const +{ + return true; +} + +const QString& HistoryTypeFile::getFileName() const +{ + return m_fileName; +} + +HistoryScroll* HistoryTypeFile::scroll(HistoryScroll *old) const +{ + if (dynamic_cast(old)) + return old; // Unchanged. + + HistoryScroll *newScroll = new HistoryScrollFile(m_fileName); + + Character line[LINE_SIZE]; + int lines = (old != 0) ? old->getLines() : 0; + for(int i = 0; i < lines; i++) + { + int size = old->getLineLen(i); + if (size > LINE_SIZE) + { + Character *tmp_line = new Character[size]; + old->getCells(i, 0, size, tmp_line); + newScroll->addCells(tmp_line, size); + newScroll->addLine(old->isWrappedLine(i)); + delete [] tmp_line; + } + else + { + old->getCells(i, 0, size, line); + newScroll->addCells(line, size); + newScroll->addLine(old->isWrappedLine(i)); + } + } + + delete old; + return newScroll; +} + +int HistoryTypeFile::maximumLineCount() const +{ + return 0; +} + +////////////////////////////// + +CompactHistoryType::CompactHistoryType ( unsigned int nbLines ) + : m_nbLines ( nbLines ) +{ +} + +bool CompactHistoryType::isEnabled() const +{ + return true; +} + +int CompactHistoryType::maximumLineCount() const +{ + return m_nbLines; +} + +HistoryScroll* CompactHistoryType::scroll ( HistoryScroll *old ) const +{ + if ( old ) + { + CompactHistoryScroll *oldBuffer = dynamic_cast ( old ); + if ( oldBuffer ) + { + oldBuffer->setMaxNbLines ( m_nbLines ); + return oldBuffer; + } + delete old; + } + return new CompactHistoryScroll ( m_nbLines ); +} diff --git a/konsole-qml-plugin/src/History.h b/konsole-qml-plugin/src/History.h new file mode 100644 index 0000000..c1b0d56 --- /dev/null +++ b/konsole-qml-plugin/src/History.h @@ -0,0 +1,490 @@ +/* + This file is part of Konsole, an X terminal. + Copyright 1997,1998 by Lars Doelle + + 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. +*/ + +#ifndef TEHISTORY_H +#define TEHISTORY_H + +// Qt +#include +#include +#include +#include + +// KDE +//#include + +// Konsole +#include "BlockArray.h" +#include "Character.h" + +// map +#include + + +#if 1 +/* + An extendable tmpfile(1) based buffer. +*/ + +class HistoryFile +{ +public: + HistoryFile(); + virtual ~HistoryFile(); + + virtual void add(const unsigned char* bytes, int len); + virtual void get(unsigned char* bytes, int len, int loc); + virtual int len(); + + //mmaps the file in read-only mode + void map(); + //un-mmaps the file + void unmap(); + //returns true if the file is mmap'ed + bool isMapped(); + + +private: + int ion; + int length; + QTemporaryFile tmpFile; + + //pointer to start of mmap'ed file data, or 0 if the file is not mmap'ed + char* fileMap; + + //incremented whenver 'add' is called and decremented whenever + //'get' is called. + //this is used to detect when a large number of lines are being read and processed from the history + //and automatically mmap the file for better performance (saves the overhead of many lseek-read calls). + int readWriteBalance; + + //when readWriteBalance goes below this threshold, the file will be mmap'ed automatically + static const int MAP_THRESHOLD = -1000; +}; +#endif + +////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////// +// Abstract base class for file and buffer versions +////////////////////////////////////////////////////////////////////// +class HistoryType; + +class HistoryScroll +{ +public: + HistoryScroll(HistoryType*); + virtual ~HistoryScroll(); + + virtual bool hasScroll(); + + // access to history + virtual int getLines() = 0; + virtual int getLineLen(int lineno) = 0; + virtual void getCells(int lineno, int colno, int count, Character res[]) = 0; + virtual bool isWrappedLine(int lineno) = 0; + + // backward compatibility (obsolete) + Character getCell(int lineno, int colno) { Character res; getCells(lineno,colno,1,&res); return res; } + + // adding lines. + virtual void addCells(const Character a[], int count) = 0; + // convenience method - this is virtual so that subclasses can take advantage + // of QVector's implicit copying + virtual void addCellsVector(const QVector& cells) + { + addCells(cells.data(),cells.size()); + } + + virtual void addLine(bool previousWrapped=false) = 0; + + // + // FIXME: Passing around constant references to HistoryType instances + // is very unsafe, because those references will no longer + // be valid if the history scroll is deleted. + // + const HistoryType& getType() { return *m_histType; } + +protected: + HistoryType* m_histType; + +}; + +#if 1 + +////////////////////////////////////////////////////////////////////// +// File-based history (e.g. file log, no limitation in length) +////////////////////////////////////////////////////////////////////// + +class HistoryScrollFile : public HistoryScroll +{ +public: + HistoryScrollFile(const QString &logFileName); + virtual ~HistoryScrollFile(); + + virtual int getLines(); + virtual int getLineLen(int lineno); + virtual void getCells(int lineno, int colno, int count, Character res[]); + virtual bool isWrappedLine(int lineno); + + virtual void addCells(const Character a[], int count); + virtual void addLine(bool previousWrapped=false); + +private: + int startOfLine(int lineno); + + QString m_logFileName; + HistoryFile index; // lines Row(int) + HistoryFile cells; // text Row(Character) + HistoryFile lineflags; // flags Row(unsigned char) +}; + + +////////////////////////////////////////////////////////////////////// +// Buffer-based history (limited to a fixed nb of lines) +////////////////////////////////////////////////////////////////////// +class HistoryScrollBuffer : public HistoryScroll +{ +public: + typedef QVector HistoryLine; + + HistoryScrollBuffer(unsigned int maxNbLines = 1000); + virtual ~HistoryScrollBuffer(); + + virtual int getLines(); + virtual int getLineLen(int lineno); + virtual void getCells(int lineno, int colno, int count, Character res[]); + virtual bool isWrappedLine(int lineno); + + virtual void addCells(const Character a[], int count); + virtual void addCellsVector(const QVector& cells); + virtual void addLine(bool previousWrapped=false); + + void setMaxNbLines(unsigned int nbLines); + unsigned int maxNbLines() { return _maxLineCount; } + + +private: + int bufferIndex(int lineNumber); + + HistoryLine* _historyBuffer; + QBitArray _wrappedLine; + int _maxLineCount; + int _usedLines; + int _head; + + //QVector m_histBuffer; + //QBitArray m_wrappedLine; + //unsigned int m_maxNbLines; + //unsigned int m_nbLines; + //unsigned int m_arrayIndex; + //bool m_buffFilled; +}; + +/*class HistoryScrollBufferV2 : public HistoryScroll +{ +public: + virtual int getLines(); + virtual int getLineLen(int lineno); + virtual void getCells(int lineno, int colno, int count, Character res[]); + virtual bool isWrappedLine(int lineno); + + virtual void addCells(const Character a[], int count); + virtual void addCells(const QVector& cells); + virtual void addLine(bool previousWrapped=false); + +};*/ + +#endif + +////////////////////////////////////////////////////////////////////// +// Nothing-based history (no history :-) +////////////////////////////////////////////////////////////////////// +class HistoryScrollNone : public HistoryScroll +{ +public: + HistoryScrollNone(); + virtual ~HistoryScrollNone(); + + virtual bool hasScroll(); + + virtual int getLines(); + virtual int getLineLen(int lineno); + virtual void getCells(int lineno, int colno, int count, Character res[]); + virtual bool isWrappedLine(int lineno); + + virtual void addCells(const Character a[], int count); + virtual void addLine(bool previousWrapped=false); +}; + +////////////////////////////////////////////////////////////////////// +// BlockArray-based history +////////////////////////////////////////////////////////////////////// +class HistoryScrollBlockArray : public HistoryScroll +{ +public: + HistoryScrollBlockArray(size_t size); + virtual ~HistoryScrollBlockArray(); + + virtual int getLines(); + virtual int getLineLen(int lineno); + virtual void getCells(int lineno, int colno, int count, Character res[]); + virtual bool isWrappedLine(int lineno); + + virtual void addCells(const Character a[], int count); + virtual void addLine(bool previousWrapped=false); + +protected: + BlockArray m_blockArray; + QHash m_lineLengths; +}; + +////////////////////////////////////////////////////////////////////// +// History using compact storage +// This implementation uses a list of fixed-sized blocks +// where history lines are allocated in (avoids heap fragmentation) +////////////////////////////////////////////////////////////////////// +typedef QVector TextLine; + +class CharacterFormat +{ +public: + bool equalsFormat(const CharacterFormat &other) const { + return other.rendition==rendition && other.fgColor==fgColor && other.bgColor==bgColor; + } + + bool equalsFormat(const Character &c) const { + return c.rendition==rendition && c.foregroundColor==fgColor && c.backgroundColor==bgColor; + } + + void setFormat(const Character& c) { + rendition=c.rendition; + fgColor=c.foregroundColor; + bgColor=c.backgroundColor; + } + + CharacterColor fgColor, bgColor; + quint16 startPos; + quint8 rendition; +}; + +class CompactHistoryBlock +{ +public: + + CompactHistoryBlock(){ + blockLength = 4096*64; // 256kb + head = (quint8*) mmap(0, blockLength, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANON, -1, 0); + //head = (quint8*) malloc(blockLength); + Q_ASSERT(head != MAP_FAILED); + tail = blockStart = head; + allocCount=0; + } + + virtual ~CompactHistoryBlock(){ + //free(blockStart); + munmap(blockStart, blockLength); + } + + virtual unsigned int remaining(){ return blockStart+blockLength-tail;} + virtual unsigned length() { return blockLength; } + virtual void* allocate(size_t length); + virtual bool contains(void *addr) {return addr>=blockStart && addr<(blockStart+blockLength);} + virtual void deallocate(); + virtual bool isInUse(){ return allocCount!=0; } ; + +private: + size_t blockLength; + quint8* head; + quint8* tail; + quint8* blockStart; + int allocCount; +}; + +class CompactHistoryBlockList { +public: + CompactHistoryBlockList() {}; + ~CompactHistoryBlockList(); + + void *allocate( size_t size ); + void deallocate(void *); + int length() {return list.size();} +private: + QList list; +}; + +class CompactHistoryLine +{ +public: + CompactHistoryLine(const TextLine&, CompactHistoryBlockList& blockList); + virtual ~CompactHistoryLine(); + + // custom new operator to allocate memory from custom pool instead of heap + static void *operator new( size_t size, CompactHistoryBlockList& blockList); + static void operator delete( void *) { /* do nothing, deallocation from pool is done in destructor*/ } ; + + virtual void getCharacters(Character* array, int length, int startColumn) ; + virtual void getCharacter(int index, Character &r) ; + virtual bool isWrapped() const {return wrapped;}; + virtual void setWrapped(bool isWrapped) { wrapped=isWrapped;}; + virtual unsigned int getLength() const {return length;}; + +protected: + CompactHistoryBlockList& blockList; + CharacterFormat* formatArray; + quint16 length; + quint16* text; + quint16 formatLength; + bool wrapped; +}; + +class CompactHistoryScroll : public HistoryScroll +{ + typedef QList HistoryArray; + +public: + CompactHistoryScroll(unsigned int maxNbLines = 1000); + virtual ~CompactHistoryScroll(); + + virtual int getLines(); + virtual int getLineLen(int lineno); + virtual void getCells(int lineno, int colno, int count, Character res[]); + virtual bool isWrappedLine(int lineno); + + virtual void addCells(const Character a[], int count); + virtual void addCellsVector(const TextLine& cells); + virtual void addLine(bool previousWrapped=false); + + void setMaxNbLines(unsigned int nbLines); + unsigned int maxNbLines() const { return _maxLineCount; } + +private: + bool hasDifferentColors(const TextLine& line) const; + HistoryArray lines; + CompactHistoryBlockList blockList; + + unsigned int _maxLineCount; +}; + +////////////////////////////////////////////////////////////////////// +// History type +////////////////////////////////////////////////////////////////////// + +class HistoryType +{ +public: + HistoryType(); + virtual ~HistoryType(); + + /** + * Returns true if the history is enabled ( can store lines of output ) + * or false otherwise. + */ + virtual bool isEnabled() const = 0; + /** + * Returns true if the history size is unlimited. + */ + bool isUnlimited() const { return maximumLineCount() == 0; } + /** + * Returns the maximum number of lines which this history type + * can store or 0 if the history can store an unlimited number of lines. + */ + virtual int maximumLineCount() const = 0; + + virtual HistoryScroll* scroll(HistoryScroll *) const = 0; +}; + +class HistoryTypeNone : public HistoryType +{ +public: + HistoryTypeNone(); + + virtual bool isEnabled() const; + virtual int maximumLineCount() const; + + virtual HistoryScroll* scroll(HistoryScroll *) const; +}; + +class HistoryTypeBlockArray : public HistoryType +{ +public: + HistoryTypeBlockArray(size_t size); + + virtual bool isEnabled() const; + virtual int maximumLineCount() const; + + virtual HistoryScroll* scroll(HistoryScroll *) const; + +protected: + size_t m_size; +}; + +#if 1 +class HistoryTypeFile : public HistoryType +{ +public: + HistoryTypeFile(const QString& fileName=QString()); + + virtual bool isEnabled() const; + virtual const QString& getFileName() const; + virtual int maximumLineCount() const; + + virtual HistoryScroll* scroll(HistoryScroll *) const; + +protected: + QString m_fileName; +}; + + +class HistoryTypeBuffer : public HistoryType +{ + friend class HistoryScrollBuffer; + +public: + HistoryTypeBuffer(unsigned int nbLines); + + virtual bool isEnabled() const; + virtual int maximumLineCount() const; + + virtual HistoryScroll* scroll(HistoryScroll *) const; + +protected: + unsigned int m_nbLines; +}; + +class CompactHistoryType : public HistoryType +{ +public: + CompactHistoryType(unsigned int size); + + virtual bool isEnabled() const; + virtual int maximumLineCount() const; + + virtual HistoryScroll* scroll(HistoryScroll *) const; + +protected: + unsigned int m_nbLines; +}; + + +#endif + + +#endif // TEHISTORY_H diff --git a/konsole-qml-plugin/src/KeyboardTranslator.cpp b/konsole-qml-plugin/src/KeyboardTranslator.cpp new file mode 100644 index 0000000..a2ad22c --- /dev/null +++ b/konsole-qml-plugin/src/KeyboardTranslator.cpp @@ -0,0 +1,892 @@ +/* + This source file is part of Konsole, a terminal emulator. + + Copyright 2007-2008 by Robert Knight + + 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. +*/ + +// Own +#include "KeyboardTranslator.h" + +// System +#include +#include + +// Qt +#include +#include +#include +#include +#include +#include +#include + +#include "tools.h" + +// KDE +//#include +//#include +//#include + + +const QByteArray KeyboardTranslatorManager::defaultTranslatorText( +"keyboard \"Fallback Key Translator\"\n" +"key Tab : \"\\t\"" +); + +KeyboardTranslatorManager::KeyboardTranslatorManager() + : _haveLoadedAll(false) +{ +} +KeyboardTranslatorManager::~KeyboardTranslatorManager() +{ + qDeleteAll(_translators); +} +QString KeyboardTranslatorManager::findTranslatorPath(const QString& name) +{ + return QString(get_kb_layout_dir() + name + ".keytab"); + //return KGlobal::dirs()->findResource("data","konsole/"+name+".keytab"); +} + +void KeyboardTranslatorManager::findTranslators() +{ + QDir dir(get_kb_layout_dir()); + QStringList filters; + filters << "*.keytab"; + dir.setNameFilters(filters); + QStringList list = dir.entryList(filters); + list = dir.entryList(filters); +// QStringList list = KGlobal::dirs()->findAllResources("data", +// "konsole/*.keytab", +// KStandardDirs::NoDuplicates); + + // add the name of each translator to the list and associated + // the name with a null pointer to indicate that the translator + // has not yet been loaded from disk + QStringListIterator listIter(list); + while (listIter.hasNext()) + { + QString translatorPath = listIter.next(); + + QString name = QFileInfo(translatorPath).baseName(); + + if ( !_translators.contains(name) ) + _translators.insert(name,0); + } + + _haveLoadedAll = true; +} + +const KeyboardTranslator* KeyboardTranslatorManager::findTranslator(const QString& name) +{ + if ( name.isEmpty() ) + return defaultTranslator(); + + if ( _translators.contains(name) && _translators[name] != 0 ) + return _translators[name]; + + KeyboardTranslator* translator = loadTranslator(name); + + if ( translator != 0 ) + _translators[name] = translator; + else if ( !name.isEmpty() ) + qDebug() << "Unable to load translator" << name; + + return translator; +} + +bool KeyboardTranslatorManager::saveTranslator(const KeyboardTranslator* translator) +{ +qDebug() << "KeyboardTranslatorManager::saveTranslator" << "unimplemented"; +Q_UNUSED(translator); +#if 0 + const QString path = KGlobal::dirs()->saveLocation("data","konsole/")+translator->name() + +".keytab"; + + //kDebug() << "Saving translator to" << path; + + QFile destination(path); + if (!destination.open(QIODevice::WriteOnly | QIODevice::Text)) + { + qDebug() << "Unable to save keyboard translation:" + << destination.errorString(); + return false; + } + + { + KeyboardTranslatorWriter writer(&destination); + writer.writeHeader(translator->description()); + + QListIterator iter(translator->entries()); + while ( iter.hasNext() ) + writer.writeEntry(iter.next()); + } + + destination.close(); +#endif + return true; +} + +KeyboardTranslator* KeyboardTranslatorManager::loadTranslator(const QString& name) +{ + const QString& path = findTranslatorPath(name); + + QFile source(path); + if (name.isEmpty() || !source.open(QIODevice::ReadOnly | QIODevice::Text)) + return 0; + + return loadTranslator(&source,name); +} + +const KeyboardTranslator* KeyboardTranslatorManager::defaultTranslator() +{ + // Try to find the default.keytab file if it exists, otherwise + // fall back to the hard-coded one + const KeyboardTranslator* translator = findTranslator("default"); + if (!translator) + { + QBuffer textBuffer; + textBuffer.setData(defaultTranslatorText); + textBuffer.open(QIODevice::ReadOnly); + translator = loadTranslator(&textBuffer,"fallback"); + } + return translator; +} + +KeyboardTranslator* KeyboardTranslatorManager::loadTranslator(QIODevice* source,const QString& name) +{ + KeyboardTranslator* translator = new KeyboardTranslator(name); + KeyboardTranslatorReader reader(source); + translator->setDescription( reader.description() ); + while ( reader.hasNextEntry() ) + translator->addEntry(reader.nextEntry()); + + source->close(); + + if ( !reader.parseError() ) + { + return translator; + } + else + { + delete translator; + return 0; + } +} + +KeyboardTranslatorWriter::KeyboardTranslatorWriter(QIODevice* destination) +: _destination(destination) +{ + Q_ASSERT( destination && destination->isWritable() ); + + _writer = new QTextStream(_destination); +} +KeyboardTranslatorWriter::~KeyboardTranslatorWriter() +{ + delete _writer; +} +void KeyboardTranslatorWriter::writeHeader( const QString& description ) +{ + *_writer << "keyboard \"" << description << '\"' << '\n'; +} +void KeyboardTranslatorWriter::writeEntry( const KeyboardTranslator::Entry& entry ) +{ + QString result; + if ( entry.command() != KeyboardTranslator::NoCommand ) + result = entry.resultToString(); + else + result = '\"' + entry.resultToString() + '\"'; + + *_writer << "key " << entry.conditionToString() << " : " << result << '\n'; +} + + +// each line of the keyboard translation file is one of: +// +// - keyboard "name" +// - key KeySequence : "characters" +// - key KeySequence : CommandName +// +// KeySequence begins with the name of the key ( taken from the Qt::Key enum ) +// and is followed by the keyboard modifiers and state flags ( with + or - in front +// of each modifier or flag to indicate whether it is required ). All keyboard modifiers +// and flags are optional, if a particular modifier or state is not specified it is +// assumed not to be a part of the sequence. The key sequence may contain whitespace +// +// eg: "key Up+Shift : scrollLineUp" +// "key Next-Shift : "\E[6~" +// +// (lines containing only whitespace are ignored, parseLine assumes that comments have +// already been removed) +// + +KeyboardTranslatorReader::KeyboardTranslatorReader( QIODevice* source ) + : _source(source) + , _hasNext(false) +{ + // read input until we find the description + while ( _description.isEmpty() && !source->atEnd() ) + { + QList tokens = tokenize( QString(source->readLine()) ); + if ( !tokens.isEmpty() && tokens.first().type == Token::TitleKeyword ) + _description = tokens[1].text.toUtf8(); + } + // read first entry (if any) + readNext(); +} +void KeyboardTranslatorReader::readNext() +{ + // find next entry + while ( !_source->atEnd() ) + { + const QList& tokens = tokenize( QString(_source->readLine()) ); + if ( !tokens.isEmpty() && tokens.first().type == Token::KeyKeyword ) + { + KeyboardTranslator::States flags = KeyboardTranslator::NoState; + KeyboardTranslator::States flagMask = KeyboardTranslator::NoState; + Qt::KeyboardModifiers modifiers = Qt::NoModifier; + Qt::KeyboardModifiers modifierMask = Qt::NoModifier; + + int keyCode = Qt::Key_unknown; + + decodeSequence(tokens[1].text.toLower(), + keyCode, + modifiers, + modifierMask, + flags, + flagMask); + + KeyboardTranslator::Command command = KeyboardTranslator::NoCommand; + QByteArray text; + + // get text or command + if ( tokens[2].type == Token::OutputText ) + { + text = tokens[2].text.toLocal8Bit(); + } + else if ( tokens[2].type == Token::Command ) + { + // identify command + if (!parseAsCommand(tokens[2].text,command)) + qDebug() << "Command" << tokens[2].text << "not understood."; + } + + KeyboardTranslator::Entry newEntry; + newEntry.setKeyCode( keyCode ); + newEntry.setState( flags ); + newEntry.setStateMask( flagMask ); + newEntry.setModifiers( modifiers ); + newEntry.setModifierMask( modifierMask ); + newEntry.setText( text ); + newEntry.setCommand( command ); + + _nextEntry = newEntry; + + _hasNext = true; + + return; + } + } + + _hasNext = false; +} + +bool KeyboardTranslatorReader::parseAsCommand(const QString& text,KeyboardTranslator::Command& command) +{ + if ( text.compare("erase",Qt::CaseInsensitive) == 0 ) + command = KeyboardTranslator::EraseCommand; + else if ( text.compare("scrollpageup",Qt::CaseInsensitive) == 0 ) + command = KeyboardTranslator::ScrollPageUpCommand; + else if ( text.compare("scrollpagedown",Qt::CaseInsensitive) == 0 ) + command = KeyboardTranslator::ScrollPageDownCommand; + else if ( text.compare("scrolllineup",Qt::CaseInsensitive) == 0 ) + command = KeyboardTranslator::ScrollLineUpCommand; + else if ( text.compare("scrolllinedown",Qt::CaseInsensitive) == 0 ) + command = KeyboardTranslator::ScrollLineDownCommand; + else if ( text.compare("scrolllock",Qt::CaseInsensitive) == 0 ) + command = KeyboardTranslator::ScrollLockCommand; + else + return false; + + return true; +} + +bool KeyboardTranslatorReader::decodeSequence(const QString& text, + int& keyCode, + Qt::KeyboardModifiers& modifiers, + Qt::KeyboardModifiers& modifierMask, + KeyboardTranslator::States& flags, + KeyboardTranslator::States& flagMask) +{ + bool isWanted = true; + bool endOfItem = false; + QString buffer; + + Qt::KeyboardModifiers tempModifiers = modifiers; + Qt::KeyboardModifiers tempModifierMask = modifierMask; + KeyboardTranslator::States tempFlags = flags; + KeyboardTranslator::States tempFlagMask = flagMask; + + for ( int i = 0 ; i < text.count() ; i++ ) + { + const QChar& ch = text[i]; + bool isFirstLetter = i == 0; + bool isLastLetter = ( i == text.count()-1 ); + endOfItem = true; + if ( ch.isLetterOrNumber() ) + { + endOfItem = false; + buffer.append(ch); + } else if ( isFirstLetter ) + { + buffer.append(ch); + } + + if ( (endOfItem || isLastLetter) && !buffer.isEmpty() ) + { + Qt::KeyboardModifier itemModifier = Qt::NoModifier; + int itemKeyCode = 0; + KeyboardTranslator::State itemFlag = KeyboardTranslator::NoState; + + if ( parseAsModifier(buffer,itemModifier) ) + { + tempModifierMask |= itemModifier; + + if ( isWanted ) + tempModifiers |= itemModifier; + } + else if ( parseAsStateFlag(buffer,itemFlag) ) + { + tempFlagMask |= itemFlag; + + if ( isWanted ) + tempFlags |= itemFlag; + } + else if ( parseAsKeyCode(buffer,itemKeyCode) ) + keyCode = itemKeyCode; + else + qDebug() << "Unable to parse key binding item:" << buffer; + + buffer.clear(); + } + + // check if this is a wanted / not-wanted flag and update the + // state ready for the next item + if ( ch == '+' ) + isWanted = true; + else if ( ch == '-' ) + isWanted = false; + } + + modifiers = tempModifiers; + modifierMask = tempModifierMask; + flags = tempFlags; + flagMask = tempFlagMask; + + return true; +} + +bool KeyboardTranslatorReader::parseAsModifier(const QString& item , Qt::KeyboardModifier& modifier) +{ + if ( item == "shift" ) + modifier = Qt::ShiftModifier; + else if ( item == "ctrl" || item == "control" ) + modifier = Qt::ControlModifier; + else if ( item == "alt" ) + modifier = Qt::AltModifier; + else if ( item == "meta" ) + modifier = Qt::MetaModifier; + else if ( item == "keypad" ) + modifier = Qt::KeypadModifier; + else + return false; + + return true; +} +bool KeyboardTranslatorReader::parseAsStateFlag(const QString& item , KeyboardTranslator::State& flag) +{ + if ( item == "appcukeys" || item == "appcursorkeys" ) + flag = KeyboardTranslator::CursorKeysState; + else if ( item == "ansi" ) + flag = KeyboardTranslator::AnsiState; + else if ( item == "newline" ) + flag = KeyboardTranslator::NewLineState; + else if ( item == "appscreen" ) + flag = KeyboardTranslator::AlternateScreenState; + else if ( item == "anymod" || item == "anymodifier" ) + flag = KeyboardTranslator::AnyModifierState; + else if ( item == "appkeypad" ) + flag = KeyboardTranslator::ApplicationKeypadState; + else + return false; + + return true; +} +bool KeyboardTranslatorReader::parseAsKeyCode(const QString& item , int& keyCode) +{ + QKeySequence sequence = QKeySequence::fromString(item); + if ( !sequence.isEmpty() ) + { + keyCode = sequence[0]; + + if ( sequence.count() > 1 ) + { + qDebug() << "Unhandled key codes in sequence: " << item; + } + } + // additional cases implemented for backwards compatibility with KDE 3 + else if ( item == "prior" ) + keyCode = Qt::Key_PageUp; + else if ( item == "next" ) + keyCode = Qt::Key_PageDown; + else + return false; + + return true; +} + +QString KeyboardTranslatorReader::description() const +{ + return _description; +} +bool KeyboardTranslatorReader::hasNextEntry() +{ + return _hasNext; +} +KeyboardTranslator::Entry KeyboardTranslatorReader::createEntry( const QString& condition , + const QString& result ) +{ + QString entryString("keyboard \"temporary\"\nkey "); + entryString.append(condition); + entryString.append(" : "); + + // if 'result' is the name of a command then the entry result will be that command, + // otherwise the result will be treated as a string to echo when the key sequence + // specified by 'condition' is pressed + KeyboardTranslator::Command command; + if (parseAsCommand(result,command)) + entryString.append(result); + else + entryString.append('\"' + result + '\"'); + + QByteArray array = entryString.toUtf8(); + QBuffer buffer(&array); + buffer.open(QIODevice::ReadOnly); + KeyboardTranslatorReader reader(&buffer); + + KeyboardTranslator::Entry entry; + if ( reader.hasNextEntry() ) + entry = reader.nextEntry(); + + return entry; +} + +KeyboardTranslator::Entry KeyboardTranslatorReader::nextEntry() +{ + Q_ASSERT( _hasNext ); + KeyboardTranslator::Entry entry = _nextEntry; + readNext(); + return entry; +} +bool KeyboardTranslatorReader::parseError() +{ + return false; +} +QList KeyboardTranslatorReader::tokenize(const QString& line) +{ + QString text = line; + + // remove comments + bool inQuotes = false; + int commentPos = -1; + for (int i=text.length()-1;i>=0;i--) + { + QChar ch = text[i]; + if (ch == '\"') + inQuotes = !inQuotes; + else if (ch == '#' && !inQuotes) + commentPos = i; + } + if (commentPos != -1) + text.remove(commentPos,text.length()); + + text = text.simplified(); + + // title line: keyboard "title" + static QRegExp title("keyboard\\s+\"(.*)\""); + // key line: key KeySequence : "output" + // key line: key KeySequence : command + static QRegExp key("key\\s+([\\w\\+\\s\\-\\*\\.]+)\\s*:\\s*(\"(.*)\"|\\w+)"); + + QList list; + if ( text.isEmpty() ) + { + return list; + } + + if ( title.exactMatch(text) ) + { + Token titleToken = { Token::TitleKeyword , QString() }; + Token textToken = { Token::TitleText , title.capturedTexts()[1] }; + + list << titleToken << textToken; + } + else if ( key.exactMatch(text) ) + { + Token keyToken = { Token::KeyKeyword , QString() }; + Token sequenceToken = { Token::KeySequence , key.capturedTexts()[1].remove(' ') }; + + list << keyToken << sequenceToken; + + if ( key.capturedTexts()[3].isEmpty() ) + { + // capturedTexts()[2] is a command + Token commandToken = { Token::Command , key.capturedTexts()[2] }; + list << commandToken; + } + else + { + // capturedTexts()[3] is the output string + Token outputToken = { Token::OutputText , key.capturedTexts()[3] }; + list << outputToken; + } + } + else + { + qDebug() << "Line in keyboard translator file could not be understood:" << text; + } + + return list; +} + +QList KeyboardTranslatorManager::allTranslators() +{ + if ( !_haveLoadedAll ) + { + findTranslators(); + } + + return _translators.keys(); +} + +KeyboardTranslator::Entry::Entry() +: _keyCode(0) +, _modifiers(Qt::NoModifier) +, _modifierMask(Qt::NoModifier) +, _state(NoState) +, _stateMask(NoState) +, _command(NoCommand) +{ +} + +bool KeyboardTranslator::Entry::operator==(const Entry& rhs) const +{ + return _keyCode == rhs._keyCode && + _modifiers == rhs._modifiers && + _modifierMask == rhs._modifierMask && + _state == rhs._state && + _stateMask == rhs._stateMask && + _command == rhs._command && + _text == rhs._text; +} + +bool KeyboardTranslator::Entry::matches(int keyCode , + Qt::KeyboardModifiers modifiers, + States testState) const +{ + if ( _keyCode != keyCode ) + return false; + + if ( (modifiers & _modifierMask) != (_modifiers & _modifierMask) ) + return false; + + // if modifiers is non-zero, the 'any modifier' state is implicit + if ( modifiers != 0 ) + testState |= AnyModifierState; + + if ( (testState & _stateMask) != (_state & _stateMask) ) + return false; + + // special handling for the 'Any Modifier' state, which checks for the presence of + // any or no modifiers. In this context, the 'keypad' modifier does not count. + bool anyModifiersSet = modifiers != 0 && modifiers != Qt::KeypadModifier; + bool wantAnyModifier = _state & KeyboardTranslator::AnyModifierState; + if ( _stateMask & KeyboardTranslator::AnyModifierState ) + { + if ( wantAnyModifier != anyModifiersSet ) + return false; + } + + return true; +} +QByteArray KeyboardTranslator::Entry::escapedText(bool expandWildCards,Qt::KeyboardModifiers modifiers) const +{ + QByteArray result(text(expandWildCards,modifiers)); + + for ( int i = 0 ; i < result.count() ; i++ ) + { + char ch = result[i]; + char replacement = 0; + + switch ( ch ) + { + case 27 : replacement = 'E'; break; + case 8 : replacement = 'b'; break; + case 12 : replacement = 'f'; break; + case 9 : replacement = 't'; break; + case 13 : replacement = 'r'; break; + case 10 : replacement = 'n'; break; + default: + // any character which is not printable is replaced by an equivalent + // \xhh escape sequence (where 'hh' are the corresponding hex digits) + if ( !QChar(ch).isPrint() ) + replacement = 'x'; + } + + if ( replacement == 'x' ) + { + result.replace(i,1,"\\x"+QByteArray(1,ch).toHex()); + } else if ( replacement != 0 ) + { + result.remove(i,1); + result.insert(i,'\\'); + result.insert(i+1,replacement); + } + } + + return result; +} +QByteArray KeyboardTranslator::Entry::unescape(const QByteArray& input) const +{ + QByteArray result(input); + + for ( int i = 0 ; i < result.count()-1 ; i++ ) + { + + QByteRef ch = result[i]; + if ( ch == '\\' ) + { + char replacement[2] = {0,0}; + int charsToRemove = 2; + bool escapedChar = true; + + switch ( result[i+1] ) + { + case 'E' : replacement[0] = 27; break; + case 'b' : replacement[0] = 8 ; break; + case 'f' : replacement[0] = 12; break; + case 't' : replacement[0] = 9 ; break; + case 'r' : replacement[0] = 13; break; + case 'n' : replacement[0] = 10; break; + case 'x' : + { + // format is \xh or \xhh where 'h' is a hexadecimal + // digit from 0-9 or A-F which should be replaced + // with the corresponding character value + char hexDigits[3] = {0}; + + if ( (i < result.count()-2) && isxdigit(result[i+2]) ) + hexDigits[0] = result[i+2]; + if ( (i < result.count()-3) && isxdigit(result[i+3]) ) + hexDigits[1] = result[i+3]; + + unsigned charValue = 0; + sscanf(hexDigits,"%x",&charValue); + + replacement[0] = (char)charValue; + charsToRemove = 2 + strlen(hexDigits); + } + break; + default: + escapedChar = false; + } + + if ( escapedChar ) + result.replace(i,charsToRemove,replacement); + } + } + + return result; +} + +void KeyboardTranslator::Entry::insertModifier( QString& item , int modifier ) const +{ + if ( !(modifier & _modifierMask) ) + return; + + if ( modifier & _modifiers ) + item += '+'; + else + item += '-'; + + if ( modifier == Qt::ShiftModifier ) + item += "Shift"; + else if ( modifier == Qt::ControlModifier ) + item += "Ctrl"; + else if ( modifier == Qt::AltModifier ) + item += "Alt"; + else if ( modifier == Qt::MetaModifier ) + item += "Meta"; + else if ( modifier == Qt::KeypadModifier ) + item += "KeyPad"; +} +void KeyboardTranslator::Entry::insertState( QString& item , int state ) const +{ + if ( !(state & _stateMask) ) + return; + + if ( state & _state ) + item += '+' ; + else + item += '-' ; + + if ( state == KeyboardTranslator::AlternateScreenState ) + item += "AppScreen"; + else if ( state == KeyboardTranslator::NewLineState ) + item += "NewLine"; + else if ( state == KeyboardTranslator::AnsiState ) + item += "Ansi"; + else if ( state == KeyboardTranslator::CursorKeysState ) + item += "AppCursorKeys"; + else if ( state == KeyboardTranslator::AnyModifierState ) + item += "AnyModifier"; + else if ( state == KeyboardTranslator::ApplicationKeypadState ) + item += "AppKeypad"; +} +QString KeyboardTranslator::Entry::resultToString(bool expandWildCards,Qt::KeyboardModifiers modifiers) const +{ + if ( !_text.isEmpty() ) + return escapedText(expandWildCards,modifiers); + else if ( _command == EraseCommand ) + return "Erase"; + else if ( _command == ScrollPageUpCommand ) + return "ScrollPageUp"; + else if ( _command == ScrollPageDownCommand ) + return "ScrollPageDown"; + else if ( _command == ScrollLineUpCommand ) + return "ScrollLineUp"; + else if ( _command == ScrollLineDownCommand ) + return "ScrollLineDown"; + else if ( _command == ScrollLockCommand ) + return "ScrollLock"; + + return QString(); +} +QString KeyboardTranslator::Entry::conditionToString() const +{ + QString result = QKeySequence(_keyCode).toString(); + + insertModifier( result , Qt::ShiftModifier ); + insertModifier( result , Qt::ControlModifier ); + insertModifier( result , Qt::AltModifier ); + insertModifier( result , Qt::MetaModifier ); + insertModifier( result , Qt::KeypadModifier ); + + insertState( result , KeyboardTranslator::AlternateScreenState ); + insertState( result , KeyboardTranslator::NewLineState ); + insertState( result , KeyboardTranslator::AnsiState ); + insertState( result , KeyboardTranslator::CursorKeysState ); + insertState( result , KeyboardTranslator::AnyModifierState ); + insertState( result , KeyboardTranslator::ApplicationKeypadState ); + + return result; +} + +KeyboardTranslator::KeyboardTranslator(const QString& name) +: _name(name) +{ +} + +void KeyboardTranslator::setDescription(const QString& description) +{ + _description = description; +} +QString KeyboardTranslator::description() const +{ + return _description; +} +void KeyboardTranslator::setName(const QString& name) +{ + _name = name; +} +QString KeyboardTranslator::name() const +{ + return _name; +} + +QList KeyboardTranslator::entries() const +{ + return _entries.values(); +} + +void KeyboardTranslator::addEntry(const Entry& entry) +{ + const int keyCode = entry.keyCode(); + _entries.insert(keyCode,entry); +} +void KeyboardTranslator::replaceEntry(const Entry& existing , const Entry& replacement) +{ + if ( !existing.isNull() ) + _entries.remove(existing.keyCode(),existing); + _entries.insert(replacement.keyCode(),replacement); +} +void KeyboardTranslator::removeEntry(const Entry& entry) +{ + _entries.remove(entry.keyCode(),entry); +} +KeyboardTranslator::Entry KeyboardTranslator::findEntry(int keyCode, Qt::KeyboardModifiers modifiers, States state) const +{ + foreach(const Entry& entry, _entries.values(keyCode)) + { + if ( entry.matches(keyCode,modifiers,state) ) + return entry; + } + return Entry(); // entry not found +} +void KeyboardTranslatorManager::addTranslator(KeyboardTranslator* translator) +{ + _translators.insert(translator->name(),translator); + + if ( !saveTranslator(translator) ) + qDebug() << "Unable to save translator" << translator->name() + << "to disk."; +} +bool KeyboardTranslatorManager::deleteTranslator(const QString& name) +{ + Q_ASSERT( _translators.contains(name) ); + + // locate and delete + QString path = findTranslatorPath(name); + if ( QFile::remove(path) ) + { + _translators.remove(name); + return true; + } + else + { + qDebug() << "Failed to remove translator - " << path; + return false; + } +} +//K_GLOBAL_STATIC( KeyboardTranslatorManager , theKeyboardTranslatorManager ) +KeyboardTranslatorManager* KeyboardTranslatorManager::theKeyboardTranslatorManager = 0; +KeyboardTranslatorManager* KeyboardTranslatorManager::instance() +{ + if (! theKeyboardTranslatorManager) + theKeyboardTranslatorManager = new KeyboardTranslatorManager(); + return theKeyboardTranslatorManager; +} diff --git a/konsole-qml-plugin/src/KeyboardTranslator.h b/konsole-qml-plugin/src/KeyboardTranslator.h new file mode 100644 index 0000000..57e7dd4 --- /dev/null +++ b/konsole-qml-plugin/src/KeyboardTranslator.h @@ -0,0 +1,584 @@ +/* + This source file is part of Konsole, a terminal emulator. + + Copyright 2007-2008 by Robert Knight + + 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. +*/ + +#ifndef KEYBOARDTRANSLATOR_H +#define KEYBOARDTRANSLATOR_H + +// Qt +#include +#include +#include +#include +#include + +// Konsole +//#include "konsole_export.h" +#define KONSOLEPRIVATE_EXPORT + +class QIODevice; +class QTextStream; + + +/** + * A convertor which maps between key sequences pressed by the user and the + * character strings which should be sent to the terminal and commands + * which should be invoked when those character sequences are pressed. + * + * Konsole supports multiple keyboard translators, allowing the user to + * specify the character sequences which are sent to the terminal + * when particular key sequences are pressed. + * + * A key sequence is defined as a key code, associated keyboard modifiers + * (Shift,Ctrl,Alt,Meta etc.) and state flags which indicate the state + * which the terminal must be in for the key sequence to apply. + */ +class KeyboardTranslator +{ +public: + /** + * The meaning of a particular key sequence may depend upon the state which + * the terminal emulation is in. Therefore findEntry() may return a different + * Entry depending upon the state flags supplied. + * + * This enum describes the states which may be associated with with a particular + * entry in the keyboard translation entry. + */ + enum State + { + /** Indicates that no special state is active */ + NoState = 0, + /** + * TODO More documentation + */ + NewLineState = 1, + /** + * Indicates that the terminal is in 'Ansi' mode. + * TODO: More documentation + */ + AnsiState = 2, + /** + * TODO More documentation + */ + CursorKeysState = 4, + /** + * Indicates that the alternate screen ( typically used by interactive programs + * such as screen or vim ) is active + */ + AlternateScreenState = 8, + /** Indicates that any of the modifier keys is active. */ + AnyModifierState = 16, + /** Indicates that the numpad is in application mode. */ + ApplicationKeypadState = 32 + }; + Q_DECLARE_FLAGS(States,State) + + /** + * This enum describes commands which are associated with particular key sequences. + */ + enum Command + { + /** Indicates that no command is associated with this command sequence */ + NoCommand = 0, + /** TODO Document me */ + SendCommand = 1, + /** Scroll the terminal display up one page */ + ScrollPageUpCommand = 2, + /** Scroll the terminal display down one page */ + ScrollPageDownCommand = 4, + /** Scroll the terminal display up one line */ + ScrollLineUpCommand = 8, + /** Scroll the terminal display down one line */ + ScrollLineDownCommand = 16, + /** Toggles scroll lock mode */ + ScrollLockCommand = 32, + /** Echos the operating system specific erase character. */ + EraseCommand = 64 + }; + Q_DECLARE_FLAGS(Commands,Command) + + /** + * Represents an association between a key sequence pressed by the user + * and the character sequence and commands associated with it for a particular + * KeyboardTranslator. + */ + class Entry + { + public: + /** + * Constructs a new entry for a keyboard translator. + */ + Entry(); + + /** + * Returns true if this entry is null. + * This is true for newly constructed entries which have no properties set. + */ + bool isNull() const; + + /** Returns the commands associated with this entry */ + Command command() const; + /** Sets the command associated with this entry. */ + void setCommand(Command command); + + /** + * Returns the character sequence associated with this entry, optionally replacing + * wildcard '*' characters with numbers to indicate the keyboard modifiers being pressed. + * + * TODO: The numbers used to replace '*' characters are taken from the Konsole/KDE 3 code. + * Document them. + * + * @param expandWildCards Specifies whether wild cards (occurrences of the '*' character) in + * the entry should be replaced with a number to indicate the modifier keys being pressed. + * + * @param modifiers The keyboard modifiers being pressed. + */ + QByteArray text(bool expandWildCards = false, + Qt::KeyboardModifiers modifiers = Qt::NoModifier) const; + + /** Sets the character sequence associated with this entry */ + void setText(const QByteArray& text); + + /** + * Returns the character sequence associated with this entry, + * with any non-printable characters replaced with escape sequences. + * + * eg. \\E for Escape, \\t for tab, \\n for new line. + * + * @param expandWildCards See text() + * @param modifiers See text() + */ + QByteArray escapedText(bool expandWildCards = false, + Qt::KeyboardModifiers modifiers = Qt::NoModifier) const; + + /** Returns the character code ( from the Qt::Key enum ) associated with this entry */ + int keyCode() const; + /** Sets the character code associated with this entry */ + void setKeyCode(int keyCode); + + /** + * Returns a bitwise-OR of the enabled keyboard modifiers associated with this entry. + * If a modifier is set in modifierMask() but not in modifiers(), this means that the entry + * only matches when that modifier is NOT pressed. + * + * If a modifier is not set in modifierMask() then the entry matches whether the modifier + * is pressed or not. + */ + Qt::KeyboardModifiers modifiers() const; + + /** Returns the keyboard modifiers which are valid in this entry. See modifiers() */ + Qt::KeyboardModifiers modifierMask() const; + + /** See modifiers() */ + void setModifiers( Qt::KeyboardModifiers modifiers ); + /** See modifierMask() and modifiers() */ + void setModifierMask( Qt::KeyboardModifiers modifiers ); + + /** + * Returns a bitwise-OR of the enabled state flags associated with this entry. + * If flag is set in stateMask() but not in state(), this means that the entry only + * matches when the terminal is NOT in that state. + * + * If a state is not set in stateMask() then the entry matches whether the terminal + * is in that state or not. + */ + States state() const; + + /** Returns the state flags which are valid in this entry. See state() */ + States stateMask() const; + + /** See state() */ + void setState( States state ); + /** See stateMask() */ + void setStateMask( States mask ); + + /** + * Returns the key code and modifiers associated with this entry + * as a QKeySequence + */ + //QKeySequence keySequence() const; + + /** + * Returns this entry's conditions ( ie. its key code, modifier and state criteria ) + * as a string. + */ + QString conditionToString() const; + + /** + * Returns this entry's result ( ie. its command or character sequence ) + * as a string. + * + * @param expandWildCards See text() + * @param modifiers See text() + */ + QString resultToString(bool expandWildCards = false, + Qt::KeyboardModifiers modifiers = Qt::NoModifier) const; + + /** + * Returns true if this entry matches the given key sequence, specified + * as a combination of @p keyCode , @p modifiers and @p state. + */ + bool matches( int keyCode , + Qt::KeyboardModifiers modifiers , + States flags ) const; + + bool operator==(const Entry& rhs) const; + + private: + void insertModifier( QString& item , int modifier ) const; + void insertState( QString& item , int state ) const; + QByteArray unescape(const QByteArray& text) const; + + int _keyCode; + Qt::KeyboardModifiers _modifiers; + Qt::KeyboardModifiers _modifierMask; + States _state; + States _stateMask; + + Command _command; + QByteArray _text; + }; + + /** Constructs a new keyboard translator with the given @p name */ + KeyboardTranslator(const QString& name); + + //KeyboardTranslator(const KeyboardTranslator& other); + + /** Returns the name of this keyboard translator */ + QString name() const; + + /** Sets the name of this keyboard translator */ + void setName(const QString& name); + + /** Returns the descriptive name of this keyboard translator */ + QString description() const; + + /** Sets the descriptive name of this keyboard translator */ + void setDescription(const QString& description); + + /** + * Looks for an entry in this keyboard translator which matches the given + * key code, keyboard modifiers and state flags. + * + * Returns the matching entry if found or a null Entry otherwise ( ie. + * entry.isNull() will return true ) + * + * @param keyCode A key code from the Qt::Key enum + * @param modifiers A combination of modifiers + * @param state Optional flags which specify the current state of the terminal + */ + Entry findEntry(int keyCode , + Qt::KeyboardModifiers modifiers , + States state = NoState) const; + + /** + * Adds an entry to this keyboard translator's table. Entries can be looked up according + * to their key sequence using findEntry() + */ + void addEntry(const Entry& entry); + + /** + * Replaces an entry in the translator. If the @p existing entry is null, + * then this is equivalent to calling addEntry(@p replacement) + */ + void replaceEntry(const Entry& existing , const Entry& replacement); + + /** + * Removes an entry from the table. + */ + void removeEntry(const Entry& entry); + + /** Returns a list of all entries in the translator. */ + QList entries() const; + +private: + + QMultiHash _entries; // entries in this keyboard translation, + // entries are indexed according to + // their keycode + QString _name; + QString _description; +}; +Q_DECLARE_OPERATORS_FOR_FLAGS(KeyboardTranslator::States) +Q_DECLARE_OPERATORS_FOR_FLAGS(KeyboardTranslator::Commands) + +/** + * Parses the contents of a Keyboard Translator (.keytab) file and + * returns the entries found in it. + * + * Usage example: + * + * @code + * QFile source( "/path/to/keytab" ); + * source.open( QIODevice::ReadOnly ); + * + * KeyboardTranslator* translator = new KeyboardTranslator( "name-of-translator" ); + * + * KeyboardTranslatorReader reader(source); + * while ( reader.hasNextEntry() ) + * translator->addEntry(reader.nextEntry()); + * + * source.close(); + * + * if ( !reader.parseError() ) + * { + * // parsing succeeded, do something with the translator + * } + * else + * { + * // parsing failed + * } + * @endcode + */ +class KeyboardTranslatorReader +{ +public: + /** Constructs a new reader which parses the given @p source */ + KeyboardTranslatorReader( QIODevice* source ); + + /** + * Returns the description text. + * TODO: More documentation + */ + QString description() const; + + /** Returns true if there is another entry in the source stream */ + bool hasNextEntry(); + /** Returns the next entry found in the source stream */ + KeyboardTranslator::Entry nextEntry(); + + /** + * Returns true if an error occurred whilst parsing the input or + * false if no error occurred. + */ + bool parseError(); + + /** + * Parses a condition and result string for a translator entry + * and produces a keyboard translator entry. + * + * The condition and result strings are in the same format as in + */ + static KeyboardTranslator::Entry createEntry( const QString& condition , + const QString& result ); +private: + struct Token + { + enum Type + { + TitleKeyword, + TitleText, + KeyKeyword, + KeySequence, + Command, + OutputText + }; + Type type; + QString text; + }; + QList tokenize(const QString&); + void readNext(); + bool decodeSequence(const QString& , + int& keyCode, + Qt::KeyboardModifiers& modifiers, + Qt::KeyboardModifiers& modifierMask, + KeyboardTranslator::States& state, + KeyboardTranslator::States& stateFlags); + + static bool parseAsModifier(const QString& item , Qt::KeyboardModifier& modifier); + static bool parseAsStateFlag(const QString& item , KeyboardTranslator::State& state); + static bool parseAsKeyCode(const QString& item , int& keyCode); + static bool parseAsCommand(const QString& text , KeyboardTranslator::Command& command); + + QIODevice* _source; + QString _description; + KeyboardTranslator::Entry _nextEntry; + bool _hasNext; +}; + +/** Writes a keyboard translation to disk. */ +class KeyboardTranslatorWriter +{ +public: + /** + * Constructs a new writer which saves data into @p destination. + * The caller is responsible for closing the device when writing is complete. + */ + KeyboardTranslatorWriter(QIODevice* destination); + ~KeyboardTranslatorWriter(); + + /** + * Writes the header for the keyboard translator. + * @param description Description of the keyboard translator. + */ + void writeHeader( const QString& description ); + /** Writes a translator entry. */ + void writeEntry( const KeyboardTranslator::Entry& entry ); + +private: + QIODevice* _destination; + QTextStream* _writer; +}; + +/** + * Manages the keyboard translations available for use by terminal sessions, + * see KeyboardTranslator. + */ +class KONSOLEPRIVATE_EXPORT KeyboardTranslatorManager +{ +public: + /** + * Constructs a new KeyboardTranslatorManager and loads the list of + * available keyboard translations. + * + * The keyboard translations themselves are not loaded until they are + * first requested via a call to findTranslator() + */ + KeyboardTranslatorManager(); + ~KeyboardTranslatorManager(); + + /** + * Adds a new translator. If a translator with the same name + * already exists, it will be replaced by the new translator. + * + * TODO: More documentation. + */ + void addTranslator(KeyboardTranslator* translator); + + /** + * Deletes a translator. Returns true on successful deletion or false otherwise. + * + * TODO: More documentation + */ + bool deleteTranslator(const QString& name); + + /** Returns the default translator for Konsole. */ + const KeyboardTranslator* defaultTranslator(); + + /** + * Returns the keyboard translator with the given name or 0 if no translator + * with that name exists. + * + * The first time that a translator with a particular name is requested, + * the on-disk .keyboard file is loaded and parsed. + */ + const KeyboardTranslator* findTranslator(const QString& name); + /** + * Returns a list of the names of available keyboard translators. + * + * The first time this is called, a search for available + * translators is started. + */ + QList allTranslators(); + + /** Returns the global KeyboardTranslatorManager instance. */ + static KeyboardTranslatorManager* instance(); + +private: + static const QByteArray defaultTranslatorText; + + void findTranslators(); // locate the available translators + KeyboardTranslator* loadTranslator(const QString& name); // loads the translator + // with the given name + KeyboardTranslator* loadTranslator(QIODevice* device,const QString& name); + + bool saveTranslator(const KeyboardTranslator* translator); + QString findTranslatorPath(const QString& name); + + QHash _translators; // maps translator-name -> KeyboardTranslator + // instance + bool _haveLoadedAll; + + static KeyboardTranslatorManager * theKeyboardTranslatorManager; +}; + +inline int KeyboardTranslator::Entry::keyCode() const { return _keyCode; } +inline void KeyboardTranslator::Entry::setKeyCode(int keyCode) { _keyCode = keyCode; } + +inline void KeyboardTranslator::Entry::setModifiers( Qt::KeyboardModifiers modifier ) +{ + _modifiers = modifier; +} +inline Qt::KeyboardModifiers KeyboardTranslator::Entry::modifiers() const { return _modifiers; } + +inline void KeyboardTranslator::Entry::setModifierMask( Qt::KeyboardModifiers mask ) +{ + _modifierMask = mask; +} +inline Qt::KeyboardModifiers KeyboardTranslator::Entry::modifierMask() const { return _modifierMask; } + +inline bool KeyboardTranslator::Entry::isNull() const +{ + return ( *this == Entry() ); +} + +inline void KeyboardTranslator::Entry::setCommand( Command command ) +{ + _command = command; +} +inline KeyboardTranslator::Command KeyboardTranslator::Entry::command() const { return _command; } + +inline void KeyboardTranslator::Entry::setText( const QByteArray& text ) +{ + _text = unescape(text); +} +inline int oneOrZero(int value) +{ + return value ? 1 : 0; +} +inline QByteArray KeyboardTranslator::Entry::text(bool expandWildCards,Qt::KeyboardModifiers modifiers) const +{ + QByteArray expandedText = _text; + + if (expandWildCards) + { + int modifierValue = 1; + modifierValue += oneOrZero(modifiers & Qt::ShiftModifier); + modifierValue += oneOrZero(modifiers & Qt::AltModifier) << 1; + modifierValue += oneOrZero(modifiers & Qt::ControlModifier) << 2; + + for (int i=0;i<_text.length();i++) + { + if (expandedText[i] == '*') + expandedText[i] = '0' + modifierValue; + } + } + + return expandedText; +} + +inline void KeyboardTranslator::Entry::setState( States state ) +{ + _state = state; +} +inline KeyboardTranslator::States KeyboardTranslator::Entry::state() const { return _state; } + +inline void KeyboardTranslator::Entry::setStateMask( States stateMask ) +{ + _stateMask = stateMask; +} +inline KeyboardTranslator::States KeyboardTranslator::Entry::stateMask() const { return _stateMask; } + + +Q_DECLARE_METATYPE(KeyboardTranslator::Entry) +Q_DECLARE_METATYPE(const KeyboardTranslator*) + +#endif // KEYBOARDTRANSLATOR_H + diff --git a/konsole-qml-plugin/src/LineFont.h b/konsole-qml-plugin/src/LineFont.h new file mode 100644 index 0000000..9c080ea --- /dev/null +++ b/konsole-qml-plugin/src/LineFont.h @@ -0,0 +1,21 @@ +// WARNING: Autogenerated by "fontembedder ./linefont.src". +// You probably do not want to hand-edit this! + +static const quint32 LineChars[] = { + 0x00007c00, 0x000fffe0, 0x00421084, 0x00e739ce, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00427000, 0x004e7380, 0x00e77800, 0x00ef7bc0, + 0x00421c00, 0x00439ce0, 0x00e73c00, 0x00e7bde0, 0x00007084, 0x000e7384, 0x000079ce, 0x000f7bce, + 0x00001c84, 0x00039ce4, 0x00003dce, 0x0007bdee, 0x00427084, 0x004e7384, 0x004279ce, 0x00e77884, + 0x00e779ce, 0x004f7bce, 0x00ef7bc4, 0x00ef7bce, 0x00421c84, 0x00439ce4, 0x00423dce, 0x00e73c84, + 0x00e73dce, 0x0047bdee, 0x00e7bde4, 0x00e7bdee, 0x00427c00, 0x0043fce0, 0x004e7f80, 0x004fffe0, + 0x004fffe0, 0x00e7fde0, 0x006f7fc0, 0x00efffe0, 0x00007c84, 0x0003fce4, 0x000e7f84, 0x000fffe4, + 0x00007dce, 0x0007fdee, 0x000f7fce, 0x000fffee, 0x00427c84, 0x0043fce4, 0x004e7f84, 0x004fffe4, + 0x00427dce, 0x00e77c84, 0x00e77dce, 0x0047fdee, 0x004e7fce, 0x00e7fde4, 0x00ef7f84, 0x004fffee, + 0x00efffe4, 0x00e7fdee, 0x00ef7fce, 0x00efffee, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x000f83e0, 0x00a5294a, 0x004e1380, 0x00a57800, 0x00ad0bc0, 0x004390e0, 0x00a53c00, 0x00a5a1e0, + 0x000e1384, 0x0000794a, 0x000f0b4a, 0x000390e4, 0x00003d4a, 0x0007a16a, 0x004e1384, 0x00a5694a, + 0x00ad2b4a, 0x004390e4, 0x00a52d4a, 0x00a5a16a, 0x004f83e0, 0x00a57c00, 0x00ad83e0, 0x000f83e4, + 0x00007d4a, 0x000f836a, 0x004f93e4, 0x00a57d4a, 0x00ad836a, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00001c00, 0x00001084, 0x00007000, 0x00421000, + 0x00039ce0, 0x000039ce, 0x000e7380, 0x00e73800, 0x000e7f80, 0x00e73884, 0x0003fce0, 0x004239ce +}; diff --git a/konsole-qml-plugin/src/LineFont.src b/konsole-qml-plugin/src/LineFont.src new file mode 100644 index 0000000..6835253 --- /dev/null +++ b/konsole-qml-plugin/src/LineFont.src @@ -0,0 +1,786 @@ +#2500: single horizontal line +2500 + + +----- + + + +#2501: triple horizontal line +2501 + +----- +----- +----- + + +#2502: single vertical line +2502 + | + | + | + | + | + +#2503: triple vertical line +2503 + ||| + ||| + ||| + ||| + ||| + +#2504-250B are dashed - not handled + +#250C: top-left corner (lines on bottom + right) +250C + + + .-- + | + | + +#250D: as above, but top line triple-width +250D + + .-- + .-- + |-- + | + +#250E: now the vert line triple-width +250E + + + ..-- + ||| + ||| + +#250F: and now both lines triple-width +250F + + .___ + |.-- + ||._ + ||| + +#2510: top-right corner +2510 + + +--. + | + | + +2511 + +==. +==. +==| + | + +2512 + + +==.. + ||| + ||| + +2513 + +===. +==.| +=.|| + ||| + +#2514: bottom-left corner +2514 + | + | + .== + + + +2515 + | + |== + |== + === + + + +2516 + ||| + ||| + |.== + + + +2517 + ||| + ||.= + |.== + .=== + + +#2518: bottm-right corner +2518 + | + | +==. + + + +2519 + | +==| +==| +=== + + + +251A + ||| + ||| +==== + + + +251B + ||| +=.|| +==.| +===. + + +#251C: Join of vertical line and one from the right +251C + | + | + |== + | + | + +251D + | + |== + |== + |== + | + +251E + ||| + ||| + ||== + | + | + +251F + | + | + ||== + ||| + ||| + + +2520 + ||| + ||| + ||== + ||| + ||| + +2521 + ||| + |||= + ||== + .|== + | + +2522 + | + .|== + ||== + |||= + ||| + +2523 + ||| + ||.= + ||== + ||.= + ||| + +#2524: Join of vertical line and one from the left +2524 + | + | +==| + | + | + +2525 + | +==| +==| +==| + | + +2526 + ||| + ||| +==+| + | + | + +2527 + | + | +==+| + ||| + ||| + +2528 + ||| + ||| +==+| + ||| + ||| + +2529 + ||| +=+|| +==+| +===+ + | + +252A + | +=+|| +==+| +===+ + ||| + +252B + ||| +=+|| +==+| +=+|| + ||| + +#252C: horizontal line joined to from below +252C + + +===== + | + | + +252D + +=== +==|== +==| + | + +252E + + === +==|== + |== + | + +252F + +==+== +==|== +==|== + | + +2530 + +===== +===== +==|== + | + +2531 + +===| +==||= +=||| + ||| + +2532 + + |=== +=||== + ||== + || + +2533 + +===== +==|== +=+|+= + ||| + +#2534: bottom line, connected to from top +2534 + | + | +===== + + + +2535 + | +==| +===== +=== + + +2536 + | + |== +===== + === + + +2537 + | +==|== +===== +===== + + +2538 + ||| + ||| +===== + + + +2539 + ||| +==|| +===== +===| + + + +253A + ||| + ||== +=|=== + |=== + + +253B + ||| +==|== +===== +===== + + +#253C: vertical + horizontal lines intersecting +253C + | + | +===== + | + | + +253D + | +==| +===== +==| + | + +253E + | + |== +===== + |== + | + +253F + | +==|== +===== +==|== + | + +2540 + ||| + ||| +===== + | + | + +2541 + | + | +===== + ||| + ||| + +2542 + ||| + ||| +===== + ||| + ||| + +2543 + ||| +=||| +===== +==|+ + | + +2544 + ||| + ||== +===== + |== + | + +2545 + | +==|+ +===== +=||| + ||| + +2546 + | + |== +===== + ||== + ||| + +2547 + ||| +=|||= +===== +=|||= + | + +2548 + | +=|||= +===== +=|||= + ||| + +2549 + ||| +=||| +===== +=||| + ||| + +254A + ||| + |||= +===== + |||= + ||| + +254B + ||| +=|||= +===== +=|||= + ||| + +#254C-254F are dashed +2550 + +_____ + +_____ + + +2551 + | | + | | + | | + | | + | | + +2552 + + |-- + | + |-- + | + +2553 + + + ---- + | | + | | + +2554 + + +--- + | + + +- + | | + +2555 + +--+ + | +--+ + | + +2556 + + +-+-+ + | | + | | + +2557 + +---+ + | +-+ | + | | + +2558 + | + +-- + | + +-- + +2559 + | | + | | + +-+- + + + +255A + | | + | +- + | + +--- + + +255B + | +--+ + | +--+ + + +255C + | | + | | +-+-+ + + +255D + | | +-+ | + | +---+ + + +255E + | + +-- + | + +-- + | + +255F + | | + | | + | +- + | | + | | + +2560 + | | + | +- + | | + | +- + | | + +2561 + | +--+ + | +--+ + | + +2562 + | | + | | +-+ + + | | + | | + +2563 + | | +-+ | + | +-+ | + | | + +2564 + +----- + +--+-- + | + +2565 + + +-+-+- + | | + | | + +2566 + +----- + +-+ +- + | | + +2567 + | +--+-- + +----- + + +2568 + | | + | | +-+-+- + + + +2569 + | | +-+ +- + +----- + + +256A + | +--+-- + | +--+-- + | + +256B + | | + | | +-+-+- + | | + | | + +256C + | | +-+ +- + +-+ +- + | | + +#256F-2570 are curly, +#2571-2573 are slashes and X + +2574 + + +___ + + + +2575 + | + | + | + + + +2576 + + + ___ + + + +2577 + + + | + | + | + +2578 + +___ +___ +___ + + +2579 + ||| + ||| + ||| + + + +257A + + ___ + ___ + ___ + + +257B + + + ||| + ||| + ||| + +257C + + ___ +_____ + ___ + + +257D + | + | + ||| + ||| + ||| + +257E + +___ +_____ +___ + + +257F + ||| + ||| + ||| + | + | diff --git a/konsole-qml-plugin/src/Pty.cpp b/konsole-qml-plugin/src/Pty.cpp new file mode 100644 index 0000000..d36585b --- /dev/null +++ b/konsole-qml-plugin/src/Pty.cpp @@ -0,0 +1,310 @@ +/* + * This file is a part of QTerminal - http://gitorious.org/qterminal + * + * This file was un-linked from KDE and modified + * by Maxim Bourmistrov + * + */ + +/* + This file is part of Konsole, an X terminal. + Copyright 1997,1998 by Lars Doelle + + 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. +*/ + +// Own +#include "Pty.h" + +// System +#include +#include +#include +#include +#include +#include + +// Qt +#include + +#include "kpty.h" +#include "kptydevice.h" + + +void Pty::setWindowSize(int lines, int cols) +{ + _windowColumns = cols; + _windowLines = lines; + + if (pty()->masterFd() >= 0) + pty()->setWinSize(lines, cols); +} +QSize Pty::windowSize() const +{ + return QSize(_windowColumns,_windowLines); +} + +void Pty::setFlowControlEnabled(bool enable) +{ + _xonXoff = enable; + + if (pty()->masterFd() >= 0) + { + struct ::termios ttmode; + pty()->tcGetAttr(&ttmode); + if (!enable) + ttmode.c_iflag &= ~(IXOFF | IXON); + else + ttmode.c_iflag |= (IXOFF | IXON); + if (!pty()->tcSetAttr(&ttmode)) + qWarning() << "Unable to set terminal attributes."; + } +} +bool Pty::flowControlEnabled() const +{ + if (pty()->masterFd() >= 0) + { + struct ::termios ttmode; + pty()->tcGetAttr(&ttmode); + return ttmode.c_iflag & IXOFF && + ttmode.c_iflag & IXON; + } + qWarning() << "Unable to get flow control status, terminal not connected."; + return false; +} + +void Pty::setUtf8Mode(bool enable) +{ +#ifdef IUTF8 // XXX not a reasonable place to check it. + _utf8 = enable; + + if (pty()->masterFd() >= 0) + { + struct ::termios ttmode; + pty()->tcGetAttr(&ttmode); + if (!enable) + ttmode.c_iflag &= ~IUTF8; + else + ttmode.c_iflag |= IUTF8; + if (!pty()->tcSetAttr(&ttmode)) + qWarning() << "Unable to set terminal attributes."; + } +#endif +} + +void Pty::setErase(char erase) +{ + _eraseChar = erase; + + if (pty()->masterFd() >= 0) + { + struct ::termios ttmode; + pty()->tcGetAttr(&ttmode); + ttmode.c_cc[VERASE] = erase; + if (!pty()->tcSetAttr(&ttmode)) + qWarning() << "Unable to set terminal attributes."; + } +} + +char Pty::erase() const +{ + if (pty()->masterFd() >= 0) + { + struct ::termios ttyAttributes; + pty()->tcGetAttr(&ttyAttributes); + return ttyAttributes.c_cc[VERASE]; + } + + return _eraseChar; +} + +void Pty::addEnvironmentVariables(const QStringList& environment) +{ + QListIterator iter(environment); + while (iter.hasNext()) + { + QString pair = iter.next(); + + // split on the first '=' character + int pos = pair.indexOf('='); + + if ( pos >= 0 ) + { + QString variable = pair.left(pos); + QString value = pair.mid(pos+1); + + setEnv(variable,value); + } + } +} + +int Pty::start(const QString& program, + const QStringList& programArguments, + const QStringList& environment, + ulong winid, + bool addToUtmp + //const QString& dbusService, + //const QString& dbusSession + ) +{ + clearProgram(); + + // For historical reasons, the first argument in programArguments is the + // name of the program to execute, so create a list consisting of all + // but the first argument to pass to setProgram() + Q_ASSERT(programArguments.count() >= 1); + setProgram(program.toLatin1(),programArguments.mid(1)); + + addEnvironmentVariables(environment); + + setEnv("WINDOWID", QString::number(winid)); + + // unless the LANGUAGE environment variable has been set explicitly + // set it to a null string + // this fixes the problem where KCatalog sets the LANGUAGE environment + // variable during the application's startup to something which + // differs from LANG,LC_* etc. and causes programs run from + // the terminal to display messages in the wrong language + // + // this can happen if LANG contains a language which KDE + // does not have a translation for + // + // BR:149300 + setEnv("LANGUAGE",QString(),false /* do not overwrite existing value if any */); + + setUseUtmp(addToUtmp); + + struct ::termios ttmode; + pty()->tcGetAttr(&ttmode); + if (!_xonXoff) + ttmode.c_iflag &= ~(IXOFF | IXON); + else + ttmode.c_iflag |= (IXOFF | IXON); +#ifdef IUTF8 // XXX not a reasonable place to check it. + if (!_utf8) + ttmode.c_iflag &= ~IUTF8; + else + ttmode.c_iflag |= IUTF8; +#endif + + if (_eraseChar != 0) + ttmode.c_cc[VERASE] = _eraseChar; + + if (!pty()->tcSetAttr(&ttmode)) + qWarning() << "Unable to set terminal attributes."; + + pty()->setWinSize(_windowLines, _windowColumns); + + KProcess::start(); + + if (!waitForStarted()) + return -1; + + return 0; +} + +void Pty::setWriteable(bool writeable) +{ + struct stat sbuf; + stat(pty()->ttyName(), &sbuf); + if (writeable) + chmod(pty()->ttyName(), sbuf.st_mode | S_IWGRP); + else + chmod(pty()->ttyName(), sbuf.st_mode & ~(S_IWGRP|S_IWOTH)); +} + +Pty::Pty(int masterFd, QObject* parent) + : KPtyProcess(masterFd,parent) +{ + init(); +} +Pty::Pty(QObject* parent) + : KPtyProcess(parent) +{ + init(); +} +void Pty::init() +{ + _windowColumns = 0; + _windowLines = 0; + _eraseChar = 0; + _xonXoff = true; + _utf8 =true; + + connect(pty(), SIGNAL(readyRead()) , this , SLOT(dataReceived())); + setPtyChannels(KPtyProcess::AllChannels); +} + +Pty::~Pty() +{ +} + +void Pty::sendData(const char* data, int length) +{ + if (!length) + return; + + if (!pty()->write(data,length)) + { + qWarning() << "Pty::doSendJobs - Could not send input data to terminal process."; + return; + } +} + +void Pty::dataReceived() +{ + QByteArray data = pty()->readAll(); + emit receivedData(data.constData(),data.count()); +} + +void Pty::lockPty(bool lock) +{ + Q_UNUSED(lock); + +// TODO: Support for locking the Pty + //if (lock) + //suspend(); + //else + //resume(); +} + +int Pty::foregroundProcessGroup() const +{ + int pid = tcgetpgrp(pty()->masterFd()); + + if ( pid != -1 ) + { + return pid; + } + + return 0; +} + +void Pty::setupChildProcess() +{ + KPtyProcess::setupChildProcess(); + + // reset all signal handlers + // this ensures that terminal applications respond to + // signals generated via key sequences such as Ctrl+C + // (which sends SIGINT) + struct sigaction action; + sigemptyset(&action.sa_mask); + action.sa_handler = SIG_DFL; + action.sa_flags = 0; + for (int signal=1;signal < NSIG; signal++) + sigaction(signal,&action,0L); +} diff --git a/konsole-qml-plugin/src/Pty.h b/konsole-qml-plugin/src/Pty.h new file mode 100644 index 0000000..fbcf4e8 --- /dev/null +++ b/konsole-qml-plugin/src/Pty.h @@ -0,0 +1,206 @@ +/* + * This file is a part of QTerminal - http://gitorious.org/qterminal + * + * This file was un-linked from KDE and modified + * by Maxim Bourmistrov + * + */ + +/* + This file is part of Konsole, KDE's terminal emulator. + + Copyright 2007-2008 by Robert Knight + Copyright 1997,1998 by Lars Doelle + + 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. +*/ + +#ifndef PTY_H +#define PTY_H + +// Qt +#include +#include +#include +#include + +// KDE +#include "kptyprocess.h" + + +/** + * The Pty class is used to start the terminal process, + * send data to it, receive data from it and manipulate + * various properties of the pseudo-teletype interface + * used to communicate with the process. + * + * To use this class, construct an instance and connect + * to the sendData slot and receivedData signal to + * send data to or receive data from the process. + * + * To start the terminal process, call the start() method + * with the program name and appropriate arguments. + */ +class Pty: public KPtyProcess +{ +Q_OBJECT + + public: + + /** + * Constructs a new Pty. + * + * Connect to the sendData() slot and receivedData() signal to prepare + * for sending and receiving data from the terminal process. + * + * To start the terminal process, call the run() method with the + * name of the program to start and appropriate arguments. + */ + explicit Pty(QObject* parent = 0); + + /** + * Construct a process using an open pty master. + * See KPtyProcess::KPtyProcess() + */ + explicit Pty(int ptyMasterFd, QObject* parent = 0); + + ~Pty(); + + /** + * Starts the terminal process. + * + * Returns 0 if the process was started successfully or non-zero + * otherwise. + * + * @param program Path to the program to start + * @param arguments Arguments to pass to the program being started + * @param environment A list of key=value pairs which will be added + * to the environment for the new process. At the very least this + * should include an assignment for the TERM environment variable. + * @param winid Specifies the value of the WINDOWID environment variable + * in the process's environment. + * @param addToUtmp Specifies whether a utmp entry should be created for + * the pty used. See K3Process::setUsePty() + * @param dbusService Specifies the value of the KONSOLE_DBUS_SERVICE + * environment variable in the process's environment. + * @param dbusSession Specifies the value of the KONSOLE_DBUS_SESSION + * environment variable in the process's environment. + */ + int start( const QString& program, + const QStringList& arguments, + const QStringList& environment, + ulong winid, + bool addToUtmp + ); + + /** TODO: Document me */ + void setWriteable(bool writeable); + + /** + * Enables or disables Xon/Xoff flow control. The flow control setting + * may be changed later by a terminal application, so flowControlEnabled() + * may not equal the value of @p on in the previous call to setFlowControlEnabled() + */ + void setFlowControlEnabled(bool on); + + /** Queries the terminal state and returns true if Xon/Xoff flow control is enabled. */ + bool flowControlEnabled() const; + + /** + * Sets the size of the window (in lines and columns of characters) + * used by this teletype. + */ + void setWindowSize(int lines, int cols); + + /** Returns the size of the window used by this teletype. See setWindowSize() */ + QSize windowSize() const; + + /** TODO Document me */ + void setErase(char erase); + + /** */ + char erase() const; + + /** + * Returns the process id of the teletype's current foreground + * process. This is the process which is currently reading + * input sent to the terminal via. sendData() + * + * If there is a problem reading the foreground process group, + * 0 will be returned. + */ + int foregroundProcessGroup() const; + + public slots: + + /** + * Put the pty into UTF-8 mode on systems which support it. + */ + void setUtf8Mode(bool on); + + /** + * Suspend or resume processing of data from the standard + * output of the terminal process. + * + * See K3Process::suspend() and K3Process::resume() + * + * @param lock If true, processing of output is suspended, + * otherwise processing is resumed. + */ + void lockPty(bool lock); + + /** + * Sends data to the process currently controlling the + * teletype ( whose id is returned by foregroundProcessGroup() ) + * + * @param buffer Pointer to the data to send. + * @param length Length of @p buffer. + */ + void sendData(const char* buffer, int length); + + signals: + + /** + * Emitted when a new block of data is received from + * the teletype. + * + * @param buffer Pointer to the data received. + * @param length Length of @p buffer + */ + void receivedData(const char* buffer, int length); + + protected: + void setupChildProcess(); + + private slots: + // called when data is received from the terminal process + void dataReceived(); + + private: + void init(); + + // takes a list of key=value pairs and adds them + // to the environment for the process + void addEnvironmentVariables(const QStringList& environment); + + int _windowColumns; + int _windowLines; + char _eraseChar; + bool _xonXoff; + bool _utf8; +}; + +#endif // PTY_H diff --git a/konsole-qml-plugin/src/Screen.cpp b/konsole-qml-plugin/src/Screen.cpp new file mode 100644 index 0000000..45ddd80 --- /dev/null +++ b/konsole-qml-plugin/src/Screen.cpp @@ -0,0 +1,1360 @@ +/* + This file is part of Konsole, an X terminal. + + Copyright 2007-2008 by Robert Knight + Copyright 1997,1998 by Lars Doelle + + 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. + */ + +// Own +#include "Screen.h" + +// Standard +#include +#include +#include +#include +#include +#include + +// Qt +#include +#include + +// KDE +//#include + +// Konsole +#include "konsole_wcwidth.h" +#include "TerminalCharacterDecoder.h" + + + +//FIXME: this is emulation specific. Use false for xterm, true for ANSI. +//FIXME: see if we can get this from terminfo. +#define BS_CLEARS false + +//Macro to convert x,y position on screen to position within an image. +// +//Originally the image was stored as one large contiguous block of +//memory, so a position within the image could be represented as an +//offset from the beginning of the block. For efficiency reasons this +//is no longer the case. +//Many internal parts of this class still use this representation for parameters and so on, +//notably moveImage() and clearImage(). +//This macro converts from an X,Y position into an image offset. +#ifndef loc +#define loc(X,Y) ((Y)*columns+(X)) +#endif + + +Character Screen::defaultChar = Character(' ', + CharacterColor(COLOR_SPACE_DEFAULT,DEFAULT_FORE_COLOR), + CharacterColor(COLOR_SPACE_DEFAULT,DEFAULT_BACK_COLOR), + DEFAULT_RENDITION); + +//#define REVERSE_WRAPPED_LINES // for wrapped line debug + +Screen::Screen(int l, int c) + : lines(l), + columns(c), + screenLines(new ImageLine[lines+1] ), + _scrolledLines(0), + _droppedLines(0), + history(new HistoryScrollNone()), + cuX(0), cuY(0), + currentRendition(0), + _topMargin(0), _bottomMargin(0), + selBegin(0), selTopLeft(0), selBottomRight(0), + blockSelectionMode(false), + effectiveForeground(CharacterColor()), effectiveBackground(CharacterColor()), effectiveRendition(0), + lastPos(-1) +{ + lineProperties.resize(lines+1); + for (int i=0;i _bottomMargin ? lines-1 : _bottomMargin; + cuX = qMin(columns-1,cuX); // nowrap! + cuY = qMin(stop,cuY+n); +} + +void Screen::cursorLeft(int n) + //=CUB +{ + if (n == 0) n = 1; // Default + cuX = qMin(columns-1,cuX); // nowrap! + cuX = qMax(0,cuX-n); +} + +void Screen::cursorRight(int n) + //=CUF +{ + if (n == 0) n = 1; // Default + cuX = qMin(columns-1,cuX+n); +} + +void Screen::setMargins(int top, int bot) + //=STBM +{ + if (top == 0) top = 1; // Default + if (bot == 0) bot = lines; // Default + top = top - 1; // Adjust to internal lineno + bot = bot - 1; // Adjust to internal lineno + if ( !( 0 <= top && top < bot && bot < lines ) ) + { //Debug()<<" setRegion("< 0) + cuY -= 1; +} + +void Screen::nextLine() + //=NEL +{ + toStartOfLine(); index(); +} + +void Screen::eraseChars(int n) +{ + if (n == 0) n = 1; // Default + int p = qMax(0,qMin(cuX+n-1,columns-1)); + clearImage(loc(cuX,cuY),loc(p,cuY),' '); +} + +void Screen::deleteChars(int n) +{ + Q_ASSERT( n >= 0 ); + + // always delete at least one char + if (n == 0) + n = 1; + + // if cursor is beyond the end of the line there is nothing to do + if ( cuX >= screenLines[cuY].count() ) + return; + + if ( cuX+n > screenLines[cuY].count() ) + n = screenLines[cuY].count() - cuX; + + Q_ASSERT( n >= 0 ); + Q_ASSERT( cuX+n <= screenLines[cuY].count() ); + + screenLines[cuY].remove(cuX,n); +} + +void Screen::insertChars(int n) +{ + if (n == 0) n = 1; // Default + + if ( screenLines[cuY].size() < cuX ) + screenLines[cuY].resize(cuX); + + screenLines[cuY].insert(cuX,n,' '); + + if ( screenLines[cuY].count() > columns ) + screenLines[cuY].resize(columns); +} + +void Screen::deleteLines(int n) +{ + if (n == 0) n = 1; // Default + scrollUp(cuY,n); +} + +void Screen::insertLines(int n) +{ + if (n == 0) n = 1; // Default + scrollDown(cuY,n); +} + +void Screen::setMode(int m) +{ + currentModes[m] = true; + switch(m) + { + case MODE_Origin : cuX = 0; cuY = _topMargin; break; //FIXME: home + } +} + +void Screen::resetMode(int m) +{ + currentModes[m] = false; + switch(m) + { + case MODE_Origin : cuX = 0; cuY = 0; break; //FIXME: home + } +} + +void Screen::saveMode(int m) +{ + savedModes[m] = currentModes[m]; +} + +void Screen::restoreMode(int m) +{ + currentModes[m] = savedModes[m]; +} + +bool Screen::getMode(int m) const +{ + return currentModes[m]; +} + +void Screen::saveCursor() +{ + savedState.cursorColumn = cuX; + savedState.cursorLine = cuY; + savedState.rendition = currentRendition; + savedState.foreground = currentForeground; + savedState.background = currentBackground; +} + +void Screen::restoreCursor() +{ + cuX = qMin(savedState.cursorColumn,columns-1); + cuY = qMin(savedState.cursorLine,lines-1); + currentRendition = savedState.rendition; + currentForeground = savedState.foreground; + currentBackground = savedState.background; + updateEffectiveRendition(); +} + +void Screen::resizeImage(int new_lines, int new_columns) +{ + if ((new_lines==lines) && (new_columns==columns)) return; + + if (cuY > new_lines-1) + { // attempt to preserve focus and lines + _bottomMargin = lines-1; //FIXME: margin lost + for (int i = 0; i < cuY-(new_lines-1); i++) + { + addHistLine(); scrollUp(0,1); + } + } + + // create new screen lines and copy from old to new + + ImageLine* newScreenLines = new ImageLine[new_lines+1]; + for (int i=0; i < qMin(lines-1,new_lines+1) ;i++) + newScreenLines[i]=screenLines[i]; + for (int i=lines;(i > 0) && (i 0) && (ir &= ~RE_TRANSPARENT; +} + +void Screen::updateEffectiveRendition() +{ + effectiveRendition = currentRendition; + if (currentRendition & RE_REVERSE) + { + effectiveForeground = currentBackground; + effectiveBackground = currentForeground; + } + else + { + effectiveForeground = currentForeground; + effectiveBackground = currentBackground; + } + + if (currentRendition & RE_BOLD) + effectiveForeground.toggleIntensive(); +} + +void Screen::copyFromHistory(Character* dest, int startLine, int count) const +{ + Q_ASSERT( startLine >= 0 && count > 0 && startLine + count <= history->getLines() ); + + for (int line = startLine; line < startLine + count; line++) + { + const int length = qMin(columns,history->getLineLen(line)); + const int destLineOffset = (line-startLine)*columns; + + history->getCells(line,0,length,dest + destLineOffset); + + for (int column = length; column < columns; column++) + dest[destLineOffset+column] = defaultChar; + + // invert selected text + if (selBegin !=-1) + { + for (int column = 0; column < columns; column++) + { + if (isSelected(column,line)) + { + reverseRendition(dest[destLineOffset + column]); + } + } + } + } +} + +void Screen::copyFromScreen(Character* dest , int startLine , int count) const +{ + Q_ASSERT( startLine >= 0 && count > 0 && startLine + count <= lines ); + + for (int line = startLine; line < (startLine+count) ; line++) + { + int srcLineStartIndex = line*columns; + int destLineStartIndex = (line-startLine)*columns; + + for (int column = 0; column < columns; column++) + { + int srcIndex = srcLineStartIndex + column; + int destIndex = destLineStartIndex + column; + + dest[destIndex] = screenLines[srcIndex/columns].value(srcIndex%columns,defaultChar); + + // invert selected text + if (selBegin != -1 && isSelected(column,line + history->getLines())) + reverseRendition(dest[destIndex]); + } + + } +} + +void Screen::getImage( Character* dest, int size, int startLine, int endLine ) const +{ + Q_ASSERT( startLine >= 0 ); + Q_ASSERT( endLine >= startLine && endLine < history->getLines() + lines ); + + const int mergedLines = endLine - startLine + 1; + + Q_ASSERT( size >= mergedLines * columns ); + Q_UNUSED( size ); + + const int linesInHistoryBuffer = qBound(0,history->getLines()-startLine,mergedLines); + const int linesInScreenBuffer = mergedLines - linesInHistoryBuffer; + + // copy lines from history buffer + if (linesInHistoryBuffer > 0) + copyFromHistory(dest,startLine,linesInHistoryBuffer); + + // copy lines from screen buffer + if (linesInScreenBuffer > 0) + copyFromScreen(dest + linesInHistoryBuffer*columns, + startLine + linesInHistoryBuffer - history->getLines(), + linesInScreenBuffer); + + // invert display when in screen mode + if (getMode(MODE_Screen)) + { + for (int i = 0; i < mergedLines*columns; i++) + reverseRendition(dest[i]); // for reverse display + } + + // mark the character at the current cursor position + int cursorIndex = loc(cuX, cuY + linesInHistoryBuffer); + if(getMode(MODE_Cursor) && cursorIndex < columns*mergedLines) + dest[cursorIndex].rendition |= RE_CURSOR; +} + +QVector Screen::getLineProperties( int startLine , int endLine ) const +{ + Q_ASSERT( startLine >= 0 ); + Q_ASSERT( endLine >= startLine && endLine < history->getLines() + lines ); + + const int mergedLines = endLine-startLine+1; + const int linesInHistory = qBound(0,history->getLines()-startLine,mergedLines); + const int linesInScreen = mergedLines - linesInHistory; + + QVector result(mergedLines); + int index = 0; + + // copy properties for lines in history + for (int line = startLine; line < startLine + linesInHistory; line++) + { + //TODO Support for line properties other than wrapped lines + if (history->isWrappedLine(line)) + { + result[index] = (LineProperty)(result[index] | LINE_WRAPPED); + } + index++; + } + + // copy properties for lines in screen buffer + const int firstScreenLine = startLine + linesInHistory - history->getLines(); + for (int line = firstScreenLine; line < firstScreenLine+linesInScreen; line++) + { + result[index]=lineProperties[line]; + index++; + } + + return result; +} + +void Screen::reset(bool clearScreen) +{ + setMode(MODE_Wrap ); saveMode(MODE_Wrap ); // wrap at end of margin + resetMode(MODE_Origin); saveMode(MODE_Origin); // position refere to [1,1] + resetMode(MODE_Insert); saveMode(MODE_Insert); // overstroke + setMode(MODE_Cursor); // cursor visible + resetMode(MODE_Screen); // screen not inverse + resetMode(MODE_NewLine); + + _topMargin=0; + _bottomMargin=lines-1; + + setDefaultRendition(); + saveCursor(); + + if ( clearScreen ) + clear(); +} + +void Screen::clear() +{ + clearEntireScreen(); + home(); +} + +void Screen::backspace() +{ + cuX = qMin(columns-1,cuX); // nowrap! + cuX = qMax(0,cuX-1); + + if (screenLines[cuY].size() < cuX+1) + screenLines[cuY].resize(cuX+1); + + if (BS_CLEARS) + screenLines[cuY][cuX].character = ' '; +} + +void Screen::tab(int n) +{ + // note that TAB is a format effector (does not write ' '); + if (n == 0) n = 1; + while((n > 0) && (cuX < columns-1)) + { + cursorRight(1); + while((cuX < columns-1) && !tabStops[cuX]) + cursorRight(1); + n--; + } +} + +void Screen::backtab(int n) +{ + // note that TAB is a format effector (does not write ' '); + if (n == 0) n = 1; + while((n > 0) && (cuX > 0)) + { + cursorLeft(1); while((cuX > 0) && !tabStops[cuX]) cursorLeft(1); + n--; + } +} + +void Screen::clearTabStops() +{ + for (int i = 0; i < columns; i++) tabStops[i] = false; +} + +void Screen::changeTabStop(bool set) +{ + if (cuX >= columns) return; + tabStops[cuX] = set; +} + +void Screen::initTabStops() +{ + tabStops.resize(columns); + + // Arrg! The 1st tabstop has to be one longer than the other. + // i.e. the kids start counting from 0 instead of 1. + // Other programs might behave correctly. Be aware. + for (int i = 0; i < columns; i++) + tabStops[i] = (i%8 == 0 && i != 0); +} + +void Screen::newLine() +{ + if (getMode(MODE_NewLine)) + toStartOfLine(); + index(); +} + +void Screen::checkSelection(int from, int to) +{ + if (selBegin == -1) + return; + int scr_TL = loc(0, history->getLines()); + //Clear entire selection if it overlaps region [from, to] + if ( (selBottomRight >= (from+scr_TL)) && (selTopLeft <= (to+scr_TL)) ) + clearSelection(); +} + +void Screen::displayCharacter(unsigned short c) +{ + // Note that VT100 does wrapping BEFORE putting the character. + // This has impact on the assumption of valid cursor positions. + // We indicate the fact that a newline has to be triggered by + // putting the cursor one right to the last column of the screen. + + int w = konsole_wcwidth(c); + if (w <= 0) + return; + + if (cuX+w > columns) { + if (getMode(MODE_Wrap)) { + lineProperties[cuY] = (LineProperty)(lineProperties[cuY] | LINE_WRAPPED); + nextLine(); + } + else + cuX = columns-w; + } + + // ensure current line vector has enough elements + int size = screenLines[cuY].size(); + if (size < cuX+w) + { + screenLines[cuY].resize(cuX+w); + } + + if (getMode(MODE_Insert)) insertChars(w); + + lastPos = loc(cuX,cuY); + + // check if selection is still valid. + checkSelection(lastPos, lastPos); + + Character& currentChar = screenLines[cuY][cuX]; + + currentChar.character = c; + currentChar.foregroundColor = effectiveForeground; + currentChar.backgroundColor = effectiveBackground; + currentChar.rendition = effectiveRendition; + + int i = 0; + int newCursorX = cuX + w--; + while(w) + { + i++; + + if ( screenLines[cuY].size() < cuX + i + 1 ) + screenLines[cuY].resize(cuX+i+1); + + Character& ch = screenLines[cuY][cuX + i]; + ch.character = 0; + ch.foregroundColor = effectiveForeground; + ch.backgroundColor = effectiveBackground; + ch.rendition = effectiveRendition; + + w--; + } + cuX = newCursorX; +} + +void Screen::compose(const QString& /*compose*/) +{ + Q_ASSERT( 0 /*Not implemented yet*/ ); + + /* if (lastPos == -1) + return; + + QChar c(image[lastPos].character); + compose.prepend(c); + //compose.compose(); ### FIXME! + image[lastPos].character = compose[0].unicode();*/ +} + +int Screen::scrolledLines() const +{ + return _scrolledLines; +} +int Screen::droppedLines() const +{ + return _droppedLines; +} +void Screen::resetDroppedLines() +{ + _droppedLines = 0; +} +void Screen::resetScrolledLines() +{ + _scrolledLines = 0; +} + +void Screen::scrollUp(int n) +{ + if (n == 0) n = 1; // Default + if (_topMargin == 0) addHistLine(); // history.history + scrollUp(_topMargin, n); +} + +QRect Screen::lastScrolledRegion() const +{ + return _lastScrolledRegion; +} + +void Screen::scrollUp(int from, int n) +{ + if (n <= 0 || from + n > _bottomMargin) return; + + _scrolledLines -= n; + _lastScrolledRegion = QRect(0,_topMargin,columns-1,(_bottomMargin-_topMargin)); + + //FIXME: make sure `topMargin', `bottomMargin', `from', `n' is in bounds. + moveImage(loc(0,from),loc(0,from+n),loc(columns-1,_bottomMargin)); + clearImage(loc(0,_bottomMargin-n+1),loc(columns-1,_bottomMargin),' '); +} + +void Screen::scrollDown(int n) +{ + if (n == 0) n = 1; // Default + scrollDown(_topMargin, n); +} + +void Screen::scrollDown(int from, int n) +{ + _scrolledLines += n; + + //FIXME: make sure `topMargin', `bottomMargin', `from', `n' is in bounds. + if (n <= 0) + return; + if (from > _bottomMargin) + return; + if (from + n > _bottomMargin) + n = _bottomMargin - from; + moveImage(loc(0,from+n),loc(0,from),loc(columns-1,_bottomMargin-n)); + clearImage(loc(0,from),loc(columns-1,from+n-1),' '); +} + +void Screen::setCursorYX(int y, int x) +{ + setCursorY(y); setCursorX(x); +} + +void Screen::setCursorX(int x) +{ + if (x == 0) x = 1; // Default + x -= 1; // Adjust + cuX = qMax(0,qMin(columns-1, x)); +} + +void Screen::setCursorY(int y) +{ + if (y == 0) y = 1; // Default + y -= 1; // Adjust + cuY = qMax(0,qMin(lines -1, y + (getMode(MODE_Origin) ? _topMargin : 0) )); +} + +void Screen::home() +{ + cuX = 0; + cuY = 0; +} + +void Screen::toStartOfLine() +{ + cuX = 0; +} + +int Screen::getCursorX() const +{ + return cuX; +} + +int Screen::getCursorY() const +{ + return cuY; +} + +void Screen::clearImage(int loca, int loce, char c) +{ + int scr_TL=loc(0,history->getLines()); + //FIXME: check positions + + //Clear entire selection if it overlaps region to be moved... + if ( (selBottomRight > (loca+scr_TL) )&&(selTopLeft < (loce+scr_TL)) ) + { + clearSelection(); + } + + int topLine = loca/columns; + int bottomLine = loce/columns; + + Character clearCh(c,currentForeground,currentBackground,DEFAULT_RENDITION); + + //if the character being used to clear the area is the same as the + //default character, the affected lines can simply be shrunk. + bool isDefaultCh = (clearCh == Character()); + + for (int y=topLine;y<=bottomLine;y++) + { + lineProperties[y] = 0; + + int endCol = ( y == bottomLine) ? loce%columns : columns-1; + int startCol = ( y == topLine ) ? loca%columns : 0; + + QVector& line = screenLines[y]; + + if ( isDefaultCh && endCol == columns-1 ) + { + line.resize(startCol); + } + else + { + if (line.size() < endCol + 1) + line.resize(endCol+1); + + Character* data = line.data(); + for (int i=startCol;i<=endCol;i++) + data[i]=clearCh; + } + } +} + +void Screen::moveImage(int dest, int sourceBegin, int sourceEnd) +{ + Q_ASSERT( sourceBegin <= sourceEnd ); + + int lines=(sourceEnd-sourceBegin)/columns; + + //move screen image and line properties: + //the source and destination areas of the image may overlap, + //so it matters that we do the copy in the right order - + //forwards if dest < sourceBegin or backwards otherwise. + //(search the web for 'memmove implementation' for details) + if (dest < sourceBegin) + { + for (int i=0;i<=lines;i++) + { + screenLines[ (dest/columns)+i ] = screenLines[ (sourceBegin/columns)+i ]; + lineProperties[(dest/columns)+i]=lineProperties[(sourceBegin/columns)+i]; + } + } + else + { + for (int i=lines;i>=0;i--) + { + screenLines[ (dest/columns)+i ] = screenLines[ (sourceBegin/columns)+i ]; + lineProperties[(dest/columns)+i]=lineProperties[(sourceBegin/columns)+i]; + } + } + + if (lastPos != -1) + { + int diff = dest - sourceBegin; // Scroll by this amount + lastPos += diff; + if ((lastPos < 0) || (lastPos >= (lines*columns))) + lastPos = -1; + } + + // Adjust selection to follow scroll. + if (selBegin != -1) + { + bool beginIsTL = (selBegin == selTopLeft); + int diff = dest - sourceBegin; // Scroll by this amount + int scr_TL=loc(0,history->getLines()); + int srca = sourceBegin+scr_TL; // Translate index from screen to global + int srce = sourceEnd+scr_TL; // Translate index from screen to global + int desta = srca+diff; + int deste = srce+diff; + + if ((selTopLeft >= srca) && (selTopLeft <= srce)) + selTopLeft += diff; + else if ((selTopLeft >= desta) && (selTopLeft <= deste)) + selBottomRight = -1; // Clear selection (see below) + + if ((selBottomRight >= srca) && (selBottomRight <= srce)) + selBottomRight += diff; + else if ((selBottomRight >= desta) && (selBottomRight <= deste)) + selBottomRight = -1; // Clear selection (see below) + + if (selBottomRight < 0) + { + clearSelection(); + } + else + { + if (selTopLeft < 0) + selTopLeft = 0; + } + + if (beginIsTL) + selBegin = selTopLeft; + else + selBegin = selBottomRight; + } +} + +void Screen::clearToEndOfScreen() +{ + clearImage(loc(cuX,cuY),loc(columns-1,lines-1),' '); +} + +void Screen::clearToBeginOfScreen() +{ + clearImage(loc(0,0),loc(cuX,cuY),' '); +} + +void Screen::clearEntireScreen() +{ + // Add entire screen to history + for (int i = 0; i < (lines-1); i++) + { + addHistLine(); scrollUp(0,1); + } + + clearImage(loc(0,0),loc(columns-1,lines-1),' '); +} + +/*! fill screen with 'E' + This is to aid screen alignment + */ + +void Screen::helpAlign() +{ + clearImage(loc(0,0),loc(columns-1,lines-1),'E'); +} + +void Screen::clearToEndOfLine() +{ + clearImage(loc(cuX,cuY),loc(columns-1,cuY),' '); +} + +void Screen::clearToBeginOfLine() +{ + clearImage(loc(0,cuY),loc(cuX,cuY),' '); +} + +void Screen::clearEntireLine() +{ + clearImage(loc(0,cuY),loc(columns-1,cuY),' '); +} + +void Screen::setRendition(int re) +{ + currentRendition |= re; + updateEffectiveRendition(); +} + +void Screen::resetRendition(int re) +{ + currentRendition &= ~re; + updateEffectiveRendition(); +} + +void Screen::setDefaultRendition() +{ + setForeColor(COLOR_SPACE_DEFAULT,DEFAULT_FORE_COLOR); + setBackColor(COLOR_SPACE_DEFAULT,DEFAULT_BACK_COLOR); + currentRendition = DEFAULT_RENDITION; + updateEffectiveRendition(); +} + +void Screen::setForeColor(int space, int color) +{ + currentForeground = CharacterColor(space, color); + + if ( currentForeground.isValid() ) + updateEffectiveRendition(); + else + setForeColor(COLOR_SPACE_DEFAULT,DEFAULT_FORE_COLOR); +} + +void Screen::setBackColor(int space, int color) +{ + currentBackground = CharacterColor(space, color); + + if ( currentBackground.isValid() ) + updateEffectiveRendition(); + else + setBackColor(COLOR_SPACE_DEFAULT,DEFAULT_BACK_COLOR); +} + +void Screen::clearSelection() +{ + selBottomRight = -1; + selTopLeft = -1; + selBegin = -1; +} + +void Screen::getSelectionStart(int& column , int& line) const +{ + if ( selTopLeft != -1 ) + { + column = selTopLeft % columns; + line = selTopLeft / columns; + } + else + { + column = cuX + getHistLines(); + line = cuY + getHistLines(); + } +} +void Screen::getSelectionEnd(int& column , int& line) const +{ + if ( selBottomRight != -1 ) + { + column = selBottomRight % columns; + line = selBottomRight / columns; + } + else + { + column = cuX + getHistLines(); + line = cuY + getHistLines(); + } +} +void Screen::setSelectionStart(const int x, const int y, const bool mode) +{ + selBegin = loc(x,y); + /* FIXME, HACK to correct for x too far to the right... */ + if (x == columns) selBegin--; + + selBottomRight = selBegin; + selTopLeft = selBegin; + blockSelectionMode = mode; +} + +void Screen::setSelectionEnd( const int x, const int y) +{ + if (selBegin == -1) + return; + + int endPos = loc(x,y); + + if (endPos < selBegin) + { + selTopLeft = endPos; + selBottomRight = selBegin; + } + else + { + /* FIXME, HACK to correct for x too far to the right... */ + if (x == columns) + endPos--; + + selTopLeft = selBegin; + selBottomRight = endPos; + } + + // Normalize the selection in column mode + if (blockSelectionMode) + { + int topRow = selTopLeft / columns; + int topColumn = selTopLeft % columns; + int bottomRow = selBottomRight / columns; + int bottomColumn = selBottomRight % columns; + + selTopLeft = loc(qMin(topColumn,bottomColumn),topRow); + selBottomRight = loc(qMax(topColumn,bottomColumn),bottomRow); + } +} + +bool Screen::isSelected( const int x,const int y) const +{ + bool columnInSelection = true; + if (blockSelectionMode) + { + columnInSelection = x >= (selTopLeft % columns) && + x <= (selBottomRight % columns); + } + + int pos = loc(x,y); + return pos >= selTopLeft && pos <= selBottomRight && columnInSelection; +} + +QString Screen::selectedText(bool preserveLineBreaks) const +{ + QString result; + QTextStream stream(&result, QIODevice::ReadWrite); + + PlainTextDecoder decoder; + decoder.begin(&stream); + writeSelectionToStream(&decoder , preserveLineBreaks); + decoder.end(); + + return result; +} + +bool Screen::isSelectionValid() const +{ + return selTopLeft >= 0 && selBottomRight >= 0; +} + +void Screen::writeSelectionToStream(TerminalCharacterDecoder* decoder , + bool preserveLineBreaks) const +{ + if (!isSelectionValid()) + return; + writeToStream(decoder,selTopLeft,selBottomRight,preserveLineBreaks); +} + +void Screen::writeToStream(TerminalCharacterDecoder* decoder, + int startIndex, int endIndex, + bool preserveLineBreaks) const +{ + int top = startIndex / columns; + int left = startIndex % columns; + + int bottom = endIndex / columns; + int right = endIndex % columns; + + Q_ASSERT( top >= 0 && left >= 0 && bottom >= 0 && right >= 0 ); + + for (int y=top;y<=bottom;y++) + { + int start = 0; + if ( y == top || blockSelectionMode ) start = left; + + int count = -1; + if ( y == bottom || blockSelectionMode ) count = right - start + 1; + + const bool appendNewLine = ( y != bottom ); + int copied = copyLineToStream( y, + start, + count, + decoder, + appendNewLine, + preserveLineBreaks ); + + // if the selection goes beyond the end of the last line then + // append a new line character. + // + // this makes it possible to 'select' a trailing new line character after + // the text on a line. + if ( y == bottom && + copied < count ) + { + Character newLineChar('\n'); + decoder->decodeLine(&newLineChar,1,0); + } + } +} + +int Screen::copyLineToStream(int line , + int start, + int count, + TerminalCharacterDecoder* decoder, + bool appendNewLine, + bool preserveLineBreaks) const +{ + //buffer to hold characters for decoding + //the buffer is static to avoid initialising every + //element on each call to copyLineToStream + //(which is unnecessary since all elements will be overwritten anyway) + static const int MAX_CHARS = 1024; + static Character characterBuffer[MAX_CHARS]; + + assert( count < MAX_CHARS ); + + LineProperty currentLineProperties = 0; + + //determine if the line is in the history buffer or the screen image + if (line < history->getLines()) + { + const int lineLength = history->getLineLen(line); + + // ensure that start position is before end of line + start = qMin(start,qMax(0,lineLength-1)); + + // retrieve line from history buffer. It is assumed + // that the history buffer does not store trailing white space + // at the end of the line, so it does not need to be trimmed here + if (count == -1) + { + count = lineLength-start; + } + else + { + count = qMin(start+count,lineLength)-start; + } + + // safety checks + assert( start >= 0 ); + assert( count >= 0 ); + assert( (start+count) <= history->getLineLen(line) ); + + history->getCells(line,start,count,characterBuffer); + + if ( history->isWrappedLine(line) ) + currentLineProperties |= LINE_WRAPPED; + } + else + { + if ( count == -1 ) + count = columns - start; + + assert( count >= 0 ); + + const int screenLine = line-history->getLines(); + + Character* data = screenLines[screenLine].data(); + int length = screenLines[screenLine].count(); + + //retrieve line from screen image + for (int i=start;i < qMin(start+count,length);i++) + { + characterBuffer[i-start] = data[i]; + } + + // count cannot be any greater than length + count = qBound(0,count,length-start); + + Q_ASSERT( screenLine < lineProperties.count() ); + currentLineProperties |= lineProperties[screenLine]; + } + + // add new line character at end + const bool omitLineBreak = (currentLineProperties & LINE_WRAPPED) || + !preserveLineBreaks; + + if ( !omitLineBreak && appendNewLine && (count+1 < MAX_CHARS) ) + { + characterBuffer[count] = '\n'; + count++; + } + + //decode line and write to text stream + decoder->decodeLine( (Character*) characterBuffer , + count, currentLineProperties ); + + return count; +} + +void Screen::writeLinesToStream(TerminalCharacterDecoder* decoder, int fromLine, int toLine) const +{ + writeToStream(decoder,loc(0,fromLine),loc(columns-1,toLine)); +} + +void Screen::addHistLine() +{ + // add line to history buffer + // we have to take care about scrolling, too... + + if (hasScroll()) + { + int oldHistLines = history->getLines(); + + history->addCellsVector(screenLines[0]); + history->addLine( lineProperties[0] & LINE_WRAPPED ); + + int newHistLines = history->getLines(); + + bool beginIsTL = (selBegin == selTopLeft); + + // If the history is full, increment the count + // of dropped lines + if ( newHistLines == oldHistLines ) + _droppedLines++; + + // Adjust selection for the new point of reference + if (newHistLines > oldHistLines) + { + if (selBegin != -1) + { + selTopLeft += columns; + selBottomRight += columns; + } + } + + if (selBegin != -1) + { + // Scroll selection in history up + int top_BR = loc(0, 1+newHistLines); + + if (selTopLeft < top_BR) + selTopLeft -= columns; + + if (selBottomRight < top_BR) + selBottomRight -= columns; + + if (selBottomRight < 0) + clearSelection(); + else + { + if (selTopLeft < 0) + selTopLeft = 0; + } + + if (beginIsTL) + selBegin = selTopLeft; + else + selBegin = selBottomRight; + } + } + +} + +int Screen::getHistLines() const +{ + return history->getLines(); +} + +void Screen::setScroll(const HistoryType& t , bool copyPreviousScroll) +{ + clearSelection(); + + if ( copyPreviousScroll ) + history = t.scroll(history); + else + { + HistoryScroll* oldScroll = history; + history = t.scroll(0); + delete oldScroll; + } +} + +bool Screen::hasScroll() const +{ + return history->hasScroll(); +} + +const HistoryType& Screen::getScroll() const +{ + return history->getType(); +} + +void Screen::setLineProperty(LineProperty property , bool enable) +{ + if ( enable ) + lineProperties[cuY] = (LineProperty)(lineProperties[cuY] | property); + else + lineProperties[cuY] = (LineProperty)(lineProperties[cuY] & ~property); +} +void Screen::fillWithDefaultChar(Character* dest, int count) +{ + for (int i=0;i + Copyright 1997,1998 by Lars Doelle + + 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. +*/ + +#ifndef SCREEN_H +#define SCREEN_H + +// Qt +#include +#include +#include + +// Konsole +#include "Character.h" +#include "History.h" + +#define MODE_Origin 0 +#define MODE_Wrap 1 +#define MODE_Insert 2 +#define MODE_Screen 3 +#define MODE_Cursor 4 +#define MODE_NewLine 5 +#define MODES_SCREEN 6 + + +class TerminalCharacterDecoder; + +/** + \brief An image of characters with associated attributes. + + The terminal emulation ( Emulation ) receives a serial stream of + characters from the program currently running in the terminal. + From this stream it creates an image of characters which is ultimately + rendered by the display widget ( TerminalDisplay ). Some types of emulation + may have more than one screen image. + + getImage() is used to retrieve the currently visible image + which is then used by the display widget to draw the output from the + terminal. + + The number of lines of output history which are kept in addition to the current + screen image depends on the history scroll being used to store the output. + The scroll is specified using setScroll() + The output history can be retrieved using writeToStream() + + The screen image has a selection associated with it, specified using + setSelectionStart() and setSelectionEnd(). The selected text can be retrieved + using selectedText(). When getImage() is used to retrieve the visible image, + characters which are part of the selection have their colours inverted. +*/ +class Screen +{ +public: + /** Construct a new screen image of size @p lines by @p columns. */ + Screen(int lines, int columns); + ~Screen(); + + // VT100/2 Operations + // Cursor Movement + + /** + * Move the cursor up by @p n lines. The cursor will stop at the + * top margin. + */ + void cursorUp(int n); + /** + * Move the cursor down by @p n lines. The cursor will stop at the + * bottom margin. + */ + void cursorDown(int n); + /** + * Move the cursor to the left by @p n columns. + * The cursor will stop at the first column. + */ + void cursorLeft(int n); + /** + * Move the cursor to the right by @p n columns. + * The cursor will stop at the right-most column. + */ + void cursorRight(int n); + /** Position the cursor on line @p y. */ + void setCursorY(int y); + /** Position the cursor at column @p x. */ + void setCursorX(int x); + /** Position the cursor at line @p y, column @p x. */ + void setCursorYX(int y, int x); + /** + * Sets the margins for scrolling the screen. + * + * @param topLine The top line of the new scrolling margin. + * @param bottomLine The bottom line of the new scrolling margin. + */ + void setMargins(int topLine , int bottomLine); + /** Returns the top line of the scrolling region. */ + int topMargin() const; + /** Returns the bottom line of the scrolling region. */ + int bottomMargin() const; + + /** + * Resets the scrolling margins back to the top and bottom lines + * of the screen. + */ + void setDefaultMargins(); + + /** + * Moves the cursor down one line, if the MODE_NewLine mode + * flag is enabled then the cursor is returned to the leftmost + * column first. + * + * Equivalent to NextLine() if the MODE_NewLine flag is set + * or index() otherwise. + */ + void newLine(); + /** + * Moves the cursor down one line and positions it at the beginning + * of the line. Equivalent to calling Return() followed by index() + */ + void nextLine(); + + /** + * Move the cursor down one line. If the cursor is on the bottom + * line of the scrolling region (as returned by bottomMargin()) the + * scrolling region is scrolled up by one line instead. + */ + void index(); + /** + * Move the cursor up one line. If the cursor is on the top line + * of the scrolling region (as returned by topMargin()) the scrolling + * region is scrolled down by one line instead. + */ + void reverseIndex(); + + /** + * Scroll the scrolling region of the screen up by @p n lines. + * The scrolling region is initially the whole screen, but can be changed + * using setMargins() + */ + void scrollUp(int n); + /** + * Scroll the scrolling region of the screen down by @p n lines. + * The scrolling region is initially the whole screen, but can be changed + * using setMargins() + */ + void scrollDown(int n); + /** + * Moves the cursor to the beginning of the current line. + * Equivalent to setCursorX(0) + */ + void toStartOfLine(); + /** + * Moves the cursor one column to the left and erases the character + * at the new cursor position. + */ + void backspace(); + /** Moves the cursor @p n tab-stops to the right. */ + void tab(int n = 1); + /** Moves the cursor @p n tab-stops to the left. */ + void backtab(int n); + + // Editing + + /** + * Erase @p n characters beginning from the current cursor position. + * This is equivalent to over-writing @p n characters starting with the current + * cursor position with spaces. + * If @p n is 0 then one character is erased. + */ + void eraseChars(int n); + /** + * Delete @p n characters beginning from the current cursor position. + * If @p n is 0 then one character is deleted. + */ + void deleteChars(int n); + /** + * Insert @p n blank characters beginning from the current cursor position. + * The position of the cursor is not altered. + * If @p n is 0 then one character is inserted. + */ + void insertChars(int n); + /** + * Removes @p n lines beginning from the current cursor position. + * The position of the cursor is not altered. + * If @p n is 0 then one line is removed. + */ + void deleteLines(int n); + /** + * Inserts @p lines beginning from the current cursor position. + * The position of the cursor is not altered. + * If @p n is 0 then one line is inserted. + */ + void insertLines(int n); + /** Clears all the tab stops. */ + void clearTabStops(); + /** Sets or removes a tab stop at the cursor's current column. */ + void changeTabStop(bool set); + + /** Resets (clears) the specified screen @p mode. */ + void resetMode(int mode); + /** Sets (enables) the specified screen @p mode. */ + void setMode(int mode); + /** + * Saves the state of the specified screen @p mode. It can be restored + * using restoreMode() + */ + void saveMode(int mode); + /** Restores the state of a screen @p mode saved by calling saveMode() */ + void restoreMode(int mode); + /** Returns whether the specified screen @p mode is enabled or not .*/ + bool getMode(int mode) const; + + /** + * Saves the current position and appearance (text color and style) of the cursor. + * It can be restored by calling restoreCursor() + */ + void saveCursor(); + /** Restores the position and appearance of the cursor. See saveCursor() */ + void restoreCursor(); + + /** Clear the whole screen, moving the current screen contents into the history first. */ + void clearEntireScreen(); + /** + * Clear the area of the screen from the current cursor position to the end of + * the screen. + */ + void clearToEndOfScreen(); + /** + * Clear the area of the screen from the current cursor position to the start + * of the screen. + */ + void clearToBeginOfScreen(); + /** Clears the whole of the line on which the cursor is currently positioned. */ + void clearEntireLine(); + /** Clears from the current cursor position to the end of the line. */ + void clearToEndOfLine(); + /** Clears from the current cursor position to the beginning of the line. */ + void clearToBeginOfLine(); + + /** Fills the entire screen with the letter 'E' */ + void helpAlign(); + + /** + * Enables the given @p rendition flag. Rendition flags control the appearance + * of characters on the screen. + * + * @see Character::rendition + */ + void setRendition(int rendition); + /** + * Disables the given @p rendition flag. Rendition flags control the appearance + * of characters on the screen. + * + * @see Character::rendition + */ + void resetRendition(int rendition); + + /** + * Sets the cursor's foreground color. + * @param space The color space used by the @p color argument + * @param color The new foreground color. The meaning of this depends on + * the color @p space used. + * + * @see CharacterColor + */ + void setForeColor(int space, int color); + /** + * Sets the cursor's background color. + * @param space The color space used by the @p color argumnet. + * @param color The new background color. The meaning of this depends on + * the color @p space used. + * + * @see CharacterColor + */ + void setBackColor(int space, int color); + /** + * Resets the cursor's color back to the default and sets the + * character's rendition flags back to the default settings. + */ + void setDefaultRendition(); + + /** Returns the column which the cursor is positioned at. */ + int getCursorX() const; + /** Returns the line which the cursor is positioned on. */ + int getCursorY() const; + + /** Clear the entire screen and move the cursor to the home position. + * Equivalent to calling clearEntireScreen() followed by home(). + */ + void clear(); + /** + * Sets the position of the cursor to the 'home' position at the top-left + * corner of the screen (0,0) + */ + void home(); + /** + * Resets the state of the screen. This resets the various screen modes + * back to their default states. The cursor style and colors are reset + * (as if setDefaultRendition() had been called) + * + *
    + *
  • Line wrapping is enabled.
  • + *
  • Origin mode is disabled.
  • + *
  • Insert mode is disabled.
  • + *
  • Cursor mode is enabled. TODO Document me
  • + *
  • Screen mode is disabled. TODO Document me
  • + *
  • New line mode is disabled. TODO Document me
  • + *
+ * + * If @p clearScreen is true then the screen contents are erased entirely, + * otherwise they are unaltered. + */ + void reset(bool clearScreen = true); + + /** + * Displays a new character at the current cursor position. + * + * If the cursor is currently positioned at the right-edge of the screen and + * line wrapping is enabled then the character is added at the start of a new + * line below the current one. + * + * If the MODE_Insert screen mode is currently enabled then the character + * is inserted at the current cursor position, otherwise it will replace the + * character already at the current cursor position. + */ + void displayCharacter(unsigned short c); + + // Do composition with last shown character FIXME: Not implemented yet for KDE 4 + void compose(const QString& compose); + + /** + * Resizes the image to a new fixed size of @p new_lines by @p new_columns. + * In the case that @p new_columns is smaller than the current number of columns, + * existing lines are not truncated. This prevents characters from being lost + * if the terminal display is resized smaller and then larger again. + * + * The top and bottom margins are reset to the top and bottom of the new + * screen size. Tab stops are also reset and the current selection is + * cleared. + */ + void resizeImage(int new_lines, int new_columns); + + /** + * Returns the current screen image. + * The result is an array of Characters of size [getLines()][getColumns()] which + * must be freed by the caller after use. + * + * @param dest Buffer to copy the characters into + * @param size Size of @p dest in Characters + * @param startLine Index of first line to copy + * @param endLine Index of last line to copy + */ + void getImage( Character* dest , int size , int startLine , int endLine ) const; + + /** + * Returns the additional attributes associated with lines in the image. + * The most important attribute is LINE_WRAPPED which specifies that the + * line is wrapped, + * other attributes control the size of characters in the line. + */ + QVector getLineProperties( int startLine , int endLine ) const; + + + /** Return the number of lines. */ + int getLines() const + { return lines; } + /** Return the number of columns. */ + int getColumns() const + { return columns; } + /** Return the number of lines in the history buffer. */ + int getHistLines() const; + /** + * Sets the type of storage used to keep lines in the history. + * If @p copyPreviousScroll is true then the contents of the previous + * history buffer are copied into the new scroll. + */ + void setScroll(const HistoryType& , bool copyPreviousScroll = true); + /** Returns the type of storage used to keep lines in the history. */ + const HistoryType& getScroll() const; + /** + * Returns true if this screen keeps lines that are scrolled off the screen + * in a history buffer. + */ + bool hasScroll() const; + + /** + * Sets the start of the selection. + * + * @param column The column index of the first character in the selection. + * @param line The line index of the first character in the selection. + * @param blockSelectionMode True if the selection is in column mode. + */ + void setSelectionStart(const int column, const int line, const bool blockSelectionMode); + + /** + * Sets the end of the current selection. + * + * @param column The column index of the last character in the selection. + * @param line The line index of the last character in the selection. + */ + void setSelectionEnd(const int column, const int line); + + /** + * Retrieves the start of the selection or the cursor position if there + * is no selection. + */ + void getSelectionStart(int& column , int& line) const; + + /** + * Retrieves the end of the selection or the cursor position if there + * is no selection. + */ + void getSelectionEnd(int& column , int& line) const; + + /** Clears the current selection */ + void clearSelection(); + + /** + * Returns true if the character at (@p column, @p line) is part of the + * current selection. + */ + bool isSelected(const int column,const int line) const; + + /** + * Convenience method. Returns the currently selected text. + * @param preserveLineBreaks Specifies whether new line characters should + * be inserted into the returned text at the end of each terminal line. + */ + QString selectedText(bool preserveLineBreaks) const; + + /** + * Copies part of the output to a stream. + * + * @param decoder A decoder which converts terminal characters into text + * @param fromLine The first line in the history to retrieve + * @param toLine The last line in the history to retrieve + */ + void writeLinesToStream(TerminalCharacterDecoder* decoder, int fromLine, int toLine) const; + + /** + * Copies the selected characters, set using @see setSelBeginXY and @see setSelExtentXY + * into a stream. + * + * @param decoder A decoder which converts terminal characters into text. + * PlainTextDecoder is the most commonly used decoder which converts characters + * into plain text with no formatting. + * @param preserveLineBreaks Specifies whether new line characters should + * be inserted into the returned text at the end of each terminal line. + */ + void writeSelectionToStream(TerminalCharacterDecoder* decoder , bool + preserveLineBreaks = true) const; + + /** + * Checks if the text between from and to is inside the current + * selection. If this is the case, the selection is cleared. The + * from and to are coordinates in the current viewable window. + * The loc(x,y) macro can be used to generate these values from a + * column,line pair. + * + * @param from The start of the area to check. + * @param to The end of the area to check + */ + void checkSelection(int from, int to); + + /** + * Sets or clears an attribute of the current line. + * + * @param property The attribute to set or clear + * Possible properties are: + * LINE_WRAPPED: Specifies that the line is wrapped. + * LINE_DOUBLEWIDTH: Specifies that the characters in the current line + * should be double the normal width. + * LINE_DOUBLEHEIGHT:Specifies that the characters in the current line + * should be double the normal height. + * Double-height lines are formed of two lines containing the same characters, + * with both having the LINE_DOUBLEHEIGHT attribute. + * This allows other parts of the code to work on the + * assumption that all lines are the same height. + * + * @param enable true to apply the attribute to the current line or false to remove it + */ + void setLineProperty(LineProperty property , bool enable); + + /** + * Returns the number of lines that the image has been scrolled up or down by, + * since the last call to resetScrolledLines(). + * + * a positive return value indicates that the image has been scrolled up, + * a negative return value indicates that the image has been scrolled down. + */ + int scrolledLines() const; + + /** + * Returns the region of the image which was last scrolled. + * + * This is the area of the image from the top margin to the + * bottom margin when the last scroll occurred. + */ + QRect lastScrolledRegion() const; + + /** + * Resets the count of the number of lines that the image has been scrolled up or down by, + * see scrolledLines() + */ + void resetScrolledLines(); + + /** + * Returns the number of lines of output which have been + * dropped from the history since the last call + * to resetDroppedLines() + * + * If the history is not unlimited then it will drop + * the oldest lines of output if new lines are added when + * it is full. + */ + int droppedLines() const; + + /** + * Resets the count of the number of lines dropped from + * the history. + */ + void resetDroppedLines(); + + /** + * Fills the buffer @p dest with @p count instances of the default (ie. blank) + * Character style. + */ + static void fillWithDefaultChar(Character* dest, int count); + +private: + + //copies a line of text from the screen or history into a stream using a + //specified character decoder. Returns the number of lines actually copied, + //which may be less than 'count' if (start+count) is more than the number of characters on + //the line + // + //line - the line number to copy, from 0 (the earliest line in the history) up to + // history->getLines() + lines - 1 + //start - the first column on the line to copy + //count - the number of characters on the line to copy + //decoder - a decoder which converts terminal characters (an Character array) into text + //appendNewLine - if true a new line character (\n) is appended to the end of the line + int copyLineToStream(int line, + int start, + int count, + TerminalCharacterDecoder* decoder, + bool appendNewLine, + bool preserveLineBreaks) const; + + //fills a section of the screen image with the character 'c' + //the parameters are specified as offsets from the start of the screen image. + //the loc(x,y) macro can be used to generate these values from a column,line pair. + void clearImage(int loca, int loce, char c); + + //move screen image between 'sourceBegin' and 'sourceEnd' to 'dest'. + //the parameters are specified as offsets from the start of the screen image. + //the loc(x,y) macro can be used to generate these values from a column,line pair. + // + //NOTE: moveImage() can only move whole lines + void moveImage(int dest, int sourceBegin, int sourceEnd); + // scroll up 'i' lines in current region, clearing the bottom 'i' lines + void scrollUp(int from, int i); + // scroll down 'i' lines in current region, clearing the top 'i' lines + void scrollDown(int from, int i); + + void addHistLine(); + + void initTabStops(); + + void updateEffectiveRendition(); + void reverseRendition(Character& p) const; + + bool isSelectionValid() const; + // copies text from 'startIndex' to 'endIndex' to a stream + // startIndex and endIndex are positions generated using the loc(x,y) macro + void writeToStream(TerminalCharacterDecoder* decoder, int startIndex, + int endIndex, bool preserveLineBreaks = true) const; + // copies 'count' lines from the screen buffer into 'dest', + // starting from 'startLine', where 0 is the first line in the screen buffer + void copyFromScreen(Character* dest, int startLine, int count) const; + // copies 'count' lines from the history buffer into 'dest', + // starting from 'startLine', where 0 is the first line in the history + void copyFromHistory(Character* dest, int startLine, int count) const; + + + // screen image ---------------- + int lines; + int columns; + + typedef QVector ImageLine; // [0..columns] + ImageLine* screenLines; // [lines] + + int _scrolledLines; + QRect _lastScrolledRegion; + + int _droppedLines; + + QVarLengthArray lineProperties; + + // history buffer --------------- + HistoryScroll* history; + + // cursor location + int cuX; + int cuY; + + // cursor color and rendition info + CharacterColor currentForeground; + CharacterColor currentBackground; + quint8 currentRendition; + + // margins ---------------- + int _topMargin; + int _bottomMargin; + + // states ---------------- + int currentModes[MODES_SCREEN]; + int savedModes[MODES_SCREEN]; + + // ---------------------------- + + QBitArray tabStops; + + // selection ------------------- + int selBegin; // The first location selected. + int selTopLeft; // TopLeft Location. + int selBottomRight; // Bottom Right Location. + bool blockSelectionMode; // Column selection mode + + // effective colors and rendition ------------ + CharacterColor effectiveForeground; // These are derived from + CharacterColor effectiveBackground; // the cu_* variables above + quint8 effectiveRendition; // to speed up operation + + class SavedState + { + public: + SavedState() + : cursorColumn(0),cursorLine(0),rendition(0) {} + + int cursorColumn; + int cursorLine; + quint8 rendition; + CharacterColor foreground; + CharacterColor background; + }; + SavedState savedState; + + // last position where we added a character + int lastPos; + + static Character defaultChar; +}; + + +#endif // SCREEN_H diff --git a/konsole-qml-plugin/src/ScreenWindow.cpp b/konsole-qml-plugin/src/ScreenWindow.cpp new file mode 100644 index 0000000..c1b0c53 --- /dev/null +++ b/konsole-qml-plugin/src/ScreenWindow.cpp @@ -0,0 +1,292 @@ +/* + Copyright (C) 2007 by Robert Knight + + 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. +*/ + +// Own +#include "ScreenWindow.h" + +// Qt +#include + +// Konsole +#include "Screen.h" + +ScreenWindow::ScreenWindow(QObject* parent) + : QObject(parent) + , _windowBuffer(0) + , _windowBufferSize(0) + , _bufferNeedsUpdate(true) + , _windowLines(1) + , _currentLine(0) + , _trackOutput(true) + , _scrollCount(0) +{ +} +ScreenWindow::~ScreenWindow() +{ + delete[] _windowBuffer; +} +void ScreenWindow::setScreen(Screen* screen) +{ + Q_ASSERT( screen ); + + _screen = screen; +} + +Screen* ScreenWindow::screen() const +{ + return _screen; +} + +Character* ScreenWindow::getImage() +{ + // reallocate internal buffer if the window size has changed + int size = windowLines() * windowColumns(); + if (_windowBuffer == 0 || _windowBufferSize != size) + { + delete[] _windowBuffer; + _windowBufferSize = size; + _windowBuffer = new Character[size]; + _bufferNeedsUpdate = true; + } + + if (!_bufferNeedsUpdate) + return _windowBuffer; + + _screen->getImage(_windowBuffer,size, + currentLine(),endWindowLine()); + + // this window may look beyond the end of the screen, in which + // case there will be an unused area which needs to be filled + // with blank characters + fillUnusedArea(); + + _bufferNeedsUpdate = false; + return _windowBuffer; +} + +void ScreenWindow::fillUnusedArea() +{ + int screenEndLine = _screen->getHistLines() + _screen->getLines() - 1; + int windowEndLine = currentLine() + windowLines() - 1; + + int unusedLines = windowEndLine - screenEndLine; + int charsToFill = unusedLines * windowColumns(); + + Screen::fillWithDefaultChar(_windowBuffer + _windowBufferSize - charsToFill,charsToFill); +} + +// return the index of the line at the end of this window, or if this window +// goes beyond the end of the screen, the index of the line at the end +// of the screen. +// +// when passing a line number to a Screen method, the line number should +// never be more than endWindowLine() +// +int ScreenWindow::endWindowLine() const +{ + return qMin(currentLine() + windowLines() - 1, + lineCount() - 1); +} +QVector ScreenWindow::getLineProperties() +{ + QVector result = _screen->getLineProperties(currentLine(),endWindowLine()); + + if (result.count() != windowLines()) + result.resize(windowLines()); + + return result; +} + +QString ScreenWindow::selectedText( bool preserveLineBreaks ) const +{ + return _screen->selectedText( preserveLineBreaks ); +} + +void ScreenWindow::getSelectionStart( int& column , int& line ) +{ + _screen->getSelectionStart(column,line); + line -= currentLine(); +} +void ScreenWindow::getSelectionEnd( int& column , int& line ) +{ + _screen->getSelectionEnd(column,line); + line -= currentLine(); +} +void ScreenWindow::setSelectionStart( int column , int line , bool columnMode ) +{ + _screen->setSelectionStart( column , qMin(line + currentLine(),endWindowLine()) , columnMode); + + _bufferNeedsUpdate = true; + emit selectionChanged(); +} + +void ScreenWindow::setSelectionEnd( int column , int line ) +{ + _screen->setSelectionEnd( column , qMin(line + currentLine(),endWindowLine()) ); + + _bufferNeedsUpdate = true; + emit selectionChanged(); +} + +bool ScreenWindow::isSelected( int column , int line ) +{ + return _screen->isSelected( column , qMin(line + currentLine(),endWindowLine()) ); +} + +void ScreenWindow::clearSelection() +{ + _screen->clearSelection(); + + emit selectionChanged(); +} + +void ScreenWindow::setWindowLines(int lines) +{ + Q_ASSERT(lines > 0); + _windowLines = lines; +} +int ScreenWindow::windowLines() const +{ + return _windowLines; +} + +int ScreenWindow::windowColumns() const +{ + return _screen->getColumns(); +} + +int ScreenWindow::lineCount() const +{ + return _screen->getHistLines() + _screen->getLines(); +} + +int ScreenWindow::columnCount() const +{ + return _screen->getColumns(); +} + +QPoint ScreenWindow::cursorPosition() const +{ + QPoint position; + + position.setX( _screen->getCursorX() ); + position.setY( _screen->getCursorY() ); + + return position; +} + +int ScreenWindow::currentLine() const +{ + return qBound(0,_currentLine,lineCount()-windowLines()); +} + +void ScreenWindow::scrollBy( RelativeScrollMode mode , int amount ) +{ + if ( mode == ScrollLines ) + { + scrollTo( currentLine() + amount ); + } + else if ( mode == ScrollPages ) + { + scrollTo( currentLine() + amount * ( windowLines() / 2 ) ); + } +} + +bool ScreenWindow::atEndOfOutput() const +{ + return currentLine() == (lineCount()-windowLines()); +} + +void ScreenWindow::scrollTo( int line ) +{ + int maxCurrentLineNumber = lineCount() - windowLines(); + line = qBound(0,line,maxCurrentLineNumber); + + const int delta = line - _currentLine; + _currentLine = line; + + // keep track of number of lines scrolled by, + // this can be reset by calling resetScrollCount() + _scrollCount += delta; + + _bufferNeedsUpdate = true; + + emit scrolled(_currentLine); +} + +void ScreenWindow::setTrackOutput(bool trackOutput) +{ + _trackOutput = trackOutput; +} + +bool ScreenWindow::trackOutput() const +{ + return _trackOutput; +} + +int ScreenWindow::scrollCount() const +{ + return _scrollCount; +} + +void ScreenWindow::resetScrollCount() +{ + _scrollCount = 0; +} + +QRect ScreenWindow::scrollRegion() const +{ + bool equalToScreenSize = windowLines() == _screen->getLines(); + + if ( atEndOfOutput() && equalToScreenSize ) + return _screen->lastScrolledRegion(); + else + return QRect(0,0,windowColumns(),windowLines()); +} + +void ScreenWindow::notifyOutputChanged() +{ + // move window to the bottom of the screen and update scroll count + // if this window is currently tracking the bottom of the screen + if ( _trackOutput ) + { + _scrollCount -= _screen->scrolledLines(); + _currentLine = qMax(0,_screen->getHistLines() - (windowLines()-_screen->getLines())); + } + else + { + // if the history is not unlimited then it may + // have run out of space and dropped the oldest + // lines of output - in this case the screen + // window's current line number will need to + // be adjusted - otherwise the output will scroll + _currentLine = qMax(0,_currentLine - + _screen->droppedLines()); + + // ensure that the screen window's current position does + // not go beyond the bottom of the screen + _currentLine = qMin( _currentLine , _screen->getHistLines() ); + } + + _bufferNeedsUpdate = true; + + emit outputChanged(); +} + +//#include "ScreenWindow.moc" diff --git a/konsole-qml-plugin/src/ScreenWindow.h b/konsole-qml-plugin/src/ScreenWindow.h new file mode 100644 index 0000000..7403c90 --- /dev/null +++ b/konsole-qml-plugin/src/ScreenWindow.h @@ -0,0 +1,257 @@ +/* + Copyright 2007-2008 by Robert Knight + + 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. +*/ + +#ifndef SCREENWINDOW_H +#define SCREENWINDOW_H + +// Qt +#include +#include +#include + +// Konsole +#include "Character.h" + + +class Screen; + +/** + * Provides a window onto a section of a terminal screen. A terminal widget can then render + * the contents of the window and use the window to change the terminal screen's selection + * in response to mouse or keyboard input. + * + * A new ScreenWindow for a terminal session can be created by calling Emulation::createWindow() + * + * Use the scrollTo() method to scroll the window up and down on the screen. + * Use the getImage() method to retrieve the character image which is currently visible in the window. + * + * setTrackOutput() controls whether the window moves to the bottom of the associated screen when new + * lines are added to it. + * + * Whenever the output from the underlying screen is changed, the notifyOutputChanged() slot should + * be called. This in turn will update the window's position and emit the outputChanged() signal + * if necessary. + */ +class ScreenWindow : public QObject +{ +Q_OBJECT + +public: + /** + * Constructs a new screen window with the given parent. + * A screen must be specified by calling setScreen() before calling getImage() or getLineProperties(). + * + * You should not call this constructor directly, instead use the Emulation::createWindow() method + * to create a window on the emulation which you wish to view. This allows the emulation + * to notify the window when the associated screen has changed and synchronize selection updates + * between all views on a session. + */ + ScreenWindow(QObject* parent = 0); + virtual ~ScreenWindow(); + + /** Sets the screen which this window looks onto */ + void setScreen(Screen* screen); + /** Returns the screen which this window looks onto */ + Screen* screen() const; + + /** + * Returns the image of characters which are currently visible through this window + * onto the screen. + * + * The returned buffer is managed by the ScreenWindow instance and does not need to be + * deleted by the caller. + */ + Character* getImage(); + + /** + * Returns the line attributes associated with the lines of characters which + * are currently visible through this window + */ + QVector getLineProperties(); + + /** + * Returns the number of lines which the region of the window + * specified by scrollRegion() has been scrolled by since the last call + * to resetScrollCount(). scrollRegion() is in most cases the + * whole window, but will be a smaller area in, for example, applications + * which provide split-screen facilities. + * + * This is not guaranteed to be accurate, but allows views to optimize + * rendering by reducing the amount of costly text rendering that + * needs to be done when the output is scrolled. + */ + int scrollCount() const; + + /** + * Resets the count of scrolled lines returned by scrollCount() + */ + void resetScrollCount(); + + /** + * Returns the area of the window which was last scrolled, this is + * usually the whole window area. + * + * Like scrollCount(), this is not guaranteed to be accurate, + * but allows views to optimize rendering. + */ + QRect scrollRegion() const; + + /** + * Sets the start of the selection to the given @p line and @p column within + * the window. + */ + void setSelectionStart( int column , int line , bool columnMode ); + /** + * Sets the end of the selection to the given @p line and @p column within + * the window. + */ + void setSelectionEnd( int column , int line ); + /** + * Retrieves the start of the selection within the window. + */ + void getSelectionStart( int& column , int& line ); + /** + * Retrieves the end of the selection within the window. + */ + void getSelectionEnd( int& column , int& line ); + /** + * Returns true if the character at @p line , @p column is part of the selection. + */ + bool isSelected( int column , int line ); + /** + * Clears the current selection + */ + void clearSelection(); + + /** Sets the number of lines in the window */ + void setWindowLines(int lines); + /** Returns the number of lines in the window */ + int windowLines() const; + /** Returns the number of columns in the window */ + int windowColumns() const; + + /** Returns the total number of lines in the screen */ + int lineCount() const; + /** Returns the total number of columns in the screen */ + int columnCount() const; + + /** Returns the index of the line which is currently at the top of this window */ + int currentLine() const; + + /** + * Returns the position of the cursor + * within the window. + */ + QPoint cursorPosition() const; + + /** + * Convenience method. Returns true if the window is currently at the bottom + * of the screen. + */ + bool atEndOfOutput() const; + + /** Scrolls the window so that @p line is at the top of the window */ + void scrollTo( int line ); + + /** Describes the units which scrollBy() moves the window by. */ + enum RelativeScrollMode + { + /** Scroll the window down by a given number of lines. */ + ScrollLines, + /** + * Scroll the window down by a given number of pages, where + * one page is windowLines() lines + */ + ScrollPages + }; + + /** + * Scrolls the window relative to its current position on the screen. + * + * @param mode Specifies whether @p amount refers to the number of lines or the number + * of pages to scroll. + * @param amount The number of lines or pages ( depending on @p mode ) to scroll by. If + * this number is positive, the view is scrolled down. If this number is negative, the view + * is scrolled up. + */ + void scrollBy( RelativeScrollMode mode , int amount ); + + /** + * Specifies whether the window should automatically move to the bottom + * of the screen when new output is added. + * + * If this is set to true, the window will be moved to the bottom of the associated screen ( see + * screen() ) when the notifyOutputChanged() method is called. + */ + void setTrackOutput(bool trackOutput); + /** + * Returns whether the window automatically moves to the bottom of the screen as + * new output is added. See setTrackOutput() + */ + bool trackOutput() const; + + /** + * Returns the text which is currently selected. + * + * @param preserveLineBreaks See Screen::selectedText() + */ + QString selectedText( bool preserveLineBreaks ) const; + +public slots: + /** + * Notifies the window that the contents of the associated terminal screen have changed. + * This moves the window to the bottom of the screen if trackOutput() is true and causes + * the outputChanged() signal to be emitted. + */ + void notifyOutputChanged(); + +signals: + /** + * Emitted when the contents of the associated terminal screen (see screen()) changes. + */ + void outputChanged(); + + /** + * Emitted when the screen window is scrolled to a different position. + * + * @param line The line which is now at the top of the window. + */ + void scrolled(int line); + + /** Emitted when the selection is changed. */ + void selectionChanged(); + +private: + int endWindowLine() const; + void fillUnusedArea(); + + Screen* _screen; // see setScreen() , screen() + Character* _windowBuffer; + int _windowBufferSize; + bool _bufferNeedsUpdate; + + int _windowLines; + int _currentLine; // see scrollTo() , currentLine() + bool _trackOutput; // see setTrackOutput() , trackOutput() + int _scrollCount; // count of lines which the window has been scrolled by since + // the last call to resetScrollCount() +}; + + +#endif // SCREENWINDOW_H diff --git a/konsole-qml-plugin/src/Session.cpp b/konsole-qml-plugin/src/Session.cpp new file mode 100644 index 0000000..4c06535 --- /dev/null +++ b/konsole-qml-plugin/src/Session.cpp @@ -0,0 +1,1064 @@ +/* + This file is part of Konsole + + Copyright (C) 2006-2007 by Robert Knight + Copyright (C) 1997,1998 by Lars Doelle + + Rewritten for QT4 by e_k , Copyright (C) 2008 + Rewritten for QT5/QML by Dmitry Zagnoyko , Copyright (C) 2013 + + 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. +*/ + +// Own +#include "Session.h" + +// Standard +#include +#include + +// Qt +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include "Pty.h" // REUSE THIS +//#include "kptyprocess.h" +#include "TerminalDisplay.h" +#include "ShellCommand.h" // REUSE THIS +#include "Vt102Emulation.h" // REUSE THIS + + +int Session::lastSessionId = 0; + +Session::Session() : + _shellProcess(0) + , _emulation(0) + , _monitorActivity(false) + , _monitorSilence(false) + , _notifiedActivity(false) + , _autoClose(true) + , _wantedClose(false) + , _silenceSeconds(10) + , _addToUtmp(false) // disabled by default because of a bug encountered on certain systems + // which caused Konsole to hang when closing a tab and then opening a new + // one. A 'QProcess destroyed while still running' warning was being + // printed to the terminal. Likely a problem in KPty::logout() + // or KPty::login() which uses a QProcess to start /usr/bin/utempter + , _flowControl(true) + , _fullScripting(false) + , _sessionId(0) +// , _zmodemBusy(false) +// , _zmodemProc(0) +// , _zmodemProgress(0) + , _hasDarkBackground(false) +{ + //prepare DBus communication +// new SessionAdaptor(this); + _sessionId = ++lastSessionId; +// QDBusConnection::sessionBus().registerObject(QLatin1String("/Sessions/")+QString::number(_sessionId), this); + + //create teletype for I/O with shell process + _shellProcess = new Pty(); + + //create emulation backend + _emulation = new Vt102Emulation(); + + connect( _emulation, SIGNAL( titleChanged( int, const QString & ) ), + this, SLOT( setUserTitle( int, const QString & ) ) ); + connect( _emulation, SIGNAL( stateSet(int) ), + this, SLOT( activityStateSet(int) ) ); +// connect( _emulation, SIGNAL( zmodemDetected() ), this , +// SLOT( fireZModemDetected() ) ); + connect( _emulation, SIGNAL( changeTabTextColorRequest( int ) ), + this, SIGNAL( changeTabTextColorRequest( int ) ) ); + connect( _emulation, SIGNAL(profileChangeCommandReceived(const QString &)), + this, SIGNAL( profileChangeCommandReceived(const QString &)) ); + // TODO + // connect( _emulation,SIGNAL(imageSizeChanged(int,int)) , this , + // SLOT(onEmulationSizeChange(int,int)) ); + + //connect teletype to emulation backend + _shellProcess->setUtf8Mode(_emulation->utf8()); + + connect( _shellProcess,SIGNAL(receivedData(const char *,int)),this, + SLOT(onReceiveBlock(const char *,int)) ); + connect( _emulation,SIGNAL(sendData(const char *,int)),_shellProcess, + SLOT(sendData(const char *,int)) ); + connect( _emulation,SIGNAL(lockPtyRequest(bool)),_shellProcess,SLOT(lockPty(bool)) ); + connect( _emulation,SIGNAL(useUtf8Request(bool)),_shellProcess,SLOT(setUtf8Mode(bool)) ); + + connect( _shellProcess,SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(done(int)) ); + // not in kprocess anymore connect( _shellProcess,SIGNAL(done(int)), this, SLOT(done(int)) ); + + //setup timer for monitoring session activity + _monitorTimer = new QTimer(this); + _monitorTimer->setSingleShot(true); + connect(_monitorTimer, SIGNAL(timeout()), this, SLOT(monitorTimerDone())); +} + +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 + + if ( _views.count() == 0 ) { + return 0; + } else { +// QQuickItem * window = _views.first(); + +// Q_ASSERT( window ); + +// while ( window->parentWidget() != 0 ) { +// window = window->parentWidget(); +// } + + return QGuiApplication::focusWindow()->winId(); + } +} + +void Session::setDarkBackground(bool darkBackground) +{ + _hasDarkBackground = darkBackground; +} +bool Session::hasDarkBackground() const +{ + return _hasDarkBackground; +} +bool Session::isRunning() const +{ + return _shellProcess->state() == QProcess::Running; +} + +void Session::setCodec(QTextCodec * codec) +{ + emulation()->setCodec(codec); +} + +void Session::setProgram(const QString & program) +{ + _program = ShellCommand::expand(program); +} +void Session::setInitialWorkingDirectory(const QString & dir) +{ + _initialWorkingDir = ShellCommand::expand(dir); +} +void Session::setArguments(const QStringList & arguments) +{ + _arguments = ShellCommand::expand(arguments); +} + +QList Session::views() const +{ + return _views; +} + +void Session::addView(KTerminalDisplay * widget) +{ + Q_ASSERT( !_views.contains(widget) ); + + _views.append(widget); + + if ( _emulation != 0 ) { + // connect emulation - view signals and slots + connect( widget , SIGNAL(keyPressedSignal(QKeyEvent *)) , _emulation , + SLOT(sendKeyEvent(QKeyEvent *)) ); +// connect( widget , SIGNAL(mouseSignal(int,int,int,int)) , _emulation , +// SLOT(sendMouseEvent(int,int,int,int)) ); +// connect( widget , SIGNAL(sendStringToEmu(const char *)) , _emulation , +// SLOT(sendString(const char *)) ); + + // allow emulation to notify view when the foreground process + // indicates whether or not it is interested in mouse signals +// connect( _emulation , SIGNAL(programUsesMouseChanged(bool)) , widget , +// SLOT(setUsesMouse(bool)) ); + + //widget->setUsesMouse( _emulation->programUsesMouse() ); + + widget->setScreenWindow(_emulation->createWindow()); + } + + //connect view signals and slots + QObject::connect( widget ,SIGNAL(changedContentSizeSignal(int,int)),this, + SLOT(onViewSizeChange(int,int))); + + QObject::connect( widget ,SIGNAL(destroyed(QObject *)) , this , + SLOT(viewDestroyed(QObject *)) ); +//slot for close + //QObject::connect(this, SIGNAL(finished()), widget, SLOT(close())); + +} + +void Session::viewDestroyed(QObject * view) +{ + KTerminalDisplay * display = (KTerminalDisplay *)view; + + Q_ASSERT( _views.contains(display) ); + + removeView(display); +} + +void Session::removeView(KTerminalDisplay * widget) +{ + _views.removeAll(widget); + + disconnect(widget,0,this,0); + + if ( _emulation != 0 ) { + // disconnect + // - key presses signals from widget + // - mouse activity signals from widget + // - string sending signals from widget + // + // ... and any other signals connected in addView() + disconnect( widget, 0, _emulation, 0); + + // disconnect state change signals emitted by emulation + disconnect( _emulation , 0 , widget , 0); + } + + // close the session automatically when the last view is removed + if ( _views.count() == 0 ) { + close(); + } +} + +void Session::run() +{ + //check that everything is in place to run the session +// if (_program.isEmpty()) { +// qDebug() << "Session::run() - program to run not set."; +// } +// else { +// qDebug() << "Session::run() - program:" << _program; +// } + +// if (_arguments.isEmpty()) { +// qDebug() << "Session::run() - no command line arguments specified."; +// } +// else { +// qDebug() << "Session::run() - arguments:" << _arguments; +// } + + // Upon a KPty error, there is no description on what that error was... + // Check to see if the given program is executable. + + + /* ok iam not exactly sure where _program comes from - however it was set to /bin/bash on my system + * Thats bad for BSD as its /usr/local/bin/bash there - its also bad for arch as its /usr/bin/bash there too! + * So i added a check to see if /bin/bash exists - if no then we use $SHELL - if that does not exist either, we fall back to /bin/sh + * As far as i know /bin/sh exists on every unix system.. You could also just put some ifdef __FREEBSD__ here but i think these 2 filechecks are worth + * their computing time on any system - especially with the problem on arch linux beeing there too. + */ + QString exec = QFile::encodeName(_program); + // if 'exec' is not specified, fall back to default shell. if that + // is not set then fall back to /bin/sh + + // here we expect full path. If there is no fullpath let's expect it's + // a custom shell (eg. python, etc.) available in the PATH. + if (exec.startsWith("/")) + { + QFile excheck(exec); + if ( exec.isEmpty() || !excheck.exists() ) { + exec = getenv("SHELL"); + } + excheck.setFileName(exec); + + if ( exec.isEmpty() || !excheck.exists() ) { + exec = "/bin/sh"; + } + } + + // _arguments sometimes contain ("") so isEmpty() + // or count() does not work as expected... + QString argsTmp(_arguments.join(" ").trimmed()); + QStringList arguments; + arguments << exec; + if (argsTmp.length()) + arguments << _arguments; + + QString cwd = QDir::currentPath(); + if (!_initialWorkingDir.isEmpty()) { + _shellProcess->setWorkingDirectory(_initialWorkingDir); + } else { + _shellProcess->setWorkingDirectory(cwd); + } + + _shellProcess->setFlowControlEnabled(_flowControl); + _shellProcess->setErase(_emulation->eraseChar()); + + // this is not strictly accurate use of the COLORFGBG variable. This does not + // tell the terminal exactly which colors are being used, but instead approximates + // the color scheme as "black on white" or "white on black" depending on whether + // the background color is deemed dark or not + QString backgroundColorHint = _hasDarkBackground ? "COLORFGBG=15;0" : "COLORFGBG=0;15"; + + /* if we do all the checking if this shell exists then we use it ;) + * Dont know about the arguments though.. maybe youll need some more checking im not sure + * However this works on Arch and FreeBSD now. + */ + int result = _shellProcess->start(exec, + arguments, + _environment << backgroundColorHint, + windowId(), + _addToUtmp); + + if (result < 0) { + qDebug() << "CRASHED! result: " << result; + return; + } + + _shellProcess->setWriteable(false); // We are reachable via kwrited. + //qDebug() << "started!"; + emit started(); +} + +void Session::setUserTitle( int what, const QString & caption ) +{ + //set to true if anything is actually changed (eg. old _nameTitle != new _nameTitle ) + bool modified = false; + + // (btw: what=0 changes _userTitle and icon, what=1 only icon, what=2 only _nameTitle + if ((what == 0) || (what == 2)) { + if ( _userTitle != caption ) { + _userTitle = caption; + modified = true; + } + } + + if ((what == 0) || (what == 1)) { + if ( _iconText != caption ) { + _iconText = caption; + modified = true; + } + } + + if (what == 11) { + QString colorString = caption.section(';',0,0); + qDebug() << __FILE__ << __LINE__ << ": setting background colour to " << colorString; + QColor backColor = QColor(colorString); + if (backColor.isValid()) { // change color via \033]11;Color\007 + if (backColor != _modifiedBackground) { + _modifiedBackground = backColor; + + // bail out here until the code to connect the terminal display + // to the changeBackgroundColor() signal has been written + // and tested - just so we don't forget to do this. + Q_ASSERT( 0 ); + + emit changeBackgroundColorRequest(backColor); + } + } + } + + if (what == 30) { + if ( _nameTitle != caption ) { + setTitle(Session::NameRole,caption); + return; + } + } + + if (what == 31) { + QString cwd=caption; + cwd=cwd.replace( QRegExp("^~"), QDir::homePath() ); + emit openUrlRequest(cwd); + } + + // change icon via \033]32;Icon\007 + if (what == 32) { + if ( _iconName != caption ) { + _iconName = caption; + + modified = true; + } + } + + if (what == 50) { + emit profileChangeCommandReceived(caption); + return; + } + + if ( modified ) { + emit titleChanged(); + } +} + +QString Session::userTitle() const +{ + return _userTitle; +} +void Session::setTabTitleFormat(TabTitleContext context , const QString & format) +{ + if ( context == LocalTabTitle ) { + _localTabTitleFormat = format; + } else if ( context == RemoteTabTitle ) { + _remoteTabTitleFormat = format; + } +} +QString Session::tabTitleFormat(TabTitleContext context) const +{ + if ( context == LocalTabTitle ) { + return _localTabTitleFormat; + } else if ( context == RemoteTabTitle ) { + return _remoteTabTitleFormat; + } + + return QString(); +} + +void Session::monitorTimerDone() +{ + //FIXME: The idea here is that the notification popup will appear to tell the user than output from + //the terminal has stopped and the popup will disappear when the user activates the session. + // + //This breaks with the addition of multiple views of a session. The popup should disappear + //when any of the views of the session becomes active + + + //FIXME: Make message text for this notification and the activity notification more descriptive. + if (_monitorSilence) { +// KNotification::event("Silence", ("Silence in session '%1'", _nameTitle), QPixmap(), +// QApplication::activeWindow(), +// KNotification::CloseWhenWidgetActivated); + emit stateChanged(NOTIFYSILENCE); + } else { + emit stateChanged(NOTIFYNORMAL); + } + + _notifiedActivity=false; +} + +void Session::activityStateSet(int state) +{ + if (state==NOTIFYBELL) { + QString s; + s.sprintf("Bell in session '%s'",_nameTitle.toLatin1().data()); + + emit bellRequest( s ); + } else if (state==NOTIFYACTIVITY) { + if (_monitorSilence) { + _monitorTimer->start(_silenceSeconds*1000); + } + + if ( _monitorActivity ) { + //FIXME: See comments in Session::monitorTimerDone() + if (!_notifiedActivity) { +// KNotification::event("Activity", ("Activity in session '%1'", _nameTitle), QPixmap(), +// QApplication::activeWindow(), +// KNotification::CloseWhenWidgetActivated); + _notifiedActivity=true; + } + } + } + + if ( state==NOTIFYACTIVITY && !_monitorActivity ) { + state = NOTIFYNORMAL; + } + if ( state==NOTIFYSILENCE && !_monitorSilence ) { + state = NOTIFYNORMAL; + } + + emit stateChanged(state); +} + +void Session::onViewSizeChange(int /*height*/, int /*width*/) +{ + updateTerminalSize(); +} +void Session::onEmulationSizeChange(int lines , int columns) +{ + setSize( QSize(lines,columns) ); +} + +void Session::updateTerminalSize() +{ + QListIterator viewIter(_views); + + int minLines = -1; + int minColumns = -1; + + // minimum number of lines and columns that views require for + // their size to be taken into consideration ( to avoid problems + // with new view widgets which haven't yet been set to their correct size ) + const int VIEW_LINES_THRESHOLD = 2; + const int VIEW_COLUMNS_THRESHOLD = 2; + + //select largest number of lines and columns that will fit in all visible views + while ( viewIter.hasNext() ) { + KTerminalDisplay * view = viewIter.next(); + if ( view->lines() >= VIEW_LINES_THRESHOLD && + view->columns() >= VIEW_COLUMNS_THRESHOLD ) { + minLines = (minLines == -1) ? view->lines() : qMin( minLines , view->lines() ); + minColumns = (minColumns == -1) ? view->columns() : qMin( minColumns , view->columns() ); + } + } + + // backend emulation must have a _terminal of at least 1 column x 1 line in size + if ( minLines > 0 && minColumns > 0 ) { + _emulation->setImageSize( minLines , minColumns ); + _shellProcess->setWindowSize( minLines , minColumns ); + } +} + +void Session::refresh() +{ + // attempt to get the shell process to redraw the display + // + // this requires the program running in the shell + // to cooperate by sending an update in response to + // a window size change + // + // the window size is changed twice, first made slightly larger and then + // resized back to its normal size so that there is actually a change + // in the window size (some shells do nothing if the + // new and old sizes are the same) + // + // if there is a more 'correct' way to do this, please + // send an email with method or patches to konsole-devel@kde.org + + const QSize existingSize = _shellProcess->windowSize(); + _shellProcess->setWindowSize(existingSize.height(),existingSize.width()+1); + _shellProcess->setWindowSize(existingSize.height(),existingSize.width()); +} + +bool Session::sendSignal(int signal) +{ + int result = ::kill(_shellProcess->pid(),signal); + + if ( result == 0 ) + { + _shellProcess->waitForFinished(); + return true; + } + else + return false; +} + +void Session::close() +{ + _autoClose = true; + _wantedClose = true; + if (!_shellProcess->isRunning() || !sendSignal(SIGHUP)) { + // Forced close. + QTimer::singleShot(1, this, SIGNAL(finished())); + } +} + +void Session::sendText(const QString &text) const +{ + _emulation->sendText(text); +} + +void Session::sendKey(QKeyEvent *key) +{ + _emulation->sendKeyEvent(key); +} + +Session::~Session() +{ + delete _emulation; + delete _shellProcess; +// delete _zmodemProc; +} + +void Session::setProfileKey(const QString & key) +{ + _profileKey = key; + emit profileChanged(key); +} +QString Session::profileKey() const +{ + return _profileKey; +} + +void Session::done(int exitStatus) +{ + if (!_autoClose) { + _userTitle = ("This session is done. Finished"); + emit titleChanged(); + return; + } + + QString message; + if (!_wantedClose || exitStatus != 0) { + + if (_shellProcess->exitStatus() == QProcess::NormalExit) { + message.sprintf("Session '%s' exited with status %d.", + _nameTitle.toLatin1().data(), exitStatus); + } else { + message.sprintf("Session '%s' crashed.", + _nameTitle.toLatin1().data()); + } + } + + if ( !_wantedClose && _shellProcess->exitStatus() != QProcess::NormalExit ) + message.sprintf("Session '%s' exited unexpectedly.", + _nameTitle.toLatin1().data()); + else + emit finished(); + +} + +Emulation * Session::emulation() const +{ + return _emulation; +} + +QString Session::keyBindings() const +{ + return _emulation->keyBindings(); +} + +QStringList Session::environment() const +{ + return _environment; +} + +void Session::setEnvironment(const QStringList & environment) +{ + _environment = environment; +} + +int Session::sessionId() const +{ + return _sessionId; +} + +void Session::setKeyBindings(const QString & id) +{ + _emulation->setKeyBindings(id); +} + +void Session::setTitle(TitleRole role , const QString & newTitle) +{ + if ( title(role) != newTitle ) { + if ( role == NameRole ) { + _nameTitle = newTitle; + } else if ( role == DisplayedTitleRole ) { + _displayTitle = newTitle; + } + + emit titleChanged(); + } +} + +QString Session::title(TitleRole role) const +{ + if ( role == NameRole ) { + return _nameTitle; + } else if ( role == DisplayedTitleRole ) { + return _displayTitle; + } else { + return QString(); + } +} + +void Session::setIconName(const QString & iconName) +{ + if ( iconName != _iconName ) { + _iconName = iconName; + emit titleChanged(); + } +} + +void Session::setIconText(const QString & iconText) +{ + _iconText = iconText; + //kDebug(1211)<<"Session setIconText " << _iconText; +} + +QString Session::iconName() const +{ + return _iconName; +} + +QString Session::iconText() const +{ + return _iconText; +} + +void Session::setHistoryType(const HistoryType & hType) +{ + _emulation->setHistory(hType); +} + +const HistoryType & Session::historyType() const +{ + return _emulation->history(); +} + +void Session::clearHistory() +{ + _emulation->clearHistory(); +} + +QStringList Session::arguments() const +{ + return _arguments; +} + +QString Session::program() const +{ + return _program; +} + +// unused currently +bool Session::isMonitorActivity() const +{ + return _monitorActivity; +} +// unused currently +bool Session::isMonitorSilence() const +{ + return _monitorSilence; +} + +void Session::setMonitorActivity(bool _monitor) +{ + _monitorActivity=_monitor; + _notifiedActivity=false; + + activityStateSet(NOTIFYNORMAL); +} + +void Session::setMonitorSilence(bool _monitor) +{ + if (_monitorSilence==_monitor) { + return; + } + + _monitorSilence=_monitor; + if (_monitorSilence) { + _monitorTimer->start(_silenceSeconds*1000); + } else { + _monitorTimer->stop(); + } + + activityStateSet(NOTIFYNORMAL); +} + +void Session::setMonitorSilenceSeconds(int seconds) +{ + _silenceSeconds=seconds; + if (_monitorSilence) { + _monitorTimer->start(_silenceSeconds*1000); + } +} + +void Session::setAddToUtmp(bool set) +{ + _addToUtmp = set; +} + +void Session::setFlowControlEnabled(bool enabled) +{ + if (_flowControl == enabled) { + return; + } + + _flowControl = enabled; + + if (_shellProcess) { + _shellProcess->setFlowControlEnabled(_flowControl); + } + + emit flowControlEnabledChanged(enabled); +} +bool Session::flowControlEnabled() const +{ + return _flowControl; +} +//void Session::fireZModemDetected() +//{ +// if (!_zmodemBusy) +// { +// QTimer::singleShot(10, this, SIGNAL(zmodemDetected())); +// _zmodemBusy = true; +// } +//} + +//void Session::cancelZModem() +//{ +// _shellProcess->sendData("\030\030\030\030", 4); // Abort +// _zmodemBusy = false; +//} + +//void Session::startZModem(const QString &zmodem, const QString &dir, const QStringList &list) +//{ +// _zmodemBusy = true; +// _zmodemProc = new KProcess(); +// _zmodemProc->setOutputChannelMode( KProcess::SeparateChannels ); +// +// *_zmodemProc << zmodem << "-v" << list; +// +// if (!dir.isEmpty()) +// _zmodemProc->setWorkingDirectory(dir); +// +// _zmodemProc->start(); +// +// connect(_zmodemProc,SIGNAL (readyReadStandardOutput()), +// this, SLOT(zmodemReadAndSendBlock())); +// connect(_zmodemProc,SIGNAL (readyReadStandardError()), +// this, SLOT(zmodemReadStatus())); +// connect(_zmodemProc,SIGNAL (finished(int,QProcess::ExitStatus)), +// this, SLOT(zmodemFinished())); +// +// disconnect( _shellProcess,SIGNAL(block_in(const char*,int)), this, SLOT(onReceiveBlock(const char*,int)) ); +// connect( _shellProcess,SIGNAL(block_in(const char*,int)), this, SLOT(zmodemRcvBlock(const char*,int)) ); +// +// _zmodemProgress = new ZModemDialog(QApplication::activeWindow(), false, +// i18n("ZModem Progress")); +// +// connect(_zmodemProgress, SIGNAL(user1Clicked()), +// this, SLOT(zmodemDone())); +// +// _zmodemProgress->show(); +//} + +/*void Session::zmodemReadAndSendBlock() +{ + _zmodemProc->setReadChannel( QProcess::StandardOutput ); + QByteArray data = _zmodemProc->readAll(); + + if ( data.count() == 0 ) + return; + + _shellProcess->sendData(data.constData(),data.count()); +} +*/ +/* +void Session::zmodemReadStatus() +{ + _zmodemProc->setReadChannel( QProcess::StandardError ); + QByteArray msg = _zmodemProc->readAll(); + while(!msg.isEmpty()) + { + int i = msg.indexOf('\015'); + int j = msg.indexOf('\012'); + QByteArray txt; + if ((i != -1) && ((j == -1) || (i < j))) + { + msg = msg.mid(i+1); + } + else if (j != -1) + { + txt = msg.left(j); + msg = msg.mid(j+1); + } + else + { + txt = msg; + msg.truncate(0); + } + if (!txt.isEmpty()) + _zmodemProgress->addProgressText(QString::fromLocal8Bit(txt)); + } +} +*/ +/* +void Session::zmodemRcvBlock(const char *data, int len) +{ + QByteArray ba( data, len ); + + _zmodemProc->write( ba ); +} +*/ +/* +void Session::zmodemFinished() +{ + if (_zmodemProc) + { + delete _zmodemProc; + _zmodemProc = 0; + _zmodemBusy = false; + + disconnect( _shellProcess,SIGNAL(block_in(const char*,int)), this ,SLOT(zmodemRcvBlock(const char*,int)) ); + connect( _shellProcess,SIGNAL(block_in(const char*,int)), this, SLOT(onReceiveBlock(const char*,int)) ); + + _shellProcess->sendData("\030\030\030\030", 4); // Abort + _shellProcess->sendData("\001\013\n", 3); // Try to get prompt back + _zmodemProgress->transferDone(); + } +} +*/ +void Session::onReceiveBlock( const char * buf, int len ) +{ + _emulation->receiveData( buf, len ); + emit receivedData( QString::fromLatin1( buf, len ) ); +} + +QSize Session::size() +{ + return _emulation->imageSize(); +} + +void Session::setSize(const QSize & size) +{ + if ((size.width() <= 1) || (size.height() <= 1)) { + return; + } + + emit resizeRequest(size); +} +int Session::foregroundProcessId() const +{ + return _shellProcess->foregroundProcessGroup(); +} +int Session::processId() const +{ + return _shellProcess->pid(); +} + +SessionGroup::SessionGroup() + : _masterMode(0) +{ +} +SessionGroup::~SessionGroup() +{ + // disconnect all + connectAll(false); +} +int SessionGroup::masterMode() const +{ + return _masterMode; +} +QList SessionGroup::sessions() const +{ + return _sessions.keys(); +} +bool SessionGroup::masterStatus(Session * session) const +{ + return _sessions[session]; +} + +void SessionGroup::addSession(Session * session) +{ + _sessions.insert(session,false); + + QListIterator masterIter(masters()); + + while ( masterIter.hasNext() ) { + connectPair(masterIter.next(),session); + } +} +void SessionGroup::removeSession(Session * session) +{ + setMasterStatus(session,false); + + QListIterator masterIter(masters()); + + while ( masterIter.hasNext() ) { + disconnectPair(masterIter.next(),session); + } + + _sessions.remove(session); +} +void SessionGroup::setMasterMode(int mode) +{ + _masterMode = mode; + + connectAll(false); + connectAll(true); +} +QList SessionGroup::masters() const +{ + return _sessions.keys(true); +} +void SessionGroup::connectAll(bool connect) +{ + QListIterator masterIter(masters()); + + while ( masterIter.hasNext() ) { + Session * master = masterIter.next(); + + QListIterator otherIter(_sessions.keys()); + while ( otherIter.hasNext() ) { + Session * other = otherIter.next(); + + if ( other != master ) { + if ( connect ) { + connectPair(master,other); + } else { + disconnectPair(master,other); + } + } + } + } +} +void SessionGroup::setMasterStatus(Session * session, bool master) +{ + bool wasMaster = _sessions[session]; + _sessions[session] = master; + + if ((!wasMaster && !master) + || (wasMaster && master)) { + return; + } + + QListIterator iter(_sessions.keys()); + while (iter.hasNext()) { + Session * other = iter.next(); + + if (other != session) { + if (master) { + connectPair(session, other); + } else { + disconnectPair(session, other); + } + } + } +} + +void SessionGroup::connectPair(Session * master , Session * other) +{ +// qDebug() << k_funcinfo; + + if ( _masterMode & CopyInputToAll ) { + qDebug() << "Connection session " << master->nameTitle() << "to" << other->nameTitle(); + + connect( master->emulation() , SIGNAL(sendData(const char *,int)) , other->emulation() , + SLOT(sendString(const char *,int)) ); + } +} +void SessionGroup::disconnectPair(Session * master , Session * other) +{ +// qDebug() << k_funcinfo; + + if ( _masterMode & CopyInputToAll ) { + qDebug() << "Disconnecting session " << master->nameTitle() << "from" << other->nameTitle(); + + disconnect( master->emulation() , SIGNAL(sendData(const char *,int)) , other->emulation() , + SLOT(sendString(const char *,int)) ); + } +} + +//#include "moc_Session.cpp" diff --git a/konsole-qml-plugin/src/Session.h b/konsole-qml-plugin/src/Session.h new file mode 100644 index 0000000..dfd5064 --- /dev/null +++ b/konsole-qml-plugin/src/Session.h @@ -0,0 +1,626 @@ +/* + This file is part of Konsole, an X terminal. + + Copyright (C) 2007 by Robert Knight + Copyright (C) 1997,1998 by Lars Doelle + + Rewritten for QT4 by e_k , Copyright (C) 2008 + Rewritten for QT5/QML by Dmitry Zagnoyko , Copyright (C) 2013 + + 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. +*/ + +#ifndef SESSION_H +#define SESSION_H + + +#include + +#include +#include + +#include "History.h" + +class KProcess; + + +class Emulation; +class Pty; +class KTerminalDisplay; +//class ZModemDialog; + +/** + * Represents a terminal session consisting of a pseudo-teletype and a terminal emulation. + * The pseudo-teletype (or PTY) handles I/O between the terminal process and Konsole. + * The terminal emulation ( Emulation and subclasses ) processes the output stream from the + * PTY and produces a character image which is then shown on views connected to the session. + * + * Each Session can be connected to one or more views by using the addView() method. + * The attached views can then display output from the program running in the terminal + * or send input to the program in the terminal in the form of keypresses and mouse + * activity. + */ +class Session : public QObject { + Q_OBJECT + +public: + Q_PROPERTY(QString name READ nameTitle) + Q_PROPERTY(int processId READ processId) + Q_PROPERTY(QString keyBindings READ keyBindings WRITE setKeyBindings) + Q_PROPERTY(QSize size READ size WRITE setSize) + + /** + * Constructs a new session. + * + * To start the terminal process, call the run() method, + * after specifying the program and arguments + * using setProgram() and setArguments() + * + * If no program or arguments are specified explicitly, the Session + * falls back to using the program specified in the SHELL environment + * variable. + */ + Session(); + ~Session(); + + /** + * Returns true if the session is currently running. This will be true + * after run() has been called successfully. + */ + bool isRunning() const; + + /** + * Sets the profile associated with this session. + * + * @param profileKey A key which can be used to obtain the current + * profile settings from the SessionManager + */ + void setProfileKey(const QString & profileKey); + /** + * Returns the profile key associated with this session. + * This can be passed to the SessionManager to obtain the current + * profile settings. + */ + QString profileKey() const; + + /** + * Adds a new view for this session. + * + * The viewing widget will display the output from the terminal and + * input from the viewing widget (key presses, mouse activity etc.) + * will be sent to the terminal. + * + * Views can be removed using removeView(). The session is automatically + * closed when the last view is removed. + */ + void addView(KTerminalDisplay * widget); + /** + * Removes a view from this session. When the last view is removed, + * the session will be closed automatically. + * + * @p widget will no longer display output from or send input + * to the terminal + */ + void removeView(KTerminalDisplay * widget); + + /** + * Returns the views connected to this session + */ + QList views() const; + + /** + * Returns the terminal emulation instance being used to encode / decode + * characters to / from the process. + */ + Emulation * emulation() const; + + /** + * Returns the environment of this session as a list of strings like + * VARIABLE=VALUE + */ + QStringList environment() const; + /** + * Sets the environment for this session. + * @p environment should be a list of strings like + * VARIABLE=VALUE + */ + void setEnvironment(const QStringList & environment); + + /** Returns the unique ID for this session. */ + int sessionId() const; + + /** + * Return the session title set by the user (ie. the program running + * in the terminal), or an empty string if the user has not set a custom title + */ + QString userTitle() const; + + /** + * This enum describes the contexts for which separate + * tab title formats may be specified. + */ + enum TabTitleContext { + /** Default tab title format */ + LocalTabTitle, + /** + * Tab title format used session currently contains + * a connection to a remote computer (via SSH) + */ + RemoteTabTitle + }; + /** + * Sets the format used by this session for tab titles. + * + * @param context The context whoose format should be set. + * @param format The tab title format. This may be a mixture + * of plain text and dynamic elements denoted by a '%' character + * followed by a letter. (eg. %d for directory). The dynamic + * elements available depend on the @p context + */ + void setTabTitleFormat(TabTitleContext context , const QString & format); + /** Returns the format used by this session for tab titles. */ + QString tabTitleFormat(TabTitleContext context) const; + + + /** Returns the arguments passed to the shell process when run() is called. */ + QStringList arguments() const; + /** Returns the program name of the shell process started when run() is called. */ + QString program() const; + + /** + * Sets the command line arguments which the session's program will be passed when + * run() is called. + */ + void setArguments(const QStringList & arguments); + /** Sets the program to be executed when run() is called. */ + void setProgram(const QString & program); + + /** Returns the session's current working directory. */ + QString initialWorkingDirectory() { + return _initialWorkingDir; + } + + /** + * Sets the initial working directory for the session when it is run + * This has no effect once the session has been started. + */ + void setInitialWorkingDirectory( const QString & dir ); + + /** + * Sets the type of history store used by this session. + * Lines of output produced by the terminal are added + * to the history store. The type of history store + * used affects the number of lines which can be + * remembered before they are lost and the storage + * (in memory, on-disk etc.) used. + */ + void setHistoryType(const HistoryType & type); + /** + * Returns the type of history store used by this session. + */ + const HistoryType & historyType() const; + /** + * Clears the history store used by this session. + */ + void clearHistory(); + + /** + * Enables monitoring for activity in the session. + * This will cause notifySessionState() to be emitted + * with the NOTIFYACTIVITY state flag when output is + * received from the terminal. + */ + void setMonitorActivity(bool); + /** Returns true if monitoring for activity is enabled. */ + bool isMonitorActivity() const; + + /** + * Enables monitoring for silence in the session. + * This will cause notifySessionState() to be emitted + * with the NOTIFYSILENCE state flag when output is not + * received from the terminal for a certain period of + * time, specified with setMonitorSilenceSeconds() + */ + void setMonitorSilence(bool); + /** + * Returns true if monitoring for inactivity (silence) + * in the session is enabled. + */ + bool isMonitorSilence() const; + /** See setMonitorSilence() */ + void setMonitorSilenceSeconds(int seconds); + + /** + * Sets the key bindings used by this session. The bindings + * specify how input key sequences are translated into + * the character stream which is sent to the terminal. + * + * @param id The name of the key bindings to use. The + * names of available key bindings can be determined using the + * KeyboardTranslatorManager class. + */ + void setKeyBindings(const QString & id); + /** Returns the name of the key bindings used by this session. */ + QString keyBindings() const; + + /** + * This enum describes the available title roles. + */ + enum TitleRole { + /** The name of the session. */ + NameRole, + /** The title of the session which is displayed in tabs etc. */ + DisplayedTitleRole + }; + + /** Sets the session's title for the specified @p role to @p title. */ + void setTitle(TitleRole role , const QString & title); + /** Returns the session's title for the specified @p role. */ + QString title(TitleRole role) const; + /** Convenience method used to read the name property. Returns title(Session::NameRole). */ + QString nameTitle() const { + return title(Session::NameRole); + } + + /** Sets the name of the icon associated with this session. */ + void setIconName(const QString & iconName); + /** Returns the name of the icon associated with this session. */ + QString iconName() const; + + /** Sets the text of the icon associated with this session. */ + void setIconText(const QString & iconText); + /** Returns the text of the icon associated with this session. */ + QString iconText() const; + + /** Specifies whether a utmp entry should be created for the pty used by this session. */ + void setAddToUtmp(bool); + + /** Sends the specified @p signal to the terminal process. */ + bool sendSignal(int signal); + + /** + * Specifies whether to close the session automatically when the terminal + * process terminates. + */ + void setAutoClose(bool b) { + _autoClose = b; + } + + /** + * Sets whether flow control is enabled for this terminal + * session. + */ + void setFlowControlEnabled(bool enabled); + + /** Returns whether flow control is enabled for this terminal session. */ + bool flowControlEnabled() const; + + /** + * Sends @p text to the current foreground terminal program. + */ + void sendText(const QString &text) const; + + /** + * Sends @p QKeyEvent to the current foreground terminal program. + */ + void sendKey(QKeyEvent *key); + + /** + * Returns the process id of the terminal process. + * This is the id used by the system API to refer to the process. + */ + int processId() const; + + /** + * Returns the process id of the terminal's foreground process. + * This is initially the same as processId() but can change + * as the user starts other programs inside the terminal. + */ + int foregroundProcessId() const; + + /** Returns the terminal session's window size in lines and columns. */ + QSize size(); + /** + * Emits a request to resize the session to accommodate + * the specified window size. + * + * @param size The size in lines and columns to request. + */ + void setSize(const QSize & size); + + /** Sets the text codec used by this session's terminal emulation. */ + void setCodec(QTextCodec * codec); + + /** + * Sets whether the session has a dark background or not. The session + * uses this information to set the COLORFGBG variable in the process's + * environment, which allows the programs running in the terminal to determine + * whether the background is light or dark and use appropriate colors by default. + * + * This has no effect once the session is running. + */ + void setDarkBackground(bool darkBackground); + /** + * Returns true if the session has a dark background. + * See setDarkBackground() + */ + bool hasDarkBackground() const; + + /** + * Attempts to get the shell program to redraw the current display area. + * This can be used after clearing the screen, for example, to get the + * shell to redraw the prompt line. + */ + void refresh(); + +// void startZModem(const QString &rz, const QString &dir, const QStringList &list); +// void cancelZModem(); +// bool isZModemBusy() { return _zmodemBusy; } + +public slots: + + /** + * Starts the terminal session. + * + * This creates the terminal process and connects the teletype to it. + */ + void run(); + + /** + * Closes the terminal session. This sends a hangup signal + * (SIGHUP) to the terminal process and causes the done(Session*) + * signal to be emitted. + */ + void close(); + + /** + * Changes the session title or other customizable aspects of the terminal + * emulation display. For a list of what may be changed see the + * Emulation::titleChanged() signal. + */ + void setUserTitle( int, const QString & caption ); + +signals: + + /** Emitted when the terminal process starts. */ + void started(); + + /** + * Emitted when the terminal process exits. + */ + void finished(); + + /** + * Emitted when output is received from the terminal process. + */ + void receivedData( const QString & text ); + + /** Emitted when the session's title has changed. */ + void titleChanged(); + + /** Emitted when the session's profile has changed. */ + void profileChanged(const QString & profile); + + /** + * Emitted when the activity state of this session changes. + * + * @param state The new state of the session. This may be one + * of NOTIFYNORMAL, NOTIFYSILENCE or NOTIFYACTIVITY + */ + void stateChanged(int state); + + /** Emitted when a bell event occurs in the session. */ + void bellRequest( const QString & message ); + + /** + * Requests that the color the text for any tabs associated with + * this session should be changed; + * + * TODO: Document what the parameter does + */ + void changeTabTextColorRequest(int); + + /** + * Requests that the background color of views on this session + * should be changed. + */ + void changeBackgroundColorRequest(const QColor &); + + /** TODO: Document me. */ + void openUrlRequest(const QString & url); + + /** TODO: Document me. */ +// void zmodemDetected(); + + /** + * Emitted when the terminal process requests a change + * in the size of the terminal window. + * + * @param size The requested window size in terms of lines and columns. + */ + void resizeRequest(const QSize & size); + + /** + * Emitted when a profile change command is received from the terminal. + * + * @param text The text of the command. This is a string of the form + * "PropertyName=Value;PropertyName=Value ..." + */ + void profileChangeCommandReceived(const QString & text); + + /** + * Emitted when the flow control state changes. + * + * @param enabled True if flow control is enabled or false otherwise. + */ + void flowControlEnabledChanged(bool enabled); + +private slots: + void done(int); + +// void fireZModemDetected(); + + void onReceiveBlock( const char * buffer, int len ); + void monitorTimerDone(); + + void onViewSizeChange(int height, int width); + void onEmulationSizeChange(int lines , int columns); + + void activityStateSet(int); + + //automatically detach views from sessions when view is destroyed + void viewDestroyed(QObject * view); + +// void zmodemReadStatus(); +// void zmodemReadAndSendBlock(); +// void zmodemRcvBlock(const char *data, int len); +// void zmodemFinished(); + +private: + + void updateTerminalSize(); + WId windowId() const; + + int _uniqueIdentifier; + + Pty *_shellProcess; + Emulation * _emulation; + + QList _views; + + bool _monitorActivity; + bool _monitorSilence; + bool _notifiedActivity; + bool _masterMode; + bool _autoClose; + bool _wantedClose; + QTimer * _monitorTimer; + + int _silenceSeconds; + + QString _nameTitle; + QString _displayTitle; + QString _userTitle; + + QString _localTabTitleFormat; + QString _remoteTabTitleFormat; + + QString _iconName; + QString _iconText; // as set by: echo -en '\033]1;IconText\007 + bool _addToUtmp; + bool _flowControl; + bool _fullScripting; + + QString _program; + QStringList _arguments; + + QStringList _environment; + int _sessionId; + + QString _initialWorkingDir; + + // ZModem +// bool _zmodemBusy; +// KProcess* _zmodemProc; +// ZModemDialog* _zmodemProgress; + + // Color/Font Changes by ESC Sequences + + QColor _modifiedBackground; // as set by: echo -en '\033]11;Color\007 + + QString _profileKey; + + bool _hasDarkBackground; + + static int lastSessionId; + +}; + +/** + * Provides a group of sessions which is divided into master and slave sessions. + * Activity in master sessions can be propagated to all sessions within the group. + * The type of activity which is propagated and method of propagation is controlled + * by the masterMode() flags. + */ +class SessionGroup : public QObject { + Q_OBJECT + +public: + /** Constructs an empty session group. */ + SessionGroup(); + /** Destroys the session group and removes all connections between master and slave sessions. */ + ~SessionGroup(); + + /** Adds a session to the group. */ + void addSession( Session * session ); + /** Removes a session from the group. */ + void removeSession( Session * session ); + + /** Returns the list of sessions currently in the group. */ + QList sessions() const; + + /** + * Sets whether a particular session is a master within the group. + * Changes or activity in the group's master sessions may be propagated + * to all the sessions in the group, depending on the current masterMode() + * + * @param session The session whoose master status should be changed. + * @param master True to make this session a master or false otherwise + */ + void setMasterStatus( Session * session , bool master ); + /** Returns the master status of a session. See setMasterStatus() */ + bool masterStatus( Session * session ) const; + + /** + * This enum describes the options for propagating certain activity or + * changes in the group's master sessions to all sessions in the group. + */ + enum MasterMode { + /** + * Any input key presses in the master sessions are sent to all + * sessions in the group. + */ + CopyInputToAll = 1 + }; + + /** + * Specifies which activity in the group's master sessions is propagated + * to all sessions in the group. + * + * @param mode A bitwise OR of MasterMode flags. + */ + void setMasterMode( int mode ); + /** + * Returns a bitwise OR of the active MasterMode flags for this group. + * See setMasterMode() + */ + int masterMode() const; + +private: + void connectPair(Session * master , Session * other); + void disconnectPair(Session * master , Session * other); + void connectAll(bool connect); + QList masters() const; + + // maps sessions to their master status + QHash _sessions; + + int _masterMode; +}; + + + +#endif diff --git a/konsole-qml-plugin/src/ShellCommand.cpp b/konsole-qml-plugin/src/ShellCommand.cpp new file mode 100644 index 0000000..802ae1e --- /dev/null +++ b/konsole-qml-plugin/src/ShellCommand.cpp @@ -0,0 +1,167 @@ +/* + Copyright (C) 2007 by Robert Knight + + Rewritten for QT4 by e_k , Copyright (C)2008 + + 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. +*/ + +// Own +#include "ShellCommand.h" + +//some versions of gcc(4.3) require explicit include +#include + + +// expands environment variables in 'text' +// function copied from kdelibs/kio/kio/kurlcompletion.cpp +static bool expandEnv(QString & text); + +ShellCommand::ShellCommand(const QString & fullCommand) +{ + bool inQuotes = false; + + QString builder; + + for ( int i = 0 ; i < fullCommand.count() ; i++ ) { + QChar ch = fullCommand[i]; + + const bool isLastChar = ( i == fullCommand.count() - 1 ); + const bool isQuote = ( ch == '\'' || ch == '\"' ); + + if ( !isLastChar && isQuote ) { + inQuotes = !inQuotes; + } else { + if ( (!ch.isSpace() || inQuotes) && !isQuote ) { + builder.append(ch); + } + + if ( (ch.isSpace() && !inQuotes) || ( i == fullCommand.count()-1 ) ) { + _arguments << builder; + builder.clear(); + } + } + } +} +ShellCommand::ShellCommand(const QString & command , const QStringList & arguments) +{ + _arguments = arguments; + + if ( !_arguments.isEmpty() ) { + _arguments[0] == command; + } +} +QString ShellCommand::fullCommand() const +{ + return _arguments.join(QChar(' ')); +} +QString ShellCommand::command() const +{ + if ( !_arguments.isEmpty() ) { + return _arguments[0]; + } else { + return QString(); + } +} +QStringList ShellCommand::arguments() const +{ + return _arguments; +} +bool ShellCommand::isRootCommand() const +{ + Q_ASSERT(0); // not implemented yet + return false; +} +bool ShellCommand::isAvailable() const +{ + Q_ASSERT(0); // not implemented yet + return false; +} +QStringList ShellCommand::expand(const QStringList & items) +{ + QStringList result; + + foreach( QString item , items ) + result << expand(item); + + return result; +} +QString ShellCommand::expand(const QString & text) +{ + QString result = text; + expandEnv(result); + return result; +} + +/* + * expandEnv + * + * Expand environment variables in text. Escaped '$' characters are ignored. + * Return true if any variables were expanded + */ +static bool expandEnv( QString & text ) +{ + // Find all environment variables beginning with '$' + // + int pos = 0; + + bool expanded = false; + + while ( (pos = text.indexOf(QLatin1Char('$'), pos)) != -1 ) { + + // Skip escaped '$' + // + if ( pos > 0 && text.at(pos-1) == QLatin1Char('\\') ) { + pos++; + } + // Variable found => expand + // + else { + // Find the end of the variable = next '/' or ' ' + // + int pos2 = text.indexOf( QLatin1Char(' '), pos+1 ); + int pos_tmp = text.indexOf( QLatin1Char('/'), pos+1 ); + + if ( pos2 == -1 || (pos_tmp != -1 && pos_tmp < pos2) ) { + pos2 = pos_tmp; + } + + if ( pos2 == -1 ) { + pos2 = text.length(); + } + + // Replace if the variable is terminated by '/' or ' ' + // and defined + // + if ( pos2 >= 0 ) { + int len = pos2 - pos; + QString key = text.mid( pos+1, len-1); + QString value = + QString::fromLocal8Bit( ::getenv(key.toLocal8Bit()) ); + + if ( !value.isEmpty() ) { + expanded = true; + text.replace( pos, len, value ); + pos = pos + value.length(); + } else { + pos = pos2; + } + } + } + } + + return expanded; +} diff --git a/konsole-qml-plugin/src/ShellCommand.h b/konsole-qml-plugin/src/ShellCommand.h new file mode 100644 index 0000000..7af91a3 --- /dev/null +++ b/konsole-qml-plugin/src/ShellCommand.h @@ -0,0 +1,90 @@ +/* + Copyright (C) 2007 by Robert Knight + + Rewritten for QT4 by e_k , Copyright (C)2008 + + 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. +*/ + +#ifndef SHELLCOMMAND_H +#define SHELLCOMMAND_H + +// Qt +#include + + +/** + * A class to parse and extract information about shell commands. + * + * ShellCommand can be used to: + * + *
    + *
  • Take a command-line (eg "/bin/sh -c /path/to/my/script") and split it + * into its component parts (eg. the command "/bin/sh" and the arguments + * "-c","/path/to/my/script") + *
  • + *
  • Take a command and a list of arguments and combine them to + * form a complete command line. + *
  • + *
  • Determine whether the binary specified by a command exists in the + * user's PATH. + *
  • + *
  • Determine whether a command-line specifies the execution of + * another command as the root user using su/sudo etc. + *
  • + *
+ */ +class ShellCommand { +public: + /** + * Constructs a ShellCommand from a command line. + * + * @param fullCommand The command line to parse. + */ + ShellCommand(const QString & fullCommand); + /** + * Constructs a ShellCommand with the specified @p command and @p arguments. + */ + ShellCommand(const QString & command , const QStringList & arguments); + + /** Returns the command. */ + QString command() const; + /** Returns the arguments. */ + QStringList arguments() const; + + /** + * Returns the full command line. + */ + QString fullCommand() const; + + /** Returns true if this is a root command. */ + bool isRootCommand() const; + /** Returns true if the program specified by @p command() exists. */ + bool isAvailable() const; + + /** Expands environment variables in @p text .*/ + static QString expand(const QString & text); + + /** Expands environment variables in each string in @p list. */ + static QStringList expand(const QStringList & items); + +private: + QStringList _arguments; +}; + + +#endif // SHELLCOMMAND_H + diff --git a/konsole-qml-plugin/src/TerminalCharacterDecoder.cpp b/konsole-qml-plugin/src/TerminalCharacterDecoder.cpp new file mode 100644 index 0000000..3e6ecac --- /dev/null +++ b/konsole-qml-plugin/src/TerminalCharacterDecoder.cpp @@ -0,0 +1,251 @@ +/* + This file is part of Konsole, an X terminal. + + Copyright 2006-2008 by Robert Knight + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser 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 Lesser 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. +*/ + +// Own +#include "TerminalCharacterDecoder.h" + +// Qt +#include + +// KDE +//#include + +// Konsole +#include "konsole_wcwidth.h" + + +PlainTextDecoder::PlainTextDecoder() + : _output(0) + , _includeTrailingWhitespace(true) + , _recordLinePositions(false) +{ + +} +void PlainTextDecoder::setTrailingWhitespace(bool enable) +{ + _includeTrailingWhitespace = enable; +} +bool PlainTextDecoder::trailingWhitespace() const +{ + return _includeTrailingWhitespace; +} +void PlainTextDecoder::begin(QTextStream* output) +{ + _output = output; + if (!_linePositions.isEmpty()) + _linePositions.clear(); +} +void PlainTextDecoder::end() +{ + _output = 0; +} + +void PlainTextDecoder::setRecordLinePositions(bool record) +{ + _recordLinePositions = record; +} +QList PlainTextDecoder::linePositions() const +{ + return _linePositions; +} +void PlainTextDecoder::decodeLine(const Character* const characters, int count, LineProperty /*properties*/ + ) +{ + Q_ASSERT( _output ); + + if (_recordLinePositions && _output->string()) + { + int pos = _output->string()->count(); + _linePositions << pos; + } + + //TODO should we ignore or respect the LINE_WRAPPED line property? + + //note: we build up a QString and send it to the text stream rather writing into the text + //stream a character at a time because it is more efficient. + //(since QTextStream always deals with QStrings internally anyway) + QString plainText; + plainText.reserve(count); + + int outputCount = count; + + // if inclusion of trailing whitespace is disabled then find the end of the + // line + if ( !_includeTrailingWhitespace ) + { + for (int i = count-1 ; i >= 0 ; i--) + { + if ( characters[i].character != ' ' ) + break; + else + outputCount--; + } + } + + for (int i=0;i') + text.append(">"); + else + text.append(ch); + } + else + { + text.append(" "); //HTML truncates multiple spaces, so use a space marker instead + } + + } + + //close any remaining open inner spans + if ( _innerSpanOpen ) + closeSpan(text); + + //start new line + text.append("
"); + + *_output << text; +} +void HTMLDecoder::openSpan(QString& text , const QString& style) +{ + text.append( QString("").arg(style) ); +} + +void HTMLDecoder::closeSpan(QString& text) +{ + text.append(""); +} + +void HTMLDecoder::setColorTable(const ColorEntry* table) +{ + _colorTable = table; +} diff --git a/konsole-qml-plugin/src/TerminalCharacterDecoder.h b/konsole-qml-plugin/src/TerminalCharacterDecoder.h new file mode 100644 index 0000000..ac605fd --- /dev/null +++ b/konsole-qml-plugin/src/TerminalCharacterDecoder.h @@ -0,0 +1,148 @@ +/* + This file is part of Konsole, an X terminal. + + Copyright 2006-2008 by Robert Knight + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser 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 Lesser 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. +*/ + +#ifndef TERMINAL_CHARACTER_DECODER_H +#define TERMINAL_CHARACTER_DECODER_H + +#include "Character.h" + +#include + +class QTextStream; + + + +/** + * Base class for terminal character decoders + * + * The decoder converts lines of terminal characters which consist of a unicode character, foreground + * and background colours and other appearance-related properties into text strings. + * + * Derived classes may produce either plain text with no other colour or appearance information, or + * they may produce text which incorporates these additional properties. + */ +class TerminalCharacterDecoder +{ +public: + virtual ~TerminalCharacterDecoder() {} + + /** Begin decoding characters. The resulting text is appended to @p output. */ + virtual void begin(QTextStream* output) = 0; + /** End decoding. */ + virtual void end() = 0; + + /** + * Converts a line of terminal characters with associated properties into a text string + * and writes the string into an output QTextStream. + * + * @param characters An array of characters of length @p count. + * @param count The number of characters + * @param properties Additional properties which affect all characters in the line + */ + virtual void decodeLine(const Character* const characters, + int count, + LineProperty properties) = 0; +}; + +/** + * A terminal character decoder which produces plain text, ignoring colours and other appearance-related + * properties of the original characters. + */ +class PlainTextDecoder : public TerminalCharacterDecoder +{ +public: + PlainTextDecoder(); + + /** + * Set whether trailing whitespace at the end of lines should be included + * in the output. + * Defaults to true. + */ + void setTrailingWhitespace(bool enable); + /** + * Returns whether trailing whitespace at the end of lines is included + * in the output. + */ + bool trailingWhitespace() const; + /** + * Returns of character positions in the output stream + * at which new lines where added. Returns an empty if setTrackLinePositions() is false or if + * the output device is not a string. + */ + QList linePositions() const; + /** Enables recording of character positions at which new lines are added. See linePositions() */ + void setRecordLinePositions(bool record); + + virtual void begin(QTextStream* output); + virtual void end(); + + virtual void decodeLine(const Character* const characters, + int count, + LineProperty properties); + + +private: + QTextStream* _output; + bool _includeTrailingWhitespace; + + bool _recordLinePositions; + QList _linePositions; +}; + +/** + * A terminal character decoder which produces pretty HTML markup + */ +class HTMLDecoder : public TerminalCharacterDecoder +{ +public: + /** + * Constructs an HTML decoder using a default black-on-white color scheme. + */ + HTMLDecoder(); + + /** + * Sets the colour table which the decoder uses to produce the HTML colour codes in its + * output + */ + void setColorTable( const ColorEntry* table ); + + virtual void decodeLine(const Character* const characters, + int count, + LineProperty properties); + + virtual void begin(QTextStream* output); + virtual void end(); + +private: + void openSpan(QString& text , const QString& style); + void closeSpan(QString& text); + + QTextStream* _output; + const ColorEntry* _colorTable; + bool _innerSpanOpen; + quint8 _lastRendition; + CharacterColor _lastForeColor; + CharacterColor _lastBackColor; + +}; + + +#endif diff --git a/konsole-qml-plugin/src/TerminalDisplay.cpp b/konsole-qml-plugin/src/TerminalDisplay.cpp new file mode 100644 index 0000000..cda36a0 --- /dev/null +++ b/konsole-qml-plugin/src/TerminalDisplay.cpp @@ -0,0 +1,2170 @@ +/* + This file is part of KTerminal, QML plugin of the Konsole, + which is a terminal emulator from KDE. + + Copyright 2006-2008 by Robert Knight + Copyright 1997,1998 by Lars Doelle + + Rewritten for QT5/QML by Dmitry Zagnoyko , Copyright (C) 2013 + + 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. +*/ + +// Own +#include "TerminalDisplay.h" + +// Qt +#include + +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include + +// Konsole +//#include +#include "Filter.h" +#include "konsole_wcwidth.h" +#include "ScreenWindow.h" +#include "ColorScheme.h" +#include "ColorTables.h" +#include "TerminalCharacterDecoder.h" + + +#ifndef loc +#define loc(X,Y) ((Y)*_columns+(X)) +#endif + +#define REPCHAR "ABCDEFGHIJKLMNOPQRSTUVWXYZ" \ + "abcdefgjijklmnopqrstuvwxyz" \ + "0123456789./+@" + +const ColorEntry base_color_table[TABLE_COLORS] = +// The following are almost IBM standard color codes, with some slight +// gamma correction for the dim colors to compensate for bright X screens. +// It contains the 8 ansiterm/xterm colors in 2 intensities. +{ + // Fixme: could add faint colors here, also. + // normal + ColorEntry(QColor(0x00,0x00,0x00), 0), ColorEntry( QColor(0xB2,0xB2,0xB2), 1), // Dfore, Dback + ColorEntry(QColor(0x00,0x00,0x00), 0), ColorEntry( QColor(0xB2,0x18,0x18), 0), // Black, Red + ColorEntry(QColor(0x18,0xB2,0x18), 0), ColorEntry( QColor(0xB2,0x68,0x18), 0), // Green, Yellow + ColorEntry(QColor(0x18,0x18,0xB2), 0), ColorEntry( QColor(0xB2,0x18,0xB2), 0), // Blue, Magenta + ColorEntry(QColor(0x18,0xB2,0xB2), 0), ColorEntry( QColor(0xB2,0xB2,0xB2), 0), // Cyan, White + // intensiv + ColorEntry(QColor(0x00,0x00,0x00), 0), ColorEntry( QColor(0xFF,0xFF,0xFF), 1), + ColorEntry(QColor(0x68,0x68,0x68), 0), ColorEntry( QColor(0xFF,0x54,0x54), 0), + ColorEntry(QColor(0x54,0xFF,0x54), 0), ColorEntry( QColor(0xFF,0xFF,0x54), 0), + ColorEntry(QColor(0x54,0x54,0xFF), 0), ColorEntry( QColor(0xFF,0x54,0xFF), 0), + ColorEntry(QColor(0x54,0xFF,0xFF), 0), ColorEntry( QColor(0xFF,0xFF,0xFF), 0) +}; + +// scroll increment used when dragging selection at top/bottom of window. + +// static +bool KTerminalDisplay::_antialiasText = true; +bool KTerminalDisplay::HAVE_TRANSPARENCY = true; + +// we use this to force QPainter to display text in LTR mode +// more information can be found in: http://unicode.org/reports/tr9/ +const QChar LTR_OVERRIDE_CHAR( 0x202D ); + +/* ------------------------------------------------------------------------- */ +/* */ +/* Colors */ +/* */ +/* ------------------------------------------------------------------------- */ + +/* Note that we use ANSI color order (bgr), while IBMPC color order is (rgb) + + Code 0 1 2 3 4 5 6 7 + ----------- ------- ------- ------- ------- ------- ------- ------- ------- + ANSI (bgr) Black Red Green Yellow Blue Magenta Cyan White + IBMPC (rgb) Black Blue Green Cyan Red Magenta Yellow White +*/ + + + +///////////////////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////////////////// +/// BEGIN +///////////////////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////////////////// + + +/* ------------------------------------------------------------------------- */ +/* */ +/* Constructor / Destructor */ +/* */ +/* ------------------------------------------------------------------------- */ +KTerminalDisplay::KTerminalDisplay(QQuickItem *parent) : + QQuickPaintedItem(parent) + ,_screenWindow(0) + ,_allowBell(true) + ,_fontHeight(1) + ,_fontWidth(1) + ,_fontAscent(1) + ,_boldIntense(true) + ,_lines(1) + ,_columns(1) + ,_usedLines(1) + ,_usedColumns(1) + ,_contentHeight(1) + ,_contentWidth(1) + ,_image(0) + ,_randomSeed(0) + ,_resizing(false) + ,_bidiEnabled(false) + ,_actSel(0) + ,_wordSelectionMode(false) + ,_lineSelectionMode(false) + ,_preserveLineBreaks(false) + ,_columnSelectionMode(false) + ,_wordCharacters(":@-./_~") + ,_bellMode(NotifyBell) //def: SystemBeepBell) + ,_blinking(false) + ,_hasBlinker(false) + ,_cursorBlinking(false) + ,_hasBlinkingCursor(false) + ,_allowBlinkingText(true) + ,_isFixedSize(false) + ,_resizeTimer(0) + ,_flowControlWarningEnabled(false) + ,_lineSpacing(0) + ,_colorsInverted(false) + ,_cursorShape(BlockCursor) + ,m_session(0) + ,m_focusOnClick(true) + ,m_showVKBonClick(true) + ,m_parent(parent) +{ + _blendColor = qRgba(0,0,0,0xff); + m_widgetRect = QRectF(0,0,1,1); + + m_palette = qApp->palette(); + + m_font = QFont("Monospace",16); + +#ifdef Q_WS_UBUNTU +#if QT_VERSION >= 0x040700 + m_font.setStyleStrategy(QFont::ForceIntegerMetrics); +#else +#warning "Correct handling of the QFont metrics requited Qt>=4.7" +#endif +#endif + + // The offsets are not yet calculated. + // Do not calculate these too often to be more smoothly when resizing + // konsole in opaque mode. + _topMargin = DEFAULT_TOP_MARGIN; + _leftMargin = DEFAULT_LEFT_MARGIN; + + // setup timers for blinking cursor and text + _blinkTimer = new QTimer(this); + connect(_blinkTimer, SIGNAL(timeout()), this, SLOT(blinkEvent())); + _blinkCursorTimer = new QTimer(this); + connect(_blinkCursorTimer, SIGNAL(timeout()), this, SLOT(blinkCursorEvent())); + + //KCursor::setAutoHideCursor( this, true ); + + setColorTable(base_color_table); + + new AutoScrollHandler(this); + + setAcceptedMouseButtons(Qt::LeftButton); + setFlags(ItemHasContents | ItemAcceptsInputMethod); + //installEventFilter(this); + + m_font.setStyleHint(QFont::TypeWriter); + + setVTFont(m_font); +} + +KTerminalDisplay::~KTerminalDisplay() +{ + disconnect(_blinkTimer); + disconnect(_blinkCursorTimer); + + delete[] _image; +} + +void KTerminalDisplay::setSession(KSession * session) +{ + if (m_session != session) { + m_session = session; + + connect(this, SIGNAL(copyAvailable(bool)), + m_session, SLOT(selectionChanged(bool))); + connect(this, SIGNAL(termGetFocus()), + m_session, SIGNAL(termGetFocus())); + connect(this, SIGNAL(termLostFocus()), + m_session, SIGNAL(termLostFocus())); + connect(this, SIGNAL(keyPressedSignal(QKeyEvent *)), + m_session, SIGNAL(termKeyPressed(QKeyEvent *))); + + m_session->addView(this); + + //m_session->changeDir(QDir::currentPath()); + + setRandomSeed(m_session->getRandomSeed()); + + emit changedSession(session); + } +} + + +ScreenWindow* KTerminalDisplay::screenWindow() const +{ + return _screenWindow; +} + +void KTerminalDisplay::forcedFocus() +{ + + bool focused = hasActiveFocus(); + + if (!focused) { + forceActiveFocus(); + focused = hasActiveFocus(); + } + +} + +void KTerminalDisplay::setScreenWindow(ScreenWindow* window) +{ + // disconnect existing screen window if any + if ( _screenWindow ) + { + disconnect( _screenWindow , 0 , this , 0 ); + } + + _screenWindow = window; + + if ( window ) + { + +// TODO: Determine if this is an issue. +//#warning "The order here is not specified - does it matter whether updateImage or updateLineProperties comes first?" + connect( _screenWindow , SIGNAL(outputChanged()) , this , SLOT(updateLineProperties()) ); + connect( _screenWindow , SIGNAL(outputChanged()) , this , SLOT(updateImage()) ); + window->setWindowLines(_lines); + } +} + +const ColorEntry* KTerminalDisplay::colorTable() const +{ + return _colorTable; +} +void KTerminalDisplay::setBackgroundColor(const QColor& color) +{ + _colorTable[DEFAULT_BACK_COLOR].color = color; +// QPalette p = m_palette; +// p.setColor( backgroundRole(), color ); +// setPalette( p ); + + update(); +} +void KTerminalDisplay::setForegroundColor(const QColor& color) +{ + _colorTable[DEFAULT_FORE_COLOR].color = color; + + update(); +} +void KTerminalDisplay::setColorTable(const ColorEntry table[]) +{ + for (int i = 0; i < TABLE_COLORS; i++) + _colorTable[i] = table[i]; + + setBackgroundColor(_colorTable[DEFAULT_BACK_COLOR].color); +} + + +/* ------------------------------------------------------------------------- */ +/* */ +/* Font */ +/* */ +/* ------------------------------------------------------------------------- */ + +/* + The VT100 has 32 special graphical characters. The usual vt100 extended + xterm fonts have these at 0x00..0x1f. + + QT's iso mapping leaves 0x00..0x7f without any changes. But the graphicals + come in here as proper unicode characters. + + We treat non-iso10646 fonts as VT100 extended and do the requiered mapping + from unicode to 0x00..0x1f. The remaining translation is then left to the + QCodec. +*/ + +static inline bool isLineChar(quint16 c) { return ((c & 0xFF80) == 0x2500);} +static inline bool isLineCharString(const QString& string) +{ + return (string.length() > 0) && (isLineChar(string.at(0).unicode())); +} + + +// assert for i in [0..31] : vt100extended(vt100_graphics[i]) == i. + +unsigned short vt100_graphics[32] = +{ // 0/8 1/9 2/10 3/11 4/12 5/13 6/14 7/15 + 0x0020, 0x25C6, 0x2592, 0x2409, 0x240c, 0x240d, 0x240a, 0x00b0, + 0x00b1, 0x2424, 0x240b, 0x2518, 0x2510, 0x250c, 0x2514, 0x253c, + 0xF800, 0xF801, 0x2500, 0xF803, 0xF804, 0x251c, 0x2524, 0x2534, + 0x252c, 0x2502, 0x2264, 0x2265, 0x03C0, 0x2260, 0x00A3, 0x00b7 +}; + +void KTerminalDisplay::fontChange(const QFont&) +{ + QFontMetrics fm(m_font); + _fontHeight = fm.height() + _lineSpacing; + + // waba TerminalDisplay 1.123: + // "Base character width on widest ASCII character. This prevents too wide + // characters in the presence of double wide (e.g. Japanese) characters." + // Get the width from representative normal width characters + _fontWidth = (double)fm.width(REPCHAR)/(double)strlen(REPCHAR); + + _fixedFont = true; + + int fw = fm.width(REPCHAR[0]); + for(unsigned int i=1; i< strlen(REPCHAR); i++) + { + if (fw != fm.width(REPCHAR[i])) + { + _fixedFont = false; + break; + } + } + + if (_fontWidth < 1) + _fontWidth=1; + + _fontAscent = fm.ascent(); + + emit changedFontMetricSignal( _fontHeight, _fontWidth ); + propagateSize(); + update(); +} + +void KTerminalDisplay::setVTFont(const QFont& f) +{ + QFont font = f; + +#if defined(Q_WS_MAC) || defined(Q_WS_UBUNTU) +#if QT_VERSION >= 0x040700 + font.setStyleStrategy(QFont::ForceIntegerMetrics); +#else +#warning "Correct handling of the QFont metrics requited Qt>=4.7" +#endif +#endif + + QFontMetrics metrics(font); + + if ( !QFontInfo(font).fixedPitch() ) + { + qDebug() << "Using an unsupported variable-width font in the terminal. This may produce display errors."; + } + + if ( metrics.height() < height() && metrics.maxWidth() < width() ) + { + // hint that text should be drawn without anti-aliasing. + // depending on the user's font configuration, this may not be respected + if (!_antialiasText) + font.setStyleStrategy( QFont::NoAntialias ); + + // experimental optimization. Konsole assumes that the terminal is using a + // mono-spaced font, in which case kerning information should have an effect. + // Disabling kerning saves some computation when rendering text. + font.setKerning(false); + + //QWidget::setFont(font); + m_font = font; + fontChange(font); + } +} + +void KTerminalDisplay::setColorScheme(const QString &name) +{ + const ColorScheme *cs; + // avoid legacy (int) solution + if (!availableColorSchemes().contains(name)) + cs = ColorSchemeManager::instance()->defaultColorScheme(); + else + cs = ColorSchemeManager::instance()->findColorScheme(name); + + if (! cs) + { +#ifndef QT_NO_DEBUG + qDebug() << "Cannot load color scheme: " << name; +#endif + return; + } + + ColorEntry table[TABLE_COLORS]; + cs->getColorTable(table); + setColorTable(table); + m_scheme = name; +} + +QStringList KTerminalDisplay::availableColorSchemes() +{ + QStringList ret; + foreach (const ColorScheme* cs, ColorSchemeManager::instance()->allColorSchemes()) + ret.append(cs->name()); + return ret; +} + +void KTerminalDisplay::click(qreal x, qreal y) +{ + QMouseEvent me(QEvent::MouseButtonPress, QPointF(x,y), Qt::RightButton, Qt::RightButton, Qt::NoModifier); + mousePressEvent(&me); +} + +void KTerminalDisplay::setAutoFocus(bool au) +{ + m_focusOnClick = au; + emit changedAutoFocus(au); +} + +void KTerminalDisplay::setAutoVKB(bool au) +{ + m_showVKBonClick = au; + emit changedAutoVKB(au); +} + + +/* ------------------------------------------------------------------------- */ +/* */ +/* Display Operations */ +/* */ +/* ------------------------------------------------------------------------- */ + +/** + A table for emulating the simple (single width) unicode drawing chars. + It represents the 250x - 257x glyphs. If it's zero, we can't use it. + if it's not, it's encoded as follows: imagine a 5x5 grid where the points are numbered + 0 to 24 left to top, top to bottom. Each point is represented by the corresponding bit. + + Then, the pixels basically have the following interpretation: + _|||_ + -...- + -...- + -...- + _|||_ + +where _ = none + | = vertical line. + - = horizontal line. + */ + + +enum LineEncode +{ + TopL = (1<<1), + TopC = (1<<2), + TopR = (1<<3), + + LeftT = (1<<5), + Int11 = (1<<6), + Int12 = (1<<7), + Int13 = (1<<8), + RightT = (1<<9), + + LeftC = (1<<10), + Int21 = (1<<11), + Int22 = (1<<12), + Int23 = (1<<13), + RightC = (1<<14), + + LeftB = (1<<15), + Int31 = (1<<16), + Int32 = (1<<17), + Int33 = (1<<18), + RightB = (1<<19), + + BotL = (1<<21), + BotC = (1<<22), + BotR = (1<<23) +}; + +#include "LineFont.h" + +static void drawLineChar(QPainter* paint, qreal x, qreal y, qreal w, qreal h, uchar code) +{ + //Calculate cell midpoints, end points. + qreal cx = x + w/2; + qreal cy = y + h/2; + qreal ex = x + w - 1; + qreal ey = y + h - 1; + + quint32 toDraw = LineChars[code]; + + //Top _lines: + if (toDraw & TopL) + paint->drawLine(cx-1, y, cx-1, cy-2); + if (toDraw & TopC) + paint->drawLine(cx, y, cx, cy-2); + if (toDraw & TopR) + paint->drawLine(cx+1, y, cx+1, cy-2); + + //Bot _lines: + if (toDraw & BotL) + paint->drawLine(cx-1, cy+2, cx-1, ey); + if (toDraw & BotC) + paint->drawLine(cx, cy+2, cx, ey); + if (toDraw & BotR) + paint->drawLine(cx+1, cy+2, cx+1, ey); + + //Left _lines: + if (toDraw & LeftT) + paint->drawLine(x, cy-1, cx-2, cy-1); + if (toDraw & LeftC) + paint->drawLine(x, cy, cx-2, cy); + if (toDraw & LeftB) + paint->drawLine(x, cy+1, cx-2, cy+1); + + //Right _lines: + if (toDraw & RightT) + paint->drawLine(cx+2, cy-1, ex, cy-1); + if (toDraw & RightC) + paint->drawLine(cx+2, cy, ex, cy); + if (toDraw & RightB) + paint->drawLine(cx+2, cy+1, ex, cy+1); + + //Intersection points. + if (toDraw & Int11) + paint->drawPoint(cx-1, cy-1); + if (toDraw & Int12) + paint->drawPoint(cx, cy-1); + if (toDraw & Int13) + paint->drawPoint(cx+1, cy-1); + + if (toDraw & Int21) + paint->drawPoint(cx-1, cy); + if (toDraw & Int22) + paint->drawPoint(cx, cy); + if (toDraw & Int23) + paint->drawPoint(cx+1, cy); + + if (toDraw & Int31) + paint->drawPoint(cx-1, cy+1); + if (toDraw & Int32) + paint->drawPoint(cx, cy+1); + if (toDraw & Int33) + paint->drawPoint(cx+1, cy+1); + +} + +void KTerminalDisplay::setKeyboardCursorShape(KeyboardCursorShape shape) +{ + _cursorShape = shape; +} + +KTerminalDisplay::KeyboardCursorShape KTerminalDisplay::keyboardCursorShape() const +{ + return _cursorShape; +} + +void KTerminalDisplay::setKeyboardCursorColor(bool useForegroundColor, const QColor& color) +{ + if (useForegroundColor) + _cursorColor = QColor(); // an invalid color means that + // the foreground color of the + // current character should + // be used + + else + _cursorColor = color; +} + +QColor KTerminalDisplay::keyboardCursorColor() const +{ + return _cursorColor; +} + +void KTerminalDisplay::ShowVKB(bool show) +{ + bool focused = hasActiveFocus(); + + if (focused && show && !qGuiApp->inputMethod()->isVisible()) { + updateInputMethod(Qt::ImEnabled); + qGuiApp->inputMethod()->show(); + } + + if (focused && !show && qGuiApp->inputMethod()->isVisible()) { + updateInputMethod(Qt::ImEnabled); + qGuiApp->inputMethod()->hide(); + } +} + +void KTerminalDisplay::setRandomSeed(uint randomSeed) { _randomSeed = randomSeed; } +uint KTerminalDisplay::randomSeed() const { return _randomSeed; } + +#if 0 +/*! + Set XIM Position +*/ +void TerminalDisplay::setCursorPos(const int curx, const int cury) +{ + int xpos, ypos; + ypos = _topMargin + _fontHeight*(cury-1) + _fontAscent; + xpos = _leftMargin + _fontWidth*curx; + //setMicroFocusHint(xpos, ypos, 0, _fontHeight); //### ??? + // fprintf(stderr, "x/y = %d/%d\txpos/ypos = %d/%d\n", curx, cury, xpos, ypos); + _cursorLine = cury; + _cursorCol = curx; +} +#endif + +// scrolls the image by 'lines', down if lines > 0 or up otherwise. +// +// the terminal emulation keeps track of the scrolling of the character +// image as it receives input, and when the view is updated, it calls scrollImage() +// with the final scroll amount. this improves performance because scrolling the +// display is much cheaper than re-rendering all the text for the +// part of the image which has moved up or down. +// Instead only new lines have to be drawn +void KTerminalDisplay::scrollImage(int lines , const QRect& screenWindowRegion) +{ + // constrain the region to the display + // the bottom of the region is capped to the number of lines in the display's + // internal image - 2, so that the height of 'region' is strictly less + // than the height of the internal image. + QRect region = screenWindowRegion; + region.setBottom( qMin(region.bottom(),this->_lines-2) ); + + // return if there is nothing to do + if ( lines == 0 + || _image == 0 + || !region.isValid() + || (region.top() + abs(lines)) >= region.bottom() + || this->_lines <= region.height() ) return; + + + void* firstCharPos = &_image[ region.top() * this->_columns ]; + void* lastCharPos = &_image[ (region.top() + abs(lines)) * this->_columns ]; + + int top = _topMargin + (region.top() * _fontHeight); + Q_UNUSED(top) //BAD IDEA! + int linesToMove = region.height() - abs(lines); + int bytesToMove = linesToMove * + this->_columns * + sizeof(Character); + + Q_ASSERT( linesToMove > 0 ); + Q_ASSERT( bytesToMove > 0 ); + + //scroll internal image + if ( lines > 0 ) + { + // check that the memory areas that we are going to move are valid + Q_ASSERT( (char*)lastCharPos + bytesToMove < + (char*)(_image + (this->_lines * this->_columns)) ); + + Q_ASSERT( (lines*this->_columns) < _imageSize ); + + //scroll internal image down + memmove( firstCharPos , lastCharPos , bytesToMove ); + } + else + { + // check that the memory areas that we are going to move are valid + Q_ASSERT( (char*)firstCharPos + bytesToMove < + (char*)(_image + (this->_lines * this->_columns)) ); + + //scroll internal image up + memmove( lastCharPos , firstCharPos , bytesToMove ); + } + + // Q_ASSERT(scrollRect.isValid() && !scrollRect.isEmpty()); + + //scroll the display vertically to match internal _image + // scroll( 0 , _fontHeight * (-lines) , scrollRect ); +} + +void KTerminalDisplay::updateImage() +{ + if ( !_screenWindow ) + return; + + // optimization - scroll the existing image where possible and + // avoid expensive text drawing for parts of the image that + // can simply be moved up or down + scrollImage( _screenWindow->scrollCount() , + _screenWindow->scrollRegion() ); + _screenWindow->resetScrollCount(); + + if (!_image) { + // Create _image. + // The emitted changedContentSizeSignal also leads to getImage being recreated, so do this first. + updateImageSize(); + } + + Character* const newimg = _screenWindow->getImage(); + int lines = _screenWindow->windowLines(); + int columns = _screenWindow->windowColumns(); + + Q_ASSERT( this->_usedLines <= this->_lines ); + Q_ASSERT( this->_usedColumns <= this->_columns ); + + int y,x,len; + + _hasBlinker = false; + + CharacterColor cf; // undefined + CharacterColor _clipboard; // undefined + int cr = -1; // undefined + + const int linesToUpdate = qMin(this->_lines, qMax(0,lines )); + const int columnsToUpdate = qMin(this->_columns,qMax(0,columns)); + + QChar *disstrU = new QChar[columnsToUpdate]; + char *dirtyMask = new char[columnsToUpdate+2]; + QRegion dirtyRegion; + + // debugging variable, this records the number of lines that are found to + // be 'dirty' ( ie. have changed from the old _image to the new _image ) and + // which therefore need to be repainted + int dirtyLineCount = 0; + + for (y = 0; y < linesToUpdate; ++y) + { + const Character* currentLine = &_image[y*this->_columns]; + const Character* const newLine = &newimg[y*columns]; + + bool updateLine = false; + + // The dirty mask indicates which characters need repainting. We also + // mark surrounding neighbours dirty, in case the character exceeds + // its cell boundaries + memset(dirtyMask, 0, columnsToUpdate+2); + + for( x = 0 ; x < columnsToUpdate ; ++x) + { + if ( newLine[x] != currentLine[x] ) + { + dirtyMask[x] = true; + } + } + + if (!_resizing) // not while _resizing, we're expecting a paintEvent + for (x = 0; x < columnsToUpdate; ++x) + { + _hasBlinker |= (newLine[x].rendition & RE_BLINK); + + // Start drawing if this character or the next one differs. + // We also take the next one into account to handle the situation + // where characters exceed their cell width. + if (dirtyMask[x]) + { + quint16 c = newLine[x+0].character; + if ( !c ) + continue; + int p = 0; + disstrU[p++] = c; //fontMap(c); + bool lineDraw = isLineChar(c); + bool doubleWidth = (x+1 == columnsToUpdate) ? false : (newLine[x+1].character == 0); + cr = newLine[x].rendition; + _clipboard = newLine[x].backgroundColor; + if (newLine[x].foregroundColor != cf) cf = newLine[x].foregroundColor; + int lln = columnsToUpdate - x; + for (len = 1; len < lln; ++len) + { + const Character& ch = newLine[x+len]; + + if (!ch.character) + continue; // Skip trailing part of multi-col chars. + + bool nextIsDoubleWidth = (x+len+1 == columnsToUpdate) ? false : (newLine[x+len+1].character == 0); + + if ( ch.foregroundColor != cf || + ch.backgroundColor != _clipboard || + ch.rendition != cr || + !dirtyMask[x+len] || + isLineChar(c) != lineDraw || + nextIsDoubleWidth != doubleWidth ) + break; + + disstrU[p++] = c; //fontMap(c); + } + + QString unistr(disstrU, p); + + bool saveFixedFont = _fixedFont; + if (lineDraw) + _fixedFont = false; + if (doubleWidth) + _fixedFont = false; + + updateLine = true; + + _fixedFont = saveFixedFont; + x += len - 1; + } + + } + + //both the top and bottom halves of double height _lines must always be redrawn + //although both top and bottom halves contain the same characters, only + //the top one is actually + //drawn. + if (_lineProperties.count() > y) + updateLine |= (_lineProperties[y] & LINE_DOUBLEHEIGHT); + + // if the characters on the line are different in the old and the new _image + // then this line must be repainted. + if (updateLine) + { + dirtyLineCount++; + + // add the area occupied by this line to the region which needs to be + // repainted + QRect dirtyRect = QRect( qRound(_leftMargin), + qRound(_topMargin + _fontHeight*y) , + qRound(_fontWidth * columnsToUpdate) , + _fontHeight ); + + dirtyRegion |= dirtyRect; + } + + // replace the line of characters in the old _image with the + // current line of the new _image + memcpy((void*)currentLine,(const void*)newLine,columnsToUpdate*sizeof(Character)); + } + + // if the new _image is smaller than the previous _image, then ensure that the area + // outside the new _image is cleared + if ( linesToUpdate < _usedLines ) + { + dirtyRegion |= QRect( qRound(_leftMargin), + qRound(_topMargin + _fontHeight*linesToUpdate) , + qRound(_fontWidth * this->_columns) , + _fontHeight * (_usedLines-linesToUpdate) ); + } + _usedLines = linesToUpdate; + + if ( columnsToUpdate < _usedColumns ) + { + dirtyRegion |= QRect( qRound(_leftMargin + columnsToUpdate*_fontWidth) , + qRound(_topMargin), + qRound(_fontWidth * (_usedColumns-columnsToUpdate)) , + _fontHeight * this->_lines ); + } + _usedColumns = columnsToUpdate; + + dirtyRegion |= geometryRound(_inputMethodData.previousPreeditRect); + + // update the parts of the display which have changed + // update(dirtyRegion.boundingRect()); + + // update whole widget + update(); + + if ( _hasBlinker && !_blinkTimer->isActive()) _blinkTimer->start( TEXT_BLINK_DELAY ); + if (!_hasBlinker && _blinkTimer->isActive()) { _blinkTimer->stop(); _blinking = false; } + delete[] dirtyMask; + delete[] disstrU; + +} + +void KTerminalDisplay::setBlinkingCursor(bool blink) +{ + _hasBlinkingCursor=blink; + + if (blink && !_blinkCursorTimer->isActive()) + _blinkCursorTimer->start(100); // WARN! HARDCODE + + if (!blink && _blinkCursorTimer->isActive()) + { + _blinkCursorTimer->stop(); + if (_cursorBlinking) + blinkCursorEvent(); + else + _cursorBlinking = false; + } +} + +void KTerminalDisplay::setBlinkingTextEnabled(bool blink) +{ + _allowBlinkingText = blink; + + if (blink && !_blinkTimer->isActive()) + _blinkTimer->start(qApp->styleHints()->cursorFlashTime() / 2); + + if (!blink && _blinkTimer->isActive()) + { + _blinkTimer->stop(); + _blinking = false; + } +} + +void KTerminalDisplay::focusOutEvent(QFocusEvent*) +{ + emit termLostFocus(); + // trigger a repaint of the cursor so that it is both visible (in case + // it was hidden during blinking) + // and drawn in a focused out state + _cursorBlinking = false; + updateCursor(); + + _blinkCursorTimer->stop(); + if (_blinking) + blinkEvent(); + + _blinkTimer->stop(); + + //parent->activeFocus = false; + emit activeFocusChanged(true); +} + +void KTerminalDisplay::focusInEvent(QFocusEvent*) +{ + emit termGetFocus(); + if (_hasBlinkingCursor) + { + _blinkCursorTimer->start(); + } + updateCursor(); + + if (_hasBlinker) + _blinkTimer->start(); +} + +QPoint KTerminalDisplay::cursorPosition() const +{ + if (_screenWindow) + return _screenWindow->cursorPosition(); + else + return QPoint(0,0); +} + +void KTerminalDisplay::blinkEvent() +{ + if (!_allowBlinkingText) return; + + _blinking = !_blinking; + + //TODO: Optimize to only repaint the areas of the widget + // where there is blinking text + // rather than repainting the whole widget. + update(); +} + +void KTerminalDisplay::updateCursor() +{ + QRect cursorRect = imageToWidget( QRect(cursorPosition(),QSize(1,1)) ); + update(cursorRect); +} + +void KTerminalDisplay::blinkCursorEvent() +{ + _cursorBlinking = !_cursorBlinking; + updateCursor(); +} + +/* ------------------------------------------------------------------------- */ +/* */ +/* Resizing */ +/* */ +/* ------------------------------------------------------------------------- */ + +void KTerminalDisplay::propagateSize() +{ + if (_image) { + updateImageSize(); + } +} + +void KTerminalDisplay::updateImageSize() +{ + Character* oldimg = _image; + int oldlin = _lines; + int oldcol = _columns; + + makeImage(); + + // copy the old image to reduce flicker + int lines = qMin(oldlin,_lines); + int columns = qMin(oldcol,_columns); + + if (oldimg) + { + for (int line = 0; line < lines; line++) + { + memcpy((void*)&_image[_columns*line], + (void*)&oldimg[oldcol*line],columns*sizeof(Character)); + } + delete[] oldimg; + } + + if (_screenWindow) + _screenWindow->setWindowLines(_lines); + + _resizing = (oldlin!=_lines) || (oldcol!=_columns); + + if ( _resizing ) + { + emit changedContentSizeSignal(_contentHeight, _contentWidth); // expose resizeEvent + } + + _resizing = false; +} + +void KTerminalDisplay::scrollToEnd() +{ + //_screenWindow->scrollTo( _scrollBar->value() + 1 ); + _screenWindow->setTrackOutput( _screenWindow->atEndOfOutput() ); +} + +void KTerminalDisplay::extendSelection( const QPoint& position ) +{ + QPoint pos = position; + + if ( !_screenWindow ) + return; + + //if ( !contentsRect().contains(ev->pos()) ) return; + + // we're in the process of moving the mouse with the left button pressed + // the mouse cursor will kept caught within the bounds of the text in + // this widget. + + int linesBeyondWidget = 0; + + QRect textBounds( _leftMargin, + _topMargin, + _usedColumns*_fontWidth-1, + _usedLines*_fontHeight-1); + + // Adjust position within text area bounds. + QPoint oldpos = pos; + + pos.setX( qBound(textBounds.left(),pos.x(),textBounds.right()) ); + pos.setY( qBound(textBounds.top(),pos.y(),textBounds.bottom()) ); + + if ( oldpos.y() > textBounds.bottom() ) + { + linesBeyondWidget = (oldpos.y()-textBounds.bottom()) / _fontHeight; + } + if ( oldpos.y() < textBounds.top() ) + { + linesBeyondWidget = (textBounds.top()-oldpos.y()) / _fontHeight; + } + + int charColumn = 0; + int charLine = 0; + getCharacterPosition(pos,charLine,charColumn); + + QPoint here = QPoint(charColumn,charLine); //QPoint((pos.x()-tLx-_leftMargin+(_fontWidth/2))/_fontWidth,(pos.y()-tLy-_topMargin)/_fontHeight); + QPoint ohere; + QPoint _iPntSelCorr = _iPntSel; + _iPntSelCorr.ry() -= 0; //_scrollBar->value(); + QPoint _pntSelCorr = _pntSel; + _pntSelCorr.ry() -= 0; //_scrollBar->value(); + bool swapping = false; + + if ( _wordSelectionMode ) + { + // Extend to word boundaries + int i; + QChar selClass; + + bool left_not_right = ( here.y() < _iPntSelCorr.y() || + ( here.y() == _iPntSelCorr.y() && here.x() < _iPntSelCorr.x() ) ); + bool old_left_not_right = ( _pntSelCorr.y() < _iPntSelCorr.y() || + ( _pntSelCorr.y() == _iPntSelCorr.y() && _pntSelCorr.x() < _iPntSelCorr.x() ) ); + swapping = left_not_right != old_left_not_right; + + // Find left (left_not_right ? from here : from start) + QPoint left = left_not_right ? here : _iPntSelCorr; + i = loc(left.x(),left.y()); + if (i>=0 && i<=_imageSize) { + selClass = charClass(_image[i].character); + while ( ((left.x()>0) || (left.y()>0 && (_lineProperties[left.y()-1] & LINE_WRAPPED) )) + && charClass(_image[i-1].character) == selClass ) + { i--; if (left.x()>0) left.rx()--; else {left.rx()=_usedColumns-1; left.ry()--;} } + } + + // Find left (left_not_right ? from start : from here) + QPoint right = left_not_right ? _iPntSelCorr : here; + i = loc(right.x(),right.y()); + if (i>=0 && i<=_imageSize) { + selClass = charClass(_image[i].character); + while( ((right.x()<_usedColumns-1) || (right.y()<_usedLines-1 && (_lineProperties[right.y()] & LINE_WRAPPED) )) + && charClass(_image[i+1].character) == selClass ) + { i++; if (right.x()<_usedColumns-1) right.rx()++; else {right.rx()=0; right.ry()++; } } + } + + // Pick which is start (ohere) and which is extension (here) + if ( left_not_right ) + { + here = left; ohere = right; + } + else + { + here = right; ohere = left; + } + ohere.rx()++; + } + + if ( _lineSelectionMode ) + { + // Extend to complete line + bool above_not_below = ( here.y() < _iPntSelCorr.y() ); + + QPoint above = above_not_below ? here : _iPntSelCorr; + QPoint below = above_not_below ? _iPntSelCorr : here; + + while (above.y()>0 && (_lineProperties[above.y()-1] & LINE_WRAPPED) ) + above.ry()--; + while (below.y()<_usedLines-1 && (_lineProperties[below.y()] & LINE_WRAPPED) ) + below.ry()++; + + above.setX(0); + below.setX(_usedColumns-1); + + // Pick which is start (ohere) and which is extension (here) + if ( above_not_below ) + { + here = above; ohere = below; + } + else + { + here = below; ohere = above; + } + + QPoint newSelBegin = QPoint( ohere.x(), ohere.y() ); + swapping = !(_tripleSelBegin==newSelBegin); + _tripleSelBegin = newSelBegin; + + ohere.rx()++; + } + + int offset = 0; + if ( !_wordSelectionMode && !_lineSelectionMode ) + { + int i; + QChar selClass; + + bool left_not_right = ( here.y() < _iPntSelCorr.y() || + ( here.y() == _iPntSelCorr.y() && here.x() < _iPntSelCorr.x() ) ); + bool old_left_not_right = ( _pntSelCorr.y() < _iPntSelCorr.y() || + ( _pntSelCorr.y() == _iPntSelCorr.y() && _pntSelCorr.x() < _iPntSelCorr.x() ) ); + swapping = left_not_right != old_left_not_right; + + // Find left (left_not_right ? from here : from start) + QPoint left = left_not_right ? here : _iPntSelCorr; + + // Find left (left_not_right ? from start : from here) + QPoint right = left_not_right ? _iPntSelCorr : here; + if ( right.x() > 0 && !_columnSelectionMode ) + { + i = loc(right.x(),right.y()); + if (i>=0 && i<=_imageSize) { + selClass = charClass(_image[i-1].character); + /* if (selClass == ' ') + { + while ( right.x() < _usedColumns-1 && charClass(_image[i+1].character) == selClass && (right.y()<_usedLines-1) && + !(_lineProperties[right.y()] & LINE_WRAPPED)) + { i++; right.rx()++; } + if (right.x() < _usedColumns-1) + right = left_not_right ? _iPntSelCorr : here; + else + right.rx()++; // will be balanced later because of offset=-1; + }*/ + } + } + + // Pick which is start (ohere) and which is extension (here) + if ( left_not_right ) + { + here = left; ohere = right; offset = 0; + } + else + { + here = right; ohere = left; offset = -1; + } + } + + //if ((here == _pntSelCorr) && (scroll == _scrollBar->value())) return; // not moved + + if (here == ohere) return; // It's not left, it's not right. + + if ( _actSel < 2 || swapping ) + { + if ( _columnSelectionMode && !_lineSelectionMode && !_wordSelectionMode ) + { + _screenWindow->setSelectionStart( ohere.x() , ohere.y() , true ); + } + else + { + _screenWindow->setSelectionStart( ohere.x()-1-offset , ohere.y() , false ); + } + + } + + _actSel = 2; // within selection + _pntSel = here; + _pntSel.ry() += 0; //_scrollBar->value(); + + if ( _columnSelectionMode && !_lineSelectionMode && !_wordSelectionMode ) + { + _screenWindow->setSelectionEnd( here.x() , here.y() ); + } + else + { + _screenWindow->setSelectionEnd( here.x()+offset , here.y() ); + } + + Q_UNUSED(linesBeyondWidget) + +} + +void KTerminalDisplay::updateLineProperties() +{ + if ( !_screenWindow ) + return; + + _lineProperties = _screenWindow->getLineProperties(); +} + +QChar KTerminalDisplay::charClass(QChar qch) const +{ + if ( qch.isSpace() ) return ' '; + + if ( qch.isLetterOrNumber() || _wordCharacters.contains(qch, Qt::CaseInsensitive ) ) + return 'a'; + + return qch; +} + +void KTerminalDisplay::setWordCharacters(const QString& wc) +{ + _wordCharacters = wc; +} + +/* ------------------------------------------------------------------------- */ +/* */ +/* Clipboard */ +/* */ +/* ------------------------------------------------------------------------- */ + +#undef KeyPress + +void KTerminalDisplay::emitSelection(bool useXselection,bool appendReturn) +{ + if ( !_screenWindow ) + return; + + // Paste Clipboard by simulating keypress events + QString text = QGuiApplication::clipboard()->text(useXselection ? QClipboard::Selection : + QClipboard::Clipboard); + if(appendReturn) + text.append("\r"); + if ( ! text.isEmpty() ) + { + text.replace('\n', '\r'); + QKeyEvent e(QEvent::KeyPress, 0, Qt::NoModifier, text); + emit keyPressedSignal(&e); // expose as a big fat keypress event + + _screenWindow->clearSelection(); + } +} + +void KTerminalDisplay::setSelection(const QString& t) +{ + QGuiApplication::clipboard()->setText(t, QClipboard::Selection); +} + +void KTerminalDisplay::copyClipboard() +{ + if ( !_screenWindow ) + return; + + QString text = _screenWindow->selectedText(_preserveLineBreaks); + if (!text.isEmpty()) + QGuiApplication::clipboard()->setText(text); +} + +void KTerminalDisplay::pasteClipboard() +{ + emitSelection(false,false); +} + +void KTerminalDisplay::pasteSelection() +{ + emitSelection(true,false); +} + +/* ------------------------------------------------------------------------- */ +/* */ +/* Keyboard */ +/* */ +/* ------------------------------------------------------------------------- */ + +void KTerminalDisplay::setFlowControlWarningEnabled( bool enable ) +{ + _flowControlWarningEnabled = enable; + + // if the dialog is currently visible and the flow control warning has + // been disabled then hide the dialog +// if (!enable) +// outputSuspended(false); +} + +void KTerminalDisplay::inputMethodEvent( QInputMethodEvent* event ) +{ + QKeyEvent keyEvent(QEvent::KeyPress,0,Qt::NoModifier,event->commitString()); + emit keyPressedSignal(&keyEvent); + + _inputMethodData.preeditString = event->preeditString(); + QRect updRect = geometryRound(preeditRect() | _inputMethodData.previousPreeditRect); + update(updRect); + + event->accept(); +} + +void KTerminalDisplay::inputMethodQuery(QInputMethodQueryEvent *event) +{ + event->setValue(Qt::ImEnabled, true); + event->accept(); +} + +QVariant KTerminalDisplay::inputMethodQuery(Qt::InputMethodQuery query) const +{ + const QPoint cursorPos = _screenWindow ? _screenWindow->cursorPosition() : QPoint(0,0); + switch ( query ) + { + case Qt::ImEnabled: + return (bool)(flags() & ItemAcceptsInputMethod); + break; + case Qt::ImMicroFocus: + return imageToWidget(QRect(cursorPos.x(),cursorPos.y(),1,1)); + break; + case Qt::ImFont: + return m_font; + break; + case Qt::ImCursorPosition: + // return the cursor position within the current line + return cursorPos.x(); + break; + case Qt::ImSurroundingText: + { + // return the text from the current line + QString lineText; + QTextStream stream(&lineText); + PlainTextDecoder decoder; + decoder.begin(&stream); + decoder.decodeLine(&_image[loc(0,cursorPos.y())],_usedColumns,_lineProperties[cursorPos.y()]); + decoder.end(); + return lineText; + } + break; + case Qt::ImCurrentSelection: + return QString(); + break; + default: + break; + } + + return QVariant(); +} + +bool KTerminalDisplay::handleShortcutOverrideEvent(QKeyEvent* keyEvent) +{ + int modifiers = keyEvent->modifiers(); + + // When a possible shortcut combination is pressed, + // emit the overrideShortcutCheck() signal to allow the host + // to decide whether the terminal should override it or not. + if (modifiers != Qt::NoModifier) + { + int modifierCount = 0; + unsigned int currentModifier = Qt::ShiftModifier; + + while (currentModifier <= Qt::KeypadModifier) + { + if (modifiers & currentModifier) + modifierCount++; + currentModifier <<= 1; + } + if (modifierCount < 2) + { + bool override = false; + emit overrideShortcutCheck(keyEvent,override); + if (override) + { + keyEvent->accept(); + return true; + } + } + } + + // Override any of the following shortcuts because + // they are needed by the terminal + int keyCode = keyEvent->key() | modifiers; + switch ( keyCode ) + { + // list is taken from the QLineEdit::event() code + case Qt::Key_Tab: + case Qt::Key_Delete: + case Qt::Key_Home: + case Qt::Key_End: + case Qt::Key_Backspace: + case Qt::Key_Left: + case Qt::Key_Right: + keyEvent->accept(); + return true; + } + return false; +} + +bool KTerminalDisplay::event(QEvent* event) +{ + bool eventHandled = false; + switch (event->type()) + { + case QEvent::ShortcutOverride: + eventHandled = handleShortcutOverrideEvent((QKeyEvent*)event); + break; + case QEvent::PaletteChange: + case QEvent::ApplicationPaletteChange: + break; + case QEvent::InputMethod: + inputMethodEvent(static_cast(event)); + break; + case QEvent::InputMethodQuery: + inputMethodQuery(static_cast(event)); + break; + default: + eventHandled = QQuickPaintedItem::event(event); + break; + } + return eventHandled; //parent->event(event); +} + +void KTerminalDisplay::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) +{ + if (newGeometry != oldGeometry) { + m_widgetRect = newGeometry; + propagateSize(); + update(); + } + + QQuickPaintedItem::geometryChanged(newGeometry,oldGeometry); +} + +QRect KTerminalDisplay::geometryRound(const QRectF &r) const +{ + QRect rect; + + rect.setTop(qRound(r.top())); + rect.setBottom(qRound(r.bottom())); + rect.setLeft(qRound(r.left())); + rect.setRight(qRound(r.right())); + + return rect; +} + +void KTerminalDisplay::mousePressEvent(QMouseEvent *ev) +{ + if (m_focusOnClick) forcedFocus(); + if (m_showVKBonClick) ShowVKB(true); + + emit clicked(); + QQuickPaintedItem::mouseMoveEvent(ev); +} + +void KTerminalDisplay::setBellMode(int mode) +{ + _bellMode=mode; +} + +void KTerminalDisplay::enableBell() +{ + _allowBell = true; +} + +void KTerminalDisplay::bell(const QString& message) +{ + Q_UNUSED(message) + + if (_bellMode==NoBell) return; + + //limit the rate at which bells can occur + //...mainly for sound effects where rapid bells in sequence + //produce a horrible noise + if ( _allowBell ) + { + _allowBell = false; + QTimer::singleShot(500,this,SLOT(enableBell())); + + if (_bellMode==SystemBeepBell) + { + // NO BEEP ! + //QGuiApplication::beep(); + int a = 0; + Q_UNUSED(a) + } + else if (_bellMode==NotifyBell) + { + //KNotification::event("BellVisible", message,QPixmap(),this); + // TODO/FIXME: qt4 notifications? + } + else if (_bellMode==VisualBell) + { + swapColorTable(); + QTimer::singleShot(200,this,SLOT(swapColorTable())); + } + } +} + +void KTerminalDisplay::selectionChanged() +{ + emit copyAvailable(_screenWindow->selectedText(false).isEmpty() == false); +} + +void KTerminalDisplay::swapColorTable() +{ + ColorEntry color = _colorTable[1]; + _colorTable[1]=_colorTable[0]; + _colorTable[0]= color; + _colorsInverted = !_colorsInverted; + update(); +} + +void KTerminalDisplay::clearImage() +{ + // We initialize _image[_imageSize] too. See makeImage() + for (int i = 0; i <= _imageSize; i++) + { + _image[i].character = ' '; + _image[i].foregroundColor = CharacterColor(COLOR_SPACE_DEFAULT, + DEFAULT_FORE_COLOR); + _image[i].backgroundColor = CharacterColor(COLOR_SPACE_DEFAULT, + DEFAULT_BACK_COLOR); + _image[i].rendition = DEFAULT_RENDITION; + } +} + +void KTerminalDisplay::calcGeometry() +{ + _leftMargin = DEFAULT_LEFT_MARGIN; + _contentWidth = width() - 2 * DEFAULT_LEFT_MARGIN; + + _topMargin = DEFAULT_TOP_MARGIN; + _contentHeight = height() - 2 * DEFAULT_TOP_MARGIN + /* mysterious */ 1; + + // ensure that display is always at least one column wide + _columns = qMax(1, qRound(_contentWidth / _fontWidth)); + _usedColumns = qMin(_usedColumns,_columns); + + // ensure that display is always at least one line high + _lines = qMax(1, qRound(_contentHeight / (double)_fontHeight)); + _usedLines = qMin(_usedLines,_lines); +} + +void KTerminalDisplay::makeImage() +{ + calcGeometry(); + + // confirm that array will be of non-zero size, since the painting code + // assumes a non-zero array length + Q_ASSERT( _lines > 0 && _columns > 0 ); + Q_ASSERT( _usedLines <= _lines && _usedColumns <= _columns ); + + _imageSize=_lines*_columns; + + // We over-commit one character so that we can be more relaxed in dealing with + // certain boundary conditions: _image[_imageSize] is a valid but unused position + _image = new Character[_imageSize+1]; + + clearImage(); +} + +uint KTerminalDisplay::lineSpacing() const +{ + return _lineSpacing; +} + +void KTerminalDisplay::setLineSpacing(uint i) +{ + _lineSpacing = i; + setVTFont(m_font); // Trigger an update. +} + + + +///////////////////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////////////////// +/// PAINT +///////////////////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////////////////// + +QRect KTerminalDisplay::imageToWidget(const QRect& imageArea) const +{ + QRect result; + result.setLeft( _leftMargin + _fontWidth * imageArea.left() ); + result.setTop( _topMargin + _fontHeight * imageArea.top() ); + result.setWidth( _fontWidth * imageArea.width() ); + result.setHeight( _fontHeight * imageArea.height() ); + + return result; +} + +void KTerminalDisplay::paint(QPainter *painter) +{ + //contentsBoundingRect() + QRectF rect = m_widgetRect; + drawBackground(painter, rect, _colorTable[DEFAULT_BACK_COLOR].color, true /* use opacity setting */); + + ///////////////////////////////////// + /// !!!WARN!!! + /// THIS FUNCTION REQUIRE PATCH + ///////////////////////////////////// + drawContents(painter, rect); + ///////////////////////////////////// + ///////////////////////////////////// + + drawInputMethodPreeditString(painter, preeditRect()); + //paintFilters(painter); +} + +void KTerminalDisplay::drawContents(QPainter *paint, QRectF &rect) +{ + //Q_UNUSED(rect) + int left_ = ceil(rect.left()); + int top_ = ceil(rect.top()); + int right_ = ceil(rect.right()); + int bottom_ = ceil(rect.bottom()); + + int lux = qMin(_usedColumns-1, qMax(0, qRound((left_ + _leftMargin ) / _fontWidth ))); + int luy = qMin(_usedLines-1, qMax(0, qRound((top_ + _topMargin ) / _fontHeight ))); + int rlx = qMin(_usedColumns-1, qMax(0, qRound((right_ - _leftMargin ) / _fontWidth ))); + int rly = qMin(_usedLines-1, qMax(0, qRound((bottom_ - _topMargin ) / _fontHeight ))); + + // prevent zero size buffer + if (_usedColumns<=1) return; + + const int bufferSize = _usedColumns; + QString unistr; + unistr.reserve(bufferSize); + for (int y = luy; y <= rly; y++) + { + quint16 c = _image[loc(lux,y)].character; + int x = lux; + if(!c && x) + x--; // Search for start of multi-column character + for (; x <= rlx; x++) + { + int len = 1; + int p = 0; + + // reset our buffer to the maximal size + unistr.resize(bufferSize); + QChar *disstrU = unistr.data(); + + // is this a single character or a sequence of characters ? + if ( _image[loc(x,y)].rendition & RE_EXTENDED_CHAR ) + { + // sequence of characters + ushort extendedCharLength = 0; + ushort* chars = ExtendedCharTable::instance + .lookupExtendedChar(_image[loc(x,y)].charSequence,extendedCharLength); + for ( int index = 0 ; index < extendedCharLength ; index++ ) + { + Q_ASSERT( p < bufferSize ); + disstrU[p++] = chars[index]; + } + } + else + { + // single character + c = _image[loc(x,y)].character; + if (c) + { + Q_ASSERT( p < bufferSize ); + disstrU[p++] = c; //fontMap(c); + } + } + + bool lineDraw = isLineChar(c); + bool doubleWidth = (_image[ qMin(loc(x,y)+1,_imageSize) ].character == 0); + CharacterColor currentForeground = _image[loc(x,y)].foregroundColor; + CharacterColor currentBackground = _image[loc(x,y)].backgroundColor; + quint8 currentRendition = _image[loc(x,y)].rendition; + + while (x+len <= rlx && + _image[loc(x+len,y)].foregroundColor == currentForeground && + _image[loc(x+len,y)].backgroundColor == currentBackground && + _image[loc(x+len,y)].rendition == currentRendition && + (_image[ qMin(loc(x+len,y)+1,_imageSize) ].character == 0) == doubleWidth && + isLineChar( c = _image[loc(x+len,y)].character) == lineDraw) // Assignment! + { + if (c) + disstrU[p++] = c; //fontMap(c); + if (doubleWidth) // assert((_image[loc(x+len,y)+1].character == 0)), see above if condition + len++; // Skip trailing part of multi-column character + len++; + } + if ((x+len < _usedColumns) && (!_image[loc(x+len,y)].character)) + len++; // Adjust for trailing part of multi-column character + + bool save__fixedFont = _fixedFont; + + if (lineDraw) + _fixedFont = false; + if (doubleWidth) + _fixedFont = false; + unistr.resize(p); + + // Create a text scaling matrix for double width and double height lines. + QMatrix textScale; + + if (y < _lineProperties.size()) + { + if (_lineProperties[y] & LINE_DOUBLEWIDTH) + textScale.scale(2,1); + + if (_lineProperties[y] & LINE_DOUBLEHEIGHT) + textScale.scale(1,2); + } + + //Apply text scaling matrix. + paint->setWorldMatrix(textScale, true); + + //calculate the area in which the text will be drawn + QRectF textArea = QRectF( _leftMargin + _fontWidth*x , _topMargin + _fontHeight*y , _fontWidth*len , _fontHeight); + + //move the calculated area to take account of scaling applied to the painter. + //the position of the area from the origin (0,0) is scaled + //by the opposite of whatever + //transformation has been applied to the painter. this ensures that + //painting does actually start from textArea.topLeft() + //(instead of textArea.topLeft() * painter-scale) + textArea.moveTopLeft( textScale.inverted().map(textArea.topLeft()) ); + + //paint text fragment + drawTextFragment( paint, + textArea, + unistr, + &_image[loc(x,y)] ); //, + //0, + //!_isPrinting ); + + _fixedFont = save__fixedFont; + + //reset back to single-width, single-height _lines + paint->setWorldMatrix(textScale.inverted(), true); + + if (y < _lineProperties.size()-1) + { + //double-height _lines are represented by two adjacent _lines + //containing the same characters + //both _lines will have the LINE_DOUBLEHEIGHT attribute. + //If the current line has the LINE_DOUBLEHEIGHT attribute, + //we can therefore skip the next line + if (_lineProperties[y] & LINE_DOUBLEHEIGHT) + y++; + } + + x += len - 1; + } + } +} + + +void KTerminalDisplay::drawLineCharString( QPainter* painter, qreal x, qreal y, const QString& str, + const Character* attributes) +{ + const QPen& currentPen = painter->pen(); + + if ( (attributes->rendition & RE_BOLD) && _boldIntense ) + { + QPen boldPen(currentPen); + boldPen.setWidth(3); + painter->setPen( boldPen ); + } + + for (int i=0 ; i < str.length(); i++) + { + uchar code = str[i].cell(); + if (LineChars[code]) + drawLineChar(painter, x + (_fontWidth*i), y, _fontWidth, _fontHeight, code); + } + + painter->setPen( currentPen ); +} + +void KTerminalDisplay::drawBackground(QPainter* painter, const QRectF &rect, const QColor& backgroundColor, bool useOpacitySetting ) +{ + // the area of the widget showing the contents of the terminal display is drawn + // using the background color from the color scheme set with setColorTable() + + QRectF contentsRect = rect; + + if ( HAVE_TRANSPARENCY && qAlpha(_blendColor) < 0xff && useOpacitySetting ) + { + QColor color(backgroundColor); + color.setAlpha(qAlpha(_blendColor)); + + painter->save(); + painter->setCompositionMode(QPainter::CompositionMode_Source); + painter->fillRect(contentsRect, color); + painter->restore(); + } + else + painter->fillRect(contentsRect, backgroundColor); + +} + +void KTerminalDisplay::drawCursor(QPainter* painter, + const QRectF& rect, + const QColor& foregroundColor, + const QColor& /*backgroundColor*/, + bool& invertCharacterColor) +{ + QRectF cursorRect = rect; + cursorRect.setHeight(_fontHeight - _lineSpacing - 1); + + if (!_cursorBlinking) + { + if ( _cursorColor.isValid() ) + painter->setPen(_cursorColor); + else + painter->setPen(foregroundColor); + + if ( _cursorShape == BlockCursor ) + { + // draw the cursor outline, adjusting the area so that + // it is draw entirely inside 'rect' + int penWidth = qMax(1,painter->pen().width()); + + painter->drawRect(cursorRect.adjusted( penWidth/2, + penWidth/2, + - penWidth/2 - penWidth%2, + - penWidth/2 - penWidth%2)); + if ( hasFocus() ) + { + painter->fillRect(cursorRect, _cursorColor.isValid() ? _cursorColor : foregroundColor); + + if ( !_cursorColor.isValid() ) + { + // invert the colour used to draw the text to ensure that the character at + // the cursor position is readable + invertCharacterColor = true; + } + } + } + else if ( _cursorShape == UnderlineCursor ) + painter->drawLine(cursorRect.left(), + cursorRect.bottom(), + cursorRect.right(), + cursorRect.bottom()); + else if ( _cursorShape == IBeamCursor ) + painter->drawLine(cursorRect.left(), + cursorRect.top(), + cursorRect.left(), + cursorRect.bottom()); + + } +} + +void KTerminalDisplay::drawCharacters(QPainter* painter, + const QRectF& rect, + const QString& text, + const Character* style, + bool invertCharacterColor) +{ + // don't draw text which is currently blinking + if ( _blinking && (style->rendition & RE_BLINK) ) + return; + + // setup bold and underline + bool useBold; + ColorEntry::FontWeight weight = style->fontWeight(_colorTable); + if (weight == ColorEntry::UseCurrentFormat) + useBold = ((style->rendition & RE_BOLD) && _boldIntense) || m_font.bold(); + else + useBold = (weight == ColorEntry::Bold) ? true : false; + bool useUnderline = style->rendition & RE_UNDERLINE || m_font.underline(); + + QFont font = m_font; + QFont font_ = painter->font(); + if ( font.bold() != useBold + || font.underline() != useUnderline ) + { + font.setBold(useBold); + font.setUnderline(useUnderline); + } + +#ifdef Q_WS_UBUNTU +#if QT_VERSION >= 0x040700 + font.setStyleStrategy(QFont::ForceIntegerMetrics); +#else +#warning "Correct handling of the QFont metrics requited Qt>=4.7" +#endif +#endif + + painter->setFont(font); + + // setup pen + const CharacterColor& textColor = ( invertCharacterColor ? style->backgroundColor : style->foregroundColor ); + const QColor color = textColor.color(_colorTable); + QPen pen = painter->pen(); + if ( pen.color() != color ) + { + pen.setColor(color); + painter->setPen(color); + } + + // draw text + if ( isLineCharString(text) ) + drawLineCharString(painter,rect.x(),rect.y(),text,style); + else + { + if (_bidiEnabled) + painter->drawText(rect,text); + else + painter->drawText(rect,LTR_OVERRIDE_CHAR+text); + } + + painter->setFont(font_); +} + +void KTerminalDisplay::drawTextFragment(QPainter* painter , + const QRectF& rect, + const QString& text, + const Character* style) +{ + painter->save(); + + // setup painter + const QColor foregroundColor = style->foregroundColor.color(_colorTable); + const QColor backgroundColor = style->backgroundColor.color(_colorTable); + + // draw background if different from the display's background color + if ( backgroundColor != m_palette.background().color() ) + drawBackground(painter, rect, backgroundColor, false /* do not use transparency */); + + // draw cursor shape if the current character is the cursor + // this may alter the foreground and background colors + bool invertCharacterColor = false; + if ( style->rendition & RE_CURSOR ) + drawCursor(painter, rect, foregroundColor,backgroundColor,invertCharacterColor); + + // draw text + drawCharacters(painter, rect, text, style, invertCharacterColor); + + painter->restore(); +} + +void KTerminalDisplay::getCharacterPosition(const QPointF &widgetPoint, int& line, int& column) const +{ + //contentsBoundingRect() + QRectF rect = m_widgetRect; + + column = qRound((widgetPoint.x() + _fontWidth/2 - rect.left()-_leftMargin) / _fontWidth); + line = qRound((widgetPoint.y() - rect.top()-_topMargin) / _fontHeight); + + if ( line < 0 ) + line = 0; + if ( column < 0 ) + column = 0; + + if ( line >= _usedLines ) + line = _usedLines-1; + + // the column value returned can be equal to _usedColumns, which + // is the position just after the last character displayed in a line. + // + // this is required so that the user can select characters in the right-most + // column (or left-most for right-to-left input) + if ( column > _usedColumns ) + column = _usedColumns; +} + +QRectF KTerminalDisplay::preeditRect() const +{ + const int preeditLength = string_width(_inputMethodData.preeditString); + + if ( preeditLength == 0 ) + return QRectF(); + + return QRectF(_leftMargin + _fontWidth*cursorPosition().x(), + _topMargin + _fontHeight*cursorPosition().y(), + _fontWidth*preeditLength, + _fontHeight); +} + +void KTerminalDisplay::drawInputMethodPreeditString(QPainter *painter , const QRectF &rect) +{ + if ( _inputMethodData.preeditString.isEmpty() ) + return; + + const QPoint cursorPos = cursorPosition(); + + bool invertColors = false; + const QColor background = _colorTable[DEFAULT_BACK_COLOR].color; + const QColor foreground = _colorTable[DEFAULT_FORE_COLOR].color; + const Character* style = &_image[loc(cursorPos.x(),cursorPos.y())]; + + drawBackground(painter, rect, background,true); + drawCursor(painter, rect, foreground,background,invertColors); + drawCharacters(painter, rect,_inputMethodData.preeditString,style,invertColors); + + _inputMethodData.previousPreeditRect = rect; +} + + + +void KTerminalDisplay::keyPressEvent(QKeyEvent *event) +{ + bool emitKeyPressSignal = true; + + // Keyboard-based navigation + if ( event->modifiers() == Qt::ShiftModifier ) + { + bool update = true; + + if ( event->key() == Qt::Key_PageUp ) + { + _screenWindow->scrollBy( ScreenWindow::ScrollPages , -1 ); + } + else if ( event->key() == Qt::Key_PageDown ) + { + _screenWindow->scrollBy( ScreenWindow::ScrollPages , 1 ); + } + else if ( event->key() == Qt::Key_Up ) + { + _screenWindow->scrollBy( ScreenWindow::ScrollLines , -1 ); + } + else if ( event->key() == Qt::Key_Down ) + { + _screenWindow->scrollBy( ScreenWindow::ScrollLines , 1 ); + } + else + update = false; + + if ( update ) + { + _screenWindow->setTrackOutput( _screenWindow->atEndOfOutput() ); + + updateLineProperties(); + updateImage(); + + // do not send key press to terminal + emitKeyPressSignal = false; + } + } + + _actSel=0; // Key stroke implies a screen update, so TerminalDisplay won't + // know where the current selection is. + + if (_hasBlinkingCursor) + { + _blinkCursorTimer->start(100); //WARN! HARDCODE + if (_cursorBlinking) + blinkCursorEvent(); + else + _cursorBlinking = false; + } + + if ( emitKeyPressSignal ) + emit keyPressedSignal(event); + + event->accept(); +} + + +///////////////////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////////////////// +/// HELPER +///////////////////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////////////////// + +AutoScrollHandler::AutoScrollHandler(QQuickItem* parent) +: QObject(parent) +, _timerId(0) +{ + parent->installEventFilter(this); +} +void AutoScrollHandler::timerEvent(QTimerEvent* event) +{ + if (event->timerId() != _timerId) + return; + + QMouseEvent mouseEvent( QEvent::MouseMove, + widget()->mapFromScene(QCursor::pos()), + Qt::NoButton, + Qt::LeftButton, + Qt::NoModifier); + + QGuiApplication::sendEvent(widget(),&mouseEvent); +} +bool AutoScrollHandler::eventFilter(QObject* watched,QEvent* event) +{ + Q_ASSERT( watched == parent() ); + Q_UNUSED( watched ); + + QMouseEvent* mouseEvent = (QMouseEvent*)event; + switch (event->type()) + { + case QEvent::MouseMove: + { + bool mouseInWidget = false; //widget()->rect().contains(mouseEvent->pos()); + + if (mouseInWidget) + { + if (_timerId) + killTimer(_timerId); + _timerId = 0; + } + else + { + if (!_timerId && (mouseEvent->buttons() & Qt::LeftButton)) + _timerId = startTimer(100); + } + break; + } + case QEvent::MouseButtonRelease: + if (_timerId && (mouseEvent->buttons() & ~Qt::LeftButton)) + { + killTimer(_timerId); + _timerId = 0; + } + break; + default: + break; + }; + + return false; +} + +//#include "TerminalDisplay.moc" diff --git a/konsole-qml-plugin/src/TerminalDisplay.h b/konsole-qml-plugin/src/TerminalDisplay.h new file mode 100644 index 0000000..f41ec9b --- /dev/null +++ b/konsole-qml-plugin/src/TerminalDisplay.h @@ -0,0 +1,715 @@ +/* + This file is part of KTerminal, QML plugin of the Konsole, + which is a terminal emulator from KDE. + + Copyright 2006-2008 by Robert Knight + Copyright 1997,1998 by Lars Doelle + + Rewritten for QT5/QML by Dmitry Zagnoyko , Copyright (C) 2013 + + 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. +*/ + +#ifndef TERMINALDISPLAY_H +#define TERMINALDISPLAY_H + +#include +#include + +// Konsole +#include "Filter.h" +#include "Character.h" +#include "ksession.h" +//#include "konsole_export.h" +#define KONSOLEPRIVATE_EXPORT + +#include +#include + +class QTimer; +class QEvent; +class QKeyEvent; +class QTimerEvent; +//class KMenu; + +extern unsigned short vt100_graphics[32]; + +class ScreenWindow; + +/** + * A widget which displays output from a terminal emulation and sends input keypresses and mouse activity + * to the terminal. + * + * When the terminal emulation receives new output from the program running in the terminal, + * it will update the display by calling updateImage(). + * + * TODO More documentation + */ + +class KONSOLEPRIVATE_EXPORT KTerminalDisplay : public QQuickPaintedItem +{ + Q_OBJECT + + Q_PROPERTY(KSession *session READ getSession WRITE setSession NOTIFY changedSession) + Q_PROPERTY(QString colorScheme READ scheme() WRITE setColorScheme NOTIFY changedScheme) + Q_PROPERTY(QFont font READ getVTFont WRITE setVTFont ) + Q_PROPERTY(bool activeFocusOnClick READ autoFocus WRITE setAutoFocus NOTIFY changedAutoFocus) + Q_PROPERTY(bool ShowIMEOnClick READ autoVKB WRITE setAutoVKB NOTIFY changedAutoVKB) + + +public: + KTerminalDisplay(QQuickItem *parent = 0); + ~KTerminalDisplay(); + + QString scheme() { return m_scheme; } + ///////////////////////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////////////////////////// + /** Returns the terminal color palette used by the display. */ + const ColorEntry* colorTable() const; + /** Sets the terminal color palette used by the display. */ + void setColorTable(const ColorEntry table[]); + /** + * Returns the seed used to generate random colors for the display + * (in color schemes that support them). + */ + uint randomSeed() const; + + /** Returns true if the cursor is set to blink or false otherwise. */ + bool blinkingCursor() { return _hasBlinkingCursor; } + /** Specifies whether or not the cursor blinks. */ + void setBlinkingCursor(bool blink); + + /** Specifies whether or not text can blink. */ + void setBlinkingTextEnabled(bool blink); + + void setLineSpacing(uint); + uint lineSpacing() const; + + void emitSelection(bool useXselection,bool appendReturn); + + /** + * This enum describes the available shapes for the keyboard cursor. + * See setKeyboardCursorShape() + */ + enum KeyboardCursorShape + { + /** A rectangular block which covers the entire area of the cursor character. */ + BlockCursor, + /** + * A single flat line which occupies the space at the bottom of the cursor + * character's area. + */ + UnderlineCursor, + /** + * An cursor shaped like the capital letter 'I', similar to the IBeam + * cursor used in Qt/KDE text editors. + */ + IBeamCursor + }; + /** + * Sets the shape of the keyboard cursor. This is the cursor drawn + * at the position in the terminal where keyboard input will appear. + * + * In addition the terminal display widget also has a cursor for + * the mouse pointer, which can be set using the QWidget::setCursor() + * method. + * + * Defaults to BlockCursor + */ + void setKeyboardCursorShape(KeyboardCursorShape shape); + /** + * Returns the shape of the keyboard cursor. See setKeyboardCursorShape() + */ + KeyboardCursorShape keyboardCursorShape() const; + + /** + * Sets the color used to draw the keyboard cursor. + * + * The keyboard cursor defaults to using the foreground color of the character + * underneath it. + * + * @param useForegroundColor If true, the cursor color will change to match + * the foreground color of the character underneath it as it is moved, in this + * case, the @p color parameter is ignored and the color of the character + * under the cursor is inverted to ensure that it is still readable. + * @param color The color to use to draw the cursor. This is only taken into + * account if @p useForegroundColor is false. + */ + void setKeyboardCursorColor(bool useForegroundColor , const QColor& color); + + /** + * Returns the color of the keyboard cursor, or an invalid color if the keyboard + * cursor color is set to change according to the foreground color of the character + * underneath it. + */ + QColor keyboardCursorColor() const; + + // Show VKB + void ShowVKB(bool show); + + /** + * Returns the number of lines of text which can be displayed in the widget. + * + * This will depend upon the height of the widget and the current font. + * See fontHeight() + */ + int lines() { return _lines; } + /** + * Returns the number of characters of text which can be displayed on + * each line in the widget. + * + * This will depend upon the width of the widget and the current font. + * See fontWidth() + */ + int columns() { return _columns; } + + /** + * Returns the height of the characters in the font used to draw the text in the display. + */ + int fontHeight() { return _fontHeight; } + /** + * Returns the width of the characters in the display. + * This assumes the use of a fixed-width font. + */ + int fontWidth() { return _fontWidth; } + + + + /** + * Sets which characters, in addition to letters and numbers, + * are regarded as being part of a word for the purposes + * of selecting words in the display by double clicking on them. + * + * The word boundaries occur at the first and last characters which + * are either a letter, number, or a character in @p wc + * + * @param wc An array of characters which are to be considered parts + * of a word ( in addition to letters and numbers ). + */ + void setWordCharacters(const QString& wc); + /** + * Returns the characters which are considered part of a word for the + * purpose of selecting words in the display with the mouse. + * + * @see setWordCharacters() + */ + QString wordCharacters() { return _wordCharacters; } + + /** + * Sets the type of effect used to alert the user when a 'bell' occurs in the + * terminal session. + * + * The terminal session can trigger the bell effect by calling bell() with + * the alert message. + */ + void setBellMode(int mode); + /** + * Returns the type of effect used to alert the user when a 'bell' occurs in + * the terminal session. + * + * See setBellMode() + */ + int bellMode() { return _bellMode; } + + /** + * This enum describes the different types of sounds and visual effects which + * can be used to alert the user when a 'bell' occurs in the terminal + * session. + */ + enum BellMode + { + /** A system beep. */ + SystemBeepBell=0, + /** + * KDE notification. This may play a sound, show a passive popup + * or perform some other action depending on the user's settings. + */ + NotifyBell=1, + /** A silent, visual bell (eg. inverting the display's colors briefly) */ + VisualBell=2, + /** No bell effects */ + NoBell=3 + }; + + void setSelection(const QString &t); + + /** + * Specified whether anti-aliasing of text in the terminal display + * is enabled or not. Defaults to enabled. + */ + static void setAntialias( bool antialias ) { _antialiasText = antialias; } + /** + * Returns true if anti-aliasing of text in the terminal is enabled. + */ + static bool antialias() { return _antialiasText; } + + /** + * Specifies whether characters with intense colors should be rendered + * as bold. Defaults to true. + */ + void setBoldIntense(bool value) { _boldIntense = value; } + /** + * Returns true if characters with intense colors are rendered in bold. + */ + bool getBoldIntense() { return _boldIntense; } + + /** + * Sets the status of the BiDi rendering inside the terminal display. + * Defaults to disabled. + */ + void setBidiEnabled(bool set) { _bidiEnabled=set; } + /** + * Returns the status of the BiDi rendering in this widget. + */ + bool isBidiEnabled() { return _bidiEnabled; } + + /** + * Sets the terminal screen section which is displayed in this widget. + * When updateImage() is called, the display fetches the latest character image from the + * the associated terminal screen window. + * + * In terms of the model-view paradigm, the ScreenWindow is the model which is rendered + * by the TerminalDisplay. + */ + void setScreenWindow( ScreenWindow* window ); + /** Returns the terminal screen section which is displayed in this widget. See setScreenWindow() */ + ScreenWindow* screenWindow() const; + + static bool HAVE_TRANSPARENCY; + ///////////////////////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////////////////////////// + + + + +public slots: + void forcedFocus(); + void setColorScheme(const QString &name); + QStringList availableColorSchemes(); + + void click(qreal x, qreal y); + + bool autoFocus() { return m_focusOnClick; } + void setAutoFocus(bool au); + bool autoVKB() { return m_showVKBonClick; } + void setAutoVKB(bool au); + + + /** Returns the font used to draw characters in the display */ + QFont getVTFont() { return m_font; } + + /** + * Sets the font used to draw the display. Has no effect if @p font + * is larger than the size of the display itself. + */ + void setVTFont(const QFont& font); + + /** + * Scroll to the bottom of the terminal (reset scrolling). + */ + void scrollToEnd(); + + ///////////////////////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////////////////////////// + /** + * Causes the terminal display to fetch the latest character image from the associated + * terminal screen ( see setScreenWindow() ) and redraw the display. + */ + void updateImage(); + /** + * Causes the terminal display to fetch the latest line status flags from the + * associated terminal screen ( see setScreenWindow() ). + */ + void updateLineProperties(); + + /** Copies the selected text to the clipboard. */ + void copyClipboard(); + /** + * Pastes the content of the clipboard into the + * display. + */ + void pasteClipboard(); + /** + * Pastes the content of the selection into the + * display. + */ + void pasteSelection(); + + /** + * Changes whether the flow control warning box should be shown when the flow control + * stop key (Ctrl+S) are pressed. + */ + void setFlowControlWarningEnabled(bool enabled); + /** + * Returns true if the flow control warning box is enabled. + * See outputSuspended() and setFlowControlWarningEnabled() + */ + bool flowControlWarningEnabled() const + { return _flowControlWarningEnabled; } + + /** + * Causes the widget to display or hide a message informing the user that terminal + * output has been suspended (by using the flow control key combination Ctrl+S) + * + * @param suspended True if terminal output has been suspended and the warning message should + * be shown or false to indicate that terminal output has been resumed and that + * the warning message should disappear. + */ + //void outputSuspended(bool suspended); + + /** + * Shows a notification that a bell event has occurred in the terminal. + * TODO: More documentation here + */ + void bell(const QString& message); + + /** + * Sets the background of the display to the specified color. + * @see setColorTable(), setForegroundColor() + */ + void setBackgroundColor(const QColor& color); + + /** + * Sets the text of the display to the specified color. + * @see setColorTable(), setBackgroundColor() + */ + void setForegroundColor(const QColor& color); + + void selectionChanged(); + ///////////////////////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////////////////////////// + + void setSession(KSession * session); + KSession * getSession() const { return m_session; } + +signals: + void changedScheme(QString scheme); + void changedAutoVKB(bool au); + void changedAutoFocus(bool au); + + void clicked(); + + ///////////////////////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////////////////////////// + /** + * Emitted when the user presses a key whilst the terminal widget has focus. + */ + void keyPressedSignal(QKeyEvent *e); + + void changedFontMetricSignal(int height, int width); + void changedContentSizeSignal(int height, int width); + + /** + * Emitted when the user right clicks on the display, or right-clicks with the Shift + * key held down if usesMouse() is true. + * + * This can be used to display a context menu. + */ + void configureRequest(const QPoint& position); + + /** + * When a shortcut which is also a valid terminal key sequence is pressed while + * the terminal widget has focus, this signal is emitted to allow the host to decide + * whether the shortcut should be overridden. + * When the shortcut is overridden, the key sequence will be sent to the terminal emulation instead + * and the action associated with the shortcut will not be triggered. + * + * @p override is set to false by default and the shortcut will be triggered as normal. + */ + void overrideShortcutCheck(QKeyEvent* keyEvent,bool& override); + void isBusySelecting(bool); + //void sendStringToEmu(const char*); + + // qtermwidget signals + void copyAvailable(bool); + void termGetFocus(); + void termLostFocus(); + ///////////////////////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////////////////////////// + + void changedSession(KSession *session); + + +protected: + void paint (QPainter * painter); + void keyPressEvent(QKeyEvent *event); + bool event( QEvent *); + + void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry); + QRect geometryRound(const QRectF &r) const; + + void mousePressEvent(QMouseEvent*ev); +// void mouseReleaseEvent( QMouseEvent* ); +// void mouseMoveEvent( QMouseEvent* ); + + void focusInEvent(QFocusEvent* event); + void focusOutEvent(QFocusEvent* event); + + + + ///////////////////////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////////////////////////// + void fontChange(const QFont &font); + void extendSelection(const QPoint &pos ); + + // classifies the 'ch' into one of three categories + // and returns a character to indicate which category it is in + // + // - A space (returns ' ') + // - Part of a word (returns 'a') + // - Other characters (returns the input character) + QChar charClass(QChar ch) const; + + void clearImage(); + + // reimplemented + // cath for UT Soft Keyboard QInputMethodEvent + void inputMethodEvent ( QInputMethodEvent* event ); + void inputMethodQuery( QInputMethodQueryEvent* event ); + QVariant inputMethodQuery( Qt::InputMethodQuery query ) const; + ///////////////////////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////////////////////////// + + +protected slots: + ///////////////////////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////////////////////////// + void blinkEvent(); + void blinkCursorEvent(); + + //Renables bell noises and visuals. Used to disable further bells for a short period of time + //after emitting the first in a sequence of bell events. + void enableBell(); + ///////////////////////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////////////////////////// + + +private slots: + void swapColorTable(); + +private: + ///////////////////////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////////////////////////// + // -- Drawing helpers -- + + // divides the part of the display specified by 'rect' into + // fragments according to their colors and styles and calls + // drawTextFragment() to draw the fragments + void drawContents(QPainter *paint, QRectF &rect); + + // draws a section of text, all the text in this section + // has a common color and style + void drawTextFragment(QPainter *painter, const QRectF &rect, + const QString& text, const Character* style); + + // draws the background for a text fragment + // if useOpacitySetting is true then the color's alpha value will be set to + // the display's transparency (set with setOpacity()), otherwise the background + // will be drawn fully opaque + void drawBackground(QPainter *painter, const QRectF& rect, const QColor& color, + bool useOpacitySetting); + + // draws the cursor character + void drawCursor(QPainter *painter, const QRectF &rect , const QColor& foregroundColor, + const QColor& backgroundColor , bool& invertColors); + + // draws the characters or line graphics in a text fragment + void drawCharacters(QPainter *painter, const QRectF &rect, const QString& text, + const Character* style, bool invertCharacterColor); + + // draws a string of line graphics + void drawLineCharString(QPainter *painter, qreal x, qreal y, + const QString& str, const Character* attributes); + + // draws the preedit string for input methods + void drawInputMethodPreeditString(QPainter *painter , const QRectF& rect); + + // -- + + // maps an area in the character image to an area on the widget + QRect imageToWidget(const QRect& imageArea) const; + + // maps a point on the widget to the position ( ie. line and column ) + // of the character at that point. + void getCharacterPosition(const QPointF& widgetPoint,int& line,int& column) const; + + // the area where the preedit string for input methods will be draw + QRectF preeditRect() const; + + // scrolls the image by a number of lines. + // 'lines' may be positive ( to scroll the image down ) + // or negative ( to scroll the image up ) + // 'region' is the part of the image to scroll - currently only + // the top, bottom and height of 'region' are taken into account, + // the left and right are ignored. + void scrollImage(int lines , const QRect& region); + + void calcGeometry(); + void propagateSize(); + void updateImageSize(); + void makeImage(); + + // returns the position of the cursor in columns and lines + QPoint cursorPosition() const; + + // redraws the cursor + void updateCursor(); + + bool handleShortcutOverrideEvent(QKeyEvent* event); + ///////////////////////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////////////////////////// + + /** + * Sets the seed used to generate random colors for the display + * (in color schemes that support them). + */ + void setRandomSeed(uint seed); + + + + ///////////////////////////////////////////////////////////////////////////////////// + /// MEMBERS + ///////////////////////////////////////////////////////////////////////////////////// + QFont m_font; + QPalette m_palette; + KSession *m_session; + QString m_scheme; + + bool m_focusOnClick; + bool m_showVKBonClick; + + QQuickItem *m_parent; + QRectF m_widgetRect; + + ///////////////////////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////////////////////////// + // the window onto the terminal screen which this display + // is currently showing. + QPointer _screenWindow; + + bool _allowBell; + bool _fixedFont; // has fixed pitch + int _fontHeight; // height + qreal _fontWidth; // width + int _fontAscent; // ascend + bool _boldIntense; // Whether intense colors should be rendered with bold font + + qreal _leftMargin; // offset + qreal _topMargin; // offset + + int _lines; // the number of lines that can be displayed in the widget + int _columns; // the number of columns that can be displayed in the widget + + int _usedLines; // the number of lines that are actually being used, this will be less + // than 'lines' if the character image provided with setImage() is smaller + // than the maximum image size which can be displayed + + int _usedColumns; // the number of columns that are actually being used, this will be less + // than 'columns' if the character image provided with setImage() is smaller + // than the maximum image size which can be displayed + + qreal _contentHeight; + qreal _contentWidth; + + Character* _image; // [lines][columns] + // only the area [usedLines][usedColumns] in the image contains valid data + + int _imageSize; + QVector _lineProperties; + + ColorEntry _colorTable[TABLE_COLORS]; + uint _randomSeed; + + bool _resizing; + bool _bidiEnabled; + + QPoint _iPntSel; // initial selection point + QPoint _pntSel; // current selection point + QPoint _tripleSelBegin; // help avoid flicker + int _actSel; // selection state + bool _wordSelectionMode; + bool _lineSelectionMode; + bool _preserveLineBreaks; + bool _columnSelectionMode; + + QClipboard* _clipboard; + QString _wordCharacters; + int _bellMode; + + bool _blinking; // hide text in paintEvent + bool _hasBlinker; // has characters to blink + bool _cursorBlinking; // hide cursor in paintEvent + bool _hasBlinkingCursor; // has blinking cursor enabled + bool _allowBlinkingText; // allow text to blink + + bool _isFixedSize; //Columns / lines are locked. + QTimer* _blinkTimer; // active when hasBlinker + QTimer* _blinkCursorTimer; // active when hasBlinkingCursor + QTimer* _resizeTimer; + + bool _flowControlWarningEnabled; + + uint _lineSpacing; + bool _colorsInverted; // true during visual bell + QRgb _blendColor; + + KeyboardCursorShape _cursorShape; + + // custom cursor color. if this is invalid then the foreground + // color of the character under the cursor is used + QColor _cursorColor; + + + struct InputMethodData + { + QString preeditString; + QRectF previousPreeditRect; + }; + InputMethodData _inputMethodData; + + static bool _antialiasText; // do we antialias or not + + //the delay in milliseconds between redrawing blinking text + static const int TEXT_BLINK_DELAY = 500; + static const int DEFAULT_LEFT_MARGIN = 1; + static const int DEFAULT_TOP_MARGIN = 1; + ///////////////////////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////////////////////////// + +public: + static void setTransparencyEnabled(bool enable) + { + HAVE_TRANSPARENCY = enable; + } +}; + +class AutoScrollHandler : public QObject +{ + Q_OBJECT + +public: + AutoScrollHandler(QQuickItem* parent); + +protected: + virtual void timerEvent(QTimerEvent* event); + virtual bool eventFilter(QObject* watched,QEvent* event); + +private: + QQuickItem* widget() const { return static_cast(parent()); } + int _timerId; +}; + +#endif // TERMINALDISPLAY_H diff --git a/konsole-qml-plugin/src/Vt102Emulation.cpp b/konsole-qml-plugin/src/Vt102Emulation.cpp new file mode 100644 index 0000000..a3e9fb2 --- /dev/null +++ b/konsole-qml-plugin/src/Vt102Emulation.cpp @@ -0,0 +1,1221 @@ +/* + This file is part of Konsole, an X terminal. + + Copyright 2007-2008 by Robert Knight + Copyright 1997,1998 by Lars Doelle + + 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. +*/ + +// Own +#include "Vt102Emulation.h" + +// XKB +//#include + +// this allows konsole to be compiled without XKB and XTEST extensions +// even though it might be available on a particular system. +#if defined(AVOID_XKB) + #undef HAVE_XKB +#endif + +#if defined(HAVE_XKB) + void scrolllock_set_off(); + void scrolllock_set_on(); +#endif + +// Standard +#include +#include +#include + +// Qt +#include +#include +#include + +// KDE +//#include +//#include + +// Konsole +#include "KeyboardTranslator.h" +#include "Screen.h" + +Vt102Emulation::Vt102Emulation() + : Emulation(), + _titleUpdateTimer(new QTimer(this)) +{ + _titleUpdateTimer->setSingleShot(true); + QObject::connect(_titleUpdateTimer , SIGNAL(timeout()) , this , SLOT(updateTitle())); + + initTokenizer(); + reset(); +} + +Vt102Emulation::~Vt102Emulation() +{} + +void Vt102Emulation::clearEntireScreen() +{ + _currentScreen->clearEntireScreen(); + bufferedUpdate(); +} + +void Vt102Emulation::reset() +{ + resetTokenizer(); + resetModes(); + resetCharset(0); + _screen[0]->reset(); + resetCharset(1); + _screen[1]->reset(); + setCodec(LocaleCodec); + + bufferedUpdate(); +} + +/* ------------------------------------------------------------------------- */ +/* */ +/* Processing the incoming byte stream */ +/* */ +/* ------------------------------------------------------------------------- */ + +/* Incoming Bytes Event pipeline + + This section deals with decoding the incoming character stream. + Decoding means here, that the stream is first separated into `tokens' + which are then mapped to a `meaning' provided as operations by the + `Screen' class or by the emulation class itself. + + The pipeline proceeds as follows: + + - Tokenizing the ESC codes (onReceiveChar) + - VT100 code page translation of plain characters (applyCharset) + - Interpretation of ESC codes (processToken) + + The escape codes and their meaning are described in the + technical reference of this program. +*/ + +// Tokens ------------------------------------------------------------------ -- + +/* + Since the tokens are the central notion if this section, we've put them + in front. They provide the syntactical elements used to represent the + terminals operations as byte sequences. + + They are encodes here into a single machine word, so that we can later + switch over them easily. Depending on the token itself, additional + argument variables are filled with parameter values. + + The tokens are defined below: + + - CHR - Printable characters (32..255 but DEL (=127)) + - CTL - Control characters (0..31 but ESC (= 27), DEL) + - ESC - Escape codes of the form + - ESC_DE - Escape codes of the form C + - CSI_PN - Escape codes of the form '[' {Pn} ';' {Pn} C + - CSI_PS - Escape codes of the form '[' {Pn} ';' ... C + - CSI_PR - Escape codes of the form '[' '?' {Pn} ';' ... C + - CSI_PE - Escape codes of the form '[' '!' {Pn} ';' ... C + - VT52 - VT52 escape codes + - + - 'Y'{Pc}{Pc} + - XTE_HA - Xterm window/terminal attribute commands + of the form `]' {Pn} `;' {Text} + (Note that these are handled differently to the other formats) + + The last two forms allow list of arguments. Since the elements of + the lists are treated individually the same way, they are passed + as individual tokens to the interpretation. Further, because the + meaning of the parameters are names (althought represented as numbers), + they are includes within the token ('N'). + +*/ + +#define TY_CONSTRUCT(T,A,N) ( ((((int)N) & 0xffff) << 16) | ((((int)A) & 0xff) << 8) | (((int)T) & 0xff) ) + +#define TY_CHR( ) TY_CONSTRUCT(0,0,0) +#define TY_CTL(A ) TY_CONSTRUCT(1,A,0) +#define TY_ESC(A ) TY_CONSTRUCT(2,A,0) +#define TY_ESC_CS(A,B) TY_CONSTRUCT(3,A,B) +#define TY_ESC_DE(A ) TY_CONSTRUCT(4,A,0) +#define TY_CSI_PS(A,N) TY_CONSTRUCT(5,A,N) +#define TY_CSI_PN(A ) TY_CONSTRUCT(6,A,0) +#define TY_CSI_PR(A,N) TY_CONSTRUCT(7,A,N) + +#define TY_VT52(A) TY_CONSTRUCT(8,A,0) +#define TY_CSI_PG(A) TY_CONSTRUCT(9,A,0) +#define TY_CSI_PE(A) TY_CONSTRUCT(10,A,0) + +#define MAX_ARGUMENT 4096 + +// Tokenizer --------------------------------------------------------------- -- + +/* The tokenizer's state + + The state is represented by the buffer (tokenBuffer, tokenBufferPos), + and accompanied by decoded arguments kept in (argv,argc). + Note that they are kept internal in the tokenizer. +*/ + +void Vt102Emulation::resetTokenizer() +{ + tokenBufferPos = 0; + argc = 0; + argv[0] = 0; + argv[1] = 0; +} + +void Vt102Emulation::addDigit(int digit) +{ + if (argv[argc] < MAX_ARGUMENT) + argv[argc] = 10*argv[argc] + digit; +} + +void Vt102Emulation::addArgument() +{ + argc = qMin(argc+1,MAXARGS-1); + argv[argc] = 0; +} + +void Vt102Emulation::addToCurrentToken(int cc) +{ + tokenBuffer[tokenBufferPos] = cc; + tokenBufferPos = qMin(tokenBufferPos+1,MAX_TOKEN_LENGTH-1); +} + +// Character Class flags used while decoding + +#define CTL 1 // Control character +#define CHR 2 // Printable character +#define CPN 4 // TODO: Document me +#define DIG 8 // Digit +#define SCS 16 // TODO: Document me +#define GRP 32 // TODO: Document me +#define CPS 64 // Character which indicates end of window resize + // escape sequence '\e[8;;t' + +void Vt102Emulation::initTokenizer() +{ + int i; + quint8* s; + for(i = 0;i < 256; ++i) + charClass[i] = 0; + for(i = 0;i < 32; ++i) + charClass[i] |= CTL; + for(i = 32;i < 256; ++i) + charClass[i] |= CHR; + for(s = (quint8*)"@ABCDGHILMPSTXZcdfry"; *s; ++s) + charClass[*s] |= CPN; + // resize = \e[8;;t + for(s = (quint8*)"t"; *s; ++s) + charClass[*s] |= CPS; + for(s = (quint8*)"0123456789"; *s; ++s) + charClass[*s] |= DIG; + for(s = (quint8*)"()+*%"; *s; ++s) + charClass[*s] |= SCS; + for(s = (quint8*)"()+*#[]%"; *s; ++s) + charClass[*s] |= GRP; + + resetTokenizer(); +} + +/* Ok, here comes the nasty part of the decoder. + + Instead of keeping an explicit state, we deduce it from the + token scanned so far. It is then immediately combined with + the current character to form a scanning decision. + + This is done by the following defines. + + - P is the length of the token scanned so far. + - L (often P-1) is the position on which contents we base a decision. + - C is a character or a group of characters (taken from 'charClass'). + + - 'cc' is the current character + - 's' is a pointer to the start of the token buffer + - 'p' is the current position within the token buffer + + Note that they need to applied in proper order. +*/ + +#define lec(P,L,C) (p == (P) && s[(L)] == (C)) +#define lun( ) (p == 1 && cc >= 32 ) +#define les(P,L,C) (p == (P) && s[L] < 256 && (charClass[s[(L)]] & (C)) == (C)) +#define eec(C) (p >= 3 && cc == (C)) +#define ees(C) (p >= 3 && cc < 256 && (charClass[cc] & (C)) == (C)) +#define eps(C) (p >= 3 && s[2] != '?' && s[2] != '!' && s[2] != '>' && cc < 256 && (charClass[cc] & (C)) == (C)) +#define epp( ) (p >= 3 && s[2] == '?') +#define epe( ) (p >= 3 && s[2] == '!') +#define egt( ) (p >= 3 && s[2] == '>') +#define Xpe (tokenBufferPos >= 2 && tokenBuffer[1] == ']') +#define Xte (Xpe && cc == 7 ) +#define ces(C) (cc < 256 && (charClass[cc] & (C)) == (C) && !Xte) + +#define ESC 27 +#define CNTL(c) ((c)-'@') + +// process an incoming unicode character +void Vt102Emulation::receiveChar(int cc) +{ + if (cc == 127) + return; //VT100: ignore. + + if (ces(CTL)) + { + // DEC HACK ALERT! Control Characters are allowed *within* esc sequences in VT100 + // This means, they do neither a resetTokenizer() nor a pushToToken(). Some of them, do + // of course. Guess this originates from a weakly layered handling of the X-on + // X-off protocol, which comes really below this level. + if (cc == CNTL('X') || cc == CNTL('Z') || cc == ESC) + resetTokenizer(); //VT100: CAN or SUB + if (cc != ESC) + { + processToken(TY_CTL(cc+'@' ),0,0); + return; + } + } + // advance the state + addToCurrentToken(cc); + + int* s = tokenBuffer; + int p = tokenBufferPos; + + if (getMode(MODE_Ansi)) + { + if (lec(1,0,ESC)) { return; } + if (lec(1,0,ESC+128)) { s[0] = ESC; receiveChar('['); return; } + if (les(2,1,GRP)) { return; } + if (Xte ) { processWindowAttributeChange(); resetTokenizer(); return; } + if (Xpe ) { return; } + if (lec(3,2,'?')) { return; } + if (lec(3,2,'>')) { return; } + if (lec(3,2,'!')) { return; } + if (lun( )) { processToken( TY_CHR(), applyCharset(cc), 0); resetTokenizer(); return; } + if (lec(2,0,ESC)) { processToken( TY_ESC(s[1]), 0, 0); resetTokenizer(); return; } + if (les(3,1,SCS)) { processToken( TY_ESC_CS(s[1],s[2]), 0, 0); resetTokenizer(); return; } + if (lec(3,1,'#')) { processToken( TY_ESC_DE(s[2]), 0, 0); resetTokenizer(); return; } + if (eps( CPN)) { processToken( TY_CSI_PN(cc), argv[0],argv[1]); resetTokenizer(); return; } + + // resize = \e[8;;t + if (eps(CPS)) + { + processToken( TY_CSI_PS(cc, argv[0]), argv[1], argv[2]); + resetTokenizer(); + return; + } + + if (epe( )) { processToken( TY_CSI_PE(cc), 0, 0); resetTokenizer(); return; } + if (ees(DIG)) { addDigit(cc-'0'); return; } + if (eec(';')) { addArgument(); return; } + for (int i=0;i<=argc;i++) + { + if (epp()) + processToken( TY_CSI_PR(cc,argv[i]), 0, 0); + else if (egt()) + processToken( TY_CSI_PG(cc), 0, 0); // spec. case for ESC]>0c or ESC]>c + else if (cc == 'm' && argc - i >= 4 && (argv[i] == 38 || argv[i] == 48) && argv[i+1] == 2) + { + // ESC[ ... 48;2;;; ... m -or- ESC[ ... 38;2;;; ... m + i += 2; + processToken( TY_CSI_PS(cc, argv[i-2]), COLOR_SPACE_RGB, (argv[i] << 16) | (argv[i+1] << 8) | argv[i+2]); + i += 2; + } + else if (cc == 'm' && argc - i >= 2 && (argv[i] == 38 || argv[i] == 48) && argv[i+1] == 5) + { + // ESC[ ... 48;5; ... m -or- ESC[ ... 38;5; ... m + i += 2; + processToken( TY_CSI_PS(cc, argv[i-2]), COLOR_SPACE_256, argv[i]); + } + else + processToken( TY_CSI_PS(cc,argv[i]), 0, 0); + } + resetTokenizer(); + } + else + { + // VT52 Mode + if (lec(1,0,ESC)) + return; + if (les(1,0,CHR)) + { + processToken( TY_CHR(), s[0], 0); + resetTokenizer(); + return; + } + if (lec(2,1,'Y')) + return; + if (lec(3,1,'Y')) + return; + if (p < 4) + { + processToken( TY_VT52(s[1] ), 0, 0); + resetTokenizer(); + return; + } + processToken( TY_VT52(s[1]), s[2], s[3]); + resetTokenizer(); + return; + } +} +void Vt102Emulation::processWindowAttributeChange() +{ + // Describes the window or terminal session attribute to change + // See Session::UserTitleChange for possible values + int attributeToChange = 0; + int i; + for (i = 2; i < tokenBufferPos && + tokenBuffer[i] >= '0' && + tokenBuffer[i] <= '9'; i++) + { + attributeToChange = 10 * attributeToChange + (tokenBuffer[i]-'0'); + } + + if (tokenBuffer[i] != ';') + { + reportDecodingError(); + return; + } + + QString newValue; + newValue.reserve(tokenBufferPos-i-2); + for (int j = 0; j < tokenBufferPos-i-2; j++) + newValue[j] = tokenBuffer[i+1+j]; + + _pendingTitleUpdates[attributeToChange] = newValue; + _titleUpdateTimer->start(20); +} + +void Vt102Emulation::updateTitle() +{ + QListIterator iter( _pendingTitleUpdates.keys() ); + while (iter.hasNext()) { + int arg = iter.next(); + emit titleChanged( arg , _pendingTitleUpdates[arg] ); + } + _pendingTitleUpdates.clear(); +} + +// Interpreting Codes --------------------------------------------------------- + +/* + Now that the incoming character stream is properly tokenized, + meaning is assigned to them. These are either operations of + the current _screen, or of the emulation class itself. + + The token to be interpreteted comes in as a machine word + possibly accompanied by two parameters. + + Likewise, the operations assigned to, come with up to two + arguments. One could consider to make up a proper table + from the function below. + + The technical reference manual provides more information + about this mapping. +*/ + +void Vt102Emulation::processToken(int token, int p, int q) +{ + switch (token) + { + + case TY_CHR( ) : _currentScreen->displayCharacter (p ); break; //UTF16 + + // 127 DEL : ignored on input + + case TY_CTL('@' ) : /* NUL: ignored */ break; + case TY_CTL('A' ) : /* SOH: ignored */ break; + case TY_CTL('B' ) : /* STX: ignored */ break; + case TY_CTL('C' ) : /* ETX: ignored */ break; + case TY_CTL('D' ) : /* EOT: ignored */ break; + case TY_CTL('E' ) : reportAnswerBack ( ); break; //VT100 + case TY_CTL('F' ) : /* ACK: ignored */ break; + case TY_CTL('G' ) : emit stateSet(NOTIFYBELL); + break; //VT100 + case TY_CTL('H' ) : _currentScreen->backspace ( ); break; //VT100 + case TY_CTL('I' ) : _currentScreen->tab ( ); break; //VT100 + case TY_CTL('J' ) : _currentScreen->newLine ( ); break; //VT100 + case TY_CTL('K' ) : _currentScreen->newLine ( ); break; //VT100 + case TY_CTL('L' ) : _currentScreen->newLine ( ); break; //VT100 + case TY_CTL('M' ) : _currentScreen->toStartOfLine ( ); break; //VT100 + + case TY_CTL('N' ) : useCharset ( 1); break; //VT100 + case TY_CTL('O' ) : useCharset ( 0); break; //VT100 + + case TY_CTL('P' ) : /* DLE: ignored */ break; + case TY_CTL('Q' ) : /* DC1: XON continue */ break; //VT100 + case TY_CTL('R' ) : /* DC2: ignored */ break; + case TY_CTL('S' ) : /* DC3: XOFF halt */ break; //VT100 + case TY_CTL('T' ) : /* DC4: ignored */ break; + case TY_CTL('U' ) : /* NAK: ignored */ break; + case TY_CTL('V' ) : /* SYN: ignored */ break; + case TY_CTL('W' ) : /* ETB: ignored */ break; + case TY_CTL('X' ) : _currentScreen->displayCharacter ( 0x2592); break; //VT100 + case TY_CTL('Y' ) : /* EM : ignored */ break; + case TY_CTL('Z' ) : _currentScreen->displayCharacter ( 0x2592); break; //VT100 + case TY_CTL('[' ) : /* ESC: cannot be seen here. */ break; + case TY_CTL('\\' ) : /* FS : ignored */ break; + case TY_CTL(']' ) : /* GS : ignored */ break; + case TY_CTL('^' ) : /* RS : ignored */ break; + case TY_CTL('_' ) : /* US : ignored */ break; + + case TY_ESC('D' ) : _currentScreen->index ( ); break; //VT100 + case TY_ESC('E' ) : _currentScreen->nextLine ( ); break; //VT100 + case TY_ESC('H' ) : _currentScreen->changeTabStop (true ); break; //VT100 + case TY_ESC('M' ) : _currentScreen->reverseIndex ( ); break; //VT100 + case TY_ESC('Z' ) : reportTerminalType ( ); break; + case TY_ESC('c' ) : reset ( ); break; + + case TY_ESC('n' ) : useCharset ( 2); break; + case TY_ESC('o' ) : useCharset ( 3); break; + case TY_ESC('7' ) : saveCursor ( ); break; + case TY_ESC('8' ) : restoreCursor ( ); break; + + case TY_ESC('=' ) : setMode (MODE_AppKeyPad); break; + case TY_ESC('>' ) : resetMode (MODE_AppKeyPad); break; + case TY_ESC('<' ) : setMode (MODE_Ansi ); break; //VT100 + + case TY_ESC_CS('(', '0') : setCharset (0, '0'); break; //VT100 + case TY_ESC_CS('(', 'A') : setCharset (0, 'A'); break; //VT100 + case TY_ESC_CS('(', 'B') : setCharset (0, 'B'); break; //VT100 + + case TY_ESC_CS(')', '0') : setCharset (1, '0'); break; //VT100 + case TY_ESC_CS(')', 'A') : setCharset (1, 'A'); break; //VT100 + case TY_ESC_CS(')', 'B') : setCharset (1, 'B'); break; //VT100 + + case TY_ESC_CS('*', '0') : setCharset (2, '0'); break; //VT100 + case TY_ESC_CS('*', 'A') : setCharset (2, 'A'); break; //VT100 + case TY_ESC_CS('*', 'B') : setCharset (2, 'B'); break; //VT100 + + case TY_ESC_CS('+', '0') : setCharset (3, '0'); break; //VT100 + case TY_ESC_CS('+', 'A') : setCharset (3, 'A'); break; //VT100 + case TY_ESC_CS('+', 'B') : setCharset (3, 'B'); break; //VT100 + + case TY_ESC_CS('%', 'G') : setCodec (Utf8Codec ); break; //LINUX + case TY_ESC_CS('%', '@') : setCodec (LocaleCodec ); break; //LINUX + + case TY_ESC_DE('3' ) : /* Double height line, top half */ + _currentScreen->setLineProperty( LINE_DOUBLEWIDTH , true ); + _currentScreen->setLineProperty( LINE_DOUBLEHEIGHT , true ); + break; + case TY_ESC_DE('4' ) : /* Double height line, bottom half */ + _currentScreen->setLineProperty( LINE_DOUBLEWIDTH , true ); + _currentScreen->setLineProperty( LINE_DOUBLEHEIGHT , true ); + break; + case TY_ESC_DE('5' ) : /* Single width, single height line*/ + _currentScreen->setLineProperty( LINE_DOUBLEWIDTH , false); + _currentScreen->setLineProperty( LINE_DOUBLEHEIGHT , false); + break; + case TY_ESC_DE('6' ) : /* Double width, single height line*/ + _currentScreen->setLineProperty( LINE_DOUBLEWIDTH , true); + _currentScreen->setLineProperty( LINE_DOUBLEHEIGHT , false); + break; + case TY_ESC_DE('8' ) : _currentScreen->helpAlign ( ); break; + +// resize = \e[8;;t + case TY_CSI_PS('t', 8) : setImageSize( q /* columns */, p /* lines */ ); break; + +// change tab text color : \e[28;t color: 0-16,777,215 + case TY_CSI_PS('t', 28) : emit changeTabTextColorRequest ( p ); break; + + case TY_CSI_PS('K', 0) : _currentScreen->clearToEndOfLine ( ); break; + case TY_CSI_PS('K', 1) : _currentScreen->clearToBeginOfLine ( ); break; + case TY_CSI_PS('K', 2) : _currentScreen->clearEntireLine ( ); break; + case TY_CSI_PS('J', 0) : _currentScreen->clearToEndOfScreen ( ); break; + case TY_CSI_PS('J', 1) : _currentScreen->clearToBeginOfScreen ( ); break; + case TY_CSI_PS('J', 2) : _currentScreen->clearEntireScreen ( ); break; + case TY_CSI_PS('J', 3) : clearHistory(); break; + case TY_CSI_PS('g', 0) : _currentScreen->changeTabStop (false ); break; //VT100 + case TY_CSI_PS('g', 3) : _currentScreen->clearTabStops ( ); break; //VT100 + case TY_CSI_PS('h', 4) : _currentScreen-> setMode (MODE_Insert ); break; + case TY_CSI_PS('h', 20) : setMode (MODE_NewLine ); break; + case TY_CSI_PS('i', 0) : /* IGNORE: attached printer */ break; //VT100 + case TY_CSI_PS('l', 4) : _currentScreen-> resetMode (MODE_Insert ); break; + case TY_CSI_PS('l', 20) : resetMode (MODE_NewLine ); break; + case TY_CSI_PS('s', 0) : saveCursor ( ); break; + case TY_CSI_PS('u', 0) : restoreCursor ( ); 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', 4) : _currentScreen-> setRendition (RE_UNDERLINE); 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', 10) : /* 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', 22) : _currentScreen->resetRendition (RE_BOLD ); 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', 27) : _currentScreen->resetRendition (RE_REVERSE ); break; + + case TY_CSI_PS('m', 30) : _currentScreen->setForeColor (COLOR_SPACE_SYSTEM, 0); break; + case TY_CSI_PS('m', 31) : _currentScreen->setForeColor (COLOR_SPACE_SYSTEM, 1); break; + case TY_CSI_PS('m', 32) : _currentScreen->setForeColor (COLOR_SPACE_SYSTEM, 2); break; + case TY_CSI_PS('m', 33) : _currentScreen->setForeColor (COLOR_SPACE_SYSTEM, 3); break; + case TY_CSI_PS('m', 34) : _currentScreen->setForeColor (COLOR_SPACE_SYSTEM, 4); break; + case TY_CSI_PS('m', 35) : _currentScreen->setForeColor (COLOR_SPACE_SYSTEM, 5); break; + case TY_CSI_PS('m', 36) : _currentScreen->setForeColor (COLOR_SPACE_SYSTEM, 6); break; + case TY_CSI_PS('m', 37) : _currentScreen->setForeColor (COLOR_SPACE_SYSTEM, 7); break; + + case TY_CSI_PS('m', 38) : _currentScreen->setForeColor (p, q); break; + + case TY_CSI_PS('m', 39) : _currentScreen->setForeColor (COLOR_SPACE_DEFAULT, 0); break; + + case TY_CSI_PS('m', 40) : _currentScreen->setBackColor (COLOR_SPACE_SYSTEM, 0); break; + case TY_CSI_PS('m', 41) : _currentScreen->setBackColor (COLOR_SPACE_SYSTEM, 1); break; + case TY_CSI_PS('m', 42) : _currentScreen->setBackColor (COLOR_SPACE_SYSTEM, 2); break; + case TY_CSI_PS('m', 43) : _currentScreen->setBackColor (COLOR_SPACE_SYSTEM, 3); break; + case TY_CSI_PS('m', 44) : _currentScreen->setBackColor (COLOR_SPACE_SYSTEM, 4); break; + case TY_CSI_PS('m', 45) : _currentScreen->setBackColor (COLOR_SPACE_SYSTEM, 5); break; + case TY_CSI_PS('m', 46) : _currentScreen->setBackColor (COLOR_SPACE_SYSTEM, 6); break; + case TY_CSI_PS('m', 47) : _currentScreen->setBackColor (COLOR_SPACE_SYSTEM, 7); break; + + case TY_CSI_PS('m', 48) : _currentScreen->setBackColor (p, q); break; + + case TY_CSI_PS('m', 49) : _currentScreen->setBackColor (COLOR_SPACE_DEFAULT, 1); break; + + case TY_CSI_PS('m', 90) : _currentScreen->setForeColor (COLOR_SPACE_SYSTEM, 8); break; + case TY_CSI_PS('m', 91) : _currentScreen->setForeColor (COLOR_SPACE_SYSTEM, 9); break; + case TY_CSI_PS('m', 92) : _currentScreen->setForeColor (COLOR_SPACE_SYSTEM, 10); break; + case TY_CSI_PS('m', 93) : _currentScreen->setForeColor (COLOR_SPACE_SYSTEM, 11); break; + case TY_CSI_PS('m', 94) : _currentScreen->setForeColor (COLOR_SPACE_SYSTEM, 12); break; + case TY_CSI_PS('m', 95) : _currentScreen->setForeColor (COLOR_SPACE_SYSTEM, 13); break; + case TY_CSI_PS('m', 96) : _currentScreen->setForeColor (COLOR_SPACE_SYSTEM, 14); break; + case TY_CSI_PS('m', 97) : _currentScreen->setForeColor (COLOR_SPACE_SYSTEM, 15); break; + + case TY_CSI_PS('m', 100) : _currentScreen->setBackColor (COLOR_SPACE_SYSTEM, 8); break; + case TY_CSI_PS('m', 101) : _currentScreen->setBackColor (COLOR_SPACE_SYSTEM, 9); break; + case TY_CSI_PS('m', 102) : _currentScreen->setBackColor (COLOR_SPACE_SYSTEM, 10); break; + case TY_CSI_PS('m', 103) : _currentScreen->setBackColor (COLOR_SPACE_SYSTEM, 11); break; + case TY_CSI_PS('m', 104) : _currentScreen->setBackColor (COLOR_SPACE_SYSTEM, 12); break; + case TY_CSI_PS('m', 105) : _currentScreen->setBackColor (COLOR_SPACE_SYSTEM, 13); break; + case TY_CSI_PS('m', 106) : _currentScreen->setBackColor (COLOR_SPACE_SYSTEM, 14); break; + case TY_CSI_PS('m', 107) : _currentScreen->setBackColor (COLOR_SPACE_SYSTEM, 15); break; + + case TY_CSI_PS('n', 5) : reportStatus ( ); break; + case TY_CSI_PS('n', 6) : reportCursorPosition ( ); break; + case TY_CSI_PS('q', 0) : /* IGNORED: LEDs off */ break; //VT100 + case TY_CSI_PS('q', 1) : /* IGNORED: LED1 on */ break; //VT100 + case TY_CSI_PS('q', 2) : /* IGNORED: LED2 on */ break; //VT100 + case TY_CSI_PS('q', 3) : /* IGNORED: LED3 on */ break; //VT100 + case TY_CSI_PS('q', 4) : /* IGNORED: LED4 on */ break; //VT100 + case TY_CSI_PS('x', 0) : reportTerminalParms ( 2); break; //VT100 + case TY_CSI_PS('x', 1) : reportTerminalParms ( 3); break; //VT100 + + case TY_CSI_PN('@' ) : _currentScreen->insertChars (p ); break; + case TY_CSI_PN('A' ) : _currentScreen->cursorUp (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('D' ) : _currentScreen->cursorLeft (p ); break; //VT100 + 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('I' ) : _currentScreen->tab (p ); break; + case TY_CSI_PN('L' ) : _currentScreen->insertLines (p ); break; + case TY_CSI_PN('M' ) : _currentScreen->deleteLines (p ); break; + case TY_CSI_PN('P' ) : _currentScreen->deleteChars (p ); break; + case TY_CSI_PN('S' ) : _currentScreen->scrollUp (p ); break; + case TY_CSI_PN('T' ) : _currentScreen->scrollDown (p ); break; + case TY_CSI_PN('X' ) : _currentScreen->eraseChars (p ); break; + case TY_CSI_PN('Z' ) : _currentScreen->backtab (p ); break; + case TY_CSI_PN('c' ) : reportTerminalType ( ); break; //VT100 + case TY_CSI_PN('d' ) : _currentScreen->setCursorY (p ); break; //LINUX + case TY_CSI_PN('f' ) : _currentScreen->setCursorYX (p, q); break; //VT100 + case TY_CSI_PN('r' ) : setMargins (p, q); break; //VT100 + case TY_CSI_PN('y' ) : /* IGNORED: Confidence test */ break; //VT100 + + case TY_CSI_PR('h', 1) : setMode (MODE_AppCuKeys); break; //VT100 + case TY_CSI_PR('l', 1) : resetMode (MODE_AppCuKeys); break; //VT100 + case TY_CSI_PR('s', 1) : saveMode (MODE_AppCuKeys); break; //FIXME + case TY_CSI_PR('r', 1) : restoreMode (MODE_AppCuKeys); break; //FIXME + + case TY_CSI_PR('l', 2) : resetMode (MODE_Ansi ); break; //VT100 + + case TY_CSI_PR('h', 3) : setMode (MODE_132Columns);break; //VT100 + case TY_CSI_PR('l', 3) : resetMode (MODE_132Columns);break; //VT100 + + case TY_CSI_PR('h', 4) : /* IGNORED: soft scrolling */ break; //VT100 + case TY_CSI_PR('l', 4) : /* IGNORED: soft scrolling */ break; //VT100 + + case TY_CSI_PR('h', 5) : _currentScreen-> setMode (MODE_Screen ); break; //VT100 + case TY_CSI_PR('l', 5) : _currentScreen-> resetMode (MODE_Screen ); break; //VT100 + + case TY_CSI_PR('h', 6) : _currentScreen-> setMode (MODE_Origin ); break; //VT100 + case TY_CSI_PR('l', 6) : _currentScreen-> resetMode (MODE_Origin ); break; //VT100 + case TY_CSI_PR('s', 6) : _currentScreen-> saveMode (MODE_Origin ); break; //FIXME + case TY_CSI_PR('r', 6) : _currentScreen->restoreMode (MODE_Origin ); break; //FIXME + + case TY_CSI_PR('h', 7) : _currentScreen-> setMode (MODE_Wrap ); break; //VT100 + case TY_CSI_PR('l', 7) : _currentScreen-> resetMode (MODE_Wrap ); break; //VT100 + case TY_CSI_PR('s', 7) : _currentScreen-> saveMode (MODE_Wrap ); break; //FIXME + case TY_CSI_PR('r', 7) : _currentScreen->restoreMode (MODE_Wrap ); break; //FIXME + + case TY_CSI_PR('h', 8) : /* IGNORED: autorepeat on */ break; //VT100 + case TY_CSI_PR('l', 8) : /* IGNORED: autorepeat off */ break; //VT100 + case TY_CSI_PR('s', 8) : /* IGNORED: autorepeat on */ break; //VT100 + case TY_CSI_PR('r', 8) : /* IGNORED: autorepeat off */ break; //VT100 + + case TY_CSI_PR('h', 9) : /* IGNORED: interlace */ break; //VT100 + case TY_CSI_PR('l', 9) : /* IGNORED: interlace */ break; //VT100 + case TY_CSI_PR('s', 9) : /* IGNORED: interlace */ break; //VT100 + case TY_CSI_PR('r', 9) : /* IGNORED: interlace */ break; //VT100 + + case TY_CSI_PR('h', 12) : /* IGNORED: Cursor blink */ break; //att610 + case TY_CSI_PR('l', 12) : /* IGNORED: Cursor blink */ break; //att610 + case TY_CSI_PR('s', 12) : /* IGNORED: Cursor blink */ break; //att610 + case TY_CSI_PR('r', 12) : /* IGNORED: Cursor blink */ break; //att610 + + case TY_CSI_PR('h', 25) : setMode (MODE_Cursor ); break; //VT100 + case TY_CSI_PR('l', 25) : resetMode (MODE_Cursor ); break; //VT100 + case TY_CSI_PR('s', 25) : saveMode (MODE_Cursor ); break; //VT100 + case TY_CSI_PR('r', 25) : restoreMode (MODE_Cursor ); break; //VT100 + + case TY_CSI_PR('h', 40) : setMode(MODE_Allow132Columns ); break; // XTERM + case TY_CSI_PR('l', 40) : resetMode(MODE_Allow132Columns ); break; // XTERM + + case TY_CSI_PR('h', 41) : /* IGNORED: obsolete more(1) fix */ break; //XTERM + case TY_CSI_PR('l', 41) : /* IGNORED: obsolete more(1) fix */ break; //XTERM + case TY_CSI_PR('s', 41) : /* IGNORED: obsolete more(1) fix */ break; //XTERM + case TY_CSI_PR('r', 41) : /* IGNORED: obsolete more(1) fix */ break; //XTERM + + case TY_CSI_PR('h', 47) : setMode (MODE_AppScreen); break; //VT100 + case TY_CSI_PR('l', 47) : resetMode (MODE_AppScreen); break; //VT100 + case TY_CSI_PR('s', 47) : saveMode (MODE_AppScreen); break; //XTERM + case TY_CSI_PR('r', 47) : restoreMode (MODE_AppScreen); break; //XTERM + + case TY_CSI_PR('h', 67) : /* IGNORED: DECBKM */ break; //XTERM + case TY_CSI_PR('l', 67) : /* IGNORED: DECBKM */ break; //XTERM + case TY_CSI_PR('s', 67) : /* IGNORED: DECBKM */ break; //XTERM + case TY_CSI_PR('r', 67) : /* IGNORED: DECBKM */ break; //XTERM + + // XTerm defines the following modes: + // SET_VT200_MOUSE 1000 + // SET_VT200_HIGHLIGHT_MOUSE 1001 + // SET_BTN_EVENT_MOUSE 1002 + // SET_ANY_EVENT_MOUSE 1003 + // + + //Note about mouse modes: + //There are four mouse modes which xterm-compatible terminals can support - 1000,1001,1002,1003 + //Konsole currently supports mode 1000 (basic mouse press and release) and mode 1002 (dragging the mouse). + //TODO: Implementation of mouse modes 1001 (something called hilight tracking) and + //1003 (a slight variation on dragging the mouse) + // + + case TY_CSI_PR('h', 1000) : setMode (MODE_Mouse1000); break; //XTERM + case TY_CSI_PR('l', 1000) : resetMode (MODE_Mouse1000); break; //XTERM + case TY_CSI_PR('s', 1000) : saveMode (MODE_Mouse1000); break; //XTERM + case TY_CSI_PR('r', 1000) : restoreMode (MODE_Mouse1000); break; //XTERM + + case TY_CSI_PR('h', 1001) : /* IGNORED: hilite mouse tracking */ break; //XTERM + case TY_CSI_PR('l', 1001) : resetMode (MODE_Mouse1001); break; //XTERM + case TY_CSI_PR('s', 1001) : /* IGNORED: hilite mouse tracking */ break; //XTERM + case TY_CSI_PR('r', 1001) : /* IGNORED: hilite mouse tracking */ break; //XTERM + + case TY_CSI_PR('h', 1002) : setMode (MODE_Mouse1002); break; //XTERM + case TY_CSI_PR('l', 1002) : resetMode (MODE_Mouse1002); break; //XTERM + case TY_CSI_PR('s', 1002) : saveMode (MODE_Mouse1002); break; //XTERM + case TY_CSI_PR('r', 1002) : restoreMode (MODE_Mouse1002); break; //XTERM + + case TY_CSI_PR('h', 1003) : setMode (MODE_Mouse1003); break; //XTERM + case TY_CSI_PR('l', 1003) : resetMode (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('h', 1034) : /* IGNORED: 8bitinput activation */ break; //XTERM + + case TY_CSI_PR('h', 1047) : setMode (MODE_AppScreen); break; //XTERM + case TY_CSI_PR('l', 1047) : _screen[1]->clearEntireScreen(); resetMode(MODE_AppScreen); break; //XTERM + case TY_CSI_PR('s', 1047) : saveMode (MODE_AppScreen); break; //XTERM + case TY_CSI_PR('r', 1047) : restoreMode (MODE_AppScreen); break; //XTERM + + //FIXME: Unitoken: save translations + case TY_CSI_PR('h', 1048) : saveCursor ( ); break; //XTERM + case TY_CSI_PR('l', 1048) : restoreCursor ( ); break; //XTERM + case TY_CSI_PR('s', 1048) : saveCursor ( ); break; //XTERM + case TY_CSI_PR('r', 1048) : restoreCursor ( ); break; //XTERM + + //FIXME: every once new sequences like this pop up in xterm. + // Here's a guess of what they could mean. + 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 + + //FIXME: weird DEC reset sequence + case TY_CSI_PE('p' ) : /* IGNORED: reset ( ) */ break; + + //FIXME: when changing between vt52 and ansi mode evtl do some resetting. + case TY_VT52('A' ) : _currentScreen->cursorUp ( 1); break; //VT52 + case TY_VT52('B' ) : _currentScreen->cursorDown ( 1); break; //VT52 + case TY_VT52('C' ) : _currentScreen->cursorRight ( 1); break; //VT52 + case TY_VT52('D' ) : _currentScreen->cursorLeft ( 1); break; //VT52 + + case TY_VT52('F' ) : setAndUseCharset (0, '0'); break; //VT52 + case TY_VT52('G' ) : setAndUseCharset (0, 'B'); break; //VT52 + + case TY_VT52('H' ) : _currentScreen->setCursorYX (1,1 ); break; //VT52 + case TY_VT52('I' ) : _currentScreen->reverseIndex ( ); break; //VT52 + case TY_VT52('J' ) : _currentScreen->clearToEndOfScreen ( ); break; //VT52 + case TY_VT52('K' ) : _currentScreen->clearToEndOfLine ( ); break; //VT52 + case TY_VT52('Y' ) : _currentScreen->setCursorYX (p-31,q-31 ); break; //VT52 + case TY_VT52('Z' ) : reportTerminalType ( ); break; //VT52 + case TY_VT52('<' ) : setMode (MODE_Ansi ); break; //VT52 + case TY_VT52('=' ) : setMode (MODE_AppKeyPad); break; //VT52 + case TY_VT52('>' ) : resetMode (MODE_AppKeyPad); break; //VT52 + + case TY_CSI_PG('c' ) : reportSecondaryAttributes( ); break; //VT100 + + default: + reportDecodingError(); + break; + }; +} + +void Vt102Emulation::clearScreenAndSetColumns(int columnCount) +{ + setImageSize(_currentScreen->getLines(),columnCount); + clearEntireScreen(); + setDefaultMargins(); + _currentScreen->setCursorYX(0,0); +} + +void Vt102Emulation::sendString(const char* s , int length) +{ + if ( length >= 0 ) + emit sendData(s,length); + else + emit sendData(s,strlen(s)); +} + +void Vt102Emulation::reportCursorPosition() +{ + char tmp[20]; + sprintf(tmp,"\033[%d;%dR",_currentScreen->getCursorY()+1,_currentScreen->getCursorX()+1); + sendString(tmp); +} + +void Vt102Emulation::reportTerminalType() +{ + // Primary device attribute response (Request was: ^[[0c or ^[[c (from TT321 Users Guide)) + // VT220: ^[[?63;1;2;3;6;7;8c (list deps on emul. capabilities) + // VT100: ^[[?1;2c + // VT101: ^[[?1;0c + // VT102: ^[[?6v + if (getMode(MODE_Ansi)) + sendString("\033[?1;2c"); // I'm a VT100 + else + sendString("\033/Z"); // I'm a VT52 +} + +void Vt102Emulation::reportSecondaryAttributes() +{ + // Seconday device attribute response (Request was: ^[[>0c or ^[[>c) + if (getMode(MODE_Ansi)) + sendString("\033[>0;115;0c"); // Why 115? ;) + else + sendString("\033/Z"); // FIXME I don't think VT52 knows about it but kept for + // konsoles backward compatibility. +} + +void Vt102Emulation::reportTerminalParms(int p) +// DECREPTPARM +{ + char tmp[100]; + sprintf(tmp,"\033[%d;1;1;112;112;1;0x",p); // not really true. + sendString(tmp); +} + +void Vt102Emulation::reportStatus() +{ + sendString("\033[0n"); //VT100. Device status report. 0 = Ready. +} + +void Vt102Emulation::reportAnswerBack() +{ + // FIXME - Test this with VTTEST + // This is really obsolete VT100 stuff. + const char* ANSWER_BACK = ""; + sendString(ANSWER_BACK); +} + +/*! + `cx',`cy' are 1-based. + `eventType' indicates the button pressed (0-2) + or a general mouse release (3). + + eventType represents the kind of mouse action that occurred: + 0 = Mouse button press or release + 1 = Mouse drag +*/ + +void Vt102Emulation::sendMouseEvent( int cb, int cx, int cy , int eventType ) +{ + if (cx < 1 || cy < 1) + return; + + // normal buttons are passed as 0x20 + button, + // mouse wheel (buttons 4,5) as 0x5c + button + if (cb >= 4) + cb += 0x3c; + + //Mouse motion handling + if ((getMode(MODE_Mouse1002) || getMode(MODE_Mouse1003)) && eventType == 1) + cb += 0x20; //add 32 to signify motion event + + char command[20]; + sprintf(command,"\033[M%c%c%c",cb+0x20,cx+0x20,cy+0x20); + sendString(command); +} + +void Vt102Emulation::sendText( const QString& text ) +{ + if (!text.isEmpty()) + { + QKeyEvent event(QEvent::KeyPress, + 0, + Qt::NoModifier, + text); + sendKeyEvent(&event); // expose as a big fat keypress event + } +} +void Vt102Emulation::sendKeyEvent( QKeyEvent* event ) +{ + Qt::KeyboardModifiers modifiers = event->modifiers(); + KeyboardTranslator::States states = KeyboardTranslator::NoState; + + // get current states + if (getMode(MODE_NewLine) ) states |= KeyboardTranslator::NewLineState; + if (getMode(MODE_Ansi) ) states |= KeyboardTranslator::AnsiState; + if (getMode(MODE_AppCuKeys)) states |= KeyboardTranslator::CursorKeysState; + if (getMode(MODE_AppScreen)) states |= KeyboardTranslator::AlternateScreenState; + if (getMode(MODE_AppKeyPad) && (modifiers & Qt::KeypadModifier)) + states |= KeyboardTranslator::ApplicationKeypadState; + + // check flow control state + if (modifiers & Qt::ControlModifier) + { + if (event->key() == Qt::Key_S) + emit flowControlKeyPressed(true); + else if (event->key() == Qt::Key_Q) + emit flowControlKeyPressed(false); + } + + // lookup key binding + if ( _keyTranslator ) + { + KeyboardTranslator::Entry entry = _keyTranslator->findEntry( + event->key() , + modifiers, + states ); + + // send result to terminal + QByteArray textToSend; + + // special handling for the Alt (aka. Meta) modifier. pressing + // Alt+[Character] results in Esc+[Character] being sent + // (unless there is an entry defined for this particular combination + // in the keyboard modifier) + bool wantsAltModifier = entry.modifiers() & entry.modifierMask() & Qt::AltModifier; + bool wantsAnyModifier = entry.state() & + entry.stateMask() & KeyboardTranslator::AnyModifierState; + + if ( modifiers & Qt::AltModifier && !(wantsAltModifier || wantsAnyModifier) + && !event->text().isEmpty() ) + { + textToSend.prepend("\033"); + } + + if ( entry.command() != KeyboardTranslator::NoCommand ) + { + if (entry.command() & KeyboardTranslator::EraseCommand) + textToSend += eraseChar(); + + // TODO command handling + } + else if ( !entry.text().isEmpty() ) + { + textToSend += _codec->fromUnicode(entry.text(true,modifiers)); + } + else + textToSend += _codec->fromUnicode(event->text()); + + sendData( textToSend.constData() , textToSend.length() ); + } + else + { + // print an error message to the terminal if no key translator has been + // set + QString translatorError = tr("No keyboard translator available. " + "The information needed to convert key presses " + "into characters to send to the terminal " + "is missing."); + reset(); + receiveData( translatorError.toLatin1().constData() , translatorError.count() ); + } +} + +/* ------------------------------------------------------------------------- */ +/* */ +/* VT100 Charsets */ +/* */ +/* ------------------------------------------------------------------------- */ + +// Character Set Conversion ------------------------------------------------ -- + +/* + The processing contains a VT100 specific code translation layer. + It's still in use and mainly responsible for the line drawing graphics. + + These and some other glyphs are assigned to codes (0x5f-0xfe) + normally occupied by the latin letters. Since this codes also + appear within control sequences, the extra code conversion + does not permute with the tokenizer and is placed behind it + in the pipeline. It only applies to tokens, which represent + plain characters. + + This conversion it eventually continued in TerminalDisplay.C, since + it might involve VT100 enhanced fonts, which have these + particular glyphs allocated in (0x00-0x1f) in their code page. +*/ + +#define CHARSET _charset[_currentScreen==_screen[1]] + +// Apply current character map. + +unsigned short Vt102Emulation::applyCharset(unsigned short c) +{ + if (CHARSET.graphic && 0x5f <= c && c <= 0x7e) return vt100_graphics[c-0x5f]; + if (CHARSET.pound && c == '#' ) return 0xa3; //This mode is obsolete + return c; +} + +/* + "Charset" related part of the emulation state. + This configures the VT100 charset filter. + + While most operation work on the current _screen, + the following two are different. +*/ + +void Vt102Emulation::resetCharset(int scrno) +{ + _charset[scrno].cu_cs = 0; + strncpy(_charset[scrno].charset,"BBBB",4); + _charset[scrno].sa_graphic = false; + _charset[scrno].sa_pound = false; + _charset[scrno].graphic = false; + _charset[scrno].pound = false; +} + +void Vt102Emulation::setCharset(int n, int cs) // on both screens. +{ + _charset[0].charset[n&3] = cs; useCharset(_charset[0].cu_cs); + _charset[1].charset[n&3] = cs; useCharset(_charset[1].cu_cs); +} + +void Vt102Emulation::setAndUseCharset(int n, int cs) +{ + CHARSET.charset[n&3] = cs; + useCharset(n&3); +} + +void Vt102Emulation::useCharset(int n) +{ + CHARSET.cu_cs = n&3; + CHARSET.graphic = (CHARSET.charset[n&3] == '0'); + CHARSET.pound = (CHARSET.charset[n&3] == 'A'); //This mode is obsolete +} + +void Vt102Emulation::setDefaultMargins() +{ + _screen[0]->setDefaultMargins(); + _screen[1]->setDefaultMargins(); +} + +void Vt102Emulation::setMargins(int t, int b) +{ + _screen[0]->setMargins(t, b); + _screen[1]->setMargins(t, b); +} + +void Vt102Emulation::saveCursor() +{ + CHARSET.sa_graphic = CHARSET.graphic; + CHARSET.sa_pound = CHARSET.pound; //This mode is obsolete + // we are not clear about these + //sa_charset = charsets[cScreen->_charset]; + //sa_charset_num = cScreen->_charset; + _currentScreen->saveCursor(); +} + +void Vt102Emulation::restoreCursor() +{ + CHARSET.graphic = CHARSET.sa_graphic; + CHARSET.pound = CHARSET.sa_pound; //This mode is obsolete + _currentScreen->restoreCursor(); +} + +/* ------------------------------------------------------------------------- */ +/* */ +/* Mode Operations */ +/* */ +/* ------------------------------------------------------------------------- */ + +/* + Some of the emulations state is either added to the state of the screens. + + This causes some scoping problems, since different emulations choose to + located the mode either to the current _screen or to both. + + For strange reasons, the extend of the rendition attributes ranges over + all screens and not over the actual _screen. + + We decided on the precise precise extend, somehow. +*/ + +// "Mode" related part of the state. These are all booleans. + +void Vt102Emulation::resetModes() +{ + // MODE_Allow132Columns is not reset here + // to match Xterm's behaviour (see Xterm's VTReset() function) + + resetMode(MODE_132Columns); saveMode(MODE_132Columns); + resetMode(MODE_Mouse1000); saveMode(MODE_Mouse1000); + resetMode(MODE_Mouse1001); saveMode(MODE_Mouse1001); + resetMode(MODE_Mouse1002); saveMode(MODE_Mouse1002); + resetMode(MODE_Mouse1003); saveMode(MODE_Mouse1003); + + resetMode(MODE_AppScreen); saveMode(MODE_AppScreen); + resetMode(MODE_AppCuKeys); saveMode(MODE_AppCuKeys); + resetMode(MODE_AppKeyPad); saveMode(MODE_AppKeyPad); + resetMode(MODE_NewLine); + setMode(MODE_Ansi); +} + +void Vt102Emulation::setMode(int m) +{ + _currentModes.mode[m] = true; + switch (m) + { + case MODE_132Columns: + if (getMode(MODE_Allow132Columns)) + clearScreenAndSetColumns(132); + else + _currentModes.mode[m] = false; + break; + case MODE_Mouse1000: + case MODE_Mouse1001: + case MODE_Mouse1002: + case MODE_Mouse1003: + emit programUsesMouseChanged(false); + break; + + case MODE_AppScreen : _screen[1]->clearSelection(); + setScreen(1); + break; + } + if (m < MODES_SCREEN || m == MODE_NewLine) + { + _screen[0]->setMode(m); + _screen[1]->setMode(m); + } +} + +void Vt102Emulation::resetMode(int m) +{ + _currentModes.mode[m] = false; + switch (m) + { + case MODE_132Columns: + if (getMode(MODE_Allow132Columns)) + clearScreenAndSetColumns(80); + break; + case MODE_Mouse1000 : + case MODE_Mouse1001 : + case MODE_Mouse1002 : + case MODE_Mouse1003 : + emit programUsesMouseChanged(true); + break; + + case MODE_AppScreen : + _screen[0]->clearSelection(); + setScreen(0); + break; + } + if (m < MODES_SCREEN || m == MODE_NewLine) + { + _screen[0]->resetMode(m); + _screen[1]->resetMode(m); + } +} + +void Vt102Emulation::saveMode(int m) +{ + _savedModes.mode[m] = _currentModes.mode[m]; +} + +void Vt102Emulation::restoreMode(int m) +{ + if (_savedModes.mode[m]) + setMode(m); + else + resetMode(m); +} + +bool Vt102Emulation::getMode(int m) +{ + return _currentModes.mode[m]; +} + +char Vt102Emulation::eraseChar() const +{ + KeyboardTranslator::Entry entry = _keyTranslator->findEntry( + Qt::Key_Backspace, + 0, + 0); + if ( entry.text().count() > 0 ) + return entry.text()[0]; + else + return '\b'; +} + +// print contents of the scan buffer +static void hexdump(int* s, int len) +{ int i; + for (i = 0; i < len; i++) + { + if (s[i] == '\\') + printf("\\\\"); + else + if ((s[i]) > 32 && s[i] < 127) + printf("%c",s[i]); + else + printf("\\%04x(hex)",s[i]); + } +} + +void Vt102Emulation::reportDecodingError() +{ + if (tokenBufferPos == 0 || ( tokenBufferPos == 1 && (tokenBuffer[0] & 0xff) >= 32) ) + return; + printf("Undecodable sequence: "); + hexdump(tokenBuffer,tokenBufferPos); + printf("\n"); +} + +//#include "Vt102Emulation.moc" + diff --git a/konsole-qml-plugin/src/Vt102Emulation.h b/konsole-qml-plugin/src/Vt102Emulation.h new file mode 100644 index 0000000..63e23c3 --- /dev/null +++ b/konsole-qml-plugin/src/Vt102Emulation.h @@ -0,0 +1,188 @@ +/* + This file is part of Konsole, an X terminal. + + Copyright 2007-2008 by Robert Knight + Copyright 1997,1998 by Lars Doelle + + 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. +*/ + +#ifndef VT102EMULATION_H +#define VT102EMULATION_H + +// Standard Library +#include + +// Qt +#include +#include +#include + +// Konsole +#include "Emulation.h" +#include "Screen.h" + +#define MODE_AppScreen (MODES_SCREEN+0) // Mode #1 +#define MODE_AppCuKeys (MODES_SCREEN+1) // Application cursor keys (DECCKM) +#define MODE_AppKeyPad (MODES_SCREEN+2) // +#define MODE_Mouse1000 (MODES_SCREEN+3) // Send mouse X,Y position on press and release +#define MODE_Mouse1001 (MODES_SCREEN+4) // Use Hilight 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_Ansi (MODES_SCREEN+7) // Use US Ascii for character sets G0-G3 (DECANM) +#define MODE_132Columns (MODES_SCREEN+8) // 80 <-> 132 column mode switch (DECCOLM) +#define MODE_Allow132Columns (MODES_SCREEN+9) // Allow DECCOLM mode +#define MODE_total (MODES_SCREEN+10) + + +struct CharCodes +{ + // coding info + char charset[4]; // + int cu_cs; // actual charset. + bool graphic; // Some VT100 tricks + bool pound ; // Some VT100 tricks + bool sa_graphic; // saved graphic + bool sa_pound; // saved pound +}; + +/** + * Provides an xterm compatible terminal emulation based on the DEC VT102 terminal. + * A full description of this terminal can be found at http://vt100.net/docs/vt102-ug/ + * + * In addition, various additional xterm escape sequences are supported to provide + * features such as mouse input handling. + * See http://rtfm.etla.org/xterm/ctlseq.html for a description of xterm's escape + * sequences. + * + */ +class Vt102Emulation : public Emulation +{ +Q_OBJECT + +public: + /** Constructs a new emulation */ + Vt102Emulation(); + ~Vt102Emulation(); + + // reimplemented from Emulation + virtual void clearEntireScreen(); + virtual void reset(); + virtual char eraseChar() const; + +public slots: + // reimplemented from Emulation + virtual void sendString(const char*,int length = -1); + virtual void sendText(const QString& text); + virtual void sendKeyEvent(QKeyEvent*); + virtual void sendMouseEvent(int buttons, int column, int line, int eventType); + +protected: + // reimplemented from Emulation + virtual void setMode(int mode); + virtual void resetMode(int mode); + virtual void receiveChar(int cc); + +private slots: + //causes changeTitle() to be emitted for each (int,QString) pair in pendingTitleUpdates + //used to buffer multiple title updates + void updateTitle(); + +private: + unsigned short applyCharset(unsigned short c); + void setCharset(int n, int cs); + void useCharset(int n); + void setAndUseCharset(int n, int cs); + void saveCursor(); + void restoreCursor(); + void resetCharset(int scrno); + + void setMargins(int top, int bottom); + //set margins for all screens back to their defaults + void setDefaultMargins(); + + // returns true if 'mode' is set or false otherwise + bool getMode (int mode); + // saves the current boolean value of 'mode' + void saveMode (int mode); + // restores the boolean value of 'mode' + void restoreMode(int mode); + // resets all modes + // (except MODE_Allow132Columns) + void resetModes(); + + void resetTokenizer(); + #define MAX_TOKEN_LENGTH 80 + void addToCurrentToken(int cc); + int tokenBuffer[MAX_TOKEN_LENGTH]; //FIXME: overflow? + int tokenBufferPos; +#define MAXARGS 15 + void addDigit(int dig); + void addArgument(); + int argv[MAXARGS]; + int argc; + void initTokenizer(); + + // Set of flags for each of the ASCII characters which indicates + // what category they fall into (printable character, control, digit etc.) + // for the purposes of decoding terminal output + int charClass[256]; + + void reportDecodingError(); + + void processToken(int code, int p, int q); + void processWindowAttributeChange(); + + void reportTerminalType(); + void reportSecondaryAttributes(); + void reportStatus(); + void reportAnswerBack(); + void reportCursorPosition(); + void reportTerminalParms(int p); + + void onScrollLock(); + void scrollLock(const bool lock); + + // clears the screen and resizes it to the specified + // number of columns + void clearScreenAndSetColumns(int columnCount); + + CharCodes _charset[2]; + + class TerminalState + { + public: + // Initializes all modes to false + TerminalState() + { memset(&mode,false,MODE_total * sizeof(bool)); } + + bool mode[MODE_total]; + }; + + TerminalState _currentModes; + TerminalState _savedModes; + + //hash table and timer for buffering calls to the session instance + //to update the name of the session + //or window title. + //these calls occur when certain escape sequences are seen in the + //output from the terminal + QHash _pendingTitleUpdates; + QTimer* _titleUpdateTimer; +}; + + +#endif // VT102EMULATION_H diff --git a/konsole-qml-plugin/src/default.keytab b/konsole-qml-plugin/src/default.keytab new file mode 100644 index 0000000..f84293d --- /dev/null +++ b/konsole-qml-plugin/src/default.keytab @@ -0,0 +1,128 @@ +# [README.default.Keytab] Buildin Keyboard Table +# +# To customize your keyboard, copy this file to something +# ending with .keytab and change it to meet you needs. +# Please read the README.KeyTab and the README.keyboard +# in this case. +# +# -------------------------------------------------------------- + +keyboard "Default (XFree 4)" + +# -------------------------------------------------------------- +# +# Note that this particular table is a "risc" version made to +# ease customization without bothering with obsolete details. +# See VT100.keytab for the more hairy stuff. +# +# -------------------------------------------------------------- + +# common keys + +key Escape : "\E" + +key Tab -Shift : "\t" +key Tab +Shift+Ansi : "\E[Z" +key Tab +Shift-Ansi : "\t" +key Backtab +Ansi : "\E[Z" +key Backtab -Ansi : "\t" + +key Return-Shift-NewLine : "\r" +key Return-Shift+NewLine : "\r\n" + +key Return+Shift : "\EOM" + +# Backspace and Delete codes are preserving CTRL-H. + +key Backspace : "\x7f" + +# Arrow keys in VT52 mode +# shift up/down are reserved for scrolling. +# shift left/right are reserved for switching between tabs (this is hardcoded). + +key Up -Shift-Ansi : "\EA" +key Down -Shift-Ansi : "\EB" +key Right-Shift-Ansi : "\EC" +key Left -Shift-Ansi : "\ED" + +# Arrow keys in ANSI mode with Application - and Normal Cursor Mode) + +key Up -Shift-AnyMod+Ansi+AppCuKeys : "\EOA" +key Down -Shift-AnyMod+Ansi+AppCuKeys : "\EOB" +key Right -Shift-AnyMod+Ansi+AppCuKeys : "\EOC" +key Left -Shift-AnyMod+Ansi+AppCuKeys : "\EOD" + +key Up -Shift-AnyMod+Ansi-AppCuKeys : "\E[A" +key Down -Shift-AnyMod+Ansi-AppCuKeys : "\E[B" +key Right -Shift-AnyMod+Ansi-AppCuKeys : "\E[C" +key Left -Shift-AnyMod+Ansi-AppCuKeys : "\E[D" + +key Up -Shift+AnyMod+Ansi : "\E[1;*A" +key Down -Shift+AnyMod+Ansi : "\E[1;*B" +key Right -Shift+AnyMod+Ansi : "\E[1;*C" +key Left -Shift+AnyMod+Ansi : "\E[1;*D" + +# other grey PC keys + +key Enter+NewLine : "\r\n" +key Enter-NewLine : "\r" + +key Home -AnyMod -AppCuKeys : "\E[H" +key End -AnyMod -AppCuKeys : "\E[F" +key Home -AnyMod +AppCuKeys : "\EOH" +key End -AnyMod +AppCuKeys : "\EOF" +key Home +AnyMod : "\E[1;*H" +key End +AnyMod : "\E[1;*F" + +key Insert -AnyMod : "\E[2~" +key Delete -AnyMod : "\E[3~" +key Insert +AnyMod : "\E[2;*~" +key Delete +AnyMod : "\E[3;*~" + +key Prior -Shift-AnyMod : "\E[5~" +key Next -Shift-AnyMod : "\E[6~" +key Prior -Shift+AnyMod : "\E[5;*~" +key Next -Shift+AnyMod : "\E[6;*~" + +# Function keys +key F1 -AnyMod : "\EOP" +key F2 -AnyMod : "\EOQ" +key F3 -AnyMod : "\EOR" +key F4 -AnyMod : "\EOS" +key F5 -AnyMod : "\E[15~" +key F6 -AnyMod : "\E[17~" +key F7 -AnyMod : "\E[18~" +key F8 -AnyMod : "\E[19~" +key F9 -AnyMod : "\E[20~" +key F10 -AnyMod : "\E[21~" +key F11 -AnyMod : "\E[23~" +key F12 -AnyMod : "\E[24~" + +key F1 +AnyMod : "\EO*P" +key F2 +AnyMod : "\EO*Q" +key F3 +AnyMod : "\EO*R" +key F4 +AnyMod : "\EO*S" +key F5 +AnyMod : "\E[15;*~" +key F6 +AnyMod : "\E[17;*~" +key F7 +AnyMod : "\E[18;*~" +key F8 +AnyMod : "\E[19;*~" +key F9 +AnyMod : "\E[20;*~" +key F10 +AnyMod : "\E[21;*~" +key F11 +AnyMod : "\E[23;*~" +key F12 +AnyMod : "\E[24;*~" + +# Work around dead keys + +key Space +Control : "\x00" + +# Some keys are used by konsole to cause operations. +# The scroll* operations refer to the history buffer. + +key Up +Shift-AppScreen : scrollLineUp +key Prior +Shift-AppScreen : scrollPageUp +key Down +Shift-AppScreen : scrollLineDown +key Next +Shift-AppScreen : scrollPageDown + +key ScrollLock : scrollLock + +# keypad characters are not offered differently by Qt. diff --git a/konsole-qml-plugin/src/konsole_wcwidth.cpp b/konsole-qml-plugin/src/konsole_wcwidth.cpp new file mode 100644 index 0000000..1996751 --- /dev/null +++ b/konsole-qml-plugin/src/konsole_wcwidth.cpp @@ -0,0 +1,224 @@ +/* $XFree86: xc/programs/xterm/wcwidth.character,v 1.3 2001/07/29 22:08:16 tsi Exp $ */ +/* + * This is an implementation of wcwidth() and wcswidth() as defined in + * "The Single UNIX Specification, Version 2, The Open Group, 1997" + * + * + * Markus Kuhn -- 2001-01-12 -- public domain + */ + +#include "konsole_wcwidth.h" + +struct interval { + unsigned short first; + unsigned short last; +}; + +/* auxiliary function for binary search in interval table */ +static int bisearch(quint16 ucs, const struct interval * table, int max) +{ + int min = 0; + int mid; + + if (ucs < table[0].first || ucs > table[max].last) { + return 0; + } + while (max >= min) { + mid = (min + max) / 2; + if (ucs > table[mid].last) { + min = mid + 1; + } else if (ucs < table[mid].first) { + max = mid - 1; + } else { + return 1; + } + } + + return 0; +} + + +/* The following functions define the column width of an ISO 10646 + * character as follows: + * + * - The null character (U+0000) has a column width of 0. + * + * - Other C0/C1 control characters and DEL will lead to a return + * value of -1. + * + * - Non-spacing and enclosing combining characters (general + * category code Mn or Me in the Unicode database) have a + * column width of 0. + * + * - Other format characters (general category code Cf in the Unicode + * database) and ZERO WIDTH SPACE (U+200B) have a column width of 0. + * + * - Hangul Jamo medial vowels and final consonants (U+1160-U+11FF) + * have a column width of 0. + * + * - Spacing characters in the East Asian Wide (W) or East Asian + * FullWidth (F) category as defined in Unicode Technical + * Report #11 have a column width of 2. + * + * - All remaining characters (including all printable + * ISO 8859-1 and WGL4 characters, Unicode control characters, + * etc.) have a column width of 1. + * + * This implementation assumes that quint16 characters are encoded + * in ISO 10646. + */ + +int konsole_wcwidth(quint16 ucs) +{ + /* sorted list of non-overlapping intervals of non-spacing characters */ + static const struct interval combining[] = { + { 0x0300, 0x034E }, { 0x0360, 0x0362 }, { 0x0483, 0x0486 }, + { 0x0488, 0x0489 }, { 0x0591, 0x05A1 }, { 0x05A3, 0x05B9 }, + { 0x05BB, 0x05BD }, { 0x05BF, 0x05BF }, { 0x05C1, 0x05C2 }, + { 0x05C4, 0x05C4 }, { 0x064B, 0x0655 }, { 0x0670, 0x0670 }, + { 0x06D6, 0x06E4 }, { 0x06E7, 0x06E8 }, { 0x06EA, 0x06ED }, + { 0x070F, 0x070F }, { 0x0711, 0x0711 }, { 0x0730, 0x074A }, + { 0x07A6, 0x07B0 }, { 0x0901, 0x0902 }, { 0x093C, 0x093C }, + { 0x0941, 0x0948 }, { 0x094D, 0x094D }, { 0x0951, 0x0954 }, + { 0x0962, 0x0963 }, { 0x0981, 0x0981 }, { 0x09BC, 0x09BC }, + { 0x09C1, 0x09C4 }, { 0x09CD, 0x09CD }, { 0x09E2, 0x09E3 }, + { 0x0A02, 0x0A02 }, { 0x0A3C, 0x0A3C }, { 0x0A41, 0x0A42 }, + { 0x0A47, 0x0A48 }, { 0x0A4B, 0x0A4D }, { 0x0A70, 0x0A71 }, + { 0x0A81, 0x0A82 }, { 0x0ABC, 0x0ABC }, { 0x0AC1, 0x0AC5 }, + { 0x0AC7, 0x0AC8 }, { 0x0ACD, 0x0ACD }, { 0x0B01, 0x0B01 }, + { 0x0B3C, 0x0B3C }, { 0x0B3F, 0x0B3F }, { 0x0B41, 0x0B43 }, + { 0x0B4D, 0x0B4D }, { 0x0B56, 0x0B56 }, { 0x0B82, 0x0B82 }, + { 0x0BC0, 0x0BC0 }, { 0x0BCD, 0x0BCD }, { 0x0C3E, 0x0C40 }, + { 0x0C46, 0x0C48 }, { 0x0C4A, 0x0C4D }, { 0x0C55, 0x0C56 }, + { 0x0CBF, 0x0CBF }, { 0x0CC6, 0x0CC6 }, { 0x0CCC, 0x0CCD }, + { 0x0D41, 0x0D43 }, { 0x0D4D, 0x0D4D }, { 0x0DCA, 0x0DCA }, + { 0x0DD2, 0x0DD4 }, { 0x0DD6, 0x0DD6 }, { 0x0E31, 0x0E31 }, + { 0x0E34, 0x0E3A }, { 0x0E47, 0x0E4E }, { 0x0EB1, 0x0EB1 }, + { 0x0EB4, 0x0EB9 }, { 0x0EBB, 0x0EBC }, { 0x0EC8, 0x0ECD }, + { 0x0F18, 0x0F19 }, { 0x0F35, 0x0F35 }, { 0x0F37, 0x0F37 }, + { 0x0F39, 0x0F39 }, { 0x0F71, 0x0F7E }, { 0x0F80, 0x0F84 }, + { 0x0F86, 0x0F87 }, { 0x0F90, 0x0F97 }, { 0x0F99, 0x0FBC }, + { 0x0FC6, 0x0FC6 }, { 0x102D, 0x1030 }, { 0x1032, 0x1032 }, + { 0x1036, 0x1037 }, { 0x1039, 0x1039 }, { 0x1058, 0x1059 }, + { 0x1160, 0x11FF }, { 0x17B7, 0x17BD }, { 0x17C6, 0x17C6 }, + { 0x17C9, 0x17D3 }, { 0x180B, 0x180E }, { 0x18A9, 0x18A9 }, + { 0x200B, 0x200F }, { 0x202A, 0x202E }, { 0x206A, 0x206F }, + { 0x20D0, 0x20E3 }, { 0x302A, 0x302F }, { 0x3099, 0x309A }, + { 0xFB1E, 0xFB1E }, { 0xFE20, 0xFE23 }, { 0xFEFF, 0xFEFF }, + { 0xFFF9, 0xFFFB } + }; + + /* test for 8-bit control characters */ + if (ucs == 0) { + return 0; + } + if (ucs < 32 || (ucs >= 0x7f && ucs < 0xa0)) { + return -1; + } + + /* binary search in table of non-spacing characters */ + if (bisearch(ucs, combining, + sizeof(combining) / sizeof(struct interval) - 1)) { + return 0; + } + + /* if we arrive here, ucs is not a combining or C0/C1 control character */ + + return 1 + + (ucs >= 0x1100 && + (ucs <= 0x115f || /* Hangul Jamo init. consonants */ + (ucs >= 0x2e80 && ucs <= 0xa4cf && (ucs & ~0x0011) != 0x300a && + ucs != 0x303f) || /* CJK ... Yi */ + (ucs >= 0xac00 && ucs <= 0xd7a3) || /* Hangul Syllables */ + (ucs >= 0xf900 && ucs <= 0xfaff) || /* CJK Compatibility Ideographs */ + (ucs >= 0xfe30 && ucs <= 0xfe6f) || /* CJK Compatibility Forms */ + (ucs >= 0xff00 && ucs <= 0xff5f) || /* Fullwidth Forms */ + (ucs >= 0xffe0 && ucs <= 0xffe6) /* do not compare UINT16 with 0x20000 || + (ucs >= 0x20000 && ucs <= 0x2ffff) */)); +} + +#if 0 +/* + * The following function is the same as konsole_wcwidth(), except that + * spacing characters in the East Asian Ambiguous (A) category as + * defined in Unicode Technical Report #11 have a column width of 2. + * This experimental variant might be useful for users of CJK legacy + * encodings who want to migrate to UCS. It is not otherwise + * recommended for general use. + */ +int konsole_wcwidth_cjk(quint16 ucs) +{ + /* sorted list of non-overlapping intervals of East Asian Ambiguous + * characters */ + static const struct interval ambiguous[] = { + { 0x00A1, 0x00A1 }, { 0x00A4, 0x00A4 }, { 0x00A7, 0x00A8 }, + { 0x00AA, 0x00AA }, { 0x00AD, 0x00AD }, { 0x00B0, 0x00B4 }, + { 0x00B6, 0x00BA }, { 0x00BC, 0x00BF }, { 0x00C6, 0x00C6 }, + { 0x00D0, 0x00D0 }, { 0x00D7, 0x00D8 }, { 0x00DE, 0x00E1 }, + { 0x00E6, 0x00E6 }, { 0x00E8, 0x00EA }, { 0x00EC, 0x00ED }, + { 0x00F0, 0x00F0 }, { 0x00F2, 0x00F3 }, { 0x00F7, 0x00FA }, + { 0x00FC, 0x00FC }, { 0x00FE, 0x00FE }, { 0x0101, 0x0101 }, + { 0x0111, 0x0111 }, { 0x0113, 0x0113 }, { 0x011B, 0x011B }, + { 0x0126, 0x0127 }, { 0x012B, 0x012B }, { 0x0131, 0x0133 }, + { 0x0138, 0x0138 }, { 0x013F, 0x0142 }, { 0x0144, 0x0144 }, + { 0x0148, 0x014A }, { 0x014D, 0x014D }, { 0x0152, 0x0153 }, + { 0x0166, 0x0167 }, { 0x016B, 0x016B }, { 0x01CE, 0x01CE }, + { 0x01D0, 0x01D0 }, { 0x01D2, 0x01D2 }, { 0x01D4, 0x01D4 }, + { 0x01D6, 0x01D6 }, { 0x01D8, 0x01D8 }, { 0x01DA, 0x01DA }, + { 0x01DC, 0x01DC }, { 0x0251, 0x0251 }, { 0x0261, 0x0261 }, + { 0x02C7, 0x02C7 }, { 0x02C9, 0x02CB }, { 0x02CD, 0x02CD }, + { 0x02D0, 0x02D0 }, { 0x02D8, 0x02DB }, { 0x02DD, 0x02DD }, + { 0x0391, 0x03A1 }, { 0x03A3, 0x03A9 }, { 0x03B1, 0x03C1 }, + { 0x03C3, 0x03C9 }, { 0x0401, 0x0401 }, { 0x0410, 0x044F }, + { 0x0451, 0x0451 }, { 0x2010, 0x2010 }, { 0x2013, 0x2016 }, + { 0x2018, 0x2019 }, { 0x201C, 0x201D }, { 0x2020, 0x2021 }, + { 0x2025, 0x2027 }, { 0x2030, 0x2030 }, { 0x2032, 0x2033 }, + { 0x2035, 0x2035 }, { 0x203B, 0x203B }, { 0x2074, 0x2074 }, + { 0x207F, 0x207F }, { 0x2081, 0x2084 }, { 0x20AC, 0x20AC }, + { 0x2103, 0x2103 }, { 0x2105, 0x2105 }, { 0x2109, 0x2109 }, + { 0x2113, 0x2113 }, { 0x2121, 0x2122 }, { 0x2126, 0x2126 }, + { 0x212B, 0x212B }, { 0x2154, 0x2155 }, { 0x215B, 0x215B }, + { 0x215E, 0x215E }, { 0x2160, 0x216B }, { 0x2170, 0x2179 }, + { 0x2190, 0x2199 }, { 0x21D2, 0x21D2 }, { 0x21D4, 0x21D4 }, + { 0x2200, 0x2200 }, { 0x2202, 0x2203 }, { 0x2207, 0x2208 }, + { 0x220B, 0x220B }, { 0x220F, 0x220F }, { 0x2211, 0x2211 }, + { 0x2215, 0x2215 }, { 0x221A, 0x221A }, { 0x221D, 0x2220 }, + { 0x2223, 0x2223 }, { 0x2225, 0x2225 }, { 0x2227, 0x222C }, + { 0x222E, 0x222E }, { 0x2234, 0x2237 }, { 0x223C, 0x223D }, + { 0x2248, 0x2248 }, { 0x224C, 0x224C }, { 0x2252, 0x2252 }, + { 0x2260, 0x2261 }, { 0x2264, 0x2267 }, { 0x226A, 0x226B }, + { 0x226E, 0x226F }, { 0x2282, 0x2283 }, { 0x2286, 0x2287 }, + { 0x2295, 0x2295 }, { 0x2299, 0x2299 }, { 0x22A5, 0x22A5 }, + { 0x22BF, 0x22BF }, { 0x2312, 0x2312 }, { 0x2460, 0x24BF }, + { 0x24D0, 0x24E9 }, { 0x2500, 0x254B }, { 0x2550, 0x2574 }, + { 0x2580, 0x258F }, { 0x2592, 0x2595 }, { 0x25A0, 0x25A1 }, + { 0x25A3, 0x25A9 }, { 0x25B2, 0x25B3 }, { 0x25B6, 0x25B7 }, + { 0x25BC, 0x25BD }, { 0x25C0, 0x25C1 }, { 0x25C6, 0x25C8 }, + { 0x25CB, 0x25CB }, { 0x25CE, 0x25D1 }, { 0x25E2, 0x25E5 }, + { 0x25EF, 0x25EF }, { 0x2605, 0x2606 }, { 0x2609, 0x2609 }, + { 0x260E, 0x260F }, { 0x261C, 0x261C }, { 0x261E, 0x261E }, + { 0x2640, 0x2640 }, { 0x2642, 0x2642 }, { 0x2660, 0x2661 }, + { 0x2663, 0x2665 }, { 0x2667, 0x266A }, { 0x266C, 0x266D }, + { 0x266F, 0x266F }, { 0x300A, 0x300B }, { 0x301A, 0x301B }, + { 0xE000, 0xF8FF }, { 0xFFFD, 0xFFFD } + }; + + /* binary search in table of non-spacing characters */ + if (bisearch(ucs, ambiguous, + sizeof(ambiguous) / sizeof(struct interval) - 1)) { + return 2; + } + + return konsole_wcwidth(ucs); +} +#endif + +// single byte char: +1, multi byte char: +2 +int string_width( const QString & txt ) +{ + int w = 0; + for ( int i = 0; i < txt.length(); ++i ) { + w += konsole_wcwidth( txt[ i ].unicode() ); + } + return w; +} diff --git a/konsole-qml-plugin/src/konsole_wcwidth.h b/konsole-qml-plugin/src/konsole_wcwidth.h new file mode 100644 index 0000000..79124d8 --- /dev/null +++ b/konsole-qml-plugin/src/konsole_wcwidth.h @@ -0,0 +1,24 @@ +/* $XFree86: xc/programs/xterm/wcwidth.h,v 1.2 2001/06/18 19:09:27 dickey Exp $ */ + +/* Markus Kuhn -- 2001-01-12 -- public domain */ +/* Adaptions for KDE by Waldo Bastian */ +/* + Rewritten for QT4 by e_k +*/ + + +#ifndef _KONSOLE_WCWIDTH_H_ +#define _KONSOLE_WCWIDTH_H_ + +// Qt +//#include +#include + +int konsole_wcwidth(quint16 ucs); +#if 0 +int konsole_wcwidth_cjk(Q_UINT16 ucs); +#endif + +int string_width( const QString & txt ); + +#endif diff --git a/konsole-qml-plugin/src/kprocess.cpp b/konsole-qml-plugin/src/kprocess.cpp new file mode 100644 index 0000000..73264a6 --- /dev/null +++ b/konsole-qml-plugin/src/kprocess.cpp @@ -0,0 +1,412 @@ +/* + * This file is a part of QTerminal - http://gitorious.org/qterminal + * + * This file was un-linked from KDE and modified + * by Maxim Bourmistrov + * + */ + +/* + This file is part of the KDE libraries + + Copyright (C) 2007 Oswald Buddenhagen + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "kprocess.h" + +#include + +#ifdef Q_OS_WIN +# include +#else +# include +# include +#endif + +#ifndef Q_OS_WIN +# define STD_OUTPUT_HANDLE 1 +# define STD_ERROR_HANDLE 2 +#endif + +#ifdef _WIN32_WCE +#include +#endif + +void KProcessPrivate::writeAll(const QByteArray &buf, int fd) +{ +#ifdef Q_OS_WIN +#ifndef _WIN32_WCE + HANDLE h = GetStdHandle(fd); + if (h) { + DWORD wr; + WriteFile(h, buf.data(), buf.size(), &wr, 0); + } +#else + fwrite(buf.data(), 1, buf.size(), (FILE*)fd); +#endif +#else + int off = 0; + do { + int ret = ::write(fd, buf.data() + off, buf.size() - off); + if (ret < 0) { + if (errno != EINTR) + return; + } else { + off += ret; + } + } while (off < buf.size()); +#endif +} + +void KProcessPrivate::forwardStd(KProcess::ProcessChannel good, int fd) +{ + Q_Q(KProcess); + + QProcess::ProcessChannel oc = q->readChannel(); + q->setReadChannel(good); + writeAll(q->readAll(), fd); + q->setReadChannel(oc); +} + +void KProcessPrivate::_k_forwardStdout() +{ +#ifndef _WIN32_WCE + forwardStd(KProcess::StandardOutput, STD_OUTPUT_HANDLE); +#else + forwardStd(KProcess::StandardOutput, (int)stdout); +#endif +} + +void KProcessPrivate::_k_forwardStderr() +{ +#ifndef _WIN32_WCE + forwardStd(KProcess::StandardError, STD_ERROR_HANDLE); +#else + forwardStd(KProcess::StandardError, (int)stderr); +#endif +} + +///////////////////////////// +// public member functions // +///////////////////////////// + +KProcess::KProcess(QObject *parent) : + QProcess(parent), + d_ptr(new KProcessPrivate) +{ + d_ptr->q_ptr = this; + setOutputChannelMode(ForwardedChannels); +} + +KProcess::KProcess(KProcessPrivate *d, QObject *parent) : + QProcess(parent), + d_ptr(d) +{ + d_ptr->q_ptr = this; + setOutputChannelMode(ForwardedChannels); +} + +KProcess::~KProcess() +{ + delete d_ptr; +} + +void KProcess::setOutputChannelMode(OutputChannelMode mode) +{ + Q_D(KProcess); + + d->outputChannelMode = mode; + disconnect(this, SIGNAL(readyReadStandardOutput())); + disconnect(this, SIGNAL(readyReadStandardError())); + switch (mode) { + case OnlyStdoutChannel: + connect(this, SIGNAL(readyReadStandardError()), SLOT(_k_forwardStderr())); + break; + case OnlyStderrChannel: + connect(this, SIGNAL(readyReadStandardOutput()), SLOT(_k_forwardStdout())); + break; + default: + QProcess::setProcessChannelMode((ProcessChannelMode)mode); + return; + } + QProcess::setProcessChannelMode(QProcess::SeparateChannels); +} + +KProcess::OutputChannelMode KProcess::outputChannelMode() const +{ + Q_D(const KProcess); + + return d->outputChannelMode; +} + +void KProcess::setNextOpenMode(QIODevice::OpenMode mode) +{ + Q_D(KProcess); + + d->openMode = mode; +} + +#define DUMMYENV "_KPROCESS_DUMMY_=" + +void KProcess::clearEnvironment() +{ + setEnvironment(QStringList() << QString::fromLatin1(DUMMYENV)); +} + +void KProcess::setEnv(const QString &name, const QString &value, bool overwrite) +{ + QStringList env = environment(); + if (env.isEmpty()) { + env = systemEnvironment(); + env.removeAll(QString::fromLatin1(DUMMYENV)); + } + QString fname(name); + fname.append(QLatin1Char('=')); + for (QStringList::Iterator it = env.begin(); it != env.end(); ++it) + if ((*it).startsWith(fname)) { + if (overwrite) { + *it = fname.append(value); + setEnvironment(env); + } + return; + } + env.append(fname.append(value)); + setEnvironment(env); +} + +void KProcess::unsetEnv(const QString &name) +{ + QStringList env = environment(); + if (env.isEmpty()) { + env = systemEnvironment(); + env.removeAll(QString::fromLatin1(DUMMYENV)); + } + QString fname(name); + fname.append(QLatin1Char('=')); + for (QStringList::Iterator it = env.begin(); it != env.end(); ++it) + if ((*it).startsWith(fname)) { + env.erase(it); + if (env.isEmpty()) + env.append(QString::fromLatin1(DUMMYENV)); + setEnvironment(env); + return; + } +} + +void KProcess::setProgram(const QString &exe, const QStringList &args) +{ + Q_D(KProcess); + + d->prog = exe; + d->args = args; +#ifdef Q_OS_WIN + setNativeArguments(QString()); +#endif +} + +void KProcess::setProgram(const QStringList &argv) +{ + Q_D(KProcess); + + Q_ASSERT( !argv.isEmpty() ); + d->args = argv; + d->prog = d->args.takeFirst(); +#ifdef Q_OS_WIN + setNativeArguments(QString()); +#endif +} + +KProcess &KProcess::operator<<(const QString &arg) +{ + Q_D(KProcess); + + if (d->prog.isEmpty()) + d->prog = arg; + else + d->args << arg; + return *this; +} + +KProcess &KProcess::operator<<(const QStringList &args) +{ + Q_D(KProcess); + + if (d->prog.isEmpty()) + setProgram(args); + else + d->args << args; + return *this; +} + +void KProcess::clearProgram() +{ + Q_D(KProcess); + + d->prog.clear(); + d->args.clear(); +#ifdef Q_OS_WIN + setNativeArguments(QString()); +#endif +} + +#if 0 +void KProcess::setShellCommand(const QString &cmd) +{ + Q_D(KProcess); + + KShell::Errors err; + d->args = KShell::splitArgs( + cmd, KShell::AbortOnMeta | KShell::TildeExpand, &err); + if (err == KShell::NoError && !d->args.isEmpty()) { + d->prog = KStandardDirs::findExe(d->args[0]); + if (!d->prog.isEmpty()) { + d->args.removeFirst(); +#ifdef Q_OS_WIN + setNativeArguments(QString()); +#endif + return; + } + } + + d->args.clear(); + +#ifdef Q_OS_UNIX +// #ifdef NON_FREE // ... as they ship non-POSIX /bin/sh +# if !defined(__linux__) && !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__OpenBSD__) && !defined(__DragonFly__) && !defined(__GNU__) + // If /bin/sh is a symlink, we can be pretty sure that it points to a + // POSIX shell - the original bourne shell is about the only non-POSIX + // shell still in use and it is always installed natively as /bin/sh. + d->prog = QFile::symLinkTarget(QString::fromLatin1("/bin/sh")); + if (d->prog.isEmpty()) { + // Try some known POSIX shells. + d->prog = KStandardDirs::findExe(QString::fromLatin1("ksh")); + if (d->prog.isEmpty()) { + d->prog = KStandardDirs::findExe(QString::fromLatin1("ash")); + if (d->prog.isEmpty()) { + d->prog = KStandardDirs::findExe(QString::fromLatin1("bash")); + if (d->prog.isEmpty()) { + d->prog = KStandardDirs::findExe(QString::fromLatin1("zsh")); + if (d->prog.isEmpty()) + // We're pretty much screwed, to be honest ... + d->prog = QString::fromLatin1("/bin/sh"); + } + } + } + } +# else + d->prog = QString::fromLatin1("/bin/sh"); +# endif + + d->args << QString::fromLatin1("-c") << cmd; +#else // Q_OS_UNIX + // KMacroExpander::expandMacrosShellQuote(), KShell::quoteArg() and + // KShell::joinArgs() may generate these for security reasons. + setEnv(PERCENT_VARIABLE, QLatin1String("%")); + +#ifndef _WIN32_WCE + WCHAR sysdir[MAX_PATH + 1]; + UINT size = GetSystemDirectoryW(sysdir, MAX_PATH + 1); + d->prog = QString::fromUtf16((const ushort *) sysdir, size); + d->prog += QLatin1String("\\cmd.exe"); + setNativeArguments(QLatin1String("/V:OFF /S /C \"") + cmd + QLatin1Char('"')); +#else + d->prog = QLatin1String("\\windows\\cmd.exe"); + setNativeArguments(QLatin1String("/S /C \"") + cmd + QLatin1Char('"')); +#endif +#endif +} +#endif +QStringList KProcess::program() const +{ + Q_D(const KProcess); + + QStringList argv = d->args; + argv.prepend(d->prog); + return argv; +} + +void KProcess::start() +{ + Q_D(KProcess); + + QProcess::start(d->prog, d->args, d->openMode); +} + +int KProcess::execute(int msecs) +{ + start(); + if (!waitForFinished(msecs)) { + kill(); + waitForFinished(-1); + return -2; + } + return (exitStatus() == QProcess::NormalExit) ? exitCode() : -1; +} + +// static +int KProcess::execute(const QString &exe, const QStringList &args, int msecs) +{ + KProcess p; + p.setProgram(exe, args); + return p.execute(msecs); +} + +// static +int KProcess::execute(const QStringList &argv, int msecs) +{ + KProcess p; + p.setProgram(argv); + return p.execute(msecs); +} + +int KProcess::startDetached() +{ + Q_D(KProcess); + + qint64 pid; + if (!QProcess::startDetached(d->prog, d->args, workingDirectory(), &pid)) + return 0; + return (int) pid; +} + +// static +int KProcess::startDetached(const QString &exe, const QStringList &args) +{ + qint64 pid; + if (!QProcess::startDetached(exe, args, QString(), &pid)) + return 0; + return (int) pid; +} + +// static +int KProcess::startDetached(const QStringList &argv) +{ + QStringList args = argv; + QString prog = args.takeFirst(); + return startDetached(prog, args); +} + +int KProcess::pid() const +{ +#ifdef Q_OS_UNIX + return (int) QProcess::pid(); +#else + return QProcess::pid() ? QProcess::pid()->dwProcessId : 0; +#endif +} + diff --git a/konsole-qml-plugin/src/kprocess.h b/konsole-qml-plugin/src/kprocess.h new file mode 100644 index 0000000..74e3978 --- /dev/null +++ b/konsole-qml-plugin/src/kprocess.h @@ -0,0 +1,372 @@ +/* + * This file is a part of QTerminal - http://gitorious.org/qterminal + * + * This file was un-linked from KDE and modified + * by Maxim Bourmistrov + * + */ + +/* + This file is part of the KDE libraries + + Copyright (C) 2007 Oswald Buddenhagen + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef KPROCESS_H +#define KPROCESS_H + +//#include + +#include + +class KProcessPrivate; + +/** + * \class KProcess kprocess.h + * + * Child process invocation, monitoring and control. + * + * This class extends QProcess by some useful functionality, overrides + * some defaults with saner values and wraps parts of the API into a more + * accessible one. + * This is the preferred way of spawning child processes in KDE; don't + * use QProcess directly. + * + * @author Oswald Buddenhagen + **/ +class KProcess : public QProcess +{ + Q_OBJECT + Q_DECLARE_PRIVATE(KProcess) + +public: + + /** + * Modes in which the output channels can be opened. + */ + enum OutputChannelMode { + SeparateChannels = QProcess::SeparateChannels, + /**< Standard output and standard error are handled by KProcess + as separate channels */ + MergedChannels = QProcess::MergedChannels, + /**< Standard output and standard error are handled by KProcess + as one channel */ + ForwardedChannels = QProcess::ForwardedChannels, + /**< Both standard output and standard error are forwarded + to the parent process' respective channel */ + OnlyStdoutChannel, + /**< Only standard output is handled; standard error is forwarded */ + OnlyStderrChannel /**< Only standard error is handled; standard output is forwarded */ + }; + + /** + * Constructor + */ + explicit KProcess(QObject *parent = 0); + + /** + * Destructor + */ + virtual ~KProcess(); + + /** + * Set how to handle the output channels of the child process. + * + * The default is ForwardedChannels, which is unlike in QProcess. + * Do not request more than you actually handle, as this output is + * simply lost otherwise. + * + * This function must be called before starting the process. + * + * @param mode the output channel handling mode + */ + void setOutputChannelMode(OutputChannelMode mode); + + /** + * Query how the output channels of the child process are handled. + * + * @return the output channel handling mode + */ + OutputChannelMode outputChannelMode() const; + + /** + * Set the QIODevice open mode the process will be opened in. + * + * This function must be called before starting the process, obviously. + * + * @param mode the open mode. Note that this mode is automatically + * "reduced" according to the channel modes and redirections. + * The default is QIODevice::ReadWrite. + */ + void setNextOpenMode(QIODevice::OpenMode mode); + + /** + * Adds the variable @p name to the process' environment. + * + * This function must be called before starting the process. + * + * @param name the name of the environment variable + * @param value the new value for the environment variable + * @param overwrite if @c false and the environment variable is already + * set, the old value will be preserved + */ + void setEnv(const QString &name, const QString &value, bool overwrite = true); + + /** + * Removes the variable @p name from the process' environment. + * + * This function must be called before starting the process. + * + * @param name the name of the environment variable + */ + void unsetEnv(const QString &name); + + /** + * Empties the process' environment. + * + * Note that LD_LIBRARY_PATH/DYLD_LIBRARY_PATH is automatically added + * on *NIX. + * + * This function must be called before starting the process. + */ + void clearEnvironment(); + + /** + * Set the program and the command line arguments. + * + * This function must be called before starting the process, obviously. + * + * @param exe the program to execute + * @param args the command line arguments for the program, + * one per list element + */ + void setProgram(const QString &exe, const QStringList &args = QStringList()); + + /** + * @overload + * + * @param argv the program to execute and the command line arguments + * for the program, one per list element + */ + void setProgram(const QStringList &argv); + + /** + * Append an element to the command line argument list for this process. + * + * If no executable is set yet, it will be set instead. + * + * For example, doing an "ls -l /usr/local/bin" can be achieved by: + * \code + * KProcess p; + * p << "ls" << "-l" << "/usr/local/bin"; + * ... + * \endcode + * + * This function must be called before starting the process, obviously. + * + * @param arg the argument to add + * @return a reference to this KProcess + */ + KProcess &operator<<(const QString& arg); + + /** + * @overload + * + * @param args the arguments to add + * @return a reference to this KProcess + */ + KProcess &operator<<(const QStringList& args); + + /** + * Clear the program and command line argument list. + */ + void clearProgram(); + + /** + * Set a command to execute through a shell (a POSIX sh on *NIX + * and cmd.exe on Windows). + * + * Using this for anything but user-supplied commands is usually a bad + * idea, as the command's syntax depends on the platform. + * Redirections including pipes, etc. are better handled by the + * respective functions provided by QProcess. + * + * If KProcess determines that the command does not really need a + * shell, it will trasparently execute it without one for performance + * reasons. + * + * This function must be called before starting the process, obviously. + * + * @param cmd the command to execute through a shell. + * The caller must make sure that all filenames etc. are properly + * quoted when passed as argument. Failure to do so often results in + * serious security holes. See KShell::quoteArg(). + */ + void setShellCommand(const QString &cmd); + + /** + * Obtain the currently set program and arguments. + * + * @return a list, the first element being the program, the remaining ones + * being command line arguments to the program. + */ + QStringList program() const; + + /** + * Start the process. + * + * @see QProcess::start(const QString &, const QStringList &, OpenMode) + */ + void start(); + + /** + * Start the process, wait for it to finish, and return the exit code. + * + * This method is roughly equivalent to the sequence: + * + * start(); + * waitForFinished(msecs); + * return exitCode(); + * + * + * Unlike the other execute() variants this method is not static, + * so the process can be parametrized properly and talked to. + * + * @param msecs time to wait for process to exit before killing it + * @return -2 if the process could not be started, -1 if it crashed, + * otherwise its exit code + */ + int execute(int msecs = -1); + + /** + * @overload + * + * @param exe the program to execute + * @param args the command line arguments for the program, + * one per list element + * @param msecs time to wait for process to exit before killing it + * @return -2 if the process could not be started, -1 if it crashed, + * otherwise its exit code + */ + static int execute(const QString &exe, const QStringList &args = QStringList(), int msecs = -1); + + /** + * @overload + * + * @param argv the program to execute and the command line arguments + * for the program, one per list element + * @param msecs time to wait for process to exit before killing it + * @return -2 if the process could not be started, -1 if it crashed, + * otherwise its exit code + */ + static int execute(const QStringList &argv, int msecs = -1); + + /** + * Start the process and detach from it. See QProcess::startDetached() + * for details. + * + * Unlike the other startDetached() variants this method is not static, + * so the process can be parametrized properly. + * @note Currently, only the setProgram()/setShellCommand() and + * setWorkingDirectory() parametrizations are supported. + * + * The KProcess object may be re-used immediately after calling this + * function. + * + * @return the PID of the started process or 0 on error + */ + int startDetached(); + + /** + * @overload + * + * @param exe the program to start + * @param args the command line arguments for the program, + * one per list element + * @return the PID of the started process or 0 on error + */ + static int startDetached(const QString &exe, const QStringList &args = QStringList()); + + /** + * @overload + * + * @param argv the program to start and the command line arguments + * for the program, one per list element + * @return the PID of the started process or 0 on error + */ + static int startDetached(const QStringList &argv); + + /** + * Obtain the process' ID as known to the system. + * + * Unlike with QProcess::pid(), this is a real PID also on Windows. + * + * This function can be called only while the process is running. + * It cannot be applied to detached processes. + * + * @return the process ID + */ + int pid() const; + +protected: + /** + * @internal + */ + KProcess(KProcessPrivate *d, QObject *parent); + + /** + * @internal + */ + KProcessPrivate * const d_ptr; + +private: + // hide those + using QProcess::setReadChannelMode; + using QProcess::readChannelMode; + using QProcess::setProcessChannelMode; + using QProcess::processChannelMode; + + Q_PRIVATE_SLOT(d_func(), void _k_forwardStdout()) + Q_PRIVATE_SLOT(d_func(), void _k_forwardStderr()) +}; + +/* ----------- kprocess_p.h ---------------- */ +class KProcessPrivate { + + Q_DECLARE_PUBLIC(KProcess) + +protected: + KProcessPrivate() : + openMode(QIODevice::ReadWrite) + { + } + void writeAll(const QByteArray &buf, int fd); + void forwardStd(KProcess::ProcessChannel good, int fd); + void _k_forwardStdout(); + void _k_forwardStderr(); + + QString prog; + QStringList args; + KProcess::OutputChannelMode outputChannelMode; + QIODevice::OpenMode openMode; + + KProcess *q_ptr; +}; +/* ------------------------------------------- */ +#endif + diff --git a/konsole-qml-plugin/src/kpty.cpp b/konsole-qml-plugin/src/kpty.cpp new file mode 100644 index 0000000..4498a97 --- /dev/null +++ b/konsole-qml-plugin/src/kpty.cpp @@ -0,0 +1,701 @@ +/* + + This file is part of the KDE libraries + Copyright (C) 2002 Waldo Bastian + Copyright (C) 2002-2003,2007 Oswald Buddenhagen + + Rewritten for QT4 by e_k , Copyright (C)2008 + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "kpty_p.h" + + +#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) +#define HAVE_LOGIN +#define HAVE_LIBUTIL_H +#endif + +#ifdef __sgi +#define __svr4__ +#endif + +#ifdef __osf__ +#define _OSF_SOURCE +#include +#endif + +#ifdef _AIX +#define _ALL_SOURCE +#endif + +// __USE_XOPEN isn't defined by default in ICC +// (needed for ptsname(), grantpt() and unlockpt()) +#ifdef __INTEL_COMPILER +# ifndef __USE_XOPEN +# define __USE_XOPEN +# endif +#endif + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#if defined(HAVE_PTY_H) +# include +#endif + +#ifdef HAVE_LIBUTIL_H +# include +#elif defined(HAVE_UTIL_H) +# include +#endif + +#ifdef HAVE_UTEMPTER +extern "C" { +# include +} +#else +# include +# ifdef HAVE_UTMPX +# include +# endif +# if !defined(_PATH_UTMPX) && defined(_UTMPX_FILE) +# define _PATH_UTMPX _UTMPX_FILE +# endif +# ifdef HAVE_UPDWTMPX +# if !defined(_PATH_WTMPX) && defined(_WTMPX_FILE) +# define _PATH_WTMPX _WTMPX_FILE +# endif +# endif +#endif + +/* for HP-UX (some versions) the extern C is needed, and for other + platforms it doesn't hurt */ +extern "C" { +#include +#if defined(HAVE_TERMIO_H) +# include // struct winsize on some systems +#endif +} + +#if defined (_HPUX_SOURCE) +# define _TERMIOS_INCLUDED +# include +#endif + +#ifdef HAVE_SYS_STROPTS_H +# include // Defines I_PUSH +# define _NEW_TTY_CTRL +#endif + +#if defined (__FreeBSD__) || defined (__NetBSD__) || defined (__OpenBSD__) || defined (__bsdi__) || defined(__APPLE__) || defined (__DragonFly__) +# define _tcgetattr(fd, ttmode) ioctl(fd, TIOCGETA, (char *)ttmode) +#else +# if defined(_HPUX_SOURCE) || defined(__Lynx__) || defined (__CYGWIN__) +# define _tcgetattr(fd, ttmode) tcgetattr(fd, ttmode) +# else +# define _tcgetattr(fd, ttmode) ioctl(fd, TCGETS, (char *)ttmode) +# endif +#endif + +#if defined (__FreeBSD__) || defined (__NetBSD__) || defined (__OpenBSD__) || defined (__bsdi__) || defined(__APPLE__) || defined (__DragonFly__) +# define _tcsetattr(fd, ttmode) ioctl(fd, TIOCSETA, (char *)ttmode) +#else +# if defined(_HPUX_SOURCE) || defined(__CYGWIN__) +# define _tcsetattr(fd, ttmode) tcsetattr(fd, TCSANOW, ttmode) +# else +# define _tcsetattr(fd, ttmode) ioctl(fd, TCSETS, (char *)ttmode) +# endif +#endif + +//#include +//#include // findExe + +#include + +// not defined on HP-UX for example +#ifndef CTRL +# define CTRL(x) ((x) & 037) +#endif + +#define TTY_GROUP "tty" + +/////////////////////// +// private functions // +/////////////////////// + +////////////////// +// private data // +////////////////// + +KPtyPrivate::KPtyPrivate(KPty* parent) : + masterFd(-1), slaveFd(-1), ownMaster(true), q_ptr(parent) +{ +} + +KPtyPrivate::~KPtyPrivate() +{ +} + +bool KPtyPrivate::chownpty(bool) +{ +// return !QProcess::execute(KStandardDirs::findExe("kgrantpty"), +// QStringList() << (grant?"--grant":"--revoke") << QString::number(masterFd)); + return true; +} + +///////////////////////////// +// public member functions // +///////////////////////////// + +KPty::KPty() : + d_ptr(new KPtyPrivate(this)) +{ +} + +KPty::KPty(KPtyPrivate *d) : + d_ptr(d) +{ + d_ptr->q_ptr = this; +} + +KPty::~KPty() +{ + close(); + delete d_ptr; +} + +bool KPty::open() +{ + Q_D(KPty); + + if (d->masterFd >= 0) + return true; + + d->ownMaster = true; + + QByteArray ptyName; + + // Find a master pty that we can open //////////////////////////////// + + // Because not all the pty animals are created equal, they want to + // be opened by several different methods. + + // We try, as we know them, one by one. + +#ifdef HAVE_OPENPTY + + char ptsn[PATH_MAX]; + if (::openpty( &d->masterFd, &d->slaveFd, ptsn, 0, 0)) { + d->masterFd = -1; + d->slaveFd = -1; + qWarning(175) << "Can't open a pseudo teletype"; + return false; + } + d->ttyName = ptsn; + +#else + +#ifdef HAVE__GETPTY // irix + + char *ptsn = _getpty(&d->masterFd, O_RDWR|O_NOCTTY, S_IRUSR|S_IWUSR, 0); + if (ptsn) { + d->ttyName = ptsn; + goto grantedpt; + } + +#elif defined(HAVE_PTSNAME) || defined(TIOCGPTN) + +#ifdef HAVE_POSIX_OPENPT + d->masterFd = ::posix_openpt(O_RDWR|O_NOCTTY); +#elif defined(HAVE_GETPT) + d->masterFd = ::getpt(); +#elif defined(PTM_DEVICE) + d->masterFd = ::open(PTM_DEVICE, O_RDWR|O_NOCTTY); +#else +# error No method to open a PTY master detected. +#endif + if (d->masterFd >= 0) { +#ifdef HAVE_PTSNAME + char *ptsn = ptsname(d->masterFd); + if (ptsn) { + d->ttyName = ptsn; +#else + int ptyno; + if (!ioctl(d->masterFd, TIOCGPTN, &ptyno)) { + d->ttyName = QByteArray("/dev/pts/") + QByteArray::number(ptyno); +#endif +#ifdef HAVE_GRANTPT + if (!grantpt(d->masterFd)) { + goto grantedpt; + } +#else + + goto gotpty; +#endif + } + ::close(d->masterFd); + d->masterFd = -1; + } +#endif // HAVE_PTSNAME || TIOCGPTN + + // Linux device names, FIXME: Trouble on other systems? + for (const char * s3 = "pqrstuvwxyzabcde"; *s3; s3++) { + for (const char * s4 = "0123456789abcdef"; *s4; s4++) { + ptyName = QString().sprintf("/dev/pty%c%c", *s3, *s4).toLatin1(); + d->ttyName = QString().sprintf("/dev/tty%c%c", *s3, *s4).toLatin1(); + + d->masterFd = ::open(ptyName.data(), O_RDWR); + if (d->masterFd >= 0) { +#ifdef Q_OS_SOLARIS + /* Need to check the process group of the pty. + * If it exists, then the slave pty is in use, + * and we need to get another one. + */ + int pgrp_rtn; + if (ioctl(d->masterFd, TIOCGPGRP, &pgrp_rtn) == 0 || errno != EIO) { + ::close(d->masterFd); + d->masterFd = -1; + continue; + } +#endif /* Q_OS_SOLARIS */ + if (!access(d->ttyName.data(),R_OK|W_OK)) { // checks availability based on permission bits + if (!geteuid()) { + struct group * p = getgrnam(TTY_GROUP); + if (!p) { + p = getgrnam("wheel"); + } + gid_t gid = p ? p->gr_gid : getgid (); + + if (!chown(d->ttyName.data(), getuid(), gid)) { + chmod(d->ttyName.data(), S_IRUSR|S_IWUSR|S_IWGRP); + } + } + goto gotpty; + } + ::close(d->masterFd); + d->masterFd = -1; + } + } + } + + qWarning() << "Can't open a pseudo teletype"; + return false; + +gotpty: + struct stat st; + if (stat(d->ttyName.data(), &st)) { + return false; // this just cannot happen ... *cough* Yeah right, I just + // had it happen when pty #349 was allocated. I guess + // there was some sort of leak? I only had a few open. + } + if (((st.st_uid != getuid()) || + (st.st_mode & (S_IRGRP|S_IXGRP|S_IROTH|S_IWOTH|S_IXOTH))) && + !d->chownpty(true)) { + qWarning() + << "chownpty failed for device " << ptyName << "::" << d->ttyName + << "\nThis means the communication can be eavesdropped." << endl; + } + +#if defined (HAVE__GETPTY) || defined (HAVE_GRANTPT) +grantedpt: +#endif + +#ifdef HAVE_REVOKE + revoke(d->ttyName.data()); +#endif + +#ifdef HAVE_UNLOCKPT + unlockpt(d->masterFd); +#elif defined(TIOCSPTLCK) + int flag = 0; + ioctl(d->masterFd, TIOCSPTLCK, &flag); +#endif + + d->slaveFd = ::open(d->ttyName.data(), O_RDWR | O_NOCTTY); + if (d->slaveFd < 0) { + qWarning() << "Can't open slave pseudo teletype"; + ::close(d->masterFd); + d->masterFd = -1; + return false; + } + +#if (defined(__svr4__) || defined(__sgi__)) + // Solaris + ioctl(d->slaveFd, I_PUSH, "ptem"); + ioctl(d->slaveFd, I_PUSH, "ldterm"); +#endif + +#endif /* HAVE_OPENPTY */ + + fcntl(d->masterFd, F_SETFD, FD_CLOEXEC); + fcntl(d->slaveFd, F_SETFD, FD_CLOEXEC); + + return true; +} + +bool KPty::open(int fd) +{ +#if !defined(HAVE_PTSNAME) && !defined(TIOCGPTN) + qWarning() << "Unsupported attempt to open pty with fd" << fd; + return false; +#else + Q_D(KPty); + + if (d->masterFd >= 0) { + qWarning() << "Attempting to open an already open pty"; + return false; + } + + d->ownMaster = false; + +# ifdef HAVE_PTSNAME + char *ptsn = ptsname(fd); + if (ptsn) { + d->ttyName = ptsn; +# else + int ptyno; + if (!ioctl(fd, TIOCGPTN, &ptyno)) { + char buf[32]; + sprintf(buf, "/dev/pts/%d", ptyno); + d->ttyName = buf; +# endif + } else { + qWarning() << "Failed to determine pty slave device for fd" << fd; + return false; + } + + d->masterFd = fd; + if (!openSlave()) { + + d->masterFd = -1; + return false; + } + + return true; +#endif +} + +void KPty::closeSlave() +{ + Q_D(KPty); + + if (d->slaveFd < 0) { + return; + } + ::close(d->slaveFd); + d->slaveFd = -1; +} + +bool KPty::openSlave() +{ + Q_D(KPty); + + if (d->slaveFd >= 0) + return true; + if (d->masterFd < 0) { + qDebug() << "Attempting to open pty slave while master is closed"; + return false; + } + //d->slaveFd = KDE_open(d->ttyName.data(), O_RDWR | O_NOCTTY); + d->slaveFd = ::open(d->ttyName.data(), O_RDWR | O_NOCTTY); + if (d->slaveFd < 0) { + qDebug() << "Can't open slave pseudo teletype"; + return false; + } + fcntl(d->slaveFd, F_SETFD, FD_CLOEXEC); + return true; +} + +void KPty::close() +{ + Q_D(KPty); + + if (d->masterFd < 0) { + return; + } + closeSlave(); + // don't bother resetting unix98 pty, it will go away after closing master anyway. + if (memcmp(d->ttyName.data(), "/dev/pts/", 9)) { + if (!geteuid()) { + struct stat st; + if (!stat(d->ttyName.data(), &st)) { + chown(d->ttyName.data(), 0, st.st_gid == getgid() ? 0 : -1); + chmod(d->ttyName.data(), S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH); + } + } else { + fcntl(d->masterFd, F_SETFD, 0); + d->chownpty(false); + } + } + ::close(d->masterFd); + d->masterFd = -1; +} + +void KPty::setCTty() +{ + Q_D(KPty); + + // Setup job control ////////////////////////////////// + + // Become session leader, process group leader, + // and get rid of the old controlling terminal. + setsid(); + + // make our slave pty the new controlling terminal. +#ifdef TIOCSCTTY + ioctl(d->slaveFd, TIOCSCTTY, 0); +#else + // __svr4__ hack: the first tty opened after setsid() becomes controlling tty + ::close(::open(d->ttyName, O_WRONLY, 0)); +#endif + + // make our new process group the foreground group on the pty + int pgrp = getpid(); +#if defined(_POSIX_VERSION) || defined(__svr4__) + tcsetpgrp(d->slaveFd, pgrp); +#elif defined(TIOCSPGRP) + ioctl(d->slaveFd, TIOCSPGRP, (char *)&pgrp); +#endif +} + +void KPty::login(const char * user, const char * remotehost) +{ +#ifdef HAVE_UTEMPTER + Q_D(KPty); + + addToUtmp(d->ttyName, remotehost, d->masterFd); + Q_UNUSED(user); +#else +# ifdef HAVE_UTMPX + struct utmpx l_struct; +# else + struct utmp l_struct; +# endif + memset(&l_struct, 0, sizeof(l_struct)); + // note: strncpy without terminators _is_ correct here. man 4 utmp + + if (user) { + strncpy(l_struct.ut_name, user, sizeof(l_struct.ut_name)); + } + + if (remotehost) { + strncpy(l_struct.ut_host, remotehost, sizeof(l_struct.ut_host)); +# ifdef HAVE_STRUCT_UTMP_UT_SYSLEN + l_struct.ut_syslen = qMin(strlen(remotehost), sizeof(l_struct.ut_host)); +# endif + } + +# ifndef __GLIBC__ + Q_D(KPty); + const char * str_ptr = d->ttyName.data(); + if (!memcmp(str_ptr, "/dev/", 5)) { + str_ptr += 5; + } + strncpy(l_struct.ut_line, str_ptr, sizeof(l_struct.ut_line)); +# ifdef HAVE_STRUCT_UTMP_UT_ID + strncpy(l_struct.ut_id, + str_ptr + strlen(str_ptr) - sizeof(l_struct.ut_id), + sizeof(l_struct.ut_id)); +# endif +# endif + +# ifdef HAVE_UTMPX + gettimeofday(&l_struct.ut_tv, 0); +# else + l_struct.ut_time = time(0); +# endif + +# ifdef HAVE_LOGIN +# ifdef HAVE_LOGINX + ::loginx(&l_struct); +# else + ::login(&l_struct); +# endif +# else +# ifdef HAVE_STRUCT_UTMP_UT_TYPE + l_struct.ut_type = USER_PROCESS; +# endif +# ifdef HAVE_STRUCT_UTMP_UT_PID + l_struct.ut_pid = getpid(); +# ifdef HAVE_STRUCT_UTMP_UT_SESSION + l_struct.ut_session = getsid(0); +# endif +# endif +# ifdef HAVE_UTMPX + utmpxname(_PATH_UTMPX); + setutxent(); + pututxline(&l_struct); + endutxent(); +# ifdef HAVE_UPDWTMPX + updwtmpx(_PATH_WTMPX, &l_struct); +# endif +# else + utmpname(_PATH_UTMP); + setutent(); + pututline(&l_struct); + endutent(); + updwtmp(_PATH_WTMP, &l_struct); +# endif +# endif +#endif +} + +void KPty::logout() +{ +#ifdef HAVE_UTEMPTER + Q_D(KPty); + + removeLineFromUtmp(d->ttyName, d->masterFd); +#else + Q_D(KPty); + + const char *str_ptr = d->ttyName.data(); + if (!memcmp(str_ptr, "/dev/", 5)) { + str_ptr += 5; + } +# ifdef __GLIBC__ + else { + const char * sl_ptr = strrchr(str_ptr, '/'); + if (sl_ptr) { + str_ptr = sl_ptr + 1; + } + } +# endif +# ifdef HAVE_LOGIN +# ifdef HAVE_LOGINX + ::logoutx(str_ptr, 0, DEAD_PROCESS); +# else + ::logout(str_ptr); +# endif +# else +# ifdef HAVE_UTMPX + struct utmpx l_struct, *ut; +# else + struct utmp l_struct, *ut; +# endif + memset(&l_struct, 0, sizeof(l_struct)); + + strncpy(l_struct.ut_line, str_ptr, sizeof(l_struct.ut_line)); + +# ifdef HAVE_UTMPX + utmpxname(_PATH_UTMPX); + setutxent(); + if ((ut = getutxline(&l_struct))) { +# else + utmpname(_PATH_UTMP); + setutent(); + if ((ut = getutline(&l_struct))) { +# endif + memset(ut->ut_name, 0, sizeof(*ut->ut_name)); + memset(ut->ut_host, 0, sizeof(*ut->ut_host)); +# ifdef HAVE_STRUCT_UTMP_UT_SYSLEN + ut->ut_syslen = 0; +# endif +# ifdef HAVE_STRUCT_UTMP_UT_TYPE + ut->ut_type = DEAD_PROCESS; +# endif +# ifdef HAVE_UTMPX + gettimeofday(&ut->ut_tv, 0); + pututxline(ut); + } + endutxent(); +# else + ut->ut_time = time(0); + pututline(ut); +} +endutent(); +# endif +# endif +#endif +} + +// XXX Supposedly, tc[gs]etattr do not work with the master on Solaris. +// Please verify. + +bool KPty::tcGetAttr(struct ::termios * ttmode) const +{ + Q_D(const KPty); + + return _tcgetattr(d->masterFd, ttmode) == 0; +} + +bool KPty::tcSetAttr(struct ::termios * ttmode) +{ + Q_D(KPty); + + return _tcsetattr(d->masterFd, ttmode) == 0; +} + +bool KPty::setWinSize(int lines, int columns) +{ + Q_D(KPty); + + struct winsize winSize; + memset(&winSize, 0, sizeof(winSize)); + winSize.ws_row = (unsigned short)lines; + winSize.ws_col = (unsigned short)columns; + return ioctl(d->masterFd, TIOCSWINSZ, (char *)&winSize) == 0; +} + +bool KPty::setEcho(bool echo) +{ + struct ::termios ttmode; + if (!tcGetAttr(&ttmode)) { + return false; + } + if (!echo) { + ttmode.c_lflag &= ~ECHO; + } else { + ttmode.c_lflag |= ECHO; + } + return tcSetAttr(&ttmode); +} + +const char * KPty::ttyName() const +{ + Q_D(const KPty); + + return d->ttyName.data(); +} + +int KPty::masterFd() const +{ + Q_D(const KPty); + + return d->masterFd; +} + +int KPty::slaveFd() const +{ + Q_D(const KPty); + + return d->slaveFd; +} diff --git a/konsole-qml-plugin/src/kpty.h b/konsole-qml-plugin/src/kpty.h new file mode 100644 index 0000000..b0a30c3 --- /dev/null +++ b/konsole-qml-plugin/src/kpty.h @@ -0,0 +1,191 @@ +/* This file is part of the KDE libraries + + Copyright (C) 2003,2007 Oswald Buddenhagen + + Rewritten for QT4 by e_k , Copyright (C)2008 + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef kpty_h +#define kpty_h + +#include + +struct KPtyPrivate; +struct termios; + +/** + * Provides primitives for opening & closing a pseudo TTY pair, assigning the + * controlling TTY, utmp registration and setting various terminal attributes. + */ +class KPty { + Q_DECLARE_PRIVATE(KPty) + +public: + + /** + * Constructor + */ + KPty(); + + /** + * Destructor: + * + * If the pty is still open, it will be closed. Note, however, that + * an utmp registration is @em not undone. + */ + ~KPty(); + + /** + * Create a pty master/slave pair. + * + * @return true if a pty pair was successfully opened + */ + bool open(); + + bool open(int fd); + + /** + * Close the pty master/slave pair. + */ + void close(); + + /** + * Close the pty slave descriptor. + * + * When creating the pty, KPty also opens the slave and keeps it open. + * Consequently the master will never receive an EOF notification. + * Usually this is the desired behavior, as a closed pty slave can be + * reopened any time - unlike a pipe or socket. However, in some cases + * pipe-alike behavior might be desired. + * + * After this function was called, slaveFd() and setCTty() cannot be + * used. + */ + void closeSlave(); + bool openSlave(); + + /** + * Creates a new session and process group and makes this pty the + * controlling tty. + */ + void setCTty(); + + /** + * Creates an utmp entry for the tty. + * This function must be called after calling setCTty and + * making this pty the stdin. + * @param user the user to be logged on + * @param remotehost the host from which the login is coming. This is + * @em not the local host. For remote logins it should be the hostname + * of the client. For local logins from inside an X session it should + * be the name of the X display. Otherwise it should be empty. + */ + void login(const char * user = 0, const char * remotehost = 0); + + /** + * Removes the utmp entry for this tty. + */ + void logout(); + + /** + * Wrapper around tcgetattr(3). + * + * This function can be used only while the PTY is open. + * You will need an #include <termios.h> to do anything useful + * with it. + * + * @param ttmode a pointer to a termios structure. + * Note: when declaring ttmode, @c struct @c ::termios must be used - + * without the '::' some version of HP-UX thinks, this declares + * the struct in your class, in your method. + * @return @c true on success, false otherwise + */ + bool tcGetAttr(struct ::termios * ttmode) const; + + /** + * Wrapper around tcsetattr(3) with mode TCSANOW. + * + * This function can be used only while the PTY is open. + * + * @param ttmode a pointer to a termios structure. + * @return @c true on success, false otherwise. Note that success means + * that @em at @em least @em one attribute could be set. + */ + bool tcSetAttr(struct ::termios * ttmode); + + /** + * Change the logical (screen) size of the pty. + * The default is 24 lines by 80 columns. + * + * This function can be used only while the PTY is open. + * + * @param lines the number of rows + * @param columns the number of columns + * @return @c true on success, false otherwise + */ + bool setWinSize(int lines, int columns); + + /** + * Set whether the pty should echo input. + * + * Echo is on by default. + * If the output of automatically fed (non-interactive) PTY clients + * needs to be parsed, disabling echo often makes it much simpler. + * + * This function can be used only while the PTY is open. + * + * @param echo true if input should be echoed. + * @return @c true on success, false otherwise + */ + bool setEcho(bool echo); + + /** + * @return the name of the slave pty device. + * + * This function should be called only while the pty is open. + */ + const char * ttyName() const; + + /** + * @return the file descriptor of the master pty + * + * This function should be called only while the pty is open. + */ + int masterFd() const; + + /** + * @return the file descriptor of the slave pty + * + * This function should be called only while the pty slave is open. + */ + int slaveFd() const; + +protected: + /** + * @internal + */ + KPty(KPtyPrivate * d); + + /** + * @internal + */ + KPtyPrivate * const d_ptr; +}; + +#endif + diff --git a/konsole-qml-plugin/src/kpty_p.h b/konsole-qml-plugin/src/kpty_p.h new file mode 100644 index 0000000..276419d --- /dev/null +++ b/konsole-qml-plugin/src/kpty_p.h @@ -0,0 +1,50 @@ +/* This file is part of the KDE libraries + + Copyright (C) 2003,2007 Oswald Buddenhagen + + Rewritten for QT4 by e_k , Copyright (C)2008 + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef kpty_p_h +#define kpty_p_h + +#include "kpty.h" + +#include + +struct KPtyPrivate { + + Q_DECLARE_PUBLIC(KPty) + + KPtyPrivate(KPty* parent); + virtual ~KPtyPrivate(); + +#ifndef HAVE_OPENPTY + bool chownpty(bool grant); +#endif + + int masterFd; + int slaveFd; + bool ownMaster:1; + + QByteArray ttyName; + + KPty *q_ptr; +}; + +#endif diff --git a/konsole-qml-plugin/src/kptydevice.cpp b/konsole-qml-plugin/src/kptydevice.cpp new file mode 100644 index 0000000..37ecce8 --- /dev/null +++ b/konsole-qml-plugin/src/kptydevice.cpp @@ -0,0 +1,422 @@ +/* + * This file is a part of QTerminal - http://gitorious.org/qterminal + * + * This file was un-linked from KDE and modified + * by Maxim Bourmistrov + * + */ + +/* + + This file is part of the KDE libraries + Copyright (C) 2007 Oswald Buddenhagen + Copyright (C) 2010 KDE e.V. + Author Adriaan de Groot + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "kptydevice.h" +#include "kpty_p.h" + +#include + +#include +#include +#include +#include +#include +#include +#ifdef HAVE_SYS_FILIO_H +# include +#endif +#ifdef HAVE_SYS_TIME_H +# include +#endif + +#if defined(Q_OS_FREEBSD) || defined(Q_OS_MAC) + // "the other end's output queue size" - kinda braindead, huh? +# define PTY_BYTES_AVAILABLE TIOCOUTQ +#elif defined(TIOCINQ) + // "our end's input queue size" +# define PTY_BYTES_AVAILABLE TIOCINQ +#else + // likewise. more generic ioctl (theoretically) +# define PTY_BYTES_AVAILABLE FIONREAD +#endif + + + + +////////////////// +// private data // +////////////////// + +// Lifted from Qt. I don't think they would mind. ;) +// Re-lift again from Qt whenever a proper replacement for pthread_once appears +static void qt_ignore_sigpipe() +{ + static QBasicAtomicInt atom = Q_BASIC_ATOMIC_INITIALIZER(0); + if (atom.testAndSetRelaxed(0, 1)) { + struct sigaction noaction; + memset(&noaction, 0, sizeof(noaction)); + noaction.sa_handler = SIG_IGN; + sigaction(SIGPIPE, &noaction, 0); + } +} + +#define NO_INTR(ret,func) do { ret = func; } while (ret < 0 && errno == EINTR) + +bool KPtyDevicePrivate::_k_canRead() +{ + Q_Q(KPtyDevice); + qint64 readBytes = 0; + +#ifdef Q_OS_IRIX // this should use a config define, but how to check it? + size_t available; +#else + int available; +#endif + if (!::ioctl(q->masterFd(), PTY_BYTES_AVAILABLE, (char *) &available)) { +#ifdef Q_OS_SOLARIS + // A Pty is a STREAMS module, and those can be activated + // with 0 bytes available. This happens either when ^C is + // pressed, or when an application does an explicit write(a,b,0) + // which happens in experiments fairly often. When 0 bytes are + // available, you must read those 0 bytes to clear the STREAMS + // module, but we don't want to hit the !readBytes case further down. + if (!available) { + char c; + // Read the 0-byte STREAMS message + NO_INTR(readBytes, read(q->masterFd(), &c, 0)); + // Should return 0 bytes read; -1 is error + if (readBytes < 0) { + readNotifier->setEnabled(false); + emit q->readEof(); + return false; + } + return true; + } +#endif + + char *ptr = readBuffer.reserve(available); +#ifdef Q_OS_SOLARIS + // Even if available > 0, it is possible for read() + // to return 0 on Solaris, due to 0-byte writes in the stream. + // Ignore them and keep reading until we hit *some* data. + // In Solaris it is possible to have 15 bytes available + // and to (say) get 0, 0, 6, 0 and 9 bytes in subsequent reads. + // Because the stream is set to O_NONBLOCK in finishOpen(), + // an EOF read will return -1. + readBytes = 0; + while (!readBytes) +#endif + // Useless block braces except in Solaris + { + NO_INTR(readBytes, read(q->masterFd(), ptr, available)); + } + if (readBytes < 0) { + readBuffer.unreserve(available); + q->setErrorString("Error reading from PTY"); + return false; + } + readBuffer.unreserve(available - readBytes); // *should* be a no-op + } + + if (!readBytes) { + readNotifier->setEnabled(false); + emit q->readEof(); + return false; + } else { + if (!emittedReadyRead) { + emittedReadyRead = true; + emit q->readyRead(); + emittedReadyRead = false; + } + return true; + } +} + +bool KPtyDevicePrivate::_k_canWrite() +{ + Q_Q(KPtyDevice); + + writeNotifier->setEnabled(false); + if (writeBuffer.isEmpty()) + return false; + + qt_ignore_sigpipe(); + int wroteBytes; + NO_INTR(wroteBytes, + write(q->masterFd(), + writeBuffer.readPointer(), writeBuffer.readSize())); + if (wroteBytes < 0) { + q->setErrorString("Error writing to PTY"); + return false; + } + writeBuffer.free(wroteBytes); + + if (!emittedBytesWritten) { + emittedBytesWritten = true; + emit q->bytesWritten(wroteBytes); + emittedBytesWritten = false; + } + + if (!writeBuffer.isEmpty()) + writeNotifier->setEnabled(true); + return true; +} + +#ifndef timeradd +// Lifted from GLIBC +# define timeradd(a, b, result) \ + do { \ + (result)->tv_sec = (a)->tv_sec + (b)->tv_sec; \ + (result)->tv_usec = (a)->tv_usec + (b)->tv_usec; \ + if ((result)->tv_usec >= 1000000) { \ + ++(result)->tv_sec; \ + (result)->tv_usec -= 1000000; \ + } \ + } while (0) +# define timersub(a, b, result) \ + do { \ + (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \ + (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \ + if ((result)->tv_usec < 0) { \ + --(result)->tv_sec; \ + (result)->tv_usec += 1000000; \ + } \ + } while (0) +#endif + +bool KPtyDevicePrivate::doWait(int msecs, bool reading) +{ + Q_Q(KPtyDevice); +#ifndef __linux__ + struct timeval etv; +#endif + struct timeval tv, *tvp; + + if (msecs < 0) + tvp = 0; + else { + tv.tv_sec = msecs / 1000; + tv.tv_usec = (msecs % 1000) * 1000; +#ifndef __linux__ + gettimeofday(&etv, 0); + timeradd(&tv, &etv, &etv); +#endif + tvp = &tv; + } + + while (reading ? readNotifier->isEnabled() : !writeBuffer.isEmpty()) { + fd_set rfds; + fd_set wfds; + + FD_ZERO(&rfds); + FD_ZERO(&wfds); + + if (readNotifier->isEnabled()) + FD_SET(q->masterFd(), &rfds); + if (!writeBuffer.isEmpty()) + FD_SET(q->masterFd(), &wfds); + +#ifndef __linux__ + if (tvp) { + gettimeofday(&tv, 0); + timersub(&etv, &tv, &tv); + if (tv.tv_sec < 0) + tv.tv_sec = tv.tv_usec = 0; + } +#endif + + switch (select(q->masterFd() + 1, &rfds, &wfds, 0, tvp)) { + case -1: + if (errno == EINTR) + break; + return false; + case 0: + q->setErrorString("PTY operation timed out"); + return false; + default: + if (FD_ISSET(q->masterFd(), &rfds)) { + bool canRead = _k_canRead(); + if (reading && canRead) + return true; + } + if (FD_ISSET(q->masterFd(), &wfds)) { + bool canWrite = _k_canWrite(); + if (!reading) + return canWrite; + } + break; + } + } + return false; +} + +void KPtyDevicePrivate::finishOpen(QIODevice::OpenMode mode) +{ + Q_Q(KPtyDevice); + + q->QIODevice::open(mode); + fcntl(q->masterFd(), F_SETFL, O_NONBLOCK); + readBuffer.clear(); + readNotifier = new QSocketNotifier(q->masterFd(), QSocketNotifier::Read, q); + writeNotifier = new QSocketNotifier(q->masterFd(), QSocketNotifier::Write, q); + QObject::connect(readNotifier, SIGNAL(activated(int)), q, SLOT(_k_canRead())); + QObject::connect(writeNotifier, SIGNAL(activated(int)), q, SLOT(_k_canWrite())); + readNotifier->setEnabled(true); +} + +///////////////////////////// +// public member functions // +///////////////////////////// + +KPtyDevice::KPtyDevice(QObject *parent) : + QIODevice(parent), + KPty(new KPtyDevicePrivate(this)) +{ +} + +KPtyDevice::~KPtyDevice() +{ + close(); +} + +bool KPtyDevice::open(OpenMode mode) +{ + Q_D(KPtyDevice); + + if (masterFd() >= 0) + return true; + + if (!KPty::open()) { + setErrorString("Error opening PTY"); + return false; + } + + d->finishOpen(mode); + + return true; +} + +bool KPtyDevice::open(int fd, OpenMode mode) +{ + Q_D(KPtyDevice); + + if (!KPty::open(fd)) { + setErrorString("Error opening PTY"); + return false; + } + + d->finishOpen(mode); + + return true; +} + +void KPtyDevice::close() +{ + Q_D(KPtyDevice); + + if (masterFd() < 0) + return; + + delete d->readNotifier; + delete d->writeNotifier; + + QIODevice::close(); + + KPty::close(); +} + +bool KPtyDevice::isSequential() const +{ + return true; +} + +bool KPtyDevice::canReadLine() const +{ + Q_D(const KPtyDevice); + return QIODevice::canReadLine() || d->readBuffer.canReadLine(); +} + +bool KPtyDevice::atEnd() const +{ + Q_D(const KPtyDevice); + return QIODevice::atEnd() && d->readBuffer.isEmpty(); +} + +qint64 KPtyDevice::bytesAvailable() const +{ + Q_D(const KPtyDevice); + return QIODevice::bytesAvailable() + d->readBuffer.size(); +} + +qint64 KPtyDevice::bytesToWrite() const +{ + Q_D(const KPtyDevice); + return d->writeBuffer.size(); +} + +bool KPtyDevice::waitForReadyRead(int msecs) +{ + Q_D(KPtyDevice); + return d->doWait(msecs, true); +} + +bool KPtyDevice::waitForBytesWritten(int msecs) +{ + Q_D(KPtyDevice); + return d->doWait(msecs, false); +} + +void KPtyDevice::setSuspended(bool suspended) +{ + Q_D(KPtyDevice); + d->readNotifier->setEnabled(!suspended); +} + +bool KPtyDevice::isSuspended() const +{ + Q_D(const KPtyDevice); + return !d->readNotifier->isEnabled(); +} + +// protected +qint64 KPtyDevice::readData(char *data, qint64 maxlen) +{ + Q_D(KPtyDevice); + return d->readBuffer.read(data, (int)qMin(maxlen, KMAXINT)); +} + +// protected +qint64 KPtyDevice::readLineData(char *data, qint64 maxlen) +{ + Q_D(KPtyDevice); + return d->readBuffer.readLine(data, (int)qMin(maxlen, KMAXINT)); +} + +// protected +qint64 KPtyDevice::writeData(const char *data, qint64 len) +{ + Q_D(KPtyDevice); + Q_ASSERT(len <= KMAXINT); + + d->writeBuffer.write(data, len); + d->writeNotifier->setEnabled(true); + return len; +} diff --git a/konsole-qml-plugin/src/kptydevice.h b/konsole-qml-plugin/src/kptydevice.h new file mode 100644 index 0000000..05a7787 --- /dev/null +++ b/konsole-qml-plugin/src/kptydevice.h @@ -0,0 +1,360 @@ +/* + * This file is a part of QTerminal - http://gitorious.org/qterminal + * + * This file was un-linked from KDE and modified + * by Maxim Bourmistrov + * + */ + +/* This file is part of the KDE libraries + + Copyright (C) 2007 Oswald Buddenhagen + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef kptydev_h +#define kptydev_h + +#include "kpty_p.h" + +#include + +#define KMAXINT ((int)(~0U >> 1)) + +struct KPtyDevicePrivate; + +#define Q_DECLARE_PRIVATE_MI(Class, SuperClass) \ + inline Class##Private* d_func() { return reinterpret_cast(SuperClass::d_ptr); } \ + inline const Class##Private* d_func() const { return reinterpret_cast(SuperClass::d_ptr); } \ + friend class Class##Private; + +/** + * Encapsulates KPty into a QIODevice, so it can be used with Q*Stream, etc. + */ +class KPtyDevice : public QIODevice, public KPty { + Q_OBJECT + Q_DECLARE_PRIVATE_MI(KPtyDevice, KPty) + +public: + + /** + * Constructor + */ + KPtyDevice(QObject *parent = 0); + + /** + * Destructor: + * + * If the pty is still open, it will be closed. Note, however, that + * an utmp registration is @em not undone. + */ + virtual ~KPtyDevice(); + + /** + * Create a pty master/slave pair. + * + * @return true if a pty pair was successfully opened + */ + virtual bool open(OpenMode mode = ReadWrite | Unbuffered); + + /** + * Open using an existing pty master. The ownership of the fd + * remains with the caller, i.e., close() will not close the fd. + * + * This is useful if you wish to attach a secondary "controller" to an + * existing pty device such as a terminal widget. + * Note that you will need to use setSuspended() on both devices to + * control which one gets the incoming data from the pty. + * + * @param fd an open pty master file descriptor. + * @param mode the device mode to open the pty with. + * @return true if a pty pair was successfully opened + */ + bool open(int fd, OpenMode mode = ReadWrite | Unbuffered); + + /** + * Close the pty master/slave pair. + */ + virtual void close(); + + /** + * Sets whether the KPtyDevice monitors the pty for incoming data. + * + * When the KPtyDevice is suspended, it will no longer attempt to buffer + * data that becomes available from the pty and it will not emit any + * signals. + * + * Do not use on closed ptys. + * After a call to open(), the pty is not suspended. If you need to + * ensure that no data is read, call this function before the main loop + * is entered again (i.e., immediately after opening the pty). + */ + void setSuspended(bool suspended); + + /** + * Returns true if the KPtyDevice is not monitoring the pty for incoming + * data. + * + * Do not use on closed ptys. + * + * See setSuspended() + */ + bool isSuspended() const; + + /** + * @return always true + */ + virtual bool isSequential() const; + + /** + * @reimp + */ + bool canReadLine() const; + + /** + * @reimp + */ + bool atEnd() const; + + /** + * @reimp + */ + qint64 bytesAvailable() const; + + /** + * @reimp + */ + qint64 bytesToWrite() const; + + bool waitForBytesWritten(int msecs = -1); + bool waitForReadyRead(int msecs = -1); + + +Q_SIGNALS: + /** + * Emitted when EOF is read from the PTY. + * + * Data may still remain in the buffers. + */ + void readEof(); + +protected: + virtual qint64 readData(char *data, qint64 maxSize); + virtual qint64 readLineData(char *data, qint64 maxSize); + virtual qint64 writeData(const char *data, qint64 maxSize); + +private: + Q_PRIVATE_SLOT(d_func(), bool _k_canRead()) + Q_PRIVATE_SLOT(d_func(), bool _k_canWrite()) +}; + +///////////////////////////////////////////////////// +// Helper. Remove when QRingBuffer becomes public. // +///////////////////////////////////////////////////// + +#include +#include + +#define CHUNKSIZE 4096 + +class KRingBuffer +{ +public: + KRingBuffer() + { + clear(); + } + + void clear() + { + buffers.clear(); + QByteArray tmp; + tmp.resize(CHUNKSIZE); + buffers << tmp; + head = tail = 0; + totalSize = 0; + } + + inline bool isEmpty() const + { + return buffers.count() == 1 && !tail; + } + + inline int size() const + { + return totalSize; + } + + inline int readSize() const + { + return (buffers.count() == 1 ? tail : buffers.first().size()) - head; + } + + inline const char *readPointer() const + { + Q_ASSERT(totalSize > 0); + return buffers.first().constData() + head; + } + + void free(int bytes) + { + totalSize -= bytes; + Q_ASSERT(totalSize >= 0); + + forever { + int nbs = readSize(); + + if (bytes < nbs) { + head += bytes; + if (head == tail && buffers.count() == 1) { + buffers.first().resize(CHUNKSIZE); + head = tail = 0; + } + break; + } + + bytes -= nbs; + if (buffers.count() == 1) { + buffers.first().resize(CHUNKSIZE); + head = tail = 0; + break; + } + + buffers.removeFirst(); + head = 0; + } + } + + char *reserve(int bytes) + { + totalSize += bytes; + + char *ptr; + if (tail + bytes <= buffers.last().size()) { + ptr = buffers.last().data() + tail; + tail += bytes; + } else { + buffers.last().resize(tail); + QByteArray tmp; + tmp.resize(qMax(CHUNKSIZE, bytes)); + ptr = tmp.data(); + buffers << tmp; + tail = bytes; + } + return ptr; + } + + // release a trailing part of the last reservation + inline void unreserve(int bytes) + { + totalSize -= bytes; + tail -= bytes; + } + + inline void write(const char *data, int len) + { + memcpy(reserve(len), data, len); + } + + // Find the first occurrence of c and return the index after it. + // If c is not found until maxLength, maxLength is returned, provided + // it is smaller than the buffer size. Otherwise -1 is returned. + int indexAfter(char c, int maxLength = KMAXINT) const + { + int index = 0; + int start = head; + QLinkedList::ConstIterator it = buffers.begin(); + forever { + if (!maxLength) + return index; + if (index == size()) + return -1; + const QByteArray &buf = *it; + ++it; + int len = qMin((it == buffers.end() ? tail : buf.size()) - start, + maxLength); + const char *ptr = buf.data() + start; + if (const char *rptr = (const char *)memchr(ptr, c, len)) + return index + (rptr - ptr) + 1; + index += len; + maxLength -= len; + start = 0; + } + } + + inline int lineSize(int maxLength = KMAXINT) const + { + return indexAfter('\n', maxLength); + } + + inline bool canReadLine() const + { + return lineSize() != -1; + } + + int read(char *data, int maxLength) + { + int bytesToRead = qMin(size(), maxLength); + int readSoFar = 0; + while (readSoFar < bytesToRead) { + const char *ptr = readPointer(); + int bs = qMin(bytesToRead - readSoFar, readSize()); + memcpy(data + readSoFar, ptr, bs); + readSoFar += bs; + free(bs); + } + return readSoFar; + } + + int readLine(char *data, int maxLength) + { + return read(data, lineSize(qMin(maxLength, size()))); + } + +private: + QLinkedList buffers; + int head, tail; + int totalSize; +}; + +struct KPtyDevicePrivate : public KPtyPrivate { + + Q_DECLARE_PUBLIC(KPtyDevice) + + KPtyDevicePrivate(KPty* parent) : + KPtyPrivate(parent), + emittedReadyRead(false), emittedBytesWritten(false), + readNotifier(0), writeNotifier(0) + { + } + + bool _k_canRead(); + bool _k_canWrite(); + + bool doWait(int msecs, bool reading); + void finishOpen(QIODevice::OpenMode mode); + + bool emittedReadyRead; + bool emittedBytesWritten; + QSocketNotifier *readNotifier; + QSocketNotifier *writeNotifier; + KRingBuffer readBuffer; + KRingBuffer writeBuffer; +}; + +#endif + diff --git a/konsole-qml-plugin/src/kptyprocess.cpp b/konsole-qml-plugin/src/kptyprocess.cpp new file mode 100644 index 0000000..078770b --- /dev/null +++ b/konsole-qml-plugin/src/kptyprocess.cpp @@ -0,0 +1,129 @@ +/* + * This file is a part of QTerminal - http://gitorious.org/qterminal + * + * This file was un-linked from KDE and modified + * by Maxim Bourmistrov + * + */ + +/* + This file is part of the KDE libraries + + Copyright (C) 2007 Oswald Buddenhagen + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + + +#include "kptyprocess.h" +#include "kprocess.h" +#include "kptydevice.h" + +#include +#include + +KPtyProcess::KPtyProcess(QObject *parent) : + KProcess(new KPtyProcessPrivate, parent) +{ + Q_D(KPtyProcess); + + d->pty = new KPtyDevice(this); + d->pty->open(); + connect(this, SIGNAL(stateChanged(QProcess::ProcessState)), + SLOT(_k_onStateChanged(QProcess::ProcessState))); +} + +KPtyProcess::KPtyProcess(int ptyMasterFd, QObject *parent) : + KProcess(new KPtyProcessPrivate, parent) +{ + Q_D(KPtyProcess); + + d->pty = new KPtyDevice(this); + d->pty->open(ptyMasterFd); + connect(this, SIGNAL(stateChanged(QProcess::ProcessState)), + SLOT(_k_onStateChanged(QProcess::ProcessState))); +} + +KPtyProcess::~KPtyProcess() +{ + Q_D(KPtyProcess); + + if (state() != QProcess::NotRunning && d->addUtmp) { + d->pty->logout(); + disconnect(SIGNAL(stateChanged(QProcess::ProcessState)), + this, SLOT(_k_onStateChanged(QProcess::ProcessState))); + } + delete d->pty; +} + +void KPtyProcess::setPtyChannels(PtyChannels channels) +{ + Q_D(KPtyProcess); + + d->ptyChannels = channels; +} + +KPtyProcess::PtyChannels KPtyProcess::ptyChannels() const +{ + Q_D(const KPtyProcess); + + return d->ptyChannels; +} + +void KPtyProcess::setUseUtmp(bool value) +{ + Q_D(KPtyProcess); + + d->addUtmp = value; +} + +bool KPtyProcess::isUseUtmp() const +{ + Q_D(const KPtyProcess); + + return d->addUtmp; +} + +KPtyDevice *KPtyProcess::pty() const +{ + Q_D(const KPtyProcess); + + return d->pty; +} + +void KPtyProcess::setupChildProcess() +{ + Q_D(KPtyProcess); + + d->pty->setCTty(); + +#if 0 + if (d->addUtmp) + d->pty->login(KUser(KUser::UseRealUserID).loginName().toLocal8Bit().data(), qgetenv("DISPLAY")); +#endif + if (d->ptyChannels & StdinChannel) + dup2(d->pty->slaveFd(), 0); + + if (d->ptyChannels & StdoutChannel) + dup2(d->pty->slaveFd(), 1); + + if (d->ptyChannels & StderrChannel) + dup2(d->pty->slaveFd(), 2); + + KProcess::setupChildProcess(); +} + +//#include "kptyprocess.moc" diff --git a/konsole-qml-plugin/src/kptyprocess.h b/konsole-qml-plugin/src/kptyprocess.h new file mode 100644 index 0000000..15e4de4 --- /dev/null +++ b/konsole-qml-plugin/src/kptyprocess.h @@ -0,0 +1,178 @@ +/* + * This file is a part of QTerminal - http://gitorious.org/qterminal + * + * This file was un-linked from KDE and modified + * by Maxim Bourmistrov + * + */ + +/* + This file is part of the KDE libraries + + Copyright (C) 2007 Oswald Buddenhagen + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef KPTYPROCESS_H +#define KPTYPROCESS_H + +#include "kprocess.h" +#include "kptydevice.h" + +#include + +class KPtyDevice; + +struct KPtyProcessPrivate; + +/** + * This class extends KProcess by support for PTYs (pseudo TTYs). + * + * The PTY is opened as soon as the class is instantiated. Verify that + * it was opened successfully by checking that pty()->masterFd() is not -1. + * + * The PTY is always made the process' controlling TTY. + * Utmp registration and connecting the stdio handles to the PTY are optional. + * + * No attempt to integrate with QProcess' waitFor*() functions was made, + * for it is impossible. Note that execute() does not work with the PTY, too. + * Use the PTY device's waitFor*() functions or use it asynchronously. + * + * @author Oswald Buddenhagen + */ +class KPtyProcess : public KProcess +{ + Q_OBJECT + Q_DECLARE_PRIVATE(KPtyProcess) + +public: + enum PtyChannelFlag { + NoChannels = 0, /**< The PTY is not connected to any channel. */ + StdinChannel = 1, /**< Connect PTY to stdin. */ + StdoutChannel = 2, /**< Connect PTY to stdout. */ + StderrChannel = 4, /**< Connect PTY to stderr. */ + AllOutputChannels = 6, /**< Connect PTY to all output channels. */ + AllChannels = 7 /**< Connect PTY to all channels. */ + }; + + Q_DECLARE_FLAGS(PtyChannels, PtyChannelFlag) + + /** + * Constructor + */ + explicit KPtyProcess(QObject *parent = 0); + + /** + * Construct a process using an open pty master. + * + * @param ptyMasterFd an open pty master file descriptor. + * The process does not take ownership of the descriptor; + * it will not be automatically closed at any point. + */ + KPtyProcess(int ptyMasterFd, QObject *parent = 0); + + /** + * Destructor + */ + virtual ~KPtyProcess(); + + /** + * Set to which channels the PTY should be assigned. + * + * This function must be called before starting the process. + * + * @param channels the output channel handling mode + */ + void setPtyChannels(PtyChannels channels); + + bool isRunning() const + { + bool rval; + (pid() > 0) ? rval= true : rval= false; + return rval; + + } + /** + * Query to which channels the PTY is assigned. + * + * @return the output channel handling mode + */ + PtyChannels ptyChannels() const; + + /** + * Set whether to register the process as a TTY login in utmp. + * + * Utmp is disabled by default. + * It should enabled for interactively fed processes, like terminal + * emulations. + * + * This function must be called before starting the process. + * + * @param value whether to register in utmp. + */ + void setUseUtmp(bool value); + + /** + * Get whether to register the process as a TTY login in utmp. + * + * @return whether to register in utmp + */ + bool isUseUtmp() const; + + /** + * Get the PTY device of this process. + * + * @return the PTY device + */ + KPtyDevice *pty() const; + +protected: + /** + * @reimp + */ + virtual void setupChildProcess(); + +private: + Q_PRIVATE_SLOT(d_func(), void _k_onStateChanged(QProcess::ProcessState)) +}; + + +////////////////// +// private data // +////////////////// + +struct KPtyProcessPrivate : KProcessPrivate { + KPtyProcessPrivate() : + ptyChannels(KPtyProcess::NoChannels), + addUtmp(false) + { + } + + void _k_onStateChanged(QProcess::ProcessState newState) + { + if (newState == QProcess::NotRunning && addUtmp) + pty->logout(); + } + + KPtyDevice *pty; + KPtyProcess::PtyChannels ptyChannels; + bool addUtmp : 1; +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(KPtyProcess::PtyChannels) + +#endif diff --git a/konsole-qml-plugin/src/ksession.cpp b/konsole-qml-plugin/src/ksession.cpp new file mode 100644 index 0000000..62338f4 --- /dev/null +++ b/konsole-qml-plugin/src/ksession.cpp @@ -0,0 +1,242 @@ +/* + This file is part of Konsole QML plugin, + which is a terminal emulator from KDE. + + Copyright 2013 by Dmitry Zagnoyko + + 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. +*/ + +// Own +#include "ksession.h" + +// Qt +#include + +// Konsole +#include "KeyboardTranslator.h" +#include "TerminalDisplay.h" + + +KSession::KSession(QObject *parent) : + QObject(parent), m_session(createSession("KSession")) +{ + connect(m_session, SIGNAL(finished()), this, SLOT(sessionFinished())); + + m_session->run(); +} + +KSession::~KSession() +{ + if (m_session) { + m_session->close(); + m_session->disconnect(); + delete m_session; + } +} + +void KSession::setTitle(QString name) +{ + m_session->setTitle(Session::NameRole, name); +} + + +Session *KSession::createSession(QString name) +{ + Session *session = new Session(); + + session->setTitle(Session::NameRole, name); + + /* Thats a freaking bad idea!!!! + * /bin/bash is not there on every system + * better set it to the current $SHELL + * Maybe you can also make a list available and then let the widget-owner decide what to use. + * By setting it to $SHELL right away we actually make the first filecheck obsolete. + * But as iam not sure if you want to do anything else ill just let both checks in and set this to $SHELL anyway. + */ + session->setProgram("/bin/bash"); + + //session->setProgram(getenv("SHELL")); + + QStringList args(""); + session->setArguments(args); + session->setAutoClose(true); + + session->setCodec(QTextCodec::codecForName("UTF-8")); + + session->setFlowControlEnabled(true); + session->setHistoryType(HistoryTypeBuffer(1000)); + + session->setDarkBackground(true); + + session->setKeyBindings(""); + + return session; +} + +///////////////////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////////////////// + + +int KSession::getRandomSeed() +{ + return m_session->sessionId() * 31; +} + +void KSession::addView(KTerminalDisplay *displa) +{ + m_session->addView(displa); +} + +void KSession::sessionFinished() +{ + emit finished(); +} + +void KSession::selectionChanged(bool textSelected) +{ + Q_UNUSED(textSelected) +} + +void KSession::startShellProgram() +{ + if ( m_session->isRunning() ) { + return; + } + + m_session->run(); +} + +int KSession::getShellPID() +{ + return m_session->processId(); +} + +void KSession::changeDir(const QString &dir) +{ + /* + this is a very hackish way of trying to determine if the shell is in + the foreground before attempting to change the directory. It may not + be portable to anything other than Linux. + */ + QString strCmd; + strCmd.setNum(getShellPID()); + strCmd.prepend("ps -j "); + strCmd.append(" | tail -1 | awk '{ print $5 }' | grep -q \\+"); + int retval = system(strCmd.toStdString().c_str()); + + if (!retval) { + QString cmd = "cd " + dir + "\n"; + sendText(cmd); + } +} + +void KSession::setEnvironment(const QStringList &environment) +{ + m_session->setEnvironment(environment); +} + + +void KSession::setShellProgram(const QString &progname) +{ + if (!m_session) + return; + + m_session->setProgram(progname); +} + +void KSession::setWorkingDirectory(const QString &dir) +{ + if (!m_session) + return; + + m_session->setInitialWorkingDirectory(dir); +} + +void KSession::setArgs(QStringList &args) +{ + if (!m_session) + return; + + m_session->setArguments(args); +} + +void KSession::setTextCodec(QTextCodec *codec) +{ + if (!m_session) + return; + + m_session->setCodec(codec); +} + +void KSession::setHistorySize(int lines) +{ + if (lines < 0) + m_session->setHistoryType(HistoryTypeFile()); + else + m_session->setHistoryType(HistoryTypeBuffer(lines)); +} + +void KSession::sendText(QString text) +{ + m_session->sendText(text); +} + +void KSession::sendKey(int rep, int key, int mod) const +{ + Qt::KeyboardModifier kbm = Qt::KeyboardModifier(mod); + + QKeyEvent qkey(QEvent::KeyPress, key, kbm); + + while (rep > 0){ + m_session->sendKey(&qkey); + --rep; + } +} + +void KSession::setFlowControlEnabled(bool enabled) +{ + m_session->setFlowControlEnabled(enabled); +} + +bool KSession::flowControlEnabled() +{ + return m_session->flowControlEnabled(); +} + +void KSession::setKeyBindings(const QString &kb) +{ + m_session->setKeyBindings(kb); + emit changedKeyBindings(kb); +} + +QString KSession::getKeyBindings() +{ + return m_session->keyBindings(); +} + + +QStringList KSession::availableKeyBindings() +{ + return KeyboardTranslatorManager::instance()->allTranslators(); +} + +QString KSession::keyBindings() +{ + return m_session->keyBindings(); +} + + diff --git a/konsole-qml-plugin/src/ksession.h b/konsole-qml-plugin/src/ksession.h new file mode 100644 index 0000000..eb18339 --- /dev/null +++ b/konsole-qml-plugin/src/ksession.h @@ -0,0 +1,132 @@ +/* + This file is part of Konsole QML plugin, + which is a terminal emulator from KDE. + + Copyright 2013 by Dmitry Zagnoyko + + 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. +*/ + +#ifndef KSESSION_H +#define KSESSION_H + +#include + +// Konsole +#include "Session.h" + +class KTerminalDisplay; + +class KSession : public QObject +{ + Q_OBJECT + Q_PROPERTY(QString kbScheme READ getKeyBindings WRITE setKeyBindings NOTIFY changedKeyBindings) + +public: + KSession(QObject *parent = 0); + ~KSession(); + +public: + //bool setup(); + void addView(KTerminalDisplay *displa); + + //start shell program if it was not started in constructor + void startShellProgram(); + + int getRandomSeed(); + QString getKeyBindings(); + + //look-n-feel, if you don`t like defaults + + //environment + void setEnvironment(const QStringList & environment); + + // Shell program, default is /bin/bash + void setShellProgram(const QString & progname); + + //working directory + void setWorkingDirectory(const QString & dir); + + // Shell program args, default is none + void setArgs(QStringList & args); + + //Text codec, default is UTF-8 + void setTextCodec(QTextCodec * codec); + + // History size for scrolling + void setHistorySize(int lines); //infinite if lines < 0 + + // Sets whether flow control is enabled + void setFlowControlEnabled(bool enabled); + + // Returns whether flow control is enabled + bool flowControlEnabled(void); + + /** + * Sets whether the flow control warning box should be shown + * when the flow control stop key (Ctrl+S) is pressed. + */ + //void setFlowControlWarningEnabled(bool enabled); + + /*! Get all available keyboard bindings + */ + static QStringList availableKeyBindings(); + + //! Return current key bindings + QString keyBindings(); + +signals: + void finished(); + void copyAvailable(bool); + + void termGetFocus(); + void termLostFocus(); + + void termKeyPressed(QKeyEvent *); + + void changedKeyBindings(QString kb); + + +public slots: + /*! Set named key binding for given widget + */ + void setKeyBindings(const QString & kb); + void setTitle(QString name); + + int getShellPID(); + void changeDir(const QString & dir); + + // Send some text to terminal + void sendText(QString text); + // Send some text to terminal + void sendKey(int rep, int key, int mod) const; + + +protected slots: + void sessionFinished(); + void selectionChanged(bool textSelected); + +private slots: + Session* createSession(QString name); + //Konsole::KTerminalDisplay* createTerminalDisplay(Konsole::Session *session, QQuickItem* parent); + +private: + //Konsole::KTerminalDisplay *m_terminalDisplay; + Session *m_session; + +}; + +#endif // KSESSION_H diff --git a/konsole-qml-plugin/src/plugin.cpp b/konsole-qml-plugin/src/plugin.cpp new file mode 100644 index 0000000..ce7f3d5 --- /dev/null +++ b/konsole-qml-plugin/src/plugin.cpp @@ -0,0 +1,63 @@ +/* + This file is part of Konsole QML plugin, + which is a terminal emulator from KDE. + + Copyright 2013 by Dmitry Zagnoyko + + 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. +*/ + +#include +#include + +#include "plugin.h" + +#include + +KonsoleKterminalPlugin::KonsoleKterminalPlugin() { } + +KonsoleKterminalPlugin::~KonsoleKterminalPlugin() { } + +void KonsoleKterminalPlugin::initializeEngine(QQmlEngine *engine, const char *uri) +{ + Q_ASSERT(uri == QLatin1String("org.kde.konsole")); + + QQmlExtensionPlugin::initializeEngine(engine, uri); + + QStringList pwds = engine->importPathList(); + + if (!pwds.empty()){ + + QString cs, kbl; + + foreach (QString pwd, pwds) { + cs = pwd + "/org/kde/konsole/color-schemes"; + kbl = pwd + "/org/kde/konsole/kb-layouts"; + if (QDir(cs).exists()) break; + } + + setenv("KB_LAYOUT_DIR",kbl.toLatin1().constData(),1); + setenv("COLORSCHEMES_DIR",cs.toLatin1().constData(),1); + } +} + +void KonsoleKterminalPlugin::registerTypes(const char *uri) +{ + Q_ASSERT(uri == QLatin1String("org.kde.konsole")); + + qmlRegisterType(uri, 0, 1, "KTerminal"); + qmlRegisterType(uri, 0, 1, "KSession"); +} diff --git a/konsole-qml-plugin/src/plugin.h b/konsole-qml-plugin/src/plugin.h new file mode 100644 index 0000000..67c2a4d --- /dev/null +++ b/konsole-qml-plugin/src/plugin.h @@ -0,0 +1,46 @@ +/* + This file is part of Konsole QML plugin, + which is a terminal emulator from KDE. + + Copyright 2013 by Dmitry Zagnoyko + + 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. +*/ + +#ifndef KDE_QML_PLUGIN_KTERMINAL +#define KDE_QML_PLUGIN_KTERMINAL + +#include "TerminalDisplay.h" +#include "ksession.h" + +#include +#include + +class KonsoleKterminalPlugin : public QQmlExtensionPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") + +public: + KonsoleKterminalPlugin(); + ~KonsoleKterminalPlugin(); + + void registerTypes(const char *uri); + void initializeEngine(QQmlEngine *engine, const char *uri); + +}; + +#endif // KDE_QML_PLUGIN_KTERMINAL diff --git a/konsole-qml-plugin/src/plugins.qmltypes b/konsole-qml-plugin/src/plugins.qmltypes new file mode 100644 index 0000000..c0d246f --- /dev/null +++ b/konsole-qml-plugin/src/plugins.qmltypes @@ -0,0 +1,169 @@ +import QtQuick.tooling 1.1 + +// This file describes the plugin-supplied types contained in the library. +// It is used for QML tooling purposes only. +// +// This file was auto-generated with the command '/usr/lib/x86_64-linux-gnu/qt5/bin/qmlplugindump -notrelocatable org.kde.konsole 0.1 ../../../'. + +Module { + Component { + name: "KSession" + prototype: "QObject" + exports: ["org.kde.konsole/KSession 0.1"] + Property { name: "kbScheme"; type: "string" } + Signal { name: "finished" } + Signal { + name: "copyAvailable" + Parameter { type: "bool" } + } + Signal { name: "termGetFocus" } + Signal { name: "termLostFocus" } + Signal { + name: "termKeyPressed" + Parameter { type: "QKeyEvent"; isPointer: true } + } + Signal { + name: "changedKeyBindings" + Parameter { name: "kb"; type: "string" } + } + Method { + name: "setKeyBindings" + Parameter { name: "kb"; type: "string" } + } + Method { + name: "setTitle" + Parameter { name: "name"; type: "string" } + } + Method { name: "getShellPID"; type: "int" } + Method { + name: "changeDir" + Parameter { name: "dir"; type: "string" } + } + Method { + name: "sendText" + Parameter { name: "text"; type: "string" } + } + Method { + name: "sendKey" + Parameter { name: "rep"; type: "int" } + Parameter { name: "key"; type: "int" } + Parameter { name: "mod"; type: "int" } + } + } + Component { + name: "KTerminalDisplay" + defaultProperty: "data" + prototype: "QQuickPaintedItem" + exports: ["org.kde.konsole/KTerminal 0.1"] + Property { name: "session"; type: "KSession"; isPointer: true } + Property { name: "colorScheme"; type: "string" } + Property { name: "font"; type: "QFont" } + Property { name: "activeFocusOnClick"; type: "bool" } + Property { name: "ShowIMEOnClick"; type: "bool" } + Signal { + name: "changedScheme" + Parameter { name: "scheme"; type: "string" } + } + Signal { + name: "changedAutoVKB" + Parameter { name: "au"; type: "bool" } + } + Signal { + name: "changedAutoFocus" + Parameter { name: "au"; type: "bool" } + } + Signal { name: "clicked" } + Signal { + name: "keyPressedSignal" + Parameter { name: "e"; type: "QKeyEvent"; isPointer: true } + } + Signal { + name: "changedFontMetricSignal" + Parameter { name: "height"; type: "int" } + Parameter { name: "width"; type: "int" } + } + Signal { + name: "changedContentSizeSignal" + Parameter { name: "height"; type: "int" } + Parameter { name: "width"; type: "int" } + } + Signal { + name: "configureRequest" + Parameter { name: "position"; type: "QPoint" } + } + Signal { + name: "overrideShortcutCheck" + Parameter { name: "keyEvent"; type: "QKeyEvent"; isPointer: true } + Parameter { name: "override"; type: "bool&" } + } + Signal { + name: "isBusySelecting" + Parameter { type: "bool" } + } + Signal { + name: "copyAvailable" + Parameter { type: "bool" } + } + Signal { name: "termGetFocus" } + Signal { name: "termLostFocus" } + Signal { + name: "changedSession" + Parameter { name: "session"; type: "KSession"; isPointer: true } + } + Method { name: "forcedFocus" } + Method { + name: "setColorScheme" + Parameter { name: "name"; type: "string" } + } + Method { name: "availableColorSchemes"; type: "QStringList" } + Method { + name: "click" + Parameter { name: "x"; type: "double" } + Parameter { name: "y"; type: "double" } + } + Method { name: "autoFocus"; type: "bool" } + Method { + name: "setAutoFocus" + Parameter { name: "au"; type: "bool" } + } + Method { name: "autoVKB"; type: "bool" } + Method { + name: "setAutoVKB" + Parameter { name: "au"; type: "bool" } + } + Method { name: "getVTFont"; type: "QFont" } + Method { + name: "setVTFont" + Parameter { name: "font"; type: "QFont" } + } + Method { name: "scrollToEnd" } + Method { name: "updateImage" } + Method { name: "updateLineProperties" } + Method { name: "copyClipboard" } + Method { name: "pasteClipboard" } + Method { name: "pasteSelection" } + Method { + name: "setFlowControlWarningEnabled" + Parameter { name: "enabled"; type: "bool" } + } + Method { name: "flowControlWarningEnabled"; type: "bool" } + Method { + name: "bell" + Parameter { name: "message"; type: "string" } + } + Method { + name: "setBackgroundColor" + Parameter { name: "color"; type: "QColor" } + } + Method { + name: "setForegroundColor" + Parameter { name: "color"; type: "QColor" } + } + Method { name: "selectionChanged" } + Method { + name: "setSession" + Parameter { name: "session"; type: "KSession"; isPointer: true } + } + Method { name: "getSession"; type: "KSession*" } + } +} diff --git a/konsole-qml-plugin/src/qmldir b/konsole-qml-plugin/src/qmldir new file mode 100644 index 0000000..f7c8b18 --- /dev/null +++ b/konsole-qml-plugin/src/qmldir @@ -0,0 +1,3 @@ +module org.kde.konsole +typeinfo plugins.qmltypes +plugin kdekonsole diff --git a/konsole-qml-plugin/src/tools.cpp b/konsole-qml-plugin/src/tools.cpp new file mode 100644 index 0000000..8cd87d6 --- /dev/null +++ b/konsole-qml-plugin/src/tools.cpp @@ -0,0 +1,80 @@ +#include "tools.h" + +#include +#include +#include + + +/*! Helper function to get possible location of layout files. +By default the KB_LAYOUT_DIR is used (linux/BSD/macports). +But in some cases (apple bundle) there can be more locations). +*/ +QString get_kb_layout_dir() +{ +// qDebug() << __FILE__ << __FUNCTION__; + + QString rval = ""; + QString k(getenv("KB_LAYOUT_DIR")); + QDir d(k); + +// qDebug() << "default KB_LAYOUT_DIR: " << k; + + if (d.exists()) + rval = k.append("/"); + + // subdir in the app location + d.setPath(QCoreApplication::applicationDirPath() + "/kb-layouts/"); + //qDebug() << d.path(); + if (d.exists()) + rval = QCoreApplication::applicationDirPath() + "/kb-layouts/"; +#ifdef Q_WS_MAC + d.setPath(QCoreApplication::applicationDirPath() + "/../Resources/kb-layouts/"); + if (d.exists()) + rval = QCoreApplication::applicationDirPath() + "/../Resources/kb-layouts/"; +#endif +#ifdef QT_DEBUG + if(!rval.isEmpty()) { + qDebug() << "Using kb-layouts: " << rval; + } else { + qDebug() << "Cannot find kb-layouts in any location!"; + } +#endif + return rval; +} + +/*! Helper function to get possible location of layout files. +By default the COLORSCHEMES_DIR is used (linux/BSD/macports). +But in some cases (apple bundle) there can be more locations). +*/ +QString get_color_schemes_dir() +{ +// qDebug() << __FILE__ << __FUNCTION__; + + QString rval = ""; + QString k(getenv("COLORSCHEMES_DIR")); + QDir d(k); + +// qDebug() << "default COLORSCHEMES_DIR: " << k; + + if (d.exists()) + rval = k.append("/"); + + // subdir in the app location + d.setPath(QCoreApplication::applicationDirPath() + "/color-schemes/"); + //qDebug() << d.path(); + if (d.exists()) + rval = QCoreApplication::applicationDirPath() + "/color-schemes/"; +#ifdef Q_WS_MAC + d.setPath(QCoreApplication::applicationDirPath() + "/../Resources/color-schemes/"); + if (d.exists()) + rval = QCoreApplication::applicationDirPath() + "/../Resources/color-schemes/"; +#endif +#ifdef QT_DEBUG + if(!rval.isEmpty()) { + qDebug() << "Using color-schemes: " << rval; + } else { + qDebug() << "Cannot find color-schemes in any location!"; + } +#endif + return rval; +} diff --git a/konsole-qml-plugin/src/tools.h b/konsole-qml-plugin/src/tools.h new file mode 100644 index 0000000..b24d88f --- /dev/null +++ b/konsole-qml-plugin/src/tools.h @@ -0,0 +1,10 @@ +#ifndef TOOLS_H +#define TOOLS_H + +#include + +QString get_kb_layout_dir(); +QString get_color_schemes_dir(); + + +#endif diff --git a/main.cpp b/main.cpp deleted file mode 100644 index acbbfa0..0000000 --- a/main.cpp +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2013 "Filippo Scognamiglio" -* https://github.com/Swordifish90/cool-old-term -* -* This file is part of cool-old-term. -* -* cool-old-term 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 . -*******************************************************************************/ - -#include -#include -#include - -#include "register_qml_types.h" -#include "terminal_screen.h" -#include "yat_pty.h" - -int main(int argc, char *argv[]) -{ - QApplication app(argc, argv); - app.setApplicationName("cool-old-term"); - - register_qml_types(); - - QQmlApplicationEngine engine; - engine.load(QUrl("qml/cool-old-term/main.qml")); - - return app.exec(); -} diff --git a/qml/cool-old-term/TerminalCursor.qml b/qml/cool-old-term/TerminalCursor.qml deleted file mode 100644 index a37e682..0000000 --- a/qml/cool-old-term/TerminalCursor.qml +++ /dev/null @@ -1,66 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2013 Jørgen Lind -* -* Permission is hereby granted, free of charge, to any person obtaining a copy -* of this software and associated documentation files (the "Software"), to deal -* in the Software without restriction, including without limitation the rights -* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -* copies of the Software, and to permit persons to whom the Software is -* furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included in all -* copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -* SOFTWARE. -* -*******************************************************************************/ - -import QtQuick 2.0 - -import org.yat 1.0 - -ObjectDestructItem { - id: cursor - - property real fontHeight - property real fontWidth - - height: fontHeight - width: fontWidth - x: objectHandle.x * fontWidth - y: objectHandle.y * fontHeight - z: 1.1 - - visible: objectHandle.visible - - ShaderEffect { - anchors.fill: parent - - property variant source: fragmentSource - - fragmentShader: - "uniform lowp float qt_Opacity;" + - "uniform sampler2D source;" + - "varying highp vec2 qt_TexCoord0;" + - - "void main() {" + - " lowp vec4 color = texture2D(source, qt_TexCoord0 ) * qt_Opacity;" + - " gl_FragColor = vec4(1.0 - color.r, 1.0 - color.g, 1.0 - color.b, color.a);" + - "}" - - ShaderEffectSource { - id: fragmentSource - sourceItem: background - live: true - - sourceRect: Qt.rect(cursor.x,cursor.y,cursor.width,cursor.height); - } - } -} - diff --git a/qml/cool-old-term/TerminalLine.qml b/qml/cool-old-term/TerminalLine.qml deleted file mode 100644 index e1c7ab2..0000000 --- a/qml/cool-old-term/TerminalLine.qml +++ /dev/null @@ -1,34 +0,0 @@ -import QtQuick 2.0 - -import org.yat 1.0 - -ObjectDestructItem { - id: textLine - - property var textComponent : Qt.createComponent("TerminalText.qml") - property font font - property real fontHeight - property real fontWidth - - height: fontHeight - width: parent.width - visible: objectHandle.visible - - Connections { - target: objectHandle - - onIndexChanged: { - y = objectHandle.index * fontHeight; - } - - onTextCreated: { - var textSegment = textComponent.createObject(textLine, - { - "objectHandle" : text, - "font" : textLine.font, - "fontWidth" : textLine.fontWidth, - }) - } - } -} - diff --git a/qml/cool-old-term/TerminalScreen.qml b/qml/cool-old-term/TerminalScreen.qml deleted file mode 100644 index e8d4169..0000000 --- a/qml/cool-old-term/TerminalScreen.qml +++ /dev/null @@ -1,258 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2013 Jørgen Lind -* -* Permission is hereby granted, free of charge, to any person obtaining a copy -* of this software and associated documentation files (the "Software"), to deal -* in the Software without restriction, including without limitation the rights -* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -* copies of the Software, and to permit persons to whom the Software is -* furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included in all -* copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -* SOFTWARE. -* -*******************************************************************************/ - -import QtQuick 2.1 - -import org.yat 1.0 - -TerminalScreen { - id: screenItem - - property font font - property real fontWidth: fontMetricText.paintedWidth - property real fontHeight: fontMetricText.paintedHeight - - property var lineComponent : Qt.createComponent("TerminalLine.qml") - property var textComponent : Qt.createComponent("TerminalText.qml") - property var cursorComponent : Qt.createComponent("TerminalCursor.qml") - - font.family: shadersettings.font.name - font.pixelSize: shadersettings.fontSize - focus: true - - onActiveFocusChanged: { - if (activeFocus) { - Qt.inputMethod.show(); - } - } - - Keys.onPressed: { - if (event.text === "?") { - terminal.screen.printScreen() - } - } - - Text { - id: fontMetricText - text: "B" - font: parent.font - visible: false - textFormat: Text.PlainText - } - - Flickable { - id: flickable - anchors.top: parent.top - anchors.left: parent.left - contentWidth: width - contentHeight: textContainer.height - interactive: false - flickableDirection: Flickable.VerticalFlick - contentY: ((screen.contentHeight - screen.height) * screenItem.fontHeight) - boundsBehavior: Flickable.StopAtBounds - - Item { - id: textContainer - width: parent.width - height: screen.contentHeight * screenItem.fontHeight - Rectangle { - id: background - anchors.fill: parent - color: terminal.screen.defaultBackgroundColor - } - } - onContentYChanged: { - if (!atYEnd) { - var top_line = Math.floor(Math.max(contentY,0) / screenItem.fontHeight); - screen.ensureVisiblePages(top_line); - } - } - } - - Connections { - id: connections - - target: terminal.screen - - onFlash: { - flashAnimation.start() - } - - onReset: { - resetScreenItems(); - } - - onTextCreated: { - var textSegment = textComponent.createObject(screenItem, - { - "parent" : background, - "objectHandle" : text, - "font" : screenItem.font, - "fontWidth" : screenItem.fontWidth, - "fontHeight" : screenItem.fontHeight, - }) - } - - onCursorCreated: { - if (cursorComponent.status != Component.Ready) { - console.log(cursorComponent.errorString()); - return; - } - var cursorVariable = cursorComponent.createObject(screenItem, - { - "parent" : textContainer, - "objectHandle" : cursor, - "fontWidth" : screenItem.fontWidth, - "fontHeight" : screenItem.fontHeight, - }) - } - - onRequestHeightChange: { - terminalWindow.height = newHeight * screenItem.fontHeight; - terminalWindow.contentItem.height = newHeight * screenItem.fontHeight; - } - - onRequestWidthChange: { - terminalWindow.width = newWidth * screenItem.fontWidth; - terminalWindow.contentItem.width = newWidth * screenItem.fontWidth; - } - } - - onFontChanged: { - setTerminalHeight(); - setTerminalWidth(); - } - - onWidthChanged: { - setTerminalWidth(); - } - onHeightChanged: { - setTerminalHeight(); - } - Component.onCompleted: { - setTerminalWidth(); - setTerminalHeight(); - } - - function setTerminalWidth() { - if (fontWidth > 0) { - var pty_width = Math.floor(width / fontWidth); - flickable.width = pty_width * fontWidth; - screen.width = pty_width; - } - } - - function setTerminalHeight() { - if (fontHeight > 0) { - var pty_height = Math.floor(height / fontHeight); - flickable.height = pty_height * fontHeight; - screen.height = pty_height; - } - } - - HighlightArea { - characterHeight: fontHeight - characterWidth: fontWidth - - start: screen.selectionAreaStart - end: screen.selectionAreaEnd - - visible: screen.selectionEnabled - } - - Rectangle { - id: flash - z: 1.2 - anchors.fill: parent - color: "grey" - opacity: 0 - SequentialAnimation { - id: flashAnimation - NumberAnimation { - target: flash - property: "opacity" - to: 0.5 - duration: 75 - } - NumberAnimation { - target: flash - property: "opacity" - to: 0 - duration: 75 - } - } - } - - MouseArea { - id:mousArea - - property point drag_start - - anchors.fill: parent - acceptedButtons: Qt.LeftButton | Qt.MiddleButton - onPressed: { - if (mouse.button == Qt.LeftButton) { - hoverEnabled = true; - var character = Math.floor((mouse.x / screen.charWidth)); - var line = Math.floor(mouse.y / screen.lineHeight); - var start = Qt.point(character,line); - drag_start = start; - screen.selectionAreaStart = start; - screen.selectionAreaEnd = start; - } - } - - onPositionChanged: { - var character = Math.floor(mouse.x / screen.charWidth); - var line = Math.floor(mouse.y / screen.lineHeight); - var current_pos = Qt.point(character,line); - if (line < drag_start.y || (line === drag_start.y && character < drag_start.x)) { - screen.selectionAreaStart = current_pos; - screen.selectionAreaEnd = drag_start; - }else { - screen.selectionAreaEnd = current_pos; - screen.selectionAreaStart = drag_start; - } - } - - onReleased: { - if (mouse.button == Qt.LeftButton) { - hoverEnabled = false; - screen.sendSelectionToSelection(); - } - } - - onClicked: { - if (mouse.button == Qt.MiddleButton) { - screen.pasteFromSelection(); - } - } - onDoubleClicked: { - if (mouse.button == Qt.LeftButton) { - var character = Math.floor(mouse.x / screen.charWidth); - var line = Math.floor(mouse.y / screen.lineHeight); - screen.doubleClicked(Qt.point(character,line)); - } - } - } -} diff --git a/qml/cool-old-term/TerminalText.qml b/qml/cool-old-term/TerminalText.qml deleted file mode 100644 index b4ecf50..0000000 --- a/qml/cool-old-term/TerminalText.qml +++ /dev/null @@ -1,81 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2013 Jørgen Lind -* -* Permission is hereby granted, free of charge, to any person obtaining a copy -* of this software and associated documentation files (the "Software"), to deal -* in the Software without restriction, including without limitation the rights -* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -* copies of the Software, and to permit persons to whom the Software is -* furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included in all -* copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -* SOFTWARE. -* -*******************************************************************************/ - -import QtQuick 2.0 - -import org.yat 1.0 - -ObjectDestructItem { - id: textItem - property font font - property real fontWidth - property real fontHeight - - y: objectHandle.line * fontHeight; - x: objectHandle.index * fontWidth; - - width: textElement.paintedWidth - height: textElement.paintedHeight - - visible: objectHandle.visible - - Rectangle { - anchors.fill: parent - color: "black" - - MonoText { - id: textElement - anchors.fill: parent - text: objectHandle.text - color: "white" - font.family: textItem.font.family - font.pixelSize: textItem.font.pixelSize - font.pointSize: textItem.font.pointSize - font.bold: objectHandle.bold - font.underline: objectHandle.underline - latin: objectHandle.latin - - SequentialAnimation { - running: objectHandle.blinking - loops: Animation.Infinite - onRunningChanged: { - if (running === false) - textElement.opacity = 1 - } - NumberAnimation { - target: textElement - property: "opacity" - to: 0 - duration: 250 - } - NumberAnimation { - target: textElement - property: "opacity" - to: 1 - duration: 250 - } - } - } - } - -} diff --git a/yat/README b/yat/README deleted file mode 100644 index 8f8c732..0000000 --- a/yat/README +++ /dev/null @@ -1,6 +0,0 @@ -YAT is a terminal emulator written in qml and c++ - -The main goal of the project was to find out if it was possible to use qml to -write a terminal emulator which performed on par with xterm and konsole. - -Turns out, it's possible. diff --git a/yat/backend/backend.pri b/yat/backend/backend.pri deleted file mode 100644 index db0e4ae..0000000 --- a/yat/backend/backend.pri +++ /dev/null @@ -1,39 +0,0 @@ -DEPENDPATH += $$PWD -INCLUDEPATH += $$PWD - -LIBS += -lutil - -CONFIG += c++11 - -MOC_DIR = .moc -OBJECTS_DIR = .obj - -HEADERS += \ - $$PWD/yat_pty.h \ - $$PWD/text.h \ - $$PWD/controll_chars.h \ - $$PWD/parser.h \ - $$PWD/screen.h \ - $$PWD/block.h \ - $$PWD/color_palette.h \ - $$PWD/text_style.h \ - $$PWD/screen_data.h \ - $$PWD/cursor.h \ - $$PWD/nrc_text_codec.h \ - $$PWD/scrollback.h \ - $$PWD/utf8_decoder.h - -SOURCES += \ - $$PWD/yat_pty.cpp \ - $$PWD/text.cpp \ - $$PWD/controll_chars.cpp \ - $$PWD/parser.cpp \ - $$PWD/screen.cpp \ - $$PWD/block.cpp \ - $$PWD/color_palette.cpp \ - $$PWD/text_style.cpp \ - $$PWD/screen_data.cpp \ - $$PWD/cursor.cpp \ - $$PWD/nrc_text_codec.cpp \ - $$PWD/scrollback.cpp - diff --git a/yat/backend/block.cpp b/yat/backend/block.cpp deleted file mode 100644 index 6a8b50b..0000000 --- a/yat/backend/block.cpp +++ /dev/null @@ -1,564 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 Jørgen Lind - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - ******************************************************************************/ - -#include "block.h" - -#include "text.h" -#include "screen.h" - -#include -#include - -#include - -#include - -Block::Block(Screen *screen) - : m_screen(screen) - , m_line(0) - , m_new_line(-1) - , m_width(m_screen->width()) - , m_visible(true) - , m_changed(true) - , m_only_latin(true) -{ - clear(); -} - -Block::~Block() -{ - for (int i = 0; i < m_style_list.size(); i++) { - m_style_list[i].releaseTextSegment(m_screen); - } -} - -Screen *Block::screen() const -{ - return m_screen; -} - -void Block::clear() -{ - m_text_line.clear(); - - for (int i = 0; i < m_style_list.size(); i++) { - m_style_list[i].releaseTextSegment(m_screen); - } - - m_style_list.clear(); - - m_only_latin = true; - m_changed = true; -} - -void Block::clearToEnd(int from) -{ - clearCharacters(from, m_text_line.size() - 1); -} - -void Block::clearCharacters(int from, int to) -{ - if (from > m_text_line.size()) - return; - - QString empty(to+1-from, QChar(' ')); - const TextStyle &defaultTextStyle = m_screen->defaultTextStyle(); - replaceAtPos(from, empty, defaultTextStyle); -} - -void Block::deleteCharacters(int from, int to) -{ - m_changed = true; - - int removed = 0; - const int size = (to + 1) - from; - bool found = false; - - int last_index = -1; - - for (int i = 0; i < m_style_list.size(); i++) { - TextStyleLine ¤t_style = m_style_list[i]; - last_index = i; - if (found) { - current_style.start_index -= removed; - current_style.end_index -= removed; - current_style.index_dirty = true; - if (removed != size) { - int current_style_size = current_style.end_index + 1 - current_style.start_index; - if (current_style_size <= size - removed) { - removed += current_style.end_index + 1 - current_style.start_index; - current_style.releaseTextSegment(m_screen); - m_style_list.remove(i); - i--; - } else { - current_style.end_index -= size - removed; - removed = size; - } - } - } else { - if (current_style.start_index <= from && current_style.end_index >= from) { - found = true; - int left_in_style = (current_style.end_index + 1) - from; - int subtract = std::min(left_in_style, size); - current_style.end_index -= subtract; - current_style.text_dirty = true; - removed = subtract; - if (current_style.end_index < current_style.start_index) { - current_style.releaseTextSegment(m_screen); - m_style_list.remove(i); - i--; - } - } - } - } - - if (last_index >= 0) { - TextStyleLine &last_modified = m_style_list[last_index]; - TextStyle defaultStyle = m_screen->defaultTextStyle(); - if (last_modified.isCompatible(defaultStyle)) { - last_modified.end_index += size; - last_modified.text_dirty = true; - } else { - m_style_list.insert(last_index + 1, TextStyleLine(defaultStyle, - last_modified.end_index + 1, last_modified.end_index + size)); - } - } - - m_text_line.remove(from, size); -} - -void Block::deleteToEnd(int from) -{ - deleteCharacters(from, m_text_line.size() - 1); -} - -void Block::deleteLines(int from) -{ - if (from > lineCount()) - return; -} - -void Block::replaceAtPos(int pos, const QString &text, const TextStyle &style, bool only_latin) -{ - m_changed = true; - m_only_latin = m_only_latin && only_latin; - - if (pos >= m_text_line.size()) { - if (pos > m_text_line.size()) { - int old_size = m_text_line.size(); - QString filling(pos - m_text_line.size(), QChar(' ')); - m_text_line.append(filling); - m_style_list.append(TextStyleLine(m_screen->defaultTextStyle(), old_size, old_size + filling.size() -1)); - } - m_text_line.append(text); - m_style_list.append(TextStyleLine(style, pos, pos + text.size()-1)); - return; - } else if (pos + text.size() > m_text_line.size()) { - m_style_list.append(TextStyleLine(m_screen->defaultTextStyle(), pos + text.size() - m_text_line.size(), pos + text.size() -1)); - } - - m_text_line.replace(pos,text.size(),text); - bool found = false; - for (int i = 0; i < m_style_list.size(); i++) { - TextStyleLine ¤t_style = m_style_list[i]; - if (found) { - if (current_style.end_index <= pos + text.size() - 1) { - current_style.releaseTextSegment(m_screen); - m_style_list.remove(i); - i--; - } else if (current_style.start_index <= pos + text.size()) { - current_style.start_index = pos + text.size(); - current_style.style_dirty = true; - current_style.text_dirty = true; - current_style.index_dirty = true; - } else { - break; - } - } else if (pos >= current_style.start_index && pos <= current_style.end_index) { - found = true; - if (pos + text.size() -1 <= current_style.end_index) { - if (current_style.isCompatible(style)) { - current_style.text_dirty = true; - } else { - if (current_style.start_index == pos && current_style.end_index == pos + text.size() - 1) { - current_style.setStyle(style); - current_style.text_dirty = true; - current_style.style_dirty = true; - } else if (current_style.start_index == pos) { - current_style.start_index = pos + text.size(); - current_style.text_dirty = true; - m_style_list.insert(i, TextStyleLine(style,pos, pos+text.size() -1)); - } else if (current_style.end_index == pos + text.size() - 1) { - current_style.end_index = pos - 1; - current_style.text_dirty = true; - m_style_list.insert(i+1, TextStyleLine(style,pos, pos + text.size() - 1)); - } else { - int old_end = current_style.end_index; - current_style.end_index = pos - 1; - current_style.text_dirty = true; - m_style_list.insert(i+1, TextStyleLine(style,pos, pos + text.size() - 1)); - if (pos + text.size() < m_text_line.size()) { - m_style_list.insert(i+2, TextStyleLine(current_style,pos + text.size(), old_end)); - } - } - } - break; - } else { - if (current_style.isCompatible(style)) { - current_style.end_index = pos + text.size() - 1; - current_style.text_dirty = true; - } else { - if (current_style.start_index == pos) { - if (i > 0 && m_style_list.at(i-1).isCompatible(style)) { - TextStyleLine &previous_style = m_style_list[i -1]; - previous_style.end_index+= text.size(); - previous_style.text_dirty = true; - current_style.releaseTextSegment(m_screen); - m_style_list.remove(i); - i--; - } else { - current_style.end_index = pos + text.size() - 1; - current_style.style = style.style; - current_style.forground = style.forground; - current_style.background = style.background; - current_style.text_dirty = true; - current_style.style_dirty = true; - current_style.index_dirty = true; - } - } else { - current_style.end_index = pos - 1; - current_style.text_dirty = true; - m_style_list.insert(i+1, TextStyleLine(style, pos, pos + text.size() -1)); - i++; - } - } - } - } - } -} - -void Block::insertAtPos(int pos, const QString &text, const TextStyle &style, bool only_latin) -{ - m_changed = true; - m_only_latin = m_only_latin && only_latin; - - m_text_line.insert(pos,text); - bool found = false; - - for (int i = 0; i < m_style_list.size(); i++) { - TextStyleLine ¤t_style = m_style_list[i]; - if (found) { - current_style.start_index += text.size(); - current_style.end_index += text.size(); - current_style.index_dirty = true; - if (current_style.start_index >= m_text_line.size()) { - current_style.releaseTextSegment(m_screen); - m_style_list.remove(i); - i--; - } else if (current_style.end_index >= m_text_line.size()) { - current_style.end_index = m_text_line.size()-1; - } - } else if (pos >= current_style.start_index && pos <= current_style.end_index) { - found = true; - if (current_style.start_index == pos) { - current_style.start_index += text.size(); - current_style.end_index += text.size(); - current_style.index_dirty = true; - m_style_list.insert(i, TextStyleLine(style, pos, pos+ text.size() - 1)); - i++; - } else if (current_style.end_index == pos) { - current_style.end_index--; - current_style.text_dirty = true; - m_style_list.insert(i+1, TextStyleLine(style, pos, pos+ text.size() - 1)); - i++; - } else { - int old_end = current_style.end_index; - current_style.end_index = pos -1; - current_style.text_dirty = true; - m_style_list.insert(i+1, TextStyleLine(style, pos, pos + text.size() - 1)); - if (pos + text.size() < m_text_line.size()) { - int segment_end = std::min(m_text_line.size() -1, old_end + text.size()); - m_style_list.insert(i+2, TextStyleLine(current_style, pos + text.size(), segment_end)); - i+=2; - } else { - i++; - } - } - } - } -} - -void Block::setIndex(int index) -{ - if (index != m_new_line) { - m_changed = true; - m_new_line = index; - } -} - -QString *Block::textLine() -{ - return &m_text_line; -} - -void Block::setVisible(bool visible) -{ - if (visible != m_visible) { - m_changed = true; - m_visible = visible; - for (int i = 0; i < m_style_list.size(); i++) { - if (m_style_list.at(i).text_segment) { - m_style_list.at(i).text_segment->setVisible(visible); - } - } - } -} - -bool Block::visible() const -{ - return m_visible; -} - -Block *Block::split(int line) -{ - if (line >= lineCount()) - return nullptr; - m_changed = true; - Block *to_return = new Block(m_screen); - int start_index = line * m_width; - for (int i = 0; i < m_style_list.size(); i++) { - ensureStyleAlignWithLines(i); - TextStyleLine ¤t_style = m_style_list[i]; - if (current_style.start_index >= start_index) { - current_style.start_index -= start_index; - current_style.old_index = current_style.start_index - 1; - current_style.end_index -= start_index; - current_style.index_dirty = true; - current_style.text_dirty = true; - current_style.index_dirty = true; - to_return->m_style_list.append(TextStyleLine(current_style, current_style.start_index, - current_style.end_index)); - m_style_list.remove(i); - i--; - } - } - to_return->m_text_line = m_text_line.mid(start_index, m_text_line.size() - start_index); - m_text_line.remove(start_index, m_text_line.size() - start_index); - return to_return; -} - -Block *Block::takeLine(int line) -{ - if (line >= lineCount()) - return nullptr; - m_changed = true; - Block *to_return = new Block(m_screen); - int start_index = line * m_width; - int end_index = start_index + (m_width - 1); - for (int i = 0; i < m_style_list.size(); i++) { - ensureStyleAlignWithLines(i); - TextStyleLine ¤t_style = m_style_list[i]; - if (current_style.start_index >= start_index && current_style.end_index <= end_index) { - current_style.releaseTextSegment(m_screen); - current_style.start_index -= start_index; - current_style.end_index -= start_index; - current_style.index_dirty = true; - to_return->m_style_list.append(TextStyleLine(current_style, current_style.start_index, - current_style.end_index)); - m_style_list.remove(i); - i--; - } else if (current_style.start_index > end_index) { - current_style.start_index -= (end_index + 1) - start_index; - current_style.end_index -= (end_index + 1) - start_index; - current_style.index_dirty = true; - current_style.text_dirty = true; - } - } - to_return->m_text_line = m_text_line.mid(start_index, m_width); - m_text_line.remove(start_index, m_width); - return to_return; -} - -void Block::removeLine(int line) -{ - if (line >= lineCount()) - return; - - m_changed = true; - int start_index = line * m_width; - int end_index = start_index + (m_width - 1); - for (int i = 0; i < m_style_list.size(); i++) { - ensureStyleAlignWithLines(i); - TextStyleLine ¤t_style = m_style_list[i]; - if (current_style.start_index >= start_index && current_style.end_index <= end_index) { - current_style.releaseTextSegment(m_screen); - m_style_list.remove(i); - i--; - } else if (current_style.start_index > end_index) { - current_style.start_index -= (end_index + 1) - start_index; - current_style.end_index -= (end_index + 1) - start_index; - current_style.index_dirty = true; - current_style.text_dirty = true; - } - } - m_text_line.remove(start_index, m_width); -} - -void Block::moveLinesFromBlock(Block *block, int start_line, int count) -{ - Q_ASSERT(block); - Q_ASSERT(block->lineCount() >= start_line + count); - - int start_char = block->width() * start_line; - int end_char = (block->width() * (start_line + count)) - 1; - - for (int i = 0; i < block->m_style_list.size(); i++) { - TextStyleLine ¤t_style = block->m_style_list[i]; - if (current_style.start_index >= start_char && current_style.end_index <= end_char) { - current_style.start_index += (-start_char + m_text_line.size()); - current_style.end_index += (-start_char + m_text_line.size()); - current_style.releaseTextSegment(m_screen); - m_style_list.append(TextStyleLine(current_style, current_style.start_index, - current_style.end_index)); - block->m_style_list.remove(i); - i--; - } else if (current_style.start_index > end_char) { - current_style.start_index -= (end_char + 1) - start_char; - current_style.end_index -= (end_char + 1) - start_char; - current_style.index_dirty = true; - current_style.text_dirty = true; - } - } - - m_text_line.append(block->m_text_line.mid(start_char, (end_char + 1) - start_char)); - block->m_text_line.remove(start_char, (end_char + 1) - start_char); - m_changed = true; - block->m_changed = true; -} - -void Block::dispatchEvents() -{ - if (!m_changed) { - return; - } - - mergeCompatibleStyles(); - - for (int i = 0; i < m_style_list.size(); i++) { - ensureStyleAlignWithLines(i); - TextStyleLine ¤t_style = m_style_list[i]; - if (current_style.text_segment == 0) { - current_style.text_segment = m_screen->createTextSegment(current_style); - current_style.text_segment->setLine(m_new_line, m_width, &m_text_line); - } else if (m_new_line != m_line) { - current_style.text_segment->setLine(m_new_line, m_width, &m_text_line); - } - - if (current_style.style_dirty) { - current_style.text_segment->setTextStyle(current_style); - current_style.style_dirty = false; - } - - if (current_style.index_dirty || current_style.text_dirty) { - current_style.text_segment->setStringSegment(current_style.start_index, current_style.end_index, current_style.text_dirty); - current_style.index_dirty = false; - current_style.text_dirty = false; - } - - current_style.text_segment->setLatin(m_only_latin); - current_style.text_segment->dispatchEvents(); - } - - m_changed = false; - m_line = m_new_line; - -} - -void Block::releaseTextObjects() -{ - m_changed = true; - for (int i = 0; i < m_style_list.size(); i++) { - TextStyleLine ¤tStyleLine = m_style_list[i]; - currentStyleLine.releaseTextSegment(m_screen); - currentStyleLine.text_dirty = true; - currentStyleLine.style_dirty = true; - } -} - -QVector Block::style_list() -{ - return m_style_list; -} - -void Block::printStyleList() const -{ - QDebug debug = qDebug(); - printStyleList(debug); -} - -void Block::printStyleList(QDebug &debug) const -{ - QString text_line = m_text_line; - debug << " " << m_line << lineCount() << m_text_line.size() << (void *) this << text_line << "\n"; debug << "\t"; - for (int i= 0; i < m_style_list.size(); i++) { - debug << m_style_list.at(i); - } -} - -void Block::printStyleListWidthText() const -{ - QString text_line = m_text_line; - for (int i= 0; i < m_style_list.size(); i++) { - const TextStyleLine ¤tStyle = m_style_list.at(i); - QDebug debug = qDebug(); - debug << m_text_line.mid(currentStyle.start_index, (currentStyle.end_index + 1) - currentStyle.start_index) << currentStyle; - } -} - -void Block::mergeCompatibleStyles() -{ - for (int i = 1; i < m_style_list.size(); i++) { - TextStyleLine ¤t = m_style_list[i]; - if (m_style_list.at(i - 1).isCompatible(current) && - current.start_index % m_width != 0) { - TextStyleLine &prev = m_style_list[i-1]; - prev.end_index = current.end_index; - prev.text_dirty = true; - current.releaseTextSegment(m_screen); - m_style_list.remove(i); - i--; - } - } -} - -void Block::ensureStyleAlignWithLines(int i) -{ - int start_line = m_style_list[i].start_index / m_width; - int end_line = m_style_list[i].end_index / m_width; - if (start_line != end_line) { - int remainder_start_line = ((m_width * (start_line + 1))-1) - m_style_list[i].start_index; - int next_line_end_index = m_style_list[i].end_index; - m_style_list[i].end_index = m_style_list[i].start_index + remainder_start_line; - m_style_list.insert(i + 1, TextStyleLine(m_style_list[i], m_style_list[i].end_index + 1, next_line_end_index)); - } -} diff --git a/yat/backend/block.h b/yat/backend/block.h deleted file mode 100644 index fe18e2a..0000000 --- a/yat/backend/block.h +++ /dev/null @@ -1,100 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 Jørgen Lind -* -* Permission is hereby granted, free of charge, to any person obtaining a copy -* of this software and associated documentation files (the "Software"), to deal -* in the Software without restriction, including without limitation the rights -* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -* copies of the Software, and to permit persons to whom the Software is -* furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included in -* all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -* SOFTWARE. -* -*******************************************************************************/ - -#ifndef BLOCK_H -#define BLOCK_H - -#include - -#include "text_style.h" - -class Text; -class Screen; - -class Block -{ -public: - Block(Screen *screen); - ~Block(); - - Q_INVOKABLE Screen *screen() const; - - void clear(); - void clearToEnd(int from); - void clearCharacters(int from, int to); - void deleteCharacters(int from, int to); - void deleteToEnd(int from); - void deleteLines(int from); - - void replaceAtPos(int i, const QString &text, const TextStyle &style, bool only_latin = true); - void insertAtPos(int i, const QString &text, const TextStyle &style, bool only_latin = true); - - void setIndex(int index); - int index() const { return m_new_line; } - - QString *textLine(); - int textSize() { return m_text_line.size(); } - - int width() const { return m_width; } - void setWidth(int width) { m_changed = true; m_width = width; } - int lineCount() const { return (std::max((m_text_line.size() - 1),0) / m_width) + 1; } - int lineCountAfterModified(int from_char, int text_size, bool replace) { - int new_size = replace ? std::max(from_char + text_size, m_text_line.size()) - : std::max(from_char, m_text_line.size()) + text_size; - return ((new_size - 1) / m_width) + 1; - } - - void setVisible(bool visible); - bool visible() const; - - Block *split(int line); - Block *takeLine(int line); - void removeLine(int line); - - void moveLinesFromBlock(Block *block, int start_line, int count); - - void dispatchEvents(); - void releaseTextObjects(); - - QVector style_list(); - - void printStyleList() const; - void printStyleList(QDebug &debug) const; - void printStyleListWidthText() const; - -private: - void mergeCompatibleStyles(); - void ensureStyleAlignWithLines(int i); - Screen *m_screen; - QString m_text_line; - QVector m_style_list; - int m_line; - int m_new_line; - int m_width; - - bool m_visible; - bool m_changed; - bool m_only_latin; -}; - -#endif // BLOCK_H diff --git a/yat/backend/character_sets.h b/yat/backend/character_sets.h deleted file mode 100644 index 1d7128c..0000000 --- a/yat/backend/character_sets.h +++ /dev/null @@ -1,265 +0,0 @@ -/****************************************************************************** -* Copyright (c) 2013 Jørgen Lind -* -* Permission is hereby granted, free of charge, to any person obtaining a copy -* of this software and associated documentation files (the "Software"), to deal -* in the Software without restriction, including without limitation the rights -* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -* copies of the Software, and to permit persons to whom the Software is -* furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included in -* all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -* SOFTWARE. -* -*******************************************************************************/ - -#include - -static const QChar dec_special_graphics_char_set[] = -{ - /*0x00*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x08*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x10*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x18*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x20*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x28*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x30*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x38*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x40*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x48*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x50*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x58*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0020, - /*0x60*/ 0x25c6,0x2592,0x2409,0x240c,0x240d,0x240a,0x00b0,0x00b1, - /*0x68*/ 0x2424,0x240b,0x2518,0x2510,0x250c,0x2514,0x253c,0x23ba, - /*0x70*/ 0x23bb,0x2500,0x23bc,0x23bd,0x251c,0x2524,0x2534,0x252c, - /*0x78*/ 0x2502,0x2264,0x2265,0x03c0,0x2260,0x00a3,0x00b7,0x0000, -}; - -static const QChar nrc_british_char_set[] = -{ - /*0x00*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x08*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x10*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x18*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x20*/ 0x0000,0x0000,0x0000,0x00a3,0x0000,0x0000,0x0000,0x0000, - /*0x28*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x30*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x38*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x40*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x48*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x50*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x58*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x60*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x68*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x70*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x78*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -}; - -static const QChar nrc_norwegian_danish_char_set[] = -{ - /*0x00*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x08*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x10*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x18*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x20*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x28*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x30*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x38*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x40*/ 0x00c4,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x48*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x50*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x58*/ 0x0000,0x0000,0x0000,0x00c6,0x00d8,0x00c5,0x00dc,0x0000, - /*0x60*/ 0x00e4,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x68*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x70*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x78*/ 0x0000,0x0000,0x0000,0x00e6,0x00f8,0x00e5,0x00fc,0x0000, -}; - -static const QChar nrc_dutch_char_set[] = -{ - /*0x00*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x08*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x10*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x18*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x20*/ 0x0000,0x0000,0x0000,0x00a3,0x0000,0x0000,0x0000,0x0000, - /*0x28*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x30*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x38*/ 0x0000,0x0000,0x00be,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x40*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x48*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x50*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x58*/ 0x0000,0x0000,0x0000,0x0133,0x00bd,0x007c,0x0000,0x0000, - /*0x60*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x68*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x70*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x78*/ 0x0000,0x0000,0x0000,0x00a8,0x0066,0x00bc,0x00b4,0x0000, -}; - -static const QChar nrc_finnish_char_set[] = -{ - /*0x00*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x08*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x10*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x18*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x20*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x28*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x30*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x38*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x40*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x48*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x50*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x58*/ 0x0000,0x0000,0x0000,0x00c4,0x00d6,0x00c5,0x00dc,0x0000, - /*0x60*/ 0x00e9,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x68*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x70*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x78*/ 0x0000,0x0000,0x0000,0x00e4,0x00f6,0x00e5,0x00fc,0x0000, -}; - -static const QChar nrc_french_char_set[] = -{ - /*0x00*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x08*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x10*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x18*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x20*/ 0x0000,0x0000,0x0000,0x00a3,0x0000,0x0000,0x0000,0x0000, - /*0x28*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x30*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x38*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x40*/ 0x00e0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x48*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x50*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x58*/ 0x0000,0x0000,0x0000,0x00b0,0x00e7,0x00a7,0x0000,0x0000, - /*0x60*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x68*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x70*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x78*/ 0x0000,0x0000,0x0000,0x00e9,0x00f9,0x00e8,0x00a8,0x0000, -}; - -static const QChar nrc_french_canadian_char_set[] = -{ - /*0x00*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x08*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x10*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x18*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x20*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x28*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x30*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x38*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x40*/ 0x00e0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x48*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x50*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x58*/ 0x0000,0x0000,0x0000,0x00e2,0x00e7,0x00ea,0x00ee,0x0000, - /*0x60*/ 0x00f4,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x68*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x70*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x78*/ 0x0000,0x0000,0x0000,0x00e9,0x00f9,0x00e8,0x00fb,0x0000, -}; - -static const QChar nrc_german_char_set[] = -{ - /*0x00*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x08*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x10*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x18*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x20*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x28*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x30*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x38*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x40*/ 0x00a7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x48*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x50*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x58*/ 0x0000,0x0000,0x0000,0x00c4,0x00d6,0x00dc,0x0000,0x0000, - /*0x60*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x68*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x70*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x78*/ 0x0000,0x0000,0x0000,0x00e4,0x00f6,0x00fc,0x00df,0x0000, -}; - -static const QChar nrc_italian_char_set[] = -{ - /*0x00*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x08*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x10*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x18*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x20*/ 0x0000,0x0000,0x0000,0x00a3,0x0000,0x0000,0x0000,0x0000, - /*0x28*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x30*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x38*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x40*/ 0x00a7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x48*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x50*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x58*/ 0x0000,0x0000,0x0000,0x00b0,0x00e7,0x00e9,0x0000,0x0000, - /*0x60*/ 0x00f9,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x68*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x70*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x78*/ 0x0000,0x0000,0x0000,0x00e0,0x00f2,0x00e8,0x00ec,0x0000, -}; - -static const QChar nrc_spanish_char_set[] = -{ - /*0x00*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x08*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x10*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x18*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x20*/ 0x0000,0x0000,0x0000,0x00a3,0x0000,0x0000,0x0000,0x0000, - /*0x28*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x30*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x38*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x40*/ 0x00a7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x48*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x50*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x58*/ 0x0000,0x0000,0x0000,0x00a1,0x00d1,0x00bf,0x0000,0x0000, - /*0x60*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x68*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x70*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x78*/ 0x0000,0x0000,0x0000,0x00b0,0x00f1,0x00e7,0x0000,0x0000, -}; - -static const QChar nrc_swedish_char_set[] = -{ - /*0x00*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x08*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x10*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x18*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x20*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x28*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x30*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x38*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x40*/ 0x00c9,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x48*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x50*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x58*/ 0x0000,0x0000,0x0000,0x00c4,0x00d6,0x00c5,0x00dc,0x0000, - /*0x60*/ 0x00e9,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x68*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x70*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x78*/ 0x0000,0x0000,0x0000,0x00e4,0x00f6,0x00e5,0x00fc,0x0000, -}; - -static const QChar nrc_swiss_char_set[] = -{ - /*0x00*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x08*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x10*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x18*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x20*/ 0x0000,0x0000,0x0000,0x00f9,0x0000,0x0000,0x0000,0x0000, - /*0x28*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x30*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x38*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x40*/ 0x00e0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x48*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x50*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x58*/ 0x0000,0x0000,0x0000,0x00e9,0x00e7,0x00ea,0x00ee,0x00e8, - /*0x60*/ 0x00f4,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x68*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x70*/ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - /*0x78*/ 0x0000,0x0000,0x0000,0x00e4,0x00f6,0x00fc,0x00fb,0x0000, -}; - diff --git a/yat/backend/color_palette.cpp b/yat/backend/color_palette.cpp deleted file mode 100644 index a97b9c6..0000000 --- a/yat/backend/color_palette.cpp +++ /dev/null @@ -1,66 +0,0 @@ -#include "color_palette.h" - -#include -ColorPalette::ColorPalette(QObject *parent) - : QObject(parent) - , m_normalColors(numberOfColors) - , m_lightColors(numberOfColors) - , m_intenseColors(numberOfColors) - , m_inverse_default(false) -{ - m_normalColors[0].setRgb(0,0,0); - m_normalColors[1].setRgb(194,54,33); - m_normalColors[2].setRgb(37,188,36); - m_normalColors[3].setRgb(173,173,39); - m_normalColors[4].setRgb(63,84,255); - m_normalColors[5].setRgb(211,56,211); - m_normalColors[6].setRgb(51,187,199); - m_normalColors[7].setRgb(229,229,229); - m_normalColors[8].setRgb(178,178,178); - m_normalColors[9].setRgb(0,0,0); - - m_lightColors[0].setRgb(129,131,131); - m_lightColors[1].setRgb(252,57,31); - m_lightColors[2].setRgb(49,231,34); - m_lightColors[3].setRgb(234,236,35); - m_lightColors[4].setRgb(88,51,255); - m_lightColors[5].setRgb(249,53,248); - m_lightColors[6].setRgb(20,240,240); - m_lightColors[7].setRgb(233,233,233); - m_lightColors[8].setRgb(220,220,220); - m_lightColors[9].setRgb(50,50,50); - -} - -QColor ColorPalette::color(ColorPalette::Color color, bool bold) const -{ - if (m_inverse_default) { - if (color == DefaultForground) - color = DefaultBackground; - else if (color == DefaultBackground) - color = DefaultForground; - } - if (bold) - return m_lightColors.at(color); - - return m_normalColors.at(color); -} - -QColor ColorPalette::normalColor(ColorPalette::Color color) const -{ - return this->color(color, false); -} - -QColor ColorPalette::lightColor(ColorPalette::Color color) const -{ - return this->color(color,true); -} - -void ColorPalette::setInverseDefaultColors(bool inverse) -{ - bool emit_changed = inverse != m_inverse_default; - if (emit_changed) { - m_inverse_default = inverse; - emit changed(); - } -} diff --git a/yat/backend/color_palette.h b/yat/backend/color_palette.h deleted file mode 100644 index bb246e7..0000000 --- a/yat/backend/color_palette.h +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef COLOR_PALETTE_H -#define COLOR_PALETTE_H - -#include - -#include - -class ColorPalette : public QObject -{ -Q_OBJECT -public: - ColorPalette(QObject *parent = 0); - - enum Color { - Black, - Red, - Green, - Yellow, - Blue, - Magenta, - Cyan, - White, - DefaultForground, - DefaultBackground, - numberOfColors - }; - - QColor color(Color color, bool bold) const; - QColor normalColor(Color color) const; - QColor lightColor(Color color) const; - - void setInverseDefaultColors(bool inverse); -signals: - void changed(); -private: - QVector m_normalColors; - QVector m_lightColors; - QVector m_intenseColors; - - bool m_inverse_default; -}; - -#endif // COLOR_PALETTE_H diff --git a/yat/backend/controll_chars.cpp b/yat/backend/controll_chars.cpp deleted file mode 100644 index 4b5c83f..0000000 --- a/yat/backend/controll_chars.cpp +++ /dev/null @@ -1,798 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2013 Jørgen Lind -* -* Permission is hereby granted, free of charge, to any person obtaining a copy -* of this software and associated documentation files (the "Software"), to deal -* in the Software without restriction, including without limitation the rights -* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -* copies of the Software, and to permit persons to whom the Software is -* furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included in all -* copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -* SOFTWARE. -* -*******************************************************************************/ -#include "controll_chars.h" - -namespace C0 { -QDebug operator<<(QDebug debug, C0 character) { - bool insert_space = debug.autoInsertSpaces(); - debug.setAutoInsertSpaces(false); - debug << "C0::"; - switch (character) { - case NUL: - debug << "NUL"; - break; - case SOH: - debug << "SOH"; - break; - case STX: - debug << "STX"; - break; - case ETX: - debug << "ETX"; - break; - case EOT: - debug << "EOT"; - break; - case ENQ: - debug << "ENQ"; - break; - case ACK: - debug << "ACK"; - break; - case BEL: - debug << "BEL"; - break; - case BS: - debug << "BS"; - break; - case HT: - debug << "HT"; - break; - case LF: - debug << "LF"; - break; - case VT: - debug << "VT"; - break; - case FF: - debug << "FF"; - break; - case CR: - debug << "CR"; - break; - case SOorLS1: - debug << "SOorLS1"; - break; - case SIorLS0: - debug << "SIorLS0"; - break; - case DLE: - debug << "DLE"; - break; - case DC1: - debug << "DC1"; - break; - case DC2: - debug << "DC2"; - break; - case DC3: - debug << "DC3"; - break; - case DC4: - debug << "DC4"; - break; - case NAK: - debug << "NAK"; - break; - case SYN: - debug << "SYN"; - break; - case ETB: - debug << "ETB"; - break; - case CAN: - debug << "CAN"; - break; - case EM: - debug << "EM"; - break; - case SUB: - debug << "SUB"; - break; - case ESC: - debug << "ESC"; - break; - case IS4: - debug << "IS4"; - break; - case IS3: - debug << "IS3"; - break; - case IS2: - debug << "IS2"; - break; - case IS1: - debug << "IS1"; - break; - case C0_END: - debug << "C0_END"; - break; - default: - debug << qPrintable(QString("0x%1").arg(character,0,16)); - break; - } - debug.setAutoInsertSpaces(insert_space); - return debug; -} -} - -namespace C1_7bit { -QDebug operator<<(QDebug debug, C1_7bit character) { - bool insert_space = debug.autoInsertSpaces(); - debug.setAutoInsertSpaces(false); - debug << "C1_7bit::"; - switch(character) { - case ESC: - debug << "ESC"; - break; - case SCS_G0: - debug << "SCS_G0"; - break; - case SCS_G1: - debug << "SCS_G1"; - break; - case SCS_G2: - debug << "SCS_G2"; - break; - case SCS_G3: - debug << "SCS_G3"; - break; - case DECSC: - debug << "DECSC"; - break; - case DECRC: - debug << "DECRC"; - break; - case NOT_DEFINED: - debug << "NOT_DEFINED"; - break; - case NOT_DEFINED1: - debug << "NOT_DEFINED1"; - break; - case BPH: - debug << "BPH"; - break; - case NBH: - debug << "NBH"; - break; - case IND: - debug << "IND"; - break; - case NEL: - debug << "NEL"; - break; - case SSA: - debug << "SSA"; - break; - case ESA: - debug << "ESA"; - break; - case HTS: - debug << "HTS"; - break; - case HTJ: - debug << "HTJ"; - break; - case VTS: - debug << "VTS"; - break; - case PLD: - debug << "PLD"; - break; - case PLU: - debug << "PLU"; - break; - case RI : - debug << "RI "; - break; - case SS2: - debug << "SS2"; - break; - case SS3: - debug << "SS3"; - break; - case DCS: - debug << "DCS"; - break; - case PU1: - debug << "PU1"; - break; - case PU2: - debug << "PU2"; - break; - case STS: - debug << "STS"; - break; - case CCH: - debug << "CCH"; - break; - case MW : - debug << "MW "; - break; - case SPA: - debug << "SPA"; - break; - case EPA: - debug << "EPA"; - break; - case SOS: - debug << "SOS"; - break; - case NOT_DEFINED3: - debug << "NOT_DEFINED3"; - break; - case SCI: - debug << "SCI"; - break; - case CSI: - debug << "CSI"; - break; - case ST : - debug << "ST "; - break; - case OSC: - debug << "OSC"; - break; - case PM : - debug << "PM "; - break; - case APC: - debug << "APC"; - break; - case C1_7bit_Stop: - debug << "C1_7bit_Stop"; - break; - default: - debug << qPrintable(QString("0x%1").arg(character,0,16)); - break; - } - debug.setAutoInsertSpaces(insert_space); - return debug; -} -} - -namespace C1_8bit { -QDebug operator<<(QDebug debug, C1_8bit character) { - bool insert_space = debug.autoInsertSpaces(); - debug.setAutoInsertSpaces(false); - debug << "C1_8bit::"; - switch(character) { - case NOT_DEFINED: - debug << "NOT_DEFINED"; - break; - case NOT_DEFINED1: - debug << "NOT_DEFINED1"; - break; - case BPH: - debug << "BPH"; - break; - case NBH: - debug << "NBH"; - break; - case NOT_DEFINED2: - debug << "NOT_DEFINED2"; - break; - case NEL: - debug << "NEL"; - break; - case SSA: - debug << "SSA"; - break; - case ESA: - debug << "ESA"; - break; - case HTS: - debug << "HTS"; - break; - case HTJ: - debug << "HTJ"; - break; - case VTS: - debug << "VTS"; - break; - case PLD: - debug << "PLD"; - break; - case PLU: - debug << "PLU"; - break; - case RI : - debug << "RI "; - break; - case SS2: - debug << "SS2"; - break; - case SS3: - debug << "SS3"; - break; - case DCS: - debug << "DCS"; - break; - case PU1: - debug << "PU1"; - break; - case PU2C1_7bit: - debug << "PU2C1_7bit"; - break; - case STS: - debug << "STS"; - break; - case CCH: - debug << "CCH"; - break; - case MW : - debug << "MW "; - break; - case SPA: - debug << "SPA"; - break; - case EPA: - debug << "EPA"; - break; - case SOS: - debug << "SOS"; - break; - case NOT_DEFINED3: - debug << "NOT_DEFINED3"; - break; - case SCI: - debug << "SCI"; - break; - case CSI: - debug << "CSI"; - break; - case ST : - debug << "ST "; - break; - case OSC: - debug << "OSC"; - break; - case PM : - debug << "PM "; - break; - case APC: - debug << "APC"; - break; - case C1_8bit_Stop: - debug << "C1_8bit_Stop"; - break; - default: - debug << qPrintable(QString("0x%1").arg(character,0,16)); - break; - } - debug.setAutoInsertSpaces(insert_space); - return debug; -} -} -namespace FinalBytesNoIntermediate { -QDebug operator<<(QDebug debug, FinalBytesNoIntermediate character) { - bool insert_space = debug.autoInsertSpaces(); - debug.setAutoInsertSpaces(false); - debug << "FinalBytesNoIntermediate::"; - switch(character) { - case ICH: - debug << "ICH"; - break; - case CUU: - debug << "CUU"; - break; - case CUD: - debug << "CUD"; - break; - case CUF: - debug << "CUF"; - break; - case CUB: - debug << "CUB"; - break; - case CNL: - debug << "CNL"; - break; - case CPL: - debug << "CPL"; - break; - case CHA: - debug << "CHA"; - break; - case CUP: - debug << "CUP"; - break; - case CHT: - debug << "CHT"; - break; - case ED: - debug << "ED"; - break; - case EL: - debug << "EL"; - break; - case IL: - debug << "IL"; - break; - case DL: - debug << "DL"; - break; - case EF: - debug << "EF"; - break; - case EA: - debug << "EA"; - break; - case DCH: - debug << "DCH"; - break; - case SSE: - debug << "SSE"; - break; - case CPR: - debug << "CPR"; - break; - case SU: - debug << "SU"; - break; - case SD: - debug << "SD"; - break; - case NP: - debug << "NP"; - break; - case PP: - debug << "PP"; - break; - case CTC: - debug << "CTC"; - break; - case ECH: - debug << "ECH"; - break; - case CVT: - debug << "CVT"; - break; - case CBT: - debug << "CBT"; - break; - case SRS: - debug << "SRS"; - break; - case PTX: - debug << "PTX"; - break; - case SDS: - debug << "SDS"; - break; - case SIMD: - debug << "SIMD"; - break; - case NOT_DEFINED: - debug << "NOT_DEFINED"; - break; - case HPA: - debug << "HPA"; - break; - case HPR: - debug << "HPR"; - break; - case REP: - debug << "REP"; - break; - case DA: - debug << "DA"; - break; - case VPA: - debug << "VPA"; - break; - case VPR: - debug << "VPR"; - break; - case HVP: - debug << "HVP"; - break; - case TBC: - debug << "TBC"; - break; - case SM: - debug << "SM"; - break; - case MC: - debug << "MC"; - break; - case HPB: - debug << "HPB"; - break; - case VPB: - debug << "VPB"; - break; - case RM: - debug << "RM"; - break; - case SGR: - debug << "SGR"; - break; - case DSR: - debug << "DSR"; - break; - case DAQ: - debug << "DAQ"; - break; - case Reserved0: - debug << "Reserved0"; - break; - case Reserved1: - debug << "Reserved1"; - break; - case DECSTBM: - debug << "DECSTBM"; - break; - case Reserved3: - debug << "Reserved3"; - break; - case Reserved4: - debug << "Reserved4"; - break; - case Reserved5: - debug << "Reserved5"; - break; - case Reserved6: - debug << "Reserved6"; - break; - case Reserved7: - debug << "Reserved7"; - break; - case Reserved8: - debug << "Reserved8"; - break; - case Reserved9: - debug << "Reserved9"; - break; - case Reserveda: - debug << "Reserveda"; - break; - case Reservedb: - debug << "Reservedb"; - break; - case Reservedc: - debug << "Reservedc"; - break; - case Reservedd: - debug << "Reservedd"; - break; - case Reservede: - debug << "Reservede"; - break; - case Reservedf: - debug << "Reservedf"; - break; - default: - debug << qPrintable(QString("0x%1").arg(character,0,16)); - break; - } - debug.setAutoInsertSpaces(insert_space); - return debug; -} -} - -namespace FinalBytesSingleIntermediate { -QDebug operator<<(QDebug debug, FinalBytesSingleIntermediate character) -{ - bool insert_space = debug.autoInsertSpaces(); - debug.setAutoInsertSpaces(false); - debug << "FinalBytesSingleIntermediate::"; - switch(character) { - case SL: - debug << "SL"; - break; - case SR: - debug << "SR"; - break; - case GSM: - debug << "GSM"; - break; - case GSS: - debug << "GSS"; - break; - case FNT: - debug << "FNT"; - break; - case TSS: - debug << "TSS"; - break; - case JFY: - debug << "JFY"; - break; - case SPI: - debug << "SPI"; - break; - case QUAD: - debug << "QUAD"; - break; - case SSU: - debug << "SSU"; - break; - case PFS: - debug << "PFS"; - break; - case SHS: - debug << "SHS"; - break; - case SVS: - debug << "SVS"; - break; - case IGS: - debug << "IGS"; - break; - case NOT_DEFINED: - debug << "NOT_DEFINED"; - break; - case IDCS: - debug << "IDCS"; - break; - case PPA: - debug << "PPA"; - break; - case PPR: - debug << "PPR"; - break; - case PPB: - debug << "PPB"; - break; - case SPD: - debug << "SPD"; - break; - case DTA: - debug << "DTA"; - break; - case SHL: - debug << "SHL"; - break; - case SLL: - debug << "SLL"; - break; - case FNK: - debug << "FNK"; - break; - case SPQR: - debug << "SPQR"; - break; - case SEF: - debug << "SEF"; - break; - case PEC: - debug << "PEC"; - break; - case SSW: - debug << "SSW"; - break; - case SACS: - debug << "SACS"; - break; - case SAPV: - debug << "SAPV"; - break; - case STAB: - debug << "STAB"; - break; - case GCC: - debug << "GCC"; - break; - case TATE: - debug << "TATE"; - break; - case TALE: - debug << "TALE"; - break; - case TAC: - debug << "TAC"; - break; - case TCC: - debug << "TCC"; - break; - case TSR: - debug << "TSR"; - break; - case SCO: - debug << "SCO"; - break; - case SRCS: - debug << "SRCS"; - break; - case SCS: - debug << "SCS"; - break; - case SLS: - debug << "SLS"; - break; - case NOT_DEFINED2: - debug << "NOT_DEFINED2"; - break; - case NOT_DEFINED3: - debug << "NOT_DEFINED3"; - break; - case SCP: - debug << "SCP"; - break; - case NOT_DEFINED4: - debug << "NOT_DEFINED4"; - break; - case NOT_DEFINED5: - debug << "NOT_DEFINED5"; - break; - case NOT_DEFINED6: - debug << "NOT_DEFINED6"; - break; - case NOT_DEFINED7: - debug << "NOT_DEFINED7"; - break; - case Reserved0: - debug << "Reserved0"; - break; - case Reserved1: - debug << "Reserved1"; - break; - case Reserved2: - debug << "Reserved2"; - break; - case Reserved3: - debug << "Reserved3"; - break; - case Reserved4: - debug << "Reserved4"; - break; - case Reserved5: - debug << "Reserved5"; - break; - case Reserved6: - debug << "Reserved6"; - break; - case Reserved7: - debug << "Reserved7"; - break; - case Reserved8: - debug << "Reserved8"; - break; - case Reserved9: - debug << "Reserved9"; - break; - case Reserveda: - debug << "Reserveda"; - break; - case Reservedb: - debug << "Reservedb"; - break; - case Reservedc: - debug << "Reservedc"; - break; - case Reservedd: - debug << "Reservedd"; - break; - case Reservedf: - debug << "Reservedf"; - break; - default: - debug << qPrintable(QString("0x%1").arg(character,0,16)); - break; - } - debug.setAutoInsertSpaces(insert_space); - return debug; -} -} - diff --git a/yat/backend/controll_chars.h b/yat/backend/controll_chars.h deleted file mode 100644 index 3098583..0000000 --- a/yat/backend/controll_chars.h +++ /dev/null @@ -1,299 +0,0 @@ -/****************************************************************************** -* Copyright (c) 2012 Jørgen Lind -* -* Permission is hereby granted, free of charge, to any person obtaining a copy -* of this software and associated documentation files (the "Software"), to deal -* in the Software without restriction, including without limitation the rights -* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -* copies of the Software, and to permit persons to whom the Software is -* furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included in -* all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -* SOFTWARE. -* -*******************************************************************************/ - -#ifndef CONTROLL_CHARS_H -#define CONTROLL_CHARS_H - -//This is taken largely from Standard ECMA-48 -//http://www.ecma-international.org/publications/standards/Ecma-048.htm -//Also to heres a few handy references -//http://invisible-island.net/xterm/ctlseqs/ctlseqs.html -//http://www.vt100.net/docs/vt100-ug/chapter3.html - -#include - -namespace C0 { -enum C0 { - NUL = 0x00, - SOH = 0x01, - STX = 0x02, - ETX = 0x03, - EOT = 0x04, - ENQ = 0x05, - ACK = 0x06, - BEL = 0x07, - BS = 0x08, - HT = 0x09, - LF = 0x0a, - VT = 0x0b, - FF = 0x0c, - CR = 0x0d, - SOorLS1 = 0x0e, - SIorLS0 = 0x0f, - DLE = 0x10, - DC1 = 0x11, - DC2 = 0x12, - DC3 = 0x13, - DC4 = 0x14, - NAK = 0x15, - SYN = 0x16, - ETB = 0x17, - CAN = 0x18, - EM = 0x19, - SUB = 0x1a, - ESC = 0x1b, - IS4 = 0x1c, - IS3 = 0x1d, - IS2 = 0x1e, - IS1 = 0x1f, - C0_END = 0x20 -}; -QDebug operator<<(QDebug debug, C0 character); -} - -namespace C1_7bit { -enum C1_7bit { - C1_7bit_Start = 0x1b, - ESC = 0x1b, - SCS_G0 = 0x28, - SCS_G1 = 0x29, - SCS_G2 = 0x2a, - SCS_G3 = 0x2b, - DECSC = 0x37, - DECRC = 0x38, - NOT_DEFINED = 0x40, - NOT_DEFINED1 = 0x41, - BPH = 0x42, - NBH = 0x43, - IND = 0x44, - NEL = 0x45, - SSA = 0x46, - ESA = 0x47, - HTS = 0x48, - HTJ = 0x49, - VTS = 0x4a, - PLD = 0x4b, - PLU = 0x4c, - RI = 0x4d, - SS2 = 0x4e, - SS3 = 0x4f, - DCS = 0x50, - PU1 = 0x51, - PU2 = 0x52, - STS = 0x53, - CCH = 0x54, - MW = 0x55, - SPA = 0x56, - EPA = 0x57, - SOS = 0x58, - NOT_DEFINED3 = 0x59, - SCI = 0x5a, - CSI = 0x5b, - ST = 0x5c, - OSC = 0x5d, - PM = 0x5e, - APC = 0x5f, - C1_7bit_Stop = 0x60 -}; -QDebug operator<<(QDebug debug, C1_7bit character); -} -namespace C1_8bit { -enum C1_8bit { - C1_8bit_Start = 0x80, - NOT_DEFINED = C1_8bit_Start, - NOT_DEFINED1 = 0x81, - BPH = 0x82, - NBH = 0x83, - NOT_DEFINED2 = 0x84, - NEL = 0x85, - SSA = 0x86, - ESA = 0x87, - HTS = 0x88, - HTJ = 0x89, - VTS = 0x8a, - PLD = 0x8b, - PLU = 0x8c, - RI = 0x8d, - SS2 = 0x8e, - SS3 = 0x8f, - DCS = 0x90, - PU1 = 0x91, - PU2C1_7bit = 0x92, - STS = 0x93, - CCH = 0x94, - MW = 0x95, - SPA = 0x96, - EPA = 0x97, - SOS = 0x98, - NOT_DEFINED3 = 0x99, - SCI = 0x9a, - CSI = 0x9b, - ST = 0x9c, - OSC = 0x9d, - PM = 0x9e, - APC = 0x9f, - C1_8bit_Stop = 0xa0 -}; -QDebug operator<<(QDebug debug, C1_8bit character); -} - -namespace FinalBytesNoIntermediate { -enum FinalBytesNoIntermediate { - ICH = 0x40, - CUU = 0x41, - CUD = 0x42, - CUF = 0x43, - CUB = 0x44, - CNL = 0x45, - CPL = 0x46, - CHA = 0x47, - CUP = 0x48, - CHT = 0x49, - ED = 0x4a, - EL = 0x4b, - IL = 0x4c, - DL = 0x4d, - EF = 0x4e, - EA = 0x4f, - DCH = 0x50, - SSE = 0x51, - CPR = 0x52, - SU = 0x53, - SD = 0x54, - NP = 0x55, - PP = 0x56, - CTC = 0x57, - ECH = 0x58, - CVT = 0x59, - CBT = 0x5a, - SRS = 0x5b, - PTX = 0x5c, - SDS = 0x5d, - SIMD = 0x5e, - NOT_DEFINED = 0x5f, - HPA = 0x60, - HPR = 0x61, - REP = 0x62, - DA = 0x63, - VPA = 0x64, - VPR = 0x65, - HVP = 0x66, - TBC = 0x67, - SM = 0x68, - MC = 0x69, - HPB = 0x6a, - VPB = 0x6b, - RM = 0x6c, - SGR = 0x6d, - DSR = 0x6e, - DAQ = 0x6f, - Reserved0 = 0x70, - Reserved1 = 0x71, - DECSTBM = 0x72, - Reserved3 = 0x73, - Reserved4 = 0x74, - Reserved5 = 0x75, - Reserved6 = 0x76, - Reserved7 = 0x77, - Reserved8 = 0x78, - Reserved9 = 0x79, - Reserveda = 0x7a, - Reservedb = 0x7b, - Reservedc = 0x7c, - Reservedd = 0x7d, - Reservede = 0x7e, - Reservedf = 0x7f -}; -QDebug operator<<(QDebug debug, FinalBytesNoIntermediate character); -} - -namespace FinalBytesSingleIntermediate { -enum FinalBytesSingleIntermediate { - SL = 0x40, - SR = 0x41, - GSM = 0x42, - GSS = 0x43, - FNT = 0x44, - TSS = 0x45, - JFY = 0x46, - SPI = 0x47, - QUAD = 0x48, - SSU = 0x49, - PFS = 0x4a, - SHS = 0x4b, - SVS = 0x4c, - IGS = 0x4d, - NOT_DEFINED = 0x4e, - IDCS = 0x4f, - PPA = 0x50, - PPR = 0x51, - PPB = 0x52, - SPD = 0x53, - DTA = 0x54, - SHL = 0x55, - SLL = 0x56, - FNK = 0x57, - SPQR = 0x58, - SEF = 0x59, - PEC = 0x5a, - SSW = 0x5b, - SACS = 0x5c, - SAPV = 0x5d, - STAB = 0x5e, - GCC = 0x5f, - TATE = 0x60, - TALE = 0x61, - TAC = 0x62, - TCC = 0x63, - TSR = 0x64, - SCO = 0x65, - SRCS = 0x66, - SCS = 0x67, - SLS = 0x68, - NOT_DEFINED2 = 0x69, - NOT_DEFINED3 = 0x6a, - SCP = 0x6b, - NOT_DEFINED4 = 0x6c, - NOT_DEFINED5 = 0x6d, - NOT_DEFINED6 = 0x6e, - NOT_DEFINED7 = 0x6f, - Reserved0 = 0x70, - Reserved1 = 0x71, - Reserved2 = 0x72, - Reserved3 = 0x73, - Reserved4 = 0x74, - Reserved5 = 0x75, - Reserved6 = 0x76, - Reserved7 = 0x77, - Reserved8 = 0x78, - Reserved9 = 0x79, - Reserveda = 0x7a, - Reservedb = 0x7b, - Reservedc = 0x7c, - Reservedd = 0x7d, - Reservedf = 0x7f -}; -QDebug operator<<(QDebug debug, FinalBytesSingleIntermediate character); -} - -#endif // CONTROLL_CHARS_H diff --git a/yat/backend/cursor.cpp b/yat/backend/cursor.cpp deleted file mode 100644 index 5d7e062..0000000 --- a/yat/backend/cursor.cpp +++ /dev/null @@ -1,541 +0,0 @@ -/****************************************************************************** -* Copyright (c) 2013 Jørgen Lind -* -* Permission is hereby granted, free of charge, to any person obtaining a copy -* of this software and associated documentation files (the "Software"), to deal -* in the Software without restriction, including without limitation the rights -* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -* copies of the Software, and to permit persons to whom the Software is -* furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included in all -* copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -* SOFTWARE. -* -*******************************************************************************/ - -#include "cursor.h" - -#include "block.h" -#include "screen_data.h" - -#include - -Cursor::Cursor(Screen* screen) - : QObject(screen) - , m_screen(screen) - , m_current_text_style(screen->defaultTextStyle()) - , m_position(0,0) - , m_new_position(0,0) - , m_document_width(screen->width()) - , m_document_height(screen->height()) - , m_top_margin(0) - , m_bottom_margin(0) - , m_scroll_margins_set(false) - , m_origin_at_margin(false) - , m_notified(false) - , m_visible(true) - , m_new_visibillity(true) - , m_blinking(false) - , m_new_blinking(false) - , m_wrap_around(true) - , m_content_height_changed(false) - , m_insert_mode(Replace) -{ - connect(screen, SIGNAL(widthAboutToChange(int)), this, SLOT(setDocumentWidth(int))); - connect(screen, SIGNAL(heightAboutToChange(int, int, int)), this, SLOT(setDocumentHeight(int, int, int))); - connect(screen, SIGNAL(contentHeightChanged()), this, SLOT(contentHeightChanged())); - - m_gl_text_codec = QTextCodec::codecForName("utf-8")->makeDecoder(); - m_gr_text_codec = QTextCodec::codecForName("utf-8")->makeDecoder(); - - for (int i = 0; i < m_document_width; i++) { - if (i % 8 == 0) { - m_tab_stops.append(i); - } - } -} - -Cursor::~Cursor() -{ - -} - -void Cursor::setDocumentWidth(int width) -{ - if (width > m_document_width) { - for (int i = m_document_width -1; i < width; i++) { - if (i % 8 == 0) { - m_tab_stops.append(i); - } - } - } - - m_document_width = width; - if (new_x() >= width) { - new_rx() = width - 1; - notifyChanged(); - } -} - -void Cursor::setDocumentHeight(int height, int currentCursorBlock, int currentScrollBackHeight) -{ - Q_UNUSED(currentCursorBlock); - resetScrollArea(); - if (m_document_height > height) { - const int to_remove = m_document_height - height; - const int removeLinesBelowCursor = - std::min(m_document_height - new_y(), to_remove); - const int removeLinesAtTop = to_remove - removeLinesBelowCursor; - if (!removeLinesAtTop) { - new_ry() -= removeLinesAtTop; - notifyChanged(); - } - } else { - int height_diff = height - m_document_height; - if (currentScrollBackHeight >= height_diff) { - new_ry() += height_diff; - } else if (currentScrollBackHeight > 0) { - const int move = height_diff - currentScrollBackHeight; - new_ry() += move; - } - } - - m_document_height = height; - - if (new_y() >= height) { - new_ry() = height - 1; - notifyChanged(); - } - if (new_y() <= 0) { - new_ry() = 0; - } -} - -bool Cursor::visible() const -{ - return m_visible; -} -void Cursor::setVisible(bool visible) -{ - m_new_visibillity = visible; -} - -bool Cursor::blinking() const -{ - return m_blinking; -} - -void Cursor::setBlinking(bool blinking) -{ - m_new_blinking = blinking; -} - -void Cursor::setTextStyle(TextStyle::Style style, bool add) -{ - if (add) { - m_current_text_style.style |= style; - } else { - m_current_text_style.style &= !style; - } -} - -void Cursor::resetStyle() -{ - m_current_text_style.background = ColorPalette::DefaultBackground; - m_current_text_style.forground = ColorPalette::DefaultForground; - m_current_text_style.style = TextStyle::Normal; -} - -void Cursor::scrollUp(int lines) -{ - if (new_y() < top() || new_y() > bottom()) - return; - for (int i = 0; i < lines; i++) { - screen_data()->moveLine(bottom(), top()); - } -} - -void Cursor::scrollDown(int lines) -{ - if (new_y() < top() || new_y() > bottom()) - return; - for (int i = 0; i < lines; i++) { - screen_data()->moveLine(top(), bottom()); - } -} - -void Cursor::setTextCodec(QTextCodec *codec) -{ - m_gl_text_codec = codec->makeDecoder(); -} - -void Cursor::setInsertMode(InsertMode mode) -{ - m_insert_mode = mode; -} - -TextStyle Cursor::currentTextStyle() const -{ - return m_current_text_style; -} - -void Cursor::setTextStyleColor(ushort color) -{ - Q_ASSERT(color >= 30 && color < 50); - if (color < 38) { - m_current_text_style.forground = ColorPalette::Color(color - 30); - } else if (color == 39) { - m_current_text_style.forground = ColorPalette::DefaultForground; - } else if (color >= 40 && color < 48) { - m_current_text_style.background = ColorPalette::Color(color - 40); - } else if (color == 49) { - m_current_text_style.background = ColorPalette::DefaultBackground; - } else { - qDebug() << "Failed to set color"; - } -} - -ColorPalette *Cursor::colorPalette() const -{ - return m_screen->colorPalette(); -} - -QPoint Cursor::position() const -{ - return m_position; -} - -int Cursor::x() const -{ - return m_position.x(); -} - -int Cursor::y() const -{ - return (m_screen->currentScreenData()->contentHeight() - m_screen->height()) + m_position.y(); -} - -void Cursor::moveOrigin() -{ - m_new_position = QPoint(0,adjusted_top()); - notifyChanged(); -} - -void Cursor::moveBeginningOfLine() -{ - new_rx() = 0; - notifyChanged(); -} - -void Cursor::moveUp(int lines) -{ - int adjusted_new_y = this->adjusted_new_y(); - if (!adjusted_new_y || !lines) - return; - - if (lines < adjusted_new_y) { - new_ry() -= lines; - } else { - new_ry() = adjusted_top(); - } - notifyChanged(); -} - -void Cursor::moveDown(int lines) -{ - int bottom = adjusted_bottom(); - if (new_y() == bottom || !lines) - return; - - if (new_y() + lines <= bottom) { - new_ry() += lines; - } else { - new_ry() = bottom; - } - notifyChanged(); -} - -void Cursor::moveLeft(int positions) -{ - if (!new_x() || !positions) - return; - if (positions < new_x()) { - new_rx() -= positions; - } else { - new_rx() = 0; - } - notifyChanged(); -} - -void Cursor::moveRight(int positions) -{ - int width = m_screen->width(); - if (new_x() == width -1 || !positions) - return; - if (positions < width - new_x()) { - new_rx() += positions; - } else { - new_rx() = width -1; - } - - notifyChanged(); -} - -void Cursor::move(int new_x, int new_y) -{ - int width = m_screen->width(); - - if (m_origin_at_margin) { - new_y += m_top_margin; - } - - if (new_x < 0) { - new_x = 0; - } else if (new_x >= width) { - new_x = width - 1; - } - - if (new_y < adjusted_top()) { - new_y = adjusted_top(); - } else if (new_y > adjusted_bottom()) { - new_y = adjusted_bottom(); - } - - if (this->new_y() != new_y || this->new_x() != new_x) { - m_new_position = QPoint(new_x, new_y); - notifyChanged(); - } -} - -void Cursor::moveToLine(int line) -{ - const int height = m_screen->height(); - if (line < adjusted_top()) { - line = 0; - } else if (line > adjusted_bottom()) { - line = height -1; - } - - if (line != new_y()) { - new_rx() = line; - notifyChanged(); - } -} - -void Cursor::moveToCharacter(int character) -{ - const int width = m_screen->width(); - if (character < 0) { - character = 1; - } else if (character > width) { - character = width; - } - if (character != new_x()) { - new_rx() = character; - notifyChanged(); - } -} - -void Cursor::moveToNextTab() -{ - for (int i = 0; i < m_tab_stops.size(); i++) { - if (new_x() < m_tab_stops.at(i)) { - moveToCharacter(std::min(m_tab_stops.at(i), m_document_width -1)); - return; - } - } - moveToCharacter(m_document_width - 1); -} - -void Cursor::setTabStop() -{ - int i; - for (i = 0; i < m_tab_stops.size(); i++) { - if (new_x() == m_tab_stops.at(i)) - return; - if (new_x() > m_tab_stops.at(i)) { - continue; - } else { - break; - } - } - m_tab_stops.insert(i,new_x()); -} - -void Cursor::removeTabStop() -{ - for (int i = 0; i < m_tab_stops.size(); i++) { - if (new_x() == m_tab_stops.at(i)) { - m_tab_stops.remove(i); - return; - } else if (new_x() < m_tab_stops.at(i)) { - return; - } - } -} - -void Cursor::clearTabStops() -{ - m_tab_stops.clear(); -} - -void Cursor::clearToBeginningOfLine() -{ - screen_data()->clearToBeginningOfLine(m_new_position); -} - -void Cursor::clearToEndOfLine() -{ - screen_data()->clearToEndOfLine(m_new_position); -} - -void Cursor::clearToBeginningOfScreen() -{ - clearToBeginningOfLine(); - if (new_y() > 0) - screen_data()->clearToBeginningOfScreen(m_new_position.y()-1); -} - -void Cursor::clearToEndOfScreen() -{ - clearToEndOfLine(); - if (new_y() < m_screen->height() -1) { - screen_data()->clearToEndOfScreen(m_new_position.y()+1); - } -} - -void Cursor::clearLine() -{ - screen_data()->clearLine(m_new_position); -} - -void Cursor::deleteCharacters(int characters) -{ - screen_data()->deleteCharacters(m_new_position, new_x() + characters -1); -} - -void Cursor::setWrapAround(bool wrap) -{ - m_wrap_around = wrap; -} - -void Cursor::addAtCursor(const QByteArray &data, bool only_latin) -{ - if (m_insert_mode == Replace) { - replaceAtCursor(data, only_latin); - } else { - insertAtCursor(data, only_latin); - } -} - -void Cursor::replaceAtCursor(const QByteArray &data, bool only_latin) -{ - const QString text = m_gl_text_codec->toUnicode(data); - - if (!m_wrap_around && new_x() + text.size() > m_screen->width()) { - const int size = m_document_width - new_x(); - QString toBlock = text.mid(0,size); - toBlock.replace(toBlock.size() - 1, 1, text.at(text.size()-1)); - screen_data()->replace(m_new_position, toBlock, m_current_text_style, only_latin); - new_rx() += toBlock.size(); - } else { - auto diff = screen_data()->replace(m_new_position, text, m_current_text_style, only_latin); - new_rx() += diff.character; - new_ry() += diff.line; - } - - if (new_y() >= m_document_height) - new_ry() = m_document_height - 1; - - notifyChanged(); -} - -void Cursor::insertAtCursor(const QByteArray &data, bool only_latin) -{ - const QString text = m_gl_text_codec->toUnicode(data); - auto diff = screen_data()->insert(m_new_position, text, m_current_text_style, only_latin); - new_rx() += diff.character; - new_ry() += diff.line; - if (new_y() >= m_document_height) - new_ry() = m_document_height - 1; - if (new_x() >= m_document_width) - new_rx() = m_document_width - 1; -} - -void Cursor::lineFeed() -{ - if(new_y() >= bottom()) { - screen_data()->insertLine(bottom(), top()); - } else { - new_ry()++; - notifyChanged(); - } -} - -void Cursor::reverseLineFeed() -{ - if (new_y() == top()) { - scrollUp(1); - } else { - new_ry()--; - notifyChanged(); - } -} - -void Cursor::setOriginAtMargin(bool atMargin) -{ - m_origin_at_margin = atMargin; - m_new_position = QPoint(0, adjusted_top()); - notifyChanged(); -} - -void Cursor::setScrollArea(int from, int to) -{ - m_top_margin = from; - m_bottom_margin = std::min(to,m_document_height -1); - m_scroll_margins_set = true; -} - -void Cursor::resetScrollArea() -{ - m_top_margin = 0; - m_bottom_margin = 0; - m_scroll_margins_set = false; -} - -void Cursor::dispatchEvents() -{ - if (m_new_position != m_position|| m_content_height_changed) { - bool emit_x_changed = m_new_position.x() != m_position.x(); - bool emit_y_changed = m_new_position.y() != m_position.y(); - m_position = m_new_position; - if (emit_x_changed) - emit xChanged(); - if (emit_y_changed || m_content_height_changed) - emit yChanged(); - } - - if (m_new_visibillity != m_visible) { - m_visible = m_new_visibillity; - emit visibilityChanged(); - } - - if (m_new_blinking != m_blinking) { - m_blinking = m_new_blinking; - emit blinkingChanged(); - } -} - -void Cursor::contentHeightChanged() -{ - m_content_height_changed = true; -} - diff --git a/yat/backend/cursor.h b/yat/backend/cursor.h deleted file mode 100644 index 95723fc..0000000 --- a/yat/backend/cursor.h +++ /dev/null @@ -1,175 +0,0 @@ -/****************************************************************************** -* Copyright (c) 2013 Jørgen Lind -* -* Permission is hereby granted, free of charge, to any person obtaining a copy -* of this software and associated documentation files (the "Software"), to deal -* in the Software without restriction, including without limitation the rights -* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -* copies of the Software, and to permit persons to whom the Software is -* furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included in all -* copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -* SOFTWARE. -* -*******************************************************************************/ - -#ifndef CURSOR_H -#define CURSOR_H - -#include "text_style.h" -#include "screen.h" - -#include - -class Cursor : public QObject -{ - Q_OBJECT - - Q_PROPERTY(bool visible READ visible WRITE setVisible NOTIFY visibilityChanged) - Q_PROPERTY(bool blinking READ blinking WRITE setBlinking NOTIFY blinkingChanged) - Q_PROPERTY(int x READ x NOTIFY xChanged) - Q_PROPERTY(int y READ y NOTIFY yChanged) -public: - enum InsertMode { - Insert, - Replace - }; - - Cursor(Screen *screen); - ~Cursor(); - - bool visible() const; - void setVisible(bool visible); - - bool blinking() const; - void setBlinking(bool blinking); - - void setTextStyle(TextStyle::Style style, bool add = true); - void resetStyle(); - TextStyle currentTextStyle() const; - - void setTextStyleColor(ushort color); - ColorPalette *colorPalette() const; - - QPoint position() const; - int x() const; - int y() const; - int new_x() const { return m_new_position.x(); } - int new_y() const { return m_new_position.y(); } - - void moveOrigin(); - void moveBeginningOfLine(); - void moveUp(int lines = 1); - void moveDown(int lines = 1); - void moveLeft(int positions = 1); - void moveRight(int positions = 1); - void move(int new_x, int new_y); - void moveToLine(int line); - void moveToCharacter(int character); - - void moveToNextTab(); - void setTabStop(); - void removeTabStop(); - void clearTabStops(); - - void clearToBeginningOfLine(); - void clearToEndOfLine(); - void clearToBeginningOfScreen(); - void clearToEndOfScreen(); - void clearLine(); - - void deleteCharacters(int characters); - - void setWrapAround(bool wrap); - void addAtCursor(const QByteArray &text, bool only_latin = true); - void insertAtCursor(const QByteArray &text, bool only_latin = true); - void replaceAtCursor(const QByteArray &text, bool only_latin = true); - - void lineFeed(); - void reverseLineFeed(); - - void setOriginAtMargin(bool atMargin); - void setScrollArea(int from, int to); - void resetScrollArea(); - - void scrollUp(int lines); - void scrollDown(int lines); - - void setTextCodec(QTextCodec *codec); - - void setInsertMode(InsertMode mode); - - inline void notifyChanged(); - void dispatchEvents(); - -public slots: - void setDocumentWidth(int width); - void setDocumentHeight(int height, int currentCursorBlock, int currentScrollBackHeight); - -signals: - void xChanged(); - void yChanged(); - void visibilityChanged(); - void blinkingChanged(); - -private slots: - void contentHeightChanged(); - -private: - ScreenData *screen_data() const { return m_screen->currentScreenData(); } - int &new_rx() { return m_new_position.rx(); } - int &new_ry() { return m_new_position.ry(); } - int adjusted_new_x() const { return m_origin_at_margin ? - m_new_position.x() - m_top_margin : m_new_position.x(); } - int adjusted_new_y() const { return m_origin_at_margin ? - m_new_position.y() - m_top_margin : m_new_position.y(); } - int adjusted_top() const { return m_origin_at_margin ? m_top_margin : 0; } - int adjusted_bottom() const { return m_origin_at_margin ? m_bottom_margin : m_document_height - 1; } - int top() const { return m_scroll_margins_set ? m_top_margin : 0; } - int bottom() const { return m_scroll_margins_set ? m_bottom_margin : m_document_height - 1; } - Screen *m_screen; - TextStyle m_current_text_style; - QPoint m_position; - QPoint m_new_position; - - int m_document_width; - int m_document_height; - - int m_top_margin; - int m_bottom_margin; - bool m_scroll_margins_set; - bool m_origin_at_margin; - - QVector m_tab_stops; - - bool m_notified; - bool m_visible; - bool m_new_visibillity; - bool m_blinking; - bool m_new_blinking; - bool m_wrap_around; - bool m_content_height_changed; - - QTextDecoder *m_gl_text_codec; - QTextDecoder *m_gr_text_codec; - - InsertMode m_insert_mode; -}; - -void Cursor::notifyChanged() -{ - if (!m_notified) { - m_notified = true; - m_screen->scheduleEventDispatch(); - } -} - -#endif //CUROSOR_H diff --git a/yat/backend/main.cpp b/yat/backend/main.cpp deleted file mode 100644 index 1b09d79..0000000 --- a/yat/backend/main.cpp +++ /dev/null @@ -1,32 +0,0 @@ -/************************************************************************************************** -* Copyright (c) 2012 Jørgen Lind -* -* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and -* associated documentation files (the "Software"), to deal in the Software without restriction, -* including without limitation the rights to use, copy, modify, merge, publish, distribute, -* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is -* furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included in all copies or -* substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT -* NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT -* OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -* -***************************************************************************************************/ - -#include "terminal_state.h" - -#include - -int main(int argc, char *argv[]) -{ - QGuiApplication app(argc, argv); - - TerminalState state; - - return app.exec(); -} diff --git a/yat/backend/nrc_text_codec.cpp b/yat/backend/nrc_text_codec.cpp deleted file mode 100644 index 26f3e93..0000000 --- a/yat/backend/nrc_text_codec.cpp +++ /dev/null @@ -1,124 +0,0 @@ -/****************************************************************************** -* Copyright (c) 2013 Jørgen Lind -* -* Permission is hereby granted, free of charge, to any person obtaining a copy -* of this software and associated documentation files (the "Software"), to deal -* in the Software without restriction, including without limitation the rights -* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -* copies of the Software, and to permit persons to whom the Software is -* furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included in -* all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -* SOFTWARE. -* -*******************************************************************************/ - -#include "nrc_text_codec.h" - -static bool nrc_text_codec_init = false; -void NrcTextCodec::initialize() -{ - if (!nrc_text_codec_init) { - nrc_text_codec_init = true; - new NrcTextCodec("dec_special_graphics", 500001, dec_special_graphics_char_set); - new NrcTextCodec("nrc_british", 500002, nrc_british_char_set); - new NrcTextCodec("nrc_norwegian_danish", 5002, nrc_norwegian_danish_char_set); - new NrcTextCodec("nrc_dutch", 5002, nrc_dutch_char_set); - new NrcTextCodec("nrc_finnish", 5002, nrc_finnish_char_set); - new NrcTextCodec("nrc_french", 5002, nrc_french_char_set); - new NrcTextCodec("nrc_french_canadian", 5002, nrc_french_canadian_char_set); - new NrcTextCodec("nrc_german", 5002, nrc_german_char_set); - new NrcTextCodec("nrc_italian", 5002, nrc_italian_char_set); - new NrcTextCodec("nrc_spanish", 5002, nrc_spanish_char_set); - new NrcTextCodec("nrc_swedish", 5002, nrc_swedish_char_set); - new NrcTextCodec("nrc_swiss", 5002, nrc_swiss_char_set); - } -} - -NrcTextCodec::NrcTextCodec(const QByteArray &name, int mib, const QChar character_set[]) - : QTextCodec() - , m_name(name) - , m_mib(mib) - , m_character_set(character_set) -{ -} - -QByteArray NrcTextCodec::name() const -{ - return m_name; -} -int NrcTextCodec::mibEnum() const -{ - return m_mib; -} - -QString NrcTextCodec::convertToUnicode(const char *in, int length, QTextCodec::ConverterState *state) const -{ - QString ret_str; - ret_str.reserve(length); - for (int i = 0; i < length; i++) { - uchar in_char = *(in + i); - if (in_char < 128) { - QChar unicode = m_character_set[in_char]; - if (unicode.isNull()) - unicode = QChar(in_char); - ret_str.append(unicode); - } else { - if (state) { - if (state->flags & QTextCodec::ConvertInvalidToNull) { - state->invalidChars++; - ret_str.append(0); - } else { - state->invalidChars++; - state->remainingChars = length - i; - return ret_str; - } - } - } - } - return ret_str; -} - -QByteArray NrcTextCodec::convertFromUnicode(const QChar *in, int length, ConverterState *state) const -{ - QByteArray ret_array; - ret_array.reserve(length); - - for (int i = 0; i < length; i++) { - QChar out_char = *(in + i); - if (out_char.unicode() < 128) { - uchar out = out_char.unicode(); - ret_array.append(out); - } else { - bool found = false; - for (uchar n = 0; n < 128; n++) { - if (m_character_set[n] == out_char) { - ret_array.append(n); - found = true; - break; - } - } - - if (!found && state) { - if (state->flags & QTextCodec::ConvertInvalidToNull) { - state->invalidChars++; - ret_array.append(char(0)); - } else { - state->invalidChars++; - state->remainingChars = length - i; - return ret_array; - } - } - } - } - return ret_array; -} - diff --git a/yat/backend/nrc_text_codec.h b/yat/backend/nrc_text_codec.h deleted file mode 100644 index 5d5eb13..0000000 --- a/yat/backend/nrc_text_codec.h +++ /dev/null @@ -1,45 +0,0 @@ -/****************************************************************************** -* Copyright (c) 2013 Jørgen Lind -* -* Permission is hereby granted, free of charge, to any person obtaining a copy -* of this software and associated documentation files (the "Software"), to deal -* in the Software without restriction, including without limitation the rights -* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -* copies of the Software, and to permit persons to whom the Software is -* furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included in -* all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -* SOFTWARE. -* -*******************************************************************************/ - -#include "character_sets.h" - -#include -#include - -class NrcTextCodec : public QTextCodec -{ -public: - NrcTextCodec(const QByteArray &name, int mib, const QChar character_set[]); - QByteArray name() const; - int mibEnum() const; - - static void initialize(); -protected: - QString convertToUnicode(const char *in, int length, ConverterState *state) const; - QByteArray convertFromUnicode(const QChar *in, int length, ConverterState *state) const; - -private: - const QByteArray m_name; - const int m_mib; - const QChar *m_character_set; -}; diff --git a/yat/backend/parser.cpp b/yat/backend/parser.cpp deleted file mode 100644 index fb5c286..0000000 --- a/yat/backend/parser.cpp +++ /dev/null @@ -1,1329 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2012 Jørgen Lind -* -* Permission is hereby granted, free of charge, to any person obtaining a copy -* of this software and associated documentation files (the "Software"), to deal -* in the Software without restriction, including without limitation the rights -* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -* copies of the Software, and to permit persons to whom the Software is -* furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included in -* all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -* SOFTWARE. -* -*******************************************************************************/ - -#include "parser.h" - -#include "controll_chars.h" -#include "screen.h" -#include "cursor.h" -#include "nrc_text_codec.h" - -#include -#include - - -static bool yat_parser_debug = qEnvironmentVariableIsSet("YAT_PARSER_DEBUG"); - -namespace CharacterSet { -enum CharacterSet { - utf_8, - ascii, - latin_1, - dec_special_graphics, - nrc_british, - nrc_norwegian_danish, - nrc_dutch, - nrc_finnish, - nrc_french, - nrc_french_canadian, - nrc_german, - nrc_italian, - nrc_spanish, - nrc_swedish, - nrc_swiss -}; -} - -QTextCodec *codecForCharacterset(CharacterSet::CharacterSet characterSet) { - QTextCodec *codec = 0; - switch(characterSet) { - case CharacterSet::utf_8: - codec = QTextCodec::codecForName("utf-8"); - break; - case CharacterSet::ascii: - codec = QTextCodec::codecForName("utf-8"); - break; - case CharacterSet::latin_1: - codec = QTextCodec::codecForName("latin-1"); - break; - case CharacterSet::dec_special_graphics: - codec = QTextCodec::codecForName("dec_special_graphics"); - break; - case CharacterSet::nrc_british: - codec = QTextCodec::codecForName("nrc_british"); - break; - case CharacterSet::nrc_norwegian_danish: - codec = QTextCodec::codecForName("nrc_norwegian_danish"); - break; - case CharacterSet::nrc_dutch: - codec = QTextCodec::codecForName("nrc_dutch"); - break; - case CharacterSet::nrc_finnish: - codec = QTextCodec::codecForName("nrc_finnish"); - break; - case CharacterSet::nrc_french: - codec = QTextCodec::codecForName("nrc_french"); - break; - case CharacterSet::nrc_french_canadian: - codec = QTextCodec::codecForName("nrc_french_canadian"); - break; - case CharacterSet::nrc_german: - codec = QTextCodec::codecForName("nrc_german"); - break; - case CharacterSet::nrc_italian: - codec = QTextCodec::codecForName("nrc_italian"); - break; - case CharacterSet::nrc_spanish: - codec = QTextCodec::codecForName("nrc_spanish"); - break; - case CharacterSet::nrc_swedish: - codec = QTextCodec::codecForName("nrc_swedish"); - break; - case CharacterSet::nrc_swiss: - codec = QTextCodec::codecForName("nrc_swiss"); - break; - } - if (!codec) { - qDebug() << "Failed to find codec for" << characterSet << ". Returning utf-8"; - return QTextCodec::codecForName("utf-8"); - } - return codec; -} - - -static const QByteArray getByteArrayMidNoCopy(const QByteArray &array, int start, int length) -{ - length = std::min(length, array.size() - start); - - if (start >= array.size() || length < 1) - return QByteArray(); - - const char *data_at_start = array.data() + start; - return QByteArray::fromRawData(data_at_start, length); -} -static void printParameters(const QVector ¶meters, QDebug &debug, bool dec_private = false) -{ - if (dec_private) - debug << "?"; - for (int i = 0; i < parameters.size(); i++) { - if (i == 0) - debug << " "; - else - debug << ";"; - debug << parameters.at(i); - } -} - -Parser::Parser(Screen *screen) - : m_decode_state(PlainText) - , m_current_token_start(0) - , m_current_position(0) - , m_intermediate_char(QChar()) - , m_parameters(10) - , m_parameters_expecting_more(false) - , m_dec_mode(false) - , m_gt_param(false) - , m_lnm_mode_set(false) - , m_contains_only_latin(true) - , m_screen(screen) -{ - for (uint i = 0; i < sizeof(m_graphic_codecs) / sizeof *m_graphic_codecs; i++) { - m_graphic_codecs[i] = QTextCodec::codecForName("utf-8"); - } - - NrcTextCodec::initialize(); -} - -void Parser::addData(const QByteArray &data) -{ - m_current_token_start = 0; - m_current_data = data; - - for (m_current_position = 0; m_current_position < m_current_data.size(); m_current_position++) { - uchar character = m_current_data.at(m_current_position); - if (character > 127) - m_utf8_decoder.addChar(character); - switch (m_decode_state) { - case PlainText: - if (character < C0::C0_END || m_utf8_decoder.isC1()) { - if (m_current_position != m_current_token_start) { - const QByteArray to_insert = getByteArrayMidNoCopy(m_current_data, m_current_token_start, m_current_position - m_current_token_start); - if (yat_parser_debug) - qDebug() << "Parser Insert text:" << to_insert; - m_screen->currentCursor()->addAtCursor(to_insert, m_contains_only_latin); - tokenFinished(); - m_current_token_start--; - } - m_decode_state = DecodeC0; - decodeC0(m_current_data.at(m_current_position)); - } - m_contains_only_latin = m_contains_only_latin && m_utf8_decoder.isLatin(); - break; - case DecodeC0: - decodeC0(character); - break; - case DecodeC1_7bit: - decodeC1_7bit(character); - break; - case DecodeCSI: - decodeCSI(character); - break; - case DecodeOSC: - decodeOSC(character); - break; - case DecodeCharacterSet: - decodeCharacterSet(character); - break; - case DecodeFontSize: - decodeFontSize(character); - break; - } - - } - if (m_decode_state == PlainText) { - QByteArray to_insert = getByteArrayMidNoCopy(m_current_data, m_current_token_start, m_current_data.size() - m_current_token_start); - if (to_insert.size()) { - if (yat_parser_debug) - qDebug() << "Parser Insert text:" << to_insert; - m_screen->currentCursor()->addAtCursor(to_insert, m_contains_only_latin); - tokenFinished(); - } - } - m_current_data = QByteArray(); -} - -void Parser::decodeC0(uchar character) -{ - if (yat_parser_debug) { - qDebug() << C0::C0(character); - } - switch (character) { - case C0::NUL: - case C0::SOH: - case C0::STX: - case C0::ETX: - case C0::EOT: - case C0::ENQ: - case C0::ACK: - qDebug() << "Unhandled" << C0::C0(character); - if (m_decode_state == DecodeC0) - tokenFinished(); - break; - case C0::BEL: - m_screen->scheduleFlash(); - if (m_decode_state == DecodeC0) - tokenFinished(); - break; - case C0::BS: - m_screen->currentCursor()->moveLeft(); - if (m_decode_state == DecodeC0) - tokenFinished(); - break; - case C0::HT: - m_screen->currentCursor()->moveToNextTab(); - if (m_decode_state == DecodeC0) - tokenFinished(); - break; - case C0::LF: - case C0::VT: - case C0::FF: - if (m_lnm_mode_set) - m_screen->currentCursor()->moveBeginningOfLine(); - m_screen->currentCursor()->lineFeed(); - if (m_decode_state == DecodeC0) - tokenFinished(); - break; - case C0::CR: - m_screen->currentCursor()->moveBeginningOfLine(); - if (m_decode_state == DecodeC0) - tokenFinished(); - break; - case C0::SOorLS1: - m_screen->currentCursor()->setTextCodec(m_graphic_codecs[1]); - if (m_decode_state == DecodeC0) - tokenFinished(); - break; - case C0::SIorLS0: - m_screen->currentCursor()->setTextCodec(m_graphic_codecs[0]); - if (m_decode_state == DecodeC0) - tokenFinished(); - break; - case C0::DLE: - case C0::DC1: - case C0::DC2: - case C0::DC3: - case C0::DC4: - case C0::NAK: - case C0::SYN: - case C0::ETB: - case C0::CAN: - case C0::EM: - case C0::SUB: - qDebug() << "Unhandled" << C0::C0(character); - if (m_decode_state == DecodeC0) - tokenFinished(); - break; - case C0::ESC: - if (m_decode_state != DecodeC0) { - tokenFinished(); - break; - } - m_decode_state = DecodeC1_7bit; - break; - if (m_decode_state != DecodeC0) - tokenFinished(); - break; - case C0::IS4: - case C0::IS3: - case C0::IS2: - case C0::IS1: - default: - qDebug() << "Unhandled" << C0::C0(character); - if (m_decode_state == DecodeC0) - tokenFinished(); - break; - } -} - -void Parser::decodeC1_7bit(uchar character) -{ - if (yat_parser_debug) { - qDebug() << C1_7bit::C1_7bit(character); - } - switch(character) { - case C1_7bit::ESC: - tokenFinished(); - break; - case '#': - m_decode_state = DecodeFontSize; - break; - case C1_7bit::SCS_G0: - m_decode_state = DecodeCharacterSet; - m_decode_graphics_set = 0; - break; - case C1_7bit::SCS_G1: - m_decode_state = DecodeCharacterSet; - m_decode_graphics_set = 1; - break; - case C1_7bit::SCS_G2: - m_decode_state = DecodeCharacterSet; - m_decode_graphics_set = 2; - break; - case C1_7bit::SCS_G3: - m_decode_state = DecodeCharacterSet; - m_decode_graphics_set = 3; - break; - case C1_7bit::DECSC: - m_screen->saveCursor(); - tokenFinished(); - break; - case C1_7bit::DECRC: - m_screen->restoreCursor(); - tokenFinished(); - break; - case '=': - qDebug() << "Application keypad"; - tokenFinished(); - break; - case '>': - qDebug() << "Normal keypad mode"; - tokenFinished(); - break; - case C1_7bit::NOT_DEFINED: - case C1_7bit::NOT_DEFINED1: - case C1_7bit::BPH: - case C1_7bit::NBH: - qDebug() << "Unhandled" << C1_7bit::C1_7bit(character); - tokenFinished(); - break; - case C1_7bit::IND: - m_screen->currentCursor()->moveDown(); - tokenFinished(); - break; - case C1_7bit::NEL: - m_screen->currentCursor()->moveBeginningOfLine(); - m_screen->currentCursor()->lineFeed(); - tokenFinished(); - break; - case C1_7bit::SSA: - case C1_7bit::ESA: - qDebug() << "Unhandled" << C1_7bit::C1_7bit(character); - tokenFinished(); - break; - case C1_7bit::HTS: - m_screen->currentCursor()->setTabStop(); - tokenFinished(); - break; - case C1_7bit::HTJ: - case C1_7bit::VTS: - case C1_7bit::PLD: - case C1_7bit::PLU: - qDebug() << "Unhandled" << C1_7bit::C1_7bit(character); - tokenFinished(); - break; - case C1_7bit::RI: - m_screen->currentCursor()->reverseLineFeed(); - tokenFinished(); - break; - case C1_7bit::SS2: - case C1_7bit::SS3: - case C1_7bit::DCS: - case C1_7bit::PU1: - case C1_7bit::PU2: - case C1_7bit::STS: - case C1_7bit::CCH: - case C1_7bit::MW : - case C1_7bit::SPA: - case C1_7bit::EPA: - case C1_7bit::SOS: - case C1_7bit::NOT_DEFINED3: - case C1_7bit::SCI: - qDebug() << "Unhandled" << C1_7bit::C1_7bit(character); - tokenFinished(); - break; - case C1_7bit::CSI: - m_decode_state = DecodeCSI; - break; - case C1_7bit::ST : - qDebug() << "Unhandled" << C1_7bit::C1_7bit(character); - tokenFinished(); - break; - case C1_7bit::OSC: - m_decode_state = DecodeOSC; - break; - case C1_7bit::PM : - case C1_7bit::APC: - default: - qDebug() << "Unhandled" << C1_7bit::C1_7bit(character); - tokenFinished(); - break; - } -} - -void Parser::decodeParameters(uchar character) -{ - switch (character) { - case 0x30: - case 0x31: - case 0x32: - case 0x33: - case 0x34: - case 0x35: - case 0x36: - case 0x37: - case 0x38: - case 0x39: - m_parameter_string.append(character); - break; - case 0x3a: - qDebug() << "Encountered special delimiter in parameterbyte"; - break; - case 0x3b: - if (!m_parameter_string.size()) { - m_parameters.append(INT_MIN); - } else { - appendParameter(); - } - m_parameters_expecting_more = true; - break; - case 0x3c: - case 0x3d: - appendParameter(); - qDebug() << "Parameter decoding INVALID RANGE" << char(character); - m_parameters.append(-character); - break; - case 0x3e: - if (m_parameters.size() == 0 && m_parameter_string.size() == 0) { - m_gt_param = true; - } else { - appendParameter(); - qDebug() << "unknown parameter state"; - } - break; - case 0x3f: - if (m_parameters.size() == 0 && m_parameter_string.size() == 0) { - m_dec_mode = true; - } else { - appendParameter(); - qDebug() << "unknown parameter state"; - } - break; - default: - //this is undefined for now - qDebug() << "Encountered undefined parameter byte"; - break; - } -} - -void Parser::decodeCSI(uchar character) -{ - if (character < C0::C0_END) { - decodeC0(character); - return; - } - - if (character >= 0x30 && character <= 0x3f) { - decodeParameters(character); - } else { - appendParameter(); - if (character >= 0x20 && character <= 0x2f) { - if (m_intermediate_char.unicode()) - qDebug() << "Warning!: double intermediate bytes found in CSI"; - m_intermediate_char = character; - } else if (character >= 0x40 && character <= 0x7d) { - if (m_intermediate_char.unicode()) { - if (yat_parser_debug) { - QDebug debug = qDebug(); - debug << FinalBytesSingleIntermediate::FinalBytesSingleIntermediate(character); - printParameters(m_parameters, debug, m_dec_mode); - } - switch (character) { - case FinalBytesSingleIntermediate::SL: - case FinalBytesSingleIntermediate::SR: - case FinalBytesSingleIntermediate::GSM: - case FinalBytesSingleIntermediate::GSS: - case FinalBytesSingleIntermediate::FNT: - case FinalBytesSingleIntermediate::TSS: - case FinalBytesSingleIntermediate::JFY: - case FinalBytesSingleIntermediate::SPI: - case FinalBytesSingleIntermediate::QUAD: - case FinalBytesSingleIntermediate::SSU: - case FinalBytesSingleIntermediate::PFS: - case FinalBytesSingleIntermediate::SHS: - case FinalBytesSingleIntermediate::SVS: - case FinalBytesSingleIntermediate::IGS: - case FinalBytesSingleIntermediate::IDCS: - case FinalBytesSingleIntermediate::PPA: - case FinalBytesSingleIntermediate::PPR: - case FinalBytesSingleIntermediate::PPB: - case FinalBytesSingleIntermediate::SPD: - case FinalBytesSingleIntermediate::DTA: - case FinalBytesSingleIntermediate::SHL: - case FinalBytesSingleIntermediate::SLL: - case FinalBytesSingleIntermediate::FNK: - case FinalBytesSingleIntermediate::SPQR: - case FinalBytesSingleIntermediate::SEF: - case FinalBytesSingleIntermediate::PEC: - case FinalBytesSingleIntermediate::SSW: - case FinalBytesSingleIntermediate::SACS: - case FinalBytesSingleIntermediate::SAPV: - case FinalBytesSingleIntermediate::STAB: - case FinalBytesSingleIntermediate::GCC: - case FinalBytesSingleIntermediate::TATE: - case FinalBytesSingleIntermediate::TALE: - case FinalBytesSingleIntermediate::TAC: - case FinalBytesSingleIntermediate::TCC: - case FinalBytesSingleIntermediate::TSR: - case FinalBytesSingleIntermediate::SCO: - case FinalBytesSingleIntermediate::SRCS: - case FinalBytesSingleIntermediate::SCS: - case FinalBytesSingleIntermediate::SLS: - case FinalBytesSingleIntermediate::SCP: - default: - qDebug() << "unhandled CSI" << FinalBytesSingleIntermediate::FinalBytesSingleIntermediate(character); - break; - } - tokenFinished(); - } else { - if (yat_parser_debug) { - QDebug debug = qDebug(); - debug << FinalBytesNoIntermediate::FinalBytesNoIntermediate(character); - printParameters(m_parameters, debug, m_dec_mode); - } - switch (character) { - case FinalBytesNoIntermediate::ICH: { - int n_chars = m_parameters.size() ? m_parameters.at(0) : 1; - QByteArray empty(n_chars, ' '); - m_screen->currentCursor()->insertAtCursor(empty); - } - break; - case FinalBytesNoIntermediate::CUU: { - Q_ASSERT(m_parameters.size() < 2); - int move_up = m_parameters.size() ? m_parameters.at(0) : 1; - m_screen->currentCursor()->moveUp(move_up ? move_up : 1); - } - break; - case FinalBytesNoIntermediate::CUD: { - int move_down = m_parameters.size() ? m_parameters.at(0) : 1; - m_screen->currentCursor()->moveDown(move_down ? move_down : 1); - } - break; - case FinalBytesNoIntermediate::CUF:{ - Q_ASSERT(m_parameters.size() < 2); - int move_right = m_parameters.size() ? m_parameters.at(0) : 1; - m_screen->currentCursor()->moveRight(move_right ? move_right : 1); - } - break; - case FinalBytesNoIntermediate::CUB: { - Q_ASSERT(m_parameters.size() < 2); - int move_left = m_parameters.size() ? m_parameters.at(0) : 1; - m_screen->currentCursor()->moveLeft(move_left ? move_left : 1); - } - break; - case FinalBytesNoIntermediate::CNL: - case FinalBytesNoIntermediate::CPL: - qDebug() << "unhandled CSI" << FinalBytesNoIntermediate::FinalBytesNoIntermediate(character); - break; - case FinalBytesNoIntermediate::CHA: { - Q_ASSERT(m_parameters.size() < 2); - handleDefaultParameters(1); - int move_to_pos_on_line = m_parameters.size() ? m_parameters.at(0) : 1; - m_screen->currentCursor()->moveToCharacter(move_to_pos_on_line - 1); - } - break; - case FinalBytesNoIntermediate::CUP: - handleDefaultParameters(1); - if (!m_parameters.size()) { - m_screen->currentCursor()->moveOrigin(); - } else if (m_parameters.size() == 2){ - m_screen->currentCursor()->move(m_parameters.at(1) - 1, m_parameters.at(0) - 1); - } else if (m_parameters.size() == 1){ - m_screen->currentCursor()->move(m_parameters.at(0) - 1, 0); - } - break; - case FinalBytesNoIntermediate::CHT: - qDebug() << "unhandled CSI" << FinalBytesNoIntermediate::FinalBytesNoIntermediate(character); - break; - case FinalBytesNoIntermediate::ED: - if (!m_parameters.size()) { - m_screen->currentCursor()->clearToEndOfScreen(); - } else { - int param = m_parameters.size() ? m_parameters.at(0) : 0; - switch (param) { - case 0: - m_screen->currentCursor()->clearToEndOfScreen(); - break; - case 1: - m_screen->currentCursor()->clearToBeginningOfScreen(); - break; - case 2: - m_screen->clearScreen(); - break; - default: - qDebug() << "Invalid parameter value for FinalBytesNoIntermediate::ED"; - } - } - - break; - case FinalBytesNoIntermediate::EL: - if (!m_parameters.size() || m_parameters.at(0) == 0) { - m_screen->currentCursor()->clearToEndOfLine(); - } else if (m_parameters.at(0) == 1) { - m_screen->currentCursor()->clearToBeginningOfLine(); - } else if (m_parameters.at(0) == 2) { - m_screen->currentCursor()->clearLine(); - } else{ - qDebug() << "Fault when processing FinalBytesNoIntermediate::EL"; - } - break; - case FinalBytesNoIntermediate::IL: { - int count = 1; - if (m_parameters.size()) { - count = m_parameters.at(0); - } - m_screen->currentCursor()->scrollUp(count); - } - break; - case FinalBytesNoIntermediate::DL: { - int count = 1; - if (m_parameters.size()) { - count = m_parameters.at(0); - } - m_screen->currentCursor()->scrollDown(count); - } - break; - case FinalBytesNoIntermediate::EF: - case FinalBytesNoIntermediate::EA: - qDebug() << "unhandled CSI" << FinalBytesNoIntermediate::FinalBytesNoIntermediate(character); - break; - case FinalBytesNoIntermediate::DCH:{ - Q_ASSERT(m_parameters.size() < 2); - int n_chars = m_parameters.size() ? m_parameters.at(0) : 1; - m_screen->currentCursor()->deleteCharacters(n_chars); - } - break; - case FinalBytesNoIntermediate::SSE: - case FinalBytesNoIntermediate::CPR: - case FinalBytesNoIntermediate::SU: - case FinalBytesNoIntermediate::SD: - case FinalBytesNoIntermediate::NP: - case FinalBytesNoIntermediate::PP: - case FinalBytesNoIntermediate::CTC: - case FinalBytesNoIntermediate::ECH: - case FinalBytesNoIntermediate::CVT: - case FinalBytesNoIntermediate::CBT: - case FinalBytesNoIntermediate::SRS: - case FinalBytesNoIntermediate::PTX: - case FinalBytesNoIntermediate::SDS: - case FinalBytesNoIntermediate::SIMD: - case FinalBytesNoIntermediate::HPA: - case FinalBytesNoIntermediate::HPR: - case FinalBytesNoIntermediate::REP: - qDebug() << "unhandled CSI" << FinalBytesNoIntermediate::FinalBytesNoIntermediate(character); - break; - case FinalBytesNoIntermediate::DA: - if (m_gt_param) { - m_screen->sendSecondaryDA(); - } else { - m_screen->sendPrimaryDA(); - } - break; - case FinalBytesNoIntermediate::VPA: { - Q_ASSERT(m_parameters.size() < 2); - handleDefaultParameters(1); - int move_to_line = m_parameters.size() ? m_parameters.at(0) -1 : 0; - m_screen->currentCursor()->moveToLine(move_to_line); - } - break; - case FinalBytesNoIntermediate::VPR: - qDebug() << "unhandled CSI" << FinalBytesNoIntermediate::FinalBytesNoIntermediate(character); - break; - case FinalBytesNoIntermediate::HVP: { - Q_ASSERT(m_parameters.size() <= 2); - handleDefaultParameters(1); - if (!m_parameters.size()) { - m_screen->currentCursor()->moveOrigin(); - } else if (m_parameters.size() == 2){ - m_screen->currentCursor()->move(m_parameters.at(1) - 1, m_parameters.at(0) - 1); - } else if (m_parameters.size() == 1){ - m_screen->currentCursor()->move(m_parameters.at(0) - 1, 0); - } - break; - } - case FinalBytesNoIntermediate::TBC: - if (!m_parameters.size() || m_parameters.at(0) == 0) { - m_screen->currentCursor()->removeTabStop(); - } else if (m_parameters.at(0) == 3) { - m_screen->currentCursor()->clearTabStops(); - } - break; - case FinalBytesNoIntermediate::SM: - if (!m_parameters.size()) { - qDebug() << FinalBytesNoIntermediate::SM << "called without parameter"; - break; - } - for (int i = 0; i < m_parameters.size(); i++) { - if (m_dec_mode) { - setDecMode(m_parameters.at(i)); - } else { - setMode(m_parameters.at(i)); - } - } - break; - case FinalBytesNoIntermediate::MC: - case FinalBytesNoIntermediate::HPB: - case FinalBytesNoIntermediate::VPB: - qDebug() << "unhandled CSI" << FinalBytesNoIntermediate::FinalBytesNoIntermediate(character); - break; - case FinalBytesNoIntermediate::RM: - if (!m_parameters.size()) { - qDebug() << FinalBytesNoIntermediate::RM << "called without parameter"; - break; - } - for (int i = 0; i < m_parameters.size(); i++) { - if (m_dec_mode) { - resetDecMode(m_parameters.at(i)); - } else { - resetMode(m_parameters.at(i)); - } - } - - break; - case FinalBytesNoIntermediate::SGR: - handleDefaultParameters(0); - if (!m_parameters.size()) - m_parameters << 0; - handleSGR(); - break; - case FinalBytesNoIntermediate::DSR: - qDebug() << "report"; - case FinalBytesNoIntermediate::DAQ: - case FinalBytesNoIntermediate::Reserved0: - case FinalBytesNoIntermediate::Reserved1: - qDebug() << "Unhandeled CSI" << FinalBytesNoIntermediate::FinalBytesNoIntermediate(character); - break; - case FinalBytesNoIntermediate::DECSTBM: - if (m_parameters.size() == 2) { - if (m_parameters.at(0) >= 0) { - m_screen->currentCursor()->setScrollArea(m_parameters.at(0) - 1,m_parameters.at(1) - 1); - } else { - qDebug() << "Unknown value for scrollRegion" << m_parameters.at(0); - } - } else { - m_screen->currentCursor()->resetScrollArea(); - } - m_screen->currentCursor()->moveOrigin(); - break; - case FinalBytesNoIntermediate::Reserved3: - case FinalBytesNoIntermediate::Reserved4: - case FinalBytesNoIntermediate::Reserved5: - case FinalBytesNoIntermediate::Reserved6: - case FinalBytesNoIntermediate::Reserved7: - case FinalBytesNoIntermediate::Reserved8: - case FinalBytesNoIntermediate::Reserved9: - case FinalBytesNoIntermediate::Reserveda: - case FinalBytesNoIntermediate::Reservedb: - case FinalBytesNoIntermediate::Reservedc: - case FinalBytesNoIntermediate::Reservedd: - case FinalBytesNoIntermediate::Reservede: - case FinalBytesNoIntermediate::Reservedf: - default: - qDebug() << "Unhandeled CSI" << FinalBytesNoIntermediate::FinalBytesNoIntermediate(character); - break; - } - tokenFinished(); - } - } - } -} - -void Parser::decodeOSC(uchar character) -{ - if (!m_parameters.size() && - character >= 0x30 && character <= 0x3f) { - decodeParameters(character); - } else { - appendParameter(); - if (m_decode_osc_state == None) { - if (m_parameters.size() != 1) { - tokenFinished(); - return; - } - - switch (m_parameters.at(0)) { - case 0: - m_decode_osc_state = ChangeWindowAndIconName; - break; - case 1: - m_decode_osc_state = ChangeIconTitle; - break; - case 2: - m_decode_osc_state = ChangeWindowTitle; - break; - default: - m_decode_osc_state = Unknown; - break; - } - } else { - if (character == 0x07) { - if (m_decode_osc_state == ChangeWindowAndIconName || - m_decode_osc_state == ChangeWindowTitle) { - QString title = QString::fromUtf8(m_current_data.mid(m_current_token_start+4, - m_current_position - m_current_token_start -1)); - m_screen->setTitle(title); - } - tokenFinished(); - } - } - } -} - -void Parser::decodeCharacterSet(uchar character) -{ - if (m_decode_graphics_set < 0 || m_decode_graphics_set > (int) (sizeof(m_graphic_codecs) / sizeof(*m_graphic_codecs))) { - qDebug() << "Parser state is illigal. m_decode_graphics_set is: " << m_decode_graphics_set << "array size is:" << (sizeof(m_graphic_codecs) / sizeof(*m_graphic_codecs)); - m_decode_graphics_set = 0; - return; - } - switch(character) { - case '0': - m_graphic_codecs[m_decode_graphics_set] = codecForCharacterset(CharacterSet::dec_special_graphics); - break; - case '4': - m_graphic_codecs[m_decode_graphics_set] = codecForCharacterset(CharacterSet::nrc_dutch); - break; - case '5': - m_graphic_codecs[m_decode_graphics_set] = codecForCharacterset(CharacterSet::nrc_finnish); - break; - case '6': - m_graphic_codecs[m_decode_graphics_set] = codecForCharacterset(CharacterSet::nrc_norwegian_danish); - break; - case '7': - m_graphic_codecs[m_decode_graphics_set] = codecForCharacterset(CharacterSet::nrc_swedish); - break; - case 'A': - m_graphic_codecs[m_decode_graphics_set] = codecForCharacterset(CharacterSet::nrc_british); - break; - case 'B': - m_graphic_codecs[m_decode_graphics_set] = codecForCharacterset(CharacterSet::ascii); - break; - case 'C': - m_graphic_codecs[m_decode_graphics_set] = codecForCharacterset(CharacterSet::nrc_finnish); - break; - case 'R': - m_graphic_codecs[m_decode_graphics_set] = codecForCharacterset(CharacterSet::nrc_french); - break; - case 'Q': - m_graphic_codecs[m_decode_graphics_set] = codecForCharacterset(CharacterSet::nrc_french_canadian); - break; - case 'K': - m_graphic_codecs[m_decode_graphics_set] = codecForCharacterset(CharacterSet::nrc_german); - break; - case 'Y': - m_graphic_codecs[m_decode_graphics_set] = codecForCharacterset(CharacterSet::nrc_italian); - break; - case 'E': - m_graphic_codecs[m_decode_graphics_set] = codecForCharacterset(CharacterSet::nrc_norwegian_danish); - break; - case 'Z': - m_graphic_codecs[m_decode_graphics_set] = codecForCharacterset(CharacterSet::nrc_spanish); - break; - case 'H': - m_graphic_codecs[m_decode_graphics_set] = codecForCharacterset(CharacterSet::nrc_swedish); - break; - case '=': - m_graphic_codecs[m_decode_graphics_set] = codecForCharacterset(CharacterSet::nrc_swiss); - break; - default: - qDebug() << "Not supported Character set!" << character << (char) character; - } - tokenFinished(); -} - -void Parser::decodeFontSize(uchar character) -{ - switch(character) { - case '8': - if (yat_parser_debug) - qDebug() << "Filling screen with 'E'"; - m_screen->fill(QChar('E')); - break; - default: - qDebug() << "Failed to decode font size for" << character; - break; - } - tokenFinished(); -} - -void Parser::setMode(int mode) -{ - switch(mode) { -//Guarded area transfer GATM* 1 -//Keyboard action KAM 2 -//Control representation CRM† 3 -//Insert/replace IRM 4 - case 4: - m_screen->currentCursor()->setInsertMode(Cursor::Insert); - break; -//Status reporting transfer SRTM* 5 -//Vertical editing VEM* 7 -//Horizontal editing HEM* 10 -//Positioning unit PUM* 11 -//Send/receive SRM 12 -//Format effector action FEAM* 13 -//Format effector transfer FETM* 14 -//Multiple area transfer MATM* 15 -//Transfer termination TTM* 16 -//Selected area transfer SATM* 17 -//Tabulation stop TSM* 18 -//Editing boundary EBM* 19 -//Line feed/new line LNM 20 - case 20: - m_lnm_mode_set = true; - break; - default: - qDebug() << "Unhandeled setMode" << mode; - break; - } -} - -void Parser::setDecMode(int mode) -{ -//taken from http://invisible-island.net/xterm/ctlseqs/ctlseqs.html - switch (mode) { -//1 -> Application Cursor Keys (DECCKM). - case 1: - m_screen->setApplicationCursorKeysMode(true); - break; -//2 -> Designate USASCII for character sets G0-G3 (DECANM), and set VT100 mode. -//3 -> 132 Column Mode (DECCOLM). - case 3: - m_screen->emitRequestWidth(132); - m_screen->emitRequestHeight(24); - m_screen->clear(); - m_screen->currentCursor()->moveOrigin(); - m_screen->currentCursor()->resetScrollArea(); - break; -//4 -> Smooth (Slow) Scroll (DECSCLM). - case 4: - m_screen->setFastScroll(false); - break; -//5 -> Reverse Video (DECSCNM). - case 5: - m_screen->colorPalette()->setInverseDefaultColors(true); - break; -//6 -> Origin Mode (DECOM). - case 6: - m_screen->currentCursor()->setOriginAtMargin(true); - break; -//7 -> Wraparound Mode (DECAWM). - case 7: - m_screen->currentCursor()->setWrapAround(true); - break; - -//8 -> Auto-repeat Keys (DECARM). -//9 -> Send Mouse X & Y on button press. See the section Mouse Tracking. -//10 -> Show toolbar (rxvt). -//12 -> Start Blinking Cursor (att610). - case 12: - m_screen->currentCursor()->setBlinking(true); - break; -//18 -> Print form feed (DECPFF). -//19 -> Set print extent to full screen (DECPEX). -//25 -> Show Cursor (DECTCEM). - case 25: - m_screen->currentCursor()->setVisible(true); - break; -//30 -> Show scrollbar (rxvt). -//35 -> Enable font-shifting functions (rxvt). -//38 -> Enter Tektronix Mode (DECTEK). -//40 -> Allow 80 → 132 Mode. -//41 -> more(1) fix (see curses resource). -//42 -> Enable Nation Replacement Character sets (DECNRCM). -//44 -> Turn On Margin Bell. -//45 -> Reverse-wraparound Mode. -//46 -> Start Logging. This is normally disabled by a compile-time option. -//47 -> Use Alternate Screen Buffer. (This may be disabled by the titeInhibit resource). - case 47: - m_screen->useAlternateScreenBuffer(); - break; -//66 -> Application keypad (DECNKM). -//67 -> Backarrow key sends backspace (DECBKM). -//69 -> Enable left and right margin mode (DECLRMM), VT420 and up. -//95 -> Do not clear screen when DECCOLM is set/reset (DECNCSM), VT510 and up. -//1000 → Send Mouse X & Y on button press and release. See the section Mouse Tracking. -//1001 -> Use Hilite Mouse Tracking. -//1002 -> Use Cell Motion Mouse Tracking. -//1003 -> Use All Motion Mouse Tracking. -//1004 -> Send FocusIn/FocusOut events. -//1005 -> Enable UTF-8 Mouse Mode. -//1006 -> Enable SGR Mouse Mode. -//1007 -> Enable Alternate Scroll Mode. -//1010 -> Scroll to bottom on tty output (rxvt). -//1015 -> Enable urxvt Mouse Mode. -//1011 -> Scroll to bottom on key press (rxvt). -//1034 -> Interpret "meta" key, sets eighth bit. (enables the eightBitInput resource). -//1035 -> Enable special modifiers for Alt and NumLock keys. (This enables the numLock resource). -//1036 -> Send ESC when Meta modifies a key. (This enables the metaSendsEscape resource). -//1037 -> Send DEL from the editing-keypad Delete key. -//1039 -> Send ESC when Alt modifies a key. (This enables the altSendsEscape resource). -//1040 -> Keep selection even if not highlighted. (This enables the keepSelection resource). -//1041 -> Use the CLIPBOARD selection. (This enables the selectToClipboard resource). -//1042 -> Enable Urgency window manager hint when Control-G is received. (This enables the bellIsUrgent resource). -//1043 -> Enable raising of the window when Control-G is received. (enables the popOnBell resource). -//1047 -> Use Alternate Screen Buffer. (This may be disabled by the titeInhibit resource). - case 1047: - m_screen->useAlternateScreenBuffer(); - break; -//1048 -> Save cursor as in DECSC. (This may be disabled by the titeInhibit resource). - case 1048: - m_screen->saveCursor(); - break; -//1049 -> Save cursor as in DECSC and use Alternate Screen Buffer, clearing it first. (This may be disabled by the titeInhibit resource). This combines the effects of the 1047 and 1048 modes. Use this with terminfo-based applications rather than the 47 mode. - case 1049: - m_screen->saveCursor(); - m_screen->useAlternateScreenBuffer(); - break; -//1050 -> Set terminfo/termcap function-key mode. -//1051 -> Set Sun function-key mode. -//1052 -> Set HP function-key mode. -//1053 -> Set SCO function-key mode. -//1060 -> Set legacy keyboard emulation (X11R6). -//1061 -> Set VT220 keyboard emulation. -//2004 -> Set bracketed paste mode - default: - qDebug() << "Unhandeled setDecMode" << mode; - } -} - -void Parser::resetMode(int mode) -{ - switch(mode) { -//Guarded area transfer GATM* 1 -//Keyboard action KAM 2 -//Control representation CRM† 3 -//Insert/replace IRM 4 - case 4: - m_screen->currentCursor()->setInsertMode(Cursor::Replace); - break; -//Status reporting transfer SRTM* 5 -//Vertical editing VEM* 7 -//Horizontal editing HEM* 10 -//Positioning unit PUM* 11 -//Send/receive SRM 12 -//Format effector action FEAM* 13 -//Format effector transfer FETM* 14 -//Multiple area transfer MATM* 15 -//Transfer termination TTM* 16 -//Selected area transfer SATM* 17 -//Tabulation stop TSM* 18 -//Editing boundary EBM* 19 -//Line feed/new line LNM 20 - case 20: - m_lnm_mode_set = false; - break; - default: - qDebug() << "Unhandeled resetMode" << mode; - break; - } -} - -void Parser::resetDecMode(int mode) -{ - switch(mode) { -//taken from http://invisible-island.net/xterm/ctlseqs/ctlseqs.html -//1 -> Normal Cursor Keys (DECCKM). - case 1: - m_screen->setApplicationCursorKeysMode(false); - break; -//2 -> Designate VT52 mode (DECANM). -//3 -> 80 Column Mode (DECCOLM). - case 3: - m_screen->emitRequestWidth(80); - m_screen->emitRequestHeight(24); - m_screen->clear(); - m_screen->currentCursor()->moveOrigin(); - m_screen->currentCursor()->resetScrollArea(); - break; -//4 -> Jump (Fast) Scroll (DECSCLM). - case 4: - m_screen->setFastScroll(true); - break; -//5 -> Normal Video (DECSCNM). - case 5: - m_screen->colorPalette()->setInverseDefaultColors(false); - break; -//6 -> Normal Cursor Mode (DECOM). - case 6: - m_screen->currentCursor()->setOriginAtMargin(false); - break; -//7 -> No Wraparound Mode (DECAWM). - case 7: - m_screen->currentCursor()->setWrapAround(false); - break; -//8 -> No Auto-repeat Keys (DECARM). -//9 -> Don’t send Mouse X & Y on button press. -//10 -> Hide toolbar (rxvt). -//12 -> Stop Blinking Cursor (att610). - case 12: - m_screen->currentCursor()->setBlinking(false); - break; -//18 -> Don’t print form feed (DECPFF). -//19 -> Limit print to scrolling region (DECPEX). -//25 -> Hide Cursor (DECTCEM). - case 25: - m_screen->currentCursor()->setVisible(false); - break; -//30 -> Don’t show scrollbar (rxvt). -//35 -> Disable font-shifting functions (rxvt). -//40 -> Disallow 80 → 132 Mode. -//41 -> No more(1) fix (see curses resource). -//42 -> Disable Nation Replacement Character sets (DECNRCM). -//44 -> Turn Off Margin Bell. -//45 -> No Reverse-wraparound Mode. -//46 -> Stop Logging. (This is normally disabled by a compile-time option). -//47 -> Use Normal Screen Buffer. - case 47: - m_screen->useNormalScreenBuffer(); - break; -//66 -> Numeric keypad (DECNKM). -//67 -> Backarrow key sends delete (DECBKM). -//69 -> Disable left and right margin mode (DECLRMM), VT420 and up. -//95 -> Clear screen when DECCOLM is set/reset (DECNCSM), VT510 and up. -//1000 -> Don’t send Mouse X & Y on button press and release. See the section Mouse Tracking. -//1001 -> Don’t use Hilite Mouse Tracking. -//1002 -> Don’t use Cell Motion Mouse Tracking. -//1003 -> Don’t use All Motion Mouse Tracking. -//1004 -> Don’t send FocusIn/FocusOut events. -//1005 -> Disable UTF-8 Mouse Mode. -//1006 -> Disable SGR Mouse Mode. -//1007 -> Disable Alternate Scroll Mode. -//1010 -> Don’t scroll to bottom on tty output (rxvt). -//1015 -> Disable urxvt Mouse Mode. -//1011 -> Don’t scroll to bottom on key press (rxvt). -//1034 -> Don’t interpret "meta" key. (This disables the eightBitInput resource). -//1035 -> Disable special modifiers for Alt and NumLock keys. (This disables the numLock resource). -//1036 -> Don’t send ESC when Meta modifies a key. (This disables the metaSendsEscape resource). -//1037 -> Send VT220 Remove from the editing-keypad Delete key. -//1039 -> Don’t send ESC when Alt modifies a key. (This disables the altSendsEscape resource). -//1040 -> Do not keep selection when not highlighted. (This disables the keepSelection resource). -//1041 -> Use the PRIMARY selection. (This disables the selectToClipboard resource). -//1042 -> Disable Urgency window manager hint when Control-G is received. (This disables the bellIsUrgent resource). -//1043 -> Disable raising of the window when Control-G is received. (This disables the popOnBell resource). -//1047 -> Use Normal Screen Buffer, clearing screen first if in the Alternate Screen. (This may be disabled by the titeInhibit resource). - case 1047: - m_screen->useNormalScreenBuffer(); - break; -//1048 -> Restore cursor as in DECRC. (This may be disabled by the titeInhibit resource). - case 1048: - m_screen->restoreCursor(); - break; -//1049 -> Use Normal Screen Buffer and restore cursor as in DECRC. (This may be disabled by the titeInhibit resource). This combines the effects of the 1047 and 1048 modes. Use this with terminfo-based applications rather than the 47 mode. - case 1049: - m_screen->restoreCursor(); - m_screen->useNormalScreenBuffer(); - break; -//1050 -> Reset terminfo/termcap function-key mode. -//1051 -> Reset Sun function-key mode. -//1052 -> Reset HP function-key mode. -//1053 -> Reset SCO function-key mode. -//1060 -> Reset legacy keyboard emulation (X11R6). -//1061 -> Reset keyboard emulation to Sun/PC style. -//2004 -> Reset bracketed paste mode - default: - qDebug() << "Unhandeled resetDecMode" << mode; - break; - } -} - -void Parser::handleSGR() -{ - for (int i = 0; i < m_parameters.size();i++) { - switch(m_parameters.at(i)) { - case 0: - // m_screen->setTextStyle(TextStyle::Normal); - m_screen->currentCursor()->resetStyle(); - break; - case 1: - m_screen->currentCursor()->setTextStyle(TextStyle::Bold); - break; - case 4: - m_screen->currentCursor()->setTextStyle(TextStyle::Underlined); - break; - case 5: - m_screen->currentCursor()->setTextStyle(TextStyle::Blinking); - break; - case 7: - m_screen->currentCursor()->setTextStyle(TextStyle::Inverse); - break; - case 8: - qDebug() << "SGR: Hidden text not supported"; - break; - case 22: - m_screen->currentCursor()->setTextStyle(TextStyle::Bold, false); - break; - case 24: - m_screen->currentCursor()->setTextStyle(TextStyle::Underlined, false); - break; - case 25: - m_screen->currentCursor()->setTextStyle(TextStyle::Blinking, false); - break; - case 27: - m_screen->currentCursor()->setTextStyle(TextStyle::Inverse, false); - break; - case 28: - qDebug() << "SGR: Visible text is allways on"; - break; - case 30: - case 31: - case 32: - case 33: - case 34: - case 35: - case 36: - case 37: - // case 38: - case 39: - case 40: - case 41: - case 42: - case 43: - case 44: - case 45: - case 46: - case 47: - // case 38: - case 49: - m_screen->currentCursor()->setTextStyleColor(m_parameters.at(i)); - break; - default: - qDebug() << "Unknown SGR" << m_parameters.at(i); - break; - } - - } -} - -void Parser::tokenFinished() -{ - m_decode_state = PlainText; - m_decode_osc_state = None; - - m_parameters.clear(); - m_parameter_string.clear(); - - m_current_token_start = m_current_position + 1; - m_intermediate_char = 0; - - m_parameters_expecting_more = false; - m_dec_mode = false; - m_gt_param = false; - m_contains_only_latin = true; -} - -void Parser::appendParameter() -{ - if (m_parameter_string.size()) { - m_parameters.append(m_parameter_string.toUShort()); - m_parameter_string.clear(); - m_parameters_expecting_more = false; - } -} - -void Parser::handleDefaultParameters(int defaultValue) -{ - for (int i = 0; i < m_parameters.size(); i++) { - if (m_parameters.at(i) == INT_MIN) - m_parameters.replace(i, defaultValue); - } - if (m_parameters_expecting_more) - m_parameters.append(defaultValue); -} - -QDebug operator<<(QDebug debug, Parser::DecodeState decodeState) -{ - switch(decodeState) { - case Parser::PlainText: - debug << "PlainText"; - break; - case Parser::DecodeC0: - debug << "DecodeC0"; - break; - case Parser::DecodeC1_7bit: - debug << "DecodeC1_7bit"; - break; - case Parser::DecodeCSI: - debug << "DecodeCSI"; - break; - case Parser::DecodeOSC: - debug << "DecodeOSC"; - break; - case Parser::DecodeCharacterSet: - debug << "DecodeCharacterSet"; - break; - case Parser::DecodeFontSize: - debug << "DecodeFontSize"; - break; - } - return debug; -} diff --git a/yat/backend/parser.h b/yat/backend/parser.h deleted file mode 100644 index 9ee598f..0000000 --- a/yat/backend/parser.h +++ /dev/null @@ -1,110 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2012 Jørgen Lind -* -* Permission is hereby granted, free of charge, to any person obtaining a copy -* of this software and associated documentation files (the "Software"), to deal -* in the Software without restriction, including without limitation the rights -* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -* copies of the Software, and to permit persons to whom the Software is -* furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included in -* all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -* SOFTWARE. -* -*******************************************************************************/ - -#ifndef PARSER_H -#define PARSER_H - -#include -#include -#include - -#include "controll_chars.h" -#include "utf8_decoder.h" - -class Screen; - -class Parser -{ -public: - Parser(Screen *screen); - - void addData(const QByteArray &data); - -private: - - enum DecodeState { - PlainText, - DecodeC0, - DecodeC1_7bit, - DecodeCSI, - DecodeOSC, - DecodeCharacterSet, - DecodeFontSize - }; - - enum DecodeOSCState { - None, - ChangeWindowAndIconName, - ChangeIconTitle, - ChangeWindowTitle, - Unknown - }; - - void decodeC0(uchar character); - void decodeC1_7bit(uchar character); - void decodeParameters(uchar character); - void decodeCSI(uchar character); - void decodeOSC(uchar character); - void decodeCharacterSet(uchar character); - void decodeFontSize(uchar character); - - void setMode(int mode); - void setDecMode(int mode); - void resetMode(int mode); - void resetDecMode(int mode); - - void handleSGR(); - - void tokenFinished(); - - void appendParameter(); - void handleDefaultParameters(int defaultValue); - - DecodeState m_decode_state; - DecodeOSCState m_decode_osc_state; - - QByteArray m_current_data; - - int m_current_token_start; - int m_current_position; - - QChar m_intermediate_char; - - QByteArray m_parameter_string; - QVector m_parameters; - bool m_parameters_expecting_more; - bool m_dec_mode; - bool m_gt_param; - bool m_lnm_mode_set; - bool m_contains_only_latin; - - int m_decode_graphics_set; - QTextCodec *m_graphic_codecs[4]; - Utf8Decoder m_utf8_decoder; - - Screen *m_screen; - friend QDebug operator<<(QDebug debug, DecodeState decodeState); -}; -QDebug operator<<(QDebug debug, Parser::DecodeState decodeState); - -#endif // PARSER_H diff --git a/yat/backend/screen.cpp b/yat/backend/screen.cpp deleted file mode 100644 index 116b818..0000000 --- a/yat/backend/screen.cpp +++ /dev/null @@ -1,688 +0,0 @@ -/****************************************************************************** - * Copyright (c) 2012 Jørgen Lind -* -* Permission is hereby granted, free of charge, to any person obtaining a copy -* of this software and associated documentation files (the "Software"), to deal -* in the Software without restriction, including without limitation the rights -* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -* copies of the Software, and to permit persons to whom the Software is -* furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included in -* all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -* SOFTWARE. -* -******************************************************************************/ - -#include "screen.h" - -#include "screen_data.h" -#include "block.h" -#include "cursor.h" -#include "text.h" -#include "scrollback.h" - -#include "controll_chars.h" -#include "character_sets.h" - -#include -#include -#include - -#include - -#include - -Screen::Screen(QObject *parent) - : QObject(parent) - , m_palette(new ColorPalette(this)) - , m_parser(this) - , m_timer_event_id(0) - , m_width(1) - , m_height(0) - , m_primary_data(new ScreenData(0, this)) - , m_alternate_data(new ScreenData(0, this)) - , m_current_data(m_primary_data) - , m_old_current_data(m_primary_data) - , m_selection_valid(false) - , m_selection_moved(0) - , m_flash(false) - , m_cursor_changed(false) - , m_application_cursor_key_mode(false) - , m_fast_scroll(true) - , m_default_background(m_palette->normalColor(ColorPalette::DefaultBackground)) -{ - Cursor *cursor = new Cursor(this); - m_cursor_stack << cursor; - m_new_cursors << cursor; - - connect(m_primary_data, SIGNAL(contentHeightChanged()), this, SIGNAL(contentHeightChanged())); - connect(m_palette, SIGNAL(changed()), this, SLOT(paletteChanged())); - - setHeight(25); - setWidth(80); - - connect(&m_pty, &YatPty::readyRead, this, &Screen::readData); - connect(&m_pty, SIGNAL(hangupReceived()),qGuiApp, SLOT(quit())); - -} - -Screen::~Screen() -{ - - for(int i = 0; i < m_to_delete.size(); i++) { - delete m_to_delete.at(i); - } - //m_to_delete.clear(); - - delete m_primary_data; - delete m_alternate_data; -} - - -QColor Screen::defaultForgroundColor() const -{ - return m_palette->normalColor(ColorPalette::DefaultForground); -} - -QColor Screen::defaultBackgroundColor() const -{ - return m_palette->normalColor(ColorPalette::DefaultBackground); -} - -void Screen::emitRequestHeight(int newHeight) -{ - emit requestHeightChange(newHeight); -} - -void Screen::setHeight(int height) -{ - if (height == m_height) - return; - - emit heightAboutToChange(height, currentCursor()->new_y(), currentScreenData()->scrollback()->height()); - - m_height = height; - - m_pty.setHeight(height, height * 10); - - emit heightChanged(); -} - -int Screen::height() const -{ - return m_height; -} - -int Screen::contentHeight() const -{ - return currentScreenData()->contentHeight(); -} - -void Screen::emitRequestWidth(int newWidth) -{ - emit requestWidthChange(newWidth); -} - -void Screen::setWidth(int width) -{ - if (width == m_width) - return; - - emit widthAboutToChange(width); - - m_width = width; - - m_pty.setWidth(width, width * 10); - - emit widthChanged(); -} - -int Screen::width() const -{ - return m_width; -} - -void Screen::useAlternateScreenBuffer() -{ - if (m_current_data == m_primary_data) { - disconnect(m_primary_data, SIGNAL(contentHeightChanged()), this, SIGNAL(contentHeightChanged())); - m_current_data = m_alternate_data; - m_current_data->clear(); - connect(m_alternate_data, SIGNAL(contentHeightChanged()), this, SIGNAL(contentHeightChanged())); - emit contentHeightChanged(); - } -} - -void Screen::useNormalScreenBuffer() -{ - if (m_current_data == m_alternate_data) { - disconnect(m_alternate_data, SIGNAL(contentHeightChanged()), this, SIGNAL(contentHeightChanged())); - m_current_data = m_primary_data; - connect(m_primary_data, SIGNAL(contentHeightChanged()), this, SIGNAL(contentHeightChanged())); - emit contentHeightChanged(); - } -} - -TextStyle Screen::defaultTextStyle() const -{ - TextStyle style; - style.style = TextStyle::Normal; - style.forground = ColorPalette::DefaultForground; - style.background = ColorPalette::DefaultBackground; - return style; -} - -void Screen::saveCursor() -{ - Cursor *new_cursor = new Cursor(this); - if (m_cursor_stack.size()) - m_cursor_stack.last()->setVisible(false); - m_cursor_stack << new_cursor; - m_new_cursors << new_cursor; -} - -void Screen::restoreCursor() -{ - if (m_cursor_stack.size() <= 1) - return; - - m_delete_cursors.append(m_cursor_stack.takeLast()); - m_cursor_stack.last()->setVisible(true); -} - -void Screen::clearScreen() -{ - currentScreenData()->clear(); -} - - -ColorPalette *Screen::colorPalette() const -{ - return m_palette; -} - -void Screen::fill(const QChar character) -{ - currentScreenData()->fill(character); -} - -void Screen::clear() -{ - fill(QChar(' ')); -} - -void Screen::setFastScroll(bool fast) -{ - m_fast_scroll = fast; -} - -bool Screen::fastScroll() const -{ - return m_fast_scroll; -} - -QPointF Screen::selectionAreaStart() const -{ - return m_selection_start; -} - -void Screen::setSelectionAreaStart(const QPointF &start) -{ - bool emitChanged = m_selection_start != start; - m_selection_start = start; - setSelectionValidity(); - if (emitChanged) - emit selectionAreaStartChanged(); -} - -QPointF Screen::selectionAreaEnd() const -{ - return m_selection_end; -} - -void Screen::setSelectionAreaEnd(const QPointF &end) -{ - bool emitChanged = m_selection_end != end; - m_selection_end = end; - setSelectionValidity(); - if (emitChanged) - emit selectionAreaEndChanged(); -} - -bool Screen::selectionEnabled() const -{ - return m_selection_valid; -} - -void Screen::setSelectionEnabled(bool enabled) -{ - bool emitchanged = m_selection_valid != enabled; - m_selection_valid = enabled; - if (emitchanged) - emit selectionEnabledChanged(); -} - -void Screen::sendSelectionToClipboard() const -{ - //currentScreenData()->sendSelectionToClipboard(m_selection_start, m_selection_end, QClipboard::Clipboard); -} - -void Screen::sendSelectionToSelection() const -{ - //currentScreenData()->sendSelectionToClipboard(m_selection_start, m_selection_end, QClipboard::Selection); -} - -void Screen::pasteFromSelection() -{ - m_pty.write(QGuiApplication::clipboard()->text(QClipboard::Selection).toUtf8()); -} - -void Screen::pasteFromClipboard() -{ - m_pty.write(QGuiApplication::clipboard()->text(QClipboard::Clipboard).toUtf8()); -} - -void Screen::doubleClicked(const QPointF &clicked) -{ - Q_UNUSED(clicked); - //int start, end; - //currentScreenData()->getDoubleClickSelectionArea(clicked, &start, &end); - //setSelectionAreaStart(QPointF(start,clicked.y())); - //setSelectionAreaEnd(QPointF(end,clicked.y())); -} - -void Screen::setTitle(const QString &title) -{ - m_title = title; - emit screenTitleChanged(); -} - -QString Screen::title() const -{ - return m_title; -} - -void Screen::scheduleFlash() -{ - m_flash = true; -} - -void Screen::printScreen() const -{ - currentScreenData()->printStyleInformation(); - qDebug() << "Total height: " << currentScreenData()->contentHeight(); -} - -void Screen::scheduleEventDispatch() -{ - if (!m_timer_event_id) { - m_timer_event_id = startTimer(1); - m_time_since_initiated.restart(); - } - - m_time_since_parsed.restart(); -} - -void Screen::dispatchChanges() -{ - if (m_old_current_data != m_current_data) { - m_old_current_data->releaseTextObjects(); - m_old_current_data = m_current_data; - } - - currentScreenData()->dispatchLineEvents(); - emit dispatchTextSegmentChanges(); - - static int max_to_delete_size = 0; - if (max_to_delete_size < m_to_delete.size()) { - max_to_delete_size = m_to_delete.size(); - qDebug() << "TO DELETE SIZE :" << max_to_delete_size; - } - - if (m_flash) { - m_flash = false; - emit flash(); - } - - for (int i = 0; i < m_delete_cursors.size(); i++) { - int new_index = m_new_cursors.indexOf(m_delete_cursors.at(i)); - if (new_index >= 0) - m_new_cursors.remove(new_index); - delete m_delete_cursors.at(i); - } - m_delete_cursors.clear(); - - for (int i = 0; i < m_new_cursors.size(); i++) { - emit cursorCreated(m_new_cursors.at(i)); - } - m_new_cursors.clear(); - - for (int i = 0; i < m_cursor_stack.size(); i++) { - m_cursor_stack[i]->dispatchEvents(); - } - - if (m_selection_valid && m_selection_moved) { - if (m_selection_start.y() < 0 || - m_selection_end.y() >= height()) { - setSelectionEnabled(false); - } else { - emit selectionAreaStartChanged(); - emit selectionAreaEndChanged(); - } - } -} - -void Screen::sendPrimaryDA() -{ - m_pty.write(QByteArrayLiteral("\033[?6c")); - -} - -void Screen::sendSecondaryDA() -{ - m_pty.write(QByteArrayLiteral("\033[>1;95;0c")); -} - -void Screen::setApplicationCursorKeysMode(bool enable) -{ - m_application_cursor_key_mode = enable; -} - -bool Screen::applicationCursorKeyMode() const -{ - return m_application_cursor_key_mode; -} - -void Screen::ensureVisiblePages(int top_line) -{ - currentScreenData()->ensureVisiblePages(top_line); -} - -static bool hasControll(Qt::KeyboardModifiers modifiers) -{ -#ifdef Q_OS_MAC - return modifiers & Qt::MetaModifier; -#else - return modifiers & Qt::ControlModifier; -#endif -} - -static bool hasMeta(Qt::KeyboardModifiers modifiers) -{ -#ifdef Q_OS_MAC - return modifiers & Qt::ControlModifier; -#else - return modifiers & Qt::MetaModifier; -#endif -} - -void Screen::sendKey(const QString &text, Qt::Key key, Qt::KeyboardModifiers modifiers) -{ - -// if (key == Qt::Key_Control) -// printScreen(); - /// UGH, this function should be re-written - char escape = '\0'; - char control = '\0'; - char code = '\0'; - QVector parameters; - bool found = true; - - switch(key) { - case Qt::Key_Up: - escape = C0::ESC; - if (m_application_cursor_key_mode) - control = C1_7bit::SS3; - else - control = C1_7bit::CSI; - - code = 'A'; - break; - case Qt::Key_Right: - escape = C0::ESC; - if (m_application_cursor_key_mode) - control = C1_7bit::SS3; - else - control = C1_7bit::CSI; - - code = 'C'; - break; - case Qt::Key_Down: - escape = C0::ESC; - if (m_application_cursor_key_mode) - control = C1_7bit::SS3; - else - control = C1_7bit::CSI; - - code = 'B'; - break; - case Qt::Key_Left: - escape = C0::ESC; - if (m_application_cursor_key_mode) - control = C1_7bit::SS3; - else - control = C1_7bit::CSI; - - code = 'D'; - break; - case Qt::Key_Insert: - escape = C0::ESC; - control = C1_7bit::CSI; - parameters.append(2); - code = '~'; - break; - case Qt::Key_Delete: - escape = C0::ESC; - control = C1_7bit::CSI; - parameters.append(3); - code = '~'; - break; - case Qt::Key_Home: - escape = C0::ESC; - control = C1_7bit::CSI; - parameters.append(1); - code = '~'; - break; - case Qt::Key_End: - escape = C0::ESC; - control = C1_7bit::CSI; - parameters.append(4); - code = '~'; - break; - case Qt::Key_PageUp: - escape = C0::ESC; - control = C1_7bit::CSI; - parameters.append(5); - code = '~'; - break; - case Qt::Key_PageDown: - escape = C0::ESC; - control = C1_7bit::CSI; - parameters.append(6); - code = '~'; - break; - case Qt::Key_F1: - case Qt::Key_F2: - case Qt::Key_F3: - case Qt::Key_F4: - if (m_application_cursor_key_mode) { - parameters.append((key & 0xff) - 37); - escape = C0::ESC; - control = C1_7bit::CSI; - code = '~'; - } - break; - case Qt::Key_F5: - case Qt::Key_F6: - case Qt::Key_F7: - case Qt::Key_F8: - case Qt::Key_F9: - case Qt::Key_F10: - case Qt::Key_F11: - case Qt::Key_F12: - if (m_application_cursor_key_mode) { - parameters.append((key & 0xff) - 36); - escape = C0::ESC; - control = C1_7bit::CSI; - code = '~'; - } - break; - case Qt::Key_Control: - case Qt::Key_Shift: - case Qt::Key_Alt: - case Qt::Key_AltGr: - return; - break; - default: - found = false; - } - - if (found) { - int term_mods = 0; - if (modifiers & Qt::ShiftModifier) - term_mods |= 1; - if (modifiers & Qt::AltModifier) - term_mods |= 2; - if (modifiers & Qt::ControlModifier) - term_mods |= 4; - - QByteArray toPty; - - if (term_mods) { - term_mods++; - parameters.append(term_mods); - } - if (escape) - toPty.append(escape); - if (control) - toPty.append(control); - if (parameters.size()) { - for (int i = 0; i < parameters.size(); i++) { - if (i) - toPty.append(';'); - toPty.append(QByteArray::number(parameters.at(i))); - } - } - if (code) - toPty.append(code); - m_pty.write(toPty); - - } else { - QString verifiedText = text.simplified(); - if (verifiedText.isEmpty()) { - switch (key) { - case Qt::Key_Return: - case Qt::Key_Enter: - verifiedText = "\r"; - break; - case Qt::Key_Backspace: - verifiedText = "\010"; - break; - case Qt::Key_Tab: - verifiedText = "\t"; - break; - case Qt::Key_Control: - case Qt::Key_Meta: - case Qt::Key_Alt: - case Qt::Key_Shift: - return; - case Qt::Key_Space: - verifiedText = " "; - break; - default: - return; - } - } - QByteArray to_pty; - QByteArray key_text; - if (hasControll(modifiers)) { - char key_char = verifiedText.toLocal8Bit().at(0); - key_text.append(key_char & 0x1F); - } else { - key_text = verifiedText.toUtf8(); - } - - if (modifiers & Qt::AltModifier) { - to_pty.append(C0::ESC); - } - - if (hasMeta(modifiers)) { - to_pty.append(C0::ESC); - to_pty.append('@'); - to_pty.append(FinalBytesNoIntermediate::Reserved3); - } - - to_pty.append(key_text); - m_pty.write(to_pty); - } -} - -YatPty *Screen::pty() -{ - return &m_pty; -} - -Text *Screen::createTextSegment(const TextStyleLine &style_line) -{ - Q_UNUSED(style_line); - Text *to_return; - if (m_to_delete.size()) { - to_return = m_to_delete.takeLast(); - to_return->setVisible(true); - } else { - to_return = new Text(this); - emit textCreated(to_return); - } - - return to_return; -} - -void Screen::releaseTextSegment(Text *text) -{ - m_to_delete.append(text); -} - -void Screen::readData(const QByteArray &data) -{ - m_parser.addData(data); - - scheduleEventDispatch(); -} - -void Screen::paletteChanged() -{ - QColor new_default = m_palette->normalColor(ColorPalette::DefaultBackground); - if (new_default != m_default_background) { - m_default_background = new_default; - emit defaultBackgroundColorChanged(); - } -} - -void Screen::setSelectionValidity() -{ - if (m_selection_end.y() > m_selection_start.y() || - (m_selection_end.y() == m_selection_start.y() && - m_selection_end.x() > m_selection_start.x())) { - setSelectionEnabled(true); - } else { - setSelectionEnabled(false); - } -} - - -void Screen::timerEvent(QTimerEvent *) -{ - if (m_timer_event_id && (m_time_since_parsed.elapsed() > 3 || m_time_since_initiated.elapsed() > 8)) { - killTimer(m_timer_event_id); - m_timer_event_id = 0; - dispatchChanges(); - } -} diff --git a/yat/backend/screen.h b/yat/backend/screen.h deleted file mode 100644 index 7502849..0000000 --- a/yat/backend/screen.h +++ /dev/null @@ -1,204 +0,0 @@ -/************************************************************************************************** -* Copyright (c) 2012 Jørgen Lind -* -* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and -* associated documentation files (the "Software"), to deal in the Software without restriction, -* including without limitation the rights to use, copy, modify, merge, publish, distribute, -* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is -* furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included in all copies or -* substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT -* NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT -* OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -* -***************************************************************************************************/ - -#ifndef TERMINALSCREEN_H -#define TERMINALSCREEN_H - -#include - -#include "color_palette.h" -#include "parser.h" -#include "yat_pty.h" -#include "text_style.h" - -#include -#include -#include -#include - -class Block; -class Cursor; -class Text; -class ScreenData; - -class Screen : public QObject -{ - Q_OBJECT - - Q_PROPERTY(int height READ height WRITE setHeight NOTIFY heightChanged) - Q_PROPERTY(int width READ width WRITE setWidth NOTIFY widthChanged) - Q_PROPERTY(int contentHeight READ contentHeight NOTIFY contentHeightChanged) - Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY screenTitleChanged) - Q_PROPERTY(bool selectionEnabled READ selectionEnabled NOTIFY selectionEnabledChanged) - Q_PROPERTY(QPointF selectionAreaStart READ selectionAreaStart WRITE setSelectionAreaStart NOTIFY selectionAreaStartChanged) - Q_PROPERTY(QPointF selectionAreaEnd READ selectionAreaEnd WRITE setSelectionAreaEnd NOTIFY selectionAreaEndChanged) - Q_PROPERTY(QColor defaultBackgroundColor READ defaultBackgroundColor NOTIFY defaultBackgroundColorChanged) - -public: - explicit Screen(QObject *parent = 0); - ~Screen(); - - void emitRequestHeight(int newHeight); - void setHeight(int height); - int height() const; - int contentHeight() const; - - void emitRequestWidth(int newWidth); - void setWidth(int width); - int width() const; - - ScreenData *currentScreenData() const { return m_current_data; } - void useAlternateScreenBuffer(); - void useNormalScreenBuffer(); - - Cursor *currentCursor() const { return m_cursor_stack.last(); } - void saveCursor(); - void restoreCursor(); - - TextStyle defaultTextStyle() const; - - QColor defaultForgroundColor() const; - QColor defaultBackgroundColor() const; - - ColorPalette *colorPalette() const; - - void clearScreen(); - - void fill(const QChar character); - void clear(); - - void setFastScroll(bool fast); - bool fastScroll() const; - - QPointF selectionAreaStart() const; - void setSelectionAreaStart(const QPointF &start); - QPointF selectionAreaEnd() const; - void setSelectionAreaEnd(const QPointF &end); - - bool selectionEnabled() const; - - Q_INVOKABLE void setSelectionEnabled(bool enabled); - Q_INVOKABLE void sendSelectionToClipboard() const; - Q_INVOKABLE void sendSelectionToSelection() const; - Q_INVOKABLE void pasteFromSelection(); - Q_INVOKABLE void pasteFromClipboard(); - - Q_INVOKABLE void doubleClicked(const QPointF &clicked); - - void setTitle(const QString &title); - QString title() const; - - void scheduleFlash(); - - Q_INVOKABLE void printScreen() const; - - void scheduleEventDispatch(); - void dispatchChanges(); - - void sendPrimaryDA(); - void sendSecondaryDA(); - - void setApplicationCursorKeysMode(bool enable); - bool applicationCursorKeyMode() const; - - Q_INVOKABLE void sendKey(const QString &text, Qt::Key key, Qt::KeyboardModifiers modifiers); - - YatPty *pty(); - - Q_INVOKABLE void ensureVisiblePages(int top_line); - Text *createTextSegment(const TextStyleLine &style_line); - void releaseTextSegment(Text *text); - -public slots: - void readData(const QByteArray &data); - void paletteChanged(); - -signals: - void reset(); - - void flash(); - - void dispatchLineChanges(); - void dispatchTextSegmentChanges(); - - void selectionAreaStartChanged(); - void selectionAreaEndChanged(); - void selectionEnabledChanged(); - - void screenTitleChanged(); - - void textCreated(Text *text); - void cursorCreated(Cursor *cursor); - - void requestHeightChange(int newHeight); - void heightAboutToChange(int height, int currentCursorLine, int currentScrollBackHeight); - void heightChanged(); - void contentHeightChanged(); - - void requestWidthChange(int newWidth); - void widthAboutToChange(int width); - void widthChanged(); - - void defaultBackgroundColorChanged(); -protected: - void timerEvent(QTimerEvent *); - -private: - void setSelectionValidity(); - - ColorPalette *m_palette; - YatPty m_pty; - Parser m_parser; - QElapsedTimer m_time_since_parsed; - QElapsedTimer m_time_since_initiated; - - int m_timer_event_id; - int m_width; - int m_height; - - ScreenData *m_primary_data; - ScreenData *m_alternate_data; - ScreenData *m_current_data; - ScreenData *m_old_current_data; - - QVector m_cursor_stack; - QVector m_new_cursors; - QVector m_delete_cursors; - - QString m_title; - - bool m_selection_valid; - bool m_selection_moved; - QPointF m_selection_start; - QPointF m_selection_end; - - bool m_flash; - bool m_cursor_changed; - bool m_application_cursor_key_mode; - bool m_fast_scroll; - - QVector m_to_delete; - - QColor m_default_background; - - friend class ScreenData; -}; - -#endif // TERMINALSCREEN_H diff --git a/yat/backend/screen_data.cpp b/yat/backend/screen_data.cpp deleted file mode 100644 index d496925..0000000 --- a/yat/backend/screen_data.cpp +++ /dev/null @@ -1,460 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 Jørgen Lind -* -* Permission is hereby granted, free of charge, to any person obtaining a copy -* of this software and associated documentation files (the "Software"), to deal -* in the Software without restriction, including without limitation the rights -* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -* copies of the Software, and to permit persons to whom the Software is -* furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included in -* all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -* SOFTWARE. -* -*******************************************************************************/ - -#include "screen_data.h" - -#include "block.h" -#include "screen.h" -#include "scrollback.h" -#include "cursor.h" - -#include - -#include -#include - -ScreenData::ScreenData(size_t max_scrollback, Screen *screen) - : QObject(screen) - , m_screen(screen) - , m_scrollback(new Scrollback(max_scrollback, this)) - , m_screen_height(0) - , m_height(0) - , m_width(0) - , m_block_count(0) - , m_old_total_lines(0) -{ - connect(screen, SIGNAL(heightAboutToChange(int, int, int)), this, SLOT(setHeight(int, int, int))); - connect(screen, SIGNAL(widthAboutToChange(int)), this, SLOT(setWidth(int))); -} - -ScreenData::~ScreenData() -{ - for (auto it = m_screen_blocks.begin(); it != m_screen_blocks.end(); ++it) { - delete *it; - } - delete m_scrollback; -} - - -int ScreenData::contentHeight() const -{ - return m_height + m_scrollback->height(); -} - -void ScreenData::setHeight(int height, int currentCursorLine, int currentContentHeight) -{ - Q_UNUSED(currentContentHeight); - m_screen_height = height; - if (height == m_height) - return; - - if (m_height > height) { - const int to_remove = m_height - height; - const int remove_from_end = std::min((m_height -1) - currentCursorLine, to_remove); - const int remove_from_start = to_remove - remove_from_end; - - if (remove_from_end) { - remove_lines_from_end(remove_from_end); - } - if (remove_from_start) { - push_at_most_to_scrollback(remove_from_start); - } - } else { - ensure_at_least_height(height); - } -} - -void ScreenData::setWidth(int width) -{ - m_width = width; - - for (Block *block : m_screen_blocks) { - int before_count = block->lineCount(); - block->setWidth(width); - m_height += block->lineCount() - before_count; - } - - if (m_height > m_screen_height) { - push_at_most_to_scrollback(m_height - m_screen_height); - } else { - ensure_at_least_height(m_screen_height); - } - - m_scrollback->setWidth(width); -} - - -void ScreenData::clearToEndOfLine(const QPoint &point) -{ - auto it = it_for_row_ensure_single_line_block(point.y()); - (*it)->clearToEnd(point.x()); -} - -void ScreenData::clearToEndOfScreen(int y) -{ - auto it = it_for_row_ensure_single_line_block(y); - while(it != m_screen_blocks.end()) { - clearBlock(it); - ++it; - } -} - -void ScreenData::clearToBeginningOfLine(const QPoint &point) -{ - auto it = it_for_row_ensure_single_line_block(point.y()); - (*it)->clearCharacters(0,point.x()); -} - -void ScreenData::clearToBeginningOfScreen(int y) -{ - auto it = it_for_row_ensure_single_line_block(y); - if (it != m_screen_blocks.end()) - (*it)->clear(); - while(it != m_screen_blocks.begin()) { - --it; - clearBlock(it); - } -} - -void ScreenData::clearLine(const QPoint &point) -{ - (*it_for_row_ensure_single_line_block(point.y()))->clear(); -} - -void ScreenData::clear() -{ - for (auto it = m_screen_blocks.begin(); it != m_screen_blocks.end(); ++it) { - clearBlock(it); - } -} - -void ScreenData::releaseTextObjects() -{ - for (auto it = m_screen_blocks.begin(); it != m_screen_blocks.end(); ++it) { - (*it)->releaseTextObjects(); - } -} - -void ScreenData::clearCharacters(const QPoint &point, int to) -{ - auto it = it_for_row_ensure_single_line_block(point.y()); - (*it)->clearCharacters(point.x(),to); -} - -void ScreenData::deleteCharacters(const QPoint &point, int to) -{ - auto it = it_for_row(point.y()); - if (it == m_screen_blocks.end()) - return; - - int line_in_block = point.y() - (*it)->index(); - int chars_to_line = line_in_block * m_width; - - (*it)->deleteCharacters(chars_to_line + point.x(), chars_to_line + to); -} - -CursorDiff ScreenData::replace(const QPoint &point, const QString &text, const TextStyle &style, bool only_latin) -{ - return modify(point,text,style,true, only_latin); -} - -CursorDiff ScreenData::insert(const QPoint &point, const QString &text, const TextStyle &style, bool only_latin) -{ - return modify(point,text,style,false, only_latin); -} - - -void ScreenData::moveLine(int from, int to) -{ - if (from == to) - return; - - if (to > from) - to++; - auto from_it = it_for_row_ensure_single_line_block(from); - auto to_it = it_for_row_ensure_single_line_block(to); - - (*from_it)->clear(); - m_screen_blocks.splice(to_it, m_screen_blocks, from_it); -} - -void ScreenData::insertLine(int row, int topMargin) -{ - auto row_it = it_for_row(row + 1); - - if (!topMargin && m_height - m_screen_blocks.front()->lineCount() >= m_screen_height) { - push_at_most_to_scrollback(1); - } else { - auto row_top_margin = it_for_row_ensure_single_line_block(topMargin); - if (row == topMargin) { - (*row_top_margin)->clear(); - return; - } - delete (*row_top_margin); - m_screen_blocks.erase(row_top_margin); - m_height--; - m_block_count--; - } - - Block *block_to_insert = new Block(m_screen); - m_screen_blocks.insert(row_it,block_to_insert); - m_height++; - m_block_count++; -} - - -void ScreenData::fill(const QChar &character) -{ - clear(); - auto it = --m_screen_blocks.end(); - for (int i = 0; i < m_block_count; --it, i++) { - QString fill_str(m_screen->width(), character); - (*it)->replaceAtPos(0, fill_str, m_screen->defaultTextStyle()); - } -} - -void ScreenData::dispatchLineEvents() -{ - if (!m_block_count) - return; - const int content_height = contentHeight(); - int i = 0; - for (auto it = m_screen_blocks.begin(); it != m_screen_blocks.end(); ++it) { - int line = content_height - m_height + i; - (*it)->setIndex(line); - (*it)->dispatchEvents(); - i+= (*it)->lineCount(); - } - - if (content_height != m_old_total_lines) { - m_old_total_lines = contentHeight(); - emit contentHeightChanged(); - } -} - -void ScreenData::printRuler(QDebug &debug) const -{ - QString ruler = QString("|----i----").repeated((m_width/10)+1).append("|"); - debug << " " << (void *) this << ruler; -} - -void ScreenData::printStyleInformation() const -{ - auto it = m_screen_blocks.end(); - std::advance(it, -m_block_count); - for (int i = 0; it != m_screen_blocks.end(); ++it, i++) { - if (i % 5 == 0) { - QDebug debug = qDebug(); - debug << "Ruler:"; - printRuler(debug); - } - QDebug debug = qDebug(); - (*it)->printStyleList(debug); - } - qDebug() << "On screen height" << m_height; -} - -Screen *ScreenData::screen() const -{ - return m_screen; -} - -void ScreenData::ensureVisiblePages(int top_line) -{ - m_scrollback->ensureVisiblePages(top_line); -} - -Scrollback *ScreenData::scrollback() const -{ - return m_scrollback; -} - -CursorDiff ScreenData::modify(const QPoint &point, const QString &text, const TextStyle &style, bool replace, bool only_latin) -{ - auto it = it_for_row(point.y()); - Block *block = *it; - int start_char = (point.y() - block->index()) * m_width + point.x(); - size_t lines_before = block->lineCount(); - int lines_changed = - block->lineCountAfterModified(start_char, text.size(), replace) - lines_before; - m_height += lines_changed; - if (lines_changed > 0) { - int removed = 0; - auto to_merge_inn = it; - ++to_merge_inn; - while(removed < lines_changed && to_merge_inn != m_screen_blocks.end()) { - Block *to_be_reduced = *to_merge_inn; - bool remove_block = removed + to_be_reduced->lineCount() <= lines_changed; - int lines_to_remove = remove_block ? to_be_reduced->lineCount() : to_be_reduced->lineCount() - (lines_changed - removed); - block->moveLinesFromBlock(to_be_reduced, 0, lines_to_remove); - removed += lines_to_remove; - if (remove_block) { - delete to_be_reduced; - to_merge_inn = m_screen_blocks.erase(to_merge_inn); - m_block_count--; - } else { - ++to_merge_inn; - } - } - - m_height -= removed; - } - - if (m_height > m_screen_height) - push_at_most_to_scrollback(m_height - m_screen_height); - - if (replace) { - block->replaceAtPos(start_char, text, style, only_latin); - } else { - block->insertAtPos(start_char, text, style, only_latin); - } - int end_char = (start_char + text.size()) % m_width; - if (end_char == 0) - end_char = m_width -1; - return { lines_changed, end_char - point.x()}; -} - -void ScreenData::clearBlock(std::list::iterator line) -{ - int before_count = (*line)->lineCount(); - (*line)->clear(); - int diff_line = before_count - (*line)->lineCount(); - if (diff_line > 0) { - ++line; - for (int i = 0; i < diff_line; i++) { - m_screen_blocks.insert(line, new Block(m_screen)); - } - m_block_count+=diff_line; - } -} - -std::list::iterator ScreenData::it_for_row_ensure_single_line_block(int row) -{ - auto it = it_for_row(row); - int index = (*it)->index(); - int lines = (*it)->lineCount(); - - if (index == row && lines == 1) { - return it; - } - - int line_diff = row - index; - return split_out_row_from_block(it, line_diff); -} - -std::list::iterator ScreenData::split_out_row_from_block(std::list::iterator it, int row_in_block) -{ - int lines = (*it)->lineCount(); - - if (row_in_block == 0 && lines == 1) - return it; - - if (row_in_block == 0) { - auto insert_before = (*it)->takeLine(0); - insert_before->setIndex(row_in_block); - m_block_count++; - return m_screen_blocks.insert(it,insert_before); - } else if (row_in_block == lines -1) { - auto insert_after = (*it)->takeLine(lines -1); - insert_after->setIndex(row_in_block); - ++it; - m_block_count++; - return m_screen_blocks.insert(it, insert_after); - } - - auto half = (*it)->split(row_in_block); - ++it; - auto it_width_first = m_screen_blocks.insert(it, half); - auto the_one = half->takeLine(0); - m_block_count+=2; - return m_screen_blocks.insert(it_width_first,the_one); -} - -void ScreenData::push_at_most_to_scrollback(int lines) -{ - int pushed = 0; - auto it = m_screen_blocks.begin(); - while (it != m_screen_blocks.end() && pushed + (*it)->lineCount() <= lines) { - m_block_count--; - const int block_height = (*it)->lineCount(); - m_height -= block_height; - pushed += block_height; - m_scrollback->addBlock(*it); - it = m_screen_blocks.erase(it); - } -} - -void ScreenData::reclaim_at_least(int lines) -{ - int lines_reclaimed = 0; - while (m_scrollback->blockCount() && lines_reclaimed < lines) { - Block *block = m_scrollback->reclaimBlock(); - m_height += block->lineCount(); - lines_reclaimed += block->lineCount(); - m_block_count++; - m_screen_blocks.push_front(block); - } -} - -void ScreenData::remove_lines_from_end(int lines) -{ - int removed = 0; - auto it = m_screen_blocks.end(); - while (it != m_screen_blocks.begin() && removed < lines) { - --it; - const int block_height = (*it)->lineCount(); - if (removed + block_height <= lines) { - removed += block_height; - m_height -= block_height; - m_block_count--; - delete (*it); - it = m_screen_blocks.erase(it); - } else { - const int to_remove = lines - removed; - removed += to_remove; - m_height -= to_remove; - Block *block = *it; - for (int i = 0; i < to_remove; i++) { - block->removeLine(block->lineCount()-1); - } - } - } -} - -void ScreenData::ensure_at_least_height(int height) -{ - if (m_height > height) - return; - - int to_grow = height - m_height; - reclaim_at_least(to_grow); - - if (height > m_height) { - int to_insert = height - m_height; - for (int i = 0; i < to_insert; i++) { - m_screen_blocks.push_back(new Block(m_screen)); - } - m_height += to_insert; - m_block_count += to_insert; - } -} diff --git a/yat/backend/screen_data.h b/yat/backend/screen_data.h deleted file mode 100644 index 26aad09..0000000 --- a/yat/backend/screen_data.h +++ /dev/null @@ -1,132 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 Jørgen Lind -* -* Permission is hereby granted, free of charge, to any person obtaining a copy -* of this software and associated documentation files (the "Software"), to deal -* in the Software without restriction, including without limitation the rights -* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -* copies of the Software, and to permit persons to whom the Software is -* furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included in -* all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -* SOFTWARE. -* -*******************************************************************************/ - -#ifndef SCREENDATA_H -#define SCREENDATA_H - -#include "text_style.h" -#include "block.h" - -#include -#include -#include -#include - -class Screen; -class Scrollback; - -class CursorDiff -{ -public: - int line; - int character; -}; - -class ScreenData : public QObject -{ -Q_OBJECT -public: - ScreenData(size_t max_scrollback, Screen *screen); - ~ScreenData(); - - int contentHeight() const; - - void clearToEndOfLine(const QPoint &pos); - void clearToEndOfScreen(int y); - void clearToBeginningOfLine(const QPoint &pos); - void clearToBeginningOfScreen(int y); - void clearLine(const QPoint &pos); - void clear(); - void releaseTextObjects(); - - void clearCharacters(const QPoint &pos, int to); - void deleteCharacters(const QPoint &pos, int to); - - CursorDiff replace(const QPoint &pos, const QString &text, const TextStyle &style, bool only_latin); - CursorDiff insert(const QPoint &pos, const QString &text, const TextStyle &style, bool only_latin); - - void moveLine(int from, int to); - void insertLine(int insertAt, int topMargin); - - void fill(const QChar &character); - - void dispatchLineEvents(); - - void printRuler(QDebug &debug) const; - void printStyleInformation() const; - - Screen *screen() const; - - void ensureVisiblePages(int top_line); - - Scrollback *scrollback() const; - - inline std::list::iterator it_for_row(int row); -public slots: - void setHeight(int height, int currentCursorLine, int currentContentHeight); - void setWidth(int width); - -signals: - void contentHeightChanged(); - -private: - CursorDiff modify(const QPoint &pos, const QString &text, const TextStyle &style, bool replace, bool only_latin); - void clearBlock(std::list::iterator line); - std::list::iterator it_for_row_ensure_single_line_block(int row); - std::list::iterator split_out_row_from_block(std::list::iterator block_it, int row_in_block); - void push_at_most_to_scrollback(int lines); - void reclaim_at_least(int lines); - void remove_lines_from_end(int lines); - void ensure_at_least_height(int height); - Screen *m_screen; - Scrollback *m_scrollback; - int m_screen_height; - int m_height; - int m_width; - int m_block_count; - int m_old_total_lines; - - std::list m_screen_blocks; -}; - -std::list::iterator ScreenData::it_for_row(int row) -{ - auto it = m_screen_blocks.end(); - int line_for_block = m_screen_height; - while (it != m_screen_blocks.begin()) { - --it; - int end_line = line_for_block - 1; - line_for_block -= (*it)->lineCount(); - if (line_for_block <= row && end_line >= row) { - (*it)->setIndex(line_for_block); - return it; - } - - if (end_line < row) { - break; - } - } - - return m_screen_blocks.end(); -} -#endif // SCREENDATA_H diff --git a/yat/backend/scrollback.cpp b/yat/backend/scrollback.cpp deleted file mode 100644 index 7bf2a14..0000000 --- a/yat/backend/scrollback.cpp +++ /dev/null @@ -1,201 +0,0 @@ -/****************************************************************************** -* Copyright (c) 2013 Jørgen Lind -* -* Permission is hereby granted, free of charge, to any person obtaining a copy -* of this software and associated documentation files (the "Software"), to deal -* in the Software without restriction, including without limitation the rights -* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -* copies of the Software, and to permit persons to whom the Software is -* furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included in -* all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -* SOFTWARE. -* -******************************************************************************/ - -#include "scrollback.h" - -#include "screen_data.h" -#include "screen.h" -#include "block.h" - -#define P_VAR(variable) \ - #variable ":" << variable - -Scrollback::Scrollback(size_t max_size, ScreenData *screen_data) - : m_screen_data(screen_data) - , m_height(0) - , m_width(0) - , m_block_count(0) - , m_max_size(max_size) - , m_adjust_visible_pages(0) -{ -} - -void Scrollback::addBlock(Block *block) -{ - m_blocks.push_back(block); - block->releaseTextObjects(); - m_block_count++; - m_height += m_blocks.back()->lineCount(); - if (!m_max_size || m_height == m_max_size - 1) { - m_block_count--; - m_height -= m_blocks.front()->lineCount(); - delete m_blocks.front(); - m_blocks.pop_front(); - m_adjust_visible_pages++; - } - m_visible_pages.clear(); -} - -Block *Scrollback::reclaimBlock() -{ - if (m_blocks.empty()) - return nullptr; - - Block *last = m_blocks.back(); - last->setWidth(m_width); - m_block_count--; - m_height -= last->lineCount(); - m_blocks.pop_back(); - - m_visible_pages.clear(); - return last; -} - -void Scrollback::ensureVisiblePages(int top_line) -{ - if (top_line < 0) - return; - if (size_t(top_line) >= m_height) - return; - - uint height = std::max(m_screen_data->screen()->height(), 1); - - int complete_pages = m_height / height; - int remainder = m_height - (complete_pages * height); - - int top_page = top_line / height; - int bottom_page = top_page + 1; - - std::set pages_to_update; - pages_to_update.insert(top_page); - if (bottom_page * height < m_height) - pages_to_update.insert(bottom_page); - - for (auto it = m_visible_pages.begin(); it != m_visible_pages.end(); ++it) { - Page &page = *it; - if (pages_to_update.count(page.page_no) != 0) { - if (page.page_no < complete_pages) { - ensurePageVisible(page, height); - } else if (page.page_no == complete_pages) { - ensurePageVisible(page, remainder); - } - pages_to_update.erase(page.page_no); - } else { - ensurePageNotVisible(page); - auto to_remove = it; - --it; - m_visible_pages.erase(to_remove); - } - } - - for (auto it = pages_to_update.begin(); it != pages_to_update.end(); ++it) { - auto page_it = findIteratorForPage(*it); - m_visible_pages.push_back( { *it, 0, page_it } ); - if (*it < complete_pages) { - ensurePageVisible(m_visible_pages.back(), height); - } else if (*it == complete_pages) { - ensurePageVisible(m_visible_pages.back(), remainder); - } - } -} - -void Scrollback::ensurePageVisible(Page &page, int new_height) -{ - if (page.size == new_height || !m_block_count) - return; - - int line_no = page.page_no * m_screen_data->screen()->height(); - auto it = page.it; - std::advance(it, page.size); - for (int i = page.size; i < new_height; ++it, i++) { - (*it)->setIndex(line_no + i); - (*it)->dispatchEvents(); - } - page.size = new_height; -} - -void Scrollback::ensurePageNotVisible(Page &page) -{ - auto it = page.it; - for (int i = 0; i < page.size; ++it, i++) { - (*it)->releaseTextObjects(); - } - page.size = 0; -} - -std::list::iterator Scrollback::findIteratorForPage(int page_no) -{ - uint line = page_no * m_screen_data->screen()->height(); - Q_ASSERT(line < m_height); - for (auto it = m_visible_pages.begin(); it != m_visible_pages.end(); ++it) { - Page &page = *it; - int diff = page_no - page.page_no; - if (diff < 5 && diff > 5) { - auto to_return = page.it; - int advance = diff * m_screen_data->screen()->height(); - std::advance(to_return, advance); - return to_return; - } - } - - if (line > m_height / 2) { - auto to_return = m_blocks.end(); - std::advance(to_return, line - m_height); - return to_return; - } - - auto to_return = m_blocks.begin(); - std::advance(to_return, line); - return to_return; -} - -void Scrollback::adjustVisiblePages() -{ - if (!m_adjust_visible_pages) - return; - - for (auto it = m_visible_pages.begin(); it != m_visible_pages.end(); ++it) { - Page &page = *it; - const size_t line_for_page = page.page_no * m_screen_data->screen()->height(); - if (line_for_page < m_adjust_visible_pages) { - auto to_remove = it; - --it; - m_visible_pages.erase(to_remove); - } else { - page.size = 0; - std::advance(page.it, m_adjust_visible_pages); - } - } - - m_adjust_visible_pages = 0; -} - -size_t Scrollback::height() const -{ - return m_height; -} - -void Scrollback::setWidth(int width) -{ - m_width = width; -} diff --git a/yat/backend/scrollback.h b/yat/backend/scrollback.h deleted file mode 100644 index fbab87b..0000000 --- a/yat/backend/scrollback.h +++ /dev/null @@ -1,70 +0,0 @@ -/****************************************************************************** -* Copyright (c) 2013 Jørgen Lind -* -* Permission is hereby granted, free of charge, to any person obtaining a copy -* of this software and associated documentation files (the "Software"), to deal -* in the Software without restriction, including without limitation the rights -* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -* copies of the Software, and to permit persons to whom the Software is -* furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included in -* all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -* SOFTWARE. -* -******************************************************************************/ - -#ifndef SCROLLBACK_H -#define SCROLLBACK_H - -#include -#include - -#include -class ScreenData; -class Block; - -struct Page { - int page_no; - int size; - std::list::iterator it; -}; - -class Scrollback -{ -public: - Scrollback(size_t max_size, ScreenData *screen_data); - - void addBlock(Block *block); - Block *reclaimBlock(); - void ensureVisiblePages(int top_line); - - size_t height() const; - - void setWidth(int width); - - size_t blockCount() { return m_block_count; } -private: - void ensurePageVisible(Page &page, int new_height); - void ensurePageNotVisible(Page &page); - std::list::iterator findIteratorForPage(int page_no); - void adjustVisiblePages(); - ScreenData *m_screen_data; - - std::list m_blocks; - std::list m_visible_pages; - size_t m_height; - size_t m_width; - size_t m_block_count; - size_t m_max_size; - size_t m_adjust_visible_pages; -}; - -#endif //SCROLLBACK_H diff --git a/yat/backend/selection.cpp b/yat/backend/selection.cpp deleted file mode 100644 index fbf754e..0000000 --- a/yat/backend/selection.cpp +++ /dev/null @@ -1,197 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2013 Jørgen Lind -* -* Permission is hereby granted, free of charge, to any person obtaining a copy -* of this software and associated documentation files (the "Software"), to deal -* in the Software without restriction, including without limitation the rights -* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -* copies of the Software, and to permit persons to whom the Software is -* furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included in -* all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -* SOFTWARE. -* -*******************************************************************************/ - -#include "selection.h" - -#include "screen.h" -#include "screen_data.h" - -#include - -Selection::Selection(Screen *screen) - : QObject(screen) - , m_screen(screen) - , m_new_start_x(0) - , m_start_x(0) - , m_new_start_y(0) - , m_start_y(0) - , m_new_end_x(0) - , m_end_x(0) - , m_new_end_y(0) - , m_end_y(0) - , m_new_enable(false) -{ - connect(screen, &Screen::contentModified, this, &Selection::screenContentModified); - -} - -void Selection::setStartX(int x) -{ - if (x != m_new_start_x) { - m_new_start_x = x; - setValidity(); - m_screen->scheduleEventDispatch(); - } -} - -int Selection::startX() const -{ - return m_start_x; -} - -void Selection::setStartY(int y) -{ - if (y != m_new_start_y) { - m_new_start_y = y; - setValidity(); - m_screen->scheduleEventDispatch(); - } -} - -int Selection::startY() const -{ - return m_start_y; -} - -void Selection::setEndX(int x) -{ - if (m_new_end_x != x) { - m_new_end_x = x; - setValidity(); - m_screen->scheduleEventDispatch(); - } -} - -int Selection::endX() const -{ - return m_end_x; -} - -void Selection::setEndY(int y) -{ - if (m_new_end_y != y) { - m_new_end_y = y; - setValidity(); - m_screen->scheduleEventDispatch(); - } -} - -int Selection::endY() const -{ - return m_end_y; -} - -void Selection::setEnable(bool enable) -{ - if (m_new_enable != enable) { - m_new_enable = enable; - m_screen->scheduleEventDispatch(); - } -} - -void Selection::screenContentModified(size_t lineModified, int lineDiff, int contentDiff) -{ - if (!m_new_enable) - return; - - if (lineModified >= size_t(m_new_start_y) && lineModified <= size_t(m_new_end_y)) { - setEnable(false); - return; - } - - if (size_t(m_new_end_y) < lineModified && lineModified != contentDiff) { - m_new_end_y -= lineDiff - contentDiff; - m_new_start_y -= lineDiff - contentDiff; - if (m_new_end_y < 0) { - setEnable(false); - return; - } - if (m_new_start_y < 0) { - m_new_start_y = 0; - } - m_screen->scheduleEventDispatch(); - } -} - -void Selection::setValidity() -{ - if (m_new_end_y > m_new_start_y || - (m_new_end_y == m_new_start_y && - m_new_end_x > m_new_start_x)) { - setEnable(true); - } else { - setEnable(false); - } -} - -void Selection::sendToClipboard() const -{ - m_screen->currentScreenData()->sendSelectionToClipboard(start_new_point(), end_new_point(), QClipboard::Clipboard); -} - -void Selection::sendToSelection() const -{ - m_screen->currentScreenData()->sendSelectionToClipboard(start_new_point(), end_new_point(), QClipboard::Selection); -} - -void Selection::pasteFromSelection() -{ - m_screen->pty()->write(QGuiApplication::clipboard()->text(QClipboard::Selection).toUtf8()); -} - -void Selection::pasteFromClipboard() -{ - m_screen->pty()->write(QGuiApplication::clipboard()->text(QClipboard::Clipboard).toUtf8()); -} - -void Selection::dispatchChanges() -{ - if (!m_new_enable && !m_enable) - return; - - if (m_new_start_y != m_start_y) { - m_start_y = m_new_start_y; - emit startYChanged(); - } - if (m_new_start_x != m_start_x) { - m_start_x = m_new_start_x; - emit startXChanged(); - } - if (m_new_end_y != m_end_y) { - m_end_y = m_new_end_y; - emit endYChanged(); - } - if (m_new_end_x != m_end_x) { - m_end_x = m_new_end_x; - emit endXChanged(); - } - if (m_new_enable != m_enable) { - m_enable = m_new_enable; - emit enableChanged(); - } -} - -bool Selection::enable() const -{ - return m_enable; -} diff --git a/yat/backend/selection.h b/yat/backend/selection.h deleted file mode 100644 index b16716c..0000000 --- a/yat/backend/selection.h +++ /dev/null @@ -1,93 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2013 Jørgen Lind -* -* Permission is hereby granted, free of charge, to any person obtaining a copy -* of this software and associated documentation files (the "Software"), to deal -* in the Software without restriction, including without limitation the rights -* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -* copies of the Software, and to permit persons to whom the Software is -* furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included in -* all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -* SOFTWARE. -* -*******************************************************************************/ - -#ifndef SELECTION_H -#define SELECTION_H - -#include -#include - -class Screen; - -class Selection : public QObject -{ - Q_OBJECT - - Q_PROPERTY(int startX READ startX WRITE setStartX NOTIFY startXChanged) - Q_PROPERTY(int startY READ startY WRITE setStartY NOTIFY startYChanged) - Q_PROPERTY(int endX READ endX WRITE setEndX NOTIFY endXChanged) - Q_PROPERTY(int endY READ endY WRITE setEndY NOTIFY endYChanged) - Q_PROPERTY(bool enable READ enable WRITE setEnable NOTIFY enableChanged) - -public: - explicit Selection(Screen *screen); - - void setStartX(int x); - int startX() const; - - void setStartY(int y); - int startY() const; - - void setEndX(int x); - int endX() const; - - void setEndY(int y); - int endY() const; - - void setEnable(bool enabled); - bool enable() const; - - Q_INVOKABLE void sendToClipboard() const; - Q_INVOKABLE void sendToSelection() const; - Q_INVOKABLE void pasteFromSelection(); - Q_INVOKABLE void pasteFromClipboard(); - - void dispatchChanges(); -signals: - void startXChanged(); - void startYChanged(); - void endXChanged(); - void endYChanged(); - void enableChanged(); - -private slots: - void screenContentModified(size_t lineModified, int lineDiff, int contentDiff); - -private: - void setValidity(); - QPoint start_new_point() const { return QPoint(m_new_start_x, m_new_start_y); } - QPoint end_new_point() const { return QPoint(m_new_end_x, m_new_end_y); } - - Screen *m_screen; - int m_new_start_x; - int m_start_x; - int m_new_start_y; - int m_start_y; - int m_new_end_x; - int m_end_x; - int m_new_end_y; - int m_end_y; - bool m_new_enable; - bool m_enable; -}; -#endif diff --git a/yat/backend/text.cpp b/yat/backend/text.cpp deleted file mode 100644 index 4d2247e..0000000 --- a/yat/backend/text.cpp +++ /dev/null @@ -1,255 +0,0 @@ -/************************************************************************************************** -* Copyright (c) 2012 Jørgen Lind -* -* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and -* associated documentation files (the "Software"), to deal in the Software without restriction, -* including without limitation the rights to use, copy, modify, merge, publish, distribute, -* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is -* furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included in all copies or -* substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT -* NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT -* OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -* -***************************************************************************************************/ - -#include "text.h" - -#include "screen.h" -#include "block.h" -#include - -#include - -Text::Text(Screen *screen) - : QObject(screen) - , m_screen(screen) - , m_text_line(0) - , m_start_index(0) - , m_old_start_index(0) - , m_end_index(0) - , m_line(0) - , m_old_line(0) - , m_width(1) - , m_style_dirty(true) - , m_text_dirty(true) - , m_visible(true) - , m_visible_old(true) - , m_latin(true) - , m_latin_old(true) - , m_forgroundColor(m_screen->defaultForgroundColor()) - , m_backgroundColor(m_screen->defaultBackgroundColor()) -{ - connect(m_screen->colorPalette(), SIGNAL(changed()), this, SLOT(paletteChanged())); - connect(m_screen, SIGNAL(dispatchTextSegmentChanges()), this, SLOT(dispatchEvents())); -} - -Text::~Text() -{ -} - -int Text::index() const -{ - return m_start_index % m_width; -} - -int Text::line() const -{ - return m_line + (m_start_index / m_width); -} - -void Text::setLine(int line, int width, const QString *textLine) -{ - m_line = line; - m_width = width; - m_text_dirty = true; - m_text_line = textLine; -} - -bool Text::visible() const -{ - return m_visible; -} - -void Text::setVisible(bool visible) -{ - m_visible = visible; -} - -QString Text::text() const -{ - return m_text; -} - -QColor Text::foregroundColor() const -{ - return m_forgroundColor; -} - - -QColor Text::backgroundColor() const -{ - return m_backgroundColor; -} - -void Text::setStringSegment(int start_index, int end_index, bool text_changed) -{ - m_start_index = start_index; - m_end_index = end_index; - - m_text_dirty = text_changed; -} - -void Text::setTextStyle(const TextStyle &style) -{ - m_new_style = style; - m_style_dirty = true; -} - -bool Text::bold() const -{ - return m_style.style & TextStyle::Bold; -} - -bool Text::blinking() const -{ - return m_style.style & TextStyle::Blinking; -} - -bool Text::underline() const -{ - return m_style.style & TextStyle::Underlined; -} - -void Text::setLatin(bool latin) -{ - m_latin = latin; -} - -bool Text::latin() const -{ - return m_latin_old; -} - -static bool differentStyle(TextStyle::Styles a, TextStyle::Styles b, TextStyle::Style style) -{ - return (a & style) != (b & style); -} - -void Text::dispatchEvents() -{ - int old_line = m_old_line + (m_old_start_index / m_width); - int new_line = m_line + (m_start_index / m_width); - if (old_line != new_line) { - m_old_line = m_line; - emit lineChanged(); - } - - if (m_latin != m_latin_old) { - m_latin_old = m_latin; - emit latinChanged(); - } - - if (m_old_start_index != m_start_index - || m_text_dirty) { - m_text_dirty = false; - QString old_text = m_text; - m_text = m_text_line->mid(m_start_index, m_end_index - m_start_index + 1); - if (m_old_start_index != m_start_index) { - m_old_start_index = m_start_index; - emit indexChanged(); - } - emit textChanged(); - } - - if (m_style_dirty) { - m_style_dirty = false; - - bool emit_forground = m_new_style.forground != m_style.forground; - bool emit_background = m_new_style.background != m_style.background; - TextStyle::Styles new_style = m_new_style.style; - TextStyle::Styles old_style = m_style.style; - - bool emit_bold = false; - bool emit_blink = false; - bool emit_underline = false; - bool emit_inverse = false; - if (new_style != old_style) { - emit_bold = differentStyle(new_style, old_style, TextStyle::Bold); - emit_blink = differentStyle(new_style, old_style, TextStyle::Blinking); - emit_underline = differentStyle(new_style, old_style, TextStyle::Underlined); - emit_inverse = differentStyle(new_style, old_style, TextStyle::Inverse); - } - - m_style = m_new_style; - if (emit_inverse) { - setForgroundColor(); - setBackgroundColor(); - } else { - if (emit_forground || emit_bold) { - setForgroundColor(); - } - if (emit_background) { - setBackgroundColor(); - } - } - - if (emit_bold) { - emit boldChanged(); - } - - if (emit_blink) { - emit blinkingChanged(); - } - - if (emit_underline) { - emit underlineChanged(); - } - - } - - - if (m_visible_old != m_visible) { - m_visible_old = m_visible; - emit visibleChanged(); - } -} - -void Text::paletteChanged() -{ - setBackgroundColor(); - setForgroundColor(); -} - -void Text::setBackgroundColor() -{ - QColor new_background; - if (m_style.style & TextStyle::Inverse) { - new_background = m_screen->colorPalette()->color(m_style.forground, false); - } else { - new_background = m_screen->colorPalette()->color(m_style.background, false); - } - if (new_background != m_backgroundColor) { - m_backgroundColor = new_background; - emit backgroundColorChanged(); - } -} - -void Text::setForgroundColor() -{ - QColor new_forground; - if (m_style.style & TextStyle::Inverse) { - new_forground = m_screen->colorPalette()->color(m_style.background, false); - } else { - new_forground = m_screen->colorPalette()->color(m_style.forground, false); - } - if (new_forground != m_forgroundColor) { - m_forgroundColor = new_forground; - emit forgroundColorChanged(); - } -} diff --git a/yat/backend/text.h b/yat/backend/text.h deleted file mode 100644 index 79dd82f..0000000 --- a/yat/backend/text.h +++ /dev/null @@ -1,121 +0,0 @@ -/************************************************************************************************** -* Copyright (c) 2012 Jørgen Lind -* -* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and -* associated documentation files (the "Software"), to deal in the Software without restriction, -* including without limitation the rights to use, copy, modify, merge, publish, distribute, -* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is -* furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included in all copies or -* substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT -* NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT -* OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -* -***************************************************************************************************/ - -#ifndef TEXT_SEGMENT_H -#define TEXT_SEGMENT_H - -#include -#include -#include -#include - -#include "text_style.h" - -class Screen; -class QQuickItem; - -class Text : public QObject -{ - Q_OBJECT - Q_PROPERTY(int index READ index NOTIFY indexChanged) - Q_PROPERTY(int line READ line NOTIFY lineChanged) - Q_PROPERTY(bool visible READ visible NOTIFY visibleChanged) - Q_PROPERTY(QString text READ text NOTIFY textChanged) - Q_PROPERTY(QColor foregroundColor READ foregroundColor NOTIFY forgroundColorChanged) - Q_PROPERTY(QColor backgroundColor READ backgroundColor NOTIFY backgroundColorChanged) - Q_PROPERTY(bool bold READ bold NOTIFY boldChanged) - Q_PROPERTY(bool blinking READ blinking NOTIFY blinkingChanged) - Q_PROPERTY(bool underline READ underline NOTIFY underlineChanged) - Q_PROPERTY(bool latin READ latin NOTIFY latinChanged) -public: - Text(Screen *screen); - ~Text(); - - int index() const; - - int line() const; - void setLine(int line, int width, const QString *textLine); - - bool visible() const; - void setVisible(bool visible); - - QString text() const; - QColor foregroundColor() const; - QColor backgroundColor() const; - - void setStringSegment(int start_index, int end_index, bool textChanged); - void setTextStyle(const TextStyle &style); - - bool bold() const; - bool blinking() const; - bool underline() const; - - void setLatin(bool latin); - bool latin() const; - - QObject *item() const; - -public slots: - void dispatchEvents(); - -signals: - void indexChanged(); - void lineChanged(); - void visibleChanged(); - void textChanged(); - void forgroundColorChanged(); - void backgroundColorChanged(); - void boldChanged(); - void blinkingChanged(); - void underlineChanged(); - void latinChanged(); - -private slots: - void paletteChanged(); - -private: - void setBackgroundColor(); - void setForgroundColor(); - - Screen *m_screen; - QString m_text; - const QString *m_text_line; - int m_start_index; - int m_old_start_index; - int m_end_index; - int m_line; - int m_old_line; - int m_width; - - TextStyle m_style; - TextStyle m_new_style; - - bool m_style_dirty; - bool m_text_dirty; - bool m_visible; - bool m_visible_old; - bool m_latin; - bool m_latin_old; - - QColor m_forgroundColor; - QColor m_backgroundColor; -}; - -#endif // TEXT_SEGMENT_H diff --git a/yat/backend/text_style.cpp b/yat/backend/text_style.cpp deleted file mode 100644 index a95dd08..0000000 --- a/yat/backend/text_style.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#include "text_style.h" - -#include "screen.h" -#include "text.h" - -#include - -TextStyle::TextStyle() - : style(Normal) - , forground(ColorPalette::DefaultForground) - , background(ColorPalette::DefaultBackground) -{ - -} - -bool TextStyle::isCompatible(const TextStyle &other) const -{ - return forground == other.forground - && background == other.background - && style == other.style; -} - -QDebug operator<<(QDebug debug, TextStyleLine line) -{ - debug << "[" << line.start_index << "(" << line.style << ":" << line.forground << ":" << line.background << ")" << line.end_index << "]"; - return debug; -} - -void TextStyleLine::releaseTextSegment(Screen *screen) -{ - if (text_segment) { - text_segment->setVisible(false); - screen->releaseTextSegment(text_segment); - text_segment = 0; - } -} diff --git a/yat/backend/text_style.h b/yat/backend/text_style.h deleted file mode 100644 index a24fc69..0000000 --- a/yat/backend/text_style.h +++ /dev/null @@ -1,85 +0,0 @@ -#ifndef TEXT_STYLE_H -#define TEXT_STYLE_H - -#include - -#include "color_palette.h" - -class Screen; - -class TextStyle -{ -public: - enum Style { - Normal = 0x0000, - Italic = 0x0001, - Bold = 0x0002, - Underlined = 0x0004, - Blinking = 0x0008, - FastBlinking = 0x0010, - Gothic = 0x0020, - DoubleUnderlined = 0x0040, - Framed = 0x0080, - Overlined = 0x0100, - Encircled = 0x0200, - Inverse = 0x0400 - }; - Q_DECLARE_FLAGS(Styles, Style) - - TextStyle(); - - Styles style; - ColorPalette::Color forground; - ColorPalette::Color background; - - bool isCompatible(const TextStyle &other) const; -}; - -class Text; -class TextStyleLine : public TextStyle { -public: - TextStyleLine(const TextStyle &style, int start_index, int end_index) - : TextStyle(style) - , start_index(start_index) - , end_index(end_index) - , old_index(-1) - , text_segment(0) - , style_dirty(true) - , index_dirty(true) - , text_dirty(true) - { - } - - TextStyleLine() - : start_index(0) - , end_index(0) - , old_index(-1) - , text_segment(0) - , style_dirty(false) - , index_dirty(false) - , text_dirty(false) - { - - } - - void releaseTextSegment(Screen *screen); - - int start_index; - int end_index; - - int old_index; - Text *text_segment; - bool style_dirty; - bool index_dirty; - bool text_dirty; - - void setStyle(const TextStyle &style) { - forground = style.forground; - background = style.background; - this->style = style.style; - } -}; -QDebug operator<<(QDebug debug, TextStyleLine line); - - -#endif // TEXT_STYLE_H diff --git a/yat/backend/utf8_decoder.h b/yat/backend/utf8_decoder.h deleted file mode 100644 index 62271b0..0000000 --- a/yat/backend/utf8_decoder.h +++ /dev/null @@ -1,109 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2013 Jørgen Lind -* -* Permission is hereby granted, free of charge, to any person obtaining a copy -* of this software and associated documentation files (the "Software"), to deal -* in the Software without restriction, including without limitation the rights -* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -* copies of the Software, and to permit persons to whom the Software is -* furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included in -* all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -* SOFTWARE. -* -*******************************************************************************/ - -#ifndef UTF8_DECODER -#define UTF8_DECODER - -#include "controll_chars.h" - -class Utf8Decoder -{ -public: - inline Utf8Decoder(); - - inline void addChar(uchar character); - - inline bool isLatin() const; - inline bool isC1() const; - - inline void clear(); -private: - short m_expected_length; - short m_length; - uint32_t m_unicode; -}; - -Utf8Decoder::Utf8Decoder() -{ - clear(); -} - -void Utf8Decoder::addChar(uchar character) -{ - if (m_length && m_length == m_expected_length) { - clear(); - } - - if (character < 0x80) - return; - - fprintf(stderr, "Character: 0x%x\n", character); - if (m_expected_length == 0) { - //this is naive. There must be a faster way. - if ((character & 0xfc) == 0xfc) { - m_expected_length = 5; - m_unicode = character & 0x01; - } else if ((character & 0xf8) == 0xf8) { - m_expected_length = 4; - m_unicode = character & 0x03; - } else if ((character & 0xf0) == 0xf0) { - m_expected_length = 3; - m_unicode = character & 0x07; - } else if ((character & 0xe0) == 0xe0) { - m_expected_length = 2; - m_unicode = character & 0x0f; - } else if ((character & 0xc0) == 0xc0) { - m_expected_length = 1; - m_unicode = character & 0x1f; - } else { - m_expected_length = 0; - m_unicode = 0; - qWarning("Utf8Decoder: invalid decoder character"); - } - } else { - fprintf(stderr, "Before 0x%x adding 0x%x pure 0x%x\n", m_unicode,(character & 0x3f), character); - m_unicode = (m_unicode << 6) | (character & 0x3f); - fprintf(stderr, "After 0x%x\n", m_unicode); - m_length++; - } -} - -bool Utf8Decoder::isLatin() const -{ - return m_expected_length < 2 && m_unicode < 0xff; -} - -bool Utf8Decoder::isC1() const -{ - return m_expected_length == 2 && m_length == m_expected_length && - (m_unicode >= C1_8bit::C1_8bit_Start && m_unicode <= C1_8bit::C1_8bit_Stop); -} - -void Utf8Decoder::clear() -{ - m_expected_length = 0; - m_length = 0; - m_unicode = 0; -} - -#endif diff --git a/yat/backend/yat_pty.cpp b/yat/backend/yat_pty.cpp deleted file mode 100644 index e14a82a..0000000 --- a/yat/backend/yat_pty.cpp +++ /dev/null @@ -1,139 +0,0 @@ -/************************************************************************************************** -* Copyright (c) 2012 Jørgen Lind -* -* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and -* associated documentation files (the "Software"), to deal in the Software without restriction, -* including without limitation the rights to use, copy, modify, merge, publish, distribute, -* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is -* furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included in all copies or -* substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT -* NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT -* OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -* -***************************************************************************************************/ - -#include "yat_pty.h" - -#include -#include - -#ifdef LINUX -#include -#endif - -#include -#ifdef Q_OS_MAC -#include -#else -#include -#endif -#include - -#include -#include -#include -#include -#include - -static char env_variables[][255] = { - "TERM=xterm-color", - "COLORTERM=xterm", - "COLORFGBG=15;0", - "LINES", - "COLUMNS", - "TERMCAP" -}; -static int env_variables_size = sizeof(env_variables) / sizeof(env_variables[0]); - -YatPty::YatPty() - : m_winsize(0) -{ - m_terminal_pid = forkpty(&m_master_fd, - NULL, - NULL, - NULL); - - if (m_terminal_pid == 0) { - for (int i = 0; i < env_variables_size; i++) { - ::putenv(env_variables[i]); - } - ::execl("/bin/bash", "/bin/bash", "--login", (const char *) 0); - exit(0); - } - - QSocketNotifier *reader = new QSocketNotifier(m_master_fd,QSocketNotifier::Read,this); - connect(reader, &QSocketNotifier::activated, this, &YatPty::readData); -} - -YatPty::~YatPty() -{ -} - -void YatPty::write(const QByteArray &data) -{ - if (::write(m_master_fd, data.constData(), data.size()) < 0) { - qDebug() << "Something whent wrong when writing to m_master_fd"; - } -} - -void YatPty::setWidth(int width, int pixelWidth) -{ - if (!m_winsize) { - m_winsize = new struct winsize; - m_winsize->ws_row = 25; - m_winsize->ws_ypixel = 0; - } - - m_winsize->ws_col = width; - m_winsize->ws_xpixel = pixelWidth; - ioctl(m_master_fd, TIOCSWINSZ, m_winsize); -} - -void YatPty::setHeight(int height, int pixelHeight) -{ - if (!m_winsize) { - m_winsize = new struct winsize; - m_winsize->ws_col = 80; - m_winsize->ws_xpixel = 0; - } - m_winsize->ws_row = height; - m_winsize->ws_ypixel = pixelHeight; - ioctl(m_master_fd, TIOCSWINSZ, m_winsize); - -} - -QSize YatPty::size() const -{ - if (!m_winsize) { - YatPty *that = const_cast(this); - that->m_winsize = new struct winsize; - ioctl(m_master_fd, TIOCGWINSZ, m_winsize); - } - return QSize(m_winsize->ws_col, m_winsize->ws_row); -} - -int YatPty::masterDevice() const -{ - return m_master_fd; -} - - -void YatPty::readData() -{ - int size_of_buffer = sizeof m_data_buffer / sizeof *m_data_buffer; - ssize_t read_size = ::read(m_master_fd,m_data_buffer,size_of_buffer); - if (read_size > 0) { - QByteArray to_return = QByteArray::fromRawData(m_data_buffer,read_size); - emit readyRead(to_return); - } else if (read_size < 0) { - emit hangupReceived(); - } else { - emit hangupReceived(); - } -} diff --git a/yat/backend/yat_pty.h b/yat/backend/yat_pty.h deleted file mode 100644 index b14ada2..0000000 --- a/yat/backend/yat_pty.h +++ /dev/null @@ -1,59 +0,0 @@ -/************************************************************************************************** -* Copyright (c) 2012 Jørgen Lind -* -* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and -* associated documentation files (the "Software"), to deal in the Software without restriction, -* including without limitation the rights to use, copy, modify, merge, publish, distribute, -* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is -* furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included in all copies or -* substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT -* NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT -* OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -* -***************************************************************************************************/ - -#ifndef YAT_PTY_H -#define YAT_PTY_H - -#include - -#include -#include -#include - -class YatPty : public QObject -{ - Q_OBJECT -public: - YatPty(); - ~YatPty(); - - void write(const QByteArray &data); - - void setWidth(int width, int pixelWidth = 0); - void setHeight(int height, int pixelHeight = 0); - QSize size() const; - - int masterDevice() const; - -signals: - void hangupReceived(); - void readyRead(const QByteArray &data); - -private: - void readData(); - - pid_t m_terminal_pid; - int m_master_fd; - char m_slave_file_name[PATH_MAX]; - struct winsize *m_winsize; - char m_data_buffer[1024]; -}; - -#endif //YAT_PTY_H diff --git a/yat/docs/Ecma-048.pdf b/yat/docs/Ecma-048.pdf deleted file mode 100644 index e1441c5..0000000 Binary files a/yat/docs/Ecma-048.pdf and /dev/null differ diff --git a/yat/docs/Xterm Control Sequences.html b/yat/docs/Xterm Control Sequences.html deleted file mode 100644 index cf3453c..0000000 --- a/yat/docs/Xterm Control Sequences.html +++ /dev/null @@ -1,4841 +0,0 @@ - - - - - - - - - -Xterm Control Sequences - - - - -

Xterm Control Sequences

- -Definitions
-C1 (8-Bit) Control Characters
-VT100 Mode
-Alt and Meta Keys
-PC-Style Function Keys
-VT220-Style Function Keys
-VT52-Style Function Keys
-Sun-Style Function Keys
-HP-Style Function Keys
-The Alternate Screen Buffer
-Bracketed Paste Mode
-Title Modes
-Mouse Tracking
-Tektronix 4014 Mode
-VT52 Mode
- -
- - -

Edward Moy
-University of California, Berkeley

- - -

Revised -by
-Stephen Gildea

-X Consortium (1994)
-Thomas Dickey

-XFree86 Project (1996-2006)
-invisible-island.net (2006-2012)

- - -

Definitions

- - - - - - - - - - - - - - - - - - - - - - - -
- - -

c

- - -

The literal -character c.

- - -

C

- - -

A single (required) -character.

- - -

P -s

- - -

A single (usually -optional) numeric parameter, composed of one of more -digits.

- - -

P -m

- - -

A multiple numeric -parameter composed of any number of single numeric -parameters, separated by ; character(s). Individual values -for the parameters are listed with P s -.

- - -

P -t

- - -

A text parameter -composed of printable characters.

- - -

C1 (8-Bit) Control Characters

- - -

The xterm -program recognizes both 8-bit and 7-bit control characters. -It generates 7-bit controls (by default) or 8-bit if S8C1T -is enabled. The following pairs of 7-bit and 8-bit control -characters are equivalent:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - -

ESC -D

- - -

Index ( -IND is 0x84).

- - -

ESC E

- - -

Next Line ( -NEL is 0x85).

- - -

ESC H

- - -

Tab Set ( HTS -is 0x88).

- - -

ESC M

- - -

Reverse Index ( -RI is 0x8d).

- - -

ESC N

- - -

Single Shift Select of G2 Character Set ( -SS2 is 0x8e). This affects -next character only.

- - -

ESC O

- - -

Single Shift Select of G3 Character Set ( -SS3 is 0x8f). This affects -next character only.

- - -

ESC P

- - -

Device Control String ( -DCS is 0x90).

- - -

ESC V

- - -

Start of Guarded Area ( -SPA is 0x96).

- - -

ESC W

- - -

End of Guarded Area ( -EPA is 0x97).

- - -

ESC X

- - -

Start of String ( -SOS is 0x98).

- - -

ESC Z

- - -

Return Terminal ID (DECID is 0x9a). -Obsolete form of CSI c -(DA).

- - -

ESC [

- - -

Control Sequence Introducer ( -CSI is 0x9b).

- - -

ESC \

- - -

String Terminator ( -ST is 0x9c).

- - -

ESC ]

- - -

Operating System Command ( -OSC is 0x9d).

- - -

ESC ^

- - -

Privacy Message ( -PM is 0x9e).

- - -

ESC _

- - -

Application Program Command ( -APC is 0x9f).

- -

These control -characters are used in the vtXXX emulation.

- - -

VT100 Mode

- - -

Most of these -control sequences are standard VT102 control sequences, but -there is support for later DEC VT terminals (i.e., VT220, -VT320, VT420, VT510), as well as ISO 6429 and aixterm -color controls. The only VT102 feature not supported is -auto-repeat, since the only way X provides for this will -affect all windows. There are additional control sequences -to provide xterm-dependent functions, such as the -scrollbar or window size. Where the function is specified by -DEC or ISO 6429, the code assigned to it is given in -parentheses. The escape codes to designate and invoke -character sets are specified by ISO 2022; see that document -for a discussion of character sets.

- - -

Single-character -functions

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - -

BEL

- - -

Bell (Ctrl-G).

- - -

BS

- - -

Backspace (Ctrl-H).

- - -

CR

- - -

Carriage Return (Ctrl-M).

- - -

ENQ

- - -

Return Terminal Status (Ctrl-E). Default -response is an empty string, but may be overridden by a -resource answerbackString.

- - -

FF

- - -

Form Feed or New Page (NP). Ctrl-L is -treated the same as LF.

- - -

LF

- - -

Line Feed or New Line (NL). (LF is -Ctrl-J).

- - -

SI

- - -

Shift In (Ctrl-O) → Switch to Standard -Character Set. This invokes the G0 character set (the -default).

- - -

SO

- - -

Shift Out (Ctrl-N) → Switch to -Alternate Character Set. This invokes the G1 character -set.

- - -

SP

- - -

Space.

- - -

TAB

- - -

Horizontal Tab (HT) (Ctrl-I).

- - -

VT

- - -

Vertical Tab (Ctrl-K). This is treated the -same as LF.

- -

Controls -beginning with ESC
-This excludes controls where -ESC is part of a 7-bit -equivalent to 8-bit C1 controls, ordered by the final -character(s).

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - -

ESC SP F

- - -

7-bit controls (S7C1T).

- - -

ESC SP G

- - -

8-bit controls (S8C1T).

- - -

ESC SP L

- - -

Set ANSI conformance level 1 (dpANS -X3.134.1).

- - -

ESC SP M

- - -

Set ANSI conformance level 2 (dpANS -X3.134.1).

- - -

ESC SP N

- - -

Set ANSI conformance level 3 (dpANS -X3.134.1).

- - -

ESC # 3

- - -

DEC double-height line, top half -(DECDHL).

- - -

ESC # 4

- - -

DEC double-height line, bottom half -(DECDHL).

- - -

ESC # 5

- - -

DEC single-width line (DECSWL).

- - -

ESC # 6

- - -

DEC double-width line (DECDWL).

- - -

ESC # 8

- - -

DEC Screen Alignment Test (DECALN).

- - -

ESC % @

- - -

Select default character set. That is ISO -8859-1 (ISO 2022).

- - -

ESC % G

- - -

Select UTF-8 character set (ISO 2022).

- - -

ESC ( -C

- - -

Designate G0 Character Set (ISO 2022, -VT100).

- -

Final character C for -designating 94-character sets. In this list, 0 , A and B -apply to VT100 and up, the remainder to VT220 and up: -
-C
= 0 → DEC Special Character and Line Drawing Set. -
-C
= A → United Kingdom (UK).
-C
= B → United States (USASCII).
-C
= 4 → Dutch.
-C
= C or 5 → Finnish.
-C
= R → French.
-C
= Q → French Canadian.
-C
= K → German.
-C
= Y → Italian.
-C
= E or 6 → Norwegian/Danish.
-C
= Z → Spanish.
-C
= H or 7 → Swedish.
-C
= = → Swiss.

- - - - - - - -
- - -

ESC ) -C

- - -

Designate G1 Character Set (ISO 2022, -VT100).

-
- -

The same character sets apply -as for ESC ( C.

- - - - - - - -
- - -

ESC * -C

- - -

Designate G2 Character Set (ISO 2022, -VT220).

-
- -

The same character sets apply -as for ESC ( C.

- - - - - - - -
- - -

ESC + -C

- - -

Designate G3 Character Set (ISO 2022, -VT220).

-
- -

The same character sets apply -as for ESC ( C.

- - - - - - - -
- - -

ESC - -C

- - -

Designate G1 Character Set (VT300).

-
- -

The same character sets apply -as for ESC ( C.

- - - - - - - -
- - -

ESC . -C

- - -

Designate G2 Character Set (VT300).

-
- -

The same character sets apply -as for ESC ( C.

- - - - - - - -
- - -

ESC / -C

- - -

Designate G3 Character Set (VT300).

-
- -

These work for 96-character -sets only.
-C
= A → ISO Latin-1 Supplemental.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - -

ESC 6

- - -

Back Index (DECBI), VT420 and up.

- - -

ESC 7

- - -

Save Cursor (DECSC).

- - -

ESC 8

- - -

Restore Cursor (DECRC).

- - -

ESC 9

- - -

Forward Index (DECFI), VT420 and up.

- - -

ESC =

- - -

Application Keypad (DECPAM).

- - -

ESC >

- - -

Normal Keypad (DECPNM).

- - -

ESC F

- - -

Cursor to lower left corner of screen. This -is enabled by the hpLowerleftBugCompat resource.

- - -

ESC c

- - -

Full Reset (RIS).

- - -

ESC l

- - -

Memory Lock (per HP terminals). Locks -memory above the cursor.

- - -

ESC m

- - -

Memory Unlock (per HP terminals).

- - -

ESC n

- - -

Invoke the G2 Character Set as GL -(LS2).

- - -

ESC o

- - -

Invoke the G3 Character Set as GL -(LS3).

- - -

ESC |

- - -

Invoke the G3 Character Set as GR -(LS3R).

- - -

ESC }

- - -

Invoke the G2 Character Set as GR -(LS2R).

- - -

ESC ~

- - -

Invoke the G1 Character Set as GR -(LS1R).

- -

Application -Program-Control functions

- - - - - - -
- - -

APC P -t ST

- - -

None. xterm implements no -APC functions; P -t is ignored. P t -need not be printable characters.

- -

Device-Control -functions

- - - - - -
- - -

DCS P -s ; P s | P -t ST

-
- -

User-Defined Keys (DECUDK). The -first parameter:
-P s
= 0 → Clear all UDK definitions -before starting (default).
-P s
= 1 → Erase Below (default). -
-The second parameter:
-P s
= 0 ← Lock the keys (default). -
-P s
= 1 ← Do not lock.
-The third parameter is a ’;’-separated list of -strings denoting the key-code separated by a ’/’ -from the hex-encoded key value. The key codes correspond to -the DEC function-key codes (e.g., F6=17).

- - - - - -
- - -

DCS $ q P -t ST

-
- -

Request Status String -(DECRQSS). The string following the "q" is one of -the following:

- - - - - -

“ q

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - -

→ DECSCA
-“ p

- - -

→ DECSCL
-r

-
- - -

→ DECSTBM
-m

-
- - -

→ SGR
-SP
q

- - -

→ DECSCUSR

- -

xterm responds with -DCS 1 $ r P -t ST for -valid requests, replacing the P t with -the corresponding CSI string, -or DCS 0 $ r P -t ST for -invalid requests.

- - - - - -
- - -

DCS + p P -t ST

-
- -

Set Termcap/Terminfo Data -(xterm, experimental). The string following the -"p" is a name to use for retrieving data from the -terminal database. The data will be used for the -"tcap" keyboard configuration’s function- -and special-keys, as well as by the Request Termcap/Terminfo -String control.

- - - - - -
- - -

DCS + q P -t ST

-
- -

Request Termcap/Terminfo String -(xterm, experimental). The string following the -"q" is a list of names encoded in hexadecimal (2 -digits per character) separated by ; which correspond to -termcap or terminfo key names.
-Two special features are also recognized, which are not key -names: Co for termcap colors (or colors for -terminfo colors), and TN for termcap name (or -name for terminfo name).
-xterm
responds with DCS 1 -+ r P t -ST for valid requests, adding -to P t an = , and the value of the -corresponding string that xterm would send, or -DCS 0 + r P -t ST for -invalid requests. The strings are encoded in hexadecimal (2 -digits per character).

- -

Functions using -CSI , ordered by the final -character(s)

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - -

CSI P -s @

- - -

Insert P s (Blank) -Character(s) (default = 1) (ICH).

- - -

CSI P -s A

- - -

Cursor Up P s Times -(default = 1) (CUU).

- - -

CSI P -s B

- - -

Cursor Down P s Times -(default = 1) (CUD).

- - -

CSI P -s C

- - -

Cursor Forward P s -Times (default = 1) (CUF).

- - -

CSI P -s D

- - -

Cursor Backward P s -Times (default = 1) (CUB).

- - -

CSI P -s E

- - -

Cursor Next Line P s -Times (default = 1) (CNL).

- - -

CSI P -s F

- - -

Cursor Preceding Line P -s Times (default = 1) (CPL).

- - -

CSI P -s G

- - -

Cursor Character Absolute [column] (default -= [row,1]) (CHA).

- - -

CSI P -s ; P

-
- -

s H

- - - - - - - - - - - - - - -
- - -

Cursor Position [row;column] (default = -[1,1]) (CUP).

- - -

CSI P -s I

- - -

Cursor Forward Tabulation P -s tab stops (default = 1) (CHT).

- - -

CSI P -s J

- - -

Erase in Display (ED).

- -

P s = 0 -→ Erase Below (default).
-P s
= 1 → Erase Above.
-P s
= 2 → Erase All.
-P s
= 3 → Erase Saved Lines -(xterm).

- - - - - - -
- - -

CSI ? P -s J

- - -

Erase in Display (DECSED).

-
- -

P s = 0 -→ Selective Erase Below (default).
-P s
= 1 → Selective Erase Above. -
-P s
= 2 → Selective Erase All.

- - - - - - - -
- - -

CSI P -s K

- - -

Erase in Line (EL).

-
- -

P s = 0 -→ Erase to Right (default).
-P s
= 1 → Erase to Left.
-P s
= 2 → Erase All.

- - - - - - -
- - -

CSI ? P -s K

- - -

Erase in Line (DECSEL).

-
- -

P s = 0 -→ Selective Erase to Right (default).
-P s
= 1 → Selective Erase to Left. -
-P s
= 2 → Selective Erase All.

- - - - - - - - - - - - - - - - - - - - - - - - - - -
- - -

CSI P -s L

- - -

Insert P s Line(s) -(default = 1) (IL).

-
- - -

CSI P -s M

- - -

Delete P s Line(s) -(default = 1) (DL).

-
- - -

CSI P -s P

- - -

Delete P s -Character(s) (default = 1) (DCH).

-
- - -

CSI P -s S

- - -

Scroll up P s lines -(default = 1) (SU).

-
- - -

CSI P -s T

- - -

Scroll down P s lines -(default = 1) (SD).

-
- - -

CSI P -s ; P

-
- -

s ; P -s ; P s ; P -s T

- - - - - - - - - - -
- - -

Initiate highlight mouse tracking. -Parameters are [func;startx;starty;firstrow;lastrow]. See -the section Mouse Tracking.

- - -

CSI > P -s ;

-
- -

P s T

- - - - - -
- - -

Reset one or more features of the title -modes to the default value. Normally, "reset" -disables the feature. It is possible to disable the ability -to reset features by compiling a different default for the -title modes into xterm.

- -

P s = 0 -→ Do not set window/icon labels using hexadecimal. -
-P s
= 1 → Do not query window/icon -labels using hexadecimal.
-P s
= 2 → Do not set window/icon -labels using UTF-8.
-P s
= 3 → Do not query window/icon -labels using UTF-8. (See discussion of "Title -Modes").

- - - - - - - - - - - - - - - - - - - - - - - - - - -
- - -

CSI P -s X

- - -

Erase P s -Character(s) (default = 1) (ECH).

- - -

CSI P -s Z

- - -

Cursor Backward Tabulation P -s tab stops (default = 1) (CBT).

- - -

CSI P -m `

- - -

Character Position Absolute [column] -(default = [row,1]) (HPA).

- - -

CSI P -m a

- - -

Character Position Relative [columns] -(default = [row,col+1]) (HPR).

- - -

CSI P -s b

- - -

Repeat the preceding graphic character P -s times (REP).

- - -

CSI P -s c

- - -

Send Device Attributes (Primary DA).

- -

P s = 0 -or omitted → request attributes from terminal. The -response depends on the decTerminalID resource -setting.
-→ CSI ? 1 ; 2 c -(‘‘VT100 with Advanced Video -Option’’)
-→ CSI ? 1 ; 0 c -(‘‘VT101 with No Options’’)
-→ CSI ? 6 c -(‘‘VT102’’)
-→ CSI ? 6 0 ; 1 ; 2 ; 6 ; -8 ; 9 ; 1 5 ; c (‘‘VT220’’)
-The VT100-style response parameters do not mean anything by -themselves. VT220 parameters do, telling the host what -features the terminal supports:
-P s
= 1 → 132-columns.
-P s
= 2 → Printer.
-P s
= 6 → Selective erase.
-P s
= 8 → User-defined keys.
-P s
= 9 → National replacement -character sets.
-P s
= 1 5 → Technical characters. -
-P s
= 2 2 → ANSI color, e.g., VT525. -
-P s
= 2 9 → ANSI text locator (i.e., -DEC Locator mode).

- - - - - - -
- - -

CSI > P -s c

- - -

Send Device Attributes (Secondary DA).

-
- -

P s = 0 -or omitted → request the terminal’s -identification code. The response depends on the -decTerminalID resource setting. It should apply only -to VT220 and up, but xterm extends this to VT100. -
-→ CSI > P -p ; P v ; P -c c
-where P p denotes the terminal type -
-P p
= 0 → -‘‘VT100’’.
-P p
= 1 → -‘‘VT220’’.
-and P v is the firmware version (for -xterm, this was originally the XFree86 patch number, -starting with 95). In a DEC terminal, P -c indicates the ROM cartridge -registration number and is always zero.

- - - - - - - - - - - -
- - -

CSI P -m d

- - -

Line Position Absolute [row] (default = -[1,column]) (VPA).

- - -

CSI P -m e

- - -

Line Position Relative [rows] (default = -[row+1,column]) (VPR).

- - -

CSI P -s ; P

-
- -

s f

- - - - - - - - - - -
- - -

Horizontal and Vertical Position -[row;column] (default = [1,1]) (HVP).

- - -

CSI P -s g

- - -

Tab Clear (TBC).

- -

P s = 0 -→ Clear Current Column (default).
-P s
= 3 → Clear All.

- - - - - - - -
- - -

CSI P -m h

- - -

Set Mode (SM).

-
- -

P s = 2 -→ Keyboard Action Mode (AM).
-P s
= 4 → Insert Mode (IRM).
-P s
= 1 2 → Send/receive (SRM). -
-P s
= 2 0 → Automatic Newline -(LNM).

- - - - - - -
- - -

CSI ? P -m h

- - -

DEC Private Mode Set (DECSET).

-
- -

P s = 1 -→ Application Cursor Keys (DECCKM).
-P s
= 2 → Designate USASCII for -character sets G0-G3 (DECANM), and set VT100 mode.
-P s
= 3 → 132 Column Mode (DECCOLM). -
-P s
= 4 → Smooth (Slow) Scroll -(DECSCLM).
-P s
= 5 → Reverse Video (DECSCNM). -
-P s
= 6 → Origin Mode (DECOM). -
-P s
= 7 → Wraparound Mode (DECAWM). -
-P s
= 8 → Auto-repeat Keys (DECARM). -
-P s
= 9 → Send Mouse X & Y on -button press. See the section Mouse Tracking.
-P s
= 1 0 → Show toolbar (rxvt). -
-P s
= 1 2 → Start Blinking Cursor -(att610).
-P s
= 1 8 → Print form feed -(DECPFF).
-P s
= 1 9 → Set print extent to full -screen (DECPEX).
-P s
= 2 5 → Show Cursor (DECTCEM). -
-P s
= 3 0 → Show scrollbar (rxvt). -
-P s
= 3 5 → Enable font-shifting -functions (rxvt).
-P s
= 3 8 → Enter Tektronix Mode -(DECTEK).
-P s
= 4 0 → Allow 80 → 132 -Mode.
-P s
= 4 1 → more(1) fix (see -curses resource).
-P s
= 4 2 → Enable Nation -Replacement Character sets (DECNRCM).
-P s
= 4 4 → Turn On Margin Bell. -
-P s
= 4 5 → Reverse-wraparound Mode. -
-P s
= 4 6 → Start Logging. This is -normally disabled by a compile-time option.
-P s
= 4 7 → Use Alternate Screen -Buffer. (This may be disabled by the titeInhibit -resource).
-P s
= 6 6 → Application keypad -(DECNKM).
-P s
= 6 7 → Backarrow key sends -backspace (DECBKM).
-P s
= 6 9 → Enable left and right -margin mode (DECLRMM), VT420 and up.
-P s
= 9 5 → Do not clear screen when -DECCOLM is set/reset (DECNCSM), VT510 and up.
-P s
= 1 0 0 0 → Send Mouse X & Y -on button press and release. See the section Mouse -Tracking.
-P s
= 1 0 0 1 → Use Hilite Mouse -Tracking.
-P s
= 1 0 0 2 → Use Cell Motion -Mouse Tracking.
-P s
= 1 0 0 3 → Use All Motion Mouse -Tracking.
-P s
= 1 0 0 4 → Send -FocusIn/FocusOut events.
-P s
= 1 0 0 5 → Enable UTF-8 Mouse -Mode.
-P s
= 1 0 0 6 → Enable SGR Mouse -Mode.
-P s
= 1 0 1 0 → Scroll to bottom on -tty output (rxvt).
-P s
= 1 0 1 5 → Enable urxvt Mouse -Mode.
-P s
= 1 0 1 1 → Scroll to bottom on -key press (rxvt).
-P s
= 1 0 3 4 → Interpret -"meta" key, sets eighth bit. (enables the -eightBitInput resource).
-P s
= 1 0 3 5 → Enable special -modifiers for Alt and NumLock keys. (This enables the -numLock resource).
-P s
= 1 0 3 6 → Send -ESC when Meta modifies a key. -(This enables the metaSendsEscape resource).
-P s
= 1 0 3 7 → Send DEL from the -editing-keypad Delete key.
-P s
= 1 0 3 9 → Send -ESC when Alt modifies a key. -(This enables the altSendsEscape resource).
-P s
= 1 0 4 0 → Keep selection even -if not highlighted. (This enables the keepSelection -resource).
-P s
= 1 0 4 1 → Use the CLIPBOARD -selection. (This enables the selectToClipboard -resource).
-P s
= 1 0 4 2 → Enable Urgency -window manager hint when Control-G is received. (This -enables the bellIsUrgent resource).
-P s
= 1 0 4 3 → Enable raising of -the window when Control-G is received. (enables the -popOnBell resource).
-P s
= 1 0 4 7 → Use Alternate Screen -Buffer. (This may be disabled by the titeInhibit -resource).
-P s
= 1 0 4 8 → Save cursor as in -DECSC. (This may be disabled by the titeInhibit -resource).
-P s
= 1 0 4 9 → Save cursor as in -DECSC and use Alternate Screen Buffer, clearing it first. -(This may be disabled by the titeInhibit resource). -This combines the effects of the 1 0 4 7 and 1 0 4 8 modes. -Use this with terminfo-based applications rather than the 4 -7 mode.
-P s
= 1 0 5 0 → Set terminfo/termcap -function-key mode.
-P s
= 1 0 5 1 → Set Sun function-key -mode.
-P s
= 1 0 5 2 → Set HP function-key -mode.
-P s
= 1 0 5 3 → Set SCO function-key -mode.
-P s
= 1 0 6 0 → Set legacy keyboard -emulation (X11R6).
-P s
= 1 0 6 1 → Set VT220 keyboard -emulation.
-P s
= 2 0 0 4 → Set bracketed paste -mode.

- - - - - - - -
- - -

CSI P -m i

- - -

Media Copy (MC).

-
- -

P s = 0 -→ Print screen (default).
-P s
= 4 → Turn off printer -controller mode.
-P s
= 5 → Turn on printer controller -mode.

- - - - - - -
- - -

CSI ? P -m i

- - -

Media Copy (MC, DEC-specific).

-
- -

P s = 1 -→ Print line containing cursor.
-P s
= 4 → Turn off autoprint mode. -
-P s
= 5 → Turn on autoprint mode. -
-P s
= 1 0 → Print composed display, -ignores DECPEX.
-P s
= 1 1 → Print all pages.

- - - - - - - -
- - -

CSI P -m l

- - -

Reset Mode (RM).

-
- -

P s = 2 -→ Keyboard Action Mode (AM).
-P s
= 4 → Replace Mode (IRM). -
-P s
= 1 2 → Send/receive (SRM). -
-P s
= 2 0 → Normal Linefeed -(LNM).

- - - - - - -
- - -

CSI ? P -m l

- - -

DEC Private Mode Reset (DECRST).

-
- -

P s = 1 -→ Normal Cursor Keys (DECCKM).
-P s
= 2 → Designate VT52 mode -(DECANM).
-P s
= 3 → 80 Column Mode (DECCOLM). -
-P s
= 4 → Jump (Fast) Scroll -(DECSCLM).
-P s
= 5 → Normal Video (DECSCNM). -
-P s
= 6 → Normal Cursor Mode -(DECOM).
-P s
= 7 → No Wraparound Mode -(DECAWM).
-P s
= 8 → No Auto-repeat Keys -(DECARM).
-P s
= 9 → Don’t send Mouse X -& Y on button press.
-P s
= 1 0 → Hide toolbar (rxvt). -
-P s
= 1 2 → Stop Blinking Cursor -(att610).
-P s
= 1 8 → Don’t print form -feed (DECPFF).
-P s
= 1 9 → Limit print to scrolling -region (DECPEX).
-P s
= 2 5 → Hide Cursor (DECTCEM). -
-P s
= 3 0 → Don’t show -scrollbar (rxvt).
-P s
= 3 5 → Disable font-shifting -functions (rxvt).
-P s
= 4 0 → Disallow 80 → 132 -Mode.
-P s
= 4 1 → No more(1) fix -(see curses resource).
-P s
= 4 2 → Disable Nation -Replacement Character sets (DECNRCM).
-P s
= 4 4 → Turn Off Margin Bell. -
-P s
= 4 5 → No Reverse-wraparound -Mode.
-P s
= 4 6 → Stop Logging. (This is -normally disabled by a compile-time option).
-P s
= 4 7 → Use Normal Screen -Buffer.
-P s
= 6 6 → Numeric keypad (DECNKM). -
-P s
= 6 7 → Backarrow key sends -delete (DECBKM).
-P s
= 6 9 → Disable left and right -margin mode (DECLRMM), VT420 and up.
-P s
= 9 5 → Clear screen when -DECCOLM is set/reset (DECNCSM), VT510 and up.
-P s
= 1 0 0 0 → Don’t send -Mouse X & Y on button press and release. See the section -Mouse Tracking.
-P s
= 1 0 0 1 → Don’t use -Hilite Mouse Tracking.
-P s
= 1 0 0 2 → Don’t use Cell -Motion Mouse Tracking.
-P s
= 1 0 0 3 → Don’t use All -Motion Mouse Tracking.
-P s
= 1 0 0 4 → Don’t send -FocusIn/FocusOut events.
-P s
= 1 0 0 5 → Disable UTF-8 Mouse -Mode.
-P s
= 1 0 0 6 → Disable SGR Mouse -Mode.
-P s
= 1 0 1 0 → Don’t scroll -to bottom on tty output (rxvt).
-P s
= 1 0 1 5 → Disable urxvt Mouse -Mode.
-P s
= 1 0 1 1 → Don’t scroll -to bottom on key press (rxvt).
-P s
= 1 0 3 4 → Don’t -interpret "meta" key. (This disables the -eightBitInput resource).
-P s
= 1 0 3 5 → Disable special -modifiers for Alt and NumLock keys. (This disables the -numLock resource).
-P s
= 1 0 3 6 → Don’t send -ESC when Meta modifies a key. -(This disables the metaSendsEscape resource).
-P s
= 1 0 3 7 → Send VT220 Remove -from the editing-keypad Delete key.
-P s
= 1 0 3 9 → Don’t send -ESC when Alt modifies a key. -(This disables the altSendsEscape resource).
-P s
= 1 0 4 0 → Do not keep -selection when not highlighted. (This disables the -keepSelection resource).
-P s
= 1 0 4 1 → Use the PRIMARY -selection. (This disables the selectToClipboard -resource).
-P s
= 1 0 4 2 → Disable Urgency -window manager hint when Control-G is received. (This -disables the bellIsUrgent resource).
-P s
= 1 0 4 3 → Disable raising of -the window when Control-G is received. (This disables the -popOnBell resource).
-P s
= 1 0 4 7 → Use Normal Screen -Buffer, clearing screen first if in the Alternate Screen. -(This may be disabled by the titeInhibit resource). -
-P s
= 1 0 4 8 → Restore cursor as in -DECRC. (This may be disabled by the titeInhibit -resource).
-P s
= 1 0 4 9 → Use Normal Screen -Buffer and restore cursor as in DECRC. (This may be disabled -by the titeInhibit resource). This combines the -effects of the 1 0 4 7 and 1 0 4 8 modes. Use this with -terminfo-based applications rather than the 4 7 mode. -
-P s
= 1 0 5 0 → Reset -terminfo/termcap function-key mode.
-P s
= 1 0 5 1 → Reset Sun -function-key mode.
-P s
= 1 0 5 2 → Reset HP -function-key mode.
-P s
= 1 0 5 3 → Reset SCO -function-key mode.
-P s
= 1 0 6 0 → Reset legacy -keyboard emulation (X11R6).
-P s
= 1 0 6 1 → Reset keyboard -emulation to Sun/PC style.
-P s
= 2 0 0 4 → Reset bracketed -paste mode.

- - - - - - - -
- - -

CSI P -m m

- - -

Character Attributes (SGR).

-
- -

P s = 0 -→ Normal (default).
-P s
= 1 → Bold.
-P s
= 4 → Underlined.
-P s
= 5 → Blink (appears as Bold). -
-P s
= 7 → Inverse.
-P s
= 8 → Invisible, i.e., hidden -(VT300).
-P s
= 2 2 → Normal (neither bold nor -faint).
-P s
= 2 4 → Not underlined.
-P s
= 2 5 → Steady (not blinking). -
-P s
= 2 7 → Positive (not inverse). -
-P s
= 2 8 → Visible, i.e., not -hidden (VT300).
-P s
= 3 0 → Set foreground color to -Black.
-P s
= 3 1 → Set foreground color to -Red.
-P s
= 3 2 → Set foreground color to -Green.
-P s
= 3 3 → Set foreground color to -Yellow.
-P s
= 3 4 → Set foreground color to -Blue.
-P s
= 3 5 → Set foreground color to -Magenta.
-P s
= 3 6 → Set foreground color to -Cyan.
-P s
= 3 7 → Set foreground color to -White.
-P s
= 3 9 → Set foreground color to -default (original).
-P s
= 4 0 → Set background color to -Black.
-P s
= 4 1 → Set background color to -Red.
-P s
= 4 2 → Set background color to -Green.
-P s
= 4 3 → Set background color to -Yellow.
-P s
= 4 4 → Set background color to -Blue.
-P s
= 4 5 → Set background color to -Magenta.
-P s
= 4 6 → Set background color to -Cyan.
-P s
= 4 7 → Set background color to -White.
-P s
= 4 9 → Set background color to -default (original).

- -

If 16-color -support is compiled, the following apply. Assume that -xterm’s resources are set so that the ISO color -codes are the first 8 of a set of 16. Then the -aixterm colors are the bright versions of the ISO -colors:
-P s
= 9 0 → Set foreground color to -Black.
-P s
= 9 1 → Set foreground color to -Red.
-P s
= 9 2 → Set foreground color to -Green.
-P s
= 9 3 → Set foreground color to -Yellow.
-P s
= 9 4 → Set foreground color to -Blue.
-P s
= 9 5 → Set foreground color to -Magenta.
-P s
= 9 6 → Set foreground color to -Cyan.
-P s
= 9 7 → Set foreground color to -White.
-P s
= 1 0 0 → Set background color -to Black.
-P s
= 1 0 1 → Set background color -to Red.
-P s
= 1 0 2 → Set background color -to Green.
-P s
= 1 0 3 → Set background color -to Yellow.
-P s
= 1 0 4 → Set background color -to Blue.
-P s
= 1 0 5 → Set background color -to Magenta.
-P s
= 1 0 6 → Set background color -to Cyan.
-P s
= 1 0 7 → Set background color -to White.

- -

If xterm -is compiled with the 16-color support disabled, it supports -the following, from rxvt:
-P s
= 1 0 0 → Set foreground and -background color to default.

- -

If 88- or -256-color support is compiled, the following apply.
-P s
= 3 8 ; 5 ; P s -→ Set foreground color to the second P -s .
-P s
= 4 8 ; 5 ; P s -→ Set background color to the second P -s .

- - - - - -
- - - -

CSI -> P s ; P s -m

-
- -

Set or reset resource-values -used by xterm to decide whether to construct escape -sequences holding information about the modifiers pressed -with a given key. The first parameter identifies the -resource to set/reset. The second parameter is the value to -assign to the resource. If the second parameter is omitted, -the resource is reset to its initial value.
-P s
= 1 → modifyCursorKeys.
-P s
= 2 → modifyFunctionKeys. -
-P s
= 4 → modifyOtherKeys.
-If no parameters are given, all resources are reset to their -initial values.

- - - - - - - -
- - -

CSI P -s n

- - -

Device Status Report (DSR).

-
- -

P s = 5 -→ Status Report. Result -(‘‘OK’’) is
-CSI
0 n
-P s
= 6 → Report Cursor Position -(CPR) [row;column]. Result is
-CSI
r ; c R

- - - - - -
- - -

CSI > P -s n

- - -

Disable modifiers which may be enabled via -the CSI > P -s ; P s m sequence. -This corresponds to a resource value of "-1", -which cannot be set with the other sequence. The parameter -identifies the resource to be disabled:

- -

P s = 1 -→ modifyCursorKeys.
-P s
= 2 → modifyFunctionKeys. -
-P s
= 4 → modifyOtherKeys.
-If the parameter is omitted, modifyFunctionKeys is -disabled. When modifyFunctionKeys is disabled, -xterm uses the modifier keys to make an extended -sequence of functions rather than adding a parameter to each -function key to denote the modifiers.

- - - - - - -
- - -

CSI ? P -s n

- - -

Device Status Report (DSR, -DEC-specific).

-
- -

P s = 6 -→ Report Cursor Position (DECXCPR) [row;column] as -CSI ? r ; c R -(assumes the default page, i.e., "1").
-P s
= 1 5 → Report Printer status as -CSI ? 1 0 n (ready). or -CSI ? 1 1 n (not ready). -
-P s
= 2 5 → Report UDK status as -CSI ? 2 0 n (unlocked) or -CSI ? 2 1 n (locked).
-P s
= 2 6 → Report Keyboard status -as
-CSI
? 2 7 ; 1 ; 0 ; 0 n (North American). -
-The last two parameters apply to VT400 & up, and denote -keyboard ready and LK01 respectively.
-P s
= 5 3 → Report Locator status as -CSI ? 5 3 n Locator available, -if compiled-in, or CSI ? 5 0 n -No Locator, if not.
-P s
= 6 2 → Report macro space -(DECMSR) as CSI P -n \* {
-P s
= 6 3 → Report memory checksum -(DECCKSR) as DCS P -t ! x x x x -ST
-P t
is the request id (from an optional -parameter to the request).
-The x’s are hexadecimal digits 0-9 and A-F.
-P s
= 7 5 → Report data integrity as -CSI ? 7 0 n (ready, no errors) -
-P s
= 8 5 → Report multi-session -configuration as CSI ? 8 3 n -(not configured for multiple-session operation).

- - - - - -
- - -

CSI > P -s p

- - -

Set resource value pointerMode. This -is used by xterm to decide whether to hide the -pointer cursor as the user types. Valid values for the -parameter:

- -

P s = 0 -→ never hide the pointer.
-P s
= 1 → hide if the mouse tracking -mode is not enabled.
-P s
= 2 → always hide the pointer. -If no parameter is given, xterm uses the default, -which is 1 .

- - - - - - - - -
- - -

CSI ! p

- - -

Soft terminal reset (DECSTR).

- - -

CSI P -s $ p

- - -

Request ANSI mode (DECRQM). For VT300 and -up, reply is

- - -

CSI -P s ; P m $ y -
-where P s is the mode number as in RM, -and P m is the mode value:
-0 - not recognized
-1 - set
-2 - reset
-3 - permanently set
-4 - permanently reset

- - - - - -
- - -

CSI ? P -s $ p

-
- -

Request DEC private mode -(DECRQM). For VT300 and up, reply is
-CSI
? P s ; P -m $ p
-where P s is the mode number as in -DECSET, P m is the mode value as in -the ANSI DECRQM.

- - - - - -
- - -

CSI P -s ; P s “ -p

-
- -

Set conformance level (DECSCL). -Valid values for the first parameter:
-P s
= 6 1 → VT100.
-P s
= 6 2 → VT200.
-P s
= 6 3 → VT300.
-Valid values for the second parameter:
-P s
= 0 → 8-bit controls.
-P s
= 1 → 7-bit controls (always set -for VT100).
-P s
= 2 → 8-bit controls.

- - - - - - - -
- - -

CSI P -s q

- - -

Load LEDs (DECLL).

-
- -

P s = 0 -→ Clear all LEDS (default).
-P s
= 1 → Light Num Lock.
-P s
= 2 → Light Caps Lock.
-P s
= 3 → Light Scroll Lock.
-P s
= 2 1 → Extinguish Num Lock. -
-P s
= 2 2 → Extinguish Caps Lock. -
-P s
= 2 3 → Extinguish Scroll -Lock.

- - - - - -
- - -

CSI P -s SP q

-
- -

Set cursor style (DECSCUSR, -VT520).
-P s
= 0 → blinking block.
-P s
= 1 → blinking block (default). -
-P s
= 2 → steady block.
-P s
= 3 → blinking underline. -
-P s
= 4 → steady underline.

- - - - - -
- - -

CSI P -s “ q

- - -

Select character protection attribute -(DECSCA). Valid values for the parameter:

- -

P s = 0 -→ DECSED and DECSEL can erase (default).
-P s
= 1 → DECSED and DECSEL cannot -erase.
-P s
= 2 → DECSED and DECSEL can -erase.

- - - - - -
- - -

CSI P -s ; P s r

-
- -

Set Scrolling Region -[top;bottom] (default = full size of window) (DECSTBM).

- - - - - - - - -
- - -

CSI ? P -m r

- - -

Restore DEC Private Mode Values. The value -of P s previously saved is restored. -P s values are the same as for -DECSET.

- - -

CSI P -t ; P l

-
- -

; P b ; P -r ; P s $ r

- - - - - -
- - -

Change Attributes in Rectangular Area -(DECCARA), VT400 and up.

- -

P t ; -P l ; P b ; P -r denotes the rectangle.
-P s
denotes the SGR attributes to change: -0, 1, 4, 5, 7.

- - - - - -
- - -

CSI P -l ; P r s

-
- -

Set left and right margins -(DECSLRM), available only when DECLRMM is enabled (VT420 and -up).

- - - - - - - - - - - -
- - -

CSI s

- - -

Save cursor (ANSI.SYS), available only when -DECLRMM is disabled.

- - -

CSI ? P -m s

- - -

Save DEC Private Mode Values. P -s values are the same as for DECSET.

- - -

CSI P -s ; P

-
- -

s ; P -s t

- - - - - -
- - -

Window manipulation (from dtterm, as -well as extensions). These controls may be disabled using -the allowWindowOps resource. Valid values for the -first (and any additional parameters) are:

- -

P s = 1 -→ De-iconify window.
-P s
= 2 → Iconify window.
-P s
= 3 ; x ; y → Move window -to [x, y].
-P s
= 4 ; height ; width → -Resize the xterm window to given height and width in -pixels. Omitted parameters reuse the current height or -width. Zero parameters use the display’s height or -width.
-P s
= 5 → Raise the xterm -window to the front of the stacking order.
-P s
= 6 → Lower the xterm -window to the bottom of the stacking order.
-P s
= 7 → Refresh the xterm -window.
-P s
= 8 ; height ; width → -Resize the text area to given height and width in -characters. Omitted parameters reuse the current height or -width. Zero parameters use the display’s height or -width.
-P s
= 9 ; 0 → Restore maximized -window.
-P s
= 9 ; 1 → Maximize window (i.e., -resize to screen size).
-P s
= 1 0 ; 0 → Undo full-screen -mode.
-P s
= 1 0 ; 1 → Change to -full-screen.
-P s
= 1 1 → Report xterm -window state. If the xterm window is open -(non-iconified), it returns -CSI 1 t . If the xterm -window is iconified, it returns -CSI 2 t .
-P s
= 1 3 → Report xterm -window position. Result is CSI -3 ; x ; y t
-P s
= 1 4 → Report xterm -window in pixels. Result is -CSI 4 ; height ; -width t
-P s
= 1 8 → Report the size of the -text area in characters. Result is -CSI 8 ; height ; -width t
-P s
= 1 9 → Report the size of the -screen in characters. Result is -CSI 9 ; height ; -width t
-P s
= 2 0 → Report xterm -window’s icon label. Result is -OSC L label -ST
-P s
= 2 1 → Report xterm -window’s title. Result is -OSC l label -ST
-P s
= 2 2 ; 0 → Save xterm -icon and window title on stack.
-P s
= 2 2 ; 1 → Save xterm -icon title on stack.
-P s
= 2 2 ; 2 → Save xterm -window title on stack.
-P s
= 2 3 ; 0 → Restore xterm -icon and window title from stack.
-P s
= 2 3 ; 1 → Restore xterm -icon title from stack.
-P s
= 2 3 ; 2 → Restore xterm -window title from stack.
-P s
>= 2 4 → Resize to P -s lines (DECSLPP).

- - - - - -
- - -

CSI P -t ; P l ; P -b ; P r ; P -s $ t

-
- -

Reverse Attributes in -Rectangular Area (DECRARA), VT400 and up.
-P t
; P l ; P -b ; P r denotes the -rectangle.
-P s
denotes the attributes to reverse, -i.e., 1, 4, 5, 7.

- - - - - -
- - -

CSI > P -s ; P s t

-
- -

Set one or more features of the -title modes. Each parameter enables a single feature. -
-P s
= 0 → Set window/icon labels -using hexadecimal.
-P s
= 1 → Query window/icon labels -using hexadecimal.
-P s
= 2 → Set window/icon labels -using UTF-8.
-P s
= 3 → Query window/icon labels -using UTF-8. (See discussion of "Title Modes")

- - - - - -
- - -

CSI P -s SP t

-
- -

Set warning-bell volume -(DECSWBV, VT520).
-P s
= 0 or 1 → off.
-P s
= 2 , 3 or 4 → low.
-P s
= 5 , 6 , 7 , or 8 → high.

- - - - - - - - - - - - -
- - -

CSI u

- - -

Restore cursor (ANSI.SYS).

-
- - -

CSI P -s SP

-
- -

u

- - - - - - -
- - -

Set margin-bell volume (DECSMBV, -VT520).

-
- -

P s = 1 -→ off.
-P s
= 2 , 3 or 4 → low.
-P s
= 0 , 5 , 6 , 7 , or 8 → -high.

- - - - - -
- - -

CSI P -t ; P l ; P -b ; P r ; P -p ; P t ; P -l ; P p $ v

-
- -

Copy Rectangular Area (DECCRA, -VT400 and up).
-P t
; P l ; P -b ; P r denotes the -rectangle.
-P p
denotes the source page.
-P t
; P l denotes -the target location.
-P p
denotes the target page.

- - - - - -
- - -

CSI P -t ; P l ; P -b ; P r ’ -w

-
- -

Enable Filter Rectangle -(DECEFR), VT420 and up.
-Parameters are [top;left;bottom;right].
-Defines the coordinates of a filter rectangle and activates -it. Anytime the locator is detected outside of the filter -rectangle, an outside rectangle event is generated and the -rectangle is disabled. Filter rectangles are always treated -as "one-shot" events. Any parameters that are -omitted default to the current locator position. If all -parameters are omitted, any locator motion will be reported. -DECELR always cancels any prevous rectangle definition.

- - - - - - - -
- - -

CSI P -s x

- - -

Request Terminal Parameters -(DECREQTPARM).

-
- -

if P s is -a "0" (default) or "1", and xterm -is emulating VT100, the control sequence elicits a response -of the same form whose parameters describe the terminal: -
-P s
→ the given P -s incremented by 2.
-P n
= 1 ← no parity.
-P n
= 1 ← eight bits.
-P n
= 1 ← 2 8 transmit 38.4k baud. -
-P n
= 1 ← 2 8 receive 38.4k baud. -
-P n
= 1 ← clock multiplier.
-P n
= 0 ← STP flags.

- - - - - - -
- - -

CSI P -s * x

- - -

Select Attribute Change Extent -(DECSACE).

-
- -

P s = 0 -→ from start to end position, wrapped.
-P s
= 1 → from start to end -position, wrapped.
-P s
= 2 → rectangle (exact).

- - - - - -
- - -

CSI P -i ; P g ; P -t ; P l ; P -b ; P r * y

-
- -

Request Checksum of Rectangular -Area (DECRQCRA), VT420 and up. Response is -
-DCS
P t ! x x x x -ST
-P i
is the request id.
-P g
is the page number.
-P t
; P l ; P -b ; P r denotes the -rectangle.
-The x’s are hexadecimal digits 0-9 and A-F.

- - - - - -
- - -

CSI P -c ; P t ; P -l ; P b ; P -r $ x

-
- -

Fill Rectangular Area (DECFRA), -VT420 and up.
-P c
is the character to use.
-P t
; P l ; P -b ; P r denotes the -rectangle.

- - - - - -
- - -

CSI P -s ; P u ’ -z

-
- -

Enable Locator Reporting -(DECELR).
-Valid values for the first parameter:
-P s
= 0 → Locator disabled -(default).
-P s
= 1 → Locator enabled.
-P s
= 2 → Locator enabled for one -report, then disabled.
-The second parameter specifies the coordinate unit for -locator reports.
-Valid values for the second parameter:
-P u
= 0 ← or omitted → default -to character cells.
-P u
= 1 ← device physical pixels. -
-P u
= 2 ← character cells.

- - - - - -
- - -

CSI P -t ; P l ; P -b ; P r $ z

-
- -

Erase Rectangular Area -(DECERA), VT400 and up.
-P t
; P l ; P -b ; P r denotes the -rectangle.

- - - - - - -
- - -

CSI P -m ’ {

- - -

Select Locator Events (DECSLE).

-
- -

Valid values for the first (and -any additional parameters) are:
-P s
= 0 → only respond to explicit -host requests (DECRQLP).
-(This is default). It also cancels any filter
-rectangle.
-P s
= 1 → report button down -transitions.
-P s
= 2 → do not report button down -transitions.
-P s
= 3 → report button up -transitions.
-P s
= 4 → do not report button up -transitions.

- - - - - -
- - -

CSI P -t ; P l ; P -b ; P r $ {

-
- -

Selective Erase Rectangular -Area (DECSERA), VT400 and up.
-P t
; P l ; P -b ; P r denotes the -rectangle.

- - - - - - -
- - -

CSI P -s ’ |

- - -

Request Locator Position (DECRQLP).

-
- -

Valid values for the parameter -are:
-P s
= 0 , 1 or omitted → transmit a -single DECLRP locator report.

- -

If Locator -Reporting has been enabled by a DECELR, xterm will respond -with a DECLRP Locator Report. This report is also generated -on button up and down events if they have been enabled with -a DECSLE, or when the locator is detected outside of a -filter rectangle, if filter rectangles have been enabled -with a DECEFR.

- -

→ -CSI P e -; P b ; P r ; -P c ; P p & -w

- -

Parameters are -[event;button;row;column;page].
-Valid values for the event:
-P e
= 0 → locator unavailable - no -other parameters sent.
-P e
= 1 → request - xterm received a -DECRQLP.
-P e
= 2 → left button down.
-P e
= 3 → left button up.
-P e
= 4 → middle button down. -
-P e
= 5 → middle button up.
-P e
= 6 → right button down.
-P e
= 7 → right button up.
-P e
= 8 → M4 button down.
-P e
= 9 → M4 button up.
-P e
= 1 0 → locator outside filter -rectangle.
-‘‘button’’ parameter is a bitmask -indicating which buttons are pressed:
-P b
= 0 ← no buttons down.
-P b
& 1 ← right button down. -
-P b
& 2 ← middle button down. -
-P b
& 4 ← left button down. -
-P b
& 8 ← M4 button down.
-‘‘row’’ and -‘‘column’’ parameters are the -coordinates of the locator position in the xterm window, -encoded as ASCII decimal.
-The ‘‘page’’ parameter is not used -by xterm, and will be omitted.

- - - - - -
- - -

CSI P -m SP }

-
- -

Insert P -s Column(s) (default = 1) (DECIC), VT420 -and up.

- - - - - -
- - -

CSI P -m SP ~

-
- -

Delete P -s Column(s) (default = 1) (DECDC), VT420 -and up.

- -

Operating System -Controls

- - - - - - - - -
- - -

OSC P -s ; P t -ST

-
- - -

OSC P -s ; P t -BEL

-
- -

Set Text Parameters. For colors -and font, if P t is a "?", -the control sequence elicits a response which consists of -the control sequence which would set the corresponding -value. The dtterm control sequences allow you to -determine the icon name and window title.
-P s
= 0 → Change Icon Name and -Window Title to P t .
-P s
= 1 → Change Icon Name to P -t .
-P s
= 2 → Change Window Title to -P t .
-P s
= 3 → Set X property on -top-level window. P t should be in the -form "prop=value", or just -"prop" to delete the property
-P s
= 4 ; c ; spec → Change -Color Number c to the color specified by spec. -This can be a name or RGB specification as per -XParseColor. Any number of c name pairs may be -given. The color numbers correspond to the ANSI colors 0-7, -their bright versions 8-15, and if supported, the remainder -of the 88-color or 256-color table.

- -

If a -"?" is given rather than a name or RGB -specification, xterm replies with a control sequence of the -same form which can be used to set the corresponding color. -Because more than one pair of color number and specification -can be given in one control sequence, xterm can make -more than one reply.

- -

P -s = 5 ; c ; spec → Change -Special Color Number c to the color specified by -spec. This can be a name or RGB specification as per -XParseColor. Any number of c name pairs may be -given. The special colors can also be set by adding the -maximum number of colors to these codes in an -OSC 4 control:

- -

P -c = 0 ← resource colorBD -(BOLD).
-P c
= 1 ← resource colorUL -(UNDERLINE).
-P c
= 2 ← resource colorBL -(BLINK).
-P c
= 3 ← resource colorRV -(REVERSE).

- -

The 10 colors -(below) which may be set or queried using 1 0 through 1 9 -are denoted dynamic colors, since the corresponding -control sequences were the first means for setting -xterm’s colors dynamically, i.e., after it was -started. They are not the same as the ANSI colors. These -controls may be disabled using the allowColorOps -resource. At least one parameter is expected for P -t . Each successive parameter changes the -next color in the list. The value of P -s tells the starting point in the list. -The colors are specified by name or RGB specification as per -XParseColor.

- -

If a -"?" is given rather than a name or RGB -specification, xterm replies with a control sequence of the -same form which can be used to set the corresponding dynamic -color. Because more than one pair of color number and -specification can be given in one control sequence, -xterm can make more than one reply.

- -

P -s = 1 0 → Change VT100 text -foreground color to P t .
-P s
= 1 1 → Change VT100 text -background color to P t .
-P s
= 1 2 → Change text cursor color -to P t .
-P s
= 1 3 → Change mouse foreground -color to P t .
-P s
= 1 4 → Change mouse background -color to P t .
-P s
= 1 5 → Change Tektronix -foreground color to P t .
-P s
= 1 6 → Change Tektronix -background color to P t .
-P s
= 1 7 → Change highlight -background color to P t .
-P s
= 1 8 → Change Tektronix cursor -color to P t .
-P s
= 1 9 → Change highlight -foreground color to P t .

- -

P -s = 4 6 → Change Log File to P -t . (This is normally disabled by a -compile-time option).

- -

P -s = 5 0 → Set Font to P -t . These controls may be disabled using -the allowFontOps resource. If P -t begins with a "#", index in -the font menu, relative (if the next character is a plus or -minus sign) or absolute. A number is expected but not -required after the sign (the default is the current entry -for relative, zero for absolute indexing).
-The same rule (plus or minus sign, optional number) is used -when querying the font. The remainder of P -t is ignored.
-A font can be specified after a "#" index -expression, by adding a space and then the font specifier. -
-If the "TrueType Fonts" menu entry is set (the -renderFont resource), then this control sets/queries -the faceName resource.

- -

P -s = 5 1 (reserved for Emacs shell).

- -

P -s = 5 2 → Manipulate Selection Data. -These controls may be disabled using the -allowWindowOps resource. The parameter P -t is parsed as

- - - - - -
- - -

P c ; P -d

- -

The first, P -c , may contain zero or more characters -from the set c p s 0 1 2 3 4 5 6 7 . It is used to construct -a list of selection parameters for clipboard, primary, -select, or cut buffers 0 through 7 respectively, in the -order given. If the parameter is empty, xterm uses s -0 , to specify the configurable primary/clipboard selection -and cut buffer 0.
-The second parameter, P d , gives the -selection data. Normally this is a string encoded in base64. -The data becomes the new selection, which is then available -for pasting by other applications.
-If the second parameter is a ? , xterm replies to the -host with the selection data encoded using the same -protocol.
-If the second parameter is neither a base64 string nor ? , -then the selection is cleared.

- -

P -s = 1 0 4 ; c → Reset Color -Number c. It is reset to the color specified by the -corresponding X resource. Any number of c parameters -may be given. These parameters correspond to the ANSI colors -0-7, their bright versions 8-15, and if supported, the -remainder of the 88-color or 256-color table. If no -parameters are given, the entire table will be reset.

- -

P -s = 1 0 5 ; c → Reset Special -Color Number c. It is reset to the color specified by -the corresponding X resource. Any number of c -parameters may be given. These parameters correspond to the -special colors which can be set using an -OSC 5 control (or by adding -the maximum number of colors using an -OSC 4 control).

- -

The dynamic -colors can also be reset to their default (resource) -values:
-P s
= 1 1 0 → Reset VT100 text -foreground color.
-P s
= 1 1 1 → Reset VT100 text -background color.
-P s
= 1 1 2 → Reset text cursor -color.
-P s
= 1 1 3 → Reset mouse foreground -color.
-P s
= 1 1 4 → Reset mouse background -color.
-P s
= 1 1 5 → Reset Tektronix -foreground color.
-P s
= 1 1 6 → Reset Tektronix -background color.
-P s
= 1 1 7 → Reset highlight color. -
-P s
= 1 1 8 → Reset Tektronix cursor -color.

- -

Privacy -Message

- - - - - - -
- - -

PM P -t ST

- - -

xterm implements no -PM functions; P -t is ignored. P t -need not be printable characters.

- - -

Alt and Meta Keys

- - -

Many keyboards have -keys labeled "Alt". Few have keys labeled -"Meta". However, xterm’s default -translations use the Meta modifier. Common keyboard -configurations assign the Meta modifier to an -"Alt" key. By using xmodmap one may have -the modifier assigned to a different key, and have -"real" alt and meta keys. Here is an example:

- -

! put meta on -mod3 to distinguish it from alt
-keycode 64 = Alt_L
-clear mod1
-add mod1 = Alt_L
-keycode 115 = Meta_L
-clear mod3
-add mod3 = Meta_L

- -

The -metaSendsEscape resource (and altSendsEscape -if altIsNotMeta is set) can be used to control the -way the Meta modifier applies to ordinary keys unless -the modifyOtherKeys resource is set:

- -

- prefix a key with the -ESC character.
-- shift the key from codes 0-127 to 128-255 by adding -128.

- -

The table shows the -result for a given character "x" with modifiers -according to the default translations with the resources set -on or off. This assumes altIsNotMeta is set:

- - -

Image grohtml-285551.png

- - -

PC-Style Function Keys

- - -

If xterm -does minimal translation of the function keys, it usually -does this with a PC-style keyboard, so PC-style function -keys result. Sun keyboards are similar to PC keyboards. Both -have cursor and scrolling operations printed on the keypad, -which duplicate the smaller cursor and scrolling -keypads.

- -

X does not -predefine NumLock (used for VT220 keyboards) or Alt (used as -an extension for the Sun/PC keyboards) as modifiers. These -keys are recognized as modifiers when enabled by the -numLock resource, or by the "DECSET 1 0 3 5 -" control sequence.

- -

The cursor keys -transmit the following escape sequences depending on the -mode specified via the DECCKM escape sequence.

- - -

Image grohtml-285552.png

- -

The home- and end-keys (unlike PageUp and -other keys also on the 6-key editing keypad) are considered -"cursor keys" by xterm. Their mode is also -controlled by the DECCKM escape sequence:

- - -

Image grohtml-285553.png

- -

The application -keypad transmits the following escape sequences depending on -the mode specified via the DECPNM and DECPAM -escape sequences. Use the NumLock key to override the -application mode.

- -

Not all keys are -present on the Sun/PC keypad (e.g., PF1, Tab), but are -supported by the program.

- - -

Image grohtml-285554.png

- -

They also provide 12 function keys, as well -as a few other special-purpose keys:

- - -

Image grohtml-285555.png

- -

Older versions of -xterm implement different escape sequences for F1 -through F4. These can be activated by setting the -oldXtermFKeys resource. However, since they do not -correspond to any hardware terminal, they have been -deprecated. (The DEC VT220 reserves F1 through F5 for local -functions such as Setup).

- - -

Image grohtml-285556.png

- -

In normal mode, i.e., a Sun/PC keyboard -when the sunKeyboard resource is false, xterm -recognizes function key modifiers which are parameters -appended before the final character of the control -sequence.

- - -

Image grohtml-285557.png

- -

For example, shift-F5 would be sent as -CSI 1 5 ; 2 ~

- -

If the -alwaysUseMods resource is set, the Meta modifier also -is recognized, making parameters 9 through 16.

- - -

VT220-Style Function Keys

- - -

However, -xterm is most useful as a DEC VT102 or VT220 -emulator. Set the sunKeyboard resource to true to -force a Sun/PC keyboard to act like a VT220 keyboard.

- -

The VT102/VT220 -application keypad transmits unique escape sequences in -application mode, which are distinct from the cursor and -scrolling keypad:

- - -

Image grohtml-285558.png

- -

The VT220 provides a 6-key editing keypad, -which is analogous to that on the PC keyboard. It is not -affected by DECCKM or -DECPNM/DECPAM:

- - -

Image grohtml-285559.png

- -

The VT220 provides 8 additional function -keys. With a Sun/PC keyboard, access these keys by -Control/F1 for F13, etc.

- - -

Image grohtml-2855510.png

- - -

VT52-Style Function Keys

- - -

A VT52 does not -have function keys, but it does have a numeric keypad and -cursor keys. They differ from the other emulations by the -prefix. Also, the cursor keys do not change:

- - -

Image grohtml-2855511.png

- -

The keypad is similar:

- - -

Image grohtml-2855512.png

- - -

Sun-Style Function Keys

- - -

The xterm -program provides support for Sun keyboards more directly, by -a menu toggle that causes it to send Sun-style function key -codes rather than VT220. Note, however, that the sun -and VT100 emulations are not really compatible. For -example, their wrap-margin behavior differs.

- -

Only function keys -are altered; keypad and cursor keys are the same. The -emulation responds identically. See the xterm-sun terminfo -entry for details.

- - -

HP-Style Function Keys

- - -

Similarly, -xterm can be compiled to support HP keyboards. See -the xterm-hp terminfo entry for details.

- - -

The Alternate Screen Buffer

- - -

Xterm -maintains two screen buffers. The normal screen buffer -allows you to scroll back to view saved lines of output up -to the maximum set by the saveLines resource. The -alternate screen buffer is exactly as large as the display, -contains no additional saved lines. When the alternate -screen buffer is active, you cannot scroll back to view -saved lines. Xterm provides control sequences and -menu entries for switching between the two.

- -

Most full-screen -applications use terminfo or termcap to obtain strings used -to start/stop full-screen mode, i.e., smcup and -rmcup for terminfo, or the corresponding ti -and te for termcap. The titeInhibit resource -removes the ti and te strings from the TERMCAP -string which is set in the environment for some platforms. -That is not done when xterm is built with terminfo -libraries because terminfo does not provide the whole text -of the termcap data in one piece. It would not work for -terminfo anyway, since terminfo data is not passed in -environment variables; setting an environment variable in -this manner would have no effect on the application’s -ability to switch between normal and alternate screen -buffers. Instead, the newer private mode controls (such as 1 -0 4 9 ) for switching between normal and alternate screen -buffers simply disable the switching. They add other -features such as clearing the display for the same reason: -to make the details of switching independent of the -application that requests the switch.

- - -

Bracketed Paste Mode

- - -

When bracketed -paste mode is set, pasted text is bracketed with control -sequences so that the program can differentiate pasted text -from typed-in text. When bracketed paste mode is set, the -program will receive:
-ESC
[ 200 ~,
-followed by the pasted text, followed by
-ESC
[ 201 ~.

- - -

Title Modes

- - -

The window- and -icon-labels can be set or queried using control sequences. -As a VT220-emulator, xterm "should" limit -the character encoding for the corresponding strings to -ISO-8859-1. Indeed, it used to be the case (and was -documented) that window titles had to be ISO-8859-1. This is -no longer the case. However, there are many applications -which still assume that titles are set using ISO-8859-1. So -that is the default behavior.

- -

If xterm is -running with UTF-8 encoding, it is possible to use window- -and icon-labels encoded using UTF-8. That is because the -underlying X libraries (and many, but not all) window -managers support this feature.

- -

The -utf8Title X resource setting tells xterm to -disable a reconversion of the title string back to -ISO-8859-1, allowing the title strings to be interpreted as -UTF-8. The same feature can be enabled using the title mode -control sequence described in this summary.

- -

Separate from the -ability to set the titles, xterm provides the ability -to query the titles, returning them either in ISO-8859-1 or -UTF-8. This choice is available only while xterm is -using UTF-8 encoding.

- -

Finally, the -characters sent to, or returned by a title control are less -constrained than the rest of the control sequences. To make -them more manageable (and constrained), for use in shell -scripts, xterm has an optional feature which decodes -the string from hexadecimal (for setting titles) or for -encoding the title into hexadecimal when querying the -value.

- - -

Mouse Tracking

- - -

The VT widget can -be set to send the mouse position and other information on -button presses. These modes are typically used by editors -and other full-screen applications that want to make use of -the mouse.

- -

There are two sets -of mutually exclusive modes:

- - - - - - - - - - - - -
- - -

- - -

mouse protocol

-
- - -

- - -

protocol encoding

-
- -

The mouse protocols -include DEC Locator mode, enabled by the DECELR -CSI P s -; P s ’ z control sequence, and -is not described here (control sequences are summarized -above). The remaining five modes of the mouse protocols are -each enabled (or disabled) by a different parameter in the -"DECSET CSI ? P -m h " or "DECRST -CSI ? P -m l " control sequence.

- -

Manifest constants -for the parameter values are defined in xcharmouse.h -as follows:

- -

#define -SET_X10_MOUSE 9
-#define SET_VT200_MOUSE 1000
-#define SET_VT200_HIGHLIGHT_MOUSE 1001
-#define SET_BTN_EVENT_MOUSE 1002
-#define SET_ANY_EVENT_MOUSE 1003

- -

#define -SET_FOCUS_EVENT_MOUSE 1004

- -

#define -SET_EXT_MODE_MOUSE 1005
-#define SET_SGR_EXT_MODE_MOUSE 1006
-#define SET_URXVT_EXT_MODE_MOUSE 1015

- -

The motion -reporting modes are strictly xterm extensions, and -are not part of any standard, though they are analogous to -the DEC VT200 DECELR locator reports.

- -

Normally, -parameters (such as pointer position and button number) for -all mouse tracking escape sequences generated by -xterm encode numeric parameters in a single character -as value+32. For example, ! specifies the value 1. -The upper left character position on the terminal is denoted -as 1,1. This scheme dates back to X10, though the normal -mouse-tracking (from X11) is more elaborate.

- -

X10 compatibility -mode sends an escape sequence only on button press, encoding -the location and the mouse button pressed. It is enabled by -specifying parameter 9 to DECSET. On button press, -xterm sends CSI M C -b C x C y -(6 characters).

- - - - - - - - - - -
- - -

- - -

C b is -button−1.

- - -

- - -

C x and C -y are the x and y coordinates of the -mouse when the button was pressed.

- -

Normal tracking -mode sends an escape sequence on both button press and -release. Modifier key (shift, ctrl, meta) information is -also sent. It is enabled by specifying parameter 1000 to -DECSET. On button press or release, xterm sends -CSI M C b C -x C y .

- - - - - - - - - - - - - - -
- - -

- - -

The low two bits of C -b encode button information: 0=MB1 -pressed, 1=MB2 pressed, 2=MB3 pressed, 3=release.

- - -

- - -

The next three bits encode the modifiers -which were down when the button was pressed and are added -together: 4=Shift, 8=Meta, 16=Control. Note however that the -shift and control bits are normally unavailable because -xterm uses the control modifier with mouse for popup -menus, and the shift modifier is used in the default -translations for button events. The Meta modifier -recognized by xterm is the mod1 mask, and is -not necessarily the "Meta" key (see -xmodmap).

- - -

- - -

C x and C -y are the x and y coordinates of the -mouse event, encoded as in X10 mode.

- -

Wheel mice may -return buttons 4 and 5. Those buttons are represented by the -same event codes as buttons 1 and 2 respectively, except -that 64 is added to the event code. Release events for the -wheel buttons are not reported.

- -

Mouse highlight -tracking notifies a program of a button press, receives a -range of lines from the program, highlights the region -covered by the mouse within that range until button release, -and then sends the program the release coordinates. It is -enabled by specifying parameter 1001 to DECSET. Highlighting -is performed only for button 1, though other button events -can be received.

- -

Warning: use -of this mode requires a cooperating program or it will hang -xterm.

- -

On button press, -the same information as for normal tracking is generated; -xterm then waits for the program to send mouse -tracking information. All X events are ignored until the -proper escape sequence is received from the pty: -CSI P s -; P s ; P s ; -P s ; P s T . -The parameters are func, startx, starty, firstrow, -and lastrow. func is non-zero to initiate highlight -tracking and zero to abort. startx and starty -give the starting x and y location for the highlighted -region. The ending location tracks the mouse, but will never -be above row firstrow and will always be above row -lastrow. (The top of the screen is row 1.) When the -button is released, xterm reports the ending position -one of two ways:

- - - - - - - -
- - -

- - -

if the start and end coordinates are the -same locations:

-
- - -

CSI -t C x C y .

- - - - - - - -
- - -

- - -

otherwise:

-
- - -

CSI -T C x C y C -x C y C x C -y .
-The parameters are startx, starty, endx, endy, -mousex, and mousey.

- - - - - - - - - - - - -
- - -

- - -

startx, starty, endx, and -endy give the starting and ending character positions -of the region.

- - -

- - -

mousex and mousey give the -location of the mouse at button up, which may not be over a -character.

- -

Button-event -tracking is essentially the same as normal tracking, but -xterm also reports button-motion events. Motion -events are reported only if the mouse pointer has moved to a -different character cell. It is enabled by specifying -parameter 1002 to DECSET. On button press or release, -xterm sends the same codes used by normal tracking -mode.

- - - - - - - - - - -
- - -

- - -

On button-motion events, xterm adds -32 to the event code (the third character, C -b ).

- - -

- - -

The other bits of the event code specify -button and modifier keys as in normal mode. For example, -motion into cell x,y with button 1 down is reported as -CSI M @ C x -C y . ( @ = 32 + 0 (button 1) + 32 -(motion indicator) ). Similarly, motion with button 3 -down is reported as CSI M B -C x C y . ( B = 32 -+ 2 (button 3) + 32 (motion indicator) ).

- -

Any-event mode is -the same as button-event mode, except that all motion events -are reported, even if no mouse button is down. It is enabled -by specifying 1003 to DECSET.

- -

FocusIn/FocusOut -can be combined with any of the mouse events since it uses a -different protocol. When set, it causes xterm to send -CSI I when the terminal gains -focus, and CSI O when it loses -focus.

- -

The original X10 -mouse protocol limits the C x and C -y ordinates to 223 (=255 - 32). -Xterm supports more than one scheme for extending -this range, by changing the protocol encoding:

- - - - - -
- - -

UTF-8 (1005)

-
- -

This enables UTF-8 encoding for -C x and C y -under all tracking modes, expanding the maximum encodable -position from 223 to 2015. For positions less than 95, the -resulting output is identical under both modes. Under -extended mouse mode, positions greater than 95 generate -"extra" bytes which will confuse applications -which do not treat their input as a UTF-8 stream. Likewise, -C b will be UTF-8 encoded, to reduce -confusion with wheel mouse events.
-Under normal mouse mode, positions outside (160,94) result -in byte pairs which can be interpreted as a single UTF-8 -character; applications which do treat their input as UTF-8 -will almost certainly be confused unless extended mouse mode -is active.
-This scheme has the drawback that the encoded coordinates -will not pass through luit unchanged, e.g., for -locales using non-UTF-8 encoding.

- - - - - -
- - -

SGR (1006)

- - -

The normal mouse response is altered to use -CSI < followed by -semicolon-separated encoded button value, the C -x and C y ordinates -and a final character which is M for button press and m for -button release.

- -

The encoded button value in -this case does not add 32 since that was useful only in the -X10 scheme for ensuring that the byte containing the button -value is a printable code. The modifiers are encoded in the -same way. A different final character is used for button -release to resolve the X10 ambiguity regarding which button -was released.
-The highlight tracking responses are also modified to an -SGR-like format, using the same SGR-style scheme and -button-encodings.

- - - - - -
- - -

URXVT (1015)

-
- -

The normal mouse response is -altered to use CSI followed by -semicolon-separated encoded button value, the C -x and C y ordinates -and final character M .
-This uses the same button encoding as X10, but printing it -as a decimal integer rather than as a single byte.
-However, CSI M can be mistaken -for DL (delete lines), while the highlight tracking -CSI T can be mistaken for SD -(scroll down), and the Window manipulation controls. For -these reasons, the 1015 control is not recommended; it is -not an improvement over 1005.

- - -

Tektronix 4014 Mode

- - -

Most of these -sequences are standard Tektronix 4014 control sequences. -Graph mode supports the 12-bit addressing of the Tektronix -4014. The major features missing are the write-through and -defocused modes. This document does not describe the -commands used in the various Tektronix plotting modes but -does describe the commands to switch modes.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - -

BEL

- - -

Bell (Ctrl-G).

- - -

BS

- - -

Backspace (Ctrl-H).

- - -

TAB

- - -

Horizontal Tab (Ctrl-I).

- - -

LF

- - -

Line Feed or New Line (Ctrl-J).

- - -

VT

- - -

Cursor up (Ctrl-K).

- - -

FF

- - -

Form Feed or New Page (Ctrl-L).

- - -

CR

- - -

Carriage Return (Ctrl-M).

- - -

ESC ETX

- - -

Switch to VT100 Mode ( -ESC Ctrl-C).

- - -

ESC ENQ

- - -

Return Terminal Status ( -ESC Ctrl-E).

- - -

ESC FF

- - -

PAGE (Clear Screen) ( -ESC Ctrl-L).

- - -

ESC SO

- - -

Begin 4015 APL mode ( -ESC Ctrl-N). (This is ignored -by xterm).

- - -

ESC SI

- - -

End 4015 APL mode ( -ESC Ctrl-O). (This is ignored -by xterm).

- - -

ESC ETB

- - -

COPY (Save Tektronix Codes to file -COPYyyyy-mm-dd.hh:mm:ss).

- - -

ETB -(end transmission block) is the same as Ctrl-W.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - -

ESC CAN

- - -

Bypass Condition ( -ESC Ctrl-X).

-
- - -

ESC SUB

- - -

GIN mode ( -ESC Ctrl-Z).

-
- - -

ESC FS

- - -

Special Point Plot Mode ( -ESC Ctrl-\).

-
- - -

ESC 8

- - -

Select Large Character Set.

-
- - -

ESC 9

- - -

Select #2 Character Set.

-
- - -

ESC :

- - -

Select #3 Character Set.

-
- - -

ESC ;

- - -

Select Small Character Set.

-
- - -

OSC P -s ; P

-
- -

t -BEL

- - - - - - -
- - -

Set Text Parameters of VT window.

-
- -

P s = 0 -→ Change Icon Name and Window Title to P -t .
-P s
= 1 → Change Icon Name to P -t .
-P s
= 2 → Change Window Title to -P t .
-P s
= 4 6 → Change Log File to P -t . (This is normally disabled by a -compile-time option).

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - -

ESC `

- - -

Normal Z Axis and Normal (solid) -Vectors.

-
- - -

ESC a

- - -

Normal Z Axis and Dotted Line Vectors.

-
- - -

ESC b

- - -

Normal Z Axis and Dot-Dashed Vectors.

-
- - -

ESC c

- - -

Normal Z Axis and Short-Dashed Vectors.

-
- - -

ESC d

- - -

Normal Z Axis and Long-Dashed Vectors.

-
- - -

ESC h

- - -

Defocused Z Axis and Normal (solid) -Vectors.

-
- - -

ESC i

- - -

Defocused Z Axis and Dotted Line -Vectors.

-
- - -

ESC j

- - -

Defocused Z Axis and Dot-Dashed -Vectors.

-
- - -

ESC k

- - -

Defocused Z Axis and Short-Dashed -Vectors.

-
- - -

ESC l

- - -

Defocused Z Axis and Long-Dashed -Vectors.

-
- - -

ESC p

- - -

Write-Thru Mode and Normal (solid) -Vectors.

-
- - -

ESC q

- - -

Write-Thru Mode and Dotted Line -Vectors.

-
- - -

ESC r

- - -

Write-Thru Mode and Dot-Dashed Vectors.

-
- - -

ESC s

- - -

Write-Thru Mode and Short-Dashed -Vectors.

-
- - -

ESC t

- - -

Write-Thru Mode and Long-Dashed -Vectors.

-
- - -

FS

- - -

Point Plot Mode (Ctrl-\).

-
- - -

GS

- - -

Graph Mode (Ctrl-]).

-
- - -

RS

- - -

Incremental Plot Mode (Ctrl-^).

-
- - -

US

- - -

Alpha Mode (Ctrl-_).

-
- - -

VT52 Mode

- - -

Parameters for -cursor movement are at the end of the -ESC Y escape sequence. Each -ordinate is encoded in a single character as -value+32. For example, ! is 1. The screen coordinate -system is 0-based.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - -

ESC -A

- - -

Cursor up.

-
- - -

ESC B

- - -

Cursor down.

-
- - -

ESC C

- - -

Cursor right.

-
- - -

ESC D

- - -

Cursor left.

-
- - -

ESC F

- - -

Enter graphics mode.

-
- - -

ESC G

- - -

Exit graphics mode.

-
- - -

ESC H

- - -

Move the cursor to the home position.

-
- - -

ESC I

- - -

Reverse line feed.

-
- - -

ESC J

- - -

Erase from the cursor to the end of the -screen.

-
- - -

ESC K

- - -

Erase from the cursor to the end of the -line.

-
- - -

ESC Y P -s P

-
- -

s

- - - - - - - - - - - - -
- - -

Move the cursor to given row and -column.

-
- - -

ESC Z

- - -

Identify.

-
- -

→ -ESC / Z (‘‘I am a -VT52.’’).

- - - - - - - - - - - - - - - - - -
- - -

ESC =

- - -

Enter alternate keypad mode.

-
- - -

ESC >

- - -

Exit alternate keypad mode.

-
- - -

ESC <

- - -

Exit VT52 mode (Enter VT100 mode).

-
-
- - diff --git a/yat/tests/auto/auto.pro b/yat/tests/auto/auto.pro deleted file mode 100644 index 99efd58..0000000 --- a/yat/tests/auto/auto.pro +++ /dev/null @@ -1,3 +0,0 @@ -TEMPLATE = subdirs -SUBDIRS = \ - block diff --git a/yat/tests/auto/block/block.pro b/yat/tests/auto/block/block.pro deleted file mode 100644 index ea88f5e..0000000 --- a/yat/tests/auto/block/block.pro +++ /dev/null @@ -1,8 +0,0 @@ -CONFIG += testcase -QT += testlib quick - -include(../../../backend/backend.pri) - -SOURCES += \ - tst_block.cpp \ - diff --git a/yat/tests/auto/block/tst_block.cpp b/yat/tests/auto/block/tst_block.cpp deleted file mode 100644 index a4f197e..0000000 --- a/yat/tests/auto/block/tst_block.cpp +++ /dev/null @@ -1,950 +0,0 @@ -#include "../../../backend/block.h" -#include - -#include -#include "../../../backend/screen.h" -#include "../../../backend/screen_data.h" - -class BlockHandler -{ -public: - BlockHandler(bool fill) { - screen.setHeight(5); - int width = 100; - screen.setWidth(width); - (*screen.currentScreenData()->it_for_row(0))->clear(); - if (fill) { - QString spaces(width, QChar(' ')); - block()->replaceAtPos(0, spaces, screen.defaultTextStyle()); - } - QCOMPARE(block()->style_list().size(), 1); - default_style = block()->style_list().at(0); - default_text_style = default_style.style; - } - - Block *block() const - { - return *screen.currentScreenData()->it_for_row(0); - } - - void doneChanges() - { - screen.dispatchChanges(); - } - - TextStyle default_style; - TextStyle::Styles default_text_style; - Screen screen; -}; - -class tst_Block: public QObject -{ - Q_OBJECT - -private slots: - void replaceStart(); - void replaceEdgeOfStyle(); - void replaceCompatibleStyle(); - void replaceCompatiblePreviousStyle(); - void replaceCompatiblePreviousStyleShouldRemove(); - void replaceCompatibleCurrentStyleShouldRemove(); - void replaceIncompatibleStyle(); - void replaceIncompaitibleStylesCrossesBoundary(); - void replace3IncompatibleStyles(); - void replaceIncomaptibleStylesCrosses2Boundaries(); - void replaceIncompatibleColor(); - void replaceRemoveOverlappedStyles(); - void replaceSwapStyles(); - void replaceEndBlock(); - void clearBlock(); - void clearToEndOfBlock1Segment(); - void clearToEndOfBlock3Segment(); - void clearToEndOfBlockMiddle3Segment(); - void deleteCharacters1Segment(); - void deleteCharacters2Segments(); - void deleteCharacters3Segments(); - void deleteCharactersRemoveSegmentEnd(); - void deleteCharactersRemoveSegmentBeginning(); - void deleteCharactersRemoveMiddle(); - void insertCharacters(); - void insertCharacters2Segments(); - void insertCharacters3Segments(); -}; - -void tst_Block::replaceStart() -{ - BlockHandler blockHandler(true); - Block *block = blockHandler.block(); - - QVector old_style_list = block->style_list(); - QCOMPARE(old_style_list.size(), 1); - - QString replace_text("This is a test"); - TextStyle textStyle; - textStyle.style = TextStyle::Overlined; - block->replaceAtPos(0,replace_text, textStyle); - - QVector new_style_list = block->style_list(); - TextStyleLine first_style = new_style_list.at(0); - QCOMPARE(first_style.start_index, 0); - QCOMPARE(first_style.end_index, replace_text.size() - 1); - QCOMPARE(new_style_list.size(), 2); - -} - -void tst_Block::replaceEdgeOfStyle() -{ - BlockHandler blockHandler(true); - Block *block = blockHandler.block(); - - QString first_text("This is the First"); - TextStyle textStyle; - textStyle.style = TextStyle::Overlined; - block->replaceAtPos(0,first_text, textStyle); - - QString second_text("This is the Second"); - textStyle.style = TextStyle::Bold; - block->replaceAtPos(first_text.size(), second_text, textStyle); - - QVector style_list = block->style_list(); - - QCOMPARE(style_list.size(), 3); - - const TextStyleLine &first_style = style_list.at(0); - QCOMPARE(first_style.style, TextStyle::Overlined); - QCOMPARE(first_style.start_index, 0); - QCOMPARE(first_style.end_index, first_text.size() - 1); - - const TextStyleLine &second_style = style_list.at(1); - QCOMPARE(second_style.style, TextStyle::Bold); - QCOMPARE(second_style.start_index, first_text.size()); - QCOMPARE(second_style.end_index, first_text.size()+ second_text.size() - 1); - - const TextStyleLine &third_style = style_list.at(2); - QCOMPARE(third_style.style, TextStyle::Normal); - QCOMPARE(third_style.start_index, first_text.size()+ second_text.size()); -} - -void tst_Block::replaceCompatibleStyle() -{ - BlockHandler blockHandler(true); - Block *block = blockHandler.block(); - - QString replace_text("replaceed Text"); - block->replaceAtPos(10, replace_text, blockHandler.default_style); - - QVector after_style_list = block->style_list(); - QCOMPARE(after_style_list.size(), 1); - QCOMPARE(after_style_list.at(0).style, blockHandler.default_text_style); -} - -void tst_Block::replaceCompatiblePreviousStyle() -{ - BlockHandler blockHandler(true); - Block *block = blockHandler.block(); - - TextStyle first_style = blockHandler.default_style; - first_style.style = TextStyle::Blinking; - QString first_text("first"); - block->replaceAtPos(0,first_text, first_style); - - TextStyle second_style = blockHandler.default_style; - second_style.style = TextStyle::Bold; - QString second_text("this is the second text"); - block->replaceAtPos(first_text.size(), second_text, second_style); - - QString third_text("third"); - block->replaceAtPos(first_text.size(), third_text,first_style); - - blockHandler.doneChanges(); - - QVector style_list = block->style_list(); - QCOMPARE(style_list.size(), 3); - - const TextStyleLine &first_check_style = style_list.at(0); - QCOMPARE(first_check_style.start_index, 0); - QCOMPARE(first_check_style.end_index, (first_text.size() -1) + third_text.size()); - - const TextStyleLine &second_check_style = style_list.at(1); - QCOMPARE(second_check_style.start_index, first_text.size() + third_text.size()); - QCOMPARE(second_check_style.end_index, (first_text.size() -1) + second_text.size()); - - const TextStyleLine &third_check_style = style_list.at(2); - QCOMPARE(third_check_style.start_index, first_text.size() + second_text.size()); -} - -void tst_Block::replaceCompatiblePreviousStyleShouldRemove() -{ - BlockHandler blockHandler(true); - Block *block = blockHandler.block(); - - TextStyle first_style = blockHandler.default_style; - first_style.style = TextStyle::Blinking; - QString first_text("first"); - block->replaceAtPos(0,first_text, first_style); - - TextStyle second_style = blockHandler.default_style; - second_style.style = TextStyle::Bold; - QString second_text("second"); - block->replaceAtPos(first_text.size(), second_text, second_style); - - QString third_text("this is the third"); - block->replaceAtPos(first_text.size(), third_text,first_style); - - blockHandler.doneChanges(); - - QVector style_list = block->style_list(); - QCOMPARE(style_list.size(), 2); - - const TextStyleLine &first_check_style = style_list.at(0); - QCOMPARE(first_check_style.start_index, 0); - QCOMPARE(first_check_style.end_index, (first_text.size() -1) + third_text.size()); - - const TextStyleLine &second_check_style = style_list.at(1); - QCOMPARE(second_check_style.start_index, first_text.size() + third_text.size()); - -} - -void tst_Block::replaceCompatibleCurrentStyleShouldRemove() -{ - BlockHandler blockHandler(true); - Block *block = blockHandler.block(); - - TextStyle first_style = blockHandler.default_style; - first_style.style = TextStyle::Blinking; - QString first_text("first"); - block->replaceAtPos(0,first_text, first_style); - - TextStyle second_style = blockHandler.default_style; - second_style.style = TextStyle::Bold; - QString second_text("second"); - block->replaceAtPos(first_text.size(), second_text, second_style); - - QString third_text("second"); - block->replaceAtPos(first_text.size(), third_text,first_style); - - blockHandler.doneChanges(); - - QVector style_list = block->style_list(); - QCOMPARE(style_list.size(), 2); - - const TextStyleLine &first_check_style = style_list.at(0); - QCOMPARE(first_check_style.start_index, 0); - QCOMPARE(first_check_style.end_index, (first_text.size() -1) + third_text.size()); - - const TextStyleLine &second_check_style = style_list.at(1); - QCOMPARE(second_check_style.start_index, first_text.size() + third_text.size()); - -} - -void tst_Block::replaceIncompatibleStyle() -{ - BlockHandler blockHandler(true); - Block *block = blockHandler.block(); - - - QString replace_text("replaceed Text"); - TextStyle replace_style; - replace_style.style = TextStyle::Blinking; - block->replaceAtPos(10, replace_text, replace_style); - - QVector after_style_list = block->style_list(); - QCOMPARE(after_style_list.size(), 3); - - const TextStyleLine &first_style = after_style_list.at(0); - QCOMPARE(first_style.start_index, 0); - QCOMPARE(first_style.end_index, 9); - QCOMPARE(first_style.style, blockHandler.default_text_style); - - const TextStyleLine &second_style = after_style_list.at(1); - QCOMPARE(second_style.start_index, 10); - QCOMPARE(second_style.end_index, 10 + replace_text.size() -1); - QCOMPARE(second_style.style, TextStyle::Blinking); - - const TextStyleLine &third_style = after_style_list.at(2); - QCOMPARE(third_style.start_index, 10 + replace_text.size()); - QCOMPARE(third_style.style, blockHandler.default_text_style); -} - -void tst_Block::replaceIncompaitibleStylesCrossesBoundary() -{ - BlockHandler blockHandler(true); - Block *block = blockHandler.block(); - - QString replace_text("replaceed Text"); - TextStyle replace_style; - replace_style.style = TextStyle::Blinking; - block->replaceAtPos(0, replace_text, replace_style); - - QString crosses_boundary("New incompatible text"); - replace_style.style = TextStyle::Framed; - int replace_pos = replace_text.size()/2; - block->replaceAtPos(replace_pos, crosses_boundary, replace_style); - - QVector after_style_list = block->style_list(); - QCOMPARE(after_style_list.size(), 3); - - const TextStyleLine &first_style = after_style_list.at(0); - QCOMPARE(first_style.start_index, 0); - QCOMPARE(first_style.end_index, replace_pos -1); - QCOMPARE(first_style.style, TextStyle::Blinking); - - const TextStyleLine &second_style = after_style_list.at(1); - QCOMPARE(second_style.start_index, replace_pos); - QCOMPARE(second_style.end_index, replace_pos + crosses_boundary.size() -1); - QCOMPARE(second_style.style, TextStyle::Framed); - - const TextStyleLine &third_style = after_style_list.at(2); - QCOMPARE(third_style.start_index, replace_pos + crosses_boundary.size()); - QCOMPARE(third_style.style, blockHandler.default_text_style); -} - -void tst_Block::replace3IncompatibleStyles() -{ - BlockHandler blockHandler(true); - Block *block = blockHandler.block(); - - QString first_text("First Text"); - TextStyle replace_style; - replace_style.style = TextStyle::Blinking; - block->replaceAtPos(0, first_text, replace_style); - - QString second_text("Second Text"); - replace_style.style = TextStyle::Italic; - block->replaceAtPos(first_text.size(), second_text, replace_style); - - QString third_text("Third Text"); - replace_style.style = TextStyle::Encircled; - block->replaceAtPos(first_text.size() + second_text.size(), third_text, replace_style); - - QCOMPARE(block->style_list().size(), 4); - - QVector after_style_list = block->style_list(); - - const TextStyleLine &first_style = after_style_list.at(0); - QCOMPARE(first_style.start_index, 0); - QCOMPARE(first_style.end_index, first_text.size() -1); - - const TextStyleLine &second_style = after_style_list.at(1); - QCOMPARE(second_style.start_index, first_text.size()); - QCOMPARE(second_style.end_index, first_text.size() + second_text.size() - 1); - QCOMPARE(second_style.style, TextStyle::Italic); - - const TextStyleLine &third_style = after_style_list.at(2); - QCOMPARE(third_style.start_index, first_text.size() + second_text.size()); - QCOMPARE(third_style.end_index, first_text.size() + second_text.size() + third_text.size() - 1); - QCOMPARE(third_style.style, TextStyle::Encircled); - - const TextStyleLine &fourth_style = after_style_list.at(3); - QCOMPARE(fourth_style.start_index, first_text.size() + second_text.size() + third_text.size()); -} -void tst_Block::replaceIncomaptibleStylesCrosses2Boundaries() -{ - BlockHandler blockHandler(true); - Block *block = blockHandler.block(); - - QString first_text("First Text"); - TextStyle replace_style; - replace_style.style = TextStyle::Blinking; - block->replaceAtPos(0, first_text, replace_style); - - QString second_text("Second Text"); - replace_style.style = TextStyle::Italic; - block->replaceAtPos(first_text.size(), second_text, replace_style); - - QString third_text("Third Text"); - replace_style.style = TextStyle::Encircled; - block->replaceAtPos(first_text.size() + second_text.size(), third_text, replace_style); - - QCOMPARE(block->style_list().size(), 4); - - QVector before_style_list = block->style_list(); - - QString overlap_first_third; - overlap_first_third.fill(QChar('A'), second_text.size() + 4); - replace_style.style = TextStyle::DoubleUnderlined; - block->replaceAtPos(first_text.size() -2, overlap_first_third, replace_style); - - QVector after_style_list = block->style_list(); - QCOMPARE(block->style_list().size(), 4); - - const TextStyleLine &first_style = after_style_list.at(0); - QCOMPARE(first_style.start_index, 0); - QCOMPARE(first_style.end_index, first_text.size() - 3); - QCOMPARE(first_style.style, TextStyle::Blinking); - - const TextStyleLine &second_style = after_style_list.at(1); - QCOMPARE(second_style.style, TextStyle::DoubleUnderlined); - QCOMPARE(second_style.start_index, first_text.size() - 2); - QCOMPARE(second_style.end_index, first_text.size() - 2 + overlap_first_third.size() -1); - - const TextStyleLine &third_style = after_style_list.at(2); - QCOMPARE(third_style.style, TextStyle::Encircled); - QCOMPARE(third_style.start_index, first_text.size() - 2 + overlap_first_third.size()); - QCOMPARE(third_style.end_index, first_text.size() - 2 + overlap_first_third.size() + third_text.size() - 1 - 2); - - const TextStyleLine &fourth_style = after_style_list.at(3); - QCOMPARE(fourth_style.style, blockHandler.default_text_style); - QCOMPARE(fourth_style.start_index, first_text.size() - 2 + overlap_first_third.size() + third_text.size() - 2); -} - -void tst_Block::replaceIncompatibleColor() -{ - BlockHandler blockHandler(true); - Block *block = blockHandler.block(); - - QString first_text("291 "); - TextStyleLine replace_style; - replace_style.forground = ColorPalette::Yellow; - block->replaceAtPos(0,first_text, replace_style); - - QString second_text("QPointF Screen::selectionAreaStart() "); - replace_style.forground = blockHandler.default_style.forground; - block->replaceAtPos(first_text.size(), second_text, replace_style); - - QString third_text("const"); - replace_style.forground = ColorPalette::Green; - block->replaceAtPos(first_text.size() + second_text.size(), third_text, replace_style); - - QString brackets("()"); - replace_style.forground = ColorPalette::Cyan; - block->replaceAtPos(38, brackets, replace_style); - - QVector after_style_list = block->style_list(); - - const TextStyleLine &first_style = after_style_list.at(0); - QCOMPARE(first_style.forground, ColorPalette::Yellow); - QCOMPARE(first_style.start_index, 0); - QCOMPARE(first_style.end_index, first_text.size() - 1); - - const TextStyleLine &second_style = after_style_list.at(1); - QCOMPARE(second_style.forground, blockHandler.default_style.forground); - QCOMPARE(second_style.start_index, first_text.size()); - QCOMPARE(second_style.end_index, 37); - - const TextStyleLine &third_style = after_style_list.at(2); - QCOMPARE(third_style.forground, ColorPalette::Cyan); - QCOMPARE(third_style.start_index, 38); - QCOMPARE(third_style.end_index, 38 + brackets.size() -1); - - const TextStyleLine &fourth_style = after_style_list.at(3); - QCOMPARE(fourth_style.forground, blockHandler.default_style.forground); - QCOMPARE(fourth_style.start_index, 38 + brackets.size()); - QCOMPARE(fourth_style.end_index, first_text.size() + second_text.size() -1); - -} - -void tst_Block::replaceRemoveOverlappedStyles() -{ - BlockHandler blockHandler(true); - Block *block = blockHandler.block(); - - QString first_text("First Text"); - TextStyle replace_style; - replace_style.style = TextStyle::Blinking; - block->replaceAtPos(0, first_text, replace_style); - - QString second_text("Second Text"); - replace_style.style = TextStyle::Italic; - block->replaceAtPos(first_text.size(), second_text, replace_style); - - QString third_text("Third Text"); - replace_style.style = TextStyle::Encircled; - block->replaceAtPos(first_text.size() + second_text.size(), third_text, replace_style); - - QString fourth_text = third_text + second_text; - fourth_text.chop(1); - replace_style.style = TextStyle::Bold; - block->replaceAtPos(first_text.size(), fourth_text, replace_style); - - QCOMPARE(block->style_list().size(), 4); -} -void tst_Block::replaceSwapStyles() -{ - BlockHandler blockHandler(true); - Block *block = blockHandler.block(); - - QString first_text("First Text"); - TextStyle replace_style; - replace_style.style = TextStyle::Blinking; - block->replaceAtPos(0, first_text, replace_style); - - QString second_text("Second Text"); - replace_style.style = TextStyle::Italic; - block->replaceAtPos(first_text.size(), second_text, replace_style); - - QString third_text("Third Text"); - replace_style.style = TextStyle::Encircled; - block->replaceAtPos(first_text.size() + second_text.size(), third_text, replace_style); - - QString replace_second("Dnoces Text"); - replace_style.style = TextStyle::Bold; - block->replaceAtPos(first_text.size(), replace_second, replace_style); - - QCOMPARE(block->style_list().size(), 4); -} - -void tst_Block::replaceEndBlock() -{ - BlockHandler blockHandler(true); - Block *block = blockHandler.block(); - - QString *full_block = block->textLine(); - int block_size = full_block->size(); - - QString replace_text("at the end of the string"); - TextStyle style = blockHandler.default_style; - style.style = TextStyle::Bold; - block->replaceAtPos(block_size - replace_text.size(), replace_text, style); - - QCOMPARE(block->textLine()->size(), block_size); - - QVector style_list = block->style_list(); - QCOMPARE(style_list.size(), 2); - - const TextStyleLine &first_style = style_list.at(0); - QCOMPARE(first_style.start_index, 0); - QCOMPARE(first_style.end_index, block_size - replace_text.size() -1); - QCOMPARE(first_style.style, blockHandler.default_text_style); - - const TextStyleLine &second_style = style_list.at(1); - QCOMPARE(second_style.start_index, block_size - replace_text.size()); - QCOMPARE(second_style.end_index, block_size - 1); - QCOMPARE(second_style.style, TextStyle::Bold); -} - -void tst_Block::clearBlock() -{ - BlockHandler blockHandler(true); - Block *block = blockHandler.block(); - - QVERIFY(block->textLine()->size() > 0); - QCOMPARE(block->textLine()->trimmed().size(), 0); -} - -void tst_Block::clearToEndOfBlock1Segment() -{ - BlockHandler blockHandler(true); - Block *block = blockHandler.block(); - - QString replace_text("To be replaceed"); - TextStyle style = blockHandler.default_style; - style.style = TextStyle::Encircled; - block->replaceAtPos(0, replace_text, style); - - int before_clear_size = block->textLine()->size(); - - block->clearCharacters(5, blockHandler.screen.width() -1); - - blockHandler.doneChanges(); - - int after_clear_size = block->textLine()->size(); - QCOMPARE(after_clear_size, before_clear_size); - QVector style_list = block->style_list(); - QCOMPARE(style_list.size(), 2); - - const TextStyleLine &first_style = style_list.at(0); - QCOMPARE(first_style.start_index, 0); - QCOMPARE(first_style.end_index, 4); - - const TextStyleLine &second_style = style_list.at(1); - QCOMPARE(second_style.start_index, 5); - - QString cleared("To be"); - QCOMPARE(block->textLine()->trimmed(), cleared); -} - -void tst_Block::clearToEndOfBlock3Segment() -{ - BlockHandler blockHandler(true); - Block *block = blockHandler.block(); - - QString replace_text("To be"); - TextStyle style = blockHandler.default_style; - style.style = TextStyle::Encircled; - block->replaceAtPos(0, replace_text, style); - - QString replace_text2(" or not to be"); - style.style = TextStyle::Bold; - block ->replaceAtPos(replace_text.size(), replace_text2, style); - - block->clearCharacters(replace_text.size(), blockHandler.screen.width() - 1); - - blockHandler.doneChanges(); - - QVector style_list = block->style_list(); - QCOMPARE(style_list.size(), 2); - - const TextStyleLine &first_style = style_list.at(0); - QCOMPARE(first_style.start_index, 0); - QCOMPARE(first_style.end_index, replace_text.size() - 1); - - const TextStyleLine &second_style = style_list.at(1); - QCOMPARE(second_style.start_index, replace_text.size()); - QCOMPARE(second_style.style, blockHandler.default_text_style); -} - -void tst_Block::clearToEndOfBlockMiddle3Segment() -{ - BlockHandler blockHandler(true); - Block *block = blockHandler.block(); - - QString replace_text("To be"); - TextStyle style = blockHandler.default_style; - style.style = TextStyle::Encircled; - block->replaceAtPos(0, replace_text, style); - - QString replace_text2(" or not to be"); - style.style = TextStyle::Bold; - block ->replaceAtPos(replace_text.size(), replace_text2, style); - - block->clearCharacters(replace_text.size() + 3, blockHandler.screen.width() - 1); - - blockHandler.doneChanges(); - - QVector style_list = block->style_list(); - QCOMPARE(style_list.size(), 3); - - const TextStyleLine &first_style = style_list.at(0); - QCOMPARE(first_style.start_index, 0); - QCOMPARE(first_style.end_index, replace_text.size() - 1); - - const TextStyleLine &second_style = style_list.at(1); - QCOMPARE(second_style.start_index, replace_text.size()); - QCOMPARE(second_style.end_index, replace_text.size() + 2); - - const TextStyleLine &third_style = style_list.at(2); - QCOMPARE(third_style.start_index, replace_text.size() + 3); - QCOMPARE(third_style.style, blockHandler.default_text_style); -} - -void tst_Block::deleteCharacters1Segment() -{ - BlockHandler blockHandler(true); - Block *block = blockHandler.block(); - - QString replace_text("replaceing some text"); - TextStyle style = blockHandler.default_style; - style.style = TextStyle::Encircled; - block->replaceAtPos(0, replace_text, style); - - QString *full_block = block->textLine(); - int block_size = full_block->size(); - - block->deleteCharacters(10,14); - - QCOMPARE(block->textLine()->size(), block_size - 5); - - QVector style_list = block->style_list(); - QCOMPARE(style_list.size(), 2); - - const TextStyleLine &first_style = style_list.at(0); - QCOMPARE(first_style.start_index, 0); - QCOMPARE(first_style.end_index, 14); - - const TextStyleLine &second_style = style_list.at(1); - QCOMPARE(second_style.start_index, 15); - QCOMPARE(second_style.style, blockHandler.default_text_style); -} - -void tst_Block::deleteCharacters2Segments() -{ - BlockHandler blockHandler(true); - Block *block = blockHandler.block(); - - QString replace_text("replaceing some text"); - TextStyle style = blockHandler.default_style; - style.style = TextStyle::Encircled; - block->replaceAtPos(0, replace_text, style); - - QString *full_block = block->textLine(); - int block_size = full_block->size(); - - block->deleteCharacters(15,25); - - QCOMPARE(block->textLine()->size(), block_size - 11); - - QVector style_list = block->style_list(); - QCOMPARE(style_list.size(), 2); - - const TextStyleLine &first_style = style_list.at(0); - QCOMPARE(first_style.start_index, 0); - QCOMPARE(first_style.end_index, 14); - - const TextStyleLine &second_style = style_list.at(1); - QCOMPARE(second_style.start_index, 15); - QCOMPARE(second_style.style, blockHandler.default_text_style); - -} - -void tst_Block::deleteCharacters3Segments() -{ - BlockHandler blockHandler(true); - Block *block = blockHandler.block(); - - QString replace_text("replaceing some text"); - TextStyle style = blockHandler.default_style; - style.style = TextStyle::Encircled; - block->replaceAtPos(0, replace_text, style); - - QString replace_more_text("Some more text"); - style.style = TextStyle::Bold; - block->replaceAtPos(replace_text.size(), replace_more_text, style); - - QString *full_block = block->textLine(); - int block_size = full_block->size(); - - block->deleteCharacters(10,15); - - QCOMPARE(block->textLine()->size(), block_size - 6); - - QVector style_list = block->style_list(); - QCOMPARE(style_list.size(), 3); - - const TextStyleLine &first_style = style_list.at(0); - QCOMPARE(first_style.start_index, 0); - QCOMPARE(first_style.end_index, 13); - - const TextStyleLine &second_style = style_list.at(1); - QCOMPARE(second_style.start_index, 14); - QCOMPARE(second_style.end_index, 14 + replace_more_text.size() -1); - QCOMPARE(second_style.style, TextStyle::Bold); - - const TextStyleLine &third_style = style_list.at(2); - QCOMPARE(third_style.start_index, 14 + replace_more_text.size()); - QCOMPARE(third_style.style, blockHandler.default_text_style); -} - -void tst_Block::deleteCharactersRemoveSegmentEnd() -{ - BlockHandler blockHandler(true); - Block *block = blockHandler.block(); - - QString replace_text("replaceing some text"); - TextStyle style = blockHandler.default_style; - style.style = TextStyle::Encircled; - block->replaceAtPos(0, replace_text, style); - - QString replace_more_text("Some more text"); - style.style = TextStyle::Bold; - block->replaceAtPos(replace_text.size(), replace_more_text, style); - - QString *full_block = block->textLine(); - int block_size = full_block->size(); - - block->deleteCharacters(16,33); - - QCOMPARE(block->textLine()->size(), block_size - ((33 - 16) + 1)); - - QVector style_list = block->style_list(); - QCOMPARE(style_list.size(), 2); - - const TextStyleLine &first_style = style_list.at(0); - QCOMPARE(first_style.start_index, 0); - QCOMPARE(first_style.end_index, 15); - - const TextStyleLine &second_style = style_list.at(1); - QCOMPARE(second_style.start_index, 16); - QCOMPARE(second_style.style, blockHandler.default_text_style); - -} - -void tst_Block::deleteCharactersRemoveSegmentBeginning() -{ - BlockHandler blockHandler(true); - Block *block = blockHandler.block(); - - QString replace_text("replaceing some text"); - TextStyle style = blockHandler.default_style; - style.style = TextStyle::Encircled; - block->replaceAtPos(0, replace_text, style); - - QString replace_more_text("Some more text"); - style.style = TextStyle::Bold; - block->replaceAtPos(replace_text.size(), replace_more_text, style); - - QString *full_block = block->textLine(); - int block_size = full_block->size(); - - block->deleteCharacters(replace_text.size(),replace_text.size() + replace_more_text.size() + 3); - - int expected_size = block_size -1 - ((replace_text.size() + replace_more_text.size() + 3 ) - replace_text.size()); - QCOMPARE(block->textLine()->size(), expected_size); - - QVector style_list = block->style_list(); - QCOMPARE(style_list.size(), 2); - - const TextStyleLine &first_style = style_list.at(0); - QCOMPARE(first_style.start_index, 0); - QCOMPARE(first_style.end_index, replace_text.size() - 1); - - const TextStyleLine &second_style = style_list.at(1); - QCOMPARE(second_style.start_index, replace_text.size()); - QCOMPARE(second_style.style, blockHandler.default_text_style); -} - -void tst_Block::deleteCharactersRemoveMiddle() -{ - BlockHandler blockHandler(true); - Block *block = blockHandler.block(); - - QString insert_text('A'); - int old_width = blockHandler.screen.width(); - QString empty(old_width - 2, ' '); - insert_text += empty + 'B'; - block->replaceAtPos(0, insert_text, blockHandler.default_style); - - Q_ASSERT(old_width == blockHandler.screen.width()); - Q_ASSERT(insert_text == *block->textLine()); - - block->deleteCharacters(1, old_width - 2); - - Q_ASSERT(QString("AB") == block->textLine()->trimmed()); -} - -void tst_Block::insertCharacters() -{ - BlockHandler blockHandler(true); - Block *block = blockHandler.block(); - - QString *full_block = block->textLine(); - int block_size = full_block->size(); - - QString insert_text("inserting some text"); - TextStyle style = blockHandler.default_style; - style.style = TextStyle::Encircled; - block->insertAtPos(5, insert_text, style); - - int expected_size = block_size + insert_text.size(); - - QCOMPARE(block->textLine()->size(), expected_size); - - QVector style_list = block->style_list(); - QCOMPARE(style_list.size(), 3); - - const TextStyleLine &first_style = style_list.at(0); - QCOMPARE(first_style.start_index, 0); - QCOMPARE(first_style.end_index, 4); - QCOMPARE(first_style.style, blockHandler.default_text_style); - - const TextStyleLine &second_style = style_list.at(1); - QCOMPARE(second_style.start_index, 5); - QCOMPARE(second_style.end_index, 5 + insert_text.size() -1); - QCOMPARE(second_style.style, TextStyle::Encircled); - - const TextStyleLine &third_style = style_list.at(2); - QCOMPARE(third_style.start_index, 5 + insert_text.size()); - QCOMPARE(third_style.end_index, expected_size - 1); - QCOMPARE(third_style.style, blockHandler.default_text_style); -} - -void tst_Block::insertCharacters2Segments() -{ - BlockHandler blockHandler(true); - Block *block = blockHandler.block(); - - QString *full_block = block->textLine(); - int block_size = full_block->size(); - - QString replace_text("at the end of the string"); - TextStyle style = blockHandler.default_style; - style.style = TextStyle::Bold; - block->replaceAtPos(block_size - replace_text.size(), replace_text, style); - - QString insert_text("inserting some text"); - style.style = TextStyle::Encircled; - block->insertAtPos(5, insert_text, style); - - int expected_size = block_size + insert_text.size(); - QCOMPARE(block->textLine()->size(), expected_size); - - QVector style_list = block->style_list(); - QCOMPARE(style_list.size(), 4); - - const TextStyleLine &first_style = style_list.at(0); - QCOMPARE(first_style.start_index, 0); - QCOMPARE(first_style.end_index, 4); - QCOMPARE(first_style.style, blockHandler.default_text_style); - - const TextStyleLine &second_style = style_list.at(1); - QCOMPARE(second_style.start_index, 5); - QCOMPARE(second_style.end_index, 5 + insert_text.size() -1); - QCOMPARE(second_style.style, TextStyle::Encircled); - - const TextStyleLine &third_style = style_list.at(2); - QCOMPARE(third_style.start_index, 5 + insert_text.size()); - QCOMPARE(third_style.end_index, block_size -1 - replace_text.size() + insert_text.size()); - QCOMPARE(third_style.style, blockHandler.default_text_style); - - const TextStyleLine &fourth_style = style_list.at(3); - QCOMPARE(fourth_style.start_index, block_size - replace_text.size() + insert_text.size()); - QCOMPARE(fourth_style.end_index, expected_size - 1 ); - QCOMPARE(fourth_style.style, TextStyle::Bold); -} - -void tst_Block::insertCharacters3Segments() -{ - BlockHandler blockHandler(true); - Block *block = blockHandler.block(); - - QString *full_block = block->textLine(); - int block_size = full_block->size(); - - QString replace_text("at the end of the string"); - TextStyle style = blockHandler.default_style; - style.style = TextStyle::Bold; - block->replaceAtPos(block_size - replace_text.size(), replace_text, style); - - QString replace_text2("somewhere in the string"); - style.style = TextStyle::Encircled; - block->replaceAtPos(20,replace_text2, style); - - QVector tmp_style_list = block->style_list(); - QCOMPARE(tmp_style_list.size(), 4); - - QString insert_text("this text is longer than last segment"); - style.style = TextStyle::Italic; - block->insertAtPos(10, insert_text, style); - - blockHandler.doneChanges(); - - int expected_size = block_size + insert_text.size(); - QCOMPARE(block->textLine()->size(), expected_size); - - block->printStyleList(); - QVector style_list = block->style_list(); - QCOMPARE(style_list.size(), 6); - - const TextStyleLine &first_style = style_list.at(0); - QCOMPARE(first_style.start_index, 0); - QCOMPARE(first_style.end_index, 9); - QCOMPARE(first_style.style, blockHandler.default_text_style); - - const TextStyleLine &second_style = style_list.at(1); - QCOMPARE(second_style.start_index, 10); - QCOMPARE(second_style.end_index, 10 + insert_text.size() -1); - QCOMPARE(second_style.style, TextStyle::Italic); - - const TextStyleLine &third_style = style_list.at(2); - QCOMPARE(third_style.start_index, 10 + insert_text.size()); - QCOMPARE(third_style.end_index, 20 + insert_text.size() - 1); - QCOMPARE(third_style.style, blockHandler.default_text_style); - - const TextStyleLine &fourth_style = style_list.at(3); - QCOMPARE(fourth_style.start_index, 20 + insert_text.size()); - QCOMPARE(fourth_style.end_index, 20 + insert_text.size() + replace_text2.size() - 1); - QCOMPARE(fourth_style.style, TextStyle::Encircled); - - const TextStyleLine &fith_style = style_list.at(4); - QCOMPARE(fith_style.start_index, 20 + insert_text.size() + replace_text2.size()); - QCOMPARE(fith_style.end_index, block_size - replace_text.size() + insert_text.size() - 1); - QCOMPARE(fith_style.style, blockHandler.default_text_style); - - const TextStyleLine &sixth_style = style_list.at(5); - QCOMPARE(sixth_style.start_index, block_size - replace_text.size() + insert_text.size()); - QCOMPARE(sixth_style.end_index, block_size + insert_text.size() - 1); - QCOMPARE(sixth_style.style, TextStyle::Bold); -} - -#include -QTEST_MAIN(tst_Block); diff --git a/yat/tests/tests.pro b/yat/tests/tests.pro deleted file mode 100644 index b8445a7..0000000 --- a/yat/tests/tests.pro +++ /dev/null @@ -1,3 +0,0 @@ -TEMPLATE = subdirs -SUBDIRS = \ - auto diff --git a/yat/yat.pro b/yat/yat.pro deleted file mode 100644 index fabc7b4..0000000 --- a/yat/yat.pro +++ /dev/null @@ -1,5 +0,0 @@ -TEMPLATE=subdirs -CONFIG += ordered -SUBDIRS= \ - yat_declarative \ - tests diff --git a/yat/yat_declarative/main.cpp b/yat/yat_declarative/main.cpp deleted file mode 100644 index bf18cd3..0000000 --- a/yat/yat_declarative/main.cpp +++ /dev/null @@ -1,46 +0,0 @@ -/************************************************************************************************** -* Copyright (c) 2012 Jørgen Lind -* -* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and -* associated documentation files (the "Software"), to deal in the Software without restriction, -* including without limitation the rights to use, copy, modify, merge, publish, distribute, -* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is -* furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included in all copies or -* substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT -* NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT -* OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -* -***************************************************************************************************/ - -#include -#include -#include - -#include - -#include "register_qml_types.h" -#include "terminal_screen.h" -#include "yat_pty.h" - -int main(int argc, char **argv) -{ - QGuiApplication app(argc, argv); - - register_qml_types(); - - QQmlEngine engine; - QQmlComponent component(&engine, QUrl("qrc:/qml/yat_declarative/main.qml")); - auto errors = component.errors(); - for (int i = 0; i < errors.size(); i++) { - qDebug() << errors.at(i).toString(); - } - component.create(); - - return app.exec(); -} diff --git a/yat/yat_declarative/mono_text.cpp b/yat/yat_declarative/mono_text.cpp deleted file mode 100644 index c0fb4f2..0000000 --- a/yat/yat_declarative/mono_text.cpp +++ /dev/null @@ -1,249 +0,0 @@ -/****************************************************************************** -* Copyright (c) 2012 Jørgen Lind -* -* Permission is hereby granted, free of charge, to any person obtaining a copy -* of this software and associated documentation files (the "Software"), to deal -* in the Software without restriction, including without limitation the rights -* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -* copies of the Software, and to permit persons to whom the Software is -* furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included in -* all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -* SOFTWARE. -* -******************************************************************************/ - -#include "mono_text.h" - -#include -#include -#include -#include -#include - -class MonoSGNode : public QSGTransformNode -{ -public: - MonoSGNode(QQuickItem *owner) - : m_owner(owner) - { - } - - void deleteContent() - { - QSGNode *subnode = firstChild(); - while (subnode) { - // We can't delete the node now as it might be in the preprocess list - // It will be deleted in the next preprocess - m_nodes_to_delete.append(subnode); - subnode = subnode->nextSibling(); - } - removeAllChildNodes(); - } - - void preprocess() - { - while (m_nodes_to_delete.count()) - delete m_nodes_to_delete.takeLast(); - } - - void setLatinText(const QString &text, const QFont &font, const QColor &color) { - QRawFont raw_font = QRawFont::fromFont(font, QFontDatabase::Latin); - - if (raw_font != m_raw_font) { - m_raw_font = raw_font; - m_positions.clear(); - } - - if (m_positions.size() < text.size()) { - qreal x_pos = 0; - qreal max_char_width = raw_font.averageCharWidth(); - qreal ascent = raw_font.ascent(); - if (m_positions.size()) - x_pos = m_positions.last().x() + max_char_width; - int to_add = text.size() - m_positions.size(); - for (int i = 0; i < to_add; i++) { - m_positions << QPointF(x_pos, ascent); - x_pos += max_char_width; - } - } - - deleteContent(); - QSGRenderContext *sgr = QQuickItemPrivate::get(m_owner)->sceneGraphRenderContext(); - QSGGlyphNode *node = sgr->sceneGraphContext()->createGlyphNode(sgr); - node->setOwnerElement(m_owner); - node->geometry()->setIndexDataPattern(QSGGeometry::StaticPattern); - node->geometry()->setVertexDataPattern(QSGGeometry::StaticPattern); - node->setStyle(QQuickText::Normal); - - node->setColor(color); - QGlyphRun glyphrun; - glyphrun.setRawFont(raw_font); - glyphrun.setGlyphIndexes(raw_font.glyphIndexesForString(text)); - - glyphrun.setPositions(m_positions); - node->setGlyphs(QPointF(0, raw_font.ascent()), glyphrun); - node->update(); - appendChildNode(node); - } - - void setUnicodeText(const QString &text, const QFont &font, const QColor &color) - { - deleteContent(); - QRawFont raw_font = QRawFont::fromFont(font, QFontDatabase::Latin); - qreal line_width = raw_font.averageCharWidth() * text.size(); - QSGRenderContext *sgr = QQuickItemPrivate::get(m_owner)->sceneGraphRenderContext(); - QTextLayout layout(text,font); - layout.beginLayout(); - QTextLine line = layout.createLine(); - line.setLineWidth(line_width); - //Q_ASSERT(!layout.createLine().isValid()); - layout.endLayout(); - QList glyphRuns = line.glyphRuns(); - qreal xpos = 0; - for (int i = 0; i < glyphRuns.size(); i++) { - QSGGlyphNode *node = sgr->sceneGraphContext()->createGlyphNode(sgr); - node->setOwnerElement(m_owner); - node->geometry()->setIndexDataPattern(QSGGeometry::StaticPattern); - node->geometry()->setVertexDataPattern(QSGGeometry::StaticPattern); - node->setGlyphs(QPointF(xpos, raw_font.ascent()), glyphRuns.at(i)); - node->setStyle(QQuickText::Normal); - node->setColor(color); - xpos += raw_font.averageCharWidth() * glyphRuns.at(i).positions().size(); - node->update(); - appendChildNode(node); - } - } -private: - QQuickItem *m_owner; - QVector m_positions; - QLinkedList m_nodes_to_delete; - QRawFont m_raw_font; -}; - -MonoText::MonoText(QQuickItem *parent) - : QQuickItem(parent) - , m_color_changed(false) - , m_latin(true) - , m_old_latin(true) -{ - setFlag(ItemHasContents, true); -} - -MonoText::~MonoText() -{ - -} - -QString MonoText::text() const -{ - return m_text; -} - -void MonoText::setText(const QString &text) -{ - if (m_text != text) { - m_text = text; - emit textChanged(); - polish(); - } -} - -QFont MonoText::font() const -{ - return m_font; -} - -void MonoText::setFont(const QFont &font) -{ - if (font != m_font) { - m_font = font; - emit fontChanged(); - polish(); - } -} - -QColor MonoText::color() const -{ - return m_color; -} - -void MonoText::setColor(const QColor &color) -{ - if (m_color != color) { - m_color = color; - emit colorChanged(); - update(); - } -} - -qreal MonoText::paintedWidth() const -{ - return implicitWidth(); -} - -qreal MonoText::paintedHeight() const -{ - return implicitHeight(); -} - -bool MonoText::latin() const -{ - return m_latin; -} - -void MonoText::setLatin(bool latin) -{ - if (latin == m_latin) - return; - - m_latin = latin; - emit latinChanged(); -} - -QSGNode *MonoText::updatePaintNode(QSGNode *old, UpdatePaintNodeData *) -{ - if (m_text.size() == 0 || m_text.trimmed().size() == 0) { - delete old; - return 0; - } - MonoSGNode *node = static_cast(old); - if (!node) { - node = new MonoSGNode(this); - } - - if (m_latin) { - node->setLatinText(m_text, m_font, m_color); - } else { - node->setUnicodeText(m_text, m_font, m_color); - } - - return node; -} - -void MonoText::updatePolish() -{ - QRawFont raw_font = QRawFont::fromFont(m_font, QFontDatabase::Latin); - - qreal height = raw_font.descent() + raw_font.ascent() + raw_font.lineThickness(); - qreal width = raw_font.averageCharWidth() * m_text.size(); - - bool emit_text_width_changed = width != implicitWidth(); - bool emit_text_height_changed = height != implicitHeight(); - setImplicitSize(width, height); - - if (emit_text_width_changed) - emit paintedWidthChanged(); - if (emit_text_height_changed) - emit paintedHeightChanged(); - - update(); -} diff --git a/yat/yat_declarative/mono_text.h b/yat/yat_declarative/mono_text.h deleted file mode 100644 index 49149bf..0000000 --- a/yat/yat_declarative/mono_text.h +++ /dev/null @@ -1,81 +0,0 @@ -/****************************************************************************** -* Copyright (c) 2012 Jørgen Lind -* -* Permission is hereby granted, free of charge, to any person obtaining a copy -* of this software and associated documentation files (the "Software"), to deal -* in the Software without restriction, including without limitation the rights -* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -* copies of the Software, and to permit persons to whom the Software is -* furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included in -* all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -* SOFTWARE. -* -******************************************************************************/ - -#ifndef MONO_TEXT_H -#define MONO_TEXT_H - -#include -#include - -class MonoText : public QQuickItem -{ - Q_OBJECT - Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged) - Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY fontChanged) - Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged) - Q_PROPERTY(qreal paintedWidth READ paintedWidth NOTIFY paintedWidthChanged) - Q_PROPERTY(qreal paintedHeight READ paintedHeight NOTIFY paintedHeightChanged) - Q_PROPERTY(bool latin READ latin WRITE setLatin NOTIFY latinChanged); -public: - MonoText(QQuickItem *parent=0); - ~MonoText(); - - QString text() const; - void setText(const QString &text); - - QFont font() const; - void setFont(const QFont &font); - - QColor color() const; - void setColor(const QColor &color); - - qreal paintedWidth() const; - qreal paintedHeight() const; - - bool latin() const; - void setLatin(bool latin); - -signals: - void textChanged(); - void fontChanged(); - void colorChanged(); - void paintedWidthChanged(); - void paintedHeightChanged(); - void latinChanged(); -protected: - QSGNode *updatePaintNode(QSGNode *old, UpdatePaintNodeData *data) Q_DECL_OVERRIDE; - void updatePolish() Q_DECL_OVERRIDE; -private: - Q_DISABLE_COPY(MonoText); - void updateSize(); - - QString m_text; - QFont m_font; - QColor m_color; - bool m_color_changed; - bool m_latin; - bool m_old_latin; - QSizeF m_text_size; -}; - -#endif diff --git a/yat/yat_declarative/object_destruct_item.cpp b/yat/yat_declarative/object_destruct_item.cpp deleted file mode 100644 index 4f48280..0000000 --- a/yat/yat_declarative/object_destruct_item.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2013 Jørgen Lind -* -* Permission is hereby granted, free of charge, to any person obtaining a copy -* of this software and associated documentation files (the "Software"), to deal -* in the Software without restriction, including without limitation the rights -* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -* copies of the Software, and to permit persons to whom the Software is -* furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included in all -* copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -* SOFTWARE. -* -*******************************************************************************/ - -#include "object_destruct_item.h" - -ObjectDestructItem::ObjectDestructItem(QQuickItem *parent) - : QQuickItem(parent) - , m_object(0) -{ -} - -QObject *ObjectDestructItem::objectHandle() const -{ - return m_object; -} - -void ObjectDestructItem::setObjectHandle(QObject *object) -{ - bool emit_changed = m_object != object; - if (m_object) { - m_object->disconnect(this); - } - - m_object = object; - connect(m_object, SIGNAL(destroyed()), this, SLOT(objectDestroyed())); - - if (emit_changed) - emit objectHandleChanged(); -} - -void ObjectDestructItem::objectDestroyed() -{ - delete this; -} - diff --git a/yat/yat_declarative/object_destruct_item.h b/yat/yat_declarative/object_destruct_item.h deleted file mode 100644 index fb74691..0000000 --- a/yat/yat_declarative/object_destruct_item.h +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2013 Jørgen Lind -* -* Permission is hereby granted, free of charge, to any person obtaining a copy -* of this software and associated documentation files (the "Software"), to deal -* in the Software without restriction, including without limitation the rights -* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -* copies of the Software, and to permit persons to whom the Software is -* furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included in all -* copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -* SOFTWARE. -* -*******************************************************************************/ - -#ifndef OBJECT_DESTRUCT_ITEM_H -#define OBJECT_DESTRUCT_ITEM_H - -#include -#include - -class ObjectDestructItem : public QQuickItem -{ - Q_OBJECT - - Q_PROPERTY(QObject *objectHandle READ objectHandle WRITE setObjectHandle NOTIFY objectHandleChanged) - -public: - ObjectDestructItem(QQuickItem *parent = 0); - - QObject *objectHandle() const; - void setObjectHandle(QObject *line); - -signals: - void objectHandleChanged(); - -private slots: - void objectDestroyed(); - -private: - QObject *m_object; -}; - -#endif //OBJECT_DESTRUCT_ITEM_H diff --git a/yat/yat_declarative/qml/yat_declarative/HighlightArea.qml b/yat/yat_declarative/qml/yat_declarative/HighlightArea.qml deleted file mode 100644 index 9444364..0000000 --- a/yat/yat_declarative/qml/yat_declarative/HighlightArea.qml +++ /dev/null @@ -1,98 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2013 Jørgen Lind -* -* Permission is hereby granted, free of charge, to any person obtaining a copy -* of this software and associated documentation files (the "Software"), to deal -* in the Software without restriction, including without limitation the rights -* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -* copies of the Software, and to permit persons to whom the Software is -* furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included in all -* copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -* SOFTWARE. -* -*******************************************************************************/ - -import QtQuick 2.0 - -Item { - id: highlightArea - - property real characterWidth: 0 - property real characterHeight: 0 - property int screenWidth: width / characterWidth - - property point start - property point end - - property color color: "grey" - - width: parent.width - height: parent.height - - opacity: 0.8 - - Rectangle { - id: begginning_rectangle - color: parent.color - opacity: parent.opacity - y:0 - height: characterHeight - } - - Rectangle { - id: middle_rectangle - color: parent.color - opacity: parent.opacity - width: parent.width - x: 0 - anchors.top: begginning_rectangle.bottom - - } - - Rectangle { - id: end_rectangle - color: parent.color - opacity: parent.opacity - x: 0 - height: characterHeight - anchors.top: middle_rectangle.bottom - } - - onCharacterWidthChanged: calculateRectangles(); - onCharacterHeightChanged: calculateRectangles(); - onScreenWidthChanged: calculateRectangles(); - - onStartChanged: calculateRectangles(); - onEndChanged: calculateRectangles(); - - function calculateRectangles() { - highlightArea.y = start.y * characterHeight; - begginning_rectangle.x = start.x * characterWidth; - if (start.y === end.y) { - middle_rectangle.visible = false; - end_rectangle.visible = false - begginning_rectangle.width = (end.x - start.x) * characterWidth; - } else { - begginning_rectangle.width = (screenWidth - start.x) * characterWidth; - if (start.y === end.y - 1) { - middle_rectangle.height = 0; - middle_rectangle.visible = false; - }else { - middle_rectangle.visible = true; - middle_rectangle.height = (end.y - start.y - 1) * characterHeight; - } - end_rectangle.visible = true; - end_rectangle.width = end.x * characterWidth; - } - } - -} diff --git a/yat/yat_declarative/qml/yat_declarative/TerminalCursor.qml b/yat/yat_declarative/qml/yat_declarative/TerminalCursor.qml deleted file mode 100644 index a37e682..0000000 --- a/yat/yat_declarative/qml/yat_declarative/TerminalCursor.qml +++ /dev/null @@ -1,66 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2013 Jørgen Lind -* -* Permission is hereby granted, free of charge, to any person obtaining a copy -* of this software and associated documentation files (the "Software"), to deal -* in the Software without restriction, including without limitation the rights -* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -* copies of the Software, and to permit persons to whom the Software is -* furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included in all -* copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -* SOFTWARE. -* -*******************************************************************************/ - -import QtQuick 2.0 - -import org.yat 1.0 - -ObjectDestructItem { - id: cursor - - property real fontHeight - property real fontWidth - - height: fontHeight - width: fontWidth - x: objectHandle.x * fontWidth - y: objectHandle.y * fontHeight - z: 1.1 - - visible: objectHandle.visible - - ShaderEffect { - anchors.fill: parent - - property variant source: fragmentSource - - fragmentShader: - "uniform lowp float qt_Opacity;" + - "uniform sampler2D source;" + - "varying highp vec2 qt_TexCoord0;" + - - "void main() {" + - " lowp vec4 color = texture2D(source, qt_TexCoord0 ) * qt_Opacity;" + - " gl_FragColor = vec4(1.0 - color.r, 1.0 - color.g, 1.0 - color.b, color.a);" + - "}" - - ShaderEffectSource { - id: fragmentSource - sourceItem: background - live: true - - sourceRect: Qt.rect(cursor.x,cursor.y,cursor.width,cursor.height); - } - } -} - diff --git a/yat/yat_declarative/qml/yat_declarative/TerminalScreen.qml b/yat/yat_declarative/qml/yat_declarative/TerminalScreen.qml deleted file mode 100644 index eb67d52..0000000 --- a/yat/yat_declarative/qml/yat_declarative/TerminalScreen.qml +++ /dev/null @@ -1,256 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2013 Jørgen Lind -* -* Permission is hereby granted, free of charge, to any person obtaining a copy -* of this software and associated documentation files (the "Software"), to deal -* in the Software without restriction, including without limitation the rights -* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -* copies of the Software, and to permit persons to whom the Software is -* furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included in all -* copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -* SOFTWARE. -* -*******************************************************************************/ - -import QtQuick 2.0 - -import org.yat 1.0 - -TerminalScreen { - id: screenItem - - property font font - property real fontWidth: fontMetricText.paintedWidth - property real fontHeight: fontMetricText.paintedHeight - - property var lineComponent : Qt.createComponent("TerminalLine.qml") - property var textComponent : Qt.createComponent("TerminalText.qml") - property var cursorComponent : Qt.createComponent("TerminalCursor.qml") - - font.family: "menlo" - focus: true - - onActiveFocusChanged: { - if (activeFocus) { - Qt.inputMethod.show(); - } - } - - Keys.onPressed: { - if (event.text === "?") { - terminal.screen.printScreen() - } - } - - Text { - id: fontMetricText - text: "B" - font: parent.font - visible: false - textFormat: Text.PlainText - } - - Flickable { - id: flickable - anchors.top: parent.top - anchors.left: parent.left - contentWidth: width - contentHeight: textContainer.height - interactive: true - flickableDirection: Flickable.VerticalFlick - contentY: ((screen.contentHeight - screen.height) * screenItem.fontHeight) - - Item { - id: textContainer - width: parent.width - height: screen.contentHeight * screenItem.fontHeight - Rectangle { - id: background - anchors.fill: parent - color: terminal.screen.defaultBackgroundColor - } - } - onContentYChanged: { - if (!atYEnd) { - var top_line = Math.floor(Math.max(contentY,0) / screenItem.fontHeight); - screen.ensureVisiblePages(top_line); - } - } - } - - Connections { - id: connections - - target: terminal.screen - - onFlash: { - flashAnimation.start() - } - - onReset: { - resetScreenItems(); - } - - onTextCreated: { - var textSegment = textComponent.createObject(screenItem, - { - "parent" : background, - "objectHandle" : text, - "font" : screenItem.font, - "fontWidth" : screenItem.fontWidth, - "fontHeight" : screenItem.fontHeight, - }) - } - - onCursorCreated: { - if (cursorComponent.status != Component.Ready) { - console.log(cursorComponent.errorString()); - return; - } - var cursorVariable = cursorComponent.createObject(screenItem, - { - "parent" : textContainer, - "objectHandle" : cursor, - "fontWidth" : screenItem.fontWidth, - "fontHeight" : screenItem.fontHeight, - }) - } - - onRequestHeightChange: { - terminalWindow.height = newHeight * screenItem.fontHeight; - terminalWindow.contentItem.height = newHeight * screenItem.fontHeight; - } - - onRequestWidthChange: { - terminalWindow.width = newWidth * screenItem.fontWidth; - terminalWindow.contentItem.width = newWidth * screenItem.fontWidth; - } - } - - onFontChanged: { - setTerminalHeight(); - setTerminalWidth(); - } - - onWidthChanged: { - setTerminalWidth(); - } - onHeightChanged: { - setTerminalHeight(); - } - Component.onCompleted: { - setTerminalWidth(); - setTerminalHeight(); - } - - function setTerminalWidth() { - if (fontWidth > 0) { - var pty_width = Math.floor(width / fontWidth); - flickable.width = pty_width * fontWidth; - screen.width = pty_width; - } - } - - function setTerminalHeight() { - if (fontHeight > 0) { - var pty_height = Math.floor(height / fontHeight); - flickable.height = pty_height * fontHeight; - screen.height = pty_height; - } - } - - HighlightArea { - characterHeight: fontHeight - characterWidth: fontWidth - - start: screen.selectionAreaStart - end: screen.selectionAreaEnd - - visible: screen.selectionEnabled - } - - Rectangle { - id: flash - z: 1.2 - anchors.fill: parent - color: "grey" - opacity: 0 - SequentialAnimation { - id: flashAnimation - NumberAnimation { - target: flash - property: "opacity" - to: 1 - duration: 75 - } - NumberAnimation { - target: flash - property: "opacity" - to: 0 - duration: 75 - } - } - } - - MouseArea { - id:mousArea - - property point drag_start - - anchors.fill: parent - acceptedButtons: Qt.LeftButton | Qt.MiddleButton - onPressed: { - if (mouse.button == Qt.LeftButton) { - hoverEnabled = true; - var character = Math.floor((mouse.x / screen.charWidth)); - var line = Math.floor(mouse.y / screen.lineHeight); - var start = Qt.point(character,line); - drag_start = start; - screen.selectionAreaStart = start; - screen.selectionAreaEnd = start; - } - } - - onPositionChanged: { - var character = Math.floor(mouse.x / screen.charWidth); - var line = Math.floor(mouse.y / screen.lineHeight); - var current_pos = Qt.point(character,line); - if (line < drag_start.y || (line === drag_start.y && character < drag_start.x)) { - screen.selectionAreaStart = current_pos; - screen.selectionAreaEnd = drag_start; - }else { - screen.selectionAreaEnd = current_pos; - screen.selectionAreaStart = drag_start; - } - } - - onReleased: { - if (mouse.button == Qt.LeftButton) { - hoverEnabled = false; - screen.sendSelectionToSelection(); - } - } - - onClicked: { - if (mouse.button == Qt.MiddleButton) { - screen.pasteFromSelection(); - } - } - onDoubleClicked: { - if (mouse.button == Qt.LeftButton) { - var character = Math.floor(mouse.x / screen.charWidth); - var line = Math.floor(mouse.y / screen.lineHeight); - screen.doubleClicked(Qt.point(character,line)); - } - } - } -} diff --git a/yat/yat_declarative/qml/yat_declarative/TerminalText.qml b/yat/yat_declarative/qml/yat_declarative/TerminalText.qml deleted file mode 100644 index 1ac5294..0000000 --- a/yat/yat_declarative/qml/yat_declarative/TerminalText.qml +++ /dev/null @@ -1,81 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2013 Jørgen Lind -* -* Permission is hereby granted, free of charge, to any person obtaining a copy -* of this software and associated documentation files (the "Software"), to deal -* in the Software without restriction, including without limitation the rights -* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -* copies of the Software, and to permit persons to whom the Software is -* furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included in all -* copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -* SOFTWARE. -* -*******************************************************************************/ - -import QtQuick 2.0 - -import org.yat 1.0 - -ObjectDestructItem { - id: textItem - property font font - property real fontWidth - property real fontHeight - - y: objectHandle.line * fontHeight; - x: objectHandle.index * fontWidth; - - width: textElement.paintedWidth - height: textElement.paintedHeight - - visible: objectHandle.visible - - Rectangle { - anchors.fill: parent - color: objectHandle.backgroundColor - - MonoText { - id: textElement - anchors.fill: parent - text: objectHandle.text - color: objectHandle.foregroundColor - font.family: textItem.font.family - font.pixelSize: textItem.font.pixelSize - font.pointSize: textItem.font.pointSize - font.bold: objectHandle.bold - font.underline: objectHandle.underline - latin: objectHandle.latin - - SequentialAnimation { - running: objectHandle.blinking - loops: Animation.Infinite - onRunningChanged: { - if (running === false) - textElement.opacity = 1 - } - NumberAnimation { - target: textElement - property: "opacity" - to: 0 - duration: 250 - } - NumberAnimation { - target: textElement - property: "opacity" - to: 1 - duration: 250 - } - } - } - } - -} diff --git a/yat/yat_declarative/qml/yat_declarative/main.qml b/yat/yat_declarative/qml/yat_declarative/main.qml deleted file mode 100644 index a63c800..0000000 --- a/yat/yat_declarative/qml/yat_declarative/main.qml +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2013 Jørgen Lind -* -* Permission is hereby granted, free of charge, to any person obtaining a copy -* of this software and associated documentation files (the "Software"), to deal -* in the Software without restriction, including without limitation the rights -* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -* copies of the Software, and to permit persons to whom the Software is -* furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included in all -* copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -* SOFTWARE. -* -*******************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Window 2.0 - -Window { - id: terminalWindow - TerminalScreen { - id: terminal - anchors.fill: parent - Component.onCompleted: terminalWindow.visible = true - } - width: 800 - height: 600 - color: terminal.screen.defaultBackgroundColor -} diff --git a/yat/yat_declarative/qml_sources.qrc b/yat/yat_declarative/qml_sources.qrc deleted file mode 100644 index 4b9427e..0000000 --- a/yat/yat_declarative/qml_sources.qrc +++ /dev/null @@ -1,9 +0,0 @@ - - - qml/yat_declarative/main.qml - qml/yat_declarative/TerminalScreen.qml - qml/yat_declarative/TerminalText.qml - qml/yat_declarative/TerminalCursor.qml - qml/yat_declarative/HighlightArea.qml - - diff --git a/yat/yat_declarative/register_qml_types.cpp b/yat/yat_declarative/register_qml_types.cpp deleted file mode 100644 index abaffce..0000000 --- a/yat/yat_declarative/register_qml_types.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include "register_qml_types.h" - -#include - -#include "terminal_screen.h" -#include "object_destruct_item.h" -#include "screen.h" -#include "text.h" -#include "cursor.h" -#include "mono_text.h" - -void register_qml_types() -{ - qmlRegisterType("org.yat", 1, 0, "TerminalScreen"); - qmlRegisterType("org.yat", 1, 0, "ObjectDestructItem"); - qmlRegisterType("org.yat", 1, 0, "MonoText"); - qmlRegisterType(); - qmlRegisterType(); - qmlRegisterType(); -} diff --git a/yat/yat_declarative/register_qml_types.h b/yat/yat_declarative/register_qml_types.h deleted file mode 100644 index 5b036c6..0000000 --- a/yat/yat_declarative/register_qml_types.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef REGISTER_QML_TYPES_H -#define REGISTER_QML_TYPES_H - -void register_qml_types(); - -#endif // REGISTER_QML_TYPES_H diff --git a/yat/yat_declarative/terminal_screen.cpp b/yat/yat_declarative/terminal_screen.cpp deleted file mode 100644 index 1000cb6..0000000 --- a/yat/yat_declarative/terminal_screen.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/************************************************************************************************** -* Copyright (c) 2012 Jørgen Lind -* -* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and -* associated documentation files (the "Software"), to deal in the Software without restriction, -* including without limitation the rights to use, copy, modify, merge, publish, distribute, -* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is -* furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included in all copies or -* substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT -* NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT -* OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -* -***************************************************************************************************/ - -#include "terminal_screen.h" - -TerminalScreen::TerminalScreen(QQuickItem *parent) - : QQuickItem(parent) - , m_screen(new Screen(this)) -{ - setFlag(QQuickItem::ItemAcceptsInputMethod); -} - -Screen *TerminalScreen::screen() const -{ - return m_screen; -} - -QVariant TerminalScreen::inputMethodQuery(Qt::InputMethodQuery query) const -{ - switch (query) { - case Qt::ImEnabled: - return QVariant(true); - case Qt::ImHints: - return QVariant(Qt::ImhNoAutoUppercase | Qt::ImhNoPredictiveText); - default: - return QVariant(); - } -} - -void TerminalScreen::inputMethodEvent(QInputMethodEvent *event) -{ - QString commitString = event->commitString(); - if (commitString.isEmpty()) { - return; - } - - Qt::Key key = Qt::Key_unknown; - if (commitString == " ") { - key = Qt::Key_Space; // screen requires - } - - m_screen->sendKey(commitString, key, 0); -} - -void TerminalScreen::keyPressEvent(QKeyEvent *event) -{ - m_screen->sendKey(event->text(), Qt::Key(event->key()), event->modifiers()); -} diff --git a/yat/yat_declarative/terminal_screen.h b/yat/yat_declarative/terminal_screen.h deleted file mode 100644 index eb0711c..0000000 --- a/yat/yat_declarative/terminal_screen.h +++ /dev/null @@ -1,54 +0,0 @@ -/****************************************************************************** -* Copyright (c) 2012 Jørgen Lind -* -* Permission is hereby granted, free of charge, to any person obtaining a copy -* of this software and associated documentation files (the "Software"), to deal -* in the Software without restriction, including without limitation the rights -* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -* copies of the Software, and to permit persons to whom the Software is -* furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included in -* all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -* SOFTWARE. -* -******************************************************************************/ - -#ifndef TERMINALITEM_H -#define TERMINALITEM_H - -#include -#include -#include -#include - -#include "screen.h" - -class TerminalScreen : public QQuickItem -{ - Q_OBJECT - - Q_PROPERTY(Screen *screen READ screen CONSTANT) -public: - TerminalScreen(QQuickItem *parent = 0); - - Screen *screen() const; - - QVariant inputMethodQuery(Qt::InputMethodQuery query) const; - -protected: - void inputMethodEvent(QInputMethodEvent *event); - void keyPressEvent(QKeyEvent *event); - -private: - Screen *m_screen; -}; - -#endif // TERMINALITEM_H diff --git a/yat/yat_declarative/yat_declarative.pro b/yat/yat_declarative/yat_declarative.pro deleted file mode 100644 index df7cba6..0000000 --- a/yat/yat_declarative/yat_declarative.pro +++ /dev/null @@ -1,18 +0,0 @@ -QT += widgets quick core-private gui-private qml-private quick quick-private -TARGET = cool-old-term - -include(../backend/backend.pri) - -INCLUDEPATH += $$PWD - -SOURCES += $$PWD/terminal_screen.cpp \ - $$PWD/object_destruct_item.cpp \ - $$PWD/register_qml_types.cpp \ - $$PWD/mono_text.cpp \ - -HEADERS += \ - $$PWD/terminal_screen.h \ - $$PWD/object_destruct_item.h \ - $$PWD/register_qml_types.h \ - $$PWD/mono_text.h \ -