mirror of
https://github.com/Swordfish90/cool-retro-term.git
synced 2025-01-18 12:15:27 +00:00
commit
6ddb507247
@ -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/../
|
||||||
|
12
app/main.cpp
12
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;
|
||||||
@ -65,9 +73,7 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
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
|
||||||
|
|
||||||
@ -242,8 +242,7 @@ QtObject {
|
|||||||
"bloomQuality": bloomQuality,
|
"bloomQuality": bloomQuality,
|
||||||
"burnInQuality": burnInQuality,
|
"burnInQuality": burnInQuality,
|
||||||
"useCustomCommand": useCustomCommand,
|
"useCustomCommand": useCustomCommand,
|
||||||
"customCommand": customCommand,
|
"customCommand": customCommand
|
||||||
"useFastBurnIn": useFastBurnIn
|
|
||||||
}
|
}
|
||||||
return stringify(settings)
|
return stringify(settings)
|
||||||
}
|
}
|
||||||
@ -338,9 +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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadProfileString(profileString) {
|
function loadProfileString(profileString) {
|
||||||
|
@ -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,20 +75,30 @@ 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()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
@ -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,28 +44,54 @@ 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 {
|
||||||
@ -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,7 +198,7 @@ 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
|
||||||
|
|
||||||
@ -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
|
||||||
@ -215,10 +216,12 @@ ColumnLayout {
|
|||||||
}
|
}
|
||||||
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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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 { }
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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
|
||||||
@ -67,14 +66,10 @@ 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)
|
||||||
@ -185,8 +180,6 @@ Item {
|
|||||||
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) ||(fallBack && (flickering || horizontalSync))) ? "
|
(((staticNoise !== 0 || jitter !== 0) ||(fallBack && (flickering || horizontalSync))) ? "
|
||||||
@ -314,11 +307,6 @@ 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" +
|
"txt_color = applyRasterization(staticCoords, txt_color, virtualResolution, rasterizationIntensity);\n" +
|
||||||
|
@ -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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -33,7 +33,6 @@ ShaderTerminal {
|
|||||||
|
|
||||||
source: terminal.mainSource
|
source: terminal.mainSource
|
||||||
burnInEffect: terminal.burnInEffect
|
burnInEffect: terminal.burnInEffect
|
||||||
slowBurnInEffect: terminal.slowBurnInEffect
|
|
||||||
virtualResolution: terminal.virtualResolution
|
virtualResolution: terminal.virtualResolution
|
||||||
screenResolution: Qt.size(
|
screenResolution: Qt.size(
|
||||||
terminalWindow.width * devicePixelRatio * appSettings.windowScaling,
|
terminalWindow.width * devicePixelRatio * appSettings.windowScaling,
|
||||||
|
@ -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()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -41,10 +41,10 @@
|
|||||||
<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>TerminalFrame.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>ShaderLibrary.qml</file>
|
||||||
|
<file>menus/OSXMenu.qml</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 5c47d1f49455394226e0e595f79c148f0c098006
|
Subproject commit 63228027e1f97c24abb907550b22ee91836929c5
|
Loading…
x
Reference in New Issue
Block a user