Compare commits
	
		
			25 Commits
		
	
	
		
			fix-qml-st
			...
			1.2.0-beta
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | 36b1cd2dde | ||
|   | 80374b3ec6 | ||
|   | bc00d1e45f | ||
|   | 6ddb507247 | ||
|   | b0f3b8f3d0 | ||
|   | 06e7191056 | ||
|   | 997131ba64 | ||
|   | ef9f412e5f | ||
|   | 7b69d41c60 | ||
|   | 552947f507 | ||
|   | f69f2df63c | ||
|   | aa270067f6 | ||
|   | 28977313da | ||
|   | cfe35d7795 | ||
|   | 4abbe332db | ||
|   | 3104abd4ad | ||
|   | 7714f7b503 | ||
|   | 9d06f10a9b | ||
|   | 8c27f7683b | ||
|   | bf1a491789 | ||
|   | 0f18a0349a | ||
|   | 39181f42cf | ||
|   | 3d706ad1a7 | ||
|   | a31b77e5bc | ||
|   | b417643415 | 
							
								
								
									
										4
									
								
								.github/FUNDING.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								.github/FUNDING.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,4 @@ | |||||||
|  | # These are supported funding model platforms | ||||||
|  |  | ||||||
|  | patreon: swordfish90 | ||||||
|  | custom: ['https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=flscogna%40gmail.com&item_name=Support+CRT¤cy_code=EUR&source=url'] | ||||||
							
								
								
									
										17
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								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. | 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 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. | 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 | 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`: | **FreeBSD** users can install cool-retro-term with `pkg`: | ||||||
| @@ -202,10 +206,5 @@ open cool-retro-term.app | |||||||
| **Homebrew** | **Homebrew** | ||||||
|  |  | ||||||
| ```sh | ```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). |  | ||||||
|  |  | ||||||
| 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  | TARGET = cool-retro-term  | ||||||
|  |  | ||||||
| DESTDIR = $$OUT_PWD/../ | DESTDIR = $$OUT_PWD/../ | ||||||
|   | |||||||
							
								
								
									
										16
									
								
								app/main.cpp
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								app/main.cpp
									
									
									
									
									
								
							| @@ -6,11 +6,13 @@ | |||||||
|  |  | ||||||
| #include <QtWidgets/QApplication> | #include <QtWidgets/QApplication> | ||||||
| #include <QIcon> | #include <QIcon> | ||||||
|  | #include <QQuickStyle> | ||||||
|  |  | ||||||
| #include <QDebug> | #include <QDebug> | ||||||
| #include <stdlib.h> | #include <stdlib.h> | ||||||
|  |  | ||||||
| #include <QFontDatabase> | #include <QFontDatabase> | ||||||
|  | #include <QLoggingCategory> | ||||||
|  |  | ||||||
| #include <fileio.h> | #include <fileio.h> | ||||||
| #include <monospacefontmanager.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. |     // This disables QT appmenu under Ubuntu, which is not working with QML apps. | ||||||
|     setenv("QT_QPA_PLATFORMTHEME", "", 1); |     setenv("QT_QPA_PLATFORMTHEME", "", 1); | ||||||
|  |  | ||||||
|  |     // Disable Connections slot warnings | ||||||
|  |     QLoggingCategory::setFilterRules("qt.qml.connections.warning=false"); | ||||||
|  |  | ||||||
| #if defined (Q_OS_LINUX) | #if defined (Q_OS_LINUX) | ||||||
|     setenv("QSG_RENDER_LOOP", "threaded", 0); |     setenv("QSG_RENDER_LOOP", "threaded", 0); | ||||||
| #endif | #endif | ||||||
| @@ -42,6 +47,9 @@ int main(int argc, char *argv[]) | |||||||
|     setenv("LC_CTYPE", "UTF-8", 1); |     setenv("LC_CTYPE", "UTF-8", 1); | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
|  |     // Force fusion style on every platform | ||||||
|  |     QQuickStyle::setStyle("Fusion"); | ||||||
|  |  | ||||||
|     if (argc>1 && (!strcmp(argv[1],"-h") || !strcmp(argv[1],"--help"))) { |     if (argc>1 && (!strcmp(argv[1],"-h") || !strcmp(argv[1],"--help"))) { | ||||||
|         QTextStream cout(stdout, QIODevice::WriteOnly); |         QTextStream cout(stdout, QIODevice::WriteOnly); | ||||||
|         cout << "Usage: " << argv[0] << " [--default-settings] [--workdir <dir>] [--program <prog>] [-p|--profile <prof>] [--fullscreen] [-h|--help]" << endl; |         cout << "Usage: " << argv[0] << " [--default-settings] [--workdir <dir>] [--program <prog>] [-p|--profile <prof>] [--fullscreen] [-h|--help]" << endl; | ||||||
| @@ -56,18 +64,16 @@ int main(int argc, char *argv[]) | |||||||
|         return 0; |         return 0; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     QString appVersion("1.1.1"); |     QString appVersion("1.2.0-beta1"); | ||||||
|  |  | ||||||
|     if (argc>1 && (!strcmp(argv[1],"-v") || !strcmp(argv[1],"--version"))) { |     if (argc>1 && (!strcmp(argv[1],"-v") || !strcmp(argv[1],"--version"))) { | ||||||
|         QTextStream cout(stdout, QIODevice::WriteOnly); |         QTextStream cout(stdout, QIODevice::WriteOnly); | ||||||
|         cout << "cool-retro-term " << appVersion << endl; |         cout << "cool-retro-term " << appVersion << endl; | ||||||
| 	return 0; |         return 0; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     QApplication app(argc, argv); |     QApplication app(argc, argv); | ||||||
|     // set application attributes |     app.setAttribute(Qt::AA_MacDontSwapCtrlAndMeta, true); | ||||||
|     // Has no effects, see https://bugreports.qt.io/browse/QTBUG-51293 |  | ||||||
|     // app.setAttribute(Qt::AA_MacDontSwapCtrlAndMeta, true); |  | ||||||
|  |  | ||||||
|     QQmlApplicationEngine engine; |     QQmlApplicationEngine engine; | ||||||
|     FileIO fileIO; |     FileIO fileIO; | ||||||
|   | |||||||
| @@ -34,6 +34,8 @@ QtObject { | |||||||
|     readonly property real minBurnInFadeTime: 160 |     readonly property real minBurnInFadeTime: 160 | ||||||
|     readonly property real maxBurnInFadeTime: 1600 |     readonly property real maxBurnInFadeTime: 1600 | ||||||
|  |  | ||||||
|  |     property bool isMacOS: Qt.platform.os === "osx" | ||||||
|  |  | ||||||
|     // GENERAL SETTINGS /////////////////////////////////////////////////////// |     // GENERAL SETTINGS /////////////////////////////////////////////////////// | ||||||
|     property int x: 100 |     property int x: 100 | ||||||
|     property int y: 100 |     property int y: 100 | ||||||
| @@ -41,7 +43,7 @@ QtObject { | |||||||
|     property int height: 768 |     property int height: 768 | ||||||
|  |  | ||||||
|     property bool fullscreen: false |     property bool fullscreen: false | ||||||
|     property bool showMenubar: Qt.platform.os === "osx" ? true : false |     property bool showMenubar: false | ||||||
|  |  | ||||||
|     property string wintitle: "cool-retro-term" |     property string wintitle: "cool-retro-term" | ||||||
|  |  | ||||||
| @@ -52,9 +54,7 @@ QtObject { | |||||||
|     property bool verbose: false |     property bool verbose: false | ||||||
|  |  | ||||||
|     property real bloomQuality: 0.5 |     property real bloomQuality: 0.5 | ||||||
|  |  | ||||||
|     property real burnInQuality: 0.5 |     property real burnInQuality: 0.5 | ||||||
|     property bool useFastBurnIn: Qt.platform.os === "osx" ? false : true |  | ||||||
|  |  | ||||||
|     property bool blinkingCursor: false |     property bool blinkingCursor: false | ||||||
|  |  | ||||||
| @@ -99,11 +99,17 @@ QtObject { | |||||||
|     property real rbgShift: 0.0 |     property real rbgShift: 0.0 | ||||||
|  |  | ||||||
|     property real _margin: 0.5 |     property real _margin: 0.5 | ||||||
|  |     property real _frameMargin: 0.5 | ||||||
|  |  | ||||||
|     property real margin: Utils.lint(1.0, 20.0, _margin) |     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 no_rasterization: 0 | ||||||
|     readonly property int scanline_rasterization: 1 |     readonly property int scanline_rasterization: 1 | ||||||
|     readonly property int pixel_rasterization: 2 |     readonly property int pixel_rasterization: 2 | ||||||
|  |     readonly property int subpixel_rasterization: 3 | ||||||
|  |  | ||||||
|     property int rasterization: no_rasterization |     property int rasterization: no_rasterization | ||||||
|  |  | ||||||
| @@ -145,6 +151,13 @@ QtObject { | |||||||
|                     target: fontManager |                     target: fontManager | ||||||
|                     source: "FontPixels.qml" |                     source: "FontPixels.qml" | ||||||
|                 } |                 } | ||||||
|  |             }, | ||||||
|  |             State { | ||||||
|  |                 when: rasterization == subpixel_rasterization | ||||||
|  |                 PropertyChanges { | ||||||
|  |                     target: fontManager | ||||||
|  |                     source: "FontPixels.qml" | ||||||
|  |                 } | ||||||
|             } |             } | ||||||
|         ] |         ] | ||||||
|  |  | ||||||
| @@ -229,9 +242,7 @@ QtObject { | |||||||
|             "bloomQuality": bloomQuality, |             "bloomQuality": bloomQuality, | ||||||
|             "burnInQuality": burnInQuality, |             "burnInQuality": burnInQuality, | ||||||
|             "useCustomCommand": useCustomCommand, |             "useCustomCommand": useCustomCommand, | ||||||
|             "customCommand": customCommand, |             "customCommand": customCommand | ||||||
|             "useFastBurnIn": useFastBurnIn, |  | ||||||
|             "blinkingCursor": blinkingCursor |  | ||||||
|         } |         } | ||||||
|         return stringify(settings) |         return stringify(settings) | ||||||
|     } |     } | ||||||
| @@ -258,7 +269,9 @@ QtObject { | |||||||
|             "windowOpacity": windowOpacity, |             "windowOpacity": windowOpacity, | ||||||
|             "fontName": fontNames[rasterization], |             "fontName": fontNames[rasterization], | ||||||
|             "fontWidth": fontWidth, |             "fontWidth": fontWidth, | ||||||
|             "margin": _margin |             "margin": _margin, | ||||||
|  |             "blinkingCursor": blinkingCursor, | ||||||
|  |             "frameMargin": _frameMargin, | ||||||
|         } |         } | ||||||
|         return settings |         return settings | ||||||
|     } |     } | ||||||
| @@ -324,12 +337,6 @@ QtObject { | |||||||
|                 !== undefined ? settings.useCustomCommand : useCustomCommand |                 !== undefined ? settings.useCustomCommand : useCustomCommand | ||||||
|         customCommand = settings.customCommand |         customCommand = settings.customCommand | ||||||
|                 !== undefined ? settings.customCommand : customCommand |                 !== undefined ? settings.customCommand : customCommand | ||||||
|  |  | ||||||
|         useFastBurnIn = settings.useFastBurnIn |  | ||||||
|                 !== undefined ? settings.useFastBurnIn : useFastBurnIn |  | ||||||
|  |  | ||||||
|         blinkingCursor = settings.blinkingCursor |  | ||||||
|                 !== undefined ? settings.blinkingCursor : blinkingCursor |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     function loadProfileString(profileString) { |     function loadProfileString(profileString) { | ||||||
| @@ -371,6 +378,9 @@ QtObject { | |||||||
|         fontWidth = settings.fontWidth !== undefined ? settings.fontWidth : fontWidth |         fontWidth = settings.fontWidth !== undefined ? settings.fontWidth : fontWidth | ||||||
|  |  | ||||||
|         _margin = settings.margin !== undefined ? settings.margin : _margin |         _margin = settings.margin !== undefined ? settings.margin : _margin | ||||||
|  |         _frameMargin = settings.frameMargin !== undefined ? settings.frameMargin : _frameMargin | ||||||
|  |  | ||||||
|  |         blinkingCursor = settings.blinkingCursor !== undefined ? settings.blinkingCursor : blinkingCursor | ||||||
|  |  | ||||||
|         handleFontChanged() |         handleFontChanged() | ||||||
|     } |     } | ||||||
| @@ -451,7 +461,9 @@ QtObject { | |||||||
|                 "screenCurvature": 0.3, |                 "screenCurvature": 0.3, | ||||||
|                 "staticNoise": 0.1198, |                 "staticNoise": 0.1198, | ||||||
|                 "windowOpacity": 1, |                 "windowOpacity": 1, | ||||||
|                 "margin": 0.5 |                 "margin": 0.5, | ||||||
|  |                 "blinkingCursor": false, | ||||||
|  |                 "frameMargin": 0.1 | ||||||
|             }' |             }' | ||||||
|             builtin: true |             builtin: true | ||||||
|         } |         } | ||||||
| @@ -478,7 +490,9 @@ QtObject { | |||||||
|                 "screenCurvature": 0.3, |                 "screenCurvature": 0.3, | ||||||
|                 "staticNoise": 0.1198, |                 "staticNoise": 0.1198, | ||||||
|                 "windowOpacity": 1, |                 "windowOpacity": 1, | ||||||
|                 "margin": 0.5 |                 "margin": 0.5, | ||||||
|  |                 "blinkingCursor": false, | ||||||
|  |                 "frameMargin": 0.1 | ||||||
|             }' |             }' | ||||||
|             builtin: true |             builtin: true | ||||||
|         } |         } | ||||||
| @@ -505,7 +519,9 @@ QtObject { | |||||||
|                 "screenCurvature": 0.3, |                 "screenCurvature": 0.3, | ||||||
|                 "staticNoise": 0.15, |                 "staticNoise": 0.15, | ||||||
|                 "windowOpacity": 1, |                 "windowOpacity": 1, | ||||||
|                 "margin": 0.5 |                 "margin": 0.5, | ||||||
|  |                 "blinkingCursor": false, | ||||||
|  |                 "frameMargin": 0.1 | ||||||
|             }' |             }' | ||||||
|             builtin: true |             builtin: true | ||||||
|         } |         } | ||||||
| @@ -532,7 +548,9 @@ QtObject { | |||||||
|                 "screenCurvature": 0, |                 "screenCurvature": 0, | ||||||
|                 "staticNoise": 0.15, |                 "staticNoise": 0.15, | ||||||
|                 "windowOpacity": 1, |                 "windowOpacity": 1, | ||||||
|                 "margin": 0.5 |                 "margin": 0.5, | ||||||
|  |                 "blinkingCursor": false, | ||||||
|  |                 "frameMargin": 0.1 | ||||||
|             }' |             }' | ||||||
|             builtin: true |             builtin: true | ||||||
|         } |         } | ||||||
| @@ -559,7 +577,9 @@ QtObject { | |||||||
|                 "screenCurvature": 0.5, |                 "screenCurvature": 0.5, | ||||||
|                 "staticNoise": 0.099, |                 "staticNoise": 0.099, | ||||||
|                 "windowOpacity": 1, |                 "windowOpacity": 1, | ||||||
|                 "margin": 0.5 |                 "margin": 0.5, | ||||||
|  |                 "blinkingCursor": false, | ||||||
|  |                 "frameMargin": 0.2 | ||||||
|             }' |             }' | ||||||
|             builtin: true |             builtin: true | ||||||
|         } |         } | ||||||
| @@ -586,7 +606,9 @@ QtObject { | |||||||
|                 "screenCurvature": 0.5, |                 "screenCurvature": 0.5, | ||||||
|                 "staticNoise": 0.2969, |                 "staticNoise": 0.2969, | ||||||
|                 "windowOpacity": 1, |                 "windowOpacity": 1, | ||||||
|                 "margin": 0.5 |                 "margin": 0.5, | ||||||
|  |                 "blinkingCursor": false, | ||||||
|  |                 "frameMargin": 0.5 | ||||||
|             }' |             }' | ||||||
|             builtin: true |             builtin: true | ||||||
|         } |         } | ||||||
| @@ -613,7 +635,9 @@ QtObject { | |||||||
|                 "screenCurvature": 0.4, |                 "screenCurvature": 0.4, | ||||||
|                 "staticNoise": 0.0503, |                 "staticNoise": 0.0503, | ||||||
|                 "windowOpacity": 1, |                 "windowOpacity": 1, | ||||||
|                 "margin": 0.5 |                 "margin": 0.5, | ||||||
|  |                 "blinkingCursor": false, | ||||||
|  |                 "frameMargin": 0.2 | ||||||
|             }' |             }' | ||||||
|             builtin: true |             builtin: true | ||||||
|         } |         } | ||||||
| @@ -640,7 +664,9 @@ QtObject { | |||||||
|                 "screenCurvature": 0.2, |                 "screenCurvature": 0.2, | ||||||
|                 "staticNoise": 0, |                 "staticNoise": 0, | ||||||
|                 "windowOpacity": 1, |                 "windowOpacity": 1, | ||||||
|                 "margin": 0.5 |                 "margin": 0.5, | ||||||
|  |                 "blinkingCursor": false, | ||||||
|  |                 "frameMargin": 0.1 | ||||||
|             }' |             }' | ||||||
|             builtin: true |             builtin: true | ||||||
|         } |         } | ||||||
| @@ -667,7 +693,9 @@ QtObject { | |||||||
|                 "screenCurvature": 0, |                 "screenCurvature": 0, | ||||||
|                 "staticNoise": 0.0955, |                 "staticNoise": 0.0955, | ||||||
|                 "windowOpacity": 0.7, |                 "windowOpacity": 0.7, | ||||||
|                 "margin": 0.1 |                 "margin": 0.1, | ||||||
|  |                 "blinkingCursor": false, | ||||||
|  |                 "frameMargin": 0 | ||||||
|             }' |             }' | ||||||
|             builtin: true |             builtin: true | ||||||
|         } |         } | ||||||
|   | |||||||
| @@ -29,26 +29,29 @@ Loader { | |||||||
|     property real lastUpdate: 0 |     property real lastUpdate: 0 | ||||||
|     property real prevLastUpdate: 0 |     property real prevLastUpdate: 0 | ||||||
|  |  | ||||||
|     property real delay: (1.0 / appSettings.fps) * 1000 |  | ||||||
|     property real burnIn: appSettings.burnIn |     property real burnIn: appSettings.burnIn | ||||||
|     property real burnInFadeTime: 1 / Utils.lint(_minBurnInFadeTime, _maxBurnInFadeTime, burnIn) |     property real burnInFadeTime: 1 / Utils.lint(_minBurnInFadeTime, _maxBurnInFadeTime, burnIn) | ||||||
|     property real _minBurnInFadeTime: appSettings.minBurnInFadeTime |     property real _minBurnInFadeTime: appSettings.minBurnInFadeTime | ||||||
|     property real _maxBurnInFadeTime: appSettings.maxBurnInFadeTime |     property real _maxBurnInFadeTime: appSettings.maxBurnInFadeTime | ||||||
|  |  | ||||||
|     active: appSettings.useFastBurnIn && appSettings.burnIn !== 0 |     active: appSettings.burnIn !== 0 | ||||||
|  |  | ||||||
|     anchors.fill: parent |     anchors.fill: parent | ||||||
|  |  | ||||||
|     function completelyUpdate() { |     function completelyUpdate() { | ||||||
|         prevLastUpdate = lastUpdate; |         let newTime = timeManager.time | ||||||
|         lastUpdate = timeManager.time; |         if (newTime > lastUpdate) { | ||||||
|         item.source.scheduleUpdate(); |             prevLastUpdate = lastUpdate | ||||||
|  |             lastUpdate = newTime | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         item.source.scheduleUpdate() | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     function restartBlurSource(){ |     function restartBlurSource() { | ||||||
|         prevLastUpdate = timeManager.time; |         prevLastUpdate = timeManager.time | ||||||
|         lastUpdate = prevLastUpdate; |         lastUpdate = prevLastUpdate | ||||||
|         completelyUpdate(); |         completelyUpdate() | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     sourceComponent: Item { |     sourceComponent: Item { | ||||||
| @@ -72,23 +75,37 @@ Loader { | |||||||
|  |  | ||||||
|             Connections { |             Connections { | ||||||
|                 target: kterminal |                 target: kterminal | ||||||
|                 onImagePainted: completelyUpdate() |  | ||||||
|  |                 function onImagePainted() { | ||||||
|  |                     completelyUpdate() | ||||||
|  |                 } | ||||||
|             } |             } | ||||||
|             // Restart blurred source settings change. |             // Restart blurred source settings change. | ||||||
|             Connections{ |  | ||||||
|                 target: appSettings |  | ||||||
|                 onBurnInChanged: burnInEffect.restartBlurSource(); |  | ||||||
|                 onTerminalFontChanged: burnInEffect.restartBlurSource(); |  | ||||||
|                 onRasterizationChanged: burnInEffect.restartBlurSource(); |  | ||||||
|                 onBurnInQualityChanged: burnInEffect.restartBlurSource(); |  | ||||||
|             } |  | ||||||
|  |  | ||||||
|             Connections { |             Connections { | ||||||
|                 target: kterminalScrollbar |                 target: appSettings | ||||||
|                 onOpacityChanged: completelyUpdate() |  | ||||||
|  |                 function onBurnInChanged() { | ||||||
|  |                     burnInEffect.restartBlurSource() | ||||||
|  |                 } | ||||||
|  |  | ||||||
|  |                 function onTerminalFontChanged() { | ||||||
|  |                     burnInEffect.restartBlurSource() | ||||||
|  |                 } | ||||||
|  |  | ||||||
|  |                 function onRasterizationChanged() { | ||||||
|  |                     burnInEffect.restartBlurSource() | ||||||
|  |                 } | ||||||
|  |  | ||||||
|  |                 function onBurnInQualityChanged() { | ||||||
|  |                     burnInEffect.restartBlurSource() | ||||||
|  |                 } | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|  |  | ||||||
|  |         ShaderLibrary { | ||||||
|  |             id: shaderLibrary | ||||||
|  |         } | ||||||
|  |  | ||||||
|         ShaderEffect { |         ShaderEffect { | ||||||
|             id: burnInShaderEffect |             id: burnInShaderEffect | ||||||
|  |  | ||||||
| @@ -118,9 +135,7 @@ Loader { | |||||||
|  |  | ||||||
|                  uniform highp float prevLastUpdate;" + |                  uniform highp float prevLastUpdate;" + | ||||||
|  |  | ||||||
|                 "float rgb2grey(vec3 v){ |                 shaderLibrary.rgb2grey + | ||||||
|                     return dot(v, vec3(0.21, 0.72, 0.04)); |  | ||||||
|                 }" + |  | ||||||
|  |  | ||||||
|                 "void main() { |                 "void main() { | ||||||
|                     vec2 coords = qt_TexCoord0; |                     vec2 coords = qt_TexCoord0; | ||||||
|   | |||||||
| @@ -34,10 +34,8 @@ Item { | |||||||
|         visible: false |         visible: false | ||||||
|  |  | ||||||
|         //This is a workaround to a Qt 5.2 bug. |         //This is a workaround to a Qt 5.2 bug. | ||||||
|         onColorChanged: if (Qt.platform.os !== "osx") |         onColorChanged: if (!appSettings.isMacOS) colorSelected(color) | ||||||
|                             colorSelected(color) |         onAccepted: if (appSettings.isMacOS) colorSelected(color) | ||||||
|         onAccepted: if (Qt.platform.os === "osx") |  | ||||||
|                         colorSelected(color) |  | ||||||
|     } |     } | ||||||
|     Rectangle { |     Rectangle { | ||||||
|         anchors.fill: parent |         anchors.fill: parent | ||||||
|   | |||||||
| @@ -213,7 +213,7 @@ QtObject { | |||||||
|         ListElement { |         ListElement { | ||||||
|             name: "IBM_3278" |             name: "IBM_3278" | ||||||
|             text: "HD: IBM 3278 (1971)" |             text: "HD: IBM 3278 (1971)" | ||||||
|             source: "fonts/1971-ibm-3278/3270Medium.ttf" |             source: "fonts/1971-ibm-3278/3270-Regular.ttf" | ||||||
|             lineSpacing: 0.2 |             lineSpacing: 0.2 | ||||||
|             pixelSize: 32 |             pixelSize: 32 | ||||||
|             fontWidth: 1.0 |             fontWidth: 1.0 | ||||||
|   | |||||||
| @@ -34,7 +34,6 @@ Item{ | |||||||
|  |  | ||||||
|     property ShaderEffectSource mainSource: kterminalSource |     property ShaderEffectSource mainSource: kterminalSource | ||||||
|     property BurnInEffect burnInEffect: burnInEffect |     property BurnInEffect burnInEffect: burnInEffect | ||||||
|     property SlowBurnIn slowBurnInEffect: slowBurnInEffect |  | ||||||
|     property real fontWidth: 1.0 |     property real fontWidth: 1.0 | ||||||
|     property real screenScaling: 1.0 |     property real screenScaling: 1.0 | ||||||
|     property real scaleTexture: 1.0 |     property real scaleTexture: 1.0 | ||||||
| @@ -45,35 +44,61 @@ Item{ | |||||||
|     property size fontMetrics: kterminal.fontMetrics |     property size fontMetrics: kterminal.fontMetrics | ||||||
|  |  | ||||||
|     // Manage copy and paste |     // Manage copy and paste | ||||||
|     Connections{ |     Connections { | ||||||
|         target: copyAction |         target: copyAction | ||||||
|         onTriggered: kterminal.copyClipboard(); |  | ||||||
|  |         function onTriggered() { | ||||||
|  |             kterminal.copyClipboard() | ||||||
|  |         } | ||||||
|     } |     } | ||||||
|     Connections{ |     Connections { | ||||||
|         target: pasteAction |         target: pasteAction | ||||||
|         onTriggered: kterminal.pasteClipboard() |  | ||||||
|  |         function onTriggered() { | ||||||
|  |             kterminal.pasteClipboard() | ||||||
|  |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     //When settings are updated sources need to be redrawn. |     //When settings are updated sources need to be redrawn. | ||||||
|     Connections{ |     Connections { | ||||||
|         target: appSettings |         target: appSettings | ||||||
|         onFontScalingChanged: terminalContainer.updateSources(); |  | ||||||
|         onFontWidthChanged: terminalContainer.updateSources(); |         function onFontScalingChanged() { | ||||||
|  |             terminalContainer.updateSources() | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         function onFontWidthChanged() { | ||||||
|  |             terminalContainer.updateSources() | ||||||
|  |         } | ||||||
|     } |     } | ||||||
|     Connections{ |     Connections { | ||||||
|         target: terminalContainer |         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() { |     function updateSources() { | ||||||
|         kterminal.update(); |         kterminal.update() | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     QMLTermWidget { |     QMLTermWidget { | ||||||
|         id: kterminal |         id: kterminal | ||||||
|  |  | ||||||
|         property int textureResolutionScale: appSettings.lowResolutionFont ? devicePixelRatio : 1 |         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 totalWidth: Math.floor(parent.width / (screenScaling * fontWidth)) | ||||||
|         property int totalHeight: Math.floor(parent.height / screenScaling) |         property int totalHeight: Math.floor(parent.height / screenScaling) | ||||||
|  |  | ||||||
| @@ -143,7 +168,7 @@ Item{ | |||||||
|                 var args = Utils.tokenizeCommandLine(appSettings.customCommand); |                 var args = Utils.tokenizeCommandLine(appSettings.customCommand); | ||||||
|                 ksession.setShellProgram(args[0]); |                 ksession.setShellProgram(args[0]); | ||||||
|                 ksession.setArgs(args.slice(1)); |                 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. |                 // OSX Requires the following default parameters for auto login. | ||||||
|                 ksession.setArgs(["-i", "-l"]); |                 ksession.setArgs(["-i", "-l"]); | ||||||
|             } |             } | ||||||
| @@ -173,12 +198,12 @@ Item{ | |||||||
|  |  | ||||||
|     Loader { |     Loader { | ||||||
|         id: menuLoader |         id: menuLoader | ||||||
|         sourceComponent: (Qt.platform.os === "osx" || appSettings.showMenubar ? shortContextMenu : fullContextMenu) |         sourceComponent: (appSettings.isMacOS || appSettings.showMenubar ? shortContextMenu : fullContextMenu) | ||||||
|     } |     } | ||||||
|     property alias contextmenu: menuLoader.item |     property alias contextmenu: menuLoader.item | ||||||
|  |  | ||||||
|     MouseArea{ |     MouseArea { | ||||||
|         property real margin: appSettings.margin |         property real margin: appSettings.totalMargin | ||||||
|  |  | ||||||
|         acceptedButtons: Qt.LeftButton | Qt.MiddleButton | Qt.RightButton |         acceptedButtons: Qt.LeftButton | Qt.MiddleButton | Qt.RightButton | ||||||
|         anchors.fill: parent |         anchors.fill: parent | ||||||
| @@ -219,8 +244,8 @@ Item{ | |||||||
|             var cc = Qt.size(0.5 - x, 0.5 - y); |             var cc = Qt.size(0.5 - x, 0.5 - y); | ||||||
|             var distortion = (cc.height * cc.height + cc.width * cc.width) * appSettings.screenCurvature * appSettings.screenCurvatureSize; |             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, |             return Qt.point((x - cc.width  * (1+distortion) * distortion) * (kterminal.totalWidth), | ||||||
|                            (y - cc.height * (1+distortion) * distortion) * kterminal.totalHeight) |                            (y - cc.height * (1+distortion) * distortion) * (kterminal.totalHeight)) | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|     ShaderEffectSource{ |     ShaderEffectSource{ | ||||||
| @@ -250,9 +275,5 @@ Item{ | |||||||
|         BurnInEffect { |         BurnInEffect { | ||||||
|             id: burnInEffect |             id: burnInEffect | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         SlowBurnIn { |  | ||||||
|             id: slowBurnInEffect |  | ||||||
|         } |  | ||||||
|     } |     } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -154,12 +154,6 @@ ColumnLayout { | |||||||
|             Label { |             Label { | ||||||
|                 text: Math.round(burnInSlider.value * 100) + "%" |                 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.fillWidth: true | ||||||
|                 Layout.fillHeight: true |                 Layout.fillHeight: true | ||||||
|                 model: appSettings.profilesList |                 model: appSettings.profilesList | ||||||
|  |                 clip: true | ||||||
|                 delegate: Rectangle { |                 delegate: Rectangle { | ||||||
|                     width: label.width |                     width: label.width | ||||||
|                     height: label.height |                     height: label.height | ||||||
| @@ -206,12 +207,21 @@ ColumnLayout { | |||||||
|                 onValueChanged: appSettings._margin = value |                 onValueChanged: appSettings._margin = value | ||||||
|                 value: appSettings._margin |                 value: appSettings._margin | ||||||
|             } |             } | ||||||
|  |             Label { | ||||||
|  |                 text: qsTr("Frame size") | ||||||
|  |             } | ||||||
|  |             SimpleSlider { | ||||||
|  |                 onValueChanged: appSettings._frameMargin = value | ||||||
|  |                 value: appSettings._frameMargin | ||||||
|  |             } | ||||||
|             Label { |             Label { | ||||||
|                 text: qsTr("Opacity") |                 text: qsTr("Opacity") | ||||||
|  |                 visible: !appSettings.isMacOS | ||||||
|             } |             } | ||||||
|             SimpleSlider { |             SimpleSlider { | ||||||
|                 onValueChanged: appSettings.windowOpacity = value |                 onValueChanged: appSettings.windowOpacity = value | ||||||
|                 value: appSettings.windowOpacity |                 value: appSettings.windowOpacity | ||||||
|  |                 visible: !appSettings.isMacOS | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -41,7 +41,7 @@ ColumnLayout { | |||||||
|                 property string selectedElement: model[currentIndex] |                 property string selectedElement: model[currentIndex] | ||||||
|  |  | ||||||
|                 Layout.fillWidth: true |                 Layout.fillWidth: true | ||||||
|                 model: [qsTr("Default"), qsTr("Scanlines"), qsTr("Pixels")] |                 model: [qsTr("Default"), qsTr("Scanlines"), qsTr("Pixels"), qsTr("Sub-Pixels")] | ||||||
|                 currentIndex: appSettings.rasterization |                 currentIndex: appSettings.rasterization | ||||||
|                 onCurrentIndexChanged: { |                 onCurrentIndexChanged: { | ||||||
|                     appSettings.rasterization = currentIndex |                     appSettings.rasterization = currentIndex | ||||||
| @@ -68,7 +68,10 @@ ColumnLayout { | |||||||
|                 } |                 } | ||||||
|                 Connections { |                 Connections { | ||||||
|                     target: appSettings |                     target: appSettings | ||||||
|                     onTerminalFontChanged: fontChanger.updateIndex() |  | ||||||
|  |                     function onTerminalFontChanged() { | ||||||
|  |                         fontChanger.updateIndex() | ||||||
|  |                     } | ||||||
|                 } |                 } | ||||||
|                 Component.onCompleted: updateIndex() |                 Component.onCompleted: updateIndex() | ||||||
|             } |             } | ||||||
|   | |||||||
| @@ -27,42 +27,49 @@ import QtQuick.Dialogs 1.1 | |||||||
| Window { | Window { | ||||||
|     id: settings_window |     id: settings_window | ||||||
|     title: qsTr("Settings") |     title: qsTr("Settings") | ||||||
|     width: 800 |     width: 600 | ||||||
|     height: 600 |     height: 480 | ||||||
|  |  | ||||||
|     property int tabmargins: 15 |     property int tabmargins: 15 | ||||||
|  |  | ||||||
|     TabBar { |     Item { | ||||||
|         id: bar |         anchors { fill: parent;  margins: tabmargins } | ||||||
|         width: parent.width |  | ||||||
|         TabButton { |  | ||||||
|             text: qsTr("General") |  | ||||||
|         } |  | ||||||
|         TabButton { |  | ||||||
|             text: qsTr("Terminal") |  | ||||||
|         } |  | ||||||
|         TabButton { |  | ||||||
|             text: qsTr("Effects") |  | ||||||
|         } |  | ||||||
|         TabButton { |  | ||||||
|             text: qsTr("Advanced") |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     StackLayout { |         TabBar { | ||||||
|         anchors { |             id: bar | ||||||
|             top: bar.bottom |             anchors { left: parent.left; right: parent.right; top: parent.top; } | ||||||
|             left: parent.left |             TabButton { | ||||||
|             right: parent.right |                 text: qsTr("General") | ||||||
|             bottom: parent.bottom |             } | ||||||
|             margins: tabmargins |             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 { } |             StackLayout { | ||||||
|         SettingsTerminalTab { } |                 anchors.fill: parent | ||||||
|         SettingsEffectsTab { } |  | ||||||
|         SettingsAdvancedTab { } |                 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 | import "utils.js" as Utils | ||||||
|  |  | ||||||
| Item { | Item { | ||||||
|     property SlowBurnIn slowBurnInEffect |  | ||||||
|     property ShaderEffectSource source |     property ShaderEffectSource source | ||||||
|     property BurnInEffect burnInEffect |     property BurnInEffect burnInEffect | ||||||
|     property ShaderEffectSource bloomSource |     property ShaderEffectSource bloomSource | ||||||
| @@ -38,11 +37,19 @@ Item { | |||||||
|  |  | ||||||
|     property real ambientLight: appSettings.ambientLight * 0.2 |     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 { |      ShaderEffect { | ||||||
|          id: dynamicShader |          id: dynamicShader | ||||||
|  |  | ||||||
|  |          property ShaderLibrary shaderLibrary: ShaderLibrary { } | ||||||
|  |  | ||||||
|          property ShaderEffectSource screenBuffer: frameBuffer |          property ShaderEffectSource screenBuffer: frameBuffer | ||||||
|          property ShaderEffectSource burnInSource: burnInEffect.source |          property ShaderEffectSource burnInSource: burnInEffect.source | ||||||
|          property ShaderEffectSource frameSource: terminalFrameLoader.item |          property ShaderEffectSource frameSource: terminalFrameLoader.item | ||||||
| @@ -59,22 +66,24 @@ Item { | |||||||
|          property real glowingLine: appSettings.glowingLine * 0.2 |          property real glowingLine: appSettings.glowingLine * 0.2 | ||||||
|  |  | ||||||
|          // Fast burnin properties |          // Fast burnin properties | ||||||
|          property real burnIn: appSettings.useFastBurnIn ? appSettings.burnIn : 0 |          property real burnIn: appSettings.burnIn | ||||||
|          property real burnInLastUpdate: burnInEffect.lastUpdate |          property real burnInLastUpdate: burnInEffect.lastUpdate | ||||||
|          property real burnInTime: burnInEffect.burnInFadeTime |          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 real jitter: appSettings.jitter | ||||||
|          property size jitterDisplacement: Qt.size(0.007 * jitter, 0.002 * 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 shadowLength: 0.25 * screenCurvature * Utils.lint(0.50, 1.5, ambientLight) | ||||||
|          property real staticNoise: appSettings.staticNoise |          property real staticNoise: appSettings.staticNoise | ||||||
|          property size scaleNoiseSize: Qt.size((width) / (noiseTexture.width * appSettings.windowScaling * appSettings.totalFontScaling), |          property size scaleNoiseSize: Qt.size((width * 0.75) / (noiseTexture.width * appSettings.windowScaling * appSettings.totalFontScaling), | ||||||
|                                                (height) / (noiseTexture.height * 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 real time: timeManager.time | ||||||
|          property ShaderEffectSource noiseSource: noiseShaderSource |          property ShaderEffectSource noiseSource: noiseShaderSource | ||||||
| @@ -164,23 +173,22 @@ Item { | |||||||
|              uniform highp vec4 backgroundColor; |              uniform highp vec4 backgroundColor; | ||||||
|              uniform lowp float shadowLength; |              uniform lowp float shadowLength; | ||||||
|  |  | ||||||
|              uniform highp vec2 virtual_resolution;" + |              uniform highp vec2 virtualResolution; | ||||||
|  |              uniform lowp float rasterizationIntensity;\n" + | ||||||
|  |  | ||||||
|              (burnIn !== 0 ? " |              (burnIn !== 0 ? " | ||||||
|                  uniform sampler2D burnInSource; |                  uniform sampler2D burnInSource; | ||||||
|                  uniform highp float burnInLastUpdate; |                  uniform highp float burnInLastUpdate; | ||||||
|                  uniform highp float burnInTime;" : "") + |                  uniform highp float burnInTime;" : "") + | ||||||
|              (slowBurnIn !== 0 ? " |  | ||||||
|                  uniform sampler2D slowBurnInSource;" : "") + |  | ||||||
|              (staticNoise !== 0 ? " |              (staticNoise !== 0 ? " | ||||||
|                  uniform highp float staticNoise;" : "") + |                  uniform highp float staticNoise;" : "") + | ||||||
|              (((staticNoise !== 0 || jitter !== 0) |              (((staticNoise !== 0 || jitter !== 0) ||(fallBack && (flickering || horizontalSync))) ? " | ||||||
|                ||(fallBack && (flickering || horizontalSync))) ? " |  | ||||||
|                  uniform lowp sampler2D noiseSource; |                  uniform lowp sampler2D noiseSource; | ||||||
|                  uniform highp vec2 scaleNoiseSize;" : "") + |                  uniform highp vec2 scaleNoiseSize;" : "") + | ||||||
|              (screenCurvature !== 0 ? " |              (displayTerminalFrame ? " | ||||||
|                  uniform highp float screenCurvature; |  | ||||||
|                  uniform lowp sampler2D frameSource;" : "") + |                  uniform lowp sampler2D frameSource;" : "") + | ||||||
|  |              (screenCurvature !== 0 ? " | ||||||
|  |                  uniform highp float screenCurvature;" : "") + | ||||||
|              (glowingLine !== 0 ? " |              (glowingLine !== 0 ? " | ||||||
|                  uniform highp float glowingLine;" : "") + |                  uniform highp float glowingLine;" : "") + | ||||||
|              (chromaColor !== 0 ? " |              (chromaColor !== 0 ? " | ||||||
| @@ -203,17 +211,14 @@ Item { | |||||||
|  |  | ||||||
|              (glowingLine !== 0 ? " |              (glowingLine !== 0 ? " | ||||||
|                  float randomPass(vec2 coords){ |                  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) { |              shaderLibrary.min2 + | ||||||
|                  return min(v.x, v.y); |              shaderLibrary.rgb2grey + | ||||||
|              } |              shaderLibrary.rasterizationShader + | ||||||
|  |  | ||||||
|              float rgb2grey(vec3 v){ |  | ||||||
|                  return dot(v, vec3(0.21, 0.72, 0.04)); |  | ||||||
|              } |  | ||||||
|  |  | ||||||
|  |              " | ||||||
|              float isInScreen(vec2 v) { |              float isInScreen(vec2 v) { | ||||||
|                  return min2(step(0.0, v) - step(1.0, v)); |                  return min2(step(0.0, v) - step(1.0, v)); | ||||||
|              } |              } | ||||||
| @@ -291,7 +296,7 @@ Item { | |||||||
|                      color += noiseVal * noise * (1.0 - distance * 1.3);" : "") + |                      color += noiseVal * noise * (1.0 - distance * 1.3);" : "") + | ||||||
|  |  | ||||||
|                  (glowingLine !== 0 ? " |                  (glowingLine !== 0 ? " | ||||||
|                      color += randomPass(coords * virtual_resolution) * glowingLine;" : "") + |                      color += randomPass(coords * virtualResolution) * glowingLine;" : "") + | ||||||
|  |  | ||||||
|                  "vec3 txt_color = texture2D(screenBuffer, txt_coords).rgb;" + |                  "vec3 txt_color = texture2D(screenBuffer, txt_coords).rgb;" + | ||||||
|  |  | ||||||
| @@ -302,13 +307,10 @@ Item { | |||||||
|                      txt_color = max(txt_color, convertWithChroma(burnInColor));" |                      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 += fontColor.rgb * vec3(color);" + | ||||||
|  |  | ||||||
|  |                   "txt_color = applyRasterization(staticCoords, txt_color, virtualResolution, rasterizationIntensity);\n" + | ||||||
|  |  | ||||||
|                  "vec3 finalColor = txt_color;" + |                  "vec3 finalColor = txt_color;" + | ||||||
|  |  | ||||||
|                  (flickering !== 0 ? " |                  (flickering !== 0 ? " | ||||||
| @@ -317,7 +319,7 @@ Item { | |||||||
|                  (ambientLight !== 0 ? " |                  (ambientLight !== 0 ? " | ||||||
|                      finalColor += vec3(ambientLight) * (1.0 - distance) * (1.0 - distance);" : "") + |                      finalColor += vec3(ambientLight) * (1.0 - distance) * (1.0 - distance);" : "") + | ||||||
|  |  | ||||||
|                  (screenCurvature !== 0 ? |                  (displayTerminalFrame ? | ||||||
|                     "vec4 frameColor = texture2D(frameSource, qt_TexCoord0); |                     "vec4 frameColor = texture2D(frameSource, qt_TexCoord0); | ||||||
|                      finalColor = mix(finalColor, frameColor.rgb, frameColor.a);" |                      finalColor = mix(finalColor, frameColor.rgb, frameColor.a);" | ||||||
|                  : "") + |                  : "") + | ||||||
| @@ -340,7 +342,7 @@ Item { | |||||||
|      Loader { |      Loader { | ||||||
|          id: terminalFrameLoader |          id: terminalFrameLoader | ||||||
|  |  | ||||||
|          active: screenCurvature !== 0 |          active: dynamicShader.displayTerminalFrame | ||||||
|  |  | ||||||
|          width: staticShader.width |          width: staticShader.width | ||||||
|          height: staticShader.height |          height: staticShader.height | ||||||
| @@ -352,7 +354,7 @@ Item { | |||||||
|              visible: false |              visible: false | ||||||
|              format: ShaderEffectSource.RGBA |              format: ShaderEffectSource.RGBA | ||||||
|  |  | ||||||
|              NewTerminalFrame { |              TerminalFrame { | ||||||
|                  id: terminalFrame |                  id: terminalFrame | ||||||
|                  blending: false |                  blending: false | ||||||
|                  anchors.fill: parent |                  anchors.fill: parent | ||||||
| @@ -360,6 +362,10 @@ Item { | |||||||
|          } |          } | ||||||
|      } |      } | ||||||
|  |  | ||||||
|  |      ShaderLibrary { | ||||||
|  |          id: shaderLibrary | ||||||
|  |      } | ||||||
|  |  | ||||||
|      ShaderEffect { |      ShaderEffect { | ||||||
|          id: staticShader |          id: staticShader | ||||||
|  |  | ||||||
| @@ -385,7 +391,7 @@ Item { | |||||||
|  |  | ||||||
|          property real ambientLight: parent.ambientLight |          property real ambientLight: parent.ambientLight | ||||||
|  |  | ||||||
|          property size virtual_resolution: parent.virtual_resolution |          property size virtualResolution: parent.virtualResolution | ||||||
|  |  | ||||||
|          blending: false |          blending: false | ||||||
|          visible: false |          visible: false | ||||||
| @@ -408,7 +414,7 @@ Item { | |||||||
|              uniform highp vec4 backgroundColor; |              uniform highp vec4 backgroundColor; | ||||||
|              uniform lowp float screen_brightness; |              uniform lowp float screen_brightness; | ||||||
|  |  | ||||||
|              uniform highp vec2 virtual_resolution;" + |              uniform highp vec2 virtualResolution;" + | ||||||
|  |  | ||||||
|              (bloom !== 0 ? " |              (bloom !== 0 ? " | ||||||
|                  uniform highp sampler2D bloomSource; |                  uniform highp sampler2D bloomSource; | ||||||
| @@ -426,36 +432,9 @@ Item { | |||||||
|              (ambientLight !== 0 ? " |              (ambientLight !== 0 ? " | ||||||
|                  uniform lowp float ambientLight;" : "") + |                  uniform lowp float ambientLight;" : "") + | ||||||
|  |  | ||||||
|              "highp float getScanlineIntensity(vec2 coords) { |              shaderLibrary.min2 + | ||||||
|                  float result = 1.0;" + |              shaderLibrary.sum2 + | ||||||
|  |              shaderLibrary.rgb2grey + | ||||||
|                 (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)); |  | ||||||
|              }" + |  | ||||||
|  |  | ||||||
|              "vec3 convertWithChroma(vec3 inColor) { |              "vec3 convertWithChroma(vec3 inColor) { | ||||||
|                 vec3 outColor = inColor;" + |                 vec3 outColor = inColor;" + | ||||||
| @@ -468,6 +447,7 @@ Item { | |||||||
|              "  return outColor; |              "  return outColor; | ||||||
|              }" + |              }" + | ||||||
|  |  | ||||||
|  |              shaderLibrary.rasterizationShader + | ||||||
|  |  | ||||||
|              "void main() {" + |              "void main() {" + | ||||||
|                  "vec2 cc = vec2(0.5) - qt_TexCoord0;" + |                  "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.b = leftColor.b * 0.30 + rightColor.b * 0.10 + txt_color.b * 0.60; | ||||||
|                  " : "") + |                  " : "") + | ||||||
|  |  | ||||||
|                   "txt_color *= getScanlineIntensity(txt_coords);" + |  | ||||||
|  |  | ||||||
|                   "txt_color += vec3(0.0001);" + |                   "txt_color += vec3(0.0001);" + | ||||||
|                   "float greyscale_color = rgb2grey(txt_color);" + |                   "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 title: terminal.title | ||||||
|     property alias terminalSize: terminal.terminalSize |     property alias terminalSize: terminal.terminalSize | ||||||
|  |  | ||||||
|  |     property real devicePixelRatio: terminalWindow.screen.devicePixelRatio | ||||||
|  |  | ||||||
|     id: mainShader |     id: mainShader | ||||||
|     opacity: appSettings.windowOpacity * 0.3 + 0.7 |     opacity: appSettings.windowOpacity * 0.3 + 0.7 | ||||||
|  |  | ||||||
|     source: terminal.mainSource |     source: terminal.mainSource | ||||||
|     burnInEffect: terminal.burnInEffect |     burnInEffect: terminal.burnInEffect | ||||||
|     slowBurnInEffect: terminal.slowBurnInEffect |     virtualResolution: terminal.virtualResolution | ||||||
|     virtual_resolution: terminal.virtualResolution |     screenResolution: Qt.size( | ||||||
|  |         terminalWindow.width * devicePixelRatio * appSettings.windowScaling, | ||||||
|  |         terminalWindow.height * devicePixelRatio * appSettings.windowScaling | ||||||
|  |     ) | ||||||
|  |  | ||||||
|     TimeManager { |     TimeManager { | ||||||
|         id: timeManager |         id: timeManager | ||||||
|   | |||||||
| @@ -22,7 +22,7 @@ import QtQuick 2.0 | |||||||
| import "utils.js" as Utils | import "utils.js" as Utils | ||||||
| 
 | 
 | ||||||
| ShaderEffect { | ShaderEffect { | ||||||
|     property color _staticFrameColor: "#ffffff" |     property color _staticFrameColor: "#fff" | ||||||
|     property color _backgroundColor: appSettings.backgroundColor |     property color _backgroundColor: appSettings.backgroundColor | ||||||
|     property color _fontColor: appSettings.fontColor |     property color _fontColor: appSettings.fontColor | ||||||
|     property color _lightColor: Utils.mix(_fontColor, _backgroundColor, 0.2) |     property color _lightColor: Utils.mix(_fontColor, _backgroundColor, 0.2) | ||||||
| @@ -30,9 +30,19 @@ ShaderEffect { | |||||||
| 
 | 
 | ||||||
|     property color frameColor: Utils.mix(_staticFrameColor, _lightColor, _ambientLight) |     property color frameColor: Utils.mix(_staticFrameColor, _lightColor, _ambientLight) | ||||||
|     property real screenCurvature: appSettings.screenCurvature * appSettings.screenCurvatureSize |     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: " |     fragmentShader: " | ||||||
|         #ifdef GL_ES |         #ifdef GL_ES | ||||||
| @@ -40,10 +50,11 @@ ShaderEffect { | |||||||
|         #endif |         #endif | ||||||
| 
 | 
 | ||||||
|         uniform lowp float screenCurvature; |         uniform lowp float screenCurvature; | ||||||
|         uniform lowp float shadowLength; |         uniform lowp float screenShadowCoeff; | ||||||
|  |         uniform lowp float frameShadowCoeff; | ||||||
|         uniform highp float qt_Opacity; |         uniform highp float qt_Opacity; | ||||||
|         uniform lowp vec4 frameColor; |         uniform lowp vec4 frameColor; | ||||||
|         uniform mediump vec2 aadelta; |         uniform mediump vec2 margin; | ||||||
| 
 | 
 | ||||||
|         varying highp vec2 qt_TexCoord0; |         varying highp vec2 qt_TexCoord0; | ||||||
| 
 | 
 | ||||||
| @@ -52,42 +63,38 @@ ShaderEffect { | |||||||
|             float dist = dot(cc, cc) * screenCurvature; |             float dist = dot(cc, cc) * screenCurvature; | ||||||
|             return (coords + cc * (1.0 + dist) * dist); |             return (coords + cc * (1.0 + dist) * dist); | ||||||
|         } |         } | ||||||
|  |         " + | ||||||
| 
 | 
 | ||||||
|         float max2(vec2 v) { |         shaderLibrary.max2 + | ||||||
|             return max(v.x, v.y); |         shaderLibrary.min2 + | ||||||
|  |         shaderLibrary.prod2 + | ||||||
|  |         shaderLibrary.sum2 + | ||||||
|  | 
 | ||||||
|  |         " | ||||||
|  | 
 | ||||||
|  |         vec2 positiveLog(vec2 x) { | ||||||
|  |             return clamp(log(x), vec2(0.0), vec2(100.0)); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         float min2(vec2 v) { |         void main() { | ||||||
|             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(){ |  | ||||||
|             vec2 staticCoords = qt_TexCoord0; |             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 alpha = 0.0; | ||||||
| 
 | 
 | ||||||
|             float outShadowLength = shadowLength; |             float frameShadow = max2(positiveLog(-coords * frameShadowCoeff + vec2(1.0)) + positiveLog(coords * frameShadowCoeff - (vec2(frameShadowCoeff) - vec2(1.0)))); | ||||||
|             float inShadowLength = shadowLength * 0.5; |             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)); |             float screenShadow = 1.0 - prod2(positiveLog(coords * screenShadowCoeff + vec2(1.0)) * positiveLog(-coords * screenShadowCoeff + vec2(screenShadowCoeff + 1.0))); | ||||||
|             outShadow = clamp(sqrt(outShadow), 0.0, 1.0); |             alpha = max(0.8 * screenShadow, alpha); | ||||||
|             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); |  | ||||||
| 
 | 
 | ||||||
|             gl_FragColor = vec4(color * alpha, 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 |     property bool fullscreen: appSettings.fullscreen | ||||||
|     onFullscreenChanged: visibility = (fullscreen ? Window.FullScreen : Window.Windowed) |     onFullscreenChanged: visibility = (fullscreen ? Window.FullScreen : Window.Windowed) | ||||||
|  |  | ||||||
|     menuBar: WindowMenu { |     menuBar: qtquickMenuLoader.item | ||||||
|         id: mainMenu |  | ||||||
|         visible: (Qt.platform.os === "osx" || appSettings.showMenubar) |     Loader { | ||||||
|  |         id: qtquickMenuLoader | ||||||
|  |         active: !appSettings.isMacOS && appSettings.showMenubar | ||||||
|  |         sourceComponent: WindowMenu { } | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     Loader { | ||||||
|  |         id: globalMenuLoader | ||||||
|  |         active: appSettings.isMacOS | ||||||
|  |         sourceComponent: OSXMenu { } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     property string wintitle: appSettings.wintitle |     property string wintitle: appSettings.wintitle | ||||||
|  |  | ||||||
|     color: "#00000000" |     color: "#00000000" | ||||||
|  |  | ||||||
|     title: terminalContainer.title || qsTr(appSettings.wintitle) |     title: terminalContainer.title || qsTr(appSettings.wintitle) | ||||||
|  |  | ||||||
|     Action { |     Action { | ||||||
|         id: showMenubarAction |         id: showMenubarAction | ||||||
|         text: qsTr("Show Menubar") |         text: qsTr("Show Menubar") | ||||||
|         enabled: Qt.platform.os !== "osx" |         enabled: !appSettings.isMacOS | ||||||
|         shortcut: "Ctrl+Shift+M" |         shortcut: "Ctrl+Shift+M" | ||||||
|         checkable: true |         checkable: true | ||||||
|         checked: appSettings.showMenubar |         checked: appSettings.showMenubar | ||||||
| @@ -75,7 +85,7 @@ ApplicationWindow { | |||||||
|     Action { |     Action { | ||||||
|         id: fullscreenAction |         id: fullscreenAction | ||||||
|         text: qsTr("Fullscreen") |         text: qsTr("Fullscreen") | ||||||
|         enabled: Qt.platform.os !== "osx" |         enabled: !appSettings.isMacOS | ||||||
|         shortcut: "Alt+F11" |         shortcut: "Alt+F11" | ||||||
|         onTriggered: appSettings.fullscreen = !appSettings.fullscreen |         onTriggered: appSettings.fullscreen = !appSettings.fullscreen | ||||||
|         checkable: true |         checkable: true | ||||||
| @@ -154,7 +164,7 @@ ApplicationWindow { | |||||||
|     onClosing: { |     onClosing: { | ||||||
|         // OSX Since we are currently supporting only one window |         // OSX Since we are currently supporting only one window | ||||||
|         // quit the application when it is closed. |         // quit the application when it is closed. | ||||||
|         if (Qt.platform.os === "osx") |         if (appSettings.isMacOS) | ||||||
|             Qt.quit() |             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>SettingsTerminalTab.qml</file> | ||||||
|         <file>FontScanlines.qml</file> |         <file>FontScanlines.qml</file> | ||||||
|         <file>fonts/1977-apple2/PrintChar21.ttf</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>Storage.qml</file> | ||||||
|         <file>SettingsAdvancedTab.qml</file> |         <file>SettingsAdvancedTab.qml</file> | ||||||
|         <file>TerminalContainer.qml</file> |         <file>TerminalContainer.qml</file> | ||||||
| @@ -40,10 +40,11 @@ | |||||||
|         <file>fonts/1977-commodore-pet/PetMe.ttf</file> |         <file>fonts/1977-commodore-pet/PetMe.ttf</file> | ||||||
|         <file>BurnInEffect.qml</file> |         <file>BurnInEffect.qml</file> | ||||||
|         <file>fonts/modern-terminus/TerminusTTF-4.46.0.ttf</file> |         <file>fonts/modern-terminus/TerminusTTF-4.46.0.ttf</file> | ||||||
|         <file>NewTerminalFrame.qml</file> |         <file>TerminalFrame.qml</file> | ||||||
|         <file>SlowBurnIn.qml</file> |  | ||||||
|         <file>menus/WindowMenu.qml</file> |         <file>menus/WindowMenu.qml</file> | ||||||
|         <file>menus/FullContextMenu.qml</file> |         <file>menus/FullContextMenu.qml</file> | ||||||
|         <file>menus/ShortContextMenu.qml</file> |         <file>menus/ShortContextMenu.qml</file> | ||||||
|  |         <file>ShaderLibrary.qml</file> | ||||||
|  |         <file>menus/OSXMenu.qml</file> | ||||||
|     </qresource> |     </qresource> | ||||||
| </RCC> | </RCC> | ||||||
|   | |||||||
| @@ -31,13 +31,18 @@ function lint(a, b, t) { | |||||||
|     return (1 - t) * a + (t) * b; |     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), |     return Qt.rgba(c1.r * alpha + c2.r * (1-alpha), | ||||||
|                    c1.g * alpha + c2.g * (1-alpha), |                    c1.g * alpha + c2.g * (1-alpha), | ||||||
|                    c1.b * alpha + c2.b * (1-alpha), |                    c1.b * alpha + c2.b * (1-alpha), | ||||||
|                    c1.a * alpha + c2.a * (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){ | function strToColor(s){ | ||||||
|     var r = parseInt(s.substring(1,3), 16) / 256; |     var r = parseInt(s.substring(1,3), 16) / 256; | ||||||
|     var g = parseInt(s.substring(3,5), 16) / 256; |     var g = parseInt(s.substring(3,5), 16) / 256; | ||||||
|   | |||||||
 Submodule qmltermwidget updated: 5c47d1f494...63228027e1
									
								
							
		Reference in New Issue
	
	Block a user