diff --git a/app/qml/ApplicationConstants.qml b/app/qml/ApplicationConstants.qml
new file mode 100644
index 0000000..602f8cc
--- /dev/null
+++ b/app/qml/ApplicationConstants.qml
@@ -0,0 +1,39 @@
+/*******************************************************************************
+* 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.2
+
+QtObject {
+ readonly property string version: appVersion
+ readonly property int profileVersion: 2
+
+ readonly property real screenCurvatureSize: 0.4
+ readonly property real minimumFontScaling: 0.25
+ readonly property real maximumFontScaling: 2.50
+
+ readonly property real minBurnInFadeTime: 160
+ readonly property real maxBurnInFadeTime: 1600
+
+ readonly property int no_rasterization: 0
+ readonly property int scanline_rasterization: 1
+ readonly property int pixel_rasterization: 2
+ readonly property int subpixel_rasterization: 3
+
+ readonly property real baseFontScaling: 0.75
+}
diff --git a/app/qml/ApplicationSettings.qml b/app/qml/ApplicationSettings.qml
index d8a1d70..9b83346 100644
--- a/app/qml/ApplicationSettings.qml
+++ b/app/qml/ApplicationSettings.qml
@@ -23,18 +23,8 @@ import QtQuick.Controls 2.0
import "utils.js" as Utils
QtObject {
- readonly property string version: appVersion
- readonly property int profileVersion: 2
- // STATIC CONSTANTS ////////////////////////////////////////////////////////
- readonly property real screenCurvatureSize: 0.4
- readonly property real minimumFontScaling: 0.25
- readonly property real maximumFontScaling: 2.50
-
- readonly property real minBurnInFadeTime: 160
- readonly property real maxBurnInFadeTime: 1600
-
- // GENERAL SETTINGS ///////////////////////////////////////////////////////
+ // APPLICATION SETTINGS ///////////////////////////////////////////////////////
property int x: 100
property int y: 100
property int width: 1024
@@ -56,8 +46,6 @@ QtObject {
property real burnInQuality: 0.5
property bool useFastBurnIn: Qt.platform.os === "osx" ? false : true
- property bool blinkingCursor: false
-
onWindowScalingChanged: handleFontChanged()
// PROFILE SETTINGS ///////////////////////////////////////////////////////
@@ -106,17 +94,13 @@ QtObject {
property real totalMargin: frameMargin + margin
- readonly property int no_rasterization: 0
- readonly property int scanline_rasterization: 1
- readonly property int pixel_rasterization: 2
- readonly property int subpixel_rasterization: 3
-
property int rasterization: no_rasterization
+ property bool blinkingCursor: false
+
// FONTS //////////////////////////////////////////////////////////////////
- readonly property real baseFontScaling: 0.75
property real fontScaling: 1.0
- property real totalFontScaling: baseFontScaling * fontScaling
+ property real totalFontScaling: appConstants.baseFontScaling * fontScaling
property real fontWidth: 1.0
@@ -132,28 +116,28 @@ QtObject {
property Loader fontManager: Loader {
states: [
State {
- when: rasterization == no_rasterization
+ when: rasterization == appConstants.no_rasterization
PropertyChanges {
target: fontManager
source: "Fonts.qml"
}
},
State {
- when: rasterization == scanline_rasterization
+ when: rasterization == appConstants.scanline_rasterization
PropertyChanges {
target: fontManager
source: "FontScanlines.qml"
}
},
State {
- when: rasterization == pixel_rasterization
+ when: rasterization == appConstants.pixel_rasterization
PropertyChanges {
target: fontManager
source: "FontPixels.qml"
}
},
State {
- when: rasterization == subpixel_rasterization
+ when: rasterization == appConstants.subpixel_rasterization
PropertyChanges {
target: fontManager
source: "FontPixels.qml"
@@ -179,12 +163,12 @@ QtObject {
}
function incrementScaling() {
- fontScaling = Math.min(fontScaling + 0.05, maximumFontScaling)
+ fontScaling = Math.min(fontScaling + 0.05, appConstants.maximumFontScaling)
handleFontChanged()
}
function decrementScaling() {
- fontScaling = Math.max(fontScaling - 0.05, minimumFontScaling)
+ fontScaling = Math.max(fontScaling - 0.05, appConstants.minimumFontScaling)
handleFontChanged()
}
diff --git a/app/qml/BurnInEffect.qml b/app/qml/BurnInEffect.qml
index 9061b9c..497f394 100644
--- a/app/qml/BurnInEffect.qml
+++ b/app/qml/BurnInEffect.qml
@@ -32,8 +32,8 @@ Loader {
property real delay: (1.0 / appSettings.fps) * 1000
property real burnIn: appSettings.burnIn
property real burnInFadeTime: 1 / Utils.lint(_minBurnInFadeTime, _maxBurnInFadeTime, burnIn)
- property real _minBurnInFadeTime: appSettings.minBurnInFadeTime
- property real _maxBurnInFadeTime: appSettings.maxBurnInFadeTime
+ property real _minBurnInFadeTime: appConstants.minBurnInFadeTime
+ property real _maxBurnInFadeTime: appConstants.maxBurnInFadeTime
active: appSettings.useFastBurnIn && appSettings.burnIn !== 0
diff --git a/app/qml/PreprocessedTerminal.qml b/app/qml/PreprocessedTerminal.qml
index 9edf981..1fa9f5d 100644
--- a/app/qml/PreprocessedTerminal.qml
+++ b/app/qml/PreprocessedTerminal.qml
@@ -217,7 +217,7 @@ Item{
y = (y - margin) / height;
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 * appConstants.screenCurvatureSize;
return Qt.point((x - cc.width * (1+distortion) * distortion) * (kterminal.totalWidth),
(y - cc.height * (1+distortion) * distortion) * (kterminal.totalHeight))
diff --git a/app/qml/SettingsAdvancedTab.qml b/app/qml/SettingsAdvancedTab.qml
index 2a4e238..ece8031 100644
--- a/app/qml/SettingsAdvancedTab.qml
+++ b/app/qml/SettingsAdvancedTab.qml
@@ -156,7 +156,7 @@ ColumnLayout {
}
CheckBox {
Layout.columnSpan: 2
- text: qsTr("Burnin optimization (Might display timing artifacts)")
+ text: qsTr("Burnin optimization (might display timing artifacts)")
checked: appSettings.useFastBurnIn
onCheckedChanged: appSettings.useFastBurnIn = checked
}
diff --git a/app/qml/SettingsGeneralTab.qml b/app/qml/SettingsGeneralTab.qml
index ed3359e..eeeb0cd 100644
--- a/app/qml/SettingsGeneralTab.qml
+++ b/app/qml/SettingsGeneralTab.qml
@@ -113,7 +113,7 @@ ColumnLayout {
var version = profileObject.version
!== undefined ? profileObject.version : 1
- if (version !== appSettings.profileVersion)
+ if (version !== appConstants.profileVersion)
throw "This profile is not supported on this version of CRT."
delete profileObject.name
@@ -160,7 +160,7 @@ ColumnLayout {
var profileSettings = JSON.parse(
profileObject.obj_string)
profileSettings["name"] = profileObject.text
- profileSettings["version"] = appSettings.profileVersion
+ profileSettings["version"] = appConstants.profileVersion
var result = fileIO.write(url, JSON.stringify(
profileSettings,
diff --git a/app/qml/SettingsTerminalTab.qml b/app/qml/SettingsTerminalTab.qml
index 8e3a35c..72ca92d 100644
--- a/app/qml/SettingsTerminalTab.qml
+++ b/app/qml/SettingsTerminalTab.qml
@@ -83,8 +83,8 @@ ColumnLayout {
onValueChanged: appSettings.fontScaling = value
value: appSettings.fontScaling
stepSize: 0.05
- from: appSettings.minimumFontScaling
- to: appSettings.maximumFontScaling
+ from: appConstants.minimumFontScaling
+ to: appConstants.maximumFontScaling
}
SizedLabel {
text: Math.round(fontScalingChanger.value * 100) + "%"
diff --git a/app/qml/ShaderLibrary.qml b/app/qml/ShaderLibrary.qml
index ae95f05..37545a4 100644
--- a/app/qml/ShaderLibrary.qml
+++ b/app/qml/ShaderLibrary.qml
@@ -2,12 +2,12 @@ import QtQuick 2.0
QtObject {
property string rasterizationShader:
- (appSettings.rasterization === appSettings.no_rasterization ? "
+ (appSettings.rasterization === appConstants.no_rasterization ? "
lowp vec3 applyRasterization(vec2 screenCoords, lowp vec3 texel, vec2 virtualResolution, float intensity) {
return texel;
}" : "") +
- (appSettings.rasterization === appSettings.scanline_rasterization ? "
+ (appSettings.rasterization === appConstants.scanline_rasterization ? "
#define INTENSITY 0.30
#define BRIGHTBOOST 0.30
@@ -22,7 +22,7 @@ QtObject {
return mix(texel, rasterizationColor, intensity);
}" : "") +
- (appSettings.rasterization === appSettings.pixel_rasterization ? "
+ (appSettings.rasterization === appConstants.pixel_rasterization ? "
#define INTENSITY 0.30
#define BRIGHTBOOST 0.30
@@ -40,7 +40,7 @@ QtObject {
return mix(texel, rasterizationColor, intensity);
}" : "") +
- (appSettings.rasterization === appSettings.subpixel_rasterization ? "
+ (appSettings.rasterization === appConstants.subpixel_rasterization ? "
#define INTENSITY 0.30
#define BRIGHTBOOST 0.30
#define SUBPIXELS 3.0
diff --git a/app/qml/ShaderTerminal.qml b/app/qml/ShaderTerminal.qml
index 4164320..b297146 100644
--- a/app/qml/ShaderTerminal.qml
+++ b/app/qml/ShaderTerminal.qml
@@ -32,7 +32,7 @@ Item {
property color fontColor: appSettings.fontColor
property color backgroundColor: appSettings.backgroundColor
- property real screenCurvature: appSettings.screenCurvature * appSettings.screenCurvatureSize
+ property real screenCurvature: appSettings.screenCurvature * appConstants.screenCurvatureSize
property real chromaColor: appSettings.chromaColor
diff --git a/app/qml/SlowBurnIn.qml b/app/qml/SlowBurnIn.qml
index 25899ba..5f193c1 100644
--- a/app/qml/SlowBurnIn.qml
+++ b/app/qml/SlowBurnIn.qml
@@ -38,8 +38,8 @@ Loader {
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
+ property real minBurnInFadeTime: appConstants.minBurnInFadeTime
+ property real maxBurnInFadeTime: appConstants.maxBurnInFadeTime
id: burnInSourceEffect
diff --git a/app/qml/TerminalFrame.qml b/app/qml/TerminalFrame.qml
index 3e1baef..2dc9498 100644
--- a/app/qml/TerminalFrame.qml
+++ b/app/qml/TerminalFrame.qml
@@ -29,7 +29,7 @@ ShaderEffect {
property real _ambientLight: Utils.lint(0.2, 0.8, appSettings.ambientLight)
property color frameColor: Utils.mix(_staticFrameColor, _lightColor, _ambientLight)
- property real screenCurvature: appSettings.screenCurvature * appSettings.screenCurvatureSize
+ property real screenCurvature: appSettings.screenCurvature * appConstants.screenCurvatureSize
// Coefficient of the log curve used to approximate shadowing
property real screenShadowCoeff: Utils.lint(20.0, 10.0, _ambientLight)
diff --git a/app/qml/main.qml b/app/qml/main.qml
index 0e8395f..09921bd 100644
--- a/app/qml/main.qml
+++ b/app/qml/main.qml
@@ -127,6 +127,9 @@ ApplicationWindow {
aboutDialog.raise()
}
}
+ ApplicationConstants {
+ id: appConstants
+ }
ApplicationSettings {
id: appSettings
}
diff --git a/app/qml/resources.qrc b/app/qml/resources.qrc
index ca16a75..deadf06 100644
--- a/app/qml/resources.qrc
+++ b/app/qml/resources.qrc
@@ -46,5 +46,6 @@
menus/FullContextMenu.qml
menus/ShortContextMenu.qml
ShaderLibrary.qml
+ ApplicationConstants.qml
diff --git a/qmltermwidget b/qmltermwidget
index 5c47d1f..65e75bc 160000
--- a/qmltermwidget
+++ b/qmltermwidget
@@ -1 +1 @@
-Subproject commit 5c47d1f49455394226e0e595f79c148f0c098006
+Subproject commit 65e75bc6ea589b51c80e5ff3f4008de5644d7cc5