From 28977313daab4c1b2196f3b648f5abb47ea90039 Mon Sep 17 00:00:00 2001 From: Filippo Scognamiglio Date: Mon, 3 Jan 2022 18:43:07 +0100 Subject: [PATCH 1/9] UI/UX fixes for OSX version. --- app/app.pro | 2 +- app/main.cpp | 8 +-- app/qml/ApplicationSettings.qml | 6 ++- app/qml/BurnInEffect.qml | 30 ++++++++--- app/qml/ColorButton.qml | 6 +-- app/qml/PreprocessedTerminal.qml | 52 ++++++++++++++----- app/qml/SettingsGeneralTab.qml | 2 + app/qml/SettingsTerminalTab.qml | 5 +- app/qml/SettingsWindow.qml | 2 +- app/qml/main.qml | 22 +++++--- app/qml/menus/OSXMenu.qml | 89 ++++++++++++++++++++++++++++++++ app/qml/resources.qrc | 1 + qmltermwidget | 2 +- 13 files changed, 189 insertions(+), 38 deletions(-) create mode 100644 app/qml/menus/OSXMenu.qml diff --git a/app/app.pro b/app/app.pro index 39bd4ec..1e42dcc 100644 --- a/app/app.pro +++ b/app/app.pro @@ -1,4 +1,4 @@ -QT += qml quick widgets sql +QT += qml quick widgets sql quickcontrols2 TARGET = cool-retro-term DESTDIR = $$OUT_PWD/../ diff --git a/app/main.cpp b/app/main.cpp index c58679e..b2a74d5 100644 --- a/app/main.cpp +++ b/app/main.cpp @@ -6,6 +6,7 @@ #include #include +#include #include #include @@ -40,6 +41,9 @@ int main(int argc, char *argv[]) #if defined(Q_OS_MAC) // This allows UTF-8 characters usage in OSX. setenv("LC_CTYPE", "UTF-8", 1); + + // Force fusion style on macOS + QQuickStyle::setStyle("Fusion"); #endif if (argc>1 && (!strcmp(argv[1],"-h") || !strcmp(argv[1],"--help"))) { @@ -65,9 +69,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; diff --git a/app/qml/ApplicationSettings.qml b/app/qml/ApplicationSettings.qml index d8a1d70..544c193 100644 --- a/app/qml/ApplicationSettings.qml +++ b/app/qml/ApplicationSettings.qml @@ -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" @@ -54,7 +56,7 @@ QtObject { property real bloomQuality: 0.5 property real burnInQuality: 0.5 - property bool useFastBurnIn: Qt.platform.os === "osx" ? false : true + property bool useFastBurnIn: true property bool blinkingCursor: false diff --git a/app/qml/BurnInEffect.qml b/app/qml/BurnInEffect.qml index 9061b9c..9e9d9ac 100644 --- a/app/qml/BurnInEffect.qml +++ b/app/qml/BurnInEffect.qml @@ -72,20 +72,38 @@ 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(); + + function onBurnInChanged() { + burnInEffect.restartBlurSource() + } + + function onTerminalFontChanged() { + burnInEffect.restartBlurSource() + } + + function onRasterizationChanged() { + burnInEffect.restartBlurSource() + } + + function onBurnInQualityChanged() { + burnInEffect.restartBlurSource() + } } Connections { target: kterminalScrollbar - onOpacityChanged: completelyUpdate() + + function onOpacityChanged() { + completelyUpdate() + } } } diff --git a/app/qml/ColorButton.qml b/app/qml/ColorButton.qml index f46134b..a2d97e3 100644 --- a/app/qml/ColorButton.qml +++ b/app/qml/ColorButton.qml @@ -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 diff --git a/app/qml/PreprocessedTerminal.qml b/app/qml/PreprocessedTerminal.qml index 9edf981..d6823db 100644 --- a/app/qml/PreprocessedTerminal.qml +++ b/app/qml/PreprocessedTerminal.qml @@ -45,28 +45,54 @@ 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 { @@ -143,7 +169,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,7 +199,7 @@ 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 diff --git a/app/qml/SettingsGeneralTab.qml b/app/qml/SettingsGeneralTab.qml index ed3359e..88e781d 100644 --- a/app/qml/SettingsGeneralTab.qml +++ b/app/qml/SettingsGeneralTab.qml @@ -215,10 +215,12 @@ ColumnLayout { } Label { text: qsTr("Opacity") + visible: !appSettings.isMacOS } SimpleSlider { onValueChanged: appSettings.windowOpacity = value value: appSettings.windowOpacity + visible: !appSettings.isMacOS } } } diff --git a/app/qml/SettingsTerminalTab.qml b/app/qml/SettingsTerminalTab.qml index 8e3a35c..7811d4c 100644 --- a/app/qml/SettingsTerminalTab.qml +++ b/app/qml/SettingsTerminalTab.qml @@ -68,7 +68,10 @@ ColumnLayout { } Connections { target: appSettings - onTerminalFontChanged: fontChanger.updateIndex() + + function onTerminalFontChanged() { + fontChanger.updateIndex() + } } Component.onCompleted: updateIndex() } diff --git a/app/qml/SettingsWindow.qml b/app/qml/SettingsWindow.qml index 6b5c024..0c0a8e1 100644 --- a/app/qml/SettingsWindow.qml +++ b/app/qml/SettingsWindow.qml @@ -34,7 +34,7 @@ Window { TabBar { id: bar - width: parent.width + anchors { left: parent.left; right: parent.right; top: parent.top } TabButton { text: qsTr("General") } diff --git a/app/qml/main.qml b/app/qml/main.qml index 0e8395f..8ae0774 100644 --- a/app/qml/main.qml +++ b/app/qml/main.qml @@ -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() } } diff --git a/app/qml/menus/OSXMenu.qml b/app/qml/menus/OSXMenu.qml new file mode 100644 index 0000000..3fe9971 --- /dev/null +++ b/app/qml/menus/OSXMenu.qml @@ -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 . +*******************************************************************************/ + +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() + } + } +} diff --git a/app/qml/resources.qrc b/app/qml/resources.qrc index 0cb4d24..f4f4431 100644 --- a/app/qml/resources.qrc +++ b/app/qml/resources.qrc @@ -46,5 +46,6 @@ menus/FullContextMenu.qml menus/ShortContextMenu.qml ShaderLibrary.qml + menus/OSXMenu.qml diff --git a/qmltermwidget b/qmltermwidget index 5c47d1f..997bdaa 160000 --- a/qmltermwidget +++ b/qmltermwidget @@ -1 +1 @@ -Subproject commit 5c47d1f49455394226e0e595f79c148f0c098006 +Subproject commit 997bdaa832609afc480e1153d458eff9692705e2 From aa270067f6ff4fc390e1bc8fa2b54295da58222f Mon Sep 17 00:00:00 2001 From: Filippo Scognamiglio Date: Mon, 3 Jan 2022 20:56:49 +0100 Subject: [PATCH 2/9] Improve settings window. --- app/main.cpp | 6 ++-- app/qml/SettingsWindow.qml | 67 +++++++++++++++++++++----------------- qmltermwidget | 2 +- 3 files changed, 41 insertions(+), 34 deletions(-) diff --git a/app/main.cpp b/app/main.cpp index b2a74d5..386bded 100644 --- a/app/main.cpp +++ b/app/main.cpp @@ -41,11 +41,11 @@ int main(int argc, char *argv[]) #if defined(Q_OS_MAC) // This allows UTF-8 characters usage in OSX. setenv("LC_CTYPE", "UTF-8", 1); - - // Force fusion style on macOS - QQuickStyle::setStyle("Fusion"); #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 ] [--program ] [-p|--profile ] [--fullscreen] [-h|--help]" << endl; diff --git a/app/qml/SettingsWindow.qml b/app/qml/SettingsWindow.qml index 0c0a8e1..1009aa2 100644 --- a/app/qml/SettingsWindow.qml +++ b/app/qml/SettingsWindow.qml @@ -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 - 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") - } - } + 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 { } + } + } } } diff --git a/qmltermwidget b/qmltermwidget index 997bdaa..e9ea684 160000 --- a/qmltermwidget +++ b/qmltermwidget @@ -1 +1 @@ -Subproject commit 997bdaa832609afc480e1153d458eff9692705e2 +Subproject commit e9ea68473416f7de6ec927ac72d144a0f464c490 From f69f2df63c944ba2a5484b2677d0ca3cea59d2b4 Mon Sep 17 00:00:00 2001 From: Filippo Scognamiglio Date: Mon, 3 Jan 2022 21:06:33 +0100 Subject: [PATCH 3/9] More Connections refactorings. --- app/qml/SlowBurnIn.qml | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/app/qml/SlowBurnIn.qml b/app/qml/SlowBurnIn.qml index 25899ba..1c2bd7a 100644 --- a/app/qml/SlowBurnIn.qml +++ b/app/qml/SlowBurnIn.qml @@ -61,8 +61,9 @@ Loader { Connections { target: burnInSourceEffect.updateBurnIn ? timeManager : null ignoreUnknownSignals: false - onTimeChanged: { - burnInSourceEffect.scheduleUpdate(); + + function onTimeChanged() { + burnInSourceEffect.scheduleUpdate() } } @@ -79,7 +80,8 @@ Loader { } Connections { target: kterminal - onImagePainted:{ + + function onImagePainted() { burnInSourceEffect.scheduleUpdate(); burnInSourceEffect.updateBurnIn = true; livetimer.restart(); @@ -88,14 +90,29 @@ Loader { // Restart blurred source settings change. Connections { target: appSettings - onBurnInChanged: burnInSourceEffect.restartBlurSource(); - onTerminalFontChanged: burnInSourceEffect.restartBlurSource(); - onRasterizationChanged: burnInSourceEffect.restartBlurSource(); - onBurnInQualityChanged: burnInSourceEffect.restartBlurSource(); + + function onBurnInChanged() { + burnInSourceEffect.restartBlurSource() + } + + function onTerminalFontChanged() { + burnInSourceEffect.restartBlurSource() + } + + function onRasterizationChanged() { + burnInSourceEffect.restartBlurSource() + } + + function onBurnInQualityChanged() { + burnInSourceEffect.restartBlurSource() + } } Connections { target: kterminalScrollbar - onOpacityChanged: burnInSourceEffect.restartBlurSource(); + + function onOpacityChanged() { + burnInSourceEffect.restartBlurSource() + } } ShaderEffect { From 552947f50774a9c32588ffa55546359c135484d0 Mon Sep 17 00:00:00 2001 From: Filippo Scognamiglio Date: Sat, 8 Jan 2022 22:20:44 +0100 Subject: [PATCH 4/9] Improve burn-in timings. --- app/qml/BurnInEffect.qml | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/app/qml/BurnInEffect.qml b/app/qml/BurnInEffect.qml index 9e9d9ac..9d38f99 100644 --- a/app/qml/BurnInEffect.qml +++ b/app/qml/BurnInEffect.qml @@ -40,15 +40,19 @@ Loader { 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(); + prevLastUpdate = timeManager.time + lastUpdate = prevLastUpdate + completelyUpdate() } sourceComponent: Item { From 7b69d41c607562b86a7897dee155277b5670269a Mon Sep 17 00:00:00 2001 From: Filippo Scognamiglio Date: Sat, 8 Jan 2022 22:32:42 +0100 Subject: [PATCH 5/9] Remove slow burn-in effect. --- app/qml/ApplicationSettings.qml | 8 +- app/qml/BurnInEffect.qml | 2 +- app/qml/PreprocessedTerminal.qml | 5 - app/qml/SettingsAdvancedTab.qml | 6 -- app/qml/ShaderTerminal.qml | 14 +-- app/qml/SlowBurnIn.qml | 157 ------------------------------- app/qml/TerminalContainer.qml | 1 - app/qml/resources.qrc | 1 - 8 files changed, 3 insertions(+), 191 deletions(-) delete mode 100644 app/qml/SlowBurnIn.qml diff --git a/app/qml/ApplicationSettings.qml b/app/qml/ApplicationSettings.qml index 544c193..424f0bd 100644 --- a/app/qml/ApplicationSettings.qml +++ b/app/qml/ApplicationSettings.qml @@ -54,9 +54,7 @@ QtObject { property bool verbose: false property real bloomQuality: 0.5 - property real burnInQuality: 0.5 - property bool useFastBurnIn: true property bool blinkingCursor: false @@ -244,8 +242,7 @@ QtObject { "bloomQuality": bloomQuality, "burnInQuality": burnInQuality, "useCustomCommand": useCustomCommand, - "customCommand": customCommand, - "useFastBurnIn": useFastBurnIn + "customCommand": customCommand } return stringify(settings) } @@ -340,9 +337,6 @@ QtObject { !== undefined ? settings.useCustomCommand : useCustomCommand customCommand = settings.customCommand !== undefined ? settings.customCommand : customCommand - - useFastBurnIn = settings.useFastBurnIn - !== undefined ? settings.useFastBurnIn : useFastBurnIn } function loadProfileString(profileString) { diff --git a/app/qml/BurnInEffect.qml b/app/qml/BurnInEffect.qml index 9d38f99..a100df6 100644 --- a/app/qml/BurnInEffect.qml +++ b/app/qml/BurnInEffect.qml @@ -35,7 +35,7 @@ Loader { property real _minBurnInFadeTime: appSettings.minBurnInFadeTime property real _maxBurnInFadeTime: appSettings.maxBurnInFadeTime - active: appSettings.useFastBurnIn && appSettings.burnIn !== 0 + active: appSettings.burnIn !== 0 anchors.fill: parent diff --git a/app/qml/PreprocessedTerminal.qml b/app/qml/PreprocessedTerminal.qml index d6823db..85660e9 100644 --- a/app/qml/PreprocessedTerminal.qml +++ b/app/qml/PreprocessedTerminal.qml @@ -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 @@ -276,9 +275,5 @@ Item{ BurnInEffect { id: burnInEffect } - - SlowBurnIn { - id: slowBurnInEffect - } } } diff --git a/app/qml/SettingsAdvancedTab.qml b/app/qml/SettingsAdvancedTab.qml index 2a4e238..f7eb161 100644 --- a/app/qml/SettingsAdvancedTab.qml +++ b/app/qml/SettingsAdvancedTab.qml @@ -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 - } } } } diff --git a/app/qml/ShaderTerminal.qml b/app/qml/ShaderTerminal.qml index 4164320..2de0d9b 100644 --- a/app/qml/ShaderTerminal.qml +++ b/app/qml/ShaderTerminal.qml @@ -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 @@ -67,14 +66,10 @@ 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) @@ -185,8 +180,6 @@ Item { 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))) ? " @@ -314,11 +307,6 @@ 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" + diff --git a/app/qml/SlowBurnIn.qml b/app/qml/SlowBurnIn.qml deleted file mode 100644 index 1c2bd7a..0000000 --- a/app/qml/SlowBurnIn.qml +++ /dev/null @@ -1,157 +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 . -*******************************************************************************/ - -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 - - function 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 - - function onImagePainted() { - burnInSourceEffect.scheduleUpdate(); - burnInSourceEffect.updateBurnIn = true; - livetimer.restart(); - } - } - // Restart blurred source settings change. - Connections { - target: appSettings - - function onBurnInChanged() { - burnInSourceEffect.restartBlurSource() - } - - function onTerminalFontChanged() { - burnInSourceEffect.restartBlurSource() - } - - function onRasterizationChanged() { - burnInSourceEffect.restartBlurSource() - } - - function onBurnInQualityChanged() { - burnInSourceEffect.restartBlurSource() - } - } - Connections { - target: kterminalScrollbar - - function 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 - } - } - } -} diff --git a/app/qml/TerminalContainer.qml b/app/qml/TerminalContainer.qml index 9896354..b6be435 100644 --- a/app/qml/TerminalContainer.qml +++ b/app/qml/TerminalContainer.qml @@ -33,7 +33,6 @@ ShaderTerminal { source: terminal.mainSource burnInEffect: terminal.burnInEffect - slowBurnInEffect: terminal.slowBurnInEffect virtualResolution: terminal.virtualResolution screenResolution: Qt.size( terminalWindow.width * devicePixelRatio * appSettings.windowScaling, diff --git a/app/qml/resources.qrc b/app/qml/resources.qrc index f4f4431..1114d8d 100644 --- a/app/qml/resources.qrc +++ b/app/qml/resources.qrc @@ -41,7 +41,6 @@ BurnInEffect.qml fonts/modern-terminus/TerminusTTF-4.46.0.ttf TerminalFrame.qml - SlowBurnIn.qml menus/WindowMenu.qml menus/FullContextMenu.qml menus/ShortContextMenu.qml From ef9f412e5f0067bcf9cad8a7f0837dd4527a8f8b Mon Sep 17 00:00:00 2001 From: Filippo Scognamiglio Date: Sat, 8 Jan 2022 22:36:02 +0100 Subject: [PATCH 6/9] Clip profiles list. --- app/qml/SettingsGeneralTab.qml | 1 + 1 file changed, 1 insertion(+) diff --git a/app/qml/SettingsGeneralTab.qml b/app/qml/SettingsGeneralTab.qml index 88e781d..40fbc0d 100644 --- a/app/qml/SettingsGeneralTab.qml +++ b/app/qml/SettingsGeneralTab.qml @@ -33,6 +33,7 @@ ColumnLayout { Layout.fillWidth: true Layout.fillHeight: true model: appSettings.profilesList + clip: true delegate: Rectangle { width: label.width height: label.height From 997131ba64c6e4fd96371e8e462d5d2ded234909 Mon Sep 17 00:00:00 2001 From: Filippo Scognamiglio Date: Sat, 8 Jan 2022 23:15:29 +0100 Subject: [PATCH 7/9] Tiny fixes to burn-in. --- app/qml/BurnInEffect.qml | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/app/qml/BurnInEffect.qml b/app/qml/BurnInEffect.qml index a100df6..6478b95 100644 --- a/app/qml/BurnInEffect.qml +++ b/app/qml/BurnInEffect.qml @@ -29,7 +29,6 @@ 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 @@ -49,7 +48,7 @@ Loader { item.source.scheduleUpdate() } - function restartBlurSource(){ + function restartBlurSource() { prevLastUpdate = timeManager.time lastUpdate = prevLastUpdate completelyUpdate() @@ -82,7 +81,7 @@ Loader { } } // Restart blurred source settings change. - Connections{ + Connections { target: appSettings function onBurnInChanged() { @@ -101,14 +100,6 @@ Loader { burnInEffect.restartBlurSource() } } - - Connections { - target: kterminalScrollbar - - function onOpacityChanged() { - completelyUpdate() - } - } } ShaderLibrary { From 06e71910569c05f85730707b8a81ee793d27c0fb Mon Sep 17 00:00:00 2001 From: Filippo Scognamiglio Date: Sun, 9 Jan 2022 10:47:02 +0100 Subject: [PATCH 8/9] Disable Qt5 Connections warnings. --- app/main.cpp | 4 ++++ qmltermwidget | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/main.cpp b/app/main.cpp index 386bded..afd0834 100644 --- a/app/main.cpp +++ b/app/main.cpp @@ -12,6 +12,7 @@ #include #include +#include #include #include @@ -34,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 diff --git a/qmltermwidget b/qmltermwidget index e9ea684..b61d620 160000 --- a/qmltermwidget +++ b/qmltermwidget @@ -1 +1 @@ -Subproject commit e9ea68473416f7de6ec927ac72d144a0f464c490 +Subproject commit b61d6204e759b45bf89104f12ed2f18a1ddc679f From b0f3b8f3d08af928e6e3087fc42c61e060d02967 Mon Sep 17 00:00:00 2001 From: Filippo Scognamiglio Date: Sun, 9 Jan 2022 10:53:35 +0100 Subject: [PATCH 9/9] Update QMLTermWidget submodule. --- qmltermwidget | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qmltermwidget b/qmltermwidget index b61d620..6322802 160000 --- a/qmltermwidget +++ b/qmltermwidget @@ -1 +1 @@ -Subproject commit b61d6204e759b45bf89104f12ed2f18a1ddc679f +Subproject commit 63228027e1f97c24abb907550b22ee91836929c5