1
0
mirror of https://github.com/Swordfish90/cool-retro-term.git synced 2025-11-03 08:32:10 +00:00

16 Commits

Author SHA1 Message Date
Filippo Scognamiglio
462831ca66 Merge pull request #134 from sschueller/patch-1
Update README.md
2014-10-02 22:14:00 +02:00
Stefan Schüller
273ac3d126 Update README.md 2014-10-02 13:35:20 +02:00
Filippo Scognamiglio
4a7e23f024 Merge pull request #65 from e1senh0rn/osx
Various OSX fixes.
2014-08-04 18:00:08 +02:00
Dmitry Shaposhnik
84e0feb626 Add OS X build instructions to README 2014-08-04 08:39:42 -05:00
Dmitry Shaposhnik
906e981449 Add 'imports' to gitignore 2014-08-04 08:39:36 -05:00
Dmitry Shaposhnik
d887842bdc Do not list 'app' in project subdirs 2014-08-04 08:31:48 -05:00
Dmitry Shaposhnik
ed701b0ac6 Remove auto-generated makefile 2014-08-04 08:28:51 -05:00
Filippo Scognamiglio
e9e3732b26 Merge pull request #58 from guitorri/osx-headers
fix compilation errors, OSX 10.6-10.9
2014-08-03 15:22:26 +02:00
Guilherme Brondani Torri
2f11060364 fix compilation errors, OSX 10.6-10.9
* add missing headers
* https://github.com/Swordifish90/cool-old-term/issues/12
2014-08-02 18:16:50 +02:00
Filippo Scognamiglio
d3d1407ca7 Remove dummy signal. Shame on me. 2014-08-01 18:09:36 +02:00
Filippo Scognamiglio
5586c36efe Fix missing sources in konsole-qml-plugin.pro. 2014-08-01 14:09:48 +02:00
Filippo Scognamiglio
4064a38998 Merge branch 'master' of https://github.com/aacalfa/cool-old-term into osx 2014-08-01 14:03:46 +02:00
aacalfa
5978a0de70 Reorganizing last commit. Changes to kpty.cpp were moved to file utmpmac.cpp. Thus I modified .pro
file to add this new file utmpmac to be compiled. I have put both .cpp and .h files inside a macro
so that they are only considered when building from a mac. Same with include from kpty.cpp.
2014-07-31 22:28:12 -03:00
aacalfa
9d7efad798 Reverting PreprocessedTerminal.qml to be used in pull request. 2014-07-31 14:25:23 -03:00
aacalfa
d063e888a3 Another workaround to solve blur problem. 2014-07-31 12:16:43 -03:00
aacalfa
c612a1d586 Workaround to work for MacOS X. 2014-07-31 11:55:52 -03:00
119 changed files with 2169 additions and 3454 deletions

13
.gitignore vendored
View File

@@ -35,15 +35,4 @@ Makefile*
*.xcf
# Ubuntu SDk
*.excludes
*.json
# Excludes compiled files
imports
cool-retro-term
# Mac OSX
.DS_Store
*.app
/imports/

View File

@@ -1,10 +1,10 @@
#cool-retro-term
#cool-old-term
##Description
cool-retro-term is a terminal emulator which mimics the look and feel of the old cathode tube screens.
cool-old-term is a terminal emulator which tries to mimic the look and feel of the old cathode tube screens.
It has been designed to be eye-candy, customizable, and reasonably lightweight.
It uses the Konsole engine which is powerful and mature.
It now uses the konsole engine which is powerful and mature.
This terminal emulator requires Qt 5.2 or higher to run.
@@ -13,16 +13,7 @@ This terminal emulator requires Qt 5.2 or higher to run.
![Image](<http://i.imgur.com/4LpfLF8.png>)
![Image](<http://i.imgur.com/MMmM6Ht.png>)
##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)
##Build instructions
##Dependencies
Make sure to install these first.
@@ -43,12 +34,22 @@ 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
```
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
```
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
```
---
@@ -56,17 +57,23 @@ or:
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
---
**openSUSE**
**OS X**
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
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
---
@@ -75,35 +82,20 @@ Install dependencies:
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/Swordfish90/cool-retro-term.git
git clone https://github.com/Swordifish90/cool-old-term.git
# Build it
cd cool-retro-term
# Compile (Fedora and OpenSUSE user should use qmake-qt5 instead of qmake)
qmake && make
cd cool-old-term
cd konsole-qml-plugin
qmake && make && make install
cd ..
# Have fun!
./cool-retro-term
./cool-old-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&currency_code=EUR&bn=PP%2dDonationsBF%3abtn_donate_LG%2egif%3aNonHosted) .

View File

@@ -15,7 +15,7 @@ Window{
spacing: 15
Text {
anchors.horizontalCenter: parent.horizontalCenter
text: "cool-retro-term"
text: "cool-old-term"
font {bold: true; pointSize: 18}
}
Loader{
@@ -63,24 +63,18 @@ 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/Swordfish90/cool-retro-term\n"
qsTr("Email: ") + "flscogna@gmail.com\n" +
qsTr("Source: ") + "https://github.com/Swordifish90/cool-old-term\n"
}
}
}
@@ -90,9 +84,9 @@ Window{
anchors.fill: parent
readOnly: true
text: "Copyright (c) 2013 Filippo Scognamiglio <flscogna@gmail.com>\n\n" +
"https://github.com/Swordfish90/cool-retro-term\n\n" +
"https://github.com/Swordifish90/cool-old-term\n\n" +
"cool-retro-term is free software: you can redistribute it and/or modify " +
"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.\n\n" +

View File

@@ -1,10 +1,10 @@
/*******************************************************************************
* Copyright (c) 2013 "Filippo Scognamiglio"
* https://github.com/Swordfish90/cool-retro-term
* https://github.com/Swordifish90/cool-old-term
*
* This file is part of cool-retro-term.
* This file is part of cool-old-term.
*
* cool-retro-term is free software: you can redistribute it and/or modify
* 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.
@@ -59,9 +59,8 @@ Item{
property string _background_color: "#000000"
property string _font_color: "#ff8100"
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 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 real noise_strength: 0.1
property real screen_distortion: 0.1
@@ -69,27 +68,17 @@ 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}
@@ -104,7 +93,7 @@ Item{
// FONTS //////////////////////////////////////////////////////////////////
signal terminalFontChanged(string fontSource, int pixelSize, int lineSpacing, real screenScaling)
signal terminalFontChanged(string fontSource, int pixelSize, int lineSpacing, size virtualCharSize)
Loader{
id: fontManager
@@ -121,36 +110,34 @@ Item{
onLoaded: handleFontChanged()
}
property real fontScaling: 1.0
onFontScalingChanged: handleFontChanged();
signal fontScalingChanged
property var fontScalingList: fontManager.item.fontScalingList
property var fontScalingIndexes: [5,1,1]
function incrementScaling(){
fontScaling = Math.min(fontScaling + 0.05, 2.50);
function setScalingIndex(newScaling){
fontScalingIndexes[rasterization] = newScaling;
fontScalingChanged();
handleFontChanged();
}
function decrementScaling(){
fontScaling = Math.max(fontScaling - 0.05, 0.50);
handleFontChanged();
function getScalingIndex(){
return fontScalingIndexes[rasterization];
}
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.scaling = fontScaling * window_scaling;
fontManager.item.selectedScalingIndex = fontScalingIndexes[rasterization];
var fontSource = fontManager.item.source;
var pixelSize = fontManager.item.pixelSize;
var lineSpacing = fontManager.item.lineSpacing;
var screenScaling = fontManager.item.screenScaling;
var virtualCharSize = fontManager.item.virtualCharSize;
terminalFontChanged(fontSource, pixelSize, lineSpacing, screenScaling);
terminalFontChanged(fontSource, pixelSize, lineSpacing, virtualCharSize);
}
// FRAMES /////////////////////////////////////////////////////////////////
@@ -171,25 +158,21 @@ Item{
fps: fps,
window_scaling: window_scaling,
show_terminal_size: show_terminal_size,
fontScaling: fontScaling,
fontScalingIndexes: fontScalingIndexes,
fontIndexes: fontIndexes,
frameReflections: _frameReflections,
showMenubar: showMenubar,
scanline_quality: scanline_quality,
bloom_quality: bloom_quality
showMenubar: showMenubar
}
return JSON.stringify(settings);
}
function composeProfileObject(){
var profile = {
function composeProfileString(){
var settings = {
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,
@@ -197,19 +180,13 @@ 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],
fontWidth: fontWidth
fontIndex: fontIndexes[rasterization]
}
return profile;
}
function composeProfileString(){
return JSON.stringify(composeProfileObject());
return JSON.stringify(settings);
}
function loadSettings(){
@@ -245,14 +222,11 @@ Item{
window_scaling = settings.window_scaling !== undefined ? settings.window_scaling : window_scaling
fontIndexes = settings.fontIndexes !== undefined ? settings.fontIndexes : fontIndexes
fontScaling = settings.fontScaling !== undefined ? settings.fontScaling : fontScaling
fontScalingIndexes = settings.fontScalingIndexes !== undefined ? settings.fontScalingIndexes : fontScalingIndexes
_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){
@@ -264,8 +238,6 @@ 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;
@@ -278,15 +250,12 @@ 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(){
@@ -338,81 +307,49 @@ 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,"chroma_color":0,"saturation_color":0,"rgb_shift":0,"fontWidth":1.0}'
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}'
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,"chroma_color":0,"saturation_color":0,"rgb_shift":0,"fontWidth":1.0}'
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}'
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,"chroma_color":0,"saturation_color":0,"rgb_shift":0,"fontWidth":1.0}'
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}'
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,"chroma_color":0,"saturation_color":0,"rgb_shift":0,"fontWidth":1.0}'
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}'
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,"chroma_color":0,"saturation_color":0,"rgb_shift":0,"fontWidth":1.0}'
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}'
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,"chroma_color":0,"saturation_color":0,"rgb_shift":0,"fontWidth":1.0}'
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}'
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,"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}'
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}'
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,"chroma_color":0,"saturation_color":0,"rgb_shift":0,"fontWidth":1.0}'
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}'
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: {
// Manage the arguments from the QML side.
var args = Qt.application.arguments;
if (args.indexOf("--default-settings") === -1) {
loadSettings();
}
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();

View File

@@ -1,10 +1,10 @@
/*******************************************************************************
* Copyright (c) 2013 "Filippo Scognamiglio"
* https://github.com/Swordfish90/cool-retro-term
* https://github.com/Swordifish90/cool-old-term
*
* This file is part of cool-retro-term.
* This file is part of cool-old-term.
*
* cool-retro-term is free software: you can redistribute it and/or modify
* 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.
@@ -23,48 +23,30 @@ import QtQuick.Controls 1.1
import QtQuick.Layouts 1.1
RowLayout {
property bool enabled: true
property alias name: check.text
property double value
property double value: (check.checked) ? _value : 0.0
property alias _value: slider.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
onClicked: {
if(!checked){
checked = false;
slider.enabled = false;
newValue(0);
} else {
checked = true;
newValue(slider.value);
slider.enabled = true;
}
}
Component.onCompleted: checked = (_value !== 0);
enabled: parent.enabled
}
Slider{
id: slider
stepSize: parent.stepSize
Layout.fillWidth: true
onValueChanged: {
newValue(value);
}
enabled: check.checked && parent.enabled
}
Text{
id: textfield

View File

@@ -1,10 +1,10 @@
/*******************************************************************************
* Copyright (c) 2013 "Filippo Scognamiglio"
* https://github.com/Swordfish90/cool-retro-term
* https://github.com/Swordifish90/cool-old-term
*
* This file is part of cool-retro-term.
* This file is part of cool-old-term.
*
* cool-retro-term is free software: you can redistribute it and/or modify
* 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.

View File

@@ -1,50 +0,0 @@
#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

View File

@@ -1,10 +1,10 @@
/*******************************************************************************
* Copyright (c) 2013 "Filippo Scognamiglio"
* https://github.com/Swordfish90/cool-retro-term
* https://github.com/Swordifish90/cool-old-term
*
* This file is part of cool-retro-term.
* This file is part of cool-old-term.
*
* cool-retro-term is free software: you can redistribute it and/or modify
* 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.
@@ -22,13 +22,16 @@ import QtQuick 2.2
Item{
property int selectedFontIndex
property real scaling
property int selectedScalingIndex
property alias fontlist: fontlist
property var _font: fontlist.get(selectedFontIndex)
property var _scaling: fontScalingList[selectedScalingIndex]
property var source: _font.source
property int pixelSize: _font.pixelSize
property int lineSpacing: _font.lineSpacing
property real screenScaling: scaling * _font.baseScaling
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)
ListModel{
id: fontlist
@@ -36,29 +39,33 @@ Item{
text: "Commodore PET (1977)"
source: "fonts/1977-commodore-pet/COMMODORE_PET.ttf"
lineSpacing: 2
pixelSize: 8
baseScaling: 4.0
virtualCharWidth: 8
virtualCharHeight: 8
pixelSize: 32
}
ListElement{
text: "Apple ][ (1977)"
source: "fonts/1977-apple2/PrintChar21.ttf"
lineSpacing: 2
pixelSize: 8
baseScaling: 4.0
virtualCharWidth: 7
virtualCharHeight: 8
pixelSize: 32
}
ListElement{
text: "Atari 400-800 (1979)"
source: "fonts/1979-atari-400-800/ATARI400800_original.TTF"
lineSpacing: 3
pixelSize: 8
baseScaling: 4.0
virtualCharWidth: 8
virtualCharHeight: 8
pixelSize: 32
}
ListElement{
text: "Commodore 64 (1982)"
source: "fonts/1982-commodore64/C64_User_Mono_v1.0-STYLE.ttf"
lineSpacing: 3
pixelSize: 8
baseScaling: 4.0
virtualCharWidth: 8
virtualCharHeight: 8
pixelSize: 32
}
}
}

View File

@@ -1,10 +1,10 @@
/*******************************************************************************
* Copyright (c) 2013 "Filippo Scognamiglio"
* https://github.com/Swordfish90/cool-retro-term
* https://github.com/Swordifish90/cool-old-term
*
* This file is part of cool-retro-term.
* This file is part of cool-old-term.
*
* cool-retro-term is free software: you can redistribute it and/or modify
* 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.
@@ -22,43 +22,58 @@ import QtQuick 2.2
Item{
property int selectedFontIndex
property real scaling
property int selectedScalingIndex
property alias fontlist: fontlist
property var _font: fontlist.get(selectedFontIndex)
property var _scaling: fontScalingList[selectedScalingIndex]
property var source: _font.source
property int pixelSize: _font.pixelSize
property int lineSpacing: _font.lineSpacing
property real screenScaling: scaling * _font.baseScaling
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)
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
pixelSize: 8
baseScaling: 4.0
virtualCharWidth: 8
virtualCharHeight: 8
pixelSize: 32
}
ListElement{
text: "Apple ][ (1977)"
source: "fonts/1977-apple2/PrintChar21.ttf"
lineSpacing: 2
pixelSize: 8
baseScaling: 4.0
virtualCharWidth: 8
virtualCharHeight: 8
pixelSize: 32
}
ListElement{
text: "Atari 400-800 (1979)"
source: "fonts/1979-atari-400-800/ATARI400800_original.TTF"
lineSpacing: 3
pixelSize: 8
baseScaling: 4.0
virtualCharWidth: 8
virtualCharHeight: 8
pixelSize: 32
}
ListElement{
text: "Commodore 64 (1982)"
source: "fonts/1982-commodore64/C64_User_Mono_v1.0-STYLE.ttf"
lineSpacing: 3
pixelSize: 8
baseScaling: 4.0
virtualCharWidth: 8
virtualCharHeight: 8
pixelSize: 32
}
}
}

View File

@@ -1,10 +1,10 @@
/*******************************************************************************
* Copyright (c) 2013 "Filippo Scognamiglio"
* https://github.com/Swordfish90/cool-retro-term
* https://github.com/Swordifish90/cool-old-term
*
* This file is part of cool-retro-term.
* This file is part of cool-old-term.
*
* cool-retro-term is free software: you can redistribute it and/or modify
* 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.
@@ -22,13 +22,14 @@ import QtQuick 2.2
Item{
property int selectedFontIndex
property real scaling
property int selectedScalingIndex
property alias fontlist: fontlist
property var source: fontlist.get(selectedFontIndex).source
property var _font: fontlist.get(selectedFontIndex)
property int pixelSize: _font.pixelSize * scaling
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 lineSpacing: pixelSize * _font.lineSpacing
property real screenScaling: 1.0
//In this configuration lineSpacing is proportional to pixelSize.
@@ -82,11 +83,5 @@ Item{
lineSpacing: 0.2
pixelSize: 32
}
ListElement{
text: "IBM 3278 (1971)"
source: "fonts/1971-ibm-3278/3270Medium.ttf"
lineSpacing: 0.2
pixelSize: 32
}
}
}

View File

@@ -1,10 +1,10 @@
/*******************************************************************************
* Copyright (c) 2013 "Filippo Scognamiglio"
* https://github.com/Swordfish90/cool-retro-term
* https://github.com/Swordifish90/cool-old-term
*
* This file is part of cool-retro-term.
* This file is part of cool-old-term.
*
* cool-retro-term is free software: you can redistribute it and/or modify
* 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.
@@ -22,41 +22,16 @@ 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 new profile")
title: qsTr("Save current 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
@@ -66,29 +41,16 @@ 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: 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();
}
onClicked: {
nameSelected(namefield.text);
close();
}
}
Button{

View File

@@ -0,0 +1,426 @@
/*******************************************************************************
* 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
}
}

View File

@@ -1,10 +1,10 @@
/*******************************************************************************
* Copyright (c) 2013 "Filippo Scognamiglio"
* https://github.com/Swordfish90/cool-retro-term
* https://github.com/Swordifish90/cool-old-term
*
* This file is part of cool-retro-term.
* This file is part of cool-old-term.
*
* cool-retro-term is free software: you can redistribute it and/or modify
* 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.
@@ -30,55 +30,49 @@ Tab{
anchors.fill: parent
CheckableSlider{
name: qsTr("Bloom")
onNewValue: shadersettings.bloom_strength = newValue
value: shadersettings.bloom_strength
onValueChanged: shadersettings.bloom_strength = value
_value: shadersettings.bloom_strength
}
CheckableSlider{
name: qsTr("Motion Blur")
onNewValue: shadersettings.motion_blur = newValue
value: shadersettings.motion_blur
onValueChanged: shadersettings.motion_blur = value
_value: shadersettings.motion_blur
}
CheckableSlider{
name: qsTr("Noise")
onNewValue: shadersettings.noise_strength = newValue
value: shadersettings.noise_strength
onValueChanged: shadersettings.noise_strength = value
_value: shadersettings.noise_strength
}
CheckableSlider{
name: qsTr("Jitter")
onNewValue: shadersettings.jitter = newValue
value: shadersettings.jitter
onValueChanged: shadersettings.jitter = value
_value: shadersettings.jitter
}
CheckableSlider{
name: qsTr("Glow")
onNewValue: shadersettings.glowing_line_strength = newValue;
value: shadersettings.glowing_line_strength
onValueChanged: shadersettings.glowing_line_strength = value;
_value: shadersettings.glowing_line_strength
}
CheckableSlider{
name: qsTr("Screen distortion")
onNewValue: shadersettings.screen_distortion = newValue;
value: shadersettings.screen_distortion;
onValueChanged: shadersettings.screen_distortion = value;
_value: shadersettings.screen_distortion;
}
CheckableSlider{
name: qsTr("Ambient light")
onNewValue: shadersettings.ambient_light = newValue;
value: shadersettings.ambient_light
onValueChanged: shadersettings.ambient_light = value;
_value: shadersettings.ambient_light
enabled: shadersettings.frames_index !== 0
}
CheckableSlider{
name: qsTr("Brightness flickering")
onNewValue: shadersettings.brightness_flickering = newValue;
value: shadersettings.brightness_flickering;
onValueChanged: shadersettings.brightness_flickering= value;
_value: shadersettings.brightness_flickering;
}
CheckableSlider{
name: qsTr("Horizontal flickering")
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
onValueChanged: shadersettings.horizontal_sincronization = value;
_value: shadersettings.horizontal_sincronization;
}
}
}

View File

@@ -1,10 +1,10 @@
/*******************************************************************************
* Copyright (c) 2013 "Filippo Scognamiglio"
* https://github.com/Swordfish90/cool-retro-term
* https://github.com/Swordifish90/cool-old-term
*
* This file is part of cool-retro-term.
* This file is part of cool-old-term.
*
* cool-retro-term is free software: you can redistribute it and/or modify
* 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.
@@ -21,7 +21,6 @@
import QtQuick 2.2
import QtQuick.Controls 1.1
import QtQuick.Layouts 1.1
import QtQuick.Dialogs 1.1
Tab{
ColumnLayout{
@@ -50,7 +49,7 @@ Tab{
}
Button{
Layout.fillWidth: true
text: qsTr("Save New Profile")
text: qsTr("Store current")
onClicked: insertname.show()
}
Button{
@@ -63,67 +62,10 @@ 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{
@@ -150,17 +92,49 @@ Tab{
}
}
GroupBox{
title: qsTr("Frame")
title: qsTr("Performace")
Layout.fillWidth: true
RowLayout{
Layout.columnSpan: 2
anchors.left: parent.left
anchors.right: parent.right
GridLayout{
anchors.fill: parent
ComboBox{
id: framescombobox
Layout.fillWidth: true
model: shadersettings.frames_list
currentIndex: shadersettings.frames_index
onCurrentIndexChanged: shadersettings.frames_index = currentIndex
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
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
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) + "%"}
}
}
}

View File

@@ -1,10 +1,10 @@
/*******************************************************************************
* Copyright (c) 2013 "Filippo Scognamiglio"
* https://github.com/Swordfish90/cool-retro-term
* https://github.com/Swordifish90/cool-old-term
*
* This file is part of cool-retro-term.
* This file is part of cool-old-term.
*
* cool-retro-term is free software: you can redistribute it and/or modify
* 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.
@@ -35,8 +35,11 @@ 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;
}
}
}
@@ -64,39 +67,24 @@ Tab{
RowLayout{
Layout.fillWidth: true
Slider{
id: scalingChanger
Layout.fillWidth: true
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;
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);
}
Connections{
target: shadersettings
onFontScalingChanged: fontScalingChanger.value = shadersettings.fontScaling;
function updateIndex(){
value = shadersettings.getScalingIndex();
}
Component.onCompleted: shadersettings.fontScalingChanged.connect(updateIndex);
}
Text{
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) + "%"
text: shadersettings.fontScalingList[scalingChanger.value].toFixed(2)
}
}
}
@@ -104,38 +92,35 @@ Tab{
GroupBox{
title: qsTr("Colors")
Layout.fillWidth: true
ColumnLayout{
RowLayout{
anchors.fill: parent
RowLayout{
ColorButton{
name: qsTr("Font")
height: 50
Layout.fillWidth: true
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
}
onColorSelected: shadersettings._font_color = color;
button_color: shadersettings._font_color
}
ColumnLayout{
ColorButton{
name: qsTr("Background")
height: 50
Layout.fillWidth: true
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
}
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
}
}
}

View File

@@ -1,10 +1,10 @@
/*******************************************************************************
* Copyright (c) 2013 "Filippo Scognamiglio"
* https://github.com/Swordfish90/cool-retro-term
* https://github.com/Swordifish90/cool-old-term
*
* This file is part of cool-retro-term.
* This file is part of cool-old-term.
*
* cool-retro-term is free software: you can redistribute it and/or modify
* 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.
@@ -28,37 +28,27 @@ Window {
id: settings_window
title: qsTr("Settings")
width: 640
height: 440
height: 450
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
}
}
}

200
app/ShaderTerminal.qml Normal file
View File

@@ -0,0 +1,200 @@
/*******************************************************************************
* 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
}

View File

@@ -1,10 +1,10 @@
/*******************************************************************************
* Copyright (c) 2013 "Filippo Scognamiglio"
* https://github.com/Swordfish90/cool-retro-term
* https://github.com/Swordifish90/cool-old-term
*
* This file is part of cool-retro-term.
* This file is part of cool-old-term.
*
* cool-retro-term is free software: you can redistribute it and/or modify
* 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.

View File

@@ -1,10 +1,10 @@
/*******************************************************************************
* Copyright (c) 2013 "Filippo Scognamiglio"
* https://github.com/Swordfish90/cool-retro-term
* https://github.com/Swordifish90/cool-old-term
*
* This file is part of cool-retro-term.
* This file is part of cool-old-term.
*
* cool-retro-term is free software: you can redistribute it and/or modify
* 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.

View File

@@ -1,10 +1,10 @@
/*******************************************************************************
* Copyright (c) 2013 "Filippo Scognamiglio"
* https://github.com/Swordfish90/cool-retro-term
* https://github.com/Swordifish90/cool-old-term
*
* This file is part of cool-retro-term.
* This file is part of cool-old-term.
*
* cool-retro-term is free software: you can redistribute it and/or modify
* 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.

View File

@@ -1,10 +1,10 @@
/*******************************************************************************
* Copyright (c) 2013 "Filippo Scognamiglio"
* https://github.com/Swordfish90/cool-retro-term
* https://github.com/Swordifish90/cool-old-term
*
* This file is part of cool-retro-term.
* This file is part of cool-old-term.
*
* cool-retro-term is free software: you can redistribute it and/or modify
* 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.

View File

@@ -1,20 +0,0 @@
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

View File

@@ -7,19 +7,22 @@ TerminalFrame{
anchors.fill: parent
addedWidth: 200
addedHeight: 370
borderLeft: 170
borderRight: 170
borderTop: 250
borderBottom: 250
borderLeft: 148
borderRight: 148
borderTop: 232
borderBottom: 232
imageSource: "../images/black-frame.png"
normalsSource: "../images/black-frame-normals.png"
rectX: 20
rectY: 20
distortionCoefficient: 1.9
displacementLeft: 80.0
displacementTop: 65.0
displacementRight: 80.0
displacementBottom: 65.0
displacementLeft: 70.0
displacementTop: 55.0
displacementRight: 50.0
displacementBottom: 38.0
shaderString: "FrameShader.qml"
}

View File

@@ -12,6 +12,9 @@ TerminalFrame{
borderTop: 0
borderBottom: 0
rectX: 15
rectY: 15
displacementLeft: 0
displacementTop: 0
displacementRight: 0

View File

@@ -14,12 +14,15 @@ TerminalFrame{
imageSource: "../images/screen-frame.png"
normalsSource: "../images/screen-frame-normals.png"
rectX: 15
rectY: 15
distortionCoefficient: 1.5
displacementLeft: 55
displacementTop: 50
displacementRight: 55
displacementBottom: 50
displacementLeft: 45
displacementTop: 40
displacementRight: 38.0
displacementBottom: 28.0
shaderString: "FrameShader.qml"
}

View File

Before

Width:  |  Height:  |  Size: 1.1 MiB

After

Width:  |  Height:  |  Size: 1.1 MiB

View File

Before

Width:  |  Height:  |  Size: 1.1 MiB

After

Width:  |  Height:  |  Size: 1.1 MiB

View File

Before

Width:  |  Height:  |  Size: 1.2 MiB

After

Width:  |  Height:  |  Size: 1.2 MiB

View File

Before

Width:  |  Height:  |  Size: 132 KiB

After

Width:  |  Height:  |  Size: 132 KiB

View File

Before

Width:  |  Height:  |  Size: 507 KiB

After

Width:  |  Height:  |  Size: 507 KiB

View File

Before

Width:  |  Height:  |  Size: 571 KiB

After

Width:  |  Height:  |  Size: 571 KiB

View File

Before

Width:  |  Height:  |  Size: 811 KiB

After

Width:  |  Height:  |  Size: 811 KiB

View File

@@ -13,8 +13,6 @@ 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
@@ -47,8 +45,7 @@ ShaderEffect{
uniform sampler2D normals;
uniform highp float screen_distorsion;
uniform highp float ambient_light;
uniform highp float qt_Opacity;
uniform lowp float chroma_color;" +
uniform highp float qt_Opacity;" +
(frameReflections ?
"uniform sampler2D lightSource;" : "") + "
@@ -65,10 +62,6 @@ 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);
@@ -79,20 +72,16 @@ ShaderEffect{
float dotProd = dot(normal, light_direction);" +
(frameReflections ? "
vec3 realLightColor = texture2D(lightSource, coords).rgb;
float screenLight = rgb2grey(realLightColor);
float screenLight = texture2D(lightSource, coords).r;
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);
vec3 lightColor = mix(font_color.rgb * screenLight, font_color.rgb * realLightColor, chroma_color);"
float reflectionAlpha = mix(1.0, 0.90, dotProd);"
: "
float diffuseReflection = 0.0;
float reflectionAlpha = 1.0;
vec3 lightColor = font_color.rgb;") + "
float reflectionAlpha = 1.0;") + "
vec3 back_color = background_color.rgb * (0.2 + 0.5 * dotProd);
vec3 front_color = lightColor * (0.05 + diffuseReflection);
vec3 front_color = font_color.rgb * (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);

View File

@@ -15,6 +15,10 @@ 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
@@ -23,6 +27,11 @@ 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

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

View File

@@ -1,55 +0,0 @@
#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 Normal file
View File

@@ -0,0 +1,193 @@
/*******************************************************************************
* 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();
}

View File

@@ -1,51 +0,0 @@
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}
}
}

View File

@@ -1,444 +0,0 @@
/*******************************************************************************
* 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
}
}

View File

@@ -1,159 +0,0 @@
/*******************************************************************************
* 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
}
}
}
}

View File

@@ -1,277 +0,0 @@
/*******************************************************************************
* 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;
}
}
}

View File

@@ -1,55 +0,0 @@
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
}
}
}

View File

@@ -1,13 +0,0 @@
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.

View File

@@ -1,73 +0,0 @@
3270font: A font for the nostalgic
==================================
https://github.com/rbanffy/3270font
![Screenshot](https://raw.github.com/wiki/rbanffy/3270font/emacs.png)
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).

Binary file not shown.

Before

Width:  |  Height:  |  Size: 62 KiB

View File

@@ -1,129 +0,0 @@
/*******************************************************************************
* 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();
}

View File

@@ -1,71 +0,0 @@
<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>

4
cool-old-term Executable file
View File

@@ -0,0 +1,4 @@
#!/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

3
cool-old-term.pro Normal file
View File

@@ -0,0 +1,3 @@
TEMPLATE =subdirs
CONFIG += ordered
SUBDIRS= konsole-qml-plugin

View File

@@ -1,11 +0,0 @@
[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

View File

@@ -1,9 +0,0 @@
TEMPLATE = subdirs
SUBDIRS += app
SUBDIRS += konsole-qml-plugin
desktop.files += cool-retro-term.desktop
desktop.path += /usr/share/applications
INSTALLS += desktop

View File

@@ -36,23 +36,22 @@ color 1 0 0 0 1 0 # regular background color (Black)
color 2 0 0 0 0 0 # regular color 0 Black
color 3 255 43 43 0 0 # regular color 1 Red
color 3 59 59 59 0 0 # regular color 1 Red
color 4 28 172 120 0 0 # regular color 2 Green
color 4 137 137 137 0 0 # regular color 2 Green
color 5 248 213 104 0 0 # regular color 3 Yellow
color 5 116 116 116 0 0 # regular color 3 Yellow
color 6 43 108 196 0 0 # regular color 4 Blue
color 6 39 39 39 0 0 # regular color 4 Blue
color 7 255 29 206 0 0 # regular color 5 Magenta
color 7 70 70 70 0 0 # regular color 5 Magenta
color 8 24 167 181 0 0 # regular color 6 Cyan
color 8 148 148 148 0 0 # regular color 6 Cyan
color 9 179 179 179 0 0 # regular color 7 White
# intensive colors
@@ -69,17 +68,17 @@ color 11 0 0 0 1 0 # intensive background color
color 12 106 106 106 0 0 # intensive color 0
color 13 253 94 83 0 0 # intensive color 1
color 13 122 122 122 0 0 # intensive color 1
color 14 168 228 160 0 0 # intensive color 2
color 14 207 207 207 0 0 # intensive color 2
color 15 254 254 34 0 0 # intensive color 3
color 15 243 243 243 0 0 # intensive color 3
color 16 154 206 235 0 0 # intensive color 4
color 16 99 99 99 0 0 # intensive color 4
color 17 252 116 253 0 0 # intensive color 5
color 17 134 134 134 0 0 # intensive color 5
color 18 236 234 190 0 0 # intensive color 6
color 18 219 219 219 0 0 # intensive color 6
color 19 255 255 255 0 0 # intensive color 7

View File

@@ -1,196 +0,0 @@
# [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

View File

@@ -0,0 +1,29 @@
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

View File

@@ -0,0 +1,40 @@
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.

View File

@@ -0,0 +1,50 @@
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/3.0/
Upstream-Name: konsole-qml-plugin
Source:
Files: *
Copyright: 2013 Dmitry Zagnoyko <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".

21
konsole-qml-plugin/debian/rules Executable file
View File

@@ -0,0 +1,21 @@
#!/usr/bin/make -f
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
#export CFLAGS := $(shell dpkg-buildflags --get CFLAGS) $(shell dpkg-buildflags --get CPPFLAGS)
#export CXXFLAGS := $(shell dpkg-buildflags --get CXXFLAGS) $(shell dpkg-buildflags --get CPPFLAGS)
#export LDFLAGS := $(shell dpkg-buildflags --get LDFLAGS) -Wl,--as-needed
override_dh_auto_configure:
QT_SELECT=qt5 dh_auto_configure
%:
dh $@ --list-missing --parallel
# WARN: currently, no pakgage
# --dbg-package=konsole-qml-plugin-dbg
#override_dh_builddeb:
# dh_builddeb -- -Zxz

View File

@@ -0,0 +1 @@
3.0 (native)

View File

@@ -6,43 +6,16 @@ TEMPLATE = lib
CONFIG += qt plugin hide_symbols
QT += qml quick widgets
DEFINES += HAVE_POSIX_OPENPT HAVE_SYS_TIME_H
!macx:DEFINES += HAVE_UPDWTMPX
macx:DEFINES += HAVE_UTMPX HAVE_UT_USER
DEFINES += HAVE_POSIX_OPENPT HAVE_SYS_TIME_H HAVE_UPDWTMPX
#MANUALY DEFINED PLATFORM
DEFINES += Q_WS_UBUNTU
TARGET = kdekonsole
PLUGIN_IMPORT_PATH = org/crt/konsole
PLUGIN_IMPORT_PATH = org/kde/konsole
PLUGIN_ASSETS = $$PWD/assets/*
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)
INSTALL_DIR = ../imports
#########################################
## SOURCES
@@ -70,7 +43,8 @@ SOURCES += \
$$PWD/src/Filter.cpp \
$$PWD/src/ColorScheme.cpp \
$$PWD/src/TerminalDisplay.cpp \
$$PWD/src/ksession.cpp
$$PWD/src/ksession.cpp \
$$PWD/src/utmpmac.cpp
HEADERS += \
$$PWD/src/plugin.h \
@@ -102,6 +76,7 @@ HEADERS += \
$$PWD/src/ColorScheme.h \
$$PWD/src/TerminalDisplay.h \
$$PWD/src/ksession.h
$$PWD/src/utmpmac.h
OTHER_FILES += \
$$PWD/src/qmldir \

View File

@@ -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

View File

@@ -376,12 +376,6 @@ 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.

View File

@@ -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() && sequence[0] != Qt::Key_unknown )
if ( !sequence.isEmpty() )
{
keyCode = sequence[0];
@@ -453,18 +453,6 @@ 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;

View File

@@ -1358,13 +1358,3 @@ 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;
}

View File

@@ -42,7 +42,6 @@
class TerminalCharacterDecoder;
class KTerminalDisplay;
/**
\brief An image of characters with associated attributes.
@@ -544,11 +543,6 @@ 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
@@ -672,8 +666,6 @@ private:
int lastPos;
static Character defaultChar;
KTerminalDisplay* _currentTerminalDisplay;
};

View File

@@ -31,7 +31,8 @@
#include <stdlib.h>
// Qt
#include <QQuickWindow>
#include <QGuiApplication>
#include <QtGui/QWindow>
#include <QtCore/QByteRef>
#include <QtCore/QDir>
@@ -47,9 +48,8 @@
#include "ShellCommand.h" // REUSE THIS
#include "Vt102Emulation.h" // REUSE THIS
int Session::lastSessionId = 0;
using namespace Konsole;
int Session::lastSessionId = 0;
Session::Session() :
_shellProcess(0)
@@ -142,12 +142,7 @@ WId Session::windowId() const
// window = window->parentWidget();
// }
//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);
return QGuiApplication::focusWindow()->winId();
}
}
@@ -204,9 +199,14 @@ void Session::addView(KTerminalDisplay * widget)
// allow emulation to notify view when the foreground process
// indicates whether or not it is interested in mouse signals
connect( _emulation , SIGNAL(programUsesMouseChanged(bool)) , widget ,
SLOT(setUsesMouse(bool)) );
widget->setUsesMouse( _emulation->programUsesMouse() );
// 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() );
widget->setScreenWindow(_emulation->createWindow());
}
@@ -307,13 +307,6 @@ 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;

Some files were not shown because too many files have changed in this diff Show More