Compare commits
21 Commits
fix-qml-st
...
osx-fixes
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b0f3b8f3d0 | ||
|
|
06e7191056 | ||
|
|
997131ba64 | ||
|
|
ef9f412e5f | ||
|
|
7b69d41c60 | ||
|
|
552947f507 | ||
|
|
f69f2df63c | ||
|
|
aa270067f6 | ||
|
|
28977313da | ||
|
|
cfe35d7795 | ||
|
|
4abbe332db | ||
|
|
3104abd4ad | ||
|
|
7714f7b503 | ||
|
|
9d06f10a9b | ||
|
|
8c27f7683b | ||
|
|
bf1a491789 | ||
|
|
0f18a0349a | ||
|
|
39181f42cf | ||
|
|
3d706ad1a7 | ||
|
|
a31b77e5bc | ||
|
|
b417643415 |
14
README.md
14
README.md
@@ -8,7 +8,7 @@
|
||||
cool-retro-term is a terminal emulator which mimics the look and feel of the old cathode tube screens.
|
||||
It has been designed to be eye-candy, customizable, and reasonably lightweight.
|
||||
|
||||
It uses the QML port of qtermwidget (Konsole) developed by me: https://github.com/Swordfish90/qmltermwidget .
|
||||
It uses the QML port of qtermwidget (Konsole) developed by me: https://github.com/Swordfish90/qmltermwidget.
|
||||
|
||||
This terminal emulator works under Linux and macOS and requires Qt 5.2 or higher.
|
||||
|
||||
@@ -51,9 +51,13 @@ Users of **Ubuntu 14.04 LTS (Trusty) up to 15.10 (Wily)** can use [this PPA](htt
|
||||
eopkg it cool-retro-term
|
||||
```
|
||||
|
||||
**macOS** users can grab the latest dmg from the [release page](https://github.com/Swordfish90/cool-retro-term/releases) or install via Homebrew:
|
||||
**macOS** users can grab the latest dmg from the [release page](https://github.com/Swordfish90/cool-retro-term/releases) or install via Homebrew or MacPorts:
|
||||
```
|
||||
brew cask install cool-retro-term
|
||||
brew install cool-retro-term --cask
|
||||
```
|
||||
or
|
||||
```
|
||||
port install cool-retro-term
|
||||
```
|
||||
|
||||
**FreeBSD** users can install cool-retro-term with `pkg`:
|
||||
@@ -202,10 +206,10 @@ open cool-retro-term.app
|
||||
**Homebrew**
|
||||
|
||||
```sh
|
||||
brew cask install cool-retro-term
|
||||
brew install cool-retro-term --cask
|
||||
```
|
||||
|
||||
## Donations
|
||||
I made this project in my spare time because I love what I'm doing. If you are enjoying it and you want to buy me a beer click [here](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=flscogna%40gmail%2ecom&lc=IT&item_name=Filippo%20Scognamiglio¤cy_code=EUR&bn=PP%2dDonationsBF%3abtn_donate_LG%2egif%3aNonHosted).
|
||||
I made this project in my spare time because I love what I'm doing. If you are enjoying it, and you want to buy me a beer click [here](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=flscogna%40gmail%2ecom&lc=IT&item_name=Filippo%20Scognamiglio¤cy_code=EUR&bn=PP%2dDonationsBF%3abtn_donate_LG%2egif%3aNonHosted).
|
||||
|
||||
You can also add "bounties" on your favourite issues. More information on the [Bountysource](https://www.bountysource.com/teams/crt/issues) page.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
QT += qml quick widgets sql
|
||||
QT += qml quick widgets sql quickcontrols2
|
||||
TARGET = cool-retro-term
|
||||
|
||||
DESTDIR = $$OUT_PWD/../
|
||||
|
||||
12
app/main.cpp
12
app/main.cpp
@@ -6,11 +6,13 @@
|
||||
|
||||
#include <QtWidgets/QApplication>
|
||||
#include <QIcon>
|
||||
#include <QQuickStyle>
|
||||
|
||||
#include <QDebug>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <QFontDatabase>
|
||||
#include <QLoggingCategory>
|
||||
|
||||
#include <fileio.h>
|
||||
#include <monospacefontmanager.h>
|
||||
@@ -33,6 +35,9 @@ int main(int argc, char *argv[])
|
||||
// This disables QT appmenu under Ubuntu, which is not working with QML apps.
|
||||
setenv("QT_QPA_PLATFORMTHEME", "", 1);
|
||||
|
||||
// Disable Connections slot warnings
|
||||
QLoggingCategory::setFilterRules("qt.qml.connections.warning=false");
|
||||
|
||||
#if defined (Q_OS_LINUX)
|
||||
setenv("QSG_RENDER_LOOP", "threaded", 0);
|
||||
#endif
|
||||
@@ -42,6 +47,9 @@ int main(int argc, char *argv[])
|
||||
setenv("LC_CTYPE", "UTF-8", 1);
|
||||
#endif
|
||||
|
||||
// Force fusion style on every platform
|
||||
QQuickStyle::setStyle("Fusion");
|
||||
|
||||
if (argc>1 && (!strcmp(argv[1],"-h") || !strcmp(argv[1],"--help"))) {
|
||||
QTextStream cout(stdout, QIODevice::WriteOnly);
|
||||
cout << "Usage: " << argv[0] << " [--default-settings] [--workdir <dir>] [--program <prog>] [-p|--profile <prof>] [--fullscreen] [-h|--help]" << endl;
|
||||
@@ -65,9 +73,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
QApplication app(argc, argv);
|
||||
// set application attributes
|
||||
// Has no effects, see https://bugreports.qt.io/browse/QTBUG-51293
|
||||
// app.setAttribute(Qt::AA_MacDontSwapCtrlAndMeta, true);
|
||||
app.setAttribute(Qt::AA_MacDontSwapCtrlAndMeta, true);
|
||||
|
||||
QQmlApplicationEngine engine;
|
||||
FileIO fileIO;
|
||||
|
||||
@@ -34,6 +34,8 @@ QtObject {
|
||||
readonly property real minBurnInFadeTime: 160
|
||||
readonly property real maxBurnInFadeTime: 1600
|
||||
|
||||
property bool isMacOS: Qt.platform.os === "osx"
|
||||
|
||||
// GENERAL SETTINGS ///////////////////////////////////////////////////////
|
||||
property int x: 100
|
||||
property int y: 100
|
||||
@@ -41,7 +43,7 @@ QtObject {
|
||||
property int height: 768
|
||||
|
||||
property bool fullscreen: false
|
||||
property bool showMenubar: Qt.platform.os === "osx" ? true : false
|
||||
property bool showMenubar: false
|
||||
|
||||
property string wintitle: "cool-retro-term"
|
||||
|
||||
@@ -52,9 +54,7 @@ QtObject {
|
||||
property bool verbose: false
|
||||
|
||||
property real bloomQuality: 0.5
|
||||
|
||||
property real burnInQuality: 0.5
|
||||
property bool useFastBurnIn: Qt.platform.os === "osx" ? false : true
|
||||
|
||||
property bool blinkingCursor: false
|
||||
|
||||
@@ -99,11 +99,17 @@ QtObject {
|
||||
property real rbgShift: 0.0
|
||||
|
||||
property real _margin: 0.5
|
||||
property real _frameMargin: 0.5
|
||||
|
||||
property real margin: Utils.lint(1.0, 20.0, _margin)
|
||||
property real frameMargin: Utils.lint(1.0, 50.0, _frameMargin)
|
||||
|
||||
property real totalMargin: frameMargin + margin
|
||||
|
||||
readonly property int no_rasterization: 0
|
||||
readonly property int scanline_rasterization: 1
|
||||
readonly property int pixel_rasterization: 2
|
||||
readonly property int subpixel_rasterization: 3
|
||||
|
||||
property int rasterization: no_rasterization
|
||||
|
||||
@@ -145,6 +151,13 @@ QtObject {
|
||||
target: fontManager
|
||||
source: "FontPixels.qml"
|
||||
}
|
||||
},
|
||||
State {
|
||||
when: rasterization == subpixel_rasterization
|
||||
PropertyChanges {
|
||||
target: fontManager
|
||||
source: "FontPixels.qml"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
@@ -229,9 +242,7 @@ QtObject {
|
||||
"bloomQuality": bloomQuality,
|
||||
"burnInQuality": burnInQuality,
|
||||
"useCustomCommand": useCustomCommand,
|
||||
"customCommand": customCommand,
|
||||
"useFastBurnIn": useFastBurnIn,
|
||||
"blinkingCursor": blinkingCursor
|
||||
"customCommand": customCommand
|
||||
}
|
||||
return stringify(settings)
|
||||
}
|
||||
@@ -258,7 +269,9 @@ QtObject {
|
||||
"windowOpacity": windowOpacity,
|
||||
"fontName": fontNames[rasterization],
|
||||
"fontWidth": fontWidth,
|
||||
"margin": _margin
|
||||
"margin": _margin,
|
||||
"blinkingCursor": blinkingCursor,
|
||||
"frameMargin": _frameMargin,
|
||||
}
|
||||
return settings
|
||||
}
|
||||
@@ -324,12 +337,6 @@ QtObject {
|
||||
!== undefined ? settings.useCustomCommand : useCustomCommand
|
||||
customCommand = settings.customCommand
|
||||
!== undefined ? settings.customCommand : customCommand
|
||||
|
||||
useFastBurnIn = settings.useFastBurnIn
|
||||
!== undefined ? settings.useFastBurnIn : useFastBurnIn
|
||||
|
||||
blinkingCursor = settings.blinkingCursor
|
||||
!== undefined ? settings.blinkingCursor : blinkingCursor
|
||||
}
|
||||
|
||||
function loadProfileString(profileString) {
|
||||
@@ -371,6 +378,9 @@ QtObject {
|
||||
fontWidth = settings.fontWidth !== undefined ? settings.fontWidth : fontWidth
|
||||
|
||||
_margin = settings.margin !== undefined ? settings.margin : _margin
|
||||
_frameMargin = settings.frameMargin !== undefined ? settings.frameMargin : _frameMargin
|
||||
|
||||
blinkingCursor = settings.blinkingCursor !== undefined ? settings.blinkingCursor : blinkingCursor
|
||||
|
||||
handleFontChanged()
|
||||
}
|
||||
@@ -451,7 +461,9 @@ QtObject {
|
||||
"screenCurvature": 0.3,
|
||||
"staticNoise": 0.1198,
|
||||
"windowOpacity": 1,
|
||||
"margin": 0.5
|
||||
"margin": 0.5,
|
||||
"blinkingCursor": false,
|
||||
"frameMargin": 0.1
|
||||
}'
|
||||
builtin: true
|
||||
}
|
||||
@@ -478,7 +490,9 @@ QtObject {
|
||||
"screenCurvature": 0.3,
|
||||
"staticNoise": 0.1198,
|
||||
"windowOpacity": 1,
|
||||
"margin": 0.5
|
||||
"margin": 0.5,
|
||||
"blinkingCursor": false,
|
||||
"frameMargin": 0.1
|
||||
}'
|
||||
builtin: true
|
||||
}
|
||||
@@ -505,7 +519,9 @@ QtObject {
|
||||
"screenCurvature": 0.3,
|
||||
"staticNoise": 0.15,
|
||||
"windowOpacity": 1,
|
||||
"margin": 0.5
|
||||
"margin": 0.5,
|
||||
"blinkingCursor": false,
|
||||
"frameMargin": 0.1
|
||||
}'
|
||||
builtin: true
|
||||
}
|
||||
@@ -532,7 +548,9 @@ QtObject {
|
||||
"screenCurvature": 0,
|
||||
"staticNoise": 0.15,
|
||||
"windowOpacity": 1,
|
||||
"margin": 0.5
|
||||
"margin": 0.5,
|
||||
"blinkingCursor": false,
|
||||
"frameMargin": 0.1
|
||||
}'
|
||||
builtin: true
|
||||
}
|
||||
@@ -559,7 +577,9 @@ QtObject {
|
||||
"screenCurvature": 0.5,
|
||||
"staticNoise": 0.099,
|
||||
"windowOpacity": 1,
|
||||
"margin": 0.5
|
||||
"margin": 0.5,
|
||||
"blinkingCursor": false,
|
||||
"frameMargin": 0.2
|
||||
}'
|
||||
builtin: true
|
||||
}
|
||||
@@ -586,7 +606,9 @@ QtObject {
|
||||
"screenCurvature": 0.5,
|
||||
"staticNoise": 0.2969,
|
||||
"windowOpacity": 1,
|
||||
"margin": 0.5
|
||||
"margin": 0.5,
|
||||
"blinkingCursor": false,
|
||||
"frameMargin": 0.5
|
||||
}'
|
||||
builtin: true
|
||||
}
|
||||
@@ -613,7 +635,9 @@ QtObject {
|
||||
"screenCurvature": 0.4,
|
||||
"staticNoise": 0.0503,
|
||||
"windowOpacity": 1,
|
||||
"margin": 0.5
|
||||
"margin": 0.5,
|
||||
"blinkingCursor": false,
|
||||
"frameMargin": 0.2
|
||||
}'
|
||||
builtin: true
|
||||
}
|
||||
@@ -640,7 +664,9 @@ QtObject {
|
||||
"screenCurvature": 0.2,
|
||||
"staticNoise": 0,
|
||||
"windowOpacity": 1,
|
||||
"margin": 0.5
|
||||
"margin": 0.5,
|
||||
"blinkingCursor": false,
|
||||
"frameMargin": 0.1
|
||||
}'
|
||||
builtin: true
|
||||
}
|
||||
@@ -667,7 +693,9 @@ QtObject {
|
||||
"screenCurvature": 0,
|
||||
"staticNoise": 0.0955,
|
||||
"windowOpacity": 0.7,
|
||||
"margin": 0.1
|
||||
"margin": 0.1,
|
||||
"blinkingCursor": false,
|
||||
"frameMargin": 0
|
||||
}'
|
||||
builtin: true
|
||||
}
|
||||
|
||||
@@ -29,26 +29,29 @@ Loader {
|
||||
property real lastUpdate: 0
|
||||
property real prevLastUpdate: 0
|
||||
|
||||
property real delay: (1.0 / appSettings.fps) * 1000
|
||||
property real burnIn: appSettings.burnIn
|
||||
property real burnInFadeTime: 1 / Utils.lint(_minBurnInFadeTime, _maxBurnInFadeTime, burnIn)
|
||||
property real _minBurnInFadeTime: appSettings.minBurnInFadeTime
|
||||
property real _maxBurnInFadeTime: appSettings.maxBurnInFadeTime
|
||||
|
||||
active: appSettings.useFastBurnIn && appSettings.burnIn !== 0
|
||||
active: appSettings.burnIn !== 0
|
||||
|
||||
anchors.fill: parent
|
||||
|
||||
function completelyUpdate() {
|
||||
prevLastUpdate = lastUpdate;
|
||||
lastUpdate = timeManager.time;
|
||||
item.source.scheduleUpdate();
|
||||
let newTime = timeManager.time
|
||||
if (newTime > lastUpdate) {
|
||||
prevLastUpdate = lastUpdate
|
||||
lastUpdate = newTime
|
||||
}
|
||||
|
||||
item.source.scheduleUpdate()
|
||||
}
|
||||
|
||||
function restartBlurSource(){
|
||||
prevLastUpdate = timeManager.time;
|
||||
lastUpdate = prevLastUpdate;
|
||||
completelyUpdate();
|
||||
function restartBlurSource() {
|
||||
prevLastUpdate = timeManager.time
|
||||
lastUpdate = prevLastUpdate
|
||||
completelyUpdate()
|
||||
}
|
||||
|
||||
sourceComponent: Item {
|
||||
@@ -72,23 +75,37 @@ Loader {
|
||||
|
||||
Connections {
|
||||
target: kterminal
|
||||
onImagePainted: completelyUpdate()
|
||||
|
||||
function onImagePainted() {
|
||||
completelyUpdate()
|
||||
}
|
||||
}
|
||||
// Restart blurred source settings change.
|
||||
Connections{
|
||||
target: appSettings
|
||||
onBurnInChanged: burnInEffect.restartBlurSource();
|
||||
onTerminalFontChanged: burnInEffect.restartBlurSource();
|
||||
onRasterizationChanged: burnInEffect.restartBlurSource();
|
||||
onBurnInQualityChanged: burnInEffect.restartBlurSource();
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: kterminalScrollbar
|
||||
onOpacityChanged: completelyUpdate()
|
||||
target: appSettings
|
||||
|
||||
function onBurnInChanged() {
|
||||
burnInEffect.restartBlurSource()
|
||||
}
|
||||
|
||||
function onTerminalFontChanged() {
|
||||
burnInEffect.restartBlurSource()
|
||||
}
|
||||
|
||||
function onRasterizationChanged() {
|
||||
burnInEffect.restartBlurSource()
|
||||
}
|
||||
|
||||
function onBurnInQualityChanged() {
|
||||
burnInEffect.restartBlurSource()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ShaderLibrary {
|
||||
id: shaderLibrary
|
||||
}
|
||||
|
||||
ShaderEffect {
|
||||
id: burnInShaderEffect
|
||||
|
||||
@@ -118,9 +135,7 @@ Loader {
|
||||
|
||||
uniform highp float prevLastUpdate;" +
|
||||
|
||||
"float rgb2grey(vec3 v){
|
||||
return dot(v, vec3(0.21, 0.72, 0.04));
|
||||
}" +
|
||||
shaderLibrary.rgb2grey +
|
||||
|
||||
"void main() {
|
||||
vec2 coords = qt_TexCoord0;
|
||||
|
||||
@@ -34,10 +34,8 @@ Item {
|
||||
visible: false
|
||||
|
||||
//This is a workaround to a Qt 5.2 bug.
|
||||
onColorChanged: if (Qt.platform.os !== "osx")
|
||||
colorSelected(color)
|
||||
onAccepted: if (Qt.platform.os === "osx")
|
||||
colorSelected(color)
|
||||
onColorChanged: if (!appSettings.isMacOS) colorSelected(color)
|
||||
onAccepted: if (appSettings.isMacOS) colorSelected(color)
|
||||
}
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
|
||||
@@ -213,7 +213,7 @@ QtObject {
|
||||
ListElement {
|
||||
name: "IBM_3278"
|
||||
text: "HD: IBM 3278 (1971)"
|
||||
source: "fonts/1971-ibm-3278/3270Medium.ttf"
|
||||
source: "fonts/1971-ibm-3278/3270-Regular.ttf"
|
||||
lineSpacing: 0.2
|
||||
pixelSize: 32
|
||||
fontWidth: 1.0
|
||||
|
||||
@@ -34,7 +34,6 @@ Item{
|
||||
|
||||
property ShaderEffectSource mainSource: kterminalSource
|
||||
property BurnInEffect burnInEffect: burnInEffect
|
||||
property SlowBurnIn slowBurnInEffect: slowBurnInEffect
|
||||
property real fontWidth: 1.0
|
||||
property real screenScaling: 1.0
|
||||
property real scaleTexture: 1.0
|
||||
@@ -45,35 +44,61 @@ Item{
|
||||
property size fontMetrics: kterminal.fontMetrics
|
||||
|
||||
// Manage copy and paste
|
||||
Connections{
|
||||
Connections {
|
||||
target: copyAction
|
||||
onTriggered: kterminal.copyClipboard();
|
||||
|
||||
function onTriggered() {
|
||||
kterminal.copyClipboard()
|
||||
}
|
||||
}
|
||||
Connections{
|
||||
Connections {
|
||||
target: pasteAction
|
||||
onTriggered: kterminal.pasteClipboard()
|
||||
|
||||
function onTriggered() {
|
||||
kterminal.pasteClipboard()
|
||||
}
|
||||
}
|
||||
|
||||
//When settings are updated sources need to be redrawn.
|
||||
Connections{
|
||||
Connections {
|
||||
target: appSettings
|
||||
onFontScalingChanged: terminalContainer.updateSources();
|
||||
onFontWidthChanged: terminalContainer.updateSources();
|
||||
|
||||
function onFontScalingChanged() {
|
||||
terminalContainer.updateSources()
|
||||
}
|
||||
|
||||
function onFontWidthChanged() {
|
||||
terminalContainer.updateSources()
|
||||
}
|
||||
}
|
||||
Connections{
|
||||
Connections {
|
||||
target: terminalContainer
|
||||
onWidthChanged: terminalContainer.updateSources();
|
||||
onHeightChanged: terminalContainer.updateSources();
|
||||
|
||||
function onWidthChanged() {
|
||||
terminalContainer.updateSources()
|
||||
}
|
||||
|
||||
function onHeightChanged() {
|
||||
terminalContainer.updateSources()
|
||||
}
|
||||
}
|
||||
Connections {
|
||||
target: terminalWindow
|
||||
|
||||
function onActiveChanged() {
|
||||
kterminal.forceActiveFocus()
|
||||
}
|
||||
}
|
||||
|
||||
function updateSources() {
|
||||
kterminal.update();
|
||||
kterminal.update()
|
||||
}
|
||||
|
||||
QMLTermWidget {
|
||||
id: kterminal
|
||||
|
||||
property int textureResolutionScale: appSettings.lowResolutionFont ? devicePixelRatio : 1
|
||||
property int margin: appSettings.margin / screenScaling
|
||||
property int margin: appSettings.totalMargin / screenScaling
|
||||
property int totalWidth: Math.floor(parent.width / (screenScaling * fontWidth))
|
||||
property int totalHeight: Math.floor(parent.height / screenScaling)
|
||||
|
||||
@@ -143,7 +168,7 @@ Item{
|
||||
var args = Utils.tokenizeCommandLine(appSettings.customCommand);
|
||||
ksession.setShellProgram(args[0]);
|
||||
ksession.setArgs(args.slice(1));
|
||||
} else if (!defaultCmd && Qt.platform.os === "osx") {
|
||||
} else if (!defaultCmd && appSettings.isMacOS) {
|
||||
// OSX Requires the following default parameters for auto login.
|
||||
ksession.setArgs(["-i", "-l"]);
|
||||
}
|
||||
@@ -173,12 +198,12 @@ Item{
|
||||
|
||||
Loader {
|
||||
id: menuLoader
|
||||
sourceComponent: (Qt.platform.os === "osx" || appSettings.showMenubar ? shortContextMenu : fullContextMenu)
|
||||
sourceComponent: (appSettings.isMacOS || appSettings.showMenubar ? shortContextMenu : fullContextMenu)
|
||||
}
|
||||
property alias contextmenu: menuLoader.item
|
||||
|
||||
MouseArea{
|
||||
property real margin: appSettings.margin
|
||||
MouseArea {
|
||||
property real margin: appSettings.totalMargin
|
||||
|
||||
acceptedButtons: Qt.LeftButton | Qt.MiddleButton | Qt.RightButton
|
||||
anchors.fill: parent
|
||||
@@ -219,8 +244,8 @@ Item{
|
||||
var cc = Qt.size(0.5 - x, 0.5 - y);
|
||||
var distortion = (cc.height * cc.height + cc.width * cc.width) * appSettings.screenCurvature * appSettings.screenCurvatureSize;
|
||||
|
||||
return Qt.point((x - cc.width * (1+distortion) * distortion) * kterminal.totalWidth,
|
||||
(y - cc.height * (1+distortion) * distortion) * kterminal.totalHeight)
|
||||
return Qt.point((x - cc.width * (1+distortion) * distortion) * (kterminal.totalWidth),
|
||||
(y - cc.height * (1+distortion) * distortion) * (kterminal.totalHeight))
|
||||
}
|
||||
}
|
||||
ShaderEffectSource{
|
||||
@@ -250,9 +275,5 @@ Item{
|
||||
BurnInEffect {
|
||||
id: burnInEffect
|
||||
}
|
||||
|
||||
SlowBurnIn {
|
||||
id: slowBurnInEffect
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -154,12 +154,6 @@ ColumnLayout {
|
||||
Label {
|
||||
text: Math.round(burnInSlider.value * 100) + "%"
|
||||
}
|
||||
CheckBox {
|
||||
Layout.columnSpan: 2
|
||||
text: qsTr("Burnin optimization (Might display timing artifacts)")
|
||||
checked: appSettings.useFastBurnIn
|
||||
onCheckedChanged: appSettings.useFastBurnIn = checked
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ ColumnLayout {
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
model: appSettings.profilesList
|
||||
clip: true
|
||||
delegate: Rectangle {
|
||||
width: label.width
|
||||
height: label.height
|
||||
@@ -206,12 +207,21 @@ ColumnLayout {
|
||||
onValueChanged: appSettings._margin = value
|
||||
value: appSettings._margin
|
||||
}
|
||||
Label {
|
||||
text: qsTr("Frame size")
|
||||
}
|
||||
SimpleSlider {
|
||||
onValueChanged: appSettings._frameMargin = value
|
||||
value: appSettings._frameMargin
|
||||
}
|
||||
Label {
|
||||
text: qsTr("Opacity")
|
||||
visible: !appSettings.isMacOS
|
||||
}
|
||||
SimpleSlider {
|
||||
onValueChanged: appSettings.windowOpacity = value
|
||||
value: appSettings.windowOpacity
|
||||
visible: !appSettings.isMacOS
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ ColumnLayout {
|
||||
property string selectedElement: model[currentIndex]
|
||||
|
||||
Layout.fillWidth: true
|
||||
model: [qsTr("Default"), qsTr("Scanlines"), qsTr("Pixels")]
|
||||
model: [qsTr("Default"), qsTr("Scanlines"), qsTr("Pixels"), qsTr("Sub-Pixels")]
|
||||
currentIndex: appSettings.rasterization
|
||||
onCurrentIndexChanged: {
|
||||
appSettings.rasterization = currentIndex
|
||||
@@ -68,7 +68,10 @@ ColumnLayout {
|
||||
}
|
||||
Connections {
|
||||
target: appSettings
|
||||
onTerminalFontChanged: fontChanger.updateIndex()
|
||||
|
||||
function onTerminalFontChanged() {
|
||||
fontChanger.updateIndex()
|
||||
}
|
||||
}
|
||||
Component.onCompleted: updateIndex()
|
||||
}
|
||||
|
||||
@@ -27,42 +27,49 @@ import QtQuick.Dialogs 1.1
|
||||
Window {
|
||||
id: settings_window
|
||||
title: qsTr("Settings")
|
||||
width: 800
|
||||
height: 600
|
||||
width: 600
|
||||
height: 480
|
||||
|
||||
property int tabmargins: 15
|
||||
|
||||
TabBar {
|
||||
id: bar
|
||||
width: parent.width
|
||||
TabButton {
|
||||
text: qsTr("General")
|
||||
}
|
||||
TabButton {
|
||||
text: qsTr("Terminal")
|
||||
}
|
||||
TabButton {
|
||||
text: qsTr("Effects")
|
||||
}
|
||||
TabButton {
|
||||
text: qsTr("Advanced")
|
||||
}
|
||||
}
|
||||
Item {
|
||||
anchors { fill: parent; margins: tabmargins }
|
||||
|
||||
StackLayout {
|
||||
anchors {
|
||||
top: bar.bottom
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
bottom: parent.bottom
|
||||
margins: tabmargins
|
||||
TabBar {
|
||||
id: bar
|
||||
anchors { left: parent.left; right: parent.right; top: parent.top; }
|
||||
TabButton {
|
||||
text: qsTr("General")
|
||||
}
|
||||
TabButton {
|
||||
text: qsTr("Terminal")
|
||||
}
|
||||
TabButton {
|
||||
text: qsTr("Effects")
|
||||
}
|
||||
TabButton {
|
||||
text: qsTr("Advanced")
|
||||
}
|
||||
}
|
||||
|
||||
currentIndex: bar.currentIndex
|
||||
Frame {
|
||||
anchors {
|
||||
top: bar.bottom
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
bottom: parent.bottom
|
||||
}
|
||||
|
||||
SettingsGeneralTab { }
|
||||
SettingsTerminalTab { }
|
||||
SettingsEffectsTab { }
|
||||
SettingsAdvancedTab { }
|
||||
StackLayout {
|
||||
anchors.fill: parent
|
||||
|
||||
currentIndex: bar.currentIndex
|
||||
|
||||
SettingsGeneralTab { }
|
||||
SettingsTerminalTab { }
|
||||
SettingsEffectsTab { }
|
||||
SettingsAdvancedTab { }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
91
app/qml/ShaderLibrary.qml
Normal file
91
app/qml/ShaderLibrary.qml
Normal file
@@ -0,0 +1,91 @@
|
||||
import QtQuick 2.0
|
||||
|
||||
QtObject {
|
||||
property string rasterizationShader:
|
||||
(appSettings.rasterization === appSettings.no_rasterization ? "
|
||||
lowp vec3 applyRasterization(vec2 screenCoords, lowp vec3 texel, vec2 virtualResolution, float intensity) {
|
||||
return texel;
|
||||
}" : "") +
|
||||
|
||||
(appSettings.rasterization === appSettings.scanline_rasterization ? "
|
||||
#define INTENSITY 0.30
|
||||
#define BRIGHTBOOST 0.30
|
||||
|
||||
lowp vec3 applyRasterization(vec2 screenCoords, lowp vec3 texel, vec2 virtualResolution, float intensity) {
|
||||
lowp vec3 pixelHigh = ((1.0 + BRIGHTBOOST) - (0.2 * texel)) * texel;
|
||||
lowp vec3 pixelLow = ((1.0 - INTENSITY) + (0.1 * texel)) * texel;
|
||||
|
||||
vec2 coords = fract(screenCoords * virtualResolution) * 2.0 - vec2(1.0);
|
||||
lowp float mask = 1.0 - abs(coords.y);
|
||||
|
||||
lowp vec3 rasterizationColor = mix(pixelLow, pixelHigh, mask);
|
||||
return mix(texel, rasterizationColor, intensity);
|
||||
}" : "") +
|
||||
|
||||
(appSettings.rasterization === appSettings.pixel_rasterization ? "
|
||||
#define INTENSITY 0.30
|
||||
#define BRIGHTBOOST 0.30
|
||||
|
||||
lowp vec3 applyRasterization(vec2 screenCoords, lowp vec3 texel, vec2 virtualResolution, float intensity) {
|
||||
lowp vec3 result = texel;
|
||||
|
||||
lowp vec3 pixelHigh = ((1.0 + BRIGHTBOOST) - (0.2 * texel)) * texel;
|
||||
lowp vec3 pixelLow = ((1.0 - INTENSITY) + (0.1 * texel)) * texel;
|
||||
|
||||
vec2 coords = fract(screenCoords * virtualResolution) * 2.0 - vec2(1.0);
|
||||
coords = coords * coords;
|
||||
lowp float mask = 1.0 - coords.x - coords.y;
|
||||
|
||||
lowp vec3 rasterizationColor = mix(pixelLow, pixelHigh, mask);
|
||||
return mix(texel, rasterizationColor, intensity);
|
||||
}" : "") +
|
||||
|
||||
(appSettings.rasterization === appSettings.subpixel_rasterization ? "
|
||||
#define INTENSITY 0.30
|
||||
#define BRIGHTBOOST 0.30
|
||||
#define SUBPIXELS 3.0
|
||||
const vec3 offsets = vec3(3.141592654) * vec3(1.0/2.0,1.0/2.0 - 2.0/3.0,1.0/2.0-4.0/3.0);
|
||||
|
||||
lowp vec3 applyRasterization(vec2 screenCoords, lowp vec3 texel, vec2 virtualResolution, float intensity) {
|
||||
vec2 omega = vec2(3.141592654) * vec2(2.0) * virtualResolution;
|
||||
vec2 angle = screenCoords * omega;
|
||||
vec3 xfactors = (SUBPIXELS + sin(angle.x + offsets)) / (SUBPIXELS + 1.0);
|
||||
|
||||
lowp vec3 result = texel * xfactors;
|
||||
lowp vec3 pixelHigh = ((1.0 + BRIGHTBOOST) - (0.2 * result)) * result;
|
||||
lowp vec3 pixelLow = ((1.0 - INTENSITY) + (0.1 * result)) * result;
|
||||
|
||||
vec2 coords = fract(screenCoords * virtualResolution) * 2.0 - vec2(1.0);
|
||||
lowp float mask = 1.0 - abs(coords.y);
|
||||
|
||||
lowp vec3 rasterizationColor = mix(pixelLow, pixelHigh, mask);
|
||||
return mix(texel, rasterizationColor, intensity);
|
||||
}" : "") +
|
||||
|
||||
"\n\n"
|
||||
|
||||
property string min2: "
|
||||
float min2(vec2 v) {
|
||||
return min(v.x, v.y);
|
||||
}\n\n"
|
||||
|
||||
property string rgb2grey: "
|
||||
float rgb2grey(vec3 v) {
|
||||
return dot(v, vec3(0.21, 0.72, 0.04));
|
||||
}\n\n"
|
||||
|
||||
property string max2: "
|
||||
float max2(vec2 v) {
|
||||
return max(v.x, v.y);
|
||||
}\n\n"
|
||||
|
||||
property string prod2: "
|
||||
float prod2(vec2 v) {
|
||||
return v.x * v.y;
|
||||
}\n\n"
|
||||
|
||||
property string sum2: "
|
||||
float sum2(vec2 v) {
|
||||
return v.x + v.y;
|
||||
}\n\n"
|
||||
}
|
||||
@@ -24,7 +24,6 @@ import QtGraphicalEffects 1.0
|
||||
import "utils.js" as Utils
|
||||
|
||||
Item {
|
||||
property SlowBurnIn slowBurnInEffect
|
||||
property ShaderEffectSource source
|
||||
property BurnInEffect burnInEffect
|
||||
property ShaderEffectSource bloomSource
|
||||
@@ -38,11 +37,19 @@ Item {
|
||||
|
||||
property real ambientLight: appSettings.ambientLight * 0.2
|
||||
|
||||
property size virtual_resolution
|
||||
property size virtualResolution
|
||||
property size screenResolution
|
||||
|
||||
property real _screenDensity: Math.min(
|
||||
screenResolution.width / virtualResolution.width,
|
||||
screenResolution.height / virtualResolution.height
|
||||
)
|
||||
|
||||
ShaderEffect {
|
||||
id: dynamicShader
|
||||
|
||||
property ShaderLibrary shaderLibrary: ShaderLibrary { }
|
||||
|
||||
property ShaderEffectSource screenBuffer: frameBuffer
|
||||
property ShaderEffectSource burnInSource: burnInEffect.source
|
||||
property ShaderEffectSource frameSource: terminalFrameLoader.item
|
||||
@@ -59,22 +66,24 @@ Item {
|
||||
property real glowingLine: appSettings.glowingLine * 0.2
|
||||
|
||||
// Fast burnin properties
|
||||
property real burnIn: appSettings.useFastBurnIn ? appSettings.burnIn : 0
|
||||
property real burnIn: appSettings.burnIn
|
||||
property real burnInLastUpdate: burnInEffect.lastUpdate
|
||||
property real burnInTime: burnInEffect.burnInFadeTime
|
||||
|
||||
// Slow burnin properties
|
||||
property real slowBurnIn: appSettings.useFastBurnIn ? 0 : appSettings.burnIn
|
||||
property ShaderEffectSource slowBurnInSource: slowBurnInEffect.source
|
||||
|
||||
property real jitter: appSettings.jitter
|
||||
property size jitterDisplacement: Qt.size(0.007 * jitter, 0.002 * jitter)
|
||||
property real shadowLength: 0.25 * screenCurvature * Utils.lint(0.50, 1.5, ambientLight)
|
||||
property real staticNoise: appSettings.staticNoise
|
||||
property size scaleNoiseSize: Qt.size((width) / (noiseTexture.width * appSettings.windowScaling * appSettings.totalFontScaling),
|
||||
(height) / (noiseTexture.height * appSettings.windowScaling * appSettings.totalFontScaling))
|
||||
property size scaleNoiseSize: Qt.size((width * 0.75) / (noiseTexture.width * appSettings.windowScaling * appSettings.totalFontScaling),
|
||||
(height * 0.75) / (noiseTexture.height * appSettings.windowScaling * appSettings.totalFontScaling))
|
||||
|
||||
property size virtual_resolution: parent.virtual_resolution
|
||||
property size virtualResolution: parent.virtualResolution
|
||||
|
||||
// Rasterization might display oversamping issues if virtual resolution is close to physical display resolution.
|
||||
// We progressively disable rasterization from 4x up to 2x resolution.
|
||||
property real rasterizationIntensity: Utils.smoothstep(2.0, 4.0, _screenDensity)
|
||||
|
||||
property real displayTerminalFrame: appSettings._frameMargin > 0 || appSettings.screenCurvature > 0
|
||||
|
||||
property real time: timeManager.time
|
||||
property ShaderEffectSource noiseSource: noiseShaderSource
|
||||
@@ -164,23 +173,22 @@ Item {
|
||||
uniform highp vec4 backgroundColor;
|
||||
uniform lowp float shadowLength;
|
||||
|
||||
uniform highp vec2 virtual_resolution;" +
|
||||
uniform highp vec2 virtualResolution;
|
||||
uniform lowp float rasterizationIntensity;\n" +
|
||||
|
||||
(burnIn !== 0 ? "
|
||||
uniform sampler2D burnInSource;
|
||||
uniform highp float burnInLastUpdate;
|
||||
uniform highp float burnInTime;" : "") +
|
||||
(slowBurnIn !== 0 ? "
|
||||
uniform sampler2D slowBurnInSource;" : "") +
|
||||
(staticNoise !== 0 ? "
|
||||
uniform highp float staticNoise;" : "") +
|
||||
(((staticNoise !== 0 || jitter !== 0)
|
||||
||(fallBack && (flickering || horizontalSync))) ? "
|
||||
(((staticNoise !== 0 || jitter !== 0) ||(fallBack && (flickering || horizontalSync))) ? "
|
||||
uniform lowp sampler2D noiseSource;
|
||||
uniform highp vec2 scaleNoiseSize;" : "") +
|
||||
(screenCurvature !== 0 ? "
|
||||
uniform highp float screenCurvature;
|
||||
(displayTerminalFrame ? "
|
||||
uniform lowp sampler2D frameSource;" : "") +
|
||||
(screenCurvature !== 0 ? "
|
||||
uniform highp float screenCurvature;" : "") +
|
||||
(glowingLine !== 0 ? "
|
||||
uniform highp float glowingLine;" : "") +
|
||||
(chromaColor !== 0 ? "
|
||||
@@ -203,17 +211,14 @@ Item {
|
||||
|
||||
(glowingLine !== 0 ? "
|
||||
float randomPass(vec2 coords){
|
||||
return fract(smoothstep(-120.0, 0.0, coords.y - (virtual_resolution.y + 120.0) * fract(time * 0.00015)));
|
||||
return fract(smoothstep(-120.0, 0.0, coords.y - (virtualResolution.y + 120.0) * fract(time * 0.00015)));
|
||||
}" : "") +
|
||||
|
||||
"float min2(vec2 v) {
|
||||
return min(v.x, v.y);
|
||||
}
|
||||
|
||||
float rgb2grey(vec3 v){
|
||||
return dot(v, vec3(0.21, 0.72, 0.04));
|
||||
}
|
||||
shaderLibrary.min2 +
|
||||
shaderLibrary.rgb2grey +
|
||||
shaderLibrary.rasterizationShader +
|
||||
|
||||
"
|
||||
float isInScreen(vec2 v) {
|
||||
return min2(step(0.0, v) - step(1.0, v));
|
||||
}
|
||||
@@ -291,7 +296,7 @@ Item {
|
||||
color += noiseVal * noise * (1.0 - distance * 1.3);" : "") +
|
||||
|
||||
(glowingLine !== 0 ? "
|
||||
color += randomPass(coords * virtual_resolution) * glowingLine;" : "") +
|
||||
color += randomPass(coords * virtualResolution) * glowingLine;" : "") +
|
||||
|
||||
"vec3 txt_color = texture2D(screenBuffer, txt_coords).rgb;" +
|
||||
|
||||
@@ -302,13 +307,10 @@ Item {
|
||||
txt_color = max(txt_color, convertWithChroma(burnInColor));"
|
||||
: "") +
|
||||
|
||||
(slowBurnIn !== 0 ? "
|
||||
vec4 txt_blur = texture2D(slowBurnInSource, staticCoords);
|
||||
txt_color = max(txt_color, convertWithChroma(txt_blur.rgb * txt_blur.a));
|
||||
" : "") +
|
||||
|
||||
"txt_color += fontColor.rgb * vec3(color);" +
|
||||
|
||||
"txt_color = applyRasterization(staticCoords, txt_color, virtualResolution, rasterizationIntensity);\n" +
|
||||
|
||||
"vec3 finalColor = txt_color;" +
|
||||
|
||||
(flickering !== 0 ? "
|
||||
@@ -317,7 +319,7 @@ Item {
|
||||
(ambientLight !== 0 ? "
|
||||
finalColor += vec3(ambientLight) * (1.0 - distance) * (1.0 - distance);" : "") +
|
||||
|
||||
(screenCurvature !== 0 ?
|
||||
(displayTerminalFrame ?
|
||||
"vec4 frameColor = texture2D(frameSource, qt_TexCoord0);
|
||||
finalColor = mix(finalColor, frameColor.rgb, frameColor.a);"
|
||||
: "") +
|
||||
@@ -340,7 +342,7 @@ Item {
|
||||
Loader {
|
||||
id: terminalFrameLoader
|
||||
|
||||
active: screenCurvature !== 0
|
||||
active: dynamicShader.displayTerminalFrame
|
||||
|
||||
width: staticShader.width
|
||||
height: staticShader.height
|
||||
@@ -352,7 +354,7 @@ Item {
|
||||
visible: false
|
||||
format: ShaderEffectSource.RGBA
|
||||
|
||||
NewTerminalFrame {
|
||||
TerminalFrame {
|
||||
id: terminalFrame
|
||||
blending: false
|
||||
anchors.fill: parent
|
||||
@@ -360,6 +362,10 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
ShaderLibrary {
|
||||
id: shaderLibrary
|
||||
}
|
||||
|
||||
ShaderEffect {
|
||||
id: staticShader
|
||||
|
||||
@@ -385,7 +391,7 @@ Item {
|
||||
|
||||
property real ambientLight: parent.ambientLight
|
||||
|
||||
property size virtual_resolution: parent.virtual_resolution
|
||||
property size virtualResolution: parent.virtualResolution
|
||||
|
||||
blending: false
|
||||
visible: false
|
||||
@@ -408,7 +414,7 @@ Item {
|
||||
uniform highp vec4 backgroundColor;
|
||||
uniform lowp float screen_brightness;
|
||||
|
||||
uniform highp vec2 virtual_resolution;" +
|
||||
uniform highp vec2 virtualResolution;" +
|
||||
|
||||
(bloom !== 0 ? "
|
||||
uniform highp sampler2D bloomSource;
|
||||
@@ -426,36 +432,9 @@ Item {
|
||||
(ambientLight !== 0 ? "
|
||||
uniform lowp float ambientLight;" : "") +
|
||||
|
||||
"highp float getScanlineIntensity(vec2 coords) {
|
||||
float result = 1.0;" +
|
||||
|
||||
(appSettings.rasterization != appSettings.no_rasterization ?
|
||||
"float val = 0.0;
|
||||
vec2 rasterizationCoords = fract(coords * virtual_resolution);
|
||||
val += smoothstep(0.0, 0.5, rasterizationCoords.y);
|
||||
val -= smoothstep(0.5, 1.0, rasterizationCoords.y);
|
||||
result *= mix(0.5, 1.0, val);" : "") +
|
||||
|
||||
(appSettings.rasterization == appSettings.pixel_rasterization ?
|
||||
"val = 0.0;
|
||||
val += smoothstep(0.0, 0.5, rasterizationCoords.x);
|
||||
val -= smoothstep(0.5, 1.0, rasterizationCoords.x);
|
||||
result *= mix(0.5, 1.0, val);" : "") + "
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
float min2(vec2 v) {
|
||||
return min(v.x, v.y);
|
||||
}
|
||||
|
||||
float sum2(vec2 v) {
|
||||
return v.x + v.y;
|
||||
}
|
||||
|
||||
float rgb2grey(vec3 v){
|
||||
return dot(v, vec3(0.21, 0.72, 0.04));
|
||||
}" +
|
||||
shaderLibrary.min2 +
|
||||
shaderLibrary.sum2 +
|
||||
shaderLibrary.rgb2grey +
|
||||
|
||||
"vec3 convertWithChroma(vec3 inColor) {
|
||||
vec3 outColor = inColor;" +
|
||||
@@ -468,6 +447,7 @@ Item {
|
||||
" return outColor;
|
||||
}" +
|
||||
|
||||
shaderLibrary.rasterizationShader +
|
||||
|
||||
"void main() {" +
|
||||
"vec2 cc = vec2(0.5) - qt_TexCoord0;" +
|
||||
@@ -490,8 +470,6 @@ Item {
|
||||
txt_color.b = leftColor.b * 0.30 + rightColor.b * 0.10 + txt_color.b * 0.60;
|
||||
" : "") +
|
||||
|
||||
"txt_color *= getScanlineIntensity(txt_coords);" +
|
||||
|
||||
"txt_color += vec3(0.0001);" +
|
||||
"float greyscale_color = rgb2grey(txt_color);" +
|
||||
|
||||
|
||||
@@ -1,140 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2013-2021 "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.0
|
||||
|
||||
import "utils.js" as Utils
|
||||
|
||||
Loader {
|
||||
property ShaderEffectSource source: item ? item.source : null
|
||||
|
||||
active: !appSettings.useFastBurnIn && appSettings.burnIn !== 0
|
||||
anchors.fill: parent
|
||||
|
||||
sourceComponent: Item {
|
||||
property alias source: burnInSourceEffect
|
||||
property int burnInScaling: scaleTexture * appSettings.burnInQuality
|
||||
|
||||
ShaderEffectSource {
|
||||
property bool updateBurnIn: false
|
||||
property real burnIn: appSettings.burnIn
|
||||
property real fps: appSettings.fps !== 0 ? appSettings.fps : 60
|
||||
property real burnInFadeTime: Utils.lint(minBurnInFadeTime, maxBurnInFadeTime, burnIn)
|
||||
property real burnInCoefficient: 1000 / (fps * burnInFadeTime)
|
||||
property real minBurnInFadeTime: appSettings.minBurnInFadeTime
|
||||
property real maxBurnInFadeTime: appSettings.maxBurnInFadeTime
|
||||
|
||||
id: burnInSourceEffect
|
||||
|
||||
anchors.fill: parent
|
||||
|
||||
sourceItem: burnInEffect
|
||||
recursive: true
|
||||
live: false
|
||||
hideSource: true
|
||||
wrapMode: kterminalSource.wrapMode
|
||||
|
||||
visible: false
|
||||
|
||||
function restartBlurSource(){
|
||||
livetimer.restart();
|
||||
}
|
||||
|
||||
// This updates the burnin synched with the timer.
|
||||
Connections {
|
||||
target: burnInSourceEffect.updateBurnIn ? timeManager : null
|
||||
ignoreUnknownSignals: false
|
||||
onTimeChanged: {
|
||||
burnInSourceEffect.scheduleUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: livetimer
|
||||
|
||||
// The interval assumes 60 fps. This is the time needed burnout a white pixel.
|
||||
// We multiply 1.1 to have a little bit of margin over the theoretical value.
|
||||
// This solution is not extremely clean, but it's probably the best to avoid measuring fps.
|
||||
|
||||
interval: burnInSourceEffect.burnInFadeTime * 1.1
|
||||
running: true
|
||||
onTriggered: burnInSourceEffect.updateBurnIn = false;
|
||||
}
|
||||
Connections {
|
||||
target: kterminal
|
||||
onImagePainted:{
|
||||
burnInSourceEffect.scheduleUpdate();
|
||||
burnInSourceEffect.updateBurnIn = true;
|
||||
livetimer.restart();
|
||||
}
|
||||
}
|
||||
// Restart blurred source settings change.
|
||||
Connections {
|
||||
target: appSettings
|
||||
onBurnInChanged: burnInSourceEffect.restartBlurSource();
|
||||
onTerminalFontChanged: burnInSourceEffect.restartBlurSource();
|
||||
onRasterizationChanged: burnInSourceEffect.restartBlurSource();
|
||||
onBurnInQualityChanged: burnInSourceEffect.restartBlurSource();
|
||||
}
|
||||
Connections {
|
||||
target: kterminalScrollbar
|
||||
onOpacityChanged: burnInSourceEffect.restartBlurSource();
|
||||
}
|
||||
|
||||
ShaderEffect {
|
||||
id: burnInEffect
|
||||
|
||||
property variant txt_source: kterminalSource
|
||||
property variant blurredSource: burnInSourceEffect
|
||||
property real burnInCoefficient: burnInSourceEffect.burnInCoefficient
|
||||
|
||||
anchors.fill: parent
|
||||
blending: false
|
||||
|
||||
fragmentShader:
|
||||
"#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif\n" +
|
||||
|
||||
"uniform lowp float qt_Opacity;" +
|
||||
"uniform lowp sampler2D txt_source;" +
|
||||
|
||||
"varying highp vec2 qt_TexCoord0;
|
||||
uniform lowp sampler2D blurredSource;
|
||||
uniform highp float burnInCoefficient;" +
|
||||
|
||||
"float max3(vec3 v) {
|
||||
return max (max (v.x, v.y), v.z);
|
||||
}" +
|
||||
|
||||
"void main() {" +
|
||||
"vec2 coords = qt_TexCoord0;" +
|
||||
"vec3 origColor = texture2D(txt_source, coords).rgb;" +
|
||||
"vec3 blur_color = texture2D(blurredSource, coords).rgb - vec3(burnInCoefficient);" +
|
||||
"vec3 color = min(origColor + blur_color, max(origColor, blur_color));" +
|
||||
|
||||
"gl_FragColor = vec4(color, max3(color - origColor));" +
|
||||
"}"
|
||||
|
||||
onStatusChanged: if (log) console.log(log) //Print warning messages
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -26,13 +26,18 @@ ShaderTerminal {
|
||||
property alias title: terminal.title
|
||||
property alias terminalSize: terminal.terminalSize
|
||||
|
||||
property real devicePixelRatio: terminalWindow.screen.devicePixelRatio
|
||||
|
||||
id: mainShader
|
||||
opacity: appSettings.windowOpacity * 0.3 + 0.7
|
||||
|
||||
source: terminal.mainSource
|
||||
burnInEffect: terminal.burnInEffect
|
||||
slowBurnInEffect: terminal.slowBurnInEffect
|
||||
virtual_resolution: terminal.virtualResolution
|
||||
virtualResolution: terminal.virtualResolution
|
||||
screenResolution: Qt.size(
|
||||
terminalWindow.width * devicePixelRatio * appSettings.windowScaling,
|
||||
terminalWindow.height * devicePixelRatio * appSettings.windowScaling
|
||||
)
|
||||
|
||||
TimeManager {
|
||||
id: timeManager
|
||||
|
||||
@@ -22,7 +22,7 @@ import QtQuick 2.0
|
||||
import "utils.js" as Utils
|
||||
|
||||
ShaderEffect {
|
||||
property color _staticFrameColor: "#ffffff"
|
||||
property color _staticFrameColor: "#fff"
|
||||
property color _backgroundColor: appSettings.backgroundColor
|
||||
property color _fontColor: appSettings.fontColor
|
||||
property color _lightColor: Utils.mix(_fontColor, _backgroundColor, 0.2)
|
||||
@@ -30,9 +30,19 @@ ShaderEffect {
|
||||
|
||||
property color frameColor: Utils.mix(_staticFrameColor, _lightColor, _ambientLight)
|
||||
property real screenCurvature: appSettings.screenCurvature * appSettings.screenCurvatureSize
|
||||
property real shadowLength: 0.5 * screenCurvature * Utils.lint(0.50, 1.5, _ambientLight)
|
||||
|
||||
property size aadelta: Qt.size(1.0 / width, 1.0 / height)
|
||||
// Coefficient of the log curve used to approximate shadowing
|
||||
property real screenShadowCoeff: Utils.lint(20.0, 10.0, _ambientLight)
|
||||
property real frameShadowCoeff: Utils.lint(20.0, 10.0, _ambientLight)
|
||||
|
||||
property size margin: Qt.size(
|
||||
appSettings.frameMargin / width * appSettings.windowScaling,
|
||||
appSettings.frameMargin / height * appSettings.windowScaling
|
||||
)
|
||||
|
||||
ShaderLibrary {
|
||||
id: shaderLibrary
|
||||
}
|
||||
|
||||
fragmentShader: "
|
||||
#ifdef GL_ES
|
||||
@@ -40,10 +50,11 @@ ShaderEffect {
|
||||
#endif
|
||||
|
||||
uniform lowp float screenCurvature;
|
||||
uniform lowp float shadowLength;
|
||||
uniform lowp float screenShadowCoeff;
|
||||
uniform lowp float frameShadowCoeff;
|
||||
uniform highp float qt_Opacity;
|
||||
uniform lowp vec4 frameColor;
|
||||
uniform mediump vec2 aadelta;
|
||||
uniform mediump vec2 margin;
|
||||
|
||||
varying highp vec2 qt_TexCoord0;
|
||||
|
||||
@@ -52,42 +63,38 @@ ShaderEffect {
|
||||
float dist = dot(cc, cc) * screenCurvature;
|
||||
return (coords + cc * (1.0 + dist) * dist);
|
||||
}
|
||||
" +
|
||||
|
||||
float max2(vec2 v) {
|
||||
return max(v.x, v.y);
|
||||
shaderLibrary.max2 +
|
||||
shaderLibrary.min2 +
|
||||
shaderLibrary.prod2 +
|
||||
shaderLibrary.sum2 +
|
||||
|
||||
"
|
||||
|
||||
vec2 positiveLog(vec2 x) {
|
||||
return clamp(log(x), vec2(0.0), vec2(100.0));
|
||||
}
|
||||
|
||||
float min2(vec2 v) {
|
||||
return min(v.x, v.y);
|
||||
}
|
||||
|
||||
float prod2(vec2 v) {
|
||||
return v.x * v.y;
|
||||
}
|
||||
|
||||
float sum2(vec2 v) {
|
||||
return v.x + v.y;
|
||||
}
|
||||
|
||||
void main(){
|
||||
void main() {
|
||||
vec2 staticCoords = qt_TexCoord0;
|
||||
vec2 coords = distortCoordinates(staticCoords);
|
||||
vec2 coords = distortCoordinates(staticCoords) * (vec2(1.0) + margin * 2.0) - margin;
|
||||
|
||||
vec3 color = vec3(0.0);
|
||||
vec2 vignetteCoords = staticCoords * (1.0 - staticCoords.yx);
|
||||
float vignette = pow(prod2(vignetteCoords) * 15.0, 0.25);
|
||||
|
||||
vec3 color = frameColor.rgb * vec3(1.0 - vignette);
|
||||
float alpha = 0.0;
|
||||
|
||||
float outShadowLength = shadowLength;
|
||||
float inShadowLength = shadowLength * 0.5;
|
||||
float frameShadow = max2(positiveLog(-coords * frameShadowCoeff + vec2(1.0)) + positiveLog(coords * frameShadowCoeff - (vec2(frameShadowCoeff) - vec2(1.0))));
|
||||
frameShadow = max(sqrt(frameShadow), 0.0);
|
||||
color *= frameShadow;
|
||||
alpha = sum2(1.0 - step(vec2(0.0), coords) + step(vec2(1.0), coords));
|
||||
alpha = clamp(alpha, 0.0, 1.0);
|
||||
alpha *= mix(1.0, 0.9, frameShadow);
|
||||
|
||||
float outShadow = max2(1.0 - smoothstep(vec2(-outShadowLength), vec2(0.0), coords) + smoothstep(vec2(1.0), vec2(1.0 + outShadowLength), coords));
|
||||
outShadow = clamp(sqrt(outShadow), 0.0, 1.0);
|
||||
color += frameColor.rgb * outShadow;
|
||||
alpha = sum2(1.0 - smoothstep(vec2(0.0), aadelta, coords) + smoothstep(vec2(1.0) - aadelta, vec2(1.0), coords));
|
||||
alpha = clamp(alpha, 0.0, 1.0) * mix(1.0, 0.9, outShadow);
|
||||
|
||||
float inShadow = 1.0 - prod2(smoothstep(0.0, inShadowLength, coords) - smoothstep(1.0 - inShadowLength, 1.0, coords));
|
||||
inShadow = 0.5 * inShadow * inShadow;
|
||||
alpha = max(alpha, inShadow);
|
||||
float screenShadow = 1.0 - prod2(positiveLog(coords * screenShadowCoeff + vec2(1.0)) * positiveLog(-coords * screenShadowCoeff + vec2(screenShadowCoeff + 1.0)));
|
||||
alpha = max(0.8 * screenShadow, alpha);
|
||||
|
||||
gl_FragColor = vec4(color * alpha, alpha);
|
||||
}
|
||||
BIN
app/qml/fonts/1971-ibm-3278/3270-Regular.ttf
Normal file
BIN
app/qml/fonts/1971-ibm-3278/3270-Regular.ttf
Normal file
Binary file not shown.
Binary file not shown.
@@ -53,20 +53,30 @@ ApplicationWindow {
|
||||
property bool fullscreen: appSettings.fullscreen
|
||||
onFullscreenChanged: visibility = (fullscreen ? Window.FullScreen : Window.Windowed)
|
||||
|
||||
menuBar: WindowMenu {
|
||||
id: mainMenu
|
||||
visible: (Qt.platform.os === "osx" || appSettings.showMenubar)
|
||||
menuBar: qtquickMenuLoader.item
|
||||
|
||||
Loader {
|
||||
id: qtquickMenuLoader
|
||||
active: !appSettings.isMacOS && appSettings.showMenubar
|
||||
sourceComponent: WindowMenu { }
|
||||
}
|
||||
|
||||
Loader {
|
||||
id: globalMenuLoader
|
||||
active: appSettings.isMacOS
|
||||
sourceComponent: OSXMenu { }
|
||||
}
|
||||
|
||||
property string wintitle: appSettings.wintitle
|
||||
|
||||
color: "#00000000"
|
||||
|
||||
title: terminalContainer.title || qsTr(appSettings.wintitle)
|
||||
|
||||
Action {
|
||||
id: showMenubarAction
|
||||
text: qsTr("Show Menubar")
|
||||
enabled: Qt.platform.os !== "osx"
|
||||
enabled: !appSettings.isMacOS
|
||||
shortcut: "Ctrl+Shift+M"
|
||||
checkable: true
|
||||
checked: appSettings.showMenubar
|
||||
@@ -75,7 +85,7 @@ ApplicationWindow {
|
||||
Action {
|
||||
id: fullscreenAction
|
||||
text: qsTr("Fullscreen")
|
||||
enabled: Qt.platform.os !== "osx"
|
||||
enabled: !appSettings.isMacOS
|
||||
shortcut: "Alt+F11"
|
||||
onTriggered: appSettings.fullscreen = !appSettings.fullscreen
|
||||
checkable: true
|
||||
@@ -154,7 +164,7 @@ ApplicationWindow {
|
||||
onClosing: {
|
||||
// OSX Since we are currently supporting only one window
|
||||
// quit the application when it is closed.
|
||||
if (Qt.platform.os === "osx")
|
||||
if (appSettings.isMacOS)
|
||||
Qt.quit()
|
||||
}
|
||||
}
|
||||
|
||||
89
app/qml/menus/OSXMenu.qml
Normal file
89
app/qml/menus/OSXMenu.qml
Normal file
@@ -0,0 +1,89 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2013-2021 "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.3
|
||||
import Qt.labs.platform 1.1
|
||||
|
||||
MenuBar {
|
||||
id: defaultMenuBar
|
||||
|
||||
Menu {
|
||||
title: qsTr("File")
|
||||
MenuItem {
|
||||
text: quitAction.text
|
||||
onTriggered: quitAction.trigger()
|
||||
}
|
||||
}
|
||||
Menu {
|
||||
title: qsTr("Edit")
|
||||
MenuItem {
|
||||
text: copyAction.text
|
||||
shortcut: "Meta+C"
|
||||
onTriggered: copyAction.trigger()
|
||||
}
|
||||
MenuItem {
|
||||
text: pasteAction.text
|
||||
shortcut: "Meta+V"
|
||||
onTriggered: pasteAction.trigger()
|
||||
}
|
||||
MenuSeparator {}
|
||||
MenuItem {
|
||||
text: showsettingsAction.text
|
||||
shortcut: showsettingsAction.shortcut
|
||||
onTriggered: showsettingsAction.trigger()
|
||||
}
|
||||
}
|
||||
Menu {
|
||||
title: qsTr("View")
|
||||
MenuItem {
|
||||
text: zoomIn.text
|
||||
shortcut: "Meta++"
|
||||
onTriggered: zoomIn.trigger()
|
||||
}
|
||||
MenuItem {
|
||||
text: zoomOut.text
|
||||
shortcut: "Meta+-"
|
||||
onTriggered: zoomOut.trigger()
|
||||
}
|
||||
}
|
||||
Menu {
|
||||
id: profilesMenu
|
||||
title: qsTr("Profiles")
|
||||
Instantiator {
|
||||
model: appSettings.profilesList
|
||||
delegate: MenuItem {
|
||||
text: model.text
|
||||
onTriggered: {
|
||||
appSettings.loadProfileString(obj_string)
|
||||
appSettings.handleFontChanged()
|
||||
}
|
||||
}
|
||||
onObjectAdded: profilesMenu.insertItem(index, object)
|
||||
onObjectRemoved: profilesMenu.removeItem(object)
|
||||
}
|
||||
}
|
||||
Menu {
|
||||
title: qsTr("Help")
|
||||
MenuItem {
|
||||
text: showAboutAction.text
|
||||
onTriggered: showAboutAction.trigger()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -19,7 +19,7 @@
|
||||
<file>SettingsTerminalTab.qml</file>
|
||||
<file>FontScanlines.qml</file>
|
||||
<file>fonts/1977-apple2/PrintChar21.ttf</file>
|
||||
<file>fonts/1971-ibm-3278/3270Medium.ttf</file>
|
||||
<file>fonts/1971-ibm-3278/3270-Regular.ttf</file>
|
||||
<file>Storage.qml</file>
|
||||
<file>SettingsAdvancedTab.qml</file>
|
||||
<file>TerminalContainer.qml</file>
|
||||
@@ -40,10 +40,11 @@
|
||||
<file>fonts/1977-commodore-pet/PetMe.ttf</file>
|
||||
<file>BurnInEffect.qml</file>
|
||||
<file>fonts/modern-terminus/TerminusTTF-4.46.0.ttf</file>
|
||||
<file>NewTerminalFrame.qml</file>
|
||||
<file>SlowBurnIn.qml</file>
|
||||
<file>TerminalFrame.qml</file>
|
||||
<file>menus/WindowMenu.qml</file>
|
||||
<file>menus/FullContextMenu.qml</file>
|
||||
<file>menus/ShortContextMenu.qml</file>
|
||||
<file>ShaderLibrary.qml</file>
|
||||
<file>menus/OSXMenu.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
@@ -31,13 +31,18 @@ function lint(a, b, t) {
|
||||
return (1 - t) * a + (t) * b;
|
||||
}
|
||||
|
||||
function mix(c1, c2, alpha){
|
||||
function mix(c1, c2, alpha) {
|
||||
return Qt.rgba(c1.r * alpha + c2.r * (1-alpha),
|
||||
c1.g * alpha + c2.g * (1-alpha),
|
||||
c1.b * alpha + c2.b * (1-alpha),
|
||||
c1.a * alpha + c2.a * (1-alpha))
|
||||
}
|
||||
|
||||
function smoothstep(min, max, value) {
|
||||
let x = Math.max(0, Math.min(1, (value - min) / (max - min)));
|
||||
return x * x * (3 - 2 * x);
|
||||
}
|
||||
|
||||
function strToColor(s){
|
||||
var r = parseInt(s.substring(1,3), 16) / 256;
|
||||
var g = parseInt(s.substring(3,5), 16) / 256;
|
||||
|
||||
Submodule qmltermwidget updated: 5c47d1f494...63228027e1
Reference in New Issue
Block a user