Compare commits
138 Commits
osx
...
ioprofiles
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
90546e49e8 | ||
|
|
058bafe033 | ||
|
|
2dd4e0d841 | ||
|
|
d603d9d54a | ||
|
|
568d278871 | ||
|
|
438c50d775 | ||
|
|
8c08f63881 | ||
|
|
71020e40a5 | ||
|
|
413a32f33f | ||
|
|
d4ca781e90 | ||
|
|
539a5ed74f | ||
|
|
093cead312 | ||
|
|
c57ef45ce6 | ||
|
|
8232543abc | ||
|
|
29ec02b65e | ||
|
|
0e765e427b | ||
|
|
1cbedb41d9 | ||
|
|
a78231eac5 | ||
|
|
9bd0ca74b6 | ||
|
|
800bbd359b | ||
|
|
10cc27e7cf | ||
|
|
9deeb5e405 | ||
|
|
614793ecd0 | ||
|
|
a9ed10573b | ||
|
|
15a951288d | ||
|
|
f15440c3c3 | ||
|
|
dab4b13bfd | ||
|
|
f8db912f5f | ||
|
|
5cfee38329 | ||
|
|
466fea495d | ||
|
|
ba77e21817 | ||
|
|
cc72a28ee3 | ||
|
|
e815fe2787 | ||
|
|
2ff6c71c23 | ||
|
|
1dd633be0b | ||
|
|
d885f27e0b | ||
|
|
a08c738a65 | ||
|
|
14ab8942af | ||
|
|
9caae00db9 | ||
|
|
4b87b6e5d6 | ||
|
|
1febce3775 | ||
|
|
d2b677a0e2 | ||
|
|
82df40591b | ||
|
|
774e4f5306 | ||
|
|
19f6d85243 | ||
|
|
1be7987abe | ||
|
|
2dbe129857 | ||
|
|
d1280f28c2 | ||
|
|
53897f8186 | ||
|
|
b4bf29dc9e | ||
|
|
bc87df170b | ||
|
|
67ea080c2e | ||
|
|
7159b9e513 | ||
|
|
7931069302 | ||
|
|
eb413f79e4 | ||
|
|
7bd8b56657 | ||
|
|
c94e31f82a | ||
|
|
639fd53a19 | ||
|
|
62b04ff491 | ||
|
|
1e5c36a351 | ||
|
|
c8fd4df6f3 | ||
|
|
1928d57f46 | ||
|
|
39bb5f5ee9 | ||
|
|
1cef3117cb | ||
|
|
61c34da01e | ||
|
|
7687ccf3e8 | ||
|
|
b047dc9313 | ||
|
|
c4d016a0fd | ||
|
|
ae0154935d | ||
|
|
dd238755c9 | ||
|
|
5e07c98919 | ||
|
|
98b2511660 | ||
|
|
2ecff6276c | ||
|
|
e8aee5412f | ||
|
|
7fa48f6c5d | ||
|
|
d81c120024 | ||
|
|
6a8cdbab4c | ||
|
|
bde7ed901c | ||
|
|
f0aa9c423b | ||
|
|
8313b2a2fd | ||
|
|
95dce399b5 | ||
|
|
3eb836fd81 | ||
|
|
a0bfe0f77f | ||
|
|
765c41307f | ||
|
|
46edda6d18 | ||
|
|
09df72c3d2 | ||
|
|
c305e32a47 | ||
|
|
ad8818f811 | ||
|
|
d3e1d9d158 | ||
|
|
f3e25d9c64 | ||
|
|
d51e0cc32e | ||
|
|
1c5bf4d3a8 | ||
|
|
edfa71d3ac | ||
|
|
9e47a366de | ||
|
|
0bc4e061d0 | ||
|
|
14ef4e2613 | ||
|
|
93c8c0f21f | ||
|
|
f6e3d518e4 | ||
|
|
cad496b1fb | ||
|
|
f7354e54dc | ||
|
|
d6288518c4 | ||
|
|
abb485f828 | ||
|
|
6b1d09955f | ||
|
|
1c97a08b8d | ||
|
|
589ebdc73f | ||
|
|
8b5da7535b | ||
|
|
3bad3122f0 | ||
|
|
3f672e6ef3 | ||
|
|
70e4e285d7 | ||
|
|
5a7e660812 | ||
|
|
428887cb8a | ||
|
|
064e967810 | ||
|
|
be0ccfa1ba | ||
|
|
cf1fed9bec | ||
|
|
307f640327 | ||
|
|
40d34c2cca | ||
|
|
7f5a47f8a4 | ||
|
|
2494bc0522 | ||
|
|
b70ea57122 | ||
|
|
3d705f7178 | ||
|
|
1cd41ce0b9 | ||
|
|
eab0eec746 | ||
|
|
17f605275e | ||
|
|
f4771d4f37 | ||
|
|
445bb5bad5 | ||
|
|
1902e34d04 | ||
|
|
a7210c69ed | ||
|
|
4b4fabaee3 | ||
|
|
876e6079d4 | ||
|
|
b81818f74d | ||
|
|
0de719b67f | ||
|
|
296c64eb73 | ||
|
|
4cb3275498 | ||
|
|
c909779514 | ||
|
|
e1ac0a35b4 | ||
|
|
e3d8992a35 | ||
|
|
f167b4d447 | ||
|
|
0f3c78a8c7 |
13
.gitignore
vendored
@@ -35,4 +35,15 @@ Makefile*
|
||||
|
||||
*.xcf
|
||||
|
||||
/imports/
|
||||
# Ubuntu SDk
|
||||
*.excludes
|
||||
*.json
|
||||
|
||||
# Excludes compiled files
|
||||
imports
|
||||
cool-retro-term
|
||||
|
||||
# Mac OSX
|
||||
|
||||
.DS_Store
|
||||
*.app
|
||||
|
||||
86
README.md
@@ -1,10 +1,10 @@
|
||||
#cool-old-term
|
||||
#cool-retro-term
|
||||
|
||||
##Description
|
||||
cool-old-term is a terminal emulator which tries to mimic the look and feel of the old cathode tube screens.
|
||||
cool-retro-term is a terminal emulator which mimics the look and feel of the old cathode tube screens.
|
||||
It has been designed to be eye-candy, customizable, and reasonably lightweight.
|
||||
|
||||
It now uses the konsole engine which is powerful and mature.
|
||||
It uses the Konsole engine which is powerful and mature.
|
||||
|
||||
This terminal emulator requires Qt 5.2 or higher to run.
|
||||
|
||||
@@ -13,7 +13,16 @@ This terminal emulator requires Qt 5.2 or higher to run.
|
||||

|
||||

|
||||
|
||||
##Build instructions
|
||||
##Get cool-retro-term
|
||||
You can either build cool-retro-term yourself (see below) or walk the easy way and install one of these packages:
|
||||
|
||||
Users of Fedora and openSUSE can grab a package from [Open Build Service](http://software.opensuse.org/package/cool-retro-term).
|
||||
|
||||
Arch users can install this [package](https://aur.archlinux.org/packages/cool-retro-term-git/) directly via the [AUR](https://aur.archlinux.org):
|
||||
|
||||
yaourt -S aur/cool-retro-term-git
|
||||
|
||||
##Build instructions (Linux)
|
||||
|
||||
##Dependencies
|
||||
Make sure to install these first.
|
||||
@@ -34,22 +43,12 @@ Make sure to install these first.
|
||||
|
||||
**Fedora**
|
||||
This command should install the known fedora dependencies:
|
||||
```
|
||||
sudo yum -y install qt5-qtbase qt5-qtbase-devel qt5-qtdeclarative qt5-qtdeclarative-devel qt5-qtgraphicaleffects qt5-qtquickcontrols
|
||||
```
|
||||
or:
|
||||
```
|
||||
sudo dnf -y install qt5-qtbase qt5-qtbase-devel qt5-qtdeclarative qt5-qtdeclarative-devel qt5-qtgraphicaleffects qt5-qtquickcontrols
|
||||
```
|
||||
|
||||
Compile using the following:
|
||||
```
|
||||
git clone https://github.com/Swordifish90/cool-old-term.git
|
||||
cd cool-old-term/konsole-qml-plugin
|
||||
qmake-qt5 && make && make install
|
||||
cd ..
|
||||
./cool-old-term
|
||||
```
|
||||
sudo yum -y install qt5-qtbase qt5-qtbase-devel qt5-qtdeclarative qt5-qtdeclarative-devel qt5-qtgraphicaleffects qt5-qtquickcontrols
|
||||
|
||||
or:
|
||||
|
||||
sudo dnf -y install qt5-qtbase qt5-qtbase-devel qt5-qtdeclarative qt5-qtdeclarative-devel qt5-qtgraphicaleffects qt5-qtquickcontrols
|
||||
|
||||
---
|
||||
|
||||
@@ -57,23 +56,17 @@ cd ..
|
||||
|
||||
sudo pacman -S qt5-base qt5-declarative qt5-quickcontrols qt5-graphicaleffects
|
||||
|
||||
You can also install this [package](https://aur.archlinux.org/packages/cool-old-term-git/) directly via the [AUR](https://aur.archlinux.org):
|
||||
|
||||
yaourt -S aur/cool-old-term-git
|
||||
|
||||
---
|
||||
|
||||
**OS X**
|
||||
**openSUSE**
|
||||
|
||||
brew install qt5
|
||||
export CPPFLAGS="-I/usr/local/opt/qt5/include"
|
||||
export LDFLAGS="-L/usr/local/opt/qt5/lib"
|
||||
export PATH=/usr/local/opt/qt5/bin:$PATH
|
||||
git clone https://github.com/Swordifish90/cool-old-term.git
|
||||
git checkout osx
|
||||
qmake && make && make install
|
||||
# Have fun!
|
||||
./cool-old-term
|
||||
Add repository with latest Qt 5 (this is only needed on openSUSE 13.1, Factory already has it):
|
||||
|
||||
sudo zypper ar http://download.opensuse.org/repositories/KDE:/Qt5/openSUSE_13.1/ KDE:Qt5
|
||||
|
||||
Install dependencies:
|
||||
|
||||
sudo zypper install libqt5-qtbase-devel libqt5-qtdeclarative-devel libqt5-qtquickcontrols libqt5-qtgraphicaleffects
|
||||
|
||||
---
|
||||
|
||||
@@ -82,20 +75,35 @@ You can also install this [package](https://aur.archlinux.org/packages/cool-old-
|
||||
Install Qt directly from here http://qt-project.org/downloads . Once done export them in you path (replace "_/opt/Qt5.3.1/5.3/gcc_64/bin_" with your correct folder):
|
||||
|
||||
export PATH=/opt/Qt5.3.1/5.3/gcc_64/bin/:$PATH
|
||||
---
|
||||
|
||||
###Compile
|
||||
Once you installed all dependencies (Qt is installed and in your path) you need to compile and run the application:
|
||||
|
||||
```bash
|
||||
# Get it from GitHub
|
||||
git clone https://github.com/Swordifish90/cool-old-term.git
|
||||
git clone https://github.com/Swordfish90/cool-retro-term.git
|
||||
|
||||
# Build it
|
||||
cd cool-old-term
|
||||
cd konsole-qml-plugin
|
||||
qmake && make && make install
|
||||
cd ..
|
||||
cd cool-retro-term
|
||||
|
||||
# Compile (Fedora and OpenSUSE user should use qmake-qt5 instead of qmake)
|
||||
qmake && make
|
||||
|
||||
# Have fun!
|
||||
./cool-old-term
|
||||
./cool-retro-term
|
||||
```
|
||||
|
||||
##Build instructions (OSX)
|
||||
|
||||
brew install qt5
|
||||
git clone https://github.com/Swordfish90/cool-retro-term.git
|
||||
export CPPFLAGS="-I/usr/local/opt/qt5/include"
|
||||
export LDFLAGS="-L/usr/local/opt/qt5/lib"
|
||||
export PATH=/usr/local/opt/qt5/bin:$PATH
|
||||
cd cool-retro-term
|
||||
qmake && make
|
||||
open cool-retro-term.app
|
||||
|
||||
##Donations
|
||||
I made this project in my spare time because I love what I'm doing. If you are enjoying it and you want to buy me a beer click [here](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=flscogna%40gmail%2ecom&lc=IT&item_name=Filippo%20Scognamiglio¤cy_code=EUR&bn=PP%2dDonationsBF%3abtn_donate_LG%2egif%3aNonHosted) .
|
||||
|
||||
50
app/FileIO.h
Normal file
@@ -0,0 +1,50 @@
|
||||
#ifndef FILEIO_H
|
||||
#define FILEIO_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QFile>
|
||||
#include <QTextStream>
|
||||
#include <QUrl>
|
||||
|
||||
class FileIO : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
FileIO() {}
|
||||
|
||||
public slots:
|
||||
bool write(const QString& sourceUrl, const QString& data) {
|
||||
if (sourceUrl.isEmpty())
|
||||
return false;
|
||||
|
||||
QUrl url(sourceUrl);
|
||||
QFile file(url.toLocalFile());
|
||||
if (!file.open(QFile::WriteOnly | QFile::Truncate))
|
||||
return false;
|
||||
|
||||
QTextStream out(&file);
|
||||
out << data;
|
||||
file.close();
|
||||
return true;
|
||||
}
|
||||
|
||||
QString read(const QString& sourceUrl) {
|
||||
if (sourceUrl.isEmpty())
|
||||
return "";
|
||||
|
||||
QUrl url(sourceUrl);
|
||||
QFile file(url.toLocalFile());
|
||||
if (!file.open(QFile::ReadOnly))
|
||||
return "";
|
||||
|
||||
QTextStream in(&file);
|
||||
QString result = in.readAll();
|
||||
|
||||
file.close();
|
||||
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
#endif // FILEIO_H
|
||||
@@ -1,426 +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 <http://www.gnu.org/licenses/>.
|
||||
*******************************************************************************/
|
||||
|
||||
import QtQuick 2.2
|
||||
import QtGraphicalEffects 1.0
|
||||
import QtQuick.Controls 1.1
|
||||
|
||||
import org.kde.konsole 0.1
|
||||
|
||||
Item{
|
||||
id: terminalContainer
|
||||
property variant theSource: finalSource
|
||||
property variant bloomSource: bloomSourceLoader.item
|
||||
property variant rasterizationSource: rasterizationEffectSource
|
||||
property variant staticNoiseSource: staticNoiseSource
|
||||
|
||||
property alias kterminal: kterminal
|
||||
|
||||
signal sizeChanged
|
||||
onWidthChanged: sizeChanged()
|
||||
onHeightChanged: sizeChanged()
|
||||
|
||||
//The blur effect has to take into account the framerate
|
||||
property int fps: shadersettings.fps !== 0 ? shadersettings.fps : 60
|
||||
property real fpsAttenuation: Math.sqrt(60 / fps)
|
||||
property real mBlur: shadersettings.motion_blur
|
||||
property real motionBlurCoefficient: (_maxBlurCoefficient * mBlur + _minBlurCoefficient * (1 - mBlur))
|
||||
property real _minBlurCoefficient: 0.70
|
||||
property real _maxBlurCoefficient: 0.90
|
||||
|
||||
property size virtualPxSize: Qt.size(1,1)
|
||||
property size virtual_resolution: Qt.size(width / virtualPxSize.width, height / virtualPxSize.height)
|
||||
property real deltay: 0.5 / virtual_resolution.height
|
||||
property real deltax: 0.5 / virtual_resolution.width
|
||||
|
||||
property real mBloom: shadersettings.bloom_strength
|
||||
property int mScanlines: shadersettings.rasterization
|
||||
onMScanlinesChanged: restartBlurredSource()
|
||||
|
||||
property size terminalSize: kterminal.terminalSize
|
||||
property size paintedTextSize
|
||||
|
||||
onMBlurChanged: restartBlurredSource()
|
||||
|
||||
function restartBlurredSource(){
|
||||
if(!blurredSource) return;
|
||||
blurredSource.live = true;
|
||||
livetimer.restart()
|
||||
}
|
||||
function pasteClipboard(){
|
||||
kterminal.pasteClipboard();
|
||||
}
|
||||
function copyClipboard(){
|
||||
kterminal.copyClipboard();
|
||||
}
|
||||
|
||||
KTerminal {
|
||||
id: kterminal
|
||||
anchors.fill: parent
|
||||
|
||||
colorScheme: "cool-old-term"
|
||||
|
||||
session: KSession {
|
||||
id: ksession
|
||||
kbScheme: "linux"
|
||||
|
||||
onFinished: {
|
||||
Qt.quit()
|
||||
}
|
||||
}
|
||||
|
||||
FontLoader{ id: fontLoader }
|
||||
Text{id: fontMetrics; text: "B"; visible: false}
|
||||
|
||||
function getPaintedSize(pixelSize){
|
||||
fontMetrics.font.family = fontLoader.name;
|
||||
fontMetrics.font.pixelSize = pixelSize;
|
||||
return Qt.size(fontMetrics.paintedWidth, fontMetrics.paintedHeight);
|
||||
}
|
||||
function isValid(size){
|
||||
return size.width >= 0 && size.height >= 0;
|
||||
}
|
||||
function handleFontChange(fontSource, pixelSize, lineSpacing, virtualCharSize){
|
||||
fontLoader.source = fontSource;
|
||||
font.pixelSize = pixelSize * shadersettings.window_scaling;
|
||||
font.family = fontLoader.name;
|
||||
|
||||
var paintedSize = getPaintedSize(pixelSize);
|
||||
var charSize = isValid(virtualCharSize)
|
||||
? virtualCharSize
|
||||
: Qt.size(paintedSize.width / 2, paintedSize.height / 2);
|
||||
|
||||
var virtualPxSize = Qt.size((paintedSize.width / charSize.width) * shadersettings.window_scaling,
|
||||
(paintedSize.height / charSize.height) * shadersettings.window_scaling)
|
||||
|
||||
terminalContainer.virtualPxSize = virtualPxSize;
|
||||
|
||||
setLineSpacing(lineSpacing * shadersettings.window_scaling);
|
||||
restartBlurredSource();
|
||||
}
|
||||
Component.onCompleted: {
|
||||
shadersettings.terminalFontChanged.connect(handleFontChange);
|
||||
forceActiveFocus();
|
||||
}
|
||||
}
|
||||
Menu{
|
||||
id: contextmenu
|
||||
|
||||
MenuItem{action: copyAction}
|
||||
MenuItem{action: pasteAction}
|
||||
MenuSeparator{}
|
||||
MenuItem{action: fullscreenAction}
|
||||
MenuItem{action: showMenubarAction}
|
||||
}
|
||||
MouseArea{
|
||||
acceptedButtons: Qt.LeftButton | Qt.MiddleButton | Qt.RightButton
|
||||
anchors.fill: parent
|
||||
onWheel:{
|
||||
var coord = correctDistortion(wheel.x, wheel.y);
|
||||
var lines = wheel.angleDelta.y > 0 ? -2 : 2;
|
||||
kterminal.scrollWheel(coord.width, coord.height, lines);
|
||||
}
|
||||
onClicked: {
|
||||
if (mouse.button == Qt.RightButton){
|
||||
contextmenu.popup();
|
||||
} else if (mouse.button == Qt.MiddleButton){
|
||||
kterminal.pasteSelection();
|
||||
}
|
||||
}
|
||||
onDoubleClicked: {
|
||||
if (mouse.button == Qt.LeftButton){
|
||||
var coord = correctDistortion(mouse.x, mouse.y);
|
||||
kterminal.mouseDoubleClick(coord.width, coord.height);
|
||||
}
|
||||
}
|
||||
onPositionChanged: {
|
||||
if (pressedButtons & Qt.LeftButton){
|
||||
var coord = correctDistortion(mouse.x, mouse.y);
|
||||
kterminal.mouseMove(coord.width, coord.height);
|
||||
}
|
||||
}
|
||||
onPressed: {
|
||||
if (mouse.button == Qt.LeftButton){
|
||||
var coord = correctDistortion(mouse.x, mouse.y);
|
||||
kterminal.mousePress(coord.width, coord.height);
|
||||
}
|
||||
}
|
||||
onReleased: {
|
||||
if (mouse.button == Qt.LeftButton){
|
||||
var coord = correctDistortion(mouse.x, mouse.y);
|
||||
kterminal.mouseRelease(coord.width, coord.height);
|
||||
}
|
||||
}
|
||||
|
||||
//Frame displacement properties
|
||||
property real dtop: frame.item.displacementTop
|
||||
property real dleft:frame.item.displacementLeft
|
||||
property real dright: frame.item.displacementRight
|
||||
property real dbottom: frame.item.displacementBottom
|
||||
|
||||
function correctDistortion(x, y){
|
||||
x = x / width;
|
||||
y = y / height;
|
||||
|
||||
x = (-dleft + x * (width + dleft + dright)) / width
|
||||
y = (-dtop + y * (height + dtop + dbottom)) / height
|
||||
|
||||
var cc = Qt.size(0.5 - x, 0.5 - y);
|
||||
var distortion = (cc.height * cc.height + cc.width * cc.width) * shadersettings.screen_distortion;
|
||||
|
||||
return Qt.size((x - cc.width * (1+distortion) * distortion) * width,
|
||||
(y - cc.height * (1+distortion) * distortion) * height)
|
||||
}
|
||||
}
|
||||
ShaderEffectSource{
|
||||
id: source
|
||||
sourceItem: kterminal
|
||||
hideSource: true
|
||||
smooth: false
|
||||
}
|
||||
ShaderEffectSource{
|
||||
id: blurredSource
|
||||
sourceItem: blurredterminal
|
||||
recursive: true
|
||||
live: false
|
||||
|
||||
hideSource: true
|
||||
|
||||
smooth: false
|
||||
antialiasing: false
|
||||
|
||||
Timer{
|
||||
id: livetimer
|
||||
running: true
|
||||
onRunningChanged: running ?
|
||||
timeManager.onTimeChanged.connect(blurredSource.scheduleUpdate) :
|
||||
timeManager.onTimeChanged.disconnect(blurredSource.scheduleUpdate)
|
||||
|
||||
Component.onCompleted: kterminal.updatedImage.connect(restart);
|
||||
}
|
||||
}
|
||||
ShaderEffectSource{
|
||||
id: finalSource
|
||||
sourceItem: blurredterminal
|
||||
sourceRect: frame.sourceRect
|
||||
//format: ShaderEffectSource.Alpha
|
||||
hideSource: true
|
||||
}
|
||||
ShaderEffect {
|
||||
id: blurredterminal
|
||||
anchors.fill: parent
|
||||
property variant source: source
|
||||
property variant blurredSource: (mBlur !== 0) ? blurredSource : undefined
|
||||
property size virtual_resolution: parent.virtual_resolution
|
||||
property size delta: Qt.size((mScanlines == shadersettings.pixel_rasterization ? deltax : 0),
|
||||
mScanlines != shadersettings.no_rasterization ? deltay : 0)
|
||||
blending: false
|
||||
|
||||
fragmentShader:
|
||||
"uniform lowp float qt_Opacity;" +
|
||||
"uniform lowp sampler2D source;" +
|
||||
"uniform highp vec2 delta;" +
|
||||
|
||||
"varying highp vec2 qt_TexCoord0;
|
||||
|
||||
uniform highp vec2 virtual_resolution;" +
|
||||
|
||||
(mBlur !== 0 ?
|
||||
"uniform lowp sampler2D blurredSource;"
|
||||
: "") +
|
||||
|
||||
"void main() {" +
|
||||
"vec2 coords = qt_TexCoord0;" +
|
||||
(mScanlines != shadersettings.no_rasterization ? "
|
||||
coords.y = floor(virtual_resolution.y * coords.y) / virtual_resolution.y;" +
|
||||
(mScanlines == shadersettings.pixel_rasterization ? "
|
||||
coords.x = floor(virtual_resolution.x * coords.x) / virtual_resolution.x;" : "")
|
||||
: "") +
|
||||
"coords = coords + delta;" +
|
||||
"vec4 vcolor = texture2D(source, coords) * 256.0;
|
||||
float color = vcolor.r * 0.21 + vcolor.g * 0.72 + vcolor.b + 0.04;" +
|
||||
(mBlur !== 0 ?
|
||||
"float blurredSourceColor = texture2D(blurredSource, coords).a * 256.0;" +
|
||||
"blurredSourceColor = blurredSourceColor - blurredSourceColor * " + (1.0 - motionBlurCoefficient) * fpsAttenuation+ ";" +
|
||||
"color = step(1.0, color) * color + step(color, 1.0) * blurredSourceColor;"
|
||||
: "") +
|
||||
|
||||
|
||||
"gl_FragColor.a = floor(color) / 256.0;" +
|
||||
"}"
|
||||
|
||||
onStatusChanged: if (log) console.log(log) //Print warning messages
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// EFFECTS //////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// BLOOM ////////////////////////////////////////////////////////////////
|
||||
|
||||
Loader{
|
||||
id: bloomEffectLoader
|
||||
active: mBloom != 0
|
||||
anchors.fill: parent
|
||||
sourceComponent: FastBlur{
|
||||
radius: 48
|
||||
source: kterminal
|
||||
transparentBorder: true
|
||||
smooth: false
|
||||
}
|
||||
}
|
||||
Loader{
|
||||
id: bloomSourceLoader
|
||||
active: mBloom != 0
|
||||
sourceComponent: ShaderEffectSource{
|
||||
sourceItem: bloomEffectLoader.item
|
||||
hideSource: true
|
||||
sourceRect: frame.sourceRect
|
||||
smooth: false
|
||||
}
|
||||
}
|
||||
|
||||
// NOISE ////////////////////////////////////////////////////////////////
|
||||
|
||||
ShaderEffect {
|
||||
id: staticNoiseEffect
|
||||
anchors.fill: parent
|
||||
property size virtual_resolution: terminalContainer.virtual_resolution
|
||||
|
||||
blending: false
|
||||
|
||||
fragmentShader:
|
||||
"uniform lowp float qt_Opacity;
|
||||
varying highp vec2 qt_TexCoord0;
|
||||
uniform highp vec2 virtual_resolution;" +
|
||||
|
||||
"highp float noise(vec2 co)
|
||||
{
|
||||
highp float a = 12.9898;
|
||||
highp float b = 78.233;
|
||||
highp float c = 43758.5453;
|
||||
highp float dt= dot(co.xy ,vec2(a,b));
|
||||
highp float sn= mod(dt,3.14);
|
||||
return fract(sin(sn) * c);
|
||||
}
|
||||
|
||||
vec2 sw(vec2 p) {return vec2( floor(p.x) , floor(p.y) );}
|
||||
vec2 se(vec2 p) {return vec2( ceil(p.x) , floor(p.y) );}
|
||||
vec2 nw(vec2 p) {return vec2( floor(p.x) , ceil(p.y) );}
|
||||
vec2 ne(vec2 p) {return vec2( ceil(p.x) , ceil(p.y) );}
|
||||
|
||||
float smoothNoise(vec2 p) {
|
||||
vec2 inter = smoothstep(0., 1., fract(p));
|
||||
float s = mix(noise(sw(p)), noise(se(p)), inter.x);
|
||||
float n = mix(noise(nw(p)), noise(ne(p)), inter.x);
|
||||
return mix(s, n, inter.y);
|
||||
}" +
|
||||
|
||||
"void main() {" +
|
||||
"gl_FragColor.a = smoothNoise(qt_TexCoord0 * virtual_resolution);" +
|
||||
"}"
|
||||
|
||||
onStatusChanged: if (log) console.log(log) //Print warning messages
|
||||
}
|
||||
ShaderEffectSource{
|
||||
id: staticNoiseSource
|
||||
sourceItem: staticNoiseEffect
|
||||
textureSize: Qt.size(parent.width, parent.height)
|
||||
wrapMode: ShaderEffectSource.Repeat
|
||||
smooth: true
|
||||
hideSource: true
|
||||
//format: ShaderEffectSource.Alpha
|
||||
}
|
||||
|
||||
// RASTERIZATION //////////////////////////////////////////////////////////
|
||||
|
||||
ShaderEffect{
|
||||
id: rasterizationContainer
|
||||
width: frame.sourceRect.width
|
||||
height: frame.sourceRect.height
|
||||
property size offset: Qt.size(width - rasterizationEffect.width, height - rasterizationEffect.height)
|
||||
property size txtRes: Qt.size(width, height)
|
||||
|
||||
blending: false
|
||||
|
||||
fragmentShader:
|
||||
"uniform lowp float qt_Opacity;
|
||||
uniform highp vec2 offset;
|
||||
uniform highp vec2 txtRes;" +
|
||||
|
||||
"varying highp vec2 qt_TexCoord0;" +
|
||||
|
||||
"void main() {" +
|
||||
"float color = 1.0;
|
||||
color *= smoothstep(0.0, offset.x / txtRes.x, qt_TexCoord0.x);
|
||||
color *= smoothstep(0.0, offset.y / txtRes.y, qt_TexCoord0.y);
|
||||
color *= smoothstep(0.0, offset.x / txtRes.x, 1.0 - qt_TexCoord0.x);
|
||||
color *= smoothstep(0.0, offset.y / txtRes.y, 1.0 - qt_TexCoord0.y);" +
|
||||
|
||||
"float distance = length(vec2(0.5) - qt_TexCoord0);" +
|
||||
"color = mix(color, 0.0, 1.2 * distance * distance);" +
|
||||
|
||||
"gl_FragColor.a = color;" +
|
||||
"}"
|
||||
|
||||
ShaderEffect {
|
||||
id: rasterizationEffect
|
||||
width: terminalContainer.width
|
||||
height: terminalContainer.height
|
||||
anchors.centerIn: parent
|
||||
property size virtual_resolution: terminalContainer.virtual_resolution
|
||||
|
||||
blending: false
|
||||
|
||||
fragmentShader:
|
||||
"uniform lowp float qt_Opacity;" +
|
||||
|
||||
"varying highp vec2 qt_TexCoord0;
|
||||
uniform highp vec2 virtual_resolution;
|
||||
|
||||
float getScanlineIntensity(vec2 coords) {
|
||||
float result = 1.0;" +
|
||||
(mScanlines != shadersettings.no_rasterization ?
|
||||
"result *= abs(sin(coords.y * virtual_resolution.y * "+Math.PI+"));" : "") +
|
||||
(mScanlines == shadersettings.pixel_rasterization ?
|
||||
"result *= abs(sin(coords.x * virtual_resolution.x * "+Math.PI+"));" : "") + "
|
||||
return result;
|
||||
}" +
|
||||
|
||||
"void main() {" +
|
||||
"float color = getScanlineIntensity(qt_TexCoord0);" +
|
||||
|
||||
"float distance = length(vec2(0.5) - qt_TexCoord0);" +
|
||||
"color = mix(color, 0.0, 1.2 * distance * distance);" +
|
||||
|
||||
"gl_FragColor.a = color;" +
|
||||
"}"
|
||||
|
||||
onStatusChanged: if (log) console.log(log) //Print warning messages
|
||||
}
|
||||
onStatusChanged: if (log) console.log(log) //Print warning messages
|
||||
}
|
||||
ShaderEffectSource{
|
||||
id: rasterizationEffectSource
|
||||
sourceItem: rasterizationContainer
|
||||
hideSource: true
|
||||
smooth: true
|
||||
//format: ShaderEffectSource.Alpha
|
||||
}
|
||||
}
|
||||
@@ -1,200 +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 <http://www.gnu.org/licenses/>.
|
||||
*******************************************************************************/
|
||||
|
||||
import QtQuick 2.2
|
||||
import QtGraphicalEffects 1.0
|
||||
|
||||
ShaderEffect {
|
||||
property color font_color: shadersettings.font_color
|
||||
property color background_color: shadersettings.background_color
|
||||
property variant source: terminal.theSource
|
||||
property variant bloomSource: terminal.bloomSource
|
||||
property variant rasterizationSource: terminal.rasterizationSource
|
||||
property variant noiseSource: terminal.staticNoiseSource
|
||||
property size txt_Size: Qt.size(frame.sourceRect.width, frame.sourceRect.height)
|
||||
property real bloom: shadersettings.bloom_strength * 2.5
|
||||
|
||||
property int rasterization: shadersettings.rasterization
|
||||
|
||||
property real jitter: shadersettings.jitter * 0.007
|
||||
|
||||
property real noise_strength: shadersettings.noise_strength
|
||||
property real screen_distorsion: shadersettings.screen_distortion
|
||||
property real glowing_line_strength: shadersettings.glowing_line_strength
|
||||
|
||||
property real brightness_flickering: shadersettings.brightness_flickering
|
||||
property real horizontal_sincronization: shadersettings.horizontal_sincronization
|
||||
|
||||
property bool frameReflections: shadersettings.frameReflections
|
||||
|
||||
property real disp_top: frame.item.displacementTop * shadersettings.window_scaling
|
||||
property real disp_bottom: frame.item.displacementBottom * shadersettings.window_scaling
|
||||
property real disp_left: frame.item.displacementLeft * shadersettings.window_scaling
|
||||
property real disp_right: frame.item.displacementRight * shadersettings.window_scaling
|
||||
|
||||
property real brightness: shadersettings.brightness * 1.5 + 0.5
|
||||
|
||||
property real time: timeManager.time
|
||||
property variant randomFunctionSource: randfuncsource
|
||||
|
||||
blending: false
|
||||
|
||||
//Smooth random texture used for flickering effect.
|
||||
Image{
|
||||
id: randtexture
|
||||
source: "frames/images/randfunction.png"
|
||||
width: 512
|
||||
height: 512
|
||||
sourceSize.width: 512
|
||||
sourceSize.height: 256
|
||||
fillMode: Image.TileVertically
|
||||
}
|
||||
ShaderEffectSource{
|
||||
id: randfuncsource
|
||||
sourceItem: randtexture
|
||||
live: false
|
||||
hideSource: true
|
||||
wrapMode: ShaderEffectSource.Repeat
|
||||
}
|
||||
|
||||
//Print the number with a reasonable precision for the shader.
|
||||
function str(num){
|
||||
return num.toFixed(8);
|
||||
}
|
||||
|
||||
vertexShader: "
|
||||
uniform highp mat4 qt_Matrix;
|
||||
uniform highp float time;
|
||||
uniform sampler2D randomFunctionSource;
|
||||
uniform highp vec2 txt_Size;
|
||||
|
||||
attribute highp vec4 qt_Vertex;
|
||||
attribute highp vec2 qt_MultiTexCoord0;
|
||||
|
||||
varying highp vec2 qt_TexCoord0;" +
|
||||
|
||||
(brightness_flickering !== 0.0 ?"
|
||||
varying lowp float brightness;" : "") +
|
||||
(horizontal_sincronization !== 0.0 ?"
|
||||
varying lowp float horizontal_distortion;" : "") +
|
||||
"
|
||||
void main() {
|
||||
qt_TexCoord0.x = -"+str(disp_left)+"/txt_Size.x + qt_MultiTexCoord0.x / ((txt_Size.x -("+str(disp_left+disp_right)+")) / txt_Size.x);" + "
|
||||
qt_TexCoord0.y = -"+str(disp_top)+"/txt_Size.y + qt_MultiTexCoord0.y / ((txt_Size.y -("+str(disp_top+disp_bottom)+")) / txt_Size.y);" + "
|
||||
vec2 coords = vec2(fract(time/(1024.0*2.0)), fract(time/(1024.0*1024.0)));" +
|
||||
(brightness_flickering !== 0.0 ? "
|
||||
brightness = 1.0 + (texture2D(randomFunctionSource, coords).g - 0.5) * "+str(brightness_flickering)+";"
|
||||
: "") +
|
||||
|
||||
(horizontal_sincronization !== 0.0 ? "
|
||||
float randval = 1.5 * texture2D(randomFunctionSource,(vec2(1.0) -coords) * 0.5).g;
|
||||
float negsinc = 1.0 - "+str(0.6*horizontal_sincronization)+";
|
||||
horizontal_distortion = step(negsinc, randval) * (randval - negsinc) * "+str(0.3*horizontal_sincronization)+";"
|
||||
: "") +
|
||||
|
||||
"gl_Position = qt_Matrix * qt_Vertex;
|
||||
}"
|
||||
|
||||
fragmentShader: "
|
||||
uniform sampler2D source;
|
||||
uniform highp float qt_Opacity;
|
||||
uniform highp float time;
|
||||
uniform highp vec2 txt_Size;
|
||||
varying highp vec2 qt_TexCoord0;
|
||||
|
||||
uniform highp vec4 font_color;
|
||||
uniform highp vec4 background_color;
|
||||
uniform highp sampler2D rasterizationSource;" +
|
||||
|
||||
(bloom !== 0 ? "
|
||||
uniform highp sampler2D bloomSource;" : "") +
|
||||
(noise_strength !== 0 ? "
|
||||
uniform highp float noise_strength;" : "") +
|
||||
(noise_strength !== 0 || jitter !== 0 ? "
|
||||
uniform lowp sampler2D noiseSource;" : "") +
|
||||
(screen_distorsion !== 0 ? "
|
||||
uniform highp float screen_distorsion;" : "")+
|
||||
(glowing_line_strength !== 0 ? "
|
||||
uniform highp float glowing_line_strength;" : "")+
|
||||
(brightness_flickering !== 0 ? "
|
||||
varying lowp float brightness;" : "") +
|
||||
(horizontal_sincronization !== 0 ? "
|
||||
varying lowp float horizontal_distortion;" : "") +
|
||||
|
||||
(glowing_line_strength !== 0 ? "
|
||||
float randomPass(vec2 coords){
|
||||
return fract(smoothstep(-0.2, 0.0, coords.y - 3.0 * fract(time * 0.0001))) * glowing_line_strength;
|
||||
}" : "") +
|
||||
|
||||
|
||||
"void main() {" +
|
||||
"vec2 cc = vec2(0.5) - qt_TexCoord0;" +
|
||||
"float distance = length(cc);" +
|
||||
|
||||
(noise_strength ? "
|
||||
float noise = noise_strength;" : "") +
|
||||
|
||||
(screen_distorsion !== 0 ? "
|
||||
float distortion = dot(cc, cc) * screen_distorsion;
|
||||
vec2 coords = (qt_TexCoord0 - cc * (1.0 + distortion) * distortion);"
|
||||
:"
|
||||
vec2 coords = qt_TexCoord0;") +
|
||||
|
||||
(frameReflections ? "
|
||||
vec2 inside = step(0.0, coords) - step(1.0, coords);
|
||||
coords = abs(mod(floor(coords), 2.0) - fract(coords)) * clamp(inside.x + inside.y, 0.0, 1.0);" : "") +
|
||||
|
||||
(horizontal_sincronization !== 0 ? "
|
||||
float h_distortion = 0.5 * sin(time*0.001 + coords.y*10.0*fract(time/10.0));
|
||||
h_distortion += 0.5 * cos(time*0.04 + 0.03 + coords.y*50.0*fract(time/10.0 + 0.4));
|
||||
coords.x = coords.x + h_distortion * horizontal_distortion;" +
|
||||
(noise_strength ? "
|
||||
noise += horizontal_distortion;" : "")
|
||||
: "") +
|
||||
|
||||
(jitter !== 0 ? "
|
||||
vec2 offset = vec2(texture2D(noiseSource, coords + fract(time / 57.0)).a,
|
||||
texture2D(noiseSource, coords + fract(time / 251.0)).a) - 0.5;
|
||||
vec2 txt_coords = coords + offset * "+str(jitter)+";"
|
||||
: "vec2 txt_coords = coords;") +
|
||||
|
||||
"float color = texture2D(source, txt_coords).a;" +
|
||||
|
||||
(noise_strength !== 0 ? "
|
||||
float noiseVal = texture2D(noiseSource, qt_TexCoord0 + vec2(fract(time / 51.0), fract(time / 237.0))).a;
|
||||
color += noiseVal * noise * (1.0 - distance * 1.3);" : "") +
|
||||
|
||||
(glowing_line_strength !== 0 ? "
|
||||
color += randomPass(coords) * glowing_line_strength;" : "") +
|
||||
|
||||
"vec3 finalColor = mix(background_color, font_color, color).rgb;" +
|
||||
"finalColor *= texture2D(rasterizationSource, coords).a;" +
|
||||
|
||||
(bloom !== 0 ? "
|
||||
finalColor += font_color.rgb * texture2D(bloomSource, coords).r *" + str(bloom) + ";" : "") +
|
||||
|
||||
(brightness_flickering !== 0 ? "
|
||||
finalColor *= brightness;" : "") +
|
||||
|
||||
"gl_FragColor = vec4(finalColor *"+str(brightness)+", qt_Opacity);
|
||||
}"
|
||||
|
||||
onStatusChanged: if (log) console.log(log) //Print warning messages
|
||||
}
|
||||
20
app/app.pro
Normal file
@@ -0,0 +1,20 @@
|
||||
QT += qml quick widgets
|
||||
TARGET = cool-retro-term
|
||||
|
||||
DESTDIR = $$OUT_PWD/../
|
||||
SOURCES = main.cpp
|
||||
|
||||
macx:ICON = icons/crt.icns
|
||||
|
||||
RESOURCES += qml/resources.qrc
|
||||
|
||||
#########################################
|
||||
## INTALLS
|
||||
#########################################
|
||||
|
||||
target.path += /usr/bin/
|
||||
|
||||
INSTALLS += target
|
||||
|
||||
HEADERS += \
|
||||
FileIO.h
|
||||
BIN
app/icons/crt.icns
Normal file
BIN
app/icons/crt128.png
Normal file
|
After Width: | Height: | Size: 32 KiB |
BIN
app/icons/crt256.png
Normal file
|
After Width: | Height: | Size: 62 KiB |
BIN
app/icons/crt32.png
Normal file
|
After Width: | Height: | Size: 8.4 KiB |
BIN
app/icons/crt64.png
Normal file
|
After Width: | Height: | Size: 19 KiB |
55
app/main.cpp
Normal file
@@ -0,0 +1,55 @@
|
||||
#include <QtQml/QQmlApplicationEngine>
|
||||
#include <QtGui/QGuiApplication>
|
||||
|
||||
#include <QQmlContext>
|
||||
#include <QStringList>
|
||||
|
||||
#include <QtWidgets/QApplication>
|
||||
|
||||
#include <QDebug>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <FileIO.h>
|
||||
|
||||
|
||||
QString getNamedArgument(QStringList args, QString name) {
|
||||
int index = args.indexOf(name);
|
||||
return (index != -1) ? args[index + 1] : QString("");
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
setenv("QT_QPA_PLATFORMTHEME", "", 1);
|
||||
QApplication app(argc, argv);
|
||||
QQmlApplicationEngine engine;
|
||||
|
||||
// Manage command line arguments from the cpp side
|
||||
QStringList args = app.arguments();
|
||||
if (args.contains("-h") || args.contains("--help")) {
|
||||
qDebug() << "Usage: " + args.at(0) + " [--default-settings] [--workdir <dir>] [--program <prog>] [-p|--profile <prof>] [--fullscreen] [-h|--help]";
|
||||
qDebug() << " --default-settings Run cool-retro-term with the default settings";
|
||||
qDebug() << " --workdir <dir> Change working directory to 'dir'";
|
||||
qDebug() << " --program <prog> Run the 'prog' in the new terminal.";
|
||||
qDebug() << " --fullscreen Run cool-retro-term in fullscreen.";
|
||||
qDebug() << " -p|--profile <prof> Run cool-retro-term with the given profile.";
|
||||
qDebug() << " -h|--help Print this help.";
|
||||
return 0;
|
||||
}
|
||||
|
||||
engine.rootContext()->setContextProperty("workdir", getNamedArgument(args, "--workdir"));
|
||||
engine.rootContext()->setContextProperty("shellProgram", getNamedArgument(args, "--program"));
|
||||
|
||||
// Used to read and write files
|
||||
FileIO fileIO;
|
||||
engine.rootContext()->setContextProperty("fileio", &fileIO);
|
||||
|
||||
// Manage import paths for Linux and OSX.
|
||||
QStringList importPathList = engine.importPathList();
|
||||
importPathList.prepend(QCoreApplication::applicationDirPath() + "/imports/");
|
||||
importPathList.prepend(QCoreApplication::applicationDirPath() + "/../PlugIns");
|
||||
engine.setImportPathList(importPathList);
|
||||
|
||||
engine.load(QUrl("qrc:/main.qml"));
|
||||
|
||||
return app.exec();
|
||||
}
|
||||
193
app/main.qml
@@ -1,193 +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 <http://www.gnu.org/licenses/>.
|
||||
*******************************************************************************/
|
||||
|
||||
import QtQuick 2.2
|
||||
import QtQuick.Window 2.1
|
||||
import QtQuick.Controls 1.1
|
||||
import QtGraphicalEffects 1.0
|
||||
|
||||
import org.kde.konsole 0.1
|
||||
|
||||
ApplicationWindow{
|
||||
id: terminalWindow
|
||||
|
||||
width: 1024
|
||||
height: 768
|
||||
minimumWidth: 320
|
||||
minimumHeight: 240
|
||||
|
||||
property bool fullscreen: shadersettings.fullscreen
|
||||
onFullscreenChanged: visibility = (fullscreen ? Window.FullScreen : Window.Windowed)
|
||||
|
||||
flags: Qt.WA_TranslucentBackground
|
||||
color: "#00000000"
|
||||
title: qsTr("cool-old-term")
|
||||
|
||||
Action {
|
||||
id: showMenubarAction
|
||||
text: qsTr("Show Menubar")
|
||||
checkable: true
|
||||
checked: shadersettings.showMenubar
|
||||
onTriggered: shadersettings.showMenubar = !shadersettings.showMenubar
|
||||
}
|
||||
Action {
|
||||
id: fullscreenAction
|
||||
text: qsTr("&Fullscreen")
|
||||
shortcut: "Alt+F11"
|
||||
onTriggered: shadersettings.fullscreen = !shadersettings.fullscreen;
|
||||
checkable: true
|
||||
checked: shadersettings.fullscreen
|
||||
}
|
||||
Action {
|
||||
id: quitAction
|
||||
text: qsTr("&Quit")
|
||||
shortcut: "Ctrl+Q"
|
||||
onTriggered: terminalWindow.close();
|
||||
}
|
||||
Action{
|
||||
id: showsettingsAction
|
||||
text: qsTr("&Settings")
|
||||
onTriggered: settingswindow.show();
|
||||
}
|
||||
Action{
|
||||
id: copyAction
|
||||
text: qsTr("&Copy")
|
||||
shortcut: "Ctrl+Shift+C"
|
||||
onTriggered: terminal.copyClipboard()
|
||||
}
|
||||
Action{
|
||||
id: pasteAction
|
||||
text: qsTr("&Paste")
|
||||
shortcut: "Ctrl+Shift+V"
|
||||
onTriggered: terminal.pasteClipboard()
|
||||
}
|
||||
Action{
|
||||
id: zoomIn
|
||||
text: qsTr("&Zoom In")
|
||||
shortcut: "Ctrl++"
|
||||
onTriggered: {
|
||||
var oldScaling = shadersettings.fontScalingIndexes[shadersettings.rasterization];
|
||||
var maxScalingIndex = shadersettings.fontScalingList.length - 1;
|
||||
shadersettings.setScalingIndex(Math.min(oldScaling + 1, maxScalingIndex));
|
||||
}
|
||||
}
|
||||
Action{
|
||||
id: zoomOut
|
||||
text: qsTr("&Zoom Out")
|
||||
shortcut: "Ctrl+-"
|
||||
onTriggered: {
|
||||
var oldScaling = shadersettings.fontScalingIndexes[shadersettings.rasterization];
|
||||
shadersettings.setScalingIndex(Math.max(oldScaling - 1, 0));
|
||||
}
|
||||
}
|
||||
Action{
|
||||
id: showAboutAction
|
||||
text: qsTr("About")
|
||||
onTriggered: {
|
||||
aboutDialog.show();
|
||||
}
|
||||
}
|
||||
|
||||
menuBar: MenuBar {
|
||||
id: menubar
|
||||
Menu {
|
||||
title: qsTr("File")
|
||||
visible: shadersettings.showMenubar
|
||||
MenuItem {action: quitAction}
|
||||
}
|
||||
Menu {
|
||||
title: qsTr("Edit")
|
||||
visible: shadersettings.showMenubar
|
||||
MenuItem {action: copyAction}
|
||||
MenuItem {action: pasteAction}
|
||||
MenuSeparator{}
|
||||
MenuItem {action: showsettingsAction}
|
||||
}
|
||||
Menu{
|
||||
title: qsTr("View")
|
||||
visible: shadersettings.showMenubar
|
||||
MenuItem {action: fullscreenAction}
|
||||
MenuItem {action: showMenubarAction}
|
||||
MenuSeparator{}
|
||||
MenuItem {action: zoomIn}
|
||||
MenuItem {action: zoomOut}
|
||||
}
|
||||
Menu{
|
||||
title: qsTr("Help")
|
||||
visible: shadersettings.showMenubar
|
||||
MenuItem {action: showAboutAction}
|
||||
}
|
||||
}
|
||||
ApplicationSettings{
|
||||
id: shadersettings
|
||||
}
|
||||
TimeManager{
|
||||
id: timeManager
|
||||
enableTimer: terminalWindow.visible
|
||||
}
|
||||
Item{
|
||||
id: maincontainer
|
||||
anchors.centerIn: parent
|
||||
width: parent.width * shadersettings.window_scaling
|
||||
height: parent.height * shadersettings.window_scaling
|
||||
scale: 1.0 / shadersettings.window_scaling
|
||||
smooth: false
|
||||
antialiasing: false
|
||||
opacity: shadersettings.windowOpacity * 0.3 + 0.7
|
||||
|
||||
Loader{
|
||||
id: frame
|
||||
anchors.fill: parent
|
||||
|
||||
property rect sourceRect: item.sourceRect
|
||||
|
||||
z: 2.1
|
||||
source: shadersettings.frame_source
|
||||
}
|
||||
PreprocessedTerminal{
|
||||
id: terminal
|
||||
anchors.fill: parent
|
||||
anchors.margins: 30
|
||||
}
|
||||
ShaderTerminal{
|
||||
id: shadercontainer
|
||||
anchors.fill: parent
|
||||
z: 1.9
|
||||
}
|
||||
}
|
||||
SettingsWindow{
|
||||
id: settingswindow
|
||||
visible: false
|
||||
}
|
||||
AboutDialog{
|
||||
id: aboutDialog
|
||||
visible: false
|
||||
}
|
||||
Loader{
|
||||
id: sizeoverlayloader
|
||||
z: 3
|
||||
anchors.centerIn: parent
|
||||
active: shadersettings.show_terminal_size
|
||||
sourceComponent: SizeOverlay{
|
||||
terminalSize: terminal.terminalSize
|
||||
}
|
||||
}
|
||||
Component.onCompleted: shadersettings.handleFontChanged();
|
||||
}
|
||||
@@ -15,7 +15,7 @@ Window{
|
||||
spacing: 15
|
||||
Text {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
text: "cool-old-term"
|
||||
text: "cool-retro-term"
|
||||
font {bold: true; pointSize: 18}
|
||||
}
|
||||
Loader{
|
||||
@@ -63,18 +63,24 @@ Window{
|
||||
id: defaultComponent
|
||||
ColumnLayout{
|
||||
anchors.fill: parent
|
||||
anchors.margins: 10
|
||||
spacing: 10
|
||||
Item{
|
||||
Layout.fillHeight: true
|
||||
Layout.fillWidth: true
|
||||
Image{
|
||||
anchors.fill: parent
|
||||
fillMode: Image.PreserveAspectFit
|
||||
source: "images/crt256.png"
|
||||
smooth: true
|
||||
}
|
||||
}
|
||||
Text{
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
text: shadersettings.version + "\n" +
|
||||
qsTr("Author: ") + "Filippo Scognamiglio\n" +
|
||||
qsTr("Email: ") + "flscogna@gmail.com\n" +
|
||||
qsTr("Source: ") + "https://github.com/Swordifish90/cool-old-term\n"
|
||||
qsTr("Email: ") + "flscogna@gmail.com\n" +
|
||||
qsTr("Source: ") + "https://github.com/Swordfish90/cool-retro-term\n"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -84,9 +90,9 @@ Window{
|
||||
anchors.fill: parent
|
||||
readOnly: true
|
||||
text: "Copyright (c) 2013 Filippo Scognamiglio <flscogna@gmail.com>\n\n" +
|
||||
"https://github.com/Swordifish90/cool-old-term\n\n" +
|
||||
"https://github.com/Swordfish90/cool-retro-term\n\n" +
|
||||
|
||||
"cool-old-term is free software: you can redistribute it and/or modify " +
|
||||
"cool-retro-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.\n\n" +
|
||||
@@ -1,10 +1,10 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2013 "Filippo Scognamiglio"
|
||||
* https://github.com/Swordifish90/cool-old-term
|
||||
* https://github.com/Swordfish90/cool-retro-term
|
||||
*
|
||||
* This file is part of cool-old-term.
|
||||
* This file is part of cool-retro-term.
|
||||
*
|
||||
* cool-old-term is free software: you can redistribute it and/or modify
|
||||
* cool-retro-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.
|
||||
@@ -59,8 +59,9 @@ Item{
|
||||
|
||||
property string _background_color: "#000000"
|
||||
property string _font_color: "#ff8100"
|
||||
property color font_color: mix(strToColor(_font_color), strToColor(_background_color), 0.7 + (contrast * 0.3))
|
||||
property color background_color: mix(strToColor(_background_color), strToColor(_font_color), 0.7 + (contrast * 0.3))
|
||||
property string saturated_color: mix(strToColor("#FFFFFF"), strToColor(_font_color), saturation_color * 0.5)
|
||||
property color font_color: mix(strToColor(saturated_color), strToColor(_background_color), 0.7 + (contrast * 0.3))
|
||||
property color background_color: mix(strToColor(_background_color), strToColor(saturated_color), 0.7 + (contrast * 0.3))
|
||||
|
||||
property real noise_strength: 0.1
|
||||
property real screen_distortion: 0.1
|
||||
@@ -68,17 +69,27 @@ Item{
|
||||
property real motion_blur: 0.40
|
||||
property real bloom_strength: 0.65
|
||||
|
||||
property real bloom_quality: 1.0
|
||||
|
||||
property real chroma_color: 0.0
|
||||
property real saturation_color: 0.0
|
||||
|
||||
property real jitter: 0.18
|
||||
|
||||
property real horizontal_sincronization: 0.08
|
||||
property real brightness_flickering: 0.1
|
||||
|
||||
property real rgb_shift: 0.0
|
||||
|
||||
readonly property int no_rasterization: 0
|
||||
readonly property int scanline_rasterization: 1
|
||||
readonly property int pixel_rasterization: 2
|
||||
|
||||
property int rasterization: no_rasterization
|
||||
|
||||
property int scanline_quality: 3
|
||||
onScanline_qualityChanged: handleFontChanged();
|
||||
|
||||
ListModel{
|
||||
id: framelist
|
||||
ListElement{text: "No frame"; source: "./frames/NoFrame.qml"; reflections: false}
|
||||
@@ -93,7 +104,7 @@ Item{
|
||||
|
||||
// FONTS //////////////////////////////////////////////////////////////////
|
||||
|
||||
signal terminalFontChanged(string fontSource, int pixelSize, int lineSpacing, size virtualCharSize)
|
||||
signal terminalFontChanged(string fontSource, int pixelSize, int lineSpacing, real screenScaling)
|
||||
|
||||
Loader{
|
||||
id: fontManager
|
||||
@@ -110,34 +121,36 @@ Item{
|
||||
onLoaded: handleFontChanged()
|
||||
}
|
||||
|
||||
signal fontScalingChanged
|
||||
property var fontScalingList: fontManager.item.fontScalingList
|
||||
property var fontScalingIndexes: [5,1,1]
|
||||
property real fontScaling: 1.0
|
||||
onFontScalingChanged: handleFontChanged();
|
||||
|
||||
function setScalingIndex(newScaling){
|
||||
fontScalingIndexes[rasterization] = newScaling;
|
||||
fontScalingChanged();
|
||||
function incrementScaling(){
|
||||
fontScaling = Math.min(fontScaling + 0.05, 2.50);
|
||||
handleFontChanged();
|
||||
}
|
||||
|
||||
function getScalingIndex(){
|
||||
return fontScalingIndexes[rasterization];
|
||||
function decrementScaling(){
|
||||
fontScaling = Math.max(fontScaling - 0.05, 0.50);
|
||||
handleFontChanged();
|
||||
}
|
||||
|
||||
property real fontWidth: 1.0
|
||||
onFontWidthChanged: handleFontChanged();
|
||||
|
||||
property var fontIndexes: [0,0,0]
|
||||
property var fontlist: fontManager.item.fontlist
|
||||
|
||||
function handleFontChanged(){
|
||||
if(!fontManager.item) return;
|
||||
fontManager.item.selectedFontIndex = fontIndexes[rasterization];
|
||||
fontManager.item.selectedScalingIndex = fontScalingIndexes[rasterization];
|
||||
fontManager.item.scaling = fontScaling * window_scaling;
|
||||
|
||||
var fontSource = fontManager.item.source;
|
||||
var pixelSize = fontManager.item.pixelSize;
|
||||
var lineSpacing = fontManager.item.lineSpacing;
|
||||
var virtualCharSize = fontManager.item.virtualCharSize;
|
||||
var screenScaling = fontManager.item.screenScaling;
|
||||
|
||||
terminalFontChanged(fontSource, pixelSize, lineSpacing, virtualCharSize);
|
||||
terminalFontChanged(fontSource, pixelSize, lineSpacing, screenScaling);
|
||||
}
|
||||
|
||||
// FRAMES /////////////////////////////////////////////////////////////////
|
||||
@@ -158,21 +171,25 @@ Item{
|
||||
fps: fps,
|
||||
window_scaling: window_scaling,
|
||||
show_terminal_size: show_terminal_size,
|
||||
fontScalingIndexes: fontScalingIndexes,
|
||||
fontScaling: fontScaling,
|
||||
fontIndexes: fontIndexes,
|
||||
frameReflections: _frameReflections,
|
||||
showMenubar: showMenubar
|
||||
showMenubar: showMenubar,
|
||||
scanline_quality: scanline_quality,
|
||||
bloom_quality: bloom_quality
|
||||
}
|
||||
return JSON.stringify(settings);
|
||||
}
|
||||
|
||||
function composeProfileString(){
|
||||
var settings = {
|
||||
function composeProfileObject(){
|
||||
var profile = {
|
||||
background_color: _background_color,
|
||||
font_color: _font_color,
|
||||
brightness_flickering: brightness_flickering,
|
||||
horizontal_sincronization: horizontal_sincronization,
|
||||
noise_strength: noise_strength,
|
||||
chroma_color: chroma_color,
|
||||
saturation_color: saturation_color,
|
||||
screen_distortion: screen_distortion,
|
||||
glowing_line_strength: glowing_line_strength,
|
||||
frames_index: frames_index,
|
||||
@@ -180,13 +197,19 @@ Item{
|
||||
bloom_strength: bloom_strength,
|
||||
rasterization: rasterization,
|
||||
jitter: jitter,
|
||||
rgb_shift: rgb_shift,
|
||||
brightness: brightness,
|
||||
contrast: contrast,
|
||||
ambient_light: ambient_light,
|
||||
windowOpacity: windowOpacity,
|
||||
fontIndex: fontIndexes[rasterization]
|
||||
fontIndex: fontIndexes[rasterization],
|
||||
fontWidth: fontWidth
|
||||
}
|
||||
return JSON.stringify(settings);
|
||||
return profile;
|
||||
}
|
||||
|
||||
function composeProfileString(){
|
||||
return JSON.stringify(composeProfileObject());
|
||||
}
|
||||
|
||||
function loadSettings(){
|
||||
@@ -222,11 +245,14 @@ Item{
|
||||
window_scaling = settings.window_scaling !== undefined ? settings.window_scaling : window_scaling
|
||||
|
||||
fontIndexes = settings.fontIndexes !== undefined ? settings.fontIndexes : fontIndexes
|
||||
fontScalingIndexes = settings.fontScalingIndexes !== undefined ? settings.fontScalingIndexes : fontScalingIndexes
|
||||
fontScaling = settings.fontScaling !== undefined ? settings.fontScaling : fontScaling
|
||||
|
||||
_frameReflections = settings.frameReflections !== undefined ? settings.frameReflections : _frameReflections;
|
||||
|
||||
showMenubar = settings.showMenubar !== undefined ? settings.showMenubar : showMenubar;
|
||||
|
||||
scanline_quality = settings.scanline_quality !== undefined ? settings.scanline_quality : scanline_quality;
|
||||
bloom_quality = settings.bloom_quality !== undefined ? settings.bloom_quality : bloom_quality;
|
||||
}
|
||||
|
||||
function loadProfileString(profileString){
|
||||
@@ -238,6 +264,8 @@ Item{
|
||||
horizontal_sincronization = settings.horizontal_sincronization !== undefined ? settings.horizontal_sincronization : horizontal_sincronization
|
||||
brightness_flickering = settings.brightness_flickering !== undefined ? settings.brightness_flickering : brightness_flickering;
|
||||
noise_strength = settings.noise_strength !== undefined ? settings.noise_strength : noise_strength;
|
||||
chroma_color = settings.chroma_color !== undefined ? settings.chroma_color : chroma_color;
|
||||
saturation_color = settings.saturation_color !== undefined ? settings.saturation_color : saturation_color;
|
||||
screen_distortion = settings.screen_distortion !== undefined ? settings.screen_distortion : screen_distortion;
|
||||
glowing_line_strength = settings.glowing_line_strength !== undefined ? settings.glowing_line_strength : glowing_line_strength;
|
||||
|
||||
@@ -250,12 +278,15 @@ Item{
|
||||
|
||||
jitter = settings.jitter !== undefined ? settings.jitter : jitter;
|
||||
|
||||
rgb_shift = settings.rgb_shift !== undefined ? settings.rgb_shift : rgb_shift;
|
||||
|
||||
ambient_light = settings.ambient_light !== undefined ? settings.ambient_light : ambient_light;
|
||||
contrast = settings.contrast !== undefined ? settings.contrast : contrast;
|
||||
brightness = settings.brightness !== undefined ? settings.brightness : brightness;
|
||||
windowOpacity = settings.windowOpacity !== undefined ? settings.windowOpacity : windowOpacity;
|
||||
|
||||
fontIndexes[rasterization] = settings.fontIndex !== undefined ? settings.fontIndex : fontIndexes[rasterization];
|
||||
fontWidth = settings.fontWidth !== undefined ? settings.fontWidth : fontWidth;
|
||||
}
|
||||
|
||||
function storeCustomProfiles(){
|
||||
@@ -307,49 +338,81 @@ Item{
|
||||
id: profileslist
|
||||
ListElement{
|
||||
text: "Default Amber"
|
||||
obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.65,"brightness":0.5,"brightness_flickering":0.1,"contrast":0.85,"fontIndex":0,"font_color":"#ff8100","frames_index":1,"glowing_line_strength":0.2,"horizontal_sincronization":0.08,"jitter":0.18,"motion_blur":0.4,"noise_strength":0.1,"rasterization":0,"screen_distortion":0.1,"windowOpacity":1}'
|
||||
obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.65,"brightness":0.5,"brightness_flickering":0.1,"contrast":0.85,"fontIndex":0,"font_color":"#ff8100","frames_index":1,"glowing_line_strength":0.2,"horizontal_sincronization":0.08,"jitter":0.18,"motion_blur":0.4,"noise_strength":0.1,"rasterization":0,"screen_distortion":0.1,"windowOpacity":1,"chroma_color":0,"saturation_color":0,"rgb_shift":0,"fontWidth":1.0}'
|
||||
builtin: true
|
||||
}
|
||||
ListElement{
|
||||
text: "Default Green"
|
||||
obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.4,"brightness":0.5,"brightness_flickering":0.1,"contrast":0.85,"fontIndex":0,"font_color":"#0ccc68","frames_index":1,"glowing_line_strength":0.2,"horizontal_sincronization":0.08,"jitter":0.18,"motion_blur":0.45,"noise_strength":0.1,"rasterization":0,"screen_distortion":0.1,"windowOpacity":1}'
|
||||
obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.4,"brightness":0.5,"brightness_flickering":0.1,"contrast":0.85,"fontIndex":0,"font_color":"#0ccc68","frames_index":1,"glowing_line_strength":0.2,"horizontal_sincronization":0.08,"jitter":0.18,"motion_blur":0.45,"noise_strength":0.1,"rasterization":0,"screen_distortion":0.1,"windowOpacity":1,"chroma_color":0,"saturation_color":0,"rgb_shift":0,"fontWidth":1.0}'
|
||||
builtin: true
|
||||
}
|
||||
ListElement{
|
||||
text: "Default Scanlines"
|
||||
obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.4,"brightness":0.5,"brightness_flickering":0.1,"contrast":0.85,"fontIndex":0,"font_color":"#00ff5b","frames_index":1,"glowing_line_strength":0.2,"horizontal_sincronization":0.07,"jitter":0.11,"motion_blur":0.4,"noise_strength":0.05,"rasterization":1,"screen_distortion":0.1,"windowOpacity":1}'
|
||||
obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.4,"brightness":0.5,"brightness_flickering":0.1,"contrast":0.85,"fontIndex":0,"font_color":"#00ff5b","frames_index":1,"glowing_line_strength":0.2,"horizontal_sincronization":0.07,"jitter":0.11,"motion_blur":0.4,"noise_strength":0.05,"rasterization":1,"screen_distortion":0.1,"windowOpacity":1,"chroma_color":0,"saturation_color":0,"rgb_shift":0,"fontWidth":1.0}'
|
||||
builtin: true
|
||||
}
|
||||
ListElement{
|
||||
text: "Default Pixelated"
|
||||
obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.4,"brightness":0.5,"brightness_flickering":0.1,"contrast":0.85,"fontIndex":0,"font_color":"#ff8100","frames_index":1,"glowing_line_strength":0.2,"horizontal_sincronization":0.1,"jitter":0,"motion_blur":0.45,"noise_strength":0.14,"rasterization":2,"screen_distortion":0.05,"windowOpacity":1}'
|
||||
obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.4,"brightness":0.5,"brightness_flickering":0.1,"contrast":0.85,"fontIndex":0,"font_color":"#ff8100","frames_index":1,"glowing_line_strength":0.2,"horizontal_sincronization":0.1,"jitter":0,"motion_blur":0.45,"noise_strength":0.14,"rasterization":2,"screen_distortion":0.05,"windowOpacity":1,"chroma_color":0,"saturation_color":0,"rgb_shift":0,"fontWidth":1.0}'
|
||||
builtin: true
|
||||
}
|
||||
ListElement{
|
||||
text: "Apple ]["
|
||||
obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.5,"brightness":0.5,"brightness_flickering":0.2,"contrast":0.85,"fontIndex":2,"font_color":"#2fff91","frames_index":1,"glowing_line_strength":0.22,"horizontal_sincronization":0.08,"jitter":0.1,"motion_blur":0.65,"noise_strength":0.08,"rasterization":1,"screen_distortion":0.18,"windowOpacity":1}'
|
||||
obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.5,"brightness":0.5,"brightness_flickering":0.2,"contrast":0.85,"fontIndex":2,"font_color":"#2fff91","frames_index":1,"glowing_line_strength":0.22,"horizontal_sincronization":0.08,"jitter":0.1,"motion_blur":0.65,"noise_strength":0.08,"rasterization":1,"screen_distortion":0.18,"windowOpacity":1,"chroma_color":0,"saturation_color":0,"rgb_shift":0,"fontWidth":1.0}'
|
||||
builtin: true
|
||||
}
|
||||
ListElement{
|
||||
text: "Vintage"
|
||||
obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.4,"brightness":0.5,"brightness_flickering":0.54,"contrast":0.85,"fontIndex":0,"font_color":"#00ff3e","frames_index":2,"glowing_line_strength":0.3,"horizontal_sincronization":0.2,"jitter":0.4,"motion_blur":0.75,"noise_strength":0.2,"rasterization":1,"screen_distortion":0.1,"windowOpacity":1}'
|
||||
obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.4,"brightness":0.5,"brightness_flickering":0.54,"contrast":0.85,"fontIndex":0,"font_color":"#00ff3e","frames_index":2,"glowing_line_strength":0.3,"horizontal_sincronization":0.2,"jitter":0.4,"motion_blur":0.75,"noise_strength":0.2,"rasterization":1,"screen_distortion":0.1,"windowOpacity":1,"chroma_color":0,"saturation_color":0,"rgb_shift":0,"fontWidth":1.0}'
|
||||
builtin: true
|
||||
}
|
||||
ListElement{
|
||||
text: "IBM Dos"
|
||||
obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.4,"brightness":0.5,"brightness_flickering":0.07,"contrast":0.85,"fontIndex":7,"font_color":"#ffffff","frames_index":1,"glowing_line_strength":0.13,"horizontal_sincronization":0,"jitter":0.08,"motion_blur":0.3,"noise_strength":0.03,"rasterization":0,"screen_distortion":0.1,"windowOpacity":1}'
|
||||
obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.4,"brightness":0.5,"brightness_flickering":0.07,"contrast":0.85,"fontIndex":7,"font_color":"#ffffff","frames_index":1,"glowing_line_strength":0.13,"horizontal_sincronization":0,"jitter":0.08,"motion_blur":0.3,"noise_strength":0.03,"rasterization":0,"screen_distortion":0.1,"windowOpacity":1,"chroma_color":1,"saturation_color":0,"rgb_shift":0.5,"fontWidth":1.0}'
|
||||
builtin: true
|
||||
}
|
||||
ListElement{
|
||||
text: "IBM 3278"
|
||||
obj_string: '{"ambient_light":0.1,"background_color":"#000000","bloom_strength":0.15,"brightness":0.5,"brightness_flickering":0,"contrast":0.95,"fontIndex":8,"font_color":"#0ccc68","frames_index":1,"glowing_line_strength":0,"horizontal_sincronization":0,"jitter":0,"motion_blur":0.6,"noise_strength":0,"rasterization":0,"screen_distortion":0.1,"windowOpacity":1,"chroma_color":0,"saturation_color":0,"rgb_shift":0,"fontWidth":1.0}'
|
||||
builtin: true
|
||||
}
|
||||
ListElement{
|
||||
text: "Transparent Green"
|
||||
obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.4549689440993788,"brightness":0.5,"brightness_flickering":0.20341614906832298,"contrast":0.85,"fontIndex":0,"font_color":"#0ccc68","frames_index":0,"glowing_line_strength":0.15993788819875776,"horizontal_sincronization":0.05045871559633028,"jitter":0.20341614906832298,"motion_blur":0.24999999999999997,"noise_strength":0.20031055900621117,"rasterization":0,"screen_distortion":0.05045871559633028,"windowOpacity":0.5956221198156681}'
|
||||
obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.4549689440993788,"brightness":0.5,"brightness_flickering":0.20341614906832298,"contrast":0.85,"fontIndex":0,"font_color":"#0ccc68","frames_index":0,"glowing_line_strength":0.15993788819875776,"horizontal_sincronization":0.05045871559633028,"jitter":0.20341614906832298,"motion_blur":0.24999999999999997,"noise_strength":0.20031055900621117,"rasterization":0,"screen_distortion":0.05045871559633028,"windowOpacity":0.5956221198156681,"chroma_color":0,"saturation_color":0,"rgb_shift":0,"fontWidth":1.0}'
|
||||
builtin: true
|
||||
}
|
||||
}
|
||||
|
||||
function getProfileIndexByName(name) {
|
||||
for (var i = 0; i < profileslist.count; i++) {
|
||||
if(profileslist.get(i).text === name)
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
loadSettings();
|
||||
// Manage the arguments from the QML side.
|
||||
var args = Qt.application.arguments;
|
||||
if (args.indexOf("--default-settings") === -1) {
|
||||
loadSettings();
|
||||
}
|
||||
|
||||
loadCustomProfiles();
|
||||
|
||||
var profileArgPosition = args.indexOf("--profile");
|
||||
if (profileArgPosition !== -1) {
|
||||
var profileIndex = getProfileIndexByName(args[profileArgPosition + 1]);
|
||||
if (profileIndex !== -1)
|
||||
loadProfile(profileIndex);
|
||||
else
|
||||
console.log("Warning: selected profile is not valid; ignoring it");
|
||||
}
|
||||
|
||||
if (args.indexOf("--fullscreen") !== -1) {
|
||||
fullscreen = true;
|
||||
showMenubar = false;
|
||||
}
|
||||
}
|
||||
Component.onDestruction: {
|
||||
storeSettings();
|
||||
51
app/qml/CRTMainMenuBar.qml
Normal file
@@ -0,0 +1,51 @@
|
||||
import QtQuick 2.2
|
||||
import QtQuick.Controls 1.1
|
||||
|
||||
MenuBar {
|
||||
id: defaultMenuBar
|
||||
property bool visible: true
|
||||
Menu {
|
||||
title: qsTr("File")
|
||||
visible: defaultMenuBar.visible
|
||||
MenuItem {action: quitAction}
|
||||
}
|
||||
Menu {
|
||||
title: qsTr("Edit")
|
||||
visible: defaultMenuBar.visible
|
||||
MenuItem {action: copyAction}
|
||||
MenuItem {action: pasteAction}
|
||||
MenuSeparator{visible: Qt.platform.os !== "osx"}
|
||||
MenuItem {action: showsettingsAction}
|
||||
}
|
||||
Menu{
|
||||
title: qsTr("View")
|
||||
visible: defaultMenuBar.visible
|
||||
MenuItem {action: fullscreenAction; visible: fullscreenAction.enabled}
|
||||
MenuItem {action: showMenubarAction; visible: showMenubarAction.enabled}
|
||||
MenuSeparator{visible: showMenubarAction.enabled}
|
||||
MenuItem {action: zoomIn}
|
||||
MenuItem {action: zoomOut}
|
||||
}
|
||||
Menu{
|
||||
id: profilesMenu
|
||||
title: qsTr("Profiles")
|
||||
visible: defaultMenuBar.visible
|
||||
Instantiator{
|
||||
model: shadersettings.profiles_list
|
||||
delegate: MenuItem {
|
||||
text: model.text
|
||||
onTriggered: {
|
||||
shadersettings.loadProfileString(obj_string);
|
||||
shadersettings.handleFontChanged();
|
||||
}
|
||||
}
|
||||
onObjectAdded: profilesMenu.insertItem(index, object)
|
||||
onObjectRemoved: profilesMenu.removeItem(object)
|
||||
}
|
||||
}
|
||||
Menu{
|
||||
title: qsTr("Help")
|
||||
visible: defaultMenuBar.visible
|
||||
MenuItem {action: showAboutAction}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2013 "Filippo Scognamiglio"
|
||||
* https://github.com/Swordifish90/cool-old-term
|
||||
* https://github.com/Swordfish90/cool-retro-term
|
||||
*
|
||||
* This file is part of cool-old-term.
|
||||
* This file is part of cool-retro-term.
|
||||
*
|
||||
* cool-old-term is free software: you can redistribute it and/or modify
|
||||
* cool-retro-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.
|
||||
@@ -23,30 +23,48 @@ import QtQuick.Controls 1.1
|
||||
import QtQuick.Layouts 1.1
|
||||
|
||||
RowLayout {
|
||||
property bool enabled: true
|
||||
property alias name: check.text
|
||||
property double value: (check.checked) ? _value : 0.0
|
||||
property alias _value: slider.value
|
||||
|
||||
property double value
|
||||
property alias min_value: slider.minimumValue
|
||||
property alias max_value: slider.maximumValue
|
||||
property alias stepSize: slider.stepSize
|
||||
|
||||
signal newValue(real newValue);
|
||||
|
||||
id: setting_component
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
spacing: 25
|
||||
|
||||
onValueChanged: {
|
||||
check.checked = !(value == 0);
|
||||
if(check.checked)
|
||||
slider.value = value;
|
||||
}
|
||||
|
||||
CheckBox{
|
||||
id: check
|
||||
implicitWidth: 150
|
||||
Component.onCompleted: checked = (_value !== 0);
|
||||
enabled: parent.enabled
|
||||
onClicked: {
|
||||
if(!checked){
|
||||
checked = false;
|
||||
slider.enabled = false;
|
||||
newValue(0);
|
||||
} else {
|
||||
checked = true;
|
||||
newValue(slider.value);
|
||||
slider.enabled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
Slider{
|
||||
id: slider
|
||||
stepSize: parent.stepSize
|
||||
Layout.fillWidth: true
|
||||
enabled: check.checked && parent.enabled
|
||||
onValueChanged: {
|
||||
newValue(value);
|
||||
}
|
||||
}
|
||||
Text{
|
||||
id: textfield
|
||||
@@ -1,10 +1,10 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2013 "Filippo Scognamiglio"
|
||||
* https://github.com/Swordifish90/cool-old-term
|
||||
* https://github.com/Swordfish90/cool-retro-term
|
||||
*
|
||||
* This file is part of cool-old-term.
|
||||
* This file is part of cool-retro-term.
|
||||
*
|
||||
* cool-old-term is free software: you can redistribute it and/or modify
|
||||
* cool-retro-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.
|
||||
@@ -1,10 +1,10 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2013 "Filippo Scognamiglio"
|
||||
* https://github.com/Swordifish90/cool-old-term
|
||||
* https://github.com/Swordfish90/cool-retro-term
|
||||
*
|
||||
* This file is part of cool-old-term.
|
||||
* This file is part of cool-retro-term.
|
||||
*
|
||||
* cool-old-term is free software: you can redistribute it and/or modify
|
||||
* cool-retro-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.
|
||||
@@ -22,16 +22,13 @@ import QtQuick 2.2
|
||||
|
||||
Item{
|
||||
property int selectedFontIndex
|
||||
property int selectedScalingIndex
|
||||
property real scaling
|
||||
property alias fontlist: fontlist
|
||||
property var _font: fontlist.get(selectedFontIndex)
|
||||
property var _scaling: fontScalingList[selectedScalingIndex]
|
||||
property var source: _font.source
|
||||
property var fontScalingList: [0.75, 1.0, 1.25, 1.50, 1.75, 2.0, 2.25, 2.5]
|
||||
property int pixelSize: _font.pixelSize * _scaling
|
||||
property int lineSpacing: (_font.pixelSize / _font.virtualCharHeight) * _font.lineSpacing
|
||||
property size virtualCharSize: Qt.size(_font.virtualCharWidth,
|
||||
_font.virtualCharHeight)
|
||||
property int pixelSize: _font.pixelSize
|
||||
property int lineSpacing: _font.lineSpacing
|
||||
property real screenScaling: scaling * _font.baseScaling
|
||||
|
||||
ListModel{
|
||||
id: fontlist
|
||||
@@ -39,33 +36,29 @@ Item{
|
||||
text: "Commodore PET (1977)"
|
||||
source: "fonts/1977-commodore-pet/COMMODORE_PET.ttf"
|
||||
lineSpacing: 2
|
||||
virtualCharWidth: 8
|
||||
virtualCharHeight: 8
|
||||
pixelSize: 32
|
||||
pixelSize: 8
|
||||
baseScaling: 4.0
|
||||
}
|
||||
ListElement{
|
||||
text: "Apple ][ (1977)"
|
||||
source: "fonts/1977-apple2/PrintChar21.ttf"
|
||||
lineSpacing: 2
|
||||
virtualCharWidth: 7
|
||||
virtualCharHeight: 8
|
||||
pixelSize: 32
|
||||
pixelSize: 8
|
||||
baseScaling: 4.0
|
||||
}
|
||||
ListElement{
|
||||
text: "Atari 400-800 (1979)"
|
||||
source: "fonts/1979-atari-400-800/ATARI400800_original.TTF"
|
||||
lineSpacing: 3
|
||||
virtualCharWidth: 8
|
||||
virtualCharHeight: 8
|
||||
pixelSize: 32
|
||||
pixelSize: 8
|
||||
baseScaling: 4.0
|
||||
}
|
||||
ListElement{
|
||||
text: "Commodore 64 (1982)"
|
||||
source: "fonts/1982-commodore64/C64_User_Mono_v1.0-STYLE.ttf"
|
||||
lineSpacing: 3
|
||||
virtualCharWidth: 8
|
||||
virtualCharHeight: 8
|
||||
pixelSize: 32
|
||||
pixelSize: 8
|
||||
baseScaling: 4.0
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2013 "Filippo Scognamiglio"
|
||||
* https://github.com/Swordifish90/cool-old-term
|
||||
* https://github.com/Swordfish90/cool-retro-term
|
||||
*
|
||||
* This file is part of cool-old-term.
|
||||
* This file is part of cool-retro-term.
|
||||
*
|
||||
* cool-old-term is free software: you can redistribute it and/or modify
|
||||
* cool-retro-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.
|
||||
@@ -22,58 +22,43 @@ import QtQuick 2.2
|
||||
|
||||
Item{
|
||||
property int selectedFontIndex
|
||||
property int selectedScalingIndex
|
||||
property real scaling
|
||||
property alias fontlist: fontlist
|
||||
property var _font: fontlist.get(selectedFontIndex)
|
||||
property var _scaling: fontScalingList[selectedScalingIndex]
|
||||
property var source: _font.source
|
||||
property var fontScalingList: [0.75, 1.0, 1.25, 1.50, 1.75, 2.0, 2.25, 2.50]
|
||||
property int pixelSize: _font.pixelSize * _scaling
|
||||
property int lineSpacing: (_font.pixelSize / _font.virtualCharHeight) * _font.lineSpacing
|
||||
property size virtualCharSize: Qt.size(_font.virtualCharWidth,
|
||||
_font.virtualCharHeight)
|
||||
property int pixelSize: _font.pixelSize
|
||||
property int lineSpacing: _font.lineSpacing
|
||||
property real screenScaling: scaling * _font.baseScaling
|
||||
|
||||
ListModel{
|
||||
id: fontlist
|
||||
ListElement{
|
||||
text: "Commodore PET 2Y (1977)"
|
||||
source: "fonts/1977-commodore-pet/COMMODORE_PET_2y.ttf"
|
||||
lineSpacing: 2
|
||||
virtualCharWidth: 4
|
||||
virtualCharHeight: 8
|
||||
pixelSize: 32
|
||||
}
|
||||
ListElement{
|
||||
text: "Commodore PET (1977)"
|
||||
source: "fonts/1977-commodore-pet/COMMODORE_PET.ttf"
|
||||
lineSpacing: 2
|
||||
virtualCharWidth: 8
|
||||
virtualCharHeight: 8
|
||||
pixelSize: 32
|
||||
pixelSize: 8
|
||||
baseScaling: 4.0
|
||||
}
|
||||
ListElement{
|
||||
text: "Apple ][ (1977)"
|
||||
source: "fonts/1977-apple2/PrintChar21.ttf"
|
||||
lineSpacing: 2
|
||||
virtualCharWidth: 8
|
||||
virtualCharHeight: 8
|
||||
pixelSize: 32
|
||||
pixelSize: 8
|
||||
baseScaling: 4.0
|
||||
}
|
||||
ListElement{
|
||||
text: "Atari 400-800 (1979)"
|
||||
source: "fonts/1979-atari-400-800/ATARI400800_original.TTF"
|
||||
lineSpacing: 3
|
||||
virtualCharWidth: 8
|
||||
virtualCharHeight: 8
|
||||
pixelSize: 32
|
||||
pixelSize: 8
|
||||
baseScaling: 4.0
|
||||
}
|
||||
ListElement{
|
||||
text: "Commodore 64 (1982)"
|
||||
source: "fonts/1982-commodore64/C64_User_Mono_v1.0-STYLE.ttf"
|
||||
lineSpacing: 3
|
||||
virtualCharWidth: 8
|
||||
virtualCharHeight: 8
|
||||
pixelSize: 32
|
||||
pixelSize: 8
|
||||
baseScaling: 4.0
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2013 "Filippo Scognamiglio"
|
||||
* https://github.com/Swordifish90/cool-old-term
|
||||
* https://github.com/Swordfish90/cool-retro-term
|
||||
*
|
||||
* This file is part of cool-old-term.
|
||||
* This file is part of cool-retro-term.
|
||||
*
|
||||
* cool-old-term is free software: you can redistribute it and/or modify
|
||||
* cool-retro-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.
|
||||
@@ -22,14 +22,13 @@ import QtQuick 2.2
|
||||
|
||||
Item{
|
||||
property int selectedFontIndex
|
||||
property int selectedScalingIndex
|
||||
property real scaling
|
||||
property alias fontlist: fontlist
|
||||
property var source: fontlist.get(selectedFontIndex).source
|
||||
property var _font: fontlist.get(selectedFontIndex)
|
||||
property var _scaling: fontScalingList[selectedScalingIndex]
|
||||
property var fontScalingList: [0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5]
|
||||
property int pixelSize: _font.pixelSize * _scaling
|
||||
property int pixelSize: _font.pixelSize * scaling
|
||||
property int lineSpacing: pixelSize * _font.lineSpacing
|
||||
property real screenScaling: 1.0
|
||||
|
||||
//In this configuration lineSpacing is proportional to pixelSize.
|
||||
|
||||
@@ -83,5 +82,11 @@ Item{
|
||||
lineSpacing: 0.2
|
||||
pixelSize: 32
|
||||
}
|
||||
ListElement{
|
||||
text: "IBM 3278 (1971)"
|
||||
source: "fonts/1971-ibm-3278/3270Medium.ttf"
|
||||
lineSpacing: 0.2
|
||||
pixelSize: 32
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2013 "Filippo Scognamiglio"
|
||||
* https://github.com/Swordifish90/cool-old-term
|
||||
* https://github.com/Swordfish90/cool-retro-term
|
||||
*
|
||||
* This file is part of cool-old-term.
|
||||
* This file is part of cool-retro-term.
|
||||
*
|
||||
* cool-old-term is free software: you can redistribute it and/or modify
|
||||
* cool-retro-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.
|
||||
@@ -22,16 +22,41 @@ import QtQuick 2.2
|
||||
import QtQuick.Window 2.0
|
||||
import QtQuick.Controls 1.1
|
||||
import QtQuick.Layouts 1.1
|
||||
import QtQuick.Dialogs 1.1
|
||||
|
||||
Window{
|
||||
id: insertnamedialog
|
||||
width: 400
|
||||
height: 100
|
||||
modality: Qt.ApplicationModal
|
||||
title: qsTr("Save current profile")
|
||||
title: qsTr("Save new profile")
|
||||
|
||||
signal nameSelected(string name)
|
||||
|
||||
MessageDialog {
|
||||
id: errorDialog
|
||||
title: qsTr("Error")
|
||||
visible: false
|
||||
|
||||
function showError(message){
|
||||
text = message;
|
||||
open();
|
||||
}
|
||||
}
|
||||
|
||||
function validateName(name){
|
||||
var profile_list = shadersettings.profiles_list;
|
||||
if (name === "")
|
||||
return 1;
|
||||
|
||||
for (var i = 0; i < profile_list.count; i++){
|
||||
if(profile_list.get(i).text === name)
|
||||
return 2;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
ColumnLayout{
|
||||
anchors.margins: 10
|
||||
anchors.fill: parent
|
||||
@@ -41,16 +66,29 @@ Window{
|
||||
id: namefield
|
||||
Layout.fillWidth: true
|
||||
Component.onCompleted: forceActiveFocus()
|
||||
onAccepted: okbutton.clickAction()
|
||||
}
|
||||
}
|
||||
RowLayout{
|
||||
anchors.right: parent.right
|
||||
anchors.bottom: parent.bottom
|
||||
Button{
|
||||
id: okbutton
|
||||
text: qsTr("OK")
|
||||
onClicked: {
|
||||
nameSelected(namefield.text);
|
||||
close();
|
||||
onClicked: clickAction()
|
||||
function clickAction(){
|
||||
var name = namefield.text;
|
||||
switch(validateName(name)){
|
||||
case 1:
|
||||
errorDialog.showError(qsTr("The name you inserted is empty. Please choose a different one."));
|
||||
break;
|
||||
case 2:
|
||||
errorDialog.showError(qsTr("The name you inserted already exists. Please choose a different one."));
|
||||
break;
|
||||
default:
|
||||
nameSelected(name);
|
||||
close();
|
||||
}
|
||||
}
|
||||
}
|
||||
Button{
|
||||
444
app/qml/PreprocessedTerminal.qml
Normal file
@@ -0,0 +1,444 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2013 "Filippo Scognamiglio"
|
||||
* https://github.com/Swordfish90/cool-retro-term
|
||||
*
|
||||
* This file is part of cool-retro-term.
|
||||
*
|
||||
* cool-retro-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 <http://www.gnu.org/licenses/>.
|
||||
*******************************************************************************/
|
||||
|
||||
import QtQuick 2.2
|
||||
import QtGraphicalEffects 1.0
|
||||
import QtQuick.Controls 1.1
|
||||
|
||||
import org.crt.konsole 0.1
|
||||
|
||||
Item{
|
||||
id: terminalContainer
|
||||
|
||||
//Frame displacement properties. This makes the terminal the same size of the texture.
|
||||
property real dtop: frame.item.displacementTop
|
||||
property real dleft:frame.item.displacementLeft
|
||||
property real dright: frame.item.displacementRight
|
||||
property real dbottom: frame.item.displacementBottom
|
||||
|
||||
anchors.leftMargin: dleft
|
||||
anchors.rightMargin: dright
|
||||
anchors.topMargin: dtop
|
||||
anchors.bottomMargin: dbottom
|
||||
|
||||
property variant theSource: mBlur !== 0 ? blurredSourceLoader.item : kterminalSource
|
||||
property variant bloomSource: bloomSourceLoader.item
|
||||
property variant rasterizationSource: rasterizationEffectSource
|
||||
property variant staticNoiseSource: staticNoiseSource
|
||||
|
||||
property alias kterminal: kterminal
|
||||
|
||||
signal sizeChanged
|
||||
onWidthChanged: sizeChanged()
|
||||
onHeightChanged: sizeChanged()
|
||||
|
||||
//The blur effect has to take into account the framerate
|
||||
property int fps: shadersettings.fps !== 0 ? shadersettings.fps : 60
|
||||
property real fpsAttenuation: Math.sqrt(60 / fps)
|
||||
property real mBlur: shadersettings.motion_blur
|
||||
property real motionBlurCoefficient: (_maxBlurCoefficient * mBlur + _minBlurCoefficient * (1 - mBlur))
|
||||
property real _minBlurCoefficient: 0.70
|
||||
property real _maxBlurCoefficient: 0.90
|
||||
|
||||
property real mBloom: shadersettings.bloom_strength
|
||||
property int mScanlines: shadersettings.rasterization
|
||||
onMScanlinesChanged: restartBlurredSource()
|
||||
|
||||
property size terminalSize: kterminal.terminalSize
|
||||
property size paintedTextSize
|
||||
|
||||
onMBlurChanged: restartBlurredSource()
|
||||
|
||||
function restartBlurredSource(){
|
||||
if(!blurredSourceLoader.item) return;
|
||||
blurredSourceLoader.item.restartBlurSource();
|
||||
}
|
||||
function pasteClipboard(){
|
||||
kterminal.pasteClipboard();
|
||||
}
|
||||
function copyClipboard(){
|
||||
kterminal.copyClipboard();
|
||||
}
|
||||
|
||||
//When settings are updated sources need to be redrawn.
|
||||
Connections{
|
||||
target: shadersettings
|
||||
onFontScalingChanged: terminalContainer.updateSources();
|
||||
onFontWidthChanged: terminalContainer.updateSources();
|
||||
}
|
||||
Connections{
|
||||
target: terminalContainer
|
||||
onWidthChanged: terminalContainer.updateSources();
|
||||
onHeightChanged: terminalContainer.updateSources();
|
||||
}
|
||||
function updateSources() {
|
||||
kterminal.update();
|
||||
kterminal.updateImage();
|
||||
}
|
||||
|
||||
|
||||
KTerminal {
|
||||
id: kterminal
|
||||
width: parent.width
|
||||
height: parent.height
|
||||
|
||||
colorScheme: "cool-retro-term"
|
||||
|
||||
smooth: false
|
||||
|
||||
session: KSession {
|
||||
id: ksession
|
||||
kbScheme: "xterm"
|
||||
|
||||
onFinished: {
|
||||
Qt.quit()
|
||||
}
|
||||
}
|
||||
|
||||
FontLoader{ id: fontLoader }
|
||||
Text{id: fontMetrics; text: "B"; visible: false}
|
||||
|
||||
function handleFontChange(fontSource, pixelSize, lineSpacing, screenScaling){
|
||||
fontLoader.source = fontSource;
|
||||
font.pixelSize = pixelSize;
|
||||
font.family = fontLoader.name;
|
||||
|
||||
var fontWidth = 1.0 / shadersettings.fontWidth;
|
||||
|
||||
width = Qt.binding(function() {return Math.floor(fontWidth * terminalContainer.width / screenScaling);});
|
||||
height = Qt.binding(function() {return Math.floor(terminalContainer.height / screenScaling);});
|
||||
|
||||
var scaleTexture = Math.max(Math.round(screenScaling / shadersettings.scanline_quality), 1.0);
|
||||
|
||||
kterminalSource.textureSize = Qt.binding(function () {
|
||||
return Qt.size(kterminal.width * scaleTexture, kterminal.height * scaleTexture);
|
||||
});
|
||||
|
||||
setLineSpacing(lineSpacing);
|
||||
update();
|
||||
restartBlurredSource();
|
||||
}
|
||||
Component.onCompleted: {
|
||||
shadersettings.terminalFontChanged.connect(handleFontChange);
|
||||
|
||||
// Retrieve the variable set in main.cpp if arguments are passed.
|
||||
if (shellProgram)
|
||||
ksession.setShellProgram(shellProgram);
|
||||
if (workdir)
|
||||
ksession.initialWorkingDirectory = workdir;
|
||||
|
||||
ksession.startShellProgram();
|
||||
forceActiveFocus();
|
||||
}
|
||||
}
|
||||
Menu{
|
||||
id: contextmenu
|
||||
MenuItem{action: copyAction}
|
||||
MenuItem{action: pasteAction}
|
||||
MenuSeparator{visible: Qt.platform.os !== "osx"}
|
||||
MenuItem{action: fullscreenAction; visible: Qt.platform.os !== "osx"}
|
||||
MenuItem{action: showMenubarAction; visible: Qt.platform.os !== "osx"}
|
||||
MenuSeparator{visible: !shadersettings.showMenubar}
|
||||
CRTMainMenuBar{visible: !shadersettings.showMenubar}
|
||||
}
|
||||
MouseArea{
|
||||
acceptedButtons: Qt.LeftButton | Qt.MiddleButton | Qt.RightButton
|
||||
// This is incredibly ugly. All this file should be reorganized.
|
||||
width: (parent.width + dleft + dright) / shadersettings.window_scaling - dleft -dright
|
||||
height: (parent.height + dtop + dbottom) / shadersettings.window_scaling - dtop - dbottom
|
||||
onWheel:{
|
||||
if(wheel.modifiers & Qt.ControlModifier){
|
||||
wheel.angleDelta.y > 0 ? zoomIn.trigger() : zoomOut.trigger();
|
||||
} else {
|
||||
var coord = correctDistortion(wheel.x, wheel.y);
|
||||
var lines = wheel.angleDelta.y > 0 ? -1 : 1;
|
||||
kterminal.scrollWheelEvent(coord, lines);
|
||||
}
|
||||
}
|
||||
onDoubleClicked: {
|
||||
var coord = correctDistortion(mouse.x, mouse.y);
|
||||
kterminal.mouseDoubleClickEvent(coord, mouse.button, mouse.modifiers);
|
||||
}
|
||||
onPressed: {
|
||||
if((!kterminal.usesMouse || mouse.modifiers & Qt.ShiftModifier) && mouse.button == Qt.RightButton) {
|
||||
contextmenu.popup();
|
||||
} else {
|
||||
var coord = correctDistortion(mouse.x, mouse.y);
|
||||
kterminal.mousePressEvent(coord, mouse.button, mouse.modifiers)
|
||||
}
|
||||
}
|
||||
onReleased: {
|
||||
var coord = correctDistortion(mouse.x, mouse.y);
|
||||
kterminal.mouseReleaseEvent(coord, mouse.button, mouse.modifiers);
|
||||
}
|
||||
onPositionChanged: {
|
||||
var coord = correctDistortion(mouse.x, mouse.y);
|
||||
kterminal.mouseMoveEvent(coord, mouse.button, mouse.buttons, mouse.modifiers);
|
||||
}
|
||||
|
||||
function correctDistortion(x, y){
|
||||
x = x / width;
|
||||
y = y / height;
|
||||
|
||||
var cc = Qt.size(0.5 - x, 0.5 - y);
|
||||
var distortion = (cc.height * cc.height + cc.width * cc.width) * shadersettings.screen_distortion;
|
||||
|
||||
return Qt.point((x - cc.width * (1+distortion) * distortion) * kterminal.width,
|
||||
(y - cc.height * (1+distortion) * distortion) * kterminal.height)
|
||||
}
|
||||
}
|
||||
ShaderEffectSource{
|
||||
id: kterminalSource
|
||||
sourceItem: kterminal
|
||||
hideSource: true
|
||||
wrapMode: ShaderEffectSource.ClampToEdge
|
||||
live: false
|
||||
|
||||
signal sourceUpdate
|
||||
|
||||
Connections{
|
||||
target: kterminal
|
||||
onUpdatedImage:{
|
||||
kterminalSource.scheduleUpdate();
|
||||
kterminalSource.sourceUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
Loader{
|
||||
id: blurredSourceLoader
|
||||
asynchronous: true
|
||||
active: mBlur !== 0
|
||||
|
||||
sourceComponent: ShaderEffectSource{
|
||||
id: _blurredSourceEffect
|
||||
sourceItem: blurredTerminalLoader.item
|
||||
recursive: true
|
||||
live: false
|
||||
hideSource: true
|
||||
wrapMode: kterminalSource.wrapMode
|
||||
|
||||
function restartBlurSource(){
|
||||
livetimer.restart();
|
||||
}
|
||||
|
||||
Timer{
|
||||
id: livetimer
|
||||
running: true
|
||||
onRunningChanged: {
|
||||
running ?
|
||||
timeBinding.target = timeManager :
|
||||
timeBinding.target = null
|
||||
}
|
||||
}
|
||||
Connections{
|
||||
id: timeBinding
|
||||
target: timeManager
|
||||
onTimeChanged: {
|
||||
_blurredSourceEffect.scheduleUpdate();
|
||||
}
|
||||
}
|
||||
Connections{
|
||||
target: kterminalSource
|
||||
onSourceUpdate:{
|
||||
livetimer.restart();
|
||||
}
|
||||
}
|
||||
Connections{
|
||||
target: shadersettings
|
||||
onScanline_qualityChanged: restartBlurredSource();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loader{
|
||||
id: blurredTerminalLoader
|
||||
width: kterminalSource.textureSize.width
|
||||
height: kterminalSource.textureSize.height
|
||||
active: mBlur !== 0
|
||||
asynchronous: true
|
||||
|
||||
sourceComponent: ShaderEffect {
|
||||
property variant txt_source: kterminalSource
|
||||
property variant blurredSource: blurredSourceLoader.item
|
||||
property real blurCoefficient: (1.0 - motionBlurCoefficient) * fpsAttenuation
|
||||
|
||||
blending: false
|
||||
|
||||
fragmentShader:
|
||||
"uniform lowp float qt_Opacity;" +
|
||||
"uniform lowp sampler2D txt_source;" +
|
||||
|
||||
"varying highp vec2 qt_TexCoord0;
|
||||
|
||||
uniform lowp sampler2D blurredSource;
|
||||
uniform highp float blurCoefficient;" +
|
||||
|
||||
"float rgb2grey(vec3 v){
|
||||
return dot(v, vec3(0.21, 0.72, 0.04));
|
||||
}" +
|
||||
|
||||
"void main() {" +
|
||||
"vec2 coords = qt_TexCoord0;" +
|
||||
"vec3 color = texture2D(txt_source, coords).rgb * 256.0;" +
|
||||
|
||||
"vec3 blur_color = texture2D(blurredSource, coords).rgb * 256.0;" +
|
||||
"blur_color = blur_color - blur_color * blurCoefficient;" +
|
||||
"color = step(vec3(1.0), color) * color + step(color, vec3(1.0)) * blur_color;" +
|
||||
|
||||
"gl_FragColor = vec4(floor(color) / 256.0, 1.0);" +
|
||||
"}"
|
||||
|
||||
onStatusChanged: if (log) console.log(log) //Print warning messages
|
||||
}
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// EFFECTS //////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// BLOOM ////////////////////////////////////////////////////////////////
|
||||
|
||||
Loader{
|
||||
property real scaling: shadersettings.bloom_quality * shadersettings.window_scaling
|
||||
id: bloomEffectLoader
|
||||
active: mBloom != 0
|
||||
asynchronous: true
|
||||
width: parent.width * scaling
|
||||
height: parent.height * scaling
|
||||
sourceComponent: FastBlur{
|
||||
radius: 48 * scaling
|
||||
source: kterminal
|
||||
transparentBorder: true
|
||||
}
|
||||
}
|
||||
Loader{
|
||||
id: bloomSourceLoader
|
||||
active: mBloom != 0
|
||||
asynchronous: true
|
||||
sourceComponent: ShaderEffectSource{
|
||||
id: _bloomEffectSource
|
||||
sourceItem: bloomEffectLoader.item
|
||||
hideSource: true
|
||||
live: false
|
||||
smooth: true
|
||||
Connections{
|
||||
target: kterminalSource
|
||||
onSourceUpdate: _bloomEffectSource.scheduleUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NOISE ////////////////////////////////////////////////////////////////
|
||||
|
||||
ShaderEffect {
|
||||
id: staticNoiseEffect
|
||||
anchors.fill: parent
|
||||
property real element_size: shadersettings.rasterization == shadersettings.no_rasterization ? 2 : 1
|
||||
property size virtual_resolution: Qt.size(kterminal.width / element_size, kterminal.height / element_size)
|
||||
|
||||
blending: false
|
||||
|
||||
fragmentShader:
|
||||
"uniform lowp float qt_Opacity;
|
||||
varying highp vec2 qt_TexCoord0;
|
||||
uniform highp vec2 virtual_resolution;" +
|
||||
|
||||
"highp float noise(vec2 co)
|
||||
{
|
||||
highp float a = 12.9898;
|
||||
highp float b = 78.233;
|
||||
highp float c = 43758.5453;
|
||||
highp float dt= dot(co.xy ,vec2(a,b));
|
||||
highp float sn= mod(dt,3.14);
|
||||
return fract(sin(sn) * c);
|
||||
}
|
||||
|
||||
vec2 sw(vec2 p) {return vec2( floor(p.x) , floor(p.y) );}
|
||||
vec2 se(vec2 p) {return vec2( ceil(p.x) , floor(p.y) );}
|
||||
vec2 nw(vec2 p) {return vec2( floor(p.x) , ceil(p.y) );}
|
||||
vec2 ne(vec2 p) {return vec2( ceil(p.x) , ceil(p.y) );}
|
||||
|
||||
float smoothNoise(vec2 p) {
|
||||
vec2 inter = smoothstep(0., 1., fract(p));
|
||||
float s = mix(noise(sw(p)), noise(se(p)), inter.x);
|
||||
float n = mix(noise(nw(p)), noise(ne(p)), inter.x);
|
||||
return mix(s, n, inter.y);
|
||||
}" +
|
||||
|
||||
"void main() {" +
|
||||
"gl_FragColor.a = smoothNoise(qt_TexCoord0 * virtual_resolution);" +
|
||||
"}"
|
||||
|
||||
onStatusChanged: if (log) console.log(log) //Print warning messages
|
||||
}
|
||||
ShaderEffectSource{
|
||||
id: staticNoiseSource
|
||||
sourceItem: staticNoiseEffect
|
||||
textureSize: Qt.size(parent.width, parent.height)
|
||||
wrapMode: ShaderEffectSource.Repeat
|
||||
smooth: true
|
||||
hideSource: true
|
||||
}
|
||||
|
||||
// RASTERIZATION //////////////////////////////////////////////////////////
|
||||
|
||||
ShaderEffect {
|
||||
id: rasterizationEffect
|
||||
width: parent.width
|
||||
height: parent.height
|
||||
property size virtual_resolution: Qt.size(kterminal.width, kterminal.height)
|
||||
|
||||
blending: false
|
||||
|
||||
fragmentShader:
|
||||
"uniform lowp float qt_Opacity;" +
|
||||
|
||||
"varying highp vec2 qt_TexCoord0;
|
||||
uniform highp vec2 virtual_resolution;
|
||||
|
||||
highp float getScanlineIntensity(vec2 coords) {
|
||||
highp float result = 1.0;" +
|
||||
|
||||
(mScanlines != shadersettings.no_rasterization ?
|
||||
"result *= abs(sin(coords.y * virtual_resolution.y * "+Math.PI+"));" : "") +
|
||||
(mScanlines == shadersettings.pixel_rasterization ?
|
||||
"result *= abs(sin(coords.x * virtual_resolution.x * "+Math.PI+"));" : "") + "
|
||||
|
||||
return result;
|
||||
}" +
|
||||
|
||||
"void main() {" +
|
||||
"highp float color = getScanlineIntensity(qt_TexCoord0);" +
|
||||
|
||||
"float distance = length(vec2(0.5) - qt_TexCoord0);" +
|
||||
"color = mix(color, 0.0, 1.2 * distance * distance);" +
|
||||
|
||||
"gl_FragColor.a = color;" +
|
||||
"}"
|
||||
|
||||
onStatusChanged: if (log) console.log(log) //Print warning messages
|
||||
}
|
||||
ShaderEffectSource{
|
||||
id: rasterizationEffectSource
|
||||
sourceItem: rasterizationEffect
|
||||
hideSource: true
|
||||
smooth: true
|
||||
wrapMode: ShaderEffectSource.Repeat
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2013 "Filippo Scognamiglio"
|
||||
* https://github.com/Swordifish90/cool-old-term
|
||||
* https://github.com/Swordfish90/cool-retro-term
|
||||
*
|
||||
* This file is part of cool-old-term.
|
||||
* This file is part of cool-retro-term.
|
||||
*
|
||||
* cool-old-term is free software: you can redistribute it and/or modify
|
||||
* cool-retro-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.
|
||||
@@ -30,49 +30,55 @@ Tab{
|
||||
anchors.fill: parent
|
||||
CheckableSlider{
|
||||
name: qsTr("Bloom")
|
||||
onValueChanged: shadersettings.bloom_strength = value
|
||||
_value: shadersettings.bloom_strength
|
||||
onNewValue: shadersettings.bloom_strength = newValue
|
||||
value: shadersettings.bloom_strength
|
||||
}
|
||||
CheckableSlider{
|
||||
name: qsTr("Motion Blur")
|
||||
onValueChanged: shadersettings.motion_blur = value
|
||||
_value: shadersettings.motion_blur
|
||||
onNewValue: shadersettings.motion_blur = newValue
|
||||
value: shadersettings.motion_blur
|
||||
}
|
||||
CheckableSlider{
|
||||
name: qsTr("Noise")
|
||||
onValueChanged: shadersettings.noise_strength = value
|
||||
_value: shadersettings.noise_strength
|
||||
onNewValue: shadersettings.noise_strength = newValue
|
||||
value: shadersettings.noise_strength
|
||||
}
|
||||
CheckableSlider{
|
||||
name: qsTr("Jitter")
|
||||
onValueChanged: shadersettings.jitter = value
|
||||
_value: shadersettings.jitter
|
||||
onNewValue: shadersettings.jitter = newValue
|
||||
value: shadersettings.jitter
|
||||
}
|
||||
CheckableSlider{
|
||||
name: qsTr("Glow")
|
||||
onValueChanged: shadersettings.glowing_line_strength = value;
|
||||
_value: shadersettings.glowing_line_strength
|
||||
onNewValue: shadersettings.glowing_line_strength = newValue;
|
||||
value: shadersettings.glowing_line_strength
|
||||
}
|
||||
CheckableSlider{
|
||||
name: qsTr("Screen distortion")
|
||||
onValueChanged: shadersettings.screen_distortion = value;
|
||||
_value: shadersettings.screen_distortion;
|
||||
onNewValue: shadersettings.screen_distortion = newValue;
|
||||
value: shadersettings.screen_distortion;
|
||||
}
|
||||
CheckableSlider{
|
||||
name: qsTr("Ambient light")
|
||||
onValueChanged: shadersettings.ambient_light = value;
|
||||
_value: shadersettings.ambient_light
|
||||
onNewValue: shadersettings.ambient_light = newValue;
|
||||
value: shadersettings.ambient_light
|
||||
enabled: shadersettings.frames_index !== 0
|
||||
}
|
||||
CheckableSlider{
|
||||
name: qsTr("Brightness flickering")
|
||||
onValueChanged: shadersettings.brightness_flickering= value;
|
||||
_value: shadersettings.brightness_flickering;
|
||||
onNewValue: shadersettings.brightness_flickering = newValue;
|
||||
value: shadersettings.brightness_flickering;
|
||||
}
|
||||
CheckableSlider{
|
||||
name: qsTr("Horizontal flickering")
|
||||
onValueChanged: shadersettings.horizontal_sincronization = value;
|
||||
_value: shadersettings.horizontal_sincronization;
|
||||
onNewValue: shadersettings.horizontal_sincronization = newValue;
|
||||
value: shadersettings.horizontal_sincronization;
|
||||
}
|
||||
CheckableSlider{
|
||||
name: qsTr("RGB shift")
|
||||
onNewValue: shadersettings.rgb_shift = newValue;
|
||||
value: shadersettings.rgb_shift;
|
||||
enabled: shadersettings.chroma_color !== 0
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2013 "Filippo Scognamiglio"
|
||||
* https://github.com/Swordifish90/cool-old-term
|
||||
* https://github.com/Swordfish90/cool-retro-term
|
||||
*
|
||||
* This file is part of cool-old-term.
|
||||
* This file is part of cool-retro-term.
|
||||
*
|
||||
* cool-old-term is free software: you can redistribute it and/or modify
|
||||
* cool-retro-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.
|
||||
@@ -21,6 +21,7 @@
|
||||
import QtQuick 2.2
|
||||
import QtQuick.Controls 1.1
|
||||
import QtQuick.Layouts 1.1
|
||||
import QtQuick.Dialogs 1.1
|
||||
|
||||
Tab{
|
||||
ColumnLayout{
|
||||
@@ -49,7 +50,7 @@ Tab{
|
||||
}
|
||||
Button{
|
||||
Layout.fillWidth: true
|
||||
text: qsTr("Store current")
|
||||
text: qsTr("Save New Profile")
|
||||
onClicked: insertname.show()
|
||||
}
|
||||
Button{
|
||||
@@ -62,10 +63,67 @@ Tab{
|
||||
}
|
||||
}
|
||||
}
|
||||
RowLayout{
|
||||
Layout.fillWidth: true
|
||||
Button{
|
||||
Layout.fillWidth: true
|
||||
text: qsTr("Import From File")
|
||||
onClicked: {
|
||||
fileDialog.selectExisting = true;
|
||||
fileDialog.callBack = function (url) {loadFile(url);};
|
||||
fileDialog.open();
|
||||
}
|
||||
|
||||
function loadFile(url) {
|
||||
console.log("Loading file: " + url);
|
||||
var profileStirng = fileio.read(url);
|
||||
shadersettings.loadProfileString(profileStirng);
|
||||
}
|
||||
}
|
||||
Button{
|
||||
Layout.fillWidth: true
|
||||
text: qsTr("Export To File")
|
||||
onClicked: {
|
||||
fileDialog.selectExisting = false;
|
||||
fileDialog.callBack = function (url) {storeFile(url);};
|
||||
fileDialog.open();
|
||||
}
|
||||
|
||||
function storeFile(url) {
|
||||
console.log("Storing file: " + url);
|
||||
var profileObject = shadersettings.composeProfileObject();
|
||||
fileio.write(url, JSON.stringify(profileObject, undefined, 2));
|
||||
}
|
||||
}
|
||||
}
|
||||
InsertNameDialog{
|
||||
id: insertname
|
||||
onNameSelected: shadersettings.addNewCustomProfile(name)
|
||||
}
|
||||
Loader {
|
||||
property var callBack
|
||||
property bool selectExisting: false
|
||||
id: fileDialog
|
||||
|
||||
sourceComponent: FileDialog{
|
||||
nameFilters: ["Json files (*.json)"]
|
||||
selectMultiple: false
|
||||
selectFolder: false
|
||||
selectExisting: fileDialog.selectExisting
|
||||
onAccepted: callBack(fileUrl);
|
||||
}
|
||||
|
||||
onSelectExistingChanged: reload()
|
||||
|
||||
function open() {
|
||||
item.open();
|
||||
}
|
||||
|
||||
function reload() {
|
||||
active = false;
|
||||
active = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
GroupBox{
|
||||
@@ -92,49 +150,17 @@ Tab{
|
||||
}
|
||||
}
|
||||
GroupBox{
|
||||
title: qsTr("Performace")
|
||||
title: qsTr("Frame")
|
||||
Layout.fillWidth: true
|
||||
Layout.columnSpan: 2
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
GridLayout{
|
||||
RowLayout{
|
||||
anchors.fill: parent
|
||||
rows: 3
|
||||
columns: 3
|
||||
CheckBox{
|
||||
Layout.columnSpan: 3
|
||||
checked: !shadersettings._frameReflections
|
||||
text: qsTr("Disable reflections")
|
||||
onCheckedChanged: shadersettings._frameReflections = !checked
|
||||
enabled: shadersettings.reflectionsAllowed
|
||||
}
|
||||
CheckBox{
|
||||
property int fps: checked ? slider.value : 0
|
||||
onFpsChanged: shadersettings.fps = fps
|
||||
checked: shadersettings.fps !== 0
|
||||
text: qsTr("Limit FPS")
|
||||
}
|
||||
Slider{
|
||||
id: slider
|
||||
ComboBox{
|
||||
id: framescombobox
|
||||
Layout.fillWidth: true
|
||||
stepSize: 1
|
||||
maximumValue: 60
|
||||
minimumValue: 1
|
||||
enabled: shadersettings.fps !== 0
|
||||
value: shadersettings.fps !== 0 ? shadersettings.fps : 60
|
||||
model: shadersettings.frames_list
|
||||
currentIndex: shadersettings.frames_index
|
||||
onCurrentIndexChanged: shadersettings.frames_index = currentIndex
|
||||
}
|
||||
Text{text: slider.value}
|
||||
Text{text: qsTr("Texture quality")}
|
||||
Slider{
|
||||
Layout.fillWidth: true
|
||||
id: txtslider
|
||||
onValueChanged: shadersettings.window_scaling = value;
|
||||
value: shadersettings.window_scaling
|
||||
tickmarksEnabled: true
|
||||
stepSize: 0.25
|
||||
Component.onCompleted: minimumValue = 0.5 //Without this value gets set to 0.5
|
||||
}
|
||||
Text{text: Math.round(txtslider.value * 100) + "%"}
|
||||
}
|
||||
}
|
||||
}
|
||||
159
app/qml/SettingsPerformanceTab.qml
Normal file
@@ -0,0 +1,159 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2013 "Filippo Scognamiglio"
|
||||
* https://github.com/Swordfish90/cool-retro-term
|
||||
*
|
||||
* This file is part of cool-retro-term.
|
||||
*
|
||||
* cool-retro-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 <http://www.gnu.org/licenses/>.
|
||||
*******************************************************************************/
|
||||
|
||||
import QtQuick 2.2
|
||||
import QtQuick.Controls 1.1
|
||||
import QtQuick.Layouts 1.1
|
||||
|
||||
Tab{
|
||||
ColumnLayout{
|
||||
anchors.fill: parent
|
||||
GroupBox{
|
||||
title: qsTr("General")
|
||||
Layout.fillWidth: true
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
GridLayout{
|
||||
anchors.fill: parent
|
||||
rows: 2
|
||||
columns: 3
|
||||
CheckBox{
|
||||
property int fps: checked ? slider.value : 0
|
||||
onFpsChanged: shadersettings.fps = fps
|
||||
checked: shadersettings.fps !== 0
|
||||
text: qsTr("Limit FPS")
|
||||
}
|
||||
Slider{
|
||||
id: slider
|
||||
Layout.fillWidth: true
|
||||
stepSize: 1
|
||||
maximumValue: 60
|
||||
minimumValue: 1
|
||||
enabled: shadersettings.fps !== 0
|
||||
value: shadersettings.fps !== 0 ? shadersettings.fps : 60
|
||||
}
|
||||
Text{text: slider.value}
|
||||
Text{text: qsTr("Texture Quality")}
|
||||
Slider{
|
||||
Layout.fillWidth: true
|
||||
id: txtslider
|
||||
onValueChanged: shadersettings.window_scaling = value;
|
||||
value: shadersettings.window_scaling
|
||||
stepSize: 0.10
|
||||
Component.onCompleted: minimumValue = 0.3 //Without this value gets set to 0.5
|
||||
}
|
||||
Text{text: Math.round(txtslider.value * 100) + "%"}
|
||||
}
|
||||
}
|
||||
GroupBox{
|
||||
title: qsTr("Rasterization")
|
||||
Layout.fillWidth: true
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
GridLayout{
|
||||
id: scanlineQualityContainer
|
||||
anchors.fill: parent
|
||||
columns: 3
|
||||
property alias valsIndex: scanlineQualitySlider.value
|
||||
property var vals: [4,3,2]
|
||||
property var valsStrings: [
|
||||
qsTr("Low"),
|
||||
qsTr("Medium"),
|
||||
qsTr("High")
|
||||
]
|
||||
|
||||
onValsIndexChanged: shadersettings.scanline_quality = vals[valsIndex];
|
||||
|
||||
Text{text: qsTr("Scanlines Quality")}
|
||||
Slider{
|
||||
id: scanlineQualitySlider
|
||||
Layout.fillWidth: true
|
||||
onValueChanged: parent.valsIndex = value;
|
||||
stepSize: 1
|
||||
Component.onCompleted: {
|
||||
minimumValue = 0;
|
||||
maximumValue = 2;
|
||||
value = parent.vals.indexOf(shadersettings.scanline_quality);
|
||||
}
|
||||
Connections{
|
||||
target: shadersettings
|
||||
onScanline_qualityChanged:
|
||||
scanlineQualityContainer.valsIndex = scanlineQualityContainer.vals.indexOf(shadersettings.scanline_quality);
|
||||
}
|
||||
}
|
||||
Text{
|
||||
text: parent.valsStrings[parent.valsIndex];
|
||||
}
|
||||
}
|
||||
}
|
||||
GroupBox{
|
||||
title: qsTr("Bloom")
|
||||
Layout.fillWidth: true
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
GridLayout{
|
||||
id: bloomQualityContainer
|
||||
anchors.fill: parent
|
||||
columns: 3
|
||||
property alias valsIndex: bloomQualitySlider.value
|
||||
property var vals: [0.25, 0.50, 1.00]
|
||||
property var valsStrings: [
|
||||
qsTr("Low"),
|
||||
qsTr("Medium"),
|
||||
qsTr("High")
|
||||
]
|
||||
|
||||
onValsIndexChanged: shadersettings.bloom_quality = vals[valsIndex];
|
||||
|
||||
Text{text: qsTr("Bloom Quality")}
|
||||
Slider{
|
||||
id: bloomQualitySlider
|
||||
Layout.fillWidth: true
|
||||
onValueChanged: parent.valsIndex = value;
|
||||
stepSize: 1
|
||||
Component.onCompleted: {
|
||||
minimumValue = 0;
|
||||
maximumValue = 2;
|
||||
value = parent.vals.indexOf(shadersettings.bloom_quality);
|
||||
}
|
||||
Connections{
|
||||
target: shadersettings
|
||||
onBloom_qualityChanged:
|
||||
bloomQualityContainer.valsIndex = bloomQualityContainer.vals.indexOf(shadersettings.bloom_quality);
|
||||
}
|
||||
}
|
||||
Text{
|
||||
text: parent.valsStrings[parent.valsIndex];
|
||||
}
|
||||
}
|
||||
}
|
||||
GroupBox{
|
||||
title: qsTr("Frame")
|
||||
Layout.fillWidth: true
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
CheckBox{
|
||||
checked: shadersettings._frameReflections
|
||||
text: qsTr("Frame Reflections")
|
||||
onCheckedChanged: shadersettings._frameReflections = checked
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2013 "Filippo Scognamiglio"
|
||||
* https://github.com/Swordifish90/cool-old-term
|
||||
* https://github.com/Swordfish90/cool-retro-term
|
||||
*
|
||||
* This file is part of cool-old-term.
|
||||
* This file is part of cool-retro-term.
|
||||
*
|
||||
* cool-old-term is free software: you can redistribute it and/or modify
|
||||
* cool-retro-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.
|
||||
@@ -35,11 +35,8 @@ Tab{
|
||||
model: [qsTr("Default"), qsTr("Scanlines"), qsTr("Pixels")]
|
||||
currentIndex: shadersettings.rasterization
|
||||
onCurrentIndexChanged: {
|
||||
scalingChanger.enabled = false;
|
||||
shadersettings.rasterization = currentIndex
|
||||
fontChanger.updateIndex();
|
||||
scalingChanger.updateIndex();
|
||||
scalingChanger.enabled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -67,24 +64,39 @@ Tab{
|
||||
RowLayout{
|
||||
Layout.fillWidth: true
|
||||
Slider{
|
||||
id: scalingChanger
|
||||
Layout.fillWidth: true
|
||||
minimumValue: 0
|
||||
maximumValue: shadersettings.fontScalingList.length - 1
|
||||
stepSize: 1
|
||||
tickmarksEnabled: true
|
||||
value: updateIndex()
|
||||
onValueChanged: {
|
||||
if(!enabled) return; //Ugly and hacky solution. Look for a better solution.
|
||||
shadersettings.setScalingIndex(value);
|
||||
id: fontScalingChanger
|
||||
onValueChanged: if(enabled) shadersettings.fontScaling = value
|
||||
stepSize: 0.05
|
||||
enabled: false // Another trick to fix initial bad behavior.
|
||||
Component.onCompleted: {
|
||||
minimumValue = 0.5;
|
||||
maximumValue = 2.5;
|
||||
value = shadersettings.fontScaling;
|
||||
enabled = true;
|
||||
}
|
||||
function updateIndex(){
|
||||
value = shadersettings.getScalingIndex();
|
||||
Connections{
|
||||
target: shadersettings
|
||||
onFontScalingChanged: fontScalingChanger.value = shadersettings.fontScaling;
|
||||
}
|
||||
Component.onCompleted: shadersettings.fontScalingChanged.connect(updateIndex);
|
||||
}
|
||||
Text{
|
||||
text: shadersettings.fontScalingList[scalingChanger.value].toFixed(2)
|
||||
text: Math.round(fontScalingChanger.value * 100) + "%"
|
||||
}
|
||||
}
|
||||
Text{ text: qsTr("Font Width") }
|
||||
RowLayout{
|
||||
Layout.fillWidth: true
|
||||
Slider{
|
||||
Layout.fillWidth: true
|
||||
id: widthChanger
|
||||
onValueChanged: shadersettings.fontWidth = value;
|
||||
value: shadersettings.fontWidth
|
||||
stepSize: 0.05
|
||||
Component.onCompleted: minimumValue = 0.5 //Without this value gets set to 0.5
|
||||
}
|
||||
Text{
|
||||
text: Math.round(widthChanger.value * 100) + "%"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -92,35 +104,38 @@ Tab{
|
||||
GroupBox{
|
||||
title: qsTr("Colors")
|
||||
Layout.fillWidth: true
|
||||
RowLayout{
|
||||
ColumnLayout{
|
||||
anchors.fill: parent
|
||||
ColorButton{
|
||||
name: qsTr("Font")
|
||||
height: 50
|
||||
RowLayout{
|
||||
Layout.fillWidth: true
|
||||
onColorSelected: shadersettings._font_color = color;
|
||||
button_color: shadersettings._font_color
|
||||
ColorButton{
|
||||
name: qsTr("Font")
|
||||
height: 50
|
||||
Layout.fillWidth: true
|
||||
onColorSelected: shadersettings._font_color = color;
|
||||
button_color: shadersettings._font_color
|
||||
}
|
||||
ColorButton{
|
||||
name: qsTr("Background")
|
||||
height: 50
|
||||
Layout.fillWidth: true
|
||||
onColorSelected: shadersettings._background_color = color;
|
||||
button_color: shadersettings._background_color
|
||||
}
|
||||
}
|
||||
ColorButton{
|
||||
name: qsTr("Background")
|
||||
height: 50
|
||||
ColumnLayout{
|
||||
Layout.fillWidth: true
|
||||
onColorSelected: shadersettings._background_color = color;
|
||||
button_color: shadersettings._background_color
|
||||
}
|
||||
}
|
||||
}
|
||||
GroupBox{
|
||||
title: qsTr("Frame")
|
||||
Layout.fillWidth: true
|
||||
RowLayout{
|
||||
anchors.fill: parent
|
||||
ComboBox{
|
||||
id: framescombobox
|
||||
Layout.fillWidth: true
|
||||
model: shadersettings.frames_list
|
||||
currentIndex: shadersettings.frames_index
|
||||
onCurrentIndexChanged: shadersettings.frames_index = currentIndex
|
||||
CheckableSlider{
|
||||
name: qsTr("Chroma Color")
|
||||
onNewValue: shadersettings.chroma_color = newValue
|
||||
value: shadersettings.chroma_color
|
||||
}
|
||||
CheckableSlider{
|
||||
name: qsTr("Saturation Color")
|
||||
onNewValue: shadersettings.saturation_color = newValue
|
||||
value: shadersettings.saturation_color
|
||||
enabled: shadersettings.chroma_color !== 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2013 "Filippo Scognamiglio"
|
||||
* https://github.com/Swordifish90/cool-old-term
|
||||
* https://github.com/Swordfish90/cool-retro-term
|
||||
*
|
||||
* This file is part of cool-old-term.
|
||||
* This file is part of cool-retro-term.
|
||||
*
|
||||
* cool-old-term is free software: you can redistribute it and/or modify
|
||||
* cool-retro-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.
|
||||
@@ -28,27 +28,37 @@ Window {
|
||||
id: settings_window
|
||||
title: qsTr("Settings")
|
||||
width: 640
|
||||
height: 450
|
||||
height: 440
|
||||
|
||||
property int tabmargins: 15
|
||||
|
||||
TabView{
|
||||
id: tabView
|
||||
anchors.fill: parent
|
||||
anchors.margins: 10
|
||||
SettingsGeneralTab{
|
||||
id: generalTab
|
||||
title: qsTr("General")
|
||||
anchors.fill: parent
|
||||
anchors.margins: tabmargins
|
||||
}
|
||||
SettingsTerminalTab{
|
||||
id: terminalTab
|
||||
title: qsTr("Terminal")
|
||||
anchors.fill: parent
|
||||
anchors.margins: tabmargins
|
||||
}
|
||||
SettingsEffectsTab{
|
||||
id: effectsTab
|
||||
title: qsTr("Effects")
|
||||
anchors.fill: parent
|
||||
anchors.margins: tabmargins
|
||||
}
|
||||
SettingsPerformanceTab{
|
||||
id: performanceTab
|
||||
title: qsTr("Performance")
|
||||
anchors.fill: parent
|
||||
anchors.margins: tabmargins
|
||||
}
|
||||
}
|
||||
}
|
||||
277
app/qml/ShaderTerminal.qml
Normal file
@@ -0,0 +1,277 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2013 "Filippo Scognamiglio"
|
||||
* https://github.com/Swordfish90/cool-retro-term
|
||||
*
|
||||
* This file is part of cool-retro-term.
|
||||
*
|
||||
* cool-retro-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 <http://www.gnu.org/licenses/>.
|
||||
*******************************************************************************/
|
||||
|
||||
import QtQuick 2.2
|
||||
import QtGraphicalEffects 1.0
|
||||
|
||||
|
||||
ShaderEffect {
|
||||
property color font_color: shadersettings.font_color
|
||||
property color background_color: shadersettings.background_color
|
||||
property variant source: terminal.theSource
|
||||
property variant bloomSource: terminal.bloomSource
|
||||
property variant rasterizationSource: terminal.rasterizationSource
|
||||
property variant noiseSource: terminal.staticNoiseSource
|
||||
property real bloom_strength: shadersettings.bloom_strength * 2.5
|
||||
|
||||
property real jitter: shadersettings.jitter * 0.007
|
||||
|
||||
property real noise_strength: shadersettings.noise_strength
|
||||
property real screen_distorsion: shadersettings.screen_distortion
|
||||
property real glowing_line_strength: shadersettings.glowing_line_strength
|
||||
|
||||
property real chroma_color: shadersettings.chroma_color;
|
||||
|
||||
property real rgb_shift: shadersettings.rgb_shift * 0.2
|
||||
|
||||
property real brightness_flickering: shadersettings.brightness_flickering
|
||||
property real horizontal_sincronization: shadersettings.horizontal_sincronization
|
||||
|
||||
property bool frameReflections: shadersettings.frameReflections
|
||||
|
||||
property real disp_top: (frame.item.displacementTop * shadersettings.window_scaling) / height
|
||||
property real disp_bottom: (frame.item.displacementBottom * shadersettings.window_scaling) / height
|
||||
property real disp_left: (frame.item.displacementLeft * shadersettings.window_scaling) / width
|
||||
property real disp_right: (frame.item.displacementRight * shadersettings.window_scaling) / width
|
||||
|
||||
property real screen_brightness: shadersettings.brightness * 1.5 + 0.5
|
||||
|
||||
property real time: timeManager.time
|
||||
property variant randomFunctionSource: randfuncsource
|
||||
|
||||
// If something goes wrong activate the fallback version of the shader.
|
||||
property bool fallBack: false
|
||||
|
||||
blending: false
|
||||
|
||||
//Smooth random texture used for flickering effect.
|
||||
Image{
|
||||
id: randtexture
|
||||
source: "frames/images/randfunction.png"
|
||||
width: 512
|
||||
height: 512
|
||||
sourceSize.width: 512
|
||||
sourceSize.height: 256
|
||||
fillMode: Image.TileVertically
|
||||
}
|
||||
ShaderEffectSource{
|
||||
id: randfuncsource
|
||||
sourceItem: randtexture
|
||||
live: false
|
||||
hideSource: true
|
||||
wrapMode: ShaderEffectSource.Repeat
|
||||
}
|
||||
|
||||
//Print the number with a reasonable precision for the shader.
|
||||
function str(num){
|
||||
return num.toFixed(8);
|
||||
}
|
||||
|
||||
vertexShader: "
|
||||
uniform highp mat4 qt_Matrix;
|
||||
uniform highp float time;
|
||||
|
||||
uniform highp float disp_left;
|
||||
uniform highp float disp_right;
|
||||
uniform highp float disp_top;
|
||||
uniform highp float disp_bottom;
|
||||
|
||||
attribute highp vec4 qt_Vertex;
|
||||
attribute highp vec2 qt_MultiTexCoord0;
|
||||
|
||||
varying highp vec2 qt_TexCoord0;" +
|
||||
|
||||
(!fallBack ? "
|
||||
uniform sampler2D randomFunctionSource;" : "") +
|
||||
|
||||
(!fallBack && brightness_flickering !== 0.0 ?"
|
||||
varying lowp float brightness;
|
||||
uniform lowp float brightness_flickering;" : "") +
|
||||
(!fallBack && horizontal_sincronization !== 0.0 ?"
|
||||
varying lowp float horizontal_distortion;
|
||||
uniform lowp float horizontal_sincronization;" : "") +
|
||||
"
|
||||
void main() {
|
||||
qt_TexCoord0.x = (qt_MultiTexCoord0.x - disp_left) / (1.0 - disp_left - disp_right);
|
||||
qt_TexCoord0.y = (qt_MultiTexCoord0.y - disp_top) / (1.0 - disp_top - disp_bottom);
|
||||
vec2 coords = vec2(fract(time/(1024.0*2.0)), fract(time/(1024.0*1024.0)));" +
|
||||
(!fallBack && brightness_flickering !== 0.0 ? "
|
||||
brightness = 1.0 + (texture2D(randomFunctionSource, coords).g - 0.5) * brightness_flickering;"
|
||||
: "") +
|
||||
|
||||
(!fallBack && horizontal_sincronization !== 0.0 ? "
|
||||
float randval = 1.5 * texture2D(randomFunctionSource,(vec2(1.0) -coords) * 0.5).g;
|
||||
float negsinc = 1.0 - 0.6 * horizontal_sincronization;" + "
|
||||
horizontal_distortion = step(negsinc, randval) * (randval - negsinc) * 0.3*horizontal_sincronization;"
|
||||
: "") +
|
||||
|
||||
"gl_Position = qt_Matrix * qt_Vertex;
|
||||
}"
|
||||
|
||||
fragmentShader: "
|
||||
uniform sampler2D source;
|
||||
uniform highp float qt_Opacity;
|
||||
uniform highp float time;
|
||||
varying highp vec2 qt_TexCoord0;
|
||||
|
||||
uniform highp vec4 font_color;
|
||||
uniform highp vec4 background_color;
|
||||
uniform highp sampler2D rasterizationSource;
|
||||
uniform lowp float screen_brightness;" +
|
||||
|
||||
(bloom_strength !== 0 ? "
|
||||
uniform highp sampler2D bloomSource;
|
||||
uniform lowp float bloom_strength;" : "") +
|
||||
(noise_strength !== 0 ? "
|
||||
uniform highp float noise_strength;" : "") +
|
||||
(noise_strength !== 0 || jitter !== 0 || rgb_shift ? "
|
||||
uniform lowp sampler2D noiseSource;" : "") +
|
||||
(screen_distorsion !== 0 ? "
|
||||
uniform highp float screen_distorsion;" : "") +
|
||||
(glowing_line_strength !== 0 ? "
|
||||
uniform highp float glowing_line_strength;" : "") +
|
||||
(chroma_color !== 0 ? "
|
||||
uniform lowp float chroma_color;" : "") +
|
||||
(jitter !== 0 ? "
|
||||
uniform lowp float jitter;" : "") +
|
||||
(rgb_shift !== 0 ? "
|
||||
uniform lowp float rgb_shift;" : "") +
|
||||
|
||||
(fallBack && (brightness_flickering || horizontal_sincronization) ? "
|
||||
uniform lowp sampler2D randomFunctionSource;" : "") +
|
||||
(fallBack && horizontal_sincronization !== 0 ? "
|
||||
uniform lowp float horizontal_sincronization;" : "") +
|
||||
(fallBack && brightness_flickering !== 0.0 ?"
|
||||
uniform lowp float brightness_flickering;" : "") +
|
||||
(!fallBack && brightness_flickering !== 0 ? "
|
||||
varying lowp float brightness;" : "") +
|
||||
(!fallBack && horizontal_sincronization !== 0 ? "
|
||||
varying lowp float horizontal_distortion;" : "") +
|
||||
|
||||
(glowing_line_strength !== 0 ? "
|
||||
float randomPass(vec2 coords){
|
||||
return fract(smoothstep(-0.2, 0.0, coords.y - 3.0 * fract(time * 0.0001))) * glowing_line_strength;
|
||||
}" : "") +
|
||||
|
||||
"float rgb2grey(vec3 v){
|
||||
return dot(v, vec3(0.21, 0.72, 0.04));
|
||||
}" +
|
||||
|
||||
"void main() {" +
|
||||
"vec2 cc = vec2(0.5) - qt_TexCoord0;" +
|
||||
"float distance = length(cc);" +
|
||||
|
||||
//FallBack if there are problem
|
||||
(fallBack && (brightness_flickering || horizontal_sincronization) ? "
|
||||
vec2 randCoords = vec2(fract(time/(1024.0*2.0)), fract(time/(1024.0*1024.0)));" : "") +
|
||||
|
||||
(fallBack && brightness_flickering !== 0.0 ? "
|
||||
float brightness = 1.0 + (texture2D(randomFunctionSource, randCoords).g - 0.5) * brightness_flickering;"
|
||||
: "") +
|
||||
|
||||
(fallBack && horizontal_sincronization !== 0.0 ? "
|
||||
float randval = 1.5 * texture2D(randomFunctionSource,(vec2(1.0) - randCoords) * 0.5).g;
|
||||
float negsinc = 1.0 - 0.6 * horizontal_sincronization;" + "
|
||||
float horizontal_distortion = step(negsinc, randval) * (randval - negsinc) * 0.3*horizontal_sincronization;"
|
||||
: "") +
|
||||
|
||||
(noise_strength ? "
|
||||
float noise = noise_strength;" : "") +
|
||||
|
||||
(screen_distorsion !== 0 ? "
|
||||
float distortion = dot(cc, cc) * screen_distorsion;
|
||||
vec2 coords = (qt_TexCoord0 - cc * (1.0 + distortion) * distortion);"
|
||||
:"
|
||||
vec2 coords = qt_TexCoord0;") +
|
||||
|
||||
(horizontal_sincronization !== 0 ? "
|
||||
float h_distortion = 0.5 * sin(time*0.001 + coords.y*10.0*fract(time/10.0));
|
||||
h_distortion += 0.5 * cos(time*0.04 + 0.03 + coords.y*50.0*fract(time/10.0 + 0.4));
|
||||
coords.x = coords.x + h_distortion * horizontal_distortion;" +
|
||||
(noise_strength ? "
|
||||
noise += horizontal_distortion;" : "")
|
||||
: "") +
|
||||
|
||||
(jitter !== 0 ? "
|
||||
vec2 offset = vec2(texture2D(noiseSource, coords + fract(time / 57.0)).a,
|
||||
texture2D(noiseSource, coords + fract(time / 251.0)).a) - 0.5;
|
||||
vec2 txt_coords = coords + offset * jitter;"
|
||||
: "vec2 txt_coords = coords;") +
|
||||
|
||||
"float color = 0.0;" +
|
||||
|
||||
(noise_strength !== 0 ? "
|
||||
float noiseVal = texture2D(noiseSource, qt_TexCoord0 + vec2(fract(time / 51.0), fract(time / 237.0))).a;
|
||||
color += noiseVal * noise * (1.0 - distance * 1.3);" : "") +
|
||||
|
||||
(glowing_line_strength !== 0 ? "
|
||||
color += randomPass(coords) * glowing_line_strength;" : "") +
|
||||
|
||||
|
||||
"vec3 txt_color = texture2D(source, txt_coords).rgb;
|
||||
float greyscale_color = rgb2grey(txt_color) + color;" +
|
||||
|
||||
(chroma_color !== 0 ?
|
||||
(rgb_shift !== 0 ? "
|
||||
float rgb_noise = abs(texture2D(noiseSource, vec2(fract(time/(1024.0 * 256.0)), fract(time/(1024.0*1024.0)))).a - 0.5);
|
||||
float rcolor = texture2D(source, txt_coords + vec2(0.1, 0.0) * rgb_shift * rgb_noise).r;
|
||||
float bcolor = texture2D(source, txt_coords - vec2(0.1, 0.0) * rgb_shift * rgb_noise).b;
|
||||
txt_color.r = rcolor;
|
||||
txt_color.b = bcolor;
|
||||
greyscale_color = 0.33 * (rcolor + bcolor);" : "") +
|
||||
|
||||
"vec3 mixedColor = mix(font_color.rgb, txt_color * font_color.rgb, chroma_color);
|
||||
vec3 finalBackColor = mix(background_color.rgb, mixedColor, greyscale_color);
|
||||
vec3 finalColor = mix(finalBackColor, font_color.rgb, color).rgb;"
|
||||
:
|
||||
"vec3 finalColor = mix(background_color.rgb, font_color.rgb, greyscale_color);") +
|
||||
|
||||
"finalColor *= texture2D(rasterizationSource, coords).a;" +
|
||||
|
||||
(bloom_strength !== 0 ?
|
||||
"vec4 bloomFullColor = texture2D(bloomSource, coords);
|
||||
vec3 bloomColor = bloomFullColor.rgb;
|
||||
vec2 minBound = step(vec2(0.0), coords);
|
||||
vec2 maxBound = step(coords, vec2(1.0));
|
||||
float bloomAlpha = bloomFullColor.a * minBound.x * minBound.y * maxBound.x * maxBound.y;" +
|
||||
(chroma_color !== 0 ?
|
||||
"bloomColor = font_color.rgb * mix(vec3(rgb2grey(bloomColor)), bloomColor, chroma_color);"
|
||||
:
|
||||
"bloomColor = font_color.rgb * rgb2grey(bloomColor);") +
|
||||
"finalColor += bloomColor * bloom_strength * bloomAlpha;"
|
||||
: "") +
|
||||
|
||||
(brightness_flickering !== 0 ? "
|
||||
finalColor *= brightness;" : "") +
|
||||
|
||||
"gl_FragColor = vec4(finalColor * screen_brightness, qt_Opacity);" +
|
||||
"}"
|
||||
|
||||
onStatusChanged: {
|
||||
// Print warning messages
|
||||
if (log)
|
||||
console.log(log);
|
||||
|
||||
// Activate fallback mode
|
||||
if (status == ShaderEffect.Error) {
|
||||
fallBack = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2013 "Filippo Scognamiglio"
|
||||
* https://github.com/Swordifish90/cool-old-term
|
||||
* https://github.com/Swordfish90/cool-retro-term
|
||||
*
|
||||
* This file is part of cool-old-term.
|
||||
* This file is part of cool-retro-term.
|
||||
*
|
||||
* cool-old-term is free software: you can redistribute it and/or modify
|
||||
* cool-retro-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.
|
||||
@@ -1,10 +1,10 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2013 "Filippo Scognamiglio"
|
||||
* https://github.com/Swordifish90/cool-old-term
|
||||
* https://github.com/Swordfish90/cool-retro-term
|
||||
*
|
||||
* This file is part of cool-old-term.
|
||||
* This file is part of cool-retro-term.
|
||||
*
|
||||
* cool-old-term is free software: you can redistribute it and/or modify
|
||||
* cool-retro-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.
|
||||
@@ -1,10 +1,10 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2013 "Filippo Scognamiglio"
|
||||
* https://github.com/Swordifish90/cool-old-term
|
||||
* https://github.com/Swordfish90/cool-retro-term
|
||||
*
|
||||
* This file is part of cool-old-term.
|
||||
* This file is part of cool-retro-term.
|
||||
*
|
||||
* cool-old-term is free software: you can redistribute it and/or modify
|
||||
* cool-retro-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.
|
||||
55
app/qml/TerminalContainer.qml
Normal file
@@ -0,0 +1,55 @@
|
||||
import QtQuick 2.2
|
||||
|
||||
Item{
|
||||
Item{
|
||||
id: scalableContent
|
||||
width: parent.width * shadersettings.window_scaling
|
||||
height: parent.height * shadersettings.window_scaling
|
||||
|
||||
Loader{
|
||||
id: frame
|
||||
anchors.fill: parent
|
||||
z: 2.1
|
||||
source: shadersettings.frame_source
|
||||
}
|
||||
PreprocessedTerminal{
|
||||
id: terminal
|
||||
anchors.fill: parent
|
||||
}
|
||||
ShaderTerminal{
|
||||
id: shadercontainer
|
||||
anchors.fill: parent
|
||||
opacity: shadersettings.windowOpacity * 0.3 + 0.7
|
||||
z: 1.9
|
||||
}
|
||||
}
|
||||
|
||||
// This is used to render the texture to a lower resolution then scale it up.
|
||||
Loader{
|
||||
id: scalableContentSource
|
||||
active: shadersettings.window_scaling < 1
|
||||
sourceComponent: ShaderEffectSource{
|
||||
sourceItem: scalableContent
|
||||
hideSource: true
|
||||
smooth: true
|
||||
}
|
||||
}
|
||||
Loader{
|
||||
active: shadersettings.window_scaling < 1
|
||||
anchors.fill: parent
|
||||
sourceComponent: ShaderEffect{
|
||||
property var source: scalableContentSource.item
|
||||
}
|
||||
}
|
||||
|
||||
// Terminal size overlay. Shown when terminal size changes.
|
||||
Loader{
|
||||
id: sizeoverlayloader
|
||||
z: 3
|
||||
anchors.centerIn: parent
|
||||
active: shadersettings.show_terminal_size
|
||||
sourceComponent: SizeOverlay{
|
||||
terminalSize: terminal.terminalSize
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2013 "Filippo Scognamiglio"
|
||||
* https://github.com/Swordifish90/cool-old-term
|
||||
* https://github.com/Swordfish90/cool-retro-term
|
||||
*
|
||||
* This file is part of cool-old-term.
|
||||
* This file is part of cool-retro-term.
|
||||
*
|
||||
* cool-old-term is free software: you can redistribute it and/or modify
|
||||
* cool-retro-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.
|
||||
BIN
app/qml/fonts/1971-ibm-3278/3270Medium.ttf
Normal file
13
app/qml/fonts/1971-ibm-3278/LICENSE.txt
Normal file
@@ -0,0 +1,13 @@
|
||||
Copyright (c) 2011-2012, Ricardo Banffy.
|
||||
Copyright (c) 1993-2011, Paul Mattes.
|
||||
Copyright (c) 2004-2005, Don Russell.
|
||||
Copyright (c) 2004, Dick Altenbern.
|
||||
Copyright (c) 1990, Jeff Sparkes.
|
||||
Copyright (c) 1989, Georgia Tech Research Corporation (GTRC), Atlanta, GA 30332.
|
||||
All rights reserved.
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
|
||||
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
Neither the names of Ricardo Banffy, Paul Mattes, Don Russell, Dick Altenbern, Jeff Sparkes, GTRC nor the names of their contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
THIS SOFTWARE IS PROVIDED BY PAUL MATTES, DON RUSSELL, DICK ALTENBERN, JEFF SPARKES AND GTRC "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL PAUL MATTES, DON RUSSELL, DICK ALTENBERN, JEFF SPARKES OR GTRC BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
73
app/qml/fonts/1971-ibm-3278/README.md
Normal file
@@ -0,0 +1,73 @@
|
||||
3270font: A font for the nostalgic
|
||||
==================================
|
||||
https://github.com/rbanffy/3270font
|
||||
|
||||

|
||||
|
||||
A little bit of history
|
||||
-----------------------
|
||||
|
||||
This font is derived from the x3270 font, which, in turn, was translated
|
||||
from the one in Georgia Tech's 3270tool, which was itself hand-copied
|
||||
from a 3270 terminal. I built it because I felt terminals deserve to be
|
||||
pretty. The .sfd font file contains a x3270 bitmap font that was used
|
||||
for guidance.
|
||||
|
||||
![Using with the Cathode terminal program]
|
||||
(https://raw.github.com/wiki/rbanffy/3270font/cathode.png)
|
||||
|
||||
The format
|
||||
----------
|
||||
|
||||
This font was built with FontForge. You'll need it if you want to
|
||||
generate fonts for your platform. On most civilized operating systems,
|
||||
you can simply `apt-get install fontforge`, `yum install fontforge` or
|
||||
even `port install fontforge`. On others, you may need to grab your copy
|
||||
from http://fontforge.org/. I encourage you to drop by and read the
|
||||
tutorials.
|
||||
|
||||
![Powerline-shell compatible!]
|
||||
(https://raw.github.com/wiki/rbanffy/3270font/powerline.png)
|
||||
|
||||
Adobe Type 1, TTF, OTF and WOFF versions are available for download on
|
||||
http://s3.amazonaws.com/rbanffy/3270_fonts.zip for those who would just
|
||||
like to use them.
|
||||
|
||||
![Using it on OSX]
|
||||
(https://raw.github.com/wiki/rbanffy/3270font/osx_terminal.png)
|
||||
|
||||
Generating derived files
|
||||
------------------------
|
||||
|
||||
The script `generate_derived.pe` calls FontForge and generates
|
||||
PostScript, OTF, TTF and WOFF versions of the base font, as well as a
|
||||
slightly more condensed .sfd file with the base font narrowed to 488
|
||||
units, with no glyph rescaling and its corresponding PostScript, TTF,
|
||||
OTF and WOFF versions.
|
||||
|
||||
Contributing
|
||||
------------
|
||||
|
||||
I don't think GitHub's pull-request mechanism is FontForge-friendly. If
|
||||
you want to contribute (there are a lot of missing glyphs, such as the
|
||||
APL set and most non-latin alphabets which most likely were never built
|
||||
into 3270 terminals), get in touch and we will figure out how to do it
|
||||
right.
|
||||
|
||||
Preserving history
|
||||
------------------
|
||||
|
||||
I regard the history of electronic computing a very important part of
|
||||
our civilization's history. Consider donating to entities that help
|
||||
preserve it, such as the Computer History Museum
|
||||
(http://www.computerhistory.org/), the IT History Society
|
||||
(http://ithistory.org/) and many others around the world. If you have a
|
||||
historically significant piece of technology in your closet or garage,
|
||||
consider contacting a local technology or industrial-design-oriented
|
||||
museum for advice.
|
||||
|
||||
Known problems
|
||||
--------------
|
||||
|
||||
I have received errors when installing the OTF, TTF, and PFM fonts on
|
||||
Windows 7 and 8 (didn't try others).
|
||||
@@ -7,22 +7,19 @@ TerminalFrame{
|
||||
anchors.fill: parent
|
||||
addedWidth: 200
|
||||
addedHeight: 370
|
||||
borderLeft: 148
|
||||
borderRight: 148
|
||||
borderTop: 232
|
||||
borderBottom: 232
|
||||
borderLeft: 170
|
||||
borderRight: 170
|
||||
borderTop: 250
|
||||
borderBottom: 250
|
||||
imageSource: "../images/black-frame.png"
|
||||
normalsSource: "../images/black-frame-normals.png"
|
||||
|
||||
rectX: 20
|
||||
rectY: 20
|
||||
|
||||
distortionCoefficient: 1.9
|
||||
|
||||
displacementLeft: 70.0
|
||||
displacementTop: 55.0
|
||||
displacementRight: 50.0
|
||||
displacementBottom: 38.0
|
||||
displacementLeft: 80.0
|
||||
displacementTop: 65.0
|
||||
displacementRight: 80.0
|
||||
displacementBottom: 65.0
|
||||
|
||||
shaderString: "FrameShader.qml"
|
||||
}
|
||||
@@ -12,9 +12,6 @@ TerminalFrame{
|
||||
borderTop: 0
|
||||
borderBottom: 0
|
||||
|
||||
rectX: 15
|
||||
rectY: 15
|
||||
|
||||
displacementLeft: 0
|
||||
displacementTop: 0
|
||||
displacementRight: 0
|
||||
@@ -14,15 +14,12 @@ TerminalFrame{
|
||||
imageSource: "../images/screen-frame.png"
|
||||
normalsSource: "../images/screen-frame-normals.png"
|
||||
|
||||
rectX: 15
|
||||
rectY: 15
|
||||
|
||||
distortionCoefficient: 1.5
|
||||
|
||||
displacementLeft: 45
|
||||
displacementTop: 40
|
||||
displacementRight: 38.0
|
||||
displacementBottom: 28.0
|
||||
displacementLeft: 55
|
||||
displacementTop: 50
|
||||
displacementRight: 55
|
||||
displacementBottom: 50
|
||||
|
||||
shaderString: "FrameShader.qml"
|
||||
}
|
||||
|
Before Width: | Height: | Size: 1.1 MiB After Width: | Height: | Size: 1.1 MiB |
|
Before Width: | Height: | Size: 1.1 MiB After Width: | Height: | Size: 1.1 MiB |
|
Before Width: | Height: | Size: 1.2 MiB After Width: | Height: | Size: 1.2 MiB |
|
Before Width: | Height: | Size: 132 KiB After Width: | Height: | Size: 132 KiB |
|
Before Width: | Height: | Size: 507 KiB After Width: | Height: | Size: 507 KiB |
|
Before Width: | Height: | Size: 571 KiB After Width: | Height: | Size: 571 KiB |
|
Before Width: | Height: | Size: 811 KiB After Width: | Height: | Size: 811 KiB |
@@ -13,6 +13,8 @@ ShaderEffect{
|
||||
property bool frameReflections: shadersettings.frameReflections
|
||||
property variant lightSource: reflectionEffectSourceLoader.item
|
||||
|
||||
property real chroma_color: shadersettings.chroma_color
|
||||
|
||||
Loader{
|
||||
id: reflectionEffectLoader
|
||||
width: parent.width * 0.33
|
||||
@@ -45,7 +47,8 @@ ShaderEffect{
|
||||
uniform sampler2D normals;
|
||||
uniform highp float screen_distorsion;
|
||||
uniform highp float ambient_light;
|
||||
uniform highp float qt_Opacity;" +
|
||||
uniform highp float qt_Opacity;
|
||||
uniform lowp float chroma_color;" +
|
||||
|
||||
(frameReflections ?
|
||||
"uniform sampler2D lightSource;" : "") + "
|
||||
@@ -62,6 +65,10 @@ ShaderEffect{
|
||||
return (coords + cc * (1.0 + dist) * dist);
|
||||
}
|
||||
|
||||
float rgb2grey(vec3 v){
|
||||
return dot(v, vec3(0.21, 0.72, 0.04));
|
||||
}
|
||||
|
||||
void main(){
|
||||
vec2 coords = distortCoordinates(qt_TexCoord0);
|
||||
vec4 txt_color = texture2D(source, coords);
|
||||
@@ -72,16 +79,20 @@ ShaderEffect{
|
||||
float dotProd = dot(normal, light_direction);" +
|
||||
|
||||
(frameReflections ? "
|
||||
float screenLight = texture2D(lightSource, coords).r;
|
||||
vec3 realLightColor = texture2D(lightSource, coords).rgb;
|
||||
float screenLight = rgb2grey(realLightColor);
|
||||
float clampedDotProd = clamp(dotProd, 0.05, 1.0);
|
||||
float diffuseReflection = clamp(screenLight * 1.5 * clampedDotProd, 0.0, 0.35);
|
||||
float reflectionAlpha = mix(1.0, 0.90, dotProd);"
|
||||
float reflectionAlpha = mix(1.0, 0.90, dotProd);
|
||||
vec3 lightColor = mix(font_color.rgb * screenLight, font_color.rgb * realLightColor, chroma_color);"
|
||||
: "
|
||||
float diffuseReflection = 0.0;
|
||||
float reflectionAlpha = 1.0;") + "
|
||||
float reflectionAlpha = 1.0;
|
||||
vec3 lightColor = font_color.rgb;") + "
|
||||
|
||||
|
||||
vec3 back_color = background_color.rgb * (0.2 + 0.5 * dotProd);
|
||||
vec3 front_color = font_color.rgb * (0.05 + diffuseReflection);
|
||||
vec3 front_color = lightColor * (0.05 + diffuseReflection);
|
||||
|
||||
vec4 dark_color = vec4((back_color + front_color) * txt_normal.a, txt_normal.a * reflectionAlpha);
|
||||
gl_FragColor = mix(dark_color, txt_color, ambient_light);
|
||||
@@ -15,10 +15,6 @@ Item{
|
||||
property string normalsSource
|
||||
property string shaderString
|
||||
|
||||
//Value used to create the rect used to add the border to the texture
|
||||
property real rectX
|
||||
property real rectY
|
||||
|
||||
//Values used to displace the texture in the screen. Used to make reflections correct.
|
||||
property real displacementLeft
|
||||
property real displacementTop
|
||||
@@ -27,11 +23,6 @@ Item{
|
||||
|
||||
property real distortionCoefficient
|
||||
|
||||
property rect sourceRect: Qt.rect(-rectX * shadersettings.window_scaling,
|
||||
-rectY * shadersettings.window_scaling,
|
||||
terminal.width + 2*rectX * shadersettings.window_scaling,
|
||||
terminal.height + 2*rectY * shadersettings.window_scaling)
|
||||
|
||||
BorderImage{
|
||||
id: frameimage
|
||||
anchors.centerIn: parent
|
||||
BIN
app/qml/images/crt256.png
Normal file
|
After Width: | Height: | Size: 62 KiB |
129
app/qml/main.qml
Normal file
@@ -0,0 +1,129 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2013 "Filippo Scognamiglio"
|
||||
* https://github.com/Swordfish90/cool-retro-term
|
||||
*
|
||||
* This file is part of cool-retro-term.
|
||||
*
|
||||
* cool-retro-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 <http://www.gnu.org/licenses/>.
|
||||
*******************************************************************************/
|
||||
|
||||
import QtQuick 2.2
|
||||
import QtQuick.Window 2.1
|
||||
import QtQuick.Controls 1.1
|
||||
import QtGraphicalEffects 1.0
|
||||
|
||||
ApplicationWindow{
|
||||
id: terminalWindow
|
||||
|
||||
width: 1024
|
||||
height: 768
|
||||
minimumWidth: 320
|
||||
minimumHeight: 240
|
||||
|
||||
visible: true
|
||||
|
||||
property bool fullscreen: shadersettings.fullscreen
|
||||
onFullscreenChanged: visibility = (fullscreen ? Window.FullScreen : Window.Windowed)
|
||||
|
||||
//Workaround: if menubar is assigned ugly margins are visible.
|
||||
menuBar: Qt.platform.os === "osx"
|
||||
? defaultMenuBar
|
||||
: shadersettings.showMenubar ? defaultMenuBar : null
|
||||
|
||||
color: "#00000000"
|
||||
title: qsTr("cool-retro-term")
|
||||
|
||||
Action {
|
||||
id: showMenubarAction
|
||||
text: qsTr("Show Menubar")
|
||||
enabled: Qt.platform.os !== "osx"
|
||||
shortcut: "Ctrl+Shift+M"
|
||||
checkable: true
|
||||
checked: shadersettings.showMenubar
|
||||
onTriggered: shadersettings.showMenubar = !shadersettings.showMenubar
|
||||
}
|
||||
Action {
|
||||
id: fullscreenAction
|
||||
text: qsTr("Fullscreen")
|
||||
enabled: Qt.platform.os !== "osx"
|
||||
shortcut: "Alt+F11"
|
||||
onTriggered: shadersettings.fullscreen = !shadersettings.fullscreen;
|
||||
checkable: true
|
||||
checked: shadersettings.fullscreen
|
||||
}
|
||||
Action {
|
||||
id: quitAction
|
||||
text: qsTr("Quit")
|
||||
shortcut: "Ctrl+Shift+Q"
|
||||
onTriggered: terminalWindow.close();
|
||||
}
|
||||
Action{
|
||||
id: showsettingsAction
|
||||
text: qsTr("Settings")
|
||||
onTriggered: settingswindow.show();
|
||||
}
|
||||
Action{
|
||||
id: copyAction
|
||||
text: qsTr("Copy")
|
||||
shortcut: "Ctrl+Shift+C"
|
||||
onTriggered: terminal.copyClipboard()
|
||||
}
|
||||
Action{
|
||||
id: pasteAction
|
||||
text: qsTr("Paste")
|
||||
shortcut: "Ctrl+Shift+V"
|
||||
onTriggered: terminal.pasteClipboard()
|
||||
}
|
||||
Action{
|
||||
id: zoomIn
|
||||
text: qsTr("Zoom In")
|
||||
shortcut: "Ctrl++"
|
||||
onTriggered: shadersettings.incrementScaling();
|
||||
}
|
||||
Action{
|
||||
id: zoomOut
|
||||
text: qsTr("Zoom Out")
|
||||
shortcut: "Ctrl+-"
|
||||
onTriggered: shadersettings.decrementScaling();
|
||||
}
|
||||
Action{
|
||||
id: showAboutAction
|
||||
text: qsTr("About")
|
||||
onTriggered: {
|
||||
aboutDialog.show();
|
||||
}
|
||||
}
|
||||
CRTMainMenuBar{
|
||||
id: defaultMenuBar
|
||||
}
|
||||
ApplicationSettings{
|
||||
id: shadersettings
|
||||
}
|
||||
TimeManager{
|
||||
id: timeManager
|
||||
enableTimer: terminalWindow.visible
|
||||
}
|
||||
TerminalContainer{
|
||||
anchors.fill: parent
|
||||
}
|
||||
SettingsWindow{
|
||||
id: settingswindow
|
||||
visible: false
|
||||
}
|
||||
AboutDialog{
|
||||
id: aboutDialog
|
||||
visible: false
|
||||
}
|
||||
Component.onCompleted: shadersettings.handleFontChanged();
|
||||
}
|
||||
71
app/qml/resources.qrc
Normal file
@@ -0,0 +1,71 @@
|
||||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file>frames/BlackRoughFrame.qml</file>
|
||||
<file>frames/NoFrame.qml</file>
|
||||
<file>frames/images/black-frame.png</file>
|
||||
<file>frames/images/screen-frame-normals.png</file>
|
||||
<file>frames/images/black-frame-normals.png</file>
|
||||
<file>frames/images/screen-frame.png</file>
|
||||
<file>frames/images/black-frame-original.png</file>
|
||||
<file>frames/images/randfunction.png</file>
|
||||
<file>frames/images/screen-frame-original.png</file>
|
||||
<file>frames/WhiteSimpleFrame.qml</file>
|
||||
<file>frames/utils/FrameShader.qml</file>
|
||||
<file>frames/utils/NoFrameShader.qml</file>
|
||||
<file>frames/utils/TerminalFrame.qml</file>
|
||||
<file>SizeOverlay.qml</file>
|
||||
<file>ShaderTerminal.qml</file>
|
||||
<file>CheckableSlider.qml</file>
|
||||
<file>ApplicationSettings.qml</file>
|
||||
<file>SettingsWindow.qml</file>
|
||||
<file>Fonts.qml</file>
|
||||
<file>FontPixels.qml</file>
|
||||
<file>SettingsGeneralTab.qml</file>
|
||||
<file>PreprocessedTerminal.qml</file>
|
||||
<file>TimeManager.qml</file>
|
||||
<file>SimpleSlider.qml</file>
|
||||
<file>ColorButton.qml</file>
|
||||
<file>Glossy.qml</file>
|
||||
<file>AboutDialog.qml</file>
|
||||
<file>InsertNameDialog.qml</file>
|
||||
<file>SettingsEffectsTab.qml</file>
|
||||
<file>main.qml</file>
|
||||
<file>SettingsTerminalTab.qml</file>
|
||||
<file>FontScanlines.qml</file>
|
||||
<file>fonts/1982-commodore64/C64_Pro_v1.0-STYLE.ttf</file>
|
||||
<file>fonts/1982-commodore64/license.txt</file>
|
||||
<file>fonts/1982-commodore64/C64_Pro_Mono_v1.0-STYLE.ttf</file>
|
||||
<file>fonts/1982-commodore64/C64_Elite_Mono_v1.0-STYLE.ttf</file>
|
||||
<file>fonts/1982-commodore64/C64_User_Mono_v1.0-STYLE.ttf</file>
|
||||
<file>fonts/1982-commodore64/C64_User_v1.0-STYLE.ttf</file>
|
||||
<file>fonts/1977-apple2/FreeLicense.txt</file>
|
||||
<file>fonts/1977-apple2/PRNumber3.ttf</file>
|
||||
<file>fonts/1977-apple2/PrintChar21.ttf</file>
|
||||
<file>fonts/1971-ibm-3278/README.md</file>
|
||||
<file>fonts/1971-ibm-3278/LICENSE.txt</file>
|
||||
<file>fonts/1971-ibm-3278/3270Medium.ttf</file>
|
||||
<file>fonts/1985-atari-st/AtariST8x16SystemFont.ttf</file>
|
||||
<file>fonts/modern-terminus/TerminusTTF-Bold-4.38.2.ttf</file>
|
||||
<file>fonts/modern-terminus/TerminusTTF-4.38.2.ttf</file>
|
||||
<file>fonts/1977-commodore-pet/FreeLicense.txt</file>
|
||||
<file>fonts/1977-commodore-pet/COMMODORE_PET_128_2y.ttf</file>
|
||||
<file>fonts/1977-commodore-pet/COMMODORE_PET.ttf</file>
|
||||
<file>fonts/1977-commodore-pet/COMMODORE_PET_64_2y.ttf</file>
|
||||
<file>fonts/1977-commodore-pet/COMMODORE_PET_2y.ttf</file>
|
||||
<file>fonts/1977-commodore-pet/COMMODORE_PET_64.ttf</file>
|
||||
<file>fonts/1977-commodore-pet/COMMODORE_PET_128.ttf</file>
|
||||
<file>fonts/1977-commodore-pet/COMMODORE_PET_2x.ttf</file>
|
||||
<file>fonts/1979-atari-400-800/ReadMe.rtf</file>
|
||||
<file>fonts/1979-atari-400-800/ATARI400800_original.TTF</file>
|
||||
<file>fonts/1979-atari-400-800/ATARI400800_squared.TTF</file>
|
||||
<file>fonts/1979-atari-400-800/ATARI400800_rounded.TTF</file>
|
||||
<file>fonts/1985-ibm-pc-vga/Perfect DOS VGA 437 Win.ttf</file>
|
||||
<file>fonts/1985-ibm-pc-vga/Perfect DOS VGA 437.ttf</file>
|
||||
<file>fonts/1985-ibm-pc-vga/dos437.txt</file>
|
||||
<file>Storage.qml</file>
|
||||
<file>CRTMainMenuBar.qml</file>
|
||||
<file>SettingsPerformanceTab.qml</file>
|
||||
<file>TerminalContainer.qml</file>
|
||||
<file>images/crt256.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
@@ -1,4 +0,0 @@
|
||||
#!/bin/bash
|
||||
#This is a workaround for an ubuntu specific problem with appmenu-qt5.
|
||||
QT_QPA_PLATFORMTHEME=
|
||||
qmlscene -I $(dirname $0)/imports $(dirname $0)/app/main.qml
|
||||
@@ -1,3 +0,0 @@
|
||||
TEMPLATE =subdirs
|
||||
CONFIG += ordered
|
||||
SUBDIRS= konsole-qml-plugin
|
||||
11
cool-retro-term.desktop
Normal file
@@ -0,0 +1,11 @@
|
||||
[Desktop Entry]
|
||||
Comment=Use the command line the old way
|
||||
Exec=cool-retro-term
|
||||
GenericName=Terminal emulator
|
||||
Icon=utilities-terminal
|
||||
MimeType=
|
||||
Name=Cool Retro Term
|
||||
Categories=Qt;System;Utility;TerminalEmulator;
|
||||
StartupNotify=true
|
||||
Terminal=false
|
||||
Type=Application
|
||||
9
cool-retro-term.pro
Normal file
@@ -0,0 +1,9 @@
|
||||
TEMPLATE = subdirs
|
||||
|
||||
SUBDIRS += app
|
||||
SUBDIRS += konsole-qml-plugin
|
||||
|
||||
desktop.files += cool-retro-term.desktop
|
||||
desktop.path += /usr/share/applications
|
||||
|
||||
INSTALLS += desktop
|
||||
@@ -36,22 +36,23 @@ color 1 0 0 0 1 0 # regular background color (Black)
|
||||
|
||||
color 2 0 0 0 0 0 # regular color 0 Black
|
||||
|
||||
color 3 59 59 59 0 0 # regular color 1 Red
|
||||
color 3 255 43 43 0 0 # regular color 1 Red
|
||||
|
||||
color 4 137 137 137 0 0 # regular color 2 Green
|
||||
color 4 28 172 120 0 0 # regular color 2 Green
|
||||
|
||||
color 5 116 116 116 0 0 # regular color 3 Yellow
|
||||
color 5 248 213 104 0 0 # regular color 3 Yellow
|
||||
|
||||
color 6 39 39 39 0 0 # regular color 4 Blue
|
||||
color 6 43 108 196 0 0 # regular color 4 Blue
|
||||
|
||||
color 7 70 70 70 0 0 # regular color 5 Magenta
|
||||
color 7 255 29 206 0 0 # regular color 5 Magenta
|
||||
|
||||
color 8 148 148 148 0 0 # regular color 6 Cyan
|
||||
color 8 24 167 181 0 0 # regular color 6 Cyan
|
||||
|
||||
color 9 179 179 179 0 0 # regular color 7 White
|
||||
|
||||
|
||||
|
||||
|
||||
# intensive colors
|
||||
|
||||
|
||||
@@ -68,17 +69,17 @@ color 11 0 0 0 1 0 # intensive background color
|
||||
|
||||
color 12 106 106 106 0 0 # intensive color 0
|
||||
|
||||
color 13 122 122 122 0 0 # intensive color 1
|
||||
color 13 253 94 83 0 0 # intensive color 1
|
||||
|
||||
color 14 207 207 207 0 0 # intensive color 2
|
||||
color 14 168 228 160 0 0 # intensive color 2
|
||||
|
||||
color 15 243 243 243 0 0 # intensive color 3
|
||||
color 15 254 254 34 0 0 # intensive color 3
|
||||
|
||||
color 16 99 99 99 0 0 # intensive color 4
|
||||
color 16 154 206 235 0 0 # intensive color 4
|
||||
|
||||
color 17 134 134 134 0 0 # intensive color 5
|
||||
color 17 252 116 253 0 0 # intensive color 5
|
||||
|
||||
color 18 219 219 219 0 0 # intensive color 6
|
||||
color 18 236 234 190 0 0 # intensive color 6
|
||||
|
||||
color 19 255 255 255 0 0 # intensive color 7
|
||||
|
||||
196
konsole-qml-plugin/assets/kb-layouts/xterm.keytab
Normal file
@@ -0,0 +1,196 @@
|
||||
# [README.xterm.Keytab] Xterm 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 "Xterm"
|
||||
|
||||
# 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
|
||||
|
||||
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 +AnyMod+Ansi : "\E[1;*A"
|
||||
key Down +AnyMod+Ansi : "\E[1;*B"
|
||||
key Right +AnyMod+Ansi : "\E[1;*C"
|
||||
key Left +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 : "\E[1;*P"
|
||||
key F2 +AnyMod : "\E[1;*Q"
|
||||
key F3 +AnyMod : "\E[1;*R"
|
||||
key F4 +AnyMod : "\E[1;*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"
|
||||
|
||||
key At +Control : "\x00"
|
||||
|
||||
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"
|
||||
|
||||
key BracketLeft +Control : "\x1b"
|
||||
key Backslash +Control : "\x1c"
|
||||
key BracketRight +Control : "\x1d"
|
||||
key AsciiCircum +Control : "\x1e"
|
||||
key _ +Control : "\x1f"
|
||||
|
||||
key Question +Control : "\x7f"
|
||||
|
||||
# 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
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
konsole-qml-plugin (0.1.2) raring; urgency=low
|
||||
|
||||
* Fixed text display bug (LP:#1182503)
|
||||
|
||||
-- Dmitry Zagnoyko <hiroshidi@gmail.com> 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 <hiroshidi@gmail.com> 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 <hiroshidi@gmail.com> 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 <hiroshidi@gmail.com> Fri, 19 Apr 2013 20:22:12 +0300
|
||||
@@ -1,40 +0,0 @@
|
||||
Source: konsole-qml-plugin
|
||||
Section: libs
|
||||
Priority: optional
|
||||
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
|
||||
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.
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/3.0/
|
||||
Upstream-Name: konsole-qml-plugin
|
||||
Source:
|
||||
|
||||
Files: *
|
||||
Copyright: 2013 Dmitry Zagnoyko <hiroshidi@gmail.com>
|
||||
2008 e_k <e_k@users.sourceforge.net>
|
||||
2006-2008 Robert Knight <robertknight@gmail.com>
|
||||
2003-2007 Oswald Buddenhagen <ossi@kde.org>
|
||||
2000 Stephan Kulow <coolo@kde.org>
|
||||
1997-1998 Lars Doelle <lars.doelle@on-line.de>
|
||||
License: GPL-3
|
||||
|
||||
Files: debian/*
|
||||
Copyright: 2013 Dmitry Zagnoyko <hiroshidi@gmail.com>
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
.
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
.
|
||||
On Debian systems, the complete text of the GNU Lesser General
|
||||
Public License can be found in "/usr/share/common-licenses/LGPL-3".
|
||||
@@ -1,21 +0,0 @@
|
||||
#!/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
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
3.0 (native)
|
||||
@@ -6,16 +6,43 @@ TEMPLATE = lib
|
||||
CONFIG += qt plugin hide_symbols
|
||||
QT += qml quick widgets
|
||||
|
||||
DEFINES += HAVE_POSIX_OPENPT HAVE_SYS_TIME_H HAVE_UPDWTMPX
|
||||
DEFINES += HAVE_POSIX_OPENPT HAVE_SYS_TIME_H
|
||||
|
||||
!macx:DEFINES += HAVE_UPDWTMPX
|
||||
macx:DEFINES += HAVE_UTMPX HAVE_UT_USER
|
||||
|
||||
#MANUALY DEFINED PLATFORM
|
||||
DEFINES += Q_WS_UBUNTU
|
||||
|
||||
TARGET = kdekonsole
|
||||
PLUGIN_IMPORT_PATH = org/kde/konsole
|
||||
PLUGIN_IMPORT_PATH = org/crt/konsole
|
||||
PLUGIN_ASSETS = $$PWD/assets/*
|
||||
|
||||
INSTALL_DIR = ../imports
|
||||
DESTDIR = $$OUT_PWD/../imports/$$PLUGIN_IMPORT_PATH
|
||||
|
||||
INSTALL_DIR = $$[QT_INSTALL_QML]
|
||||
|
||||
# Copy additional plugin files
|
||||
QMAKE_COPY = "cp -r"
|
||||
|
||||
defineTest(copyToDestdir) {
|
||||
files = $$1
|
||||
|
||||
for(FILE, files) {
|
||||
DDIR = $$DESTDIR
|
||||
|
||||
# Replace slashes in paths with backslashes for Windows
|
||||
win32:FILE ~= s,/,\\,g
|
||||
win32:DDIR ~= s,/,\\,g
|
||||
|
||||
QMAKE_POST_LINK += $$QMAKE_COPY $$quote($$FILE) $$quote($$DDIR) $$escape_expand(\\n\\t)
|
||||
}
|
||||
|
||||
export(QMAKE_POST_LINK)
|
||||
}
|
||||
|
||||
copyToDestdir($$PLUGIN_ASSETS)
|
||||
copyToDestdir($$PWD/src/qmldir)
|
||||
|
||||
#########################################
|
||||
## SOURCES
|
||||
@@ -43,8 +70,7 @@ SOURCES += \
|
||||
$$PWD/src/Filter.cpp \
|
||||
$$PWD/src/ColorScheme.cpp \
|
||||
$$PWD/src/TerminalDisplay.cpp \
|
||||
$$PWD/src/ksession.cpp \
|
||||
$$PWD/src/utmpmac.cpp
|
||||
$$PWD/src/ksession.cpp
|
||||
|
||||
HEADERS += \
|
||||
$$PWD/src/plugin.h \
|
||||
@@ -76,7 +102,6 @@ HEADERS += \
|
||||
$$PWD/src/ColorScheme.h \
|
||||
$$PWD/src/TerminalDisplay.h \
|
||||
$$PWD/src/ksession.h
|
||||
$$PWD/src/utmpmac.h
|
||||
|
||||
OTHER_FILES += \
|
||||
$$PWD/src/qmldir \
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
This file is part of Konsole, KDE's terminal.
|
||||
|
||||
|
||||
Copyright 2007-2008 by Robert Knight <robertknight@gmail.com>
|
||||
Copyright 1997,1998 by Lars Doelle <lars.doelle@on-line.de>
|
||||
|
||||
@@ -53,7 +53,7 @@ static const int LINE_DOUBLEHEIGHT = (1 << 2);
|
||||
class Character
|
||||
{
|
||||
public:
|
||||
/**
|
||||
/**
|
||||
* Constructs a new character.
|
||||
*
|
||||
* @param _c The unicode character value of this character.
|
||||
@@ -71,25 +71,25 @@ public:
|
||||
{
|
||||
/** 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;
|
||||
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;
|
||||
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.
|
||||
*/
|
||||
@@ -97,16 +97,16 @@ public:
|
||||
/**
|
||||
* 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.
|
||||
* 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.
|
||||
*/
|
||||
@@ -119,36 +119,36 @@ public:
|
||||
};
|
||||
|
||||
inline bool operator == (const Character& a, const Character& b)
|
||||
{
|
||||
return a.character == b.character &&
|
||||
a.rendition == b.rendition &&
|
||||
a.foregroundColor == b.foregroundColor &&
|
||||
{
|
||||
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 ||
|
||||
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) &&
|
||||
return ((backgroundColor._colorSpace == COLOR_SPACE_DEFAULT) &&
|
||||
base[backgroundColor._u+0+(backgroundColor._v?BASE_COLORS:0)].transparent)
|
||||
|| ((backgroundColor._colorSpace == COLOR_SPACE_SYSTEM) &&
|
||||
|| ((backgroundColor._colorSpace == COLOR_SPACE_SYSTEM) &&
|
||||
base[backgroundColor._u+2+(backgroundColor._v?BASE_COLORS:0)].transparent);
|
||||
}
|
||||
|
||||
inline bool Character::equalsFormat(const Character& other) const
|
||||
{
|
||||
return
|
||||
return
|
||||
backgroundColor==other.backgroundColor &&
|
||||
foregroundColor==other.foregroundColor &&
|
||||
rendition==other.rendition;
|
||||
}
|
||||
}
|
||||
|
||||
inline ColorEntry::FontWeight Character::fontWeight(const ColorEntry* base) const
|
||||
{
|
||||
@@ -193,7 +193,7 @@ public:
|
||||
* 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
|
||||
* @param length This variable is set to the length of the
|
||||
* character sequence.
|
||||
*
|
||||
* @return A unicode character sequence of size @p length.
|
||||
@@ -205,7 +205,7 @@ public:
|
||||
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
|
||||
// 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
|
||||
|
||||
@@ -376,6 +376,12 @@ signals:
|
||||
*/
|
||||
void imageSizeChanged(int lineCount , int columnCount);
|
||||
|
||||
/**
|
||||
* Emitted after receiving the escape sequence which asks to change
|
||||
* the terminal emulator's size
|
||||
*/
|
||||
void imageResizeRequest(const QSize& sizz);
|
||||
|
||||
/**
|
||||
* Emitted when the terminal program requests to change various properties
|
||||
* of the terminal display.
|
||||
|
||||
@@ -439,7 +439,7 @@ bool KeyboardTranslatorReader::parseAsStateFlag(const QString& item , KeyboardTr
|
||||
bool KeyboardTranslatorReader::parseAsKeyCode(const QString& item , int& keyCode)
|
||||
{
|
||||
QKeySequence sequence = QKeySequence::fromString(item);
|
||||
if ( !sequence.isEmpty() )
|
||||
if ( !sequence.isEmpty() && sequence[0] != Qt::Key_unknown )
|
||||
{
|
||||
keyCode = sequence[0];
|
||||
|
||||
@@ -453,6 +453,18 @@ bool KeyboardTranslatorReader::parseAsKeyCode(const QString& item , int& keyCode
|
||||
keyCode = Qt::Key_PageUp;
|
||||
else if ( item == "next" )
|
||||
keyCode = Qt::Key_PageDown;
|
||||
else if ( item == "question" )
|
||||
keyCode = Qt::Key_Question;
|
||||
else if ( item == "at" )
|
||||
keyCode = Qt::Key_At;
|
||||
else if ( item == "bracketleft" )
|
||||
keyCode = Qt::Key_BracketLeft;
|
||||
else if ( item == "backslash" )
|
||||
keyCode = Qt::Key_Backslash;
|
||||
else if ( item == "bracketright" )
|
||||
keyCode = Qt::Key_BracketRight;
|
||||
else if ( item == "asciicircum" )
|
||||
keyCode = Qt::Key_AsciiCircum;
|
||||
else
|
||||
return false;
|
||||
|
||||
|
||||
@@ -1358,3 +1358,13 @@ void Screen::fillWithDefaultChar(Character* dest, int count)
|
||||
for (int i=0;i<count;i++)
|
||||
dest[i] = defaultChar;
|
||||
}
|
||||
|
||||
void Screen::setCurrentTerminalDisplay(KTerminalDisplay* display)
|
||||
{
|
||||
_currentTerminalDisplay = display;
|
||||
}
|
||||
|
||||
KTerminalDisplay* Screen::currentTerminalDisplay()
|
||||
{
|
||||
return _currentTerminalDisplay;
|
||||
}
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
|
||||
|
||||
class TerminalCharacterDecoder;
|
||||
class KTerminalDisplay;
|
||||
|
||||
/**
|
||||
\brief An image of characters with associated attributes.
|
||||
@@ -543,6 +544,11 @@ public:
|
||||
*/
|
||||
static void fillWithDefaultChar(Character* dest, int count);
|
||||
|
||||
//cool-old-term: added to allow scrolling from commands
|
||||
void setCurrentTerminalDisplay(KTerminalDisplay* display);
|
||||
KTerminalDisplay* currentTerminalDisplay();
|
||||
|
||||
|
||||
private:
|
||||
|
||||
//copies a line of text from the screen or history into a stream using a
|
||||
@@ -666,6 +672,8 @@ private:
|
||||
int lastPos;
|
||||
|
||||
static Character defaultChar;
|
||||
|
||||
KTerminalDisplay* _currentTerminalDisplay;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -31,8 +31,7 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
// Qt
|
||||
#include <QGuiApplication>
|
||||
#include <QtGui/QWindow>
|
||||
#include <QQuickWindow>
|
||||
|
||||
#include <QtCore/QByteRef>
|
||||
#include <QtCore/QDir>
|
||||
@@ -48,9 +47,10 @@
|
||||
#include "ShellCommand.h" // REUSE THIS
|
||||
#include "Vt102Emulation.h" // REUSE THIS
|
||||
|
||||
|
||||
int Session::lastSessionId = 0;
|
||||
|
||||
using namespace Konsole;
|
||||
|
||||
Session::Session() :
|
||||
_shellProcess(0)
|
||||
, _emulation(0)
|
||||
@@ -142,7 +142,12 @@ WId Session::windowId() const
|
||||
// window = window->parentWidget();
|
||||
// }
|
||||
|
||||
return QGuiApplication::focusWindow()->winId();
|
||||
//return QGuiApplication::focusWindow()->winId();
|
||||
|
||||
//There is an issue here! Probably this always returns zero.
|
||||
//but I try to preseve the behavior there was before.
|
||||
QQuickWindow * window = _views.first()->window();
|
||||
return (window ? window->winId() : 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -199,14 +204,9 @@ void Session::addView(KTerminalDisplay * widget)
|
||||
|
||||
// allow emulation to notify view when the foreground process
|
||||
// indicates whether or not it is interested in mouse signals
|
||||
|
||||
// TODO Disabled since at the moment it is not working properly.
|
||||
// Remember to reenable that once it' is's working.
|
||||
|
||||
//connect( _emulation , SIGNAL(programUsesMouseChanged(bool)) , widget ,
|
||||
// SLOT(setUsesMouse(bool)) );
|
||||
|
||||
//widget->setUsesMouse( _emulation->programUsesMouse() );
|
||||
connect( _emulation , SIGNAL(programUsesMouseChanged(bool)) , widget ,
|
||||
SLOT(setUsesMouse(bool)) );
|
||||
widget->setUsesMouse( _emulation->programUsesMouse() );
|
||||
|
||||
widget->setScreenWindow(_emulation->createWindow());
|
||||
}
|
||||
@@ -307,6 +307,13 @@ void Session::run()
|
||||
QString argsTmp(_arguments.join(" ").trimmed());
|
||||
QStringList arguments;
|
||||
arguments << exec;
|
||||
|
||||
#ifdef Q_OS_OSX
|
||||
// Fix osx initial behavior with -i (interactive) and -l (login).
|
||||
arguments.append("-i");
|
||||
arguments.append("-l");
|
||||
#endif
|
||||
|
||||
if (argsTmp.length())
|
||||
arguments << _arguments;
|
||||
|
||||
|
||||
@@ -124,6 +124,10 @@ const QChar LTR_OVERRIDE_CHAR( 0x202D );
|
||||
/* ------------------------------------------------------------------------- */
|
||||
KTerminalDisplay::KTerminalDisplay(QQuickItem *parent) :
|
||||
QQuickPaintedItem(parent)
|
||||
,m_session(0)
|
||||
,m_focusOnClick(true)
|
||||
,m_showVKBonClick(true)
|
||||
,m_parent(parent)
|
||||
,_screenWindow(0)
|
||||
,_allowBell(true)
|
||||
,_fontHeight(1)
|
||||
@@ -159,10 +163,6 @@ KTerminalDisplay::KTerminalDisplay(QQuickItem *parent) :
|
||||
,_colorsInverted(false)
|
||||
,_cursorShape(BlockCursor)
|
||||
,_mouseMarks(false)
|
||||
,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);
|
||||
@@ -447,97 +447,396 @@ QStringList KTerminalDisplay::availableColorSchemes()
|
||||
return ret;
|
||||
}
|
||||
|
||||
void KTerminalDisplay::scrollWheel(qreal x, qreal y, int lines){
|
||||
void KTerminalDisplay::scrollWheelEvent(QPoint position, int lines){
|
||||
if(_mouseMarks){
|
||||
int charLine;
|
||||
int charColumn;
|
||||
getCharacterPosition(QPoint(x,y) , charLine , charColumn);
|
||||
|
||||
emit mouseSignal(lines > 0 ? 5 : 4,
|
||||
charColumn + 1,
|
||||
charLine + 1,
|
||||
0);
|
||||
} else {
|
||||
if(_screenWindow->lineCount() == _screenWindow->windowLines()){
|
||||
const int keyCode = lines > 0 ? Qt::Key_Down : Qt::Key_Up;
|
||||
QKeyEvent keyEvent(QEvent::KeyPress, keyCode, Qt::NoModifier);
|
||||
|
||||
emit keyPressedSignal(&keyEvent);
|
||||
emit keyPressedSignal(&keyEvent);
|
||||
} else {
|
||||
_screenWindow->scrollBy( ScreenWindow::ScrollLines, lines );
|
||||
_screenWindow->scrollCount();
|
||||
updateImage();
|
||||
}
|
||||
} else {
|
||||
int charLine;
|
||||
int charColumn;
|
||||
getCharacterPosition(position, charLine, charColumn);
|
||||
|
||||
emit mouseSignal(lines > 0 ? 5 : 4,
|
||||
charColumn + 1,
|
||||
charLine + 1,
|
||||
0);
|
||||
}
|
||||
}
|
||||
|
||||
void KTerminalDisplay::mousePress(qreal x, qreal y){
|
||||
if (m_focusOnClick) forcedFocus();
|
||||
if (m_showVKBonClick) ShowVKB(true);
|
||||
void KTerminalDisplay::doPaste(QString text, bool appendReturn)
|
||||
{
|
||||
if (!_screenWindow)
|
||||
return;
|
||||
|
||||
if (appendReturn)
|
||||
text.append("\r");
|
||||
|
||||
if (!text.isEmpty()) {
|
||||
text.replace('\n', '\r');
|
||||
// if (bracketedPasteMode()) {
|
||||
// text.prepend("\e[200~");
|
||||
// text.append("\e[201~");
|
||||
// }
|
||||
// perform paste by simulating keypress events
|
||||
QKeyEvent e(QEvent::KeyPress, 0, Qt::NoModifier, text);
|
||||
emit keyPressedSignal(&e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void KTerminalDisplay::pasteFromClipboard(bool appendEnter)
|
||||
{
|
||||
QString text = QGuiApplication::clipboard()->text(QClipboard::Clipboard);
|
||||
doPaste(text, appendEnter);
|
||||
}
|
||||
|
||||
void KTerminalDisplay::pasteFromX11Selection(bool appendEnter)
|
||||
{
|
||||
QString text = QGuiApplication::clipboard()->text(QClipboard::Selection);
|
||||
doPaste(text, appendEnter);
|
||||
}
|
||||
|
||||
|
||||
void KTerminalDisplay::processMidButtonClick(QPoint &position, Qt::KeyboardModifier modifiers)
|
||||
{
|
||||
if (_mouseMarks || (modifiers & Qt::ShiftModifier)) {
|
||||
const bool appendEnter = modifiers & Qt::ControlModifier;
|
||||
|
||||
if (true /*_middleClickPasteMode == Enum::PasteFromX11Selection*/) {
|
||||
pasteFromX11Selection(appendEnter);
|
||||
} else if (false /*_middleClickPasteMode == Enum::PasteFromClipboard*/) {
|
||||
pasteFromClipboard(appendEnter);
|
||||
} else {
|
||||
Q_ASSERT(false);
|
||||
}
|
||||
} else {
|
||||
int charLine = 0;
|
||||
int charColumn = 0;
|
||||
getCharacterPosition(position, charLine, charColumn);
|
||||
|
||||
emit mouseSignal(1, charColumn + 1, charLine + 1, 0);
|
||||
//emit mouseSignal(1, charColumn + 1, charLine + 1 + _scrollBar->value() - _scrollBar->maximum() , 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void KTerminalDisplay::mousePressEvent(QPoint position, int but, int mod)
|
||||
{
|
||||
Qt::MouseButton button = (Qt::MouseButton) but;
|
||||
Qt::KeyboardModifier modifiers = (Qt::KeyboardModifier) mod;
|
||||
// if (_possibleTripleClick && (ev->button() == Qt::LeftButton)) {
|
||||
// mouseTripleClickEvent(ev);
|
||||
// return;
|
||||
// }
|
||||
|
||||
if (!_screenWindow) return;
|
||||
|
||||
int charLine;
|
||||
int charColumn;
|
||||
getCharacterPosition(QPoint(x,y), charLine, charColumn);
|
||||
getCharacterPosition(position, charLine, charColumn);
|
||||
QPoint pos = QPoint(charColumn, charLine);
|
||||
|
||||
_wordSelectionMode = false;
|
||||
_lineSelectionMode = false;
|
||||
if (button == Qt::LeftButton) {
|
||||
_lineSelectionMode = false;
|
||||
_wordSelectionMode = false;
|
||||
|
||||
if(_mouseMarks){
|
||||
emit mouseSignal(0, charColumn + 1, charLine + 1, 0);
|
||||
} else {
|
||||
QPoint pos = QPoint(charColumn, charLine);
|
||||
_preserveLineBreaks = !((modifiers & Qt::ControlModifier) && !(modifiers & Qt::AltModifier));
|
||||
_columnSelectionMode = (modifiers & Qt::AltModifier) && (modifiers & Qt::ControlModifier);
|
||||
|
||||
_screenWindow->clearSelection();
|
||||
_iPntSel = _pntSel = pos;
|
||||
_actSel = 1; // left mouse button pressed but nothing selected yet.
|
||||
if (_mouseMarks || (modifiers == Qt::ShiftModifier)) {
|
||||
// Only extend selection for programs not interested in mouse
|
||||
if (_mouseMarks && (modifiers == Qt::ShiftModifier)) {
|
||||
extendSelection(position);
|
||||
} else {
|
||||
_screenWindow->clearSelection();
|
||||
|
||||
//pos.ry() += _scrollBar->value();
|
||||
_iPntSel = _pntSel = pos;
|
||||
_actSel = 1; // left mouse button pressed but nothing selected yet.
|
||||
}
|
||||
} else {
|
||||
emit mouseSignal(0, charColumn + 1, charLine + 1, 0);
|
||||
}
|
||||
} else if (button == Qt::MidButton) {
|
||||
processMidButtonClick(position, modifiers);
|
||||
} else if (button == Qt::RightButton) {
|
||||
if (!_mouseMarks)
|
||||
emit mouseSignal(2, charColumn + 1, charLine + 1, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void KTerminalDisplay::mouseMove(qreal x, qreal y){
|
||||
QPoint pos(x, y);
|
||||
void KTerminalDisplay::mouseMoveEvent(QPoint position, int but, int buts, int mod)
|
||||
{
|
||||
Qt::MouseButton button = (Qt::MouseButton) but;
|
||||
Qt::KeyboardModifier modifiers = (Qt::KeyboardModifier) mod;
|
||||
Qt::MouseButtons buttons = (Qt::MouseButtons) buts;
|
||||
|
||||
if(_mouseMarks){
|
||||
int charLine;
|
||||
int charColumn;
|
||||
getCharacterPosition(pos, charLine, charColumn);
|
||||
int charLine = 0;
|
||||
int charColumn = 0;
|
||||
getCharacterPosition(position, charLine, charColumn);
|
||||
|
||||
emit mouseSignal(0, charColumn + 1, charLine + 1, 1);
|
||||
} else {
|
||||
extendSelection(pos);
|
||||
// for auto-hiding the cursor, we need mouseTracking
|
||||
if (buttons == Qt::NoButton) return;
|
||||
|
||||
// if the terminal is interested in mouse movements
|
||||
// then emit a mouse movement signal, unless the shift
|
||||
// key is being held down, which overrides this.
|
||||
if (!_mouseMarks && !(modifiers & Qt::ShiftModifier)) {
|
||||
int button = 3;
|
||||
if (buttons & Qt::LeftButton)
|
||||
button = 0;
|
||||
if (buttons & Qt::MidButton)
|
||||
button = 1;
|
||||
if (buttons & Qt::RightButton)
|
||||
button = 2;
|
||||
|
||||
emit mouseSignal(button, charColumn + 1, charLine + 1, 1);
|
||||
return;
|
||||
}
|
||||
|
||||
if (_actSel == 0) return;
|
||||
|
||||
// don't extend selection while pasting
|
||||
if (buttons & Qt::MidButton) return;
|
||||
|
||||
extendSelection(position);
|
||||
}
|
||||
|
||||
|
||||
QPoint KTerminalDisplay::findWordEnd(const QPoint &pnt)
|
||||
{
|
||||
const int regSize = qMax(_screenWindow->windowLines(), 10);
|
||||
const int curLine = _screenWindow->currentLine();
|
||||
int i = pnt.y();
|
||||
int x = pnt.x();
|
||||
int y = i + curLine;
|
||||
int j = loc(x, i);
|
||||
QVector<LineProperty> lineProperties = _lineProperties;
|
||||
Screen *screen = _screenWindow->screen();
|
||||
Character *image = _image;
|
||||
Character *tmp_image = NULL;
|
||||
const QChar selClass = charClass(image[j]);
|
||||
const int imageSize = regSize * _columns;
|
||||
const int maxY = _screenWindow->lineCount() - 1;
|
||||
const int maxX = _columns - 1;
|
||||
|
||||
while (true) {
|
||||
const int lineCount = lineProperties.count();
|
||||
for (;;j++, x++) {
|
||||
if (x < maxX) {
|
||||
if (charClass(image[j + 1]) == selClass)
|
||||
continue;
|
||||
goto out;
|
||||
} else if (i < lineCount - 1) {
|
||||
if (lineProperties[i] & LINE_WRAPPED &&
|
||||
charClass(image[j + 1]) == selClass) {
|
||||
x = -1;
|
||||
i++;
|
||||
y++;
|
||||
continue;
|
||||
}
|
||||
goto out;
|
||||
} else if (y < maxY) {
|
||||
if (i < lineCount && !(lineProperties[i] & LINE_WRAPPED))
|
||||
goto out;
|
||||
break;
|
||||
} else {
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
int newRegEnd = qMin(y + regSize - 1, maxY);
|
||||
lineProperties = screen->getLineProperties(y, newRegEnd);
|
||||
i = 0;
|
||||
if (!tmp_image) {
|
||||
tmp_image = new Character[imageSize];
|
||||
image = tmp_image;
|
||||
}
|
||||
screen->getImage(tmp_image, imageSize, y, newRegEnd);
|
||||
x--;
|
||||
j = loc(x, i);
|
||||
}
|
||||
out:
|
||||
y -= curLine;
|
||||
// In word selection mode don't select @ (64) if at end of word.
|
||||
if (((image[j].rendition & RE_EXTENDED_CHAR) == 0) &&
|
||||
(QChar(image[j].character) == '@') &&
|
||||
(y > pnt.y() || x > pnt.x())) {
|
||||
if (x > 0) {
|
||||
x--;
|
||||
} else {
|
||||
y--;
|
||||
}
|
||||
}
|
||||
if (tmp_image) {
|
||||
delete[] tmp_image;
|
||||
}
|
||||
return QPoint(x, y);
|
||||
}
|
||||
|
||||
QPoint KTerminalDisplay::findWordStart(const QPoint &pnt)
|
||||
{
|
||||
const int regSize = qMax(_screenWindow->windowLines(), 10);
|
||||
const int curLine = _screenWindow->currentLine();
|
||||
int i = pnt.y();
|
||||
int x = pnt.x();
|
||||
int y = i + curLine;
|
||||
int j = loc(x, i);
|
||||
QVector<LineProperty> lineProperties = _lineProperties;
|
||||
Screen *screen = _screenWindow->screen();
|
||||
Character *image = _image;
|
||||
Character *tmp_image = NULL;
|
||||
const QChar selClass = charClass(image[j]);
|
||||
const int imageSize = regSize * _columns;
|
||||
|
||||
while (true) {
|
||||
for (;;j--, x--) {
|
||||
if (x > 0) {
|
||||
if (charClass(image[j - 1]) == selClass)
|
||||
continue;
|
||||
goto out;
|
||||
} else if (i > 0) {
|
||||
if (lineProperties[i - 1] & LINE_WRAPPED &&
|
||||
charClass(image[j - 1]) == selClass) {
|
||||
x = _columns;
|
||||
i--;
|
||||
y--;
|
||||
continue;
|
||||
}
|
||||
goto out;
|
||||
} else if (y > 0) {
|
||||
break;
|
||||
} else {
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
int newRegStart = qMax(0, y - regSize);
|
||||
lineProperties = screen->getLineProperties(newRegStart, y - 1);
|
||||
i = y - newRegStart;
|
||||
if (!tmp_image) {
|
||||
tmp_image = new Character[imageSize];
|
||||
image = tmp_image;
|
||||
}
|
||||
screen->getImage(tmp_image, imageSize, newRegStart, y - 1);
|
||||
j = loc(x, i);
|
||||
}
|
||||
out:
|
||||
if (tmp_image) {
|
||||
delete[] tmp_image;
|
||||
}
|
||||
return QPoint(x, y - curLine);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void KTerminalDisplay::mouseDoubleClickEvent(QPoint position, int but, int mod)
|
||||
{
|
||||
Qt::MouseButton button = (Qt::MouseButton) but;
|
||||
Qt::KeyboardModifier modifiers = (Qt::KeyboardModifier) mod;
|
||||
|
||||
if (button != Qt::LeftButton) return;
|
||||
if (!_screenWindow) return;
|
||||
|
||||
int charLine = 0;
|
||||
int charColumn = 0;
|
||||
|
||||
getCharacterPosition(position, charLine, charColumn);
|
||||
|
||||
// If the application is interested in mouse events. They have already been forwarded.
|
||||
if (!_mouseMarks && !(modifiers & Qt::ShiftModifier))
|
||||
return;
|
||||
|
||||
_screenWindow->clearSelection();
|
||||
|
||||
_wordSelectionMode = true;
|
||||
_actSel = 2; // within selection
|
||||
|
||||
_iPntSel = QPoint(charColumn, charLine);
|
||||
const QPoint bgnSel = findWordStart(_iPntSel);
|
||||
const QPoint endSel = findWordEnd(_iPntSel);
|
||||
|
||||
_screenWindow->setSelectionStart(bgnSel.x() , bgnSel.y() , false);
|
||||
_screenWindow->setSelectionEnd(endSel.x() , endSel.y());
|
||||
copyToX11Selection();
|
||||
|
||||
//TODO implement triple click.
|
||||
// _possibleTripleClick = true;
|
||||
|
||||
// QTimer::singleShot(QApplication::doubleClickInterval(), this,
|
||||
// SLOT(tripleClickTimeout()));
|
||||
}
|
||||
|
||||
|
||||
void KTerminalDisplay::copyToX11Selection()
|
||||
{
|
||||
if (!_screenWindow)
|
||||
return;
|
||||
|
||||
QString text = _screenWindow->selectedText(_preserveLineBreaks);
|
||||
if (text.isEmpty())
|
||||
return;
|
||||
|
||||
QGuiApplication::clipboard()->setText(text, QClipboard::Selection);
|
||||
}
|
||||
|
||||
|
||||
void KTerminalDisplay::mouseReleaseEvent(QPoint position, int but, int mod)
|
||||
{
|
||||
Qt::MouseButton button = (Qt::MouseButton) but;
|
||||
Qt::KeyboardModifier modifiers = (Qt::KeyboardModifier) mod;
|
||||
|
||||
if (!_screenWindow)
|
||||
return;
|
||||
|
||||
int charLine;
|
||||
int charColumn;
|
||||
getCharacterPosition(position, charLine, charColumn);
|
||||
|
||||
if (button == Qt::LeftButton) {
|
||||
if (_actSel > 1) {
|
||||
copyToX11Selection();
|
||||
}
|
||||
|
||||
_actSel = 0;
|
||||
|
||||
//FIXME: emits a release event even if the mouse is
|
||||
// outside the range. The procedure used in `mouseMoveEvent'
|
||||
// applies here, too.
|
||||
|
||||
if (!_mouseMarks && !(modifiers & Qt::ShiftModifier))
|
||||
emit mouseSignal(0, charColumn + 1, charLine + 1 , 2);
|
||||
}
|
||||
|
||||
if (!_mouseMarks &&
|
||||
(button == Qt::RightButton || button == Qt::MidButton) &&
|
||||
!(modifiers & Qt::ShiftModifier)) {
|
||||
emit mouseSignal(button == Qt::MidButton ? 1 : 2, charColumn + 1, charLine + 1, 2);
|
||||
}
|
||||
}
|
||||
|
||||
void KTerminalDisplay::mouseDoubleClick(qreal x, qreal y){
|
||||
QPoint pos(x, y);
|
||||
|
||||
if(_mouseMarks){
|
||||
int charLine;
|
||||
int charColumn;
|
||||
getCharacterPosition(pos, charLine, charColumn);
|
||||
|
||||
emit mouseSignal(0, charColumn + 1, charLine + 1, 0);
|
||||
//emit mouseSignal(0, charColumn + 1, charLine + 1, 0);
|
||||
} else {
|
||||
_wordSelectionMode = true;
|
||||
extendSelection(pos);
|
||||
}
|
||||
void KTerminalDisplay::scrollScreenWindow(enum ScreenWindow::RelativeScrollMode mode, int amount)
|
||||
{
|
||||
_screenWindow->scrollBy(mode, amount);
|
||||
_screenWindow->setTrackOutput(_screenWindow->atEndOfOutput());
|
||||
updateLineProperties();
|
||||
updateImage();
|
||||
}
|
||||
|
||||
void KTerminalDisplay::mouseRelease(qreal x, qreal y){
|
||||
_actSel = 0;
|
||||
|
||||
if(_mouseMarks){
|
||||
int charLine;
|
||||
int charColumn;
|
||||
getCharacterPosition(QPoint(x,y), charLine, charColumn);
|
||||
|
||||
emit mouseSignal(0, charColumn + 1, charLine + 1, 2);
|
||||
}
|
||||
}
|
||||
|
||||
void KTerminalDisplay::setUsesMouse(bool usesMouse){
|
||||
_mouseMarks = !usesMouse;
|
||||
_mouseMarks = usesMouse;
|
||||
emit usesMouseChanged();
|
||||
}
|
||||
|
||||
bool KTerminalDisplay::getUsesMouse(){
|
||||
return !_mouseMarks;
|
||||
}
|
||||
|
||||
void KTerminalDisplay::setAutoFocus(bool au)
|
||||
@@ -1352,16 +1651,33 @@ void KTerminalDisplay::updateLineProperties()
|
||||
_lineProperties = _screenWindow->getLineProperties();
|
||||
}
|
||||
|
||||
QChar KTerminalDisplay::charClass(QChar qch) const
|
||||
QChar KTerminalDisplay::charClass(const Character& ch) const
|
||||
{
|
||||
if ( qch.isSpace() ) return ' ';
|
||||
if (ch.rendition & RE_EXTENDED_CHAR) {
|
||||
ushort extendedCharLength = 0;
|
||||
const ushort* chars = ExtendedCharTable::instance.lookupExtendedChar(ch.character, extendedCharLength);
|
||||
if (chars && extendedCharLength > 0) {
|
||||
const QString s = QString::fromUtf16(chars, extendedCharLength);
|
||||
if (_wordCharacters.contains(s, Qt::CaseInsensitive))
|
||||
return 'a';
|
||||
bool allLetterOrNumber = true;
|
||||
for (int i = 0; allLetterOrNumber && i < s.size(); ++i)
|
||||
allLetterOrNumber = s.at(i).isLetterOrNumber();
|
||||
return allLetterOrNumber ? 'a' : s.at(0);
|
||||
}
|
||||
return 0;
|
||||
} else {
|
||||
const QChar qch(ch.character);
|
||||
if (qch.isSpace()) return ' ';
|
||||
|
||||
if ( qch.isLetterOrNumber() || _wordCharacters.contains(qch, Qt::CaseInsensitive ) )
|
||||
return 'a';
|
||||
if (qch.isLetterOrNumber() || _wordCharacters.contains(qch, Qt::CaseInsensitive))
|
||||
return 'a';
|
||||
|
||||
return qch;
|
||||
return qch;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void KTerminalDisplay::setWordCharacters(const QString& wc)
|
||||
{
|
||||
_wordCharacters = wc;
|
||||
@@ -1680,7 +1996,7 @@ void KTerminalDisplay::calcGeometry()
|
||||
_contentHeight = height() - 2 * DEFAULT_TOP_MARGIN + /* mysterious */ 1;
|
||||
|
||||
// ensure that display is always at least one column wide
|
||||
_columns = qMax(1, qRound(_contentWidth / _fontWidth));
|
||||
_columns = qMax(1, qFloor(_contentWidth / _fontWidth));
|
||||
_usedColumns = qMin(_usedColumns,_columns);
|
||||
|
||||
// ensure that display is always at least one line high
|
||||
@@ -1949,7 +2265,7 @@ void KTerminalDisplay::drawCursor(QPainter* painter,
|
||||
bool& invertCharacterColor)
|
||||
{
|
||||
QRectF cursorRect = rect;
|
||||
cursorRect.setHeight(_fontHeight - _lineSpacing - 1);
|
||||
cursorRect.setHeight(_fontHeight - _lineSpacing);
|
||||
|
||||
if (!_cursorBlinking)
|
||||
{
|
||||
@@ -1964,8 +2280,8 @@ void KTerminalDisplay::drawCursor(QPainter* painter,
|
||||
// it is draw entirely inside 'rect'
|
||||
int penWidth = qMax(1,painter->pen().width());
|
||||
|
||||
painter->drawRect(cursorRect.adjusted( penWidth/2,
|
||||
penWidth/2,
|
||||
painter->drawRect(cursorRect.adjusted( penWidth/2 + penWidth%2,
|
||||
penWidth/2 + penWidth%2,
|
||||
- penWidth/2 - penWidth%2,
|
||||
- penWidth/2 - penWidth%2));
|
||||
if ( hasFocus() )
|
||||
@@ -2144,44 +2460,10 @@ void KTerminalDisplay::drawInputMethodPreeditString(QPainter *painter , const QR
|
||||
|
||||
void KTerminalDisplay::keyPressEvent(QKeyEvent *event)
|
||||
{
|
||||
_screenWindow->screen()->setCurrentTerminalDisplay(this);
|
||||
|
||||
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.
|
||||
|
||||
|
||||