Compare commits

...

5 Commits

Author SHA1 Message Date
Alf Gaida
d06dea1daa Fixed control and symbols
* Followed Multiarch hinter suggestions
  - qtermwidget5-data marked as Multi-Arch: foreign
  - libqtermwidget5-0 marked as Multi-Arch: same
  - libqtermwidget5-0-dev marked as Multi-Arch: same
* simplify optional symbols
2016-09-27 18:03:25 +02:00
Alf Gaida
16321f309a Mark some symbols optional 2016-09-26 21:01:16 +02:00
Alf Gaida
66dac22692 Cherry-picking upstream release: 0.7.0
* Bumped compat to 10
* Bumped build dependency debhelper (>= 10)
* Bumped build dependency liblxqt-dev (>= 0.11.0)
* Removed --parallel from rules, standard in compat 10
* Fixed Symbols for amd64
2016-09-25 22:07:36 +02:00
Alf Gaida
d4f8abddde prepare 0.7.0 import
added current upstream signinig key
fixed watch file
2016-09-24 11:34:34 +02:00
Alf Gaida
3033e27bf3 Cherry-picking upstream version 0.6.1~85-ge6253c0.
Preparing the upcoming release, switch to experimental
Added build dependencies:
 - gcc (>= 4:6),
 - g++ (>= 4:6),
 - liblxqt0-dev (>= 0.10.96~),
Rework symbols (Closes: #831083)
Fixed VCS fields, using plain /git/
Fixed copyright Format field, using https
Exported LC_ALL=C.UTF-8, make builds reproducible
Set CMAKE_BUILD_TYPE=RelWithDebInfo
2016-07-20 17:18:48 +02:00
47 changed files with 2461 additions and 1476 deletions

184
CHANGELOG Normal file
View File

@ -0,0 +1,184 @@
qtermwidget-0.7.0 / 2016-09-24
==============================
* Bump version to 0.7.0 (#92)
* Add Solarized Color Schemes
* Update README.md
* qtermwidget: Unify title & icon propagation
* lib: Fix FTBFS (struct vs. class mismatch)
* Add 'const' decorators
* Expose titleChanged() signal
* Fix building instructions
* cmake support changes
* Make addCustomColorSchemeDir() static and check for duplicates
* Address review comments
* Allow app to add custom color sheme locations
* Avoid enums duplication
* Add support for setting keyboard cursor shape
* Remove assignment to self
* Backport konsole changes to fix memory leaks
* Remove __FILE__ macros
* Replace assert() with Q_ASSERT()
* Fix ASan error about delete size mismatch
* Add support for GNU/Hurd to kpty.cpp.
* fixes kfreebsd builds on debian and derivatives
* Fix indenations (misleading-indentation warning)
* Remove Q_DECL_OVERRIDE macros
* typo Higlight
* Remove noisy qDebugs
* Bracketed paste mode implementation
* Use function setWorldTranfer for Qpainter instead of setWorldMatrix
* Modify treatment drawing double width character
* pyqt5 bindings
* pyqt5 bindings
* Avoid checking uninitialized member + simplify condition
* Use markdown for README and improve it a bit
* Remove support for Qt <= 5.4
* Remove Designer plugin
* Fix LICENSE text and name
* Remove Changelog
* Remove empty TODO file
* Remove PyQt4 bindings
* Sort out terminal resizing
* Rebase Vt102Emulation to Konsole
* Enable terminal resizing from the emulator
* Clean up trailing whitespaces
* implemented start TTY for external recipient;
* Fix: typo in TerminalDisplay
* add method for get pty slave fd;
* add method for get pty slave fd;
* Use GNUInstallDirs in CMakeLists.txt to stop hardcoding paths
* Set the '_notifiedActivity' flag early
* Also expose signals and slots to pyqt
* Get/set selection end in python bindings
* Avoid calling winId() on Qt5.
* Fix TerminalDisplay::getCharacterPosition for proportional fonts
* Handle proportional fonts a bit better
* Expose more functionality through the python bindings (#23)
* Allow stopping test.py with ctrl-C
* Fix 'getSelectionEnd'
* Make whitespace consistent (tabs->spaces)
* Fix python binding compile errors #23
* Add event to notify the application that the shell application uses mouse.
* Change mouseMarks only when needed. This might be useful if an application wants to be notified of the event.
* Prevents deleting the last line when resizing.
0.6.0 / 2014-10-21
==================
* Release 0.6.0
* Update AUTHORS
* Update INSTALL instructions
* CMakeLists.txt cleanup
* osx: link fixes
* fixed #57 Linux emulation does not seem to support Ctrl+Arrows (warning: I have no clue what I did...)
* Fix Qt4 compilation
* qterminal #64 No drag & drop support
* fixed qterminal #71 qt5 version ignoring page up / down
* Fixed a typo in CMakeLists.txt.
0.5.1 / 2014-07-14
==================
* fixed 'make dist'; version bump
* Url activation & filters #21
* Proxy activity/silence methods to Session in QTermWidget.
* Emit activity() and silence() signals instead of KNotification.
* Support bells.
* Support bells.
* Added QTermWidget::urlActivated(QUrl) signal.
* Emit UrlFilter::activated() instead of QDesktopServices::openUrl().
* Derive Filter from QObject.
* Add UrlFilter.
* Activate link filters on ctrl+click.
* Update filters on resize and screen events.
* Const-correctness for QTermWidget API.
* Load arbitrary schemes by path via setColorScheme().
* ColorSchemeManager::loadCustomColorScheme(const QString& path).
* Unified schemeName() usage.
* fixed #17 lib/ShellCommand.cpp:66: possible =/== mixup
* Delete CMakeLists.txt.user
* new API selectedText()
* new API methods (thanks to William Brumley)
* fixed #11 compile against Qt 5 (Qt4 and Qt5 supported and waguely tested)
* build simplified: qtermwidget is versioned (libqtermwidget4 for Qt4, 5 for Qt5...). Better cmake support.
* fixed broken API for sendText() - const missing
* mail address change
* Current Working Directory for linux. Part of #8. More implementations welcomed...
* Add a method for get working directory in class QTermWidget
* Fix missing cleanup for temporary history files
* a potential improvement for #9 font fractional pixels causes spacing errors
* fix #2 update various documentations for debian packaging
* fix #10 Update FSF address
0.4.0 / 2013-04-16
==================
* readme updated
* Added pasteSelection-slot and corrected two nonsense comments
* qt/embedded doesn't ship with a Monospace font (and it won't use system fonts even if they exist). Using 'fixed' instead works fine
* Without this, the terminal display area will permanently lose focus when consoleq's Find dialog is called up.
* This is only needed when using Qt/E built for DirectFB display. DirectFB blocks SIGINT and some other signals, so any terminal app (be it Qt or otherwise) must call sigprocmask() to unblock them. Without this, ^C doesn't work.
* The control and tab keys don't work in Qt/E. This fixes it, but maybe not in the most elegant way. The trouble seems to be that _codec->fromUnicode(event->text()) doesn't handle control characters in qt-embedded.
* Fix resize label
* Search code cleanup
* Change searchbar background color to red(ish) when no match found
* Fix search, find-next when selection is one character long
* Hotkeys for search: Return->find-next, Shift-Return->find-previous, Escape->hide searchbar
* Added search functionality
* Add zoom. Add choice action after paste clipboard
* Add zoom. Add choice action after paste clipboard
* Add zoom. Add choice action after paste clipboard
* Add zoom. Add choice action after paste clipboard
* Add zoom. Add choice action after paste clipboard
* Add zoom. Add choice action after paste clipboard
* Add zoom. Add choice action after paste clipboard
* Add zoom. Add choice action after paste clipboard
* Add zoom. Add choice action after paste clipboard
* Fix logical error
* Add zoom. Add choice action after paste clipboard
* Add zoom. Add choice action after paste clipboard
* Add Shift+KeyEnd and Shift+KeyHome to go line 0 and line end. No move screenwindow when copy and paste with keyboard
* fix for text drawing in qt>=4.8,x
* constructor for Qt Designer
* test commit
* clear() slot implemented
* fix the scroll at the end again
* The escape key is always needed for terminal programs like vim.
* Add resource files and the appropriate paths to enable bundling of color schemes and keyboard layouts into the actual executable.
* Add a define which will be used to bundle the color schemes and keyboard layouts as resource files with the executable itself instead of putting them on disk.
* scrollToEnd() method provided to trigger 'snapping' the terminal to cursor tracked position (typically the extreme value of the scrollbar, or the 'end') Some signal-fu particular to keyPressEvent(QKeyEvent *) done to make the above usable, no existing dependent implementations should be disturbed by this.
* revert workaround for key on end
* scroll to bottom on input
* scrollToEnd() method provided to trigger 'snapping' the terminal to cursor tracked position (typically the extreme value of the scrollbar, or the 'end') Some signal-fu particular to keyPressEvent(QKeyEvent *) done to make the above usable, no existing dependent implementations should be disturbed by this.
* improved sample app for testing
* macosx compile fix
* arguments work correctly for custom shells too
* lib has to be built first in any case
* merge changes from the experimental "bundle" repository
* fix for kb-layout location on mac (mainly)
* rpm builds
* mac universal build helper
* build cleanup; make dist; various readmes updated
* make availableKeyBindings static
* transparency support
* font display fix on mac (widths in int)
* qt designer plugin
* correct lib ID for mac
* remove the KDE legacy code
* code reformatted after resync
* display stuff synced from konsole again to improve color scheme handling
* focus in/out signals
* correct shell detection (BSD, Christopher VdoP)
* library location on BSD
* patches to build on BSD by Christopher VdoP
* K&R formatting
* K&R formatting
* merge with qscite
* fixed KB finding + sort
* key layouts can be read and provided to widget
* install keyboard bindings; handle KB in src code; allow to get and set KB
* fix for includes and 64bit builds
* port to macosx
* initial import

View File

@ -1,20 +1,35 @@
cmake_minimum_required( VERSION 2.8 )
cmake_minimum_required(VERSION 3.0.2 FATAL_ERROR)
project(qtermwidget)
include(GNUInstallDirs)
include(CheckFunctionExists)
option(BUILD_TEST "Build test application. Default OFF." OFF)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
# just change version for releases
set(QTERMWIDGET_VERSION_MAJOR "0")
set(QTERMWIDGET_VERSION_MINOR "6")
set(QTERMWIDGET_VERSION_MINOR "7")
set(QTERMWIDGET_VERSION_PATCH "0")
set(QTERMWIDGET_VERSION "${QTERMWIDGET_VERSION_MAJOR}.${QTERMWIDGET_VERSION_MINOR}.${QTERMWIDGET_VERSION_PATCH}")
include(CheckFunctionExists)
include(GNUInstallDirs)
# additional cmake files
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
if(COMPILER_SUPPORTS_CXX11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
elseif(COMPILER_SUPPORTS_CXX0X)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
else()
message(FATAL "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. C++11 support is required")
endif()
include_directories(
"${CMAKE_SOURCE_DIR}/lib"

View File

@ -1,34 +1,28 @@
# QTermWidget
A terminal emulator widget for Qt 5.
## Overview
QTermWidget is an opensource project originally based on KDE4 Konsole application,
but it took its own direction later.
The main goal of this project is to provide unicode-enabled, embeddable
Qt widget for using as a built-in console (or terminal emulation widget).
A terminal emulator widget for Qt 5.
# Installation
QTermWidget is an open-source project originally based on KDE4 Konsole application, but it took its own direction later.
The main goal of this project is to provide a unicode-enabled, embeddable Qt widget for using as a built-in console (or terminal emulation widget).
Requirements:
* Qt >= 5.4
* cmake >= 3.0
It is compatible with BSD, Linux and OS X.
Supported platforms:
* Linux
* BSD
* OS X
This project is licensed under the terms of the [GPLv2](https://www.gnu.org/licenses/gpl-2.0.en.html) or any later version. See the LICENSE file for the full text of the license.
Building
## Installation
1. `mkdir -p build && cd build`
2. `cmake `<path/to/source>`
3. make
### Compiling sources
Run `make install` to install.
The only runtime dependency is qtbase ≥ 5.4.
In order to build CMake ≥ 3.0 is needed as well as optionally Git to pull latest VCS checkouts.
# License
Code configuration is handled by CMake. Building out of source is strongly recommended. CMake variable `CMAKE_INSTALL_PREFIX` will normally have to be set to `/usr`, depending on the way library paths are dealt with on 64bit systems variables like `CMAKE_INSTALL_LIBDIR` may have to be set as well.
This project is licensed under the terms of the
[GPLv2](https://www.gnu.org/licenses/gpl-2.0.en.html) or any later version.
To build run `make`, to install `make install` which accepts variable `DESTDIR` as usual.
See the LICENSE file for the full text of the license.
### Binary packages
The library is provided by all major Linux distributions like Arch Linux, Debian, Fedora and openSUSE.
Just use the distributions' package managers to search for string `qtermwidget`.

8
debian/.gitignore vendored
View File

@ -1,8 +1,10 @@
/mangled
/*.debhelper/
/files
/*.debhelper
/*.log
/*.mangled
/*.substvars
/debhelper-build-stamp
/files
/libqtermwidget5-0-dev/
/libqtermwidget5-0/
/qtermwidget5-data/

43
debian/changelog vendored
View File

@ -1,3 +1,46 @@
qtermwidget (0.7.0-3) experimental; urgency=medium
* Followed Multiarch hinter suggestions
- qtermwidget5-data marked as Multi-Arch: foreign
- libqtermwidget5-0 marked as Multi-Arch: same
- libqtermwidget5-0-dev marked as Multi-Arch: same
* simplify optional symbols
-- Alf Gaida <agaida@siduction.org> Tue, 27 Sep 2016 18:03:03 +0200
qtermwidget (0.7.0-2) experimental; urgency=medium
* Mark some symbols optional
-- Alf Gaida <agaida@siduction.org> Mon, 26 Sep 2016 21:01:01 +0200
qtermwidget (0.7.0-1) experimental; urgency=medium
* Cherry-picking upstream release: 0.7.0
* Bumped compat to 10
* Bumped build dependency debhelper (>= 10)
* Bumped build dependency liblxqt-dev (>= 0.11.0)
* Removed --parallel from rules, standard in compat 10
* Fixed Symbols for amd64
-- Alf Gaida <agaida@siduction.org> Sun, 25 Sep 2016 22:07:18 +0200
qtermwidget (0.6.1~85-ge6253c0-1) experimental; urgency=medium
* Cherry-picking upstream version 0.6.1~85-ge6253c0.
* Preparing the upcoming release, switch to experimental
* Added build dependencies:
- gcc (>= 4:6),
- g++ (>= 4:6),
- liblxqt0-dev (>= 0.10.96~),
* Rework symbols (Closes: #831083)
* Fixed VCS fields, using plain /git/
* Fixed copyright Format field, using https
* Exported LC_ALL=C.UTF-8, make builds reproducible
* Set CMAKE_BUILD_TYPE=RelWithDebInfo
-- Alf Gaida <agaida@siduction.org> Wed, 20 Jul 2016 02:01:32 +0200
qtermwidget (0.6.0-55-gd572f39-1) unstable; urgency=medium
* Cherry-picked snapshot: 0.6.0-55-gd572f39

2
debian/compat vendored
View File

@ -1 +1 @@
9
10

10
debian/control vendored
View File

@ -5,16 +5,18 @@ Uploaders: Alf Gaida <agaida@siduction.org>,
Andrew Lee (李健秋) <ajqlee@debian.org>,
Section: libs
Priority: optional
Build-Depends: debhelper (>= 9),
Build-Depends: debhelper (>= 10),
cmake (>= 3.0.2),
liblxqt0-dev (>= 0.11.0),
qtbase5-dev
Standards-Version: 3.9.8
Vcs-Browser: https://anonscm.debian.org/cgit/pkg-lxqt/qtermwidget.git/?h=debian/sid
Vcs-Git: https://anonscm.debian.org/cgit/pkg-lxqt/qtermwidget.git -b debian/sid
Vcs-Browser: https://anonscm.debian.org/cgit/pkg-lxqt/qtermwidget.git/?h=debian/experimental
Vcs-Git: https://anonscm.debian.org/git/pkg-lxqt/qtermwidget.git -b debian/experimental
Homepage: https://github.com/lxde/qtermwidget
Package: libqtermwidget5-0
Architecture: any
Multi-Arch: same
Depends: ${shlibs:Depends},
${misc:Depends},
qtermwidget5-data (= ${source:Version}),
@ -27,6 +29,7 @@ Description: Terminal emulator widget for Qt 5 (shared libraries)
Package: libqtermwidget5-0-dev
Architecture: any
Multi-Arch: same
Section: libdevel
Depends: ${misc:Depends},
libqtermwidget5-0 (= ${binary:Version}),
@ -38,6 +41,7 @@ Description: Terminal emulator widget for Qt 5 (development files)
Package: qtermwidget5-data
Architecture: all
Multi-Arch: foreign
Depends: ${misc:Depends},
Description: Terminal emulator widget for Qt 5 (data files)
QTermWidget is a Unicode-enabled, embeddable Qt widget that can be used as

4
debian/copyright vendored
View File

@ -1,4 +1,4 @@
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: qtermwidget
Source: https://github.com/qterminal/qtermwidget
@ -20,7 +20,7 @@ License: LGPL-2+
Files: debian/*
Copyright: 2012-2016 Alf Gaida <agaida@siduction.org>
2012 Thorsten Wohlfarth <towo@siduction.org>
2012 Thorsten Wohlfarth <towo@siduction.org>
2012 Henson Sturgill <daddysturg@gmail.com>
2015 ChangZhuo Chen (陳昌倬) <czchen@debian.org>
2015 Andrew Lee (李健秋) <ajqlee@debian.org>

2
debian/gbp.conf vendored
View File

@ -1,5 +1,5 @@
[DEFAULT]
debian-branch = debian/sid
debian-branch = debian/experimental
upstream-branch = upstream/latest
pristine-tar = True

File diff suppressed because it is too large Load Diff

8
debian/rules vendored
View File

@ -1,10 +1,14 @@
#!/usr/bin/make -f
#export DH_VERBOSE=1
# export DH_VERBOSE=1
export LC_ALL=C.UTF-8
export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
%:
dh ${@} --buildsystem cmake \
--parallel \
--fail-missing
override_dh_auto_configure:
dh_auto_configure -- \
-DCMAKE_BUILD_TYPE=RelWithDebInfo

View File

@ -1,2 +1 @@
tar-ignore=.gitignore
tar-ignore=mangled

50
debian/upstream/signing-key.asc vendored Normal file
View File

@ -0,0 +1,50 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----
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
=h7ww
-----END PGP PUBLIC KEY BLOCK-----

5
debian/watch vendored
View File

@ -1,2 +1,3 @@
version=3
https://github.com/qterminal/qtermwidget/releases .*/v?(\d\S*)/qtermwidget-(?:\d\S*)\.(?:zip|tgz|tbz|txz|(?:tar\.(?:gz|bz2|xz)))
version=4
opts="pgpsigurlmangle=s/$/.asc/" \
https://github.com/qterminal/qtermwidget/releases .*/qtermwidget-([\d\.]+).tar.xz

View File

@ -27,7 +27,6 @@
#include "BlockArray.h"
// System
#include <assert.h>
#include <sys/mman.h>
#include <sys/param.h>
#include <unistd.h>
@ -57,7 +56,7 @@ BlockArray::BlockArray()
BlockArray::~BlockArray()
{
setHistorySize(0);
assert(!lastblock);
Q_ASSERT(!lastblock);
}
size_t BlockArray::append(Block * block)
@ -149,7 +148,7 @@ const Block * BlockArray::at(size_t i)
size_t j = i; // (current - (index - i) + (index/size+1)*size) % size ;
assert(j < size);
Q_ASSERT(j < size);
unmap();
Block * block = (Block *)mmap(0, blocksize, PROT_READ, MAP_PRIVATE, ion, j * blocksize);
@ -218,7 +217,7 @@ bool BlockArray::setHistorySize(size_t newsize)
return false;
}
assert(!lastblock);
Q_ASSERT(!lastblock);
lastblock = new Block();
size = newsize;

View File

@ -256,13 +256,16 @@ inline bool operator != (const CharacterColor& a, const CharacterColor& 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;
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;
((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);

View File

@ -558,17 +558,13 @@ ColorSchemeManager::~ColorSchemeManager()
void ColorSchemeManager::loadAllColorSchemes()
{
qDebug() << "loadAllColorSchemes";
int success = 0;
int failed = 0;
QList<QString> nativeColorSchemes = listColorSchemes();
QListIterator<QString> nativeIter(nativeColorSchemes);
while ( nativeIter.hasNext() )
{
if ( loadColorScheme( nativeIter.next() ) )
success++;
else
if ( !loadColorScheme( nativeIter.next() ) )
failed++;
}
@ -576,9 +572,7 @@ void ColorSchemeManager::loadAllColorSchemes()
QListIterator<QString> kde3Iter(kde3ColorSchemes);
while ( kde3Iter.hasNext() )
{
if ( loadKDE3ColorScheme( kde3Iter.next() ) )
success++;
else
if ( !loadKDE3ColorScheme( kde3Iter.next() ) )
failed++;
}
@ -650,6 +644,11 @@ bool ColorSchemeManager::loadCustomColorScheme(const QString& path)
return false;
}
void ColorSchemeManager::addCustomColorSchemeDir(const QString& custom_dir)
{
add_custom_color_scheme_dir(custom_dir);
}
bool ColorSchemeManager::loadColorScheme(const QString& filePath)
{
if ( !filePath.endsWith(QLatin1String(".colorscheme")) || !QFile::exists(filePath) )
@ -686,15 +685,18 @@ bool ColorSchemeManager::loadColorScheme(const QString& filePath)
}
QList<QString> 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;
for (const QString &scheme_dir : get_color_schemes_dirs())
{
const QString dname(scheme_dir);
QDir dir(dname);
QStringList filters;
filters << "*.schema";
dir.setNameFilters(filters);
QStringList list = dir.entryList(filters);
for (const QString &i : list)
ret << dname + "/" + i;
}
return ret;
//return KGlobal::dirs()->findAllResources("data",
// "konsole/*.schema",
@ -703,15 +705,18 @@ QList<QString> ColorSchemeManager::listKDE3ColorSchemes()
}
QList<QString> 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;
for (const QString &scheme_dir : get_color_schemes_dirs())
{
const QString dname(scheme_dir);
QDir dir(dname);
QStringList filters;
filters << "*.colorscheme";
dir.setNameFilters(filters);
QStringList list = dir.entryList(filters);
for (const QString &i : list)
ret << dname + "/" + i;
}
return ret;
// return KGlobal::dirs()->findAllResources("data",
// "konsole/*.colorscheme",
@ -742,12 +747,17 @@ bool ColorSchemeManager::deleteColorScheme(const QString& name)
QString ColorSchemeManager::findColorSchemePath(const QString& name) const
{
// QString path = KStandardDirs::locate("data","konsole/"+name+".colorscheme");
QString path(get_color_schemes_dir() + "/"+ name + ".colorscheme");
const QStringList dirs = get_color_schemes_dirs();
if ( dirs.isEmpty() )
return QString();
const QString dir = dirs.first();
QString path(dir + "/"+ name + ".colorscheme");
if ( !path.isEmpty() )
return path;
return path;
//path = KStandardDirs::locate("data","konsole/"+name+".schema");
path = get_color_schemes_dir() + "/"+ name + ".schema";
path = dir + "/"+ name + ".schema";
return path;
}
@ -777,12 +787,8 @@ const ColorScheme* ColorSchemeManager::findColorScheme(const QString& name)
return 0;
}
}
ColorSchemeManager* ColorSchemeManager::theColorSchemeManager = 0;
//K_GLOBAL_STATIC( ColorSchemeManager , theColorSchemeManager )
Q_GLOBAL_STATIC(ColorSchemeManager, theColorSchemeManager)
ColorSchemeManager* ColorSchemeManager::instance()
{
if (! theColorSchemeManager)
theColorSchemeManager = new ColorSchemeManager();
return theColorSchemeManager;
}

View File

@ -327,6 +327,14 @@ public:
* @return Whether the color scheme is loaded successfully.
*/
bool loadCustomColorScheme(const QString& path);
/**
* @brief Allows to add a custom location of color schemes.
*
* @param[in] custom_dir Custom location of color schemes (must end with /).
*/
void addCustomColorSchemeDir(const QString& custom_dir);
private:
// loads a color scheme from a KDE 4+ .colorscheme file
bool loadColorScheme(const QString& path);
@ -348,8 +356,6 @@ private:
bool _haveLoadedAll;
static const ColorScheme _defaultColorScheme;
static ColorSchemeManager * theColorSchemeManager;
};
}

View File

@ -23,7 +23,6 @@
#include "Emulation.h"
// System
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@ -55,7 +54,8 @@ Emulation::Emulation() :
_codec(0),
_decoder(0),
_keyTranslator(0),
_usesMouse(false)
_usesMouse(false),
_bracketedPasteMode(false)
{
// create screens with a default size
_screen[0] = new Screen(40,80);
@ -66,8 +66,10 @@ Emulation::Emulation() :
QObject::connect(&_bulkTimer2, SIGNAL(timeout()), this, SLOT(showBulk()) );
// listen for mouse status changes
connect( this , SIGNAL(programUsesMouseChanged(bool)) ,
SLOT(usesMouseChanged(bool)) );
connect(this , SIGNAL(programUsesMouseChanged(bool)) ,
SLOT(usesMouseChanged(bool)));
connect(this , SIGNAL(programBracketedPasteModeChanged(bool)) ,
SLOT(bracketedPasteModeChanged(bool)));
}
bool Emulation::programUsesMouse() const
@ -80,6 +82,16 @@ void Emulation::usesMouseChanged(bool usesMouse)
_usesMouse = usesMouse;
}
bool Emulation::programBracketedPasteMode() const
{
return _bracketedPasteMode;
}
void Emulation::bracketedPasteModeChanged(bool bracketedPasteMode)
{
_bracketedPasteMode = bracketedPasteMode;
}
ScreenWindow* Emulation::createWindow()
{
ScreenWindow* window = new ScreenWindow();

View File

@ -218,6 +218,8 @@ public:
*/
bool programUsesMouse() const;
bool programBracketedPasteMode() const;
public slots:
/** Change the size of the emulation's image */
@ -325,6 +327,8 @@ signals:
*/
void programUsesMouseChanged(bool usesMouse);
void programBracketedPasteModeChanged(bool bracketedPasteMode);
/**
* Emitted when the contents of the screen image change.
* The emulation buffers the updates from successive image changes,
@ -471,8 +475,11 @@ private slots:
void usesMouseChanged(bool usesMouse);
void bracketedPasteModeChanged(bool bracketedPasteMode);
private:
bool _usesMouse;
bool _bracketedPasteMode;
QTimer _bulkTimer1;
QTimer _bulkTimer2;

View File

@ -24,7 +24,6 @@
// System
#include <iostream>
#include <stdlib.h>
#include <assert.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/mman.h>
@ -110,7 +109,7 @@ HistoryFile::~HistoryFile()
//to avoid this.
void HistoryFile::map()
{
assert( fileMap == 0 );
Q_ASSERT( fileMap == 0 );
fileMap = (char*)mmap( 0 , length , PROT_READ , MAP_PRIVATE , ion , 0 );
@ -119,14 +118,14 @@ void HistoryFile::map()
{
readWriteBalance = 0;
fileMap = 0;
qDebug() << __FILE__ << __LINE__ << ": mmap'ing history failed. errno = " << errno;
//qDebug() << __FILE__ << __LINE__ << ": mmap'ing history failed. errno = " << errno;
}
}
void HistoryFile::unmap()
{
int result = munmap( fileMap , length );
assert( result == 0 ); Q_UNUSED( result );
Q_ASSERT( result == 0 ); Q_UNUSED( result );
fileMap = 0;
}
@ -502,7 +501,7 @@ void HistoryScrollBlockArray::getCells(int lineno, int colno,
return;
}
assert(((colno + count) * sizeof(Character)) < ENTRIES);
Q_ASSERT(((colno + count) * sizeof(Character)) < ENTRIES);
memcpy(res, b->data + (colno * sizeof(Character)), count * sizeof(Character));
}
@ -513,7 +512,7 @@ void HistoryScrollBlockArray::addCells(const Character a[], int count)
if (!b) return;
// put cells in block's data
assert((count * sizeof(Character)) < ENTRIES);
Q_ASSERT((count * sizeof(Character)) < ENTRIES);
memset(b->data, 0, ENTRIES);
@ -521,7 +520,7 @@ void HistoryScrollBlockArray::addCells(const Character a[], int count)
b->size = count * sizeof(Character);
size_t res = m_blockArray.newBlock();
assert (res > 0);
Q_ASSERT(res > 0);
Q_UNUSED( res );
m_lineLengths.insert(m_blockArray.getCurrent(), count);
@ -634,7 +633,6 @@ CompactHistoryLine::CompactHistoryLine ( const TextLine& line, CompactHistoryBlo
Q_ASSERT (text!=NULL);
length=line.size();
formatLength=formatLength;
wrapped=false;
// record formats and their positions in the format array

View File

@ -884,11 +884,8 @@ bool KeyboardTranslatorManager::deleteTranslator(const QString& name)
return false;
}
}
//K_GLOBAL_STATIC( KeyboardTranslatorManager , theKeyboardTranslatorManager )
KeyboardTranslatorManager* KeyboardTranslatorManager::theKeyboardTranslatorManager = 0;
Q_GLOBAL_STATIC( KeyboardTranslatorManager , theKeyboardTranslatorManager )
KeyboardTranslatorManager* KeyboardTranslatorManager::instance()
{
if (! theKeyboardTranslatorManager)
theKeyboardTranslatorManager = new KeyboardTranslatorManager();
return theKeyboardTranslatorManager;
}

View File

@ -456,6 +456,9 @@ public:
KeyboardTranslatorManager();
~KeyboardTranslatorManager();
KeyboardTranslatorManager(const KeyboardTranslatorManager&) = delete;
KeyboardTranslatorManager& operator=(const KeyboardTranslatorManager&) = delete;
/**
* Adds a new translator. If a translator with the same name
* already exists, it will be replaced by the new translator.
@ -507,8 +510,6 @@ private:
QHash<QString,KeyboardTranslator*> _translators; // maps translator-name -> KeyboardTranslator
// instance
bool _haveLoadedAll;
static KeyboardTranslatorManager * theKeyboardTranslatorManager;
};
inline int KeyboardTranslator::Entry::keyCode() const { return _keyCode; }

View File

@ -27,7 +27,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <assert.h>
#include <string.h>
#include <ctype.h>
@ -1177,7 +1176,7 @@ int Screen::copyLineToStream(int line ,
static const int MAX_CHARS = 1024;
static Character characterBuffer[MAX_CHARS];
assert( count < MAX_CHARS );
Q_ASSERT( count < MAX_CHARS );
LineProperty currentLineProperties = 0;
@ -1202,9 +1201,9 @@ int Screen::copyLineToStream(int line ,
}
// safety checks
assert( start >= 0 );
assert( count >= 0 );
assert( (start+count) <= history->getLineLen(line) );
Q_ASSERT( start >= 0 );
Q_ASSERT( count >= 0 );
Q_ASSERT( (start+count) <= history->getLineLen(line) );
history->getCells(line,start,count,characterBuffer);
@ -1216,7 +1215,7 @@ int Screen::copyLineToStream(int line ,
if ( count == -1 )
count = columns - start;
assert( count >= 0 );
Q_ASSERT( count >= 0 );
const int screenLine = line-history->getLines();

View File

@ -26,7 +26,6 @@
#include "Session.h"
// Standard
#include <assert.h>
#include <stdlib.h>
// Qt
@ -59,6 +58,7 @@ Session::Session(QObject* parent) :
, _autoClose(true)
, _wantedClose(false)
, _silenceSeconds(10)
, _isTitleChanged(false)
, _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
@ -186,6 +186,11 @@ void Session::addView(TerminalDisplay * widget)
widget->setUsesMouse( _emulation->programUsesMouse() );
connect( _emulation , SIGNAL(programBracketedPasteModeChanged(bool)) ,
widget , SLOT(setBracketedPasteMode(bool)) );
widget->setBracketedPasteMode(_emulation->programBracketedPasteMode());
widget->setScreenWindow(_emulation->createWindow());
}
@ -328,6 +333,7 @@ void Session::setUserTitle( int what, const QString & caption )
// (btw: what=0 changes _userTitle and icon, what=1 only icon, what=2 only _nameTitle
if ((what == 0) || (what == 2)) {
_isTitleChanged = true;
if ( _userTitle != caption ) {
_userTitle = caption;
modified = true;
@ -335,6 +341,7 @@ void Session::setUserTitle( int what, const QString & caption )
}
if ((what == 0) || (what == 1)) {
_isTitleChanged = true;
if ( _iconText != caption ) {
_iconText = caption;
modified = true;
@ -343,7 +350,7 @@ void Session::setUserTitle( int what, const QString & caption )
if (what == 11) {
QString colorString = caption.section(';',0,0);
qDebug() << __FILE__ << __LINE__ << ": setting background colour to " << colorString;
//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) {
@ -360,6 +367,7 @@ void Session::setUserTitle( int what, const QString & caption )
}
if (what == 30) {
_isTitleChanged = true;
if ( _nameTitle != caption ) {
setTitle(Session::NameRole,caption);
return;
@ -374,6 +382,7 @@ void Session::setUserTitle( int what, const QString & caption )
// change icon via \033]32;Icon\007
if (what == 32) {
_isTitleChanged = true;
if ( _iconName != caption ) {
_iconName = caption;
@ -677,6 +686,11 @@ QString Session::iconText() const
return _iconText;
}
bool Session::isTitleChanged() const
{
return _isTitleChanged;
}
void Session::setHistoryType(const HistoryType & hType)
{
_emulation->setHistory(hType);

View File

@ -282,6 +282,9 @@ public:
/** Returns the text of the icon associated with this session. */
QString iconText() const;
/** Flag if the title/icon was changed by user/shell. */
bool isTitleChanged() const;
/** Specifies whether a utmp entry should be created for the pty used by this session. */
void setAddToUtmp(bool);
@ -529,6 +532,7 @@ private:
QString _iconName;
QString _iconText; // as set by: echo -en '\033]1;IconText\007
bool _isTitleChanged; ///< flag if the title/icon was changed by user
bool _addToUtmp;
bool _flowControl;
bool _fullScripting;

View File

@ -318,7 +318,7 @@ TerminalDisplay::TerminalDisplay(QWidget *parent)
,_lineSelectionMode(false)
,_preserveLineBreaks(false)
,_columnSelectionMode(false)
,_scrollbarLocation(NoScrollBar)
,_scrollbarLocation(QTermWidget::NoScrollBar)
,_wordCharacters(":@-./_~")
,_bellMode(SystemBeepBell)
,_blinking(false)
@ -338,7 +338,7 @@ TerminalDisplay::TerminalDisplay(QWidget *parent)
,_colorsInverted(false)
,_blendColor(qRgba(0,0,0,0xff))
,_filterChain(new TerminalImageFilterChain())
,_cursorShape(BlockCursor)
,_cursorShape(QTermWidget::BlockCursor)
,mMotionAfterPasting(NoMoveScreenWindow)
{
// terminal applications are not designed with Right-To-Left in mind,
@ -371,6 +371,7 @@ TerminalDisplay::TerminalDisplay(QWidget *parent)
// KCursor::setAutoHideCursor( this, true );
setUsesMouse(true);
setBracketedPasteMode(false);
setColorTable(base_color_table);
setMouseTracking(true);
@ -552,11 +553,11 @@ void TerminalDisplay::drawLineCharString( QPainter& painter, int x, int y, co
painter.setPen( currentPen );
}
void TerminalDisplay::setKeyboardCursorShape(KeyboardCursorShape shape)
void TerminalDisplay::setKeyboardCursorShape(QTermWidget::KeyboardCursorShape shape)
{
_cursorShape = shape;
}
TerminalDisplay::KeyboardCursorShape TerminalDisplay::keyboardCursorShape() const
QTermWidget::KeyboardCursorShape TerminalDisplay::keyboardCursorShape() const
{
return _cursorShape;
}
@ -643,7 +644,7 @@ void TerminalDisplay::drawCursor(QPainter& painter,
else
painter.setPen(foregroundColor);
if ( _cursorShape == BlockCursor )
if ( _cursorShape == QTermWidget::BlockCursor )
{
// draw the cursor outline, adjusting the area so that
// it is draw entirely inside 'rect'
@ -665,12 +666,12 @@ void TerminalDisplay::drawCursor(QPainter& painter,
}
}
}
else if ( _cursorShape == UnderlineCursor )
else if ( _cursorShape == QTermWidget::UnderlineCursor )
painter.drawLine(cursorRect.left(),
cursorRect.bottom(),
cursorRect.right(),
cursorRect.bottom());
else if ( _cursorShape == IBeamCursor )
else if ( _cursorShape == QTermWidget::IBeamCursor )
painter.drawLine(cursorRect.left(),
cursorRect.top(),
cursorRect.left(),
@ -833,7 +834,7 @@ void TerminalDisplay::scrollImage(int lines , const QRect& screenWindowRegion)
int scrollBarWidth = _scrollBar->isHidden() ? 0 : _scrollBar->width();
const int SCROLLBAR_CONTENT_GAP = 1;
QRect scrollRect;
if ( _scrollbarLocation == ScrollBarLeft )
if ( _scrollbarLocation == QTermWidget::ScrollBarLeft )
{
scrollRect.setLeft(scrollBarWidth+SCROLLBAR_CONTENT_GAP);
scrollRect.setRight(width());
@ -1290,7 +1291,7 @@ void TerminalDisplay::paintFilters(QPainter& painter)
QPoint cursorPos = mapFromGlobal(QCursor::pos());
int cursorLine;
int cursorColumn;
int scrollBarWidth = (_scrollbarLocation == ScrollBarLeft) ? _scrollBar->width() : 0;
int scrollBarWidth = (_scrollbarLocation == QTermWidget::ScrollBarLeft) ? _scrollBar->width() : 0;
getCharacterPosition( cursorPos , cursorLine , cursorColumn );
Character cursorCharacter = _image[loc(cursorColumn,cursorLine)];
@ -1717,12 +1718,12 @@ void TerminalDisplay::scrollToEnd()
_screenWindow->setTrackOutput( _screenWindow->atEndOfOutput() );
}
void TerminalDisplay::setScrollBarPosition(ScrollBarPosition position)
void TerminalDisplay::setScrollBarPosition(QTermWidget::ScrollBarPosition position)
{
if (_scrollbarLocation == position)
return;
if ( position == NoScrollBar )
if ( position == QTermWidget::NoScrollBar )
_scrollBar->hide();
else
_scrollBar->show();
@ -1827,7 +1828,7 @@ void TerminalDisplay::mouseMoveEvent(QMouseEvent* ev)
{
int charLine = 0;
int charColumn = 0;
int scrollBarWidth = (_scrollbarLocation == ScrollBarLeft) ? _scrollBar->width() : 0;
int scrollBarWidth = (_scrollbarLocation == QTermWidget::ScrollBarLeft) ? _scrollBar->width() : 0;
getCharacterPosition(ev->pos(),charLine,charColumn);
@ -2487,6 +2488,15 @@ bool TerminalDisplay::usesMouse() const
return _mouseMarks;
}
void TerminalDisplay::setBracketedPasteMode(bool on)
{
_bracketedPasteMode = on;
}
bool TerminalDisplay::bracketedPasteMode() const
{
return _bracketedPasteMode;
}
/* ------------------------------------------------------------------------- */
/* */
/* Clipboard */
@ -2508,6 +2518,11 @@ void TerminalDisplay::emitSelection(bool useXselection,bool appendReturn)
if ( ! text.isEmpty() )
{
text.replace('\n', '\r');
if ( bracketedPasteMode() )
{
text.prepend("\e[200~");
text.append("\e[201~");
}
QKeyEvent e(QEvent::KeyPress, 0, Qt::NoModifier, text);
emit keyPressedSignal(&e); // expose as a big fat keypress event
@ -2841,16 +2856,16 @@ void TerminalDisplay::calcGeometry()
_scrollBar->resize(_scrollBar->sizeHint().width(), contentsRect().height());
switch(_scrollbarLocation)
{
case NoScrollBar :
case QTermWidget::NoScrollBar :
_leftMargin = DEFAULT_LEFT_MARGIN;
_contentWidth = contentsRect().width() - 2 * DEFAULT_LEFT_MARGIN;
break;
case ScrollBarLeft :
case QTermWidget::ScrollBarLeft :
_leftMargin = DEFAULT_LEFT_MARGIN + _scrollBar->width();
_contentWidth = contentsRect().width() - 2 * DEFAULT_LEFT_MARGIN - _scrollBar->width();
_scrollBar->move(contentsRect().topLeft());
break;
case ScrollBarRight:
case QTermWidget::ScrollBarRight:
_leftMargin = DEFAULT_LEFT_MARGIN;
_contentWidth = contentsRect().width() - 2 * DEFAULT_LEFT_MARGIN - _scrollBar->width();
_scrollBar->move(contentsRect().topRight() - QPoint(_scrollBar->width()-1,0));

View File

@ -29,6 +29,7 @@
// Konsole
#include "Filter.h"
#include "Character.h"
#include "qtermwidget.h"
//#include "konsole_export.h"
#define KONSOLEPRIVATE_EXPORT
@ -102,23 +103,11 @@ public:
/** Sets the opacity of the terminal display. */
void setOpacity(qreal opacity);
/**
* This enum describes the location where the scroll bar is positioned in the display widget.
*/
enum ScrollBarPosition
{
/** Do not show the scroll bar. */
NoScrollBar=0,
/** Show the scroll bar on the left side of the display. */
ScrollBarLeft=1,
/** Show the scroll bar on the right side of the display. */
ScrollBarRight=2
};
/**
* Specifies whether the terminal display has a vertical scroll bar, and if so whether it
* is shown on the left or right side of the display.
*/
void setScrollBarPosition(ScrollBarPosition position);
void setScrollBarPosition(QTermWidget::ScrollBarPosition position);
/**
* Sets the current position and range of the display's scroll bar.
@ -200,25 +189,6 @@ public:
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.
@ -229,11 +199,11 @@ public:
*
* Defaults to BlockCursor
*/
void setKeyboardCursorShape(KeyboardCursorShape shape);
void setKeyboardCursorShape(QTermWidget::KeyboardCursorShape shape);
/**
* Returns the shape of the keyboard cursor. See setKeyboardCursorShape()
*/
KeyboardCursorShape keyboardCursorShape() const;
QTermWidget::KeyboardCursorShape keyboardCursorShape() const;
/**
* Sets the color used to draw the keyboard cursor.
@ -505,6 +475,9 @@ public slots:
/** See setUsesMouse() */
bool usesMouse() const;
void setBracketedPasteMode(bool bracketedPasteMode);
bool bracketedPasteMode() const;
/**
* Shows a notification that a bell event has occurred in the terminal.
* TODO: More documentation here
@ -757,6 +730,7 @@ private:
bool _terminalSizeStartup;
bool _bidiEnabled;
bool _mouseMarks;
bool _bracketedPasteMode;
QPoint _iPntSel; // initial selection point
QPoint _pntSel; // current selection point
@ -769,7 +743,7 @@ private:
QClipboard* _clipboard;
QScrollBar* _scrollBar;
ScrollBarPosition _scrollbarLocation;
QTermWidget::ScrollBarPosition _scrollbarLocation;
QString _wordCharacters;
int _bellMode;
@ -814,7 +788,7 @@ private:
TerminalImageFilterChain* _filterChain;
QRegion _mouseOverHotspotArea;
KeyboardCursorShape _cursorShape;
QTermWidget::KeyboardCursorShape _cursorShape;
// custom cursor color. if this is invalid then the foreground
// color of the character under the cursor is used

View File

@ -40,7 +40,6 @@
// Standard
#include <stdio.h>
#include <unistd.h>
#include <assert.h>
// Qt
#include <QEvent>
@ -1170,6 +1169,7 @@ void Vt102Emulation::resetModes()
resetMode(MODE_Mouse1001); saveMode(MODE_Mouse1001);
resetMode(MODE_Mouse1002); saveMode(MODE_Mouse1002);
resetMode(MODE_Mouse1003); saveMode(MODE_Mouse1003);
resetMode(MODE_BracketedPaste); saveMode(MODE_BracketedPaste);
resetMode(MODE_AppScreen); saveMode(MODE_AppScreen);
resetMode(MODE_AppCuKeys); saveMode(MODE_AppCuKeys);
@ -1193,7 +1193,11 @@ void Vt102Emulation::setMode(int m)
case MODE_Mouse1001:
case MODE_Mouse1002:
case MODE_Mouse1003:
emit programUsesMouseChanged(false);
emit programUsesMouseChanged(false);
break;
case MODE_BracketedPaste:
emit programBracketedPasteModeChanged(true);
break;
case MODE_AppScreen : _screen[1]->clearSelection();
@ -1223,6 +1227,10 @@ void Vt102Emulation::resetMode(int m)
emit programUsesMouseChanged(true);
break;
case MODE_BracketedPaste:
emit programBracketedPasteModeChanged(false);
break;
case MODE_AppScreen :
_screen[0]->clearSelection();
setScreen(0);

View File

@ -0,0 +1,93 @@
[Color0]
Color=7,54,66
[Color0Intense]
Color=0,43,54
[Color0Faint]
Color=6,48,59
[Color1]
Color=220,50,47
[Color1Intense]
Color=203,75,22
[Color1Faint]
Color=147,33,31
[Color2]
Color=133,153,0
[Color2Intense]
Color=88,110,117
[Color2Faint]
Color=94,106,0
[Color3]
Color=181,137,0
[Color3Intense]
Color=101,123,131
[Color3Faint]
Color=138,103,0
[Color4]
Color=38,139,210
[Color4Intense]
Color=131,148,150
[Color4Faint]
Color=20,77,115
[Color5]
Color=211,54,130
[Color5Intense]
Color=108,113,196
[Color5Faint]
Color=120,30,75
[Color6]
Color=42,161,152
[Color6Intense]
Color=147,161,161
[Color6Faint]
Color=24,94,88
[Color7]
Color=238,232,213
[Color7Intense]
Color=253,246,227
[Color7Faint]
Color=171,167,154
[Background]
Color=0,43,54
[BackgroundIntense]
Color=7,54,66
[BackgroundFaint]
Color=0,43,54
[Foreground]
Color=131,148,150
[ForegroundIntense]
Color=147,161,161
[ForegroundFaint]
Color=106,119,121
[General]
Description=Solarized
Opacity=1

View File

@ -0,0 +1,93 @@
[Color0]
Color=7,54,66
[Color0Intense]
Color=0,43,54
[Color0Faint]
Color=8,65,80
[Color1]
Color=220,50,47
[Color1Intense]
Color=203,75,22
[Color1Faint]
Color=222,81,81
[Color2]
Color=133,153,0
[Color2Intense]
Color=88,110,117
[Color2Faint]
Color=153,168,39
[Color3]
Color=181,137,0
[Color3Intense]
Color=101,123,131
[Color3Faint]
Color=213,170,49
[Color4]
Color=38,139,210
[Color4Intense]
Color=131,148,150
[Color4Faint]
Color=80,173,226
[Color5]
Color=211,54,130
[Color5Intense]
Color=108,113,196
[Color5Faint]
Color=223,92,158
[Color6]
Color=42,161,152
[Color6Intense]
Color=147,161,161
[Color6Faint]
Color=78,211,200
[Color7]
Color=238,232,213
[Color7Intense]
Color=253,246,227
[Color7Faint]
Color=238,232,213
[Background]
Color=253,246,227
[BackgroundIntense]
Color=238,232,213
[BackgroundFaint]
Color=253,246,227
[Foreground]
Color=101,123,131
[ForegroundIntense]
Color=88,110,117
[ForegroundFaint]
Color=141,172,182
[General]
Description=Solarized Light
Opacity=1

View File

@ -355,6 +355,9 @@ protected:
openMode(QIODevice::ReadWrite)
{
}
virtual ~KProcessPrivate()
{
}
void writeAll(const QByteArray &buf, int fd);
void forwardStd(KProcess::ProcessChannel good, int fd);
void _k_forwardStdout();

View File

@ -25,7 +25,7 @@
#include <QObject>
struct KPtyPrivate;
class KPtyPrivate;
struct termios;
/**

View File

@ -27,7 +27,8 @@
#include <QByteArray>
struct KPtyPrivate {
class KPtyPrivate {
public:
Q_DECLARE_PUBLIC(KPty)

View File

@ -41,7 +41,7 @@ class QSocketNotifier;
#define Q_DECLARE_PRIVATE_MI(Class, SuperClass) \
inline Class##Private* d_func() { return reinterpret_cast<Class##Private *>(SuperClass::d_ptr); } \
inline const Class##Private* d_func() const { return reinterpret_cast<const Class##Private *>(SuperClass::d_ptr); } \
friend class Class##Private;
friend struct Class##Private;
/**
* Encapsulates KPty into a QIODevice, so it can be used with Q*Stream, etc.

View File

@ -37,7 +37,7 @@
class KPtyDevice;
struct KPtyProcessPrivate;
class KPtyProcessPrivate;
/**
* This class extends KProcess by support for PTYs (pseudo TTYs).
@ -155,7 +155,8 @@ private:
// private data //
//////////////////
struct KPtyProcessPrivate : KProcessPrivate {
class KPtyProcessPrivate : public KProcessPrivate {
public:
KPtyProcessPrivate() :
ptyChannels(KPtyProcess::NoChannels),
addUtmp(false)

View File

@ -296,11 +296,13 @@ void QTermWidget::init(int startnow)
m_searchBar->setFont(font);
setScrollBarPosition(NoScrollBar);
setKeyboardCursorShape(BlockCursor);
m_impl->m_session->addView(m_impl->m_terminalDisplay);
connect(m_impl->m_session, SIGNAL(resizeRequest(QSize)), this, SLOT(setSize(QSize)));
connect(m_impl->m_session, SIGNAL(finished()), this, SLOT(sessionFinished()));
connect(m_impl->m_session, &Session::titleChanged, this, &QTermWidget::titleChanged);
}
@ -432,6 +434,11 @@ QStringList QTermWidget::availableColorSchemes()
return ret;
}
void QTermWidget::addCustomColorSchemeDir(const QString& custom_dir)
{
ColorSchemeManager::instance()->addCustomColorSchemeDir(custom_dir);
}
void QTermWidget::setSize(const QSize &size)
{
if (!m_impl->m_terminalDisplay)
@ -451,7 +458,7 @@ void QTermWidget::setScrollBarPosition(ScrollBarPosition pos)
{
if (!m_impl->m_terminalDisplay)
return;
m_impl->m_terminalDisplay->setScrollBarPosition((TerminalDisplay::ScrollBarPosition)pos);
m_impl->m_terminalDisplay->setScrollBarPosition(pos);
}
void QTermWidget::scrollToEnd()
@ -478,7 +485,6 @@ void QTermWidget::sessionFinished()
emit finished();
}
void QTermWidget::copyClipboard()
{
m_impl->m_terminalDisplay->copyClipboard();
@ -641,3 +647,31 @@ int QTermWidget::getPtySlaveFd() const
{
return m_impl->m_session->getPtySlaveFd();
}
void QTermWidget::setKeyboardCursorShape(KeyboardCursorShape shape)
{
if (!m_impl->m_terminalDisplay)
return;
m_impl->m_terminalDisplay->setKeyboardCursorShape(shape);
}
QString QTermWidget::title() const
{
QString title = m_impl->m_session->userTitle();
if (title.isEmpty())
title = m_impl->m_session->title(Konsole::Session::NameRole);
return title;
}
QString QTermWidget::icon() const
{
QString icon = m_impl->m_session->iconText();
if (icon.isEmpty())
icon = m_impl->m_session->iconName();
return icon;
}
bool QTermWidget::isTitleChanged() const
{
return m_impl->m_session->isTitleChanged();
}

View File

@ -32,13 +32,35 @@ class QTermWidget : public QWidget {
Q_OBJECT
public:
/**
* This enum describes the location where the scroll bar is positioned in the display widget.
*/
enum ScrollBarPosition {
/** Do not show the scroll bar. */
NoScrollBar=0,
NoScrollBar = 0,
/** Show the scroll bar on the left side of the display. */
ScrollBarLeft=1,
ScrollBarLeft = 1,
/** Show the scroll bar on the right side of the display. */
ScrollBarRight=2
ScrollBarRight = 2
};
/**
* 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 = 0,
/**
* A single flat line which occupies the space at the bottom of the cursor
* character's area.
*/
UnderlineCursor = 1,
/**
* An cursor shaped like the capital letter 'I', similar to the IBeam
* cursor used in Qt/KDE text editors.
*/
IBeamCursor = 2
};
//Creation of widget
@ -98,6 +120,7 @@ public:
*/
void setColorScheme(const QString & name);
static QStringList availableColorSchemes();
static void addCustomColorSchemeDir(const QString& custom_dir);
// History size for scrolling
void setHistorySize(int lines); //infinite if lines < 0
@ -176,6 +199,18 @@ public:
*/
int getPtySlaveFd() const;
/**
* Sets the shape of the keyboard cursor. This is the cursor drawn
* at the position in the terminal where keyboard input will appear.
*/
void setKeyboardCursorShape(KeyboardCursorShape shape);
QString title() const;
QString icon() const;
/** True if the title() or icon() was (ever) changed by the session. */
bool isTitleChanged() const;
signals:
void finished();
void copyAvailable(bool);
@ -199,6 +234,8 @@ signals:
*/
void sendData(const char *,int);
void titleChanged();
public slots:
// Copy selection to clipboard
void copyClipboard();

View File

@ -43,36 +43,61 @@ QString get_kb_layout_dir()
#endif // BUNDLE_KEYBOARDLAYOUTS
}
/*! Helper function to get possible location of layout files.
/*! Helper function to add custom location of color schemes.
*/
namespace {
QStringList custom_color_schemes_dirs;
}
void add_custom_color_scheme_dir(const QString& custom_dir)
{
if (!custom_color_schemes_dirs.contains(custom_dir))
custom_color_schemes_dirs << custom_dir;
}
/*! Helper function to get possible locations of color schemes.
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()
const QStringList get_color_schemes_dirs()
{
#ifdef BUNDLE_COLORSCHEMES
return QLatin1String(":/");
#else
// qDebug() << __FILE__ << __FUNCTION__;
QString rval = "";
QStringList rval;
QString k(COLORSCHEMES_DIR);
QDir d(k);
// qDebug() << "default COLORSCHEMES_DIR: " << k;
if (d.exists())
rval = k.append("/");
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/";
{
if (!rval.isEmpty())
rval.clear();
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/";
{
if (!rval.isEmpty())
rval.clear();
rval << (QCoreApplication::applicationDirPath() + "/../Resources/color-schemes/");
}
#endif
for (const QString& custom_dir : custom_color_schemes_dirs)
{
d.setPath(custom_dir);
if (d.exists())
rval << custom_dir;
}
#ifdef QT_DEBUG
if(!rval.isEmpty()) {
qDebug() << "Using color-schemes: " << rval;

View File

@ -2,9 +2,10 @@
#define TOOLS_H
#include <QString>
#include <QStringList>
QString get_kb_layout_dir();
QString get_color_schemes_dir();
void add_custom_color_scheme_dir(const QString& custom_dir);
const QStringList get_color_schemes_dirs();
#endif

34
pyqt/README.md Normal file
View File

@ -0,0 +1,34 @@
PyQt5 Bindings for QTermWidget
==============================
INSTALL:
------------
####1. Download QTermWidget -> https://github.com/lxde/qtermwidget
####2. Compile and install it:
$ mkdir build && cd build
$ cmake ..
$ make
$ sudo make install
If `make install` command will not work just copy the `qtermwidget.so*` files to /usr/lib directory.
####3. Install PyQt5 and PyQt5-devel if not yet installed.
####4. Configure, compile and install bindings. Execute in terminal in the qtermwidget bindings folder:
$ python config.py
$ make
$ sudo make install
####5. You can run ./test.py to test the installed module.
ABOUT:
---------
Based on previous PyQt4 bindings by:
- Piotr "Riklaunim" Maliński <riklaunim@gmail.com>,
- Alexander Slesarev <alex.slesarev@gmail.com>
PyQt5 QTermWidget Bindings
License: GPL3

85
pyqt/config-old.py Executable file
View File

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

93
pyqt/config.py Executable file
View File

@ -0,0 +1,93 @@
import os
import sipconfig
import subprocess
import os
import site
import pprint
from distutils import sysconfig
import pyqtconfig
from PyQt5 import QtCore
import PyQt5
class Configuration(sipconfig.Configuration):
"""The class that represents PyQt configuration values.
"""
def getEnv(self,name, default):
return os.environ.get(name) or default
def __init__(self):
qtconfig = subprocess.check_output(["/usr/lib64/qt5/bin/qmake", "-query"], universal_newlines=True)
qtconfig = dict(x.split(":", 1) for x in qtconfig.splitlines())
self.pyQtIncludePath = self.getEnv('PYQT_INCLUDE_PATH','/usr/share/sip/PyQt5' )
pyqtconfig = {
"pyqt_config_args": "--confirm-license -v "+str(self.pyQtIncludePath)+" --qsci-api -q /usr/lib64/qt5/bin/qmake",
"pyqt_version": QtCore.PYQT_VERSION,
"pyqt_version_str": QtCore.PYQT_VERSION_STR,
"pyqt_bin_dir": PyQt5.__path__[0],
"pyqt_mod_dir": PyQt5.__path__[0],
"pyqt_sip_dir": str(self.pyQtIncludePath),
"pyqt_modules": "QtCore QtGui QtWidgets", #... and many more
"pyqt_sip_flags": QtCore.PYQT_CONFIGURATION['sip_flags'],
"qt_version": QtCore.QT_VERSION,
"qt_edition": "free",
"qt_winconfig": "shared",
"qt_framework": 0,
"qt_threaded": 1,
"qt_dir": qtconfig['QT_INSTALL_PREFIX'],
"qt_data_dir": qtconfig['QT_INSTALL_DATA'],
"qt_archdata_dir": qtconfig['QT_INSTALL_DATA'],
"qt_inc_dir": qtconfig['QT_INSTALL_HEADERS'],
"qt_lib_dir": qtconfig['QT_INSTALL_LIBS']
}
macros = sipconfig._default_macros.copy()
macros['INCDIR_QT'] = qtconfig['QT_INSTALL_HEADERS']
macros['LIBDIR_QT'] = qtconfig['QT_INSTALL_LIBS']
macros['MOC'] = os.path.join(qtconfig['QT_INSTALL_BINS'], 'moc')
sipconfig.Configuration.__init__(self, [pyqtconfig])
self.set_build_macros(macros)
## The name of the SIP build file generated by SIP and used by the build system.
build_file = "qtermwidget.sbf"
# Get the SIP configuration information.
config = Configuration()
# Run SIP to generate the build_file
os.system(" ".join([config.sip_bin, '-I' , str(config.pyQtIncludePath), str(config.pyqt_sip_flags), "-b", build_file,"-o", "-c", ". " " qtermwidget.sip"]))
installs = []
installs.append(["qtermwidget.sip", os.path.join(config.pyqt_sip_dir,"qtermwidget")])
installs.append(["qtermwidgetconfig.py", config.pyqt_mod_dir])
makefile = sipconfig.SIPModuleMakefile( configuration = config, build_file = build_file, installs = installs, qt=["QtCore" ,"QtGui", "QtWidgets"] )
# Add the library we are wrapping. The name doesn't include any platform
# specific prefixes or extensions (e.g. the "lib" prefix on UNIX, or the
# ".dll" extension on Windows).
makefile.extra_lib_dirs.append("../lib/")
makefile.extra_lib_dirs.append("..")
makefile.extra_libs = ["qtermwidget5"]
# Generate the Makefile itself.
makefile.generate()
content = {
# Publish where the SIP specifications for this module will be
# installed.
"qtermwidget_sip_dir": config.pyqt_sip_dir,
# Publish the set of SIP flags needed by this module. As these are the
# same flags needed by the qt module we could leave it out, but this
# allows us to change the flags at a later date without breaking
# scripts that import the configuration module.
"qtermwidget_sip_flags": config.pyqt_sip_flags
}
# This creates the qtermwidgetconfig.py module from the qtermwidgetconfig.py.in
# template and the dictionary.
sipconfig.create_config_module("qtermwidgetconfig.py", "config.py.in", content)

0
pyqt/config.py.in Normal file
View File

86
pyqt/qtermwidget.sip Normal file
View File

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

View File

34
pyqt/test.py Executable file
View File

@ -0,0 +1,34 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# PyQt4 bindings for th QTermWidget project.
#
# Copyright (C) 2009 Piotr "Riklaunim" Maliński <riklaunim@gmail.com>,
# Alexander Slesarev <alex.slesarev@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import sys, signal
from PyQt5 import QtCore,QtWidgets
import QTermWidget
signal.signal(signal.SIGINT, signal.SIG_DFL)
a = QtWidgets.QApplication(sys.argv)
w = QTermWidget.QTermWidget()
w.finished.connect(a.quit)
w.show()
a.exec_()