1
0
mirror of https://github.com/Swordfish90/cool-retro-term.git synced 2025-04-19 17:20:45 +01:00

Refactoring: rename shadersettings in appSettings.

This commit is contained in:
Filippo Scognamiglio 2014-12-11 12:08:15 +01:00
parent 0daf33c36f
commit 7b7eba1c7c
14 changed files with 146 additions and 148 deletions

View File

@ -77,7 +77,7 @@ Window{
Text{ Text{
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
text: shadersettings.version + "\n" + text: appSettings.version + "\n" +
qsTr("Author: ") + "Filippo Scognamiglio\n" + qsTr("Author: ") + "Filippo Scognamiglio\n" +
qsTr("Email: ") + "flscogna@gmail.com\n" + qsTr("Email: ") + "flscogna@gmail.com\n" +
qsTr("Source: ") + "https://github.com/Swordfish90/cool-retro-term\n" qsTr("Source: ") + "https://github.com/Swordfish90/cool-retro-term\n"

View File

@ -20,8 +20,6 @@
import QtQuick 2.2 import QtQuick 2.2
Item{ Item{
property string version: "0.9" property string version: "0.9"

View File

@ -31,12 +31,12 @@ MenuBar {
title: qsTr("Profiles") title: qsTr("Profiles")
visible: defaultMenuBar.visible visible: defaultMenuBar.visible
Instantiator{ Instantiator{
model: shadersettings.profiles_list model: appSettings.profiles_list
delegate: MenuItem { delegate: MenuItem {
text: model.text text: model.text
onTriggered: { onTriggered: {
shadersettings.loadProfileString(obj_string); appSettings.loadProfileString(obj_string);
shadersettings.handleFontChanged(); appSettings.handleFontChanged();
} }
} }
onObjectAdded: profilesMenu.insertItem(index, object) onObjectAdded: profilesMenu.insertItem(index, object)

View File

@ -45,7 +45,7 @@ Window{
} }
function validateName(name){ function validateName(name){
var profile_list = shadersettings.profiles_list; var profile_list = appSettings.profiles_list;
if (name === "") if (name === "")
return 1; return 1;

View File

@ -33,13 +33,13 @@ Item{
property alias title: ksession.title property alias title: ksession.title
property alias kterminal: kterminal property alias kterminal: kterminal
anchors.leftMargin: frame.item.displacementLeft * shadersettings.window_scaling anchors.leftMargin: frame.item.displacementLeft * appSettings.window_scaling
anchors.rightMargin: frame.item.displacementRight * shadersettings.window_scaling anchors.rightMargin: frame.item.displacementRight * appSettings.window_scaling
anchors.topMargin: frame.item.displacementTop * shadersettings.window_scaling anchors.topMargin: frame.item.displacementTop * appSettings.window_scaling
anchors.bottomMargin: frame.item.displacementBottom * shadersettings.window_scaling anchors.bottomMargin: frame.item.displacementBottom * appSettings.window_scaling
//The blur effect has to take into account the framerate //The blur effect has to take into account the framerate
property real mBlur: shadersettings.motion_blur property real mBlur: appSettings.motion_blur
property real motionBlurCoefficient: (_maxBlurCoefficient * mBlur + _minBlurCoefficient * (1 - mBlur)) property real motionBlurCoefficient: (_maxBlurCoefficient * mBlur + _minBlurCoefficient * (1 - mBlur))
property real _minBlurCoefficient: 0.70 property real _minBlurCoefficient: 0.70
property real _maxBlurCoefficient: 0.90 property real _maxBlurCoefficient: 0.90
@ -58,7 +58,7 @@ Item{
//When settings are updated sources need to be redrawn. //When settings are updated sources need to be redrawn.
Connections{ Connections{
target: shadersettings target: appSettings
onFontScalingChanged: terminalContainer.updateSources(); onFontScalingChanged: terminalContainer.updateSources();
onFontWidthChanged: terminalContainer.updateSources(); onFontWidthChanged: terminalContainer.updateSources();
} }
@ -109,12 +109,12 @@ Item{
font.pixelSize = pixelSize; font.pixelSize = pixelSize;
font.family = fontLoader.name; font.family = fontLoader.name;
var fontWidth = 1.0 / shadersettings.fontWidth; var fontWidth = 1.0 / appSettings.fontWidth;
width = Qt.binding(function() {return Math.floor(fontWidth * terminalContainer.width / screenScaling);}); width = Qt.binding(function() {return Math.floor(fontWidth * terminalContainer.width / screenScaling);});
height = Qt.binding(function() {return Math.floor(terminalContainer.height / screenScaling);}); height = Qt.binding(function() {return Math.floor(terminalContainer.height / screenScaling);});
var scaleTexture = Math.max(Math.round(screenScaling / shadersettings.scanline_quality), 1.0); var scaleTexture = Math.max(Math.round(screenScaling / appSettings.scanline_quality), 1.0);
kterminalSource.textureSize = Qt.binding(function () { kterminalSource.textureSize = Qt.binding(function () {
return Qt.size(kterminal.width * scaleTexture, kterminal.height * scaleTexture); return Qt.size(kterminal.width * scaleTexture, kterminal.height * scaleTexture);
@ -124,7 +124,7 @@ Item{
//update(); //update();
} }
Component.onCompleted: { Component.onCompleted: {
shadersettings.terminalFontChanged.connect(handleFontChange); appSettings.terminalFontChanged.connect(handleFontChange);
// Retrieve the variable set in main.cpp if arguments are passed. // Retrieve the variable set in main.cpp if arguments are passed.
if (shellProgram) if (shellProgram)
@ -143,8 +143,8 @@ Item{
MenuSeparator{visible: Qt.platform.os !== "osx"} MenuSeparator{visible: Qt.platform.os !== "osx"}
MenuItem{action: fullscreenAction; visible: Qt.platform.os !== "osx"} MenuItem{action: fullscreenAction; visible: Qt.platform.os !== "osx"}
MenuItem{action: showMenubarAction; visible: Qt.platform.os !== "osx"} MenuItem{action: showMenubarAction; visible: Qt.platform.os !== "osx"}
MenuSeparator{visible: !shadersettings.showMenubar} MenuSeparator{visible: !appSettings.showMenubar}
CRTMainMenuBar{visible: !shadersettings.showMenubar} CRTMainMenuBar{visible: !appSettings.showMenubar}
} }
MouseArea{ MouseArea{
acceptedButtons: Qt.LeftButton | Qt.MiddleButton | Qt.RightButton acceptedButtons: Qt.LeftButton | Qt.MiddleButton | Qt.RightButton
@ -183,7 +183,7 @@ Item{
y = y / height; y = y / height;
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) * shadersettings.screen_distortion; var distortion = (cc.height * cc.height + cc.width * cc.width) * appSettings.screen_distortion;
return Qt.point((x - cc.width * (1+distortion) * distortion) * kterminal.width, return Qt.point((x - cc.width * (1+distortion) * distortion) * kterminal.width,
(y - cc.height * (1+distortion) * distortion) * kterminal.height) (y - cc.height * (1+distortion) * distortion) * kterminal.height)
@ -229,7 +229,7 @@ Item{
} }
// Restart blurred source settings change. // Restart blurred source settings change.
Connections{ Connections{
target: shadersettings target: appSettings
onScanline_qualityChanged: _blurredSourceEffect.restartBlurSource(); onScanline_qualityChanged: _blurredSourceEffect.restartBlurSource();
onMotion_blurChanged: _blurredSourceEffect.restartBlurSource(); onMotion_blurChanged: _blurredSourceEffect.restartBlurSource();
onTerminalFontChanged: _blurredSourceEffect.restartBlurSource(); onTerminalFontChanged: _blurredSourceEffect.restartBlurSource();

View File

@ -30,55 +30,55 @@ Tab{
anchors.fill: parent anchors.fill: parent
CheckableSlider{ CheckableSlider{
name: qsTr("Bloom") name: qsTr("Bloom")
onNewValue: shadersettings.bloom_strength = newValue onNewValue: appSettings.bloom_strength = newValue
value: shadersettings.bloom_strength value: appSettings.bloom_strength
} }
CheckableSlider{ CheckableSlider{
name: qsTr("Motion Blur") name: qsTr("Motion Blur")
onNewValue: shadersettings.motion_blur = newValue onNewValue: appSettings.motion_blur = newValue
value: shadersettings.motion_blur value: appSettings.motion_blur
} }
CheckableSlider{ CheckableSlider{
name: qsTr("Noise") name: qsTr("Noise")
onNewValue: shadersettings.noise_strength = newValue onNewValue: appSettings.noise_strength = newValue
value: shadersettings.noise_strength value: appSettings.noise_strength
} }
CheckableSlider{ CheckableSlider{
name: qsTr("Jitter") name: qsTr("Jitter")
onNewValue: shadersettings.jitter = newValue onNewValue: appSettings.jitter = newValue
value: shadersettings.jitter value: appSettings.jitter
} }
CheckableSlider{ CheckableSlider{
name: qsTr("Glow") name: qsTr("Glow")
onNewValue: shadersettings.glowing_line_strength = newValue; onNewValue: appSettings.glowing_line_strength = newValue;
value: shadersettings.glowing_line_strength value: appSettings.glowing_line_strength
} }
CheckableSlider{ CheckableSlider{
name: qsTr("Screen distortion") name: qsTr("Screen distortion")
onNewValue: shadersettings.screen_distortion = newValue; onNewValue: appSettings.screen_distortion = newValue;
value: shadersettings.screen_distortion; value: appSettings.screen_distortion;
} }
CheckableSlider{ CheckableSlider{
name: qsTr("Ambient light") name: qsTr("Ambient light")
onNewValue: shadersettings.ambient_light = newValue; onNewValue: appSettings.ambient_light = newValue;
value: shadersettings.ambient_light value: appSettings.ambient_light
enabled: shadersettings.frames_index !== 0 enabled: appSettings.frames_index !== 0
} }
CheckableSlider{ CheckableSlider{
name: qsTr("Brightness flickering") name: qsTr("Brightness flickering")
onNewValue: shadersettings.brightness_flickering = newValue; onNewValue: appSettings.brightness_flickering = newValue;
value: shadersettings.brightness_flickering; value: appSettings.brightness_flickering;
} }
CheckableSlider{ CheckableSlider{
name: qsTr("Horizontal flickering") name: qsTr("Horizontal flickering")
onNewValue: shadersettings.horizontal_sincronization = newValue; onNewValue: appSettings.horizontal_sincronization = newValue;
value: shadersettings.horizontal_sincronization; value: appSettings.horizontal_sincronization;
} }
CheckableSlider{ CheckableSlider{
name: qsTr("RGB shift") name: qsTr("RGB shift")
onNewValue: shadersettings.rgb_shift = newValue; onNewValue: appSettings.rgb_shift = newValue;
value: shadersettings.rgb_shift; value: appSettings.rgb_shift;
enabled: shadersettings.chroma_color !== 0 enabled: appSettings.chroma_color !== 0
} }
} }
} }

View File

@ -33,8 +33,8 @@ Tab{
ComboBox{ ComboBox{
id: profilesbox id: profilesbox
Layout.fillWidth: true Layout.fillWidth: true
model: shadersettings.profiles_list model: appSettings.profiles_list
currentIndex: shadersettings.profiles_index currentIndex: appSettings.profiles_index
} }
RowLayout{ RowLayout{
Layout.fillWidth: true Layout.fillWidth: true
@ -42,9 +42,9 @@ Tab{
Layout.fillWidth: true Layout.fillWidth: true
text: qsTr("Load") text: qsTr("Load")
onClicked: { onClicked: {
shadersettings.profiles_index = profilesbox.currentIndex appSettings.profiles_index = profilesbox.currentIndex
shadersettings.loadCurrentProfile(); appSettings.loadCurrentProfile();
shadersettings.handleFontChanged(); appSettings.handleFontChanged();
} }
} }
Button{ Button{
@ -55,16 +55,16 @@ Tab{
Button{ Button{
Layout.fillWidth: true Layout.fillWidth: true
text: qsTr("Remove Selected") text: qsTr("Remove Selected")
enabled: !shadersettings.profiles_list.get(profilesbox.currentIndex).builtin enabled: !appSettings.profiles_list.get(profilesbox.currentIndex).builtin
onClicked: { onClicked: {
shadersettings.profiles_list.remove(profilesbox.currentIndex) appSettings.profiles_list.remove(profilesbox.currentIndex)
profilesbox.currentIndex = profilesbox.currentIndex - 1 profilesbox.currentIndex = profilesbox.currentIndex - 1
} }
} }
} }
InsertNameDialog{ InsertNameDialog{
id: insertname id: insertname
onNameSelected: shadersettings.addNewCustomProfile(name) onNameSelected: appSettings.addNewCustomProfile(name)
} }
} }
} }
@ -76,18 +76,18 @@ Tab{
columns: 2 columns: 2
Text{ text: qsTr("Brightness") } Text{ text: qsTr("Brightness") }
SimpleSlider{ SimpleSlider{
onValueChanged: shadersettings.brightness = value onValueChanged: appSettings.brightness = value
value: shadersettings.brightness value: appSettings.brightness
} }
Text{ text: qsTr("Contrast") } Text{ text: qsTr("Contrast") }
SimpleSlider{ SimpleSlider{
onValueChanged: shadersettings.contrast = value onValueChanged: appSettings.contrast = value
value: shadersettings.contrast value: appSettings.contrast
} }
Text{ text: qsTr("Opacity") } Text{ text: qsTr("Opacity") }
SimpleSlider{ SimpleSlider{
onValueChanged: shadersettings.windowOpacity = value onValueChanged: appSettings.windowOpacity = value
value: shadersettings.windowOpacity value: appSettings.windowOpacity
} }
} }
} }
@ -99,9 +99,9 @@ Tab{
ComboBox{ ComboBox{
id: framescombobox id: framescombobox
Layout.fillWidth: true Layout.fillWidth: true
model: shadersettings.frames_list model: appSettings.frames_list
currentIndex: shadersettings.frames_index currentIndex: appSettings.frames_index
onCurrentIndexChanged: shadersettings.frames_index = currentIndex onCurrentIndexChanged: appSettings.frames_index = currentIndex
} }
} }
} }

View File

@ -36,8 +36,8 @@ Tab{
columns: 3 columns: 3
CheckBox{ CheckBox{
property int fps: checked ? slider.value : 0 property int fps: checked ? slider.value : 0
onFpsChanged: shadersettings.fps = fps onFpsChanged: appSettings.fps = fps
checked: shadersettings.fps !== 0 checked: appSettings.fps !== 0
text: qsTr("Limit FPS") text: qsTr("Limit FPS")
} }
Slider{ Slider{
@ -46,16 +46,16 @@ Tab{
stepSize: 1 stepSize: 1
maximumValue: 60 maximumValue: 60
minimumValue: 1 minimumValue: 1
enabled: shadersettings.fps !== 0 enabled: appSettings.fps !== 0
value: shadersettings.fps !== 0 ? shadersettings.fps : 60 value: appSettings.fps !== 0 ? appSettings.fps : 60
} }
Text{text: slider.value} Text{text: slider.value}
Text{text: qsTr("Texture Quality")} Text{text: qsTr("Texture Quality")}
Slider{ Slider{
Layout.fillWidth: true Layout.fillWidth: true
id: txtslider id: txtslider
onValueChanged: shadersettings.window_scaling = value; onValueChanged: appSettings.window_scaling = value;
value: shadersettings.window_scaling value: appSettings.window_scaling
stepSize: 0.10 stepSize: 0.10
Component.onCompleted: minimumValue = 0.3 //Without this value gets set to 0.5 Component.onCompleted: minimumValue = 0.3 //Without this value gets set to 0.5
} }
@ -79,7 +79,7 @@ Tab{
qsTr("High") qsTr("High")
] ]
onValsIndexChanged: shadersettings.scanline_quality = vals[valsIndex]; onValsIndexChanged: appSettings.scanline_quality = vals[valsIndex];
Text{text: qsTr("Scanlines Quality")} Text{text: qsTr("Scanlines Quality")}
Slider{ Slider{
@ -90,12 +90,12 @@ Tab{
Component.onCompleted: { Component.onCompleted: {
minimumValue = 0; minimumValue = 0;
maximumValue = 2; maximumValue = 2;
value = parent.vals.indexOf(shadersettings.scanline_quality); value = parent.vals.indexOf(appSettings.scanline_quality);
} }
Connections{ Connections{
target: shadersettings target: appSettings
onScanline_qualityChanged: onScanline_qualityChanged:
scanlineQualityContainer.valsIndex = scanlineQualityContainer.vals.indexOf(shadersettings.scanline_quality); scanlineQualityContainer.valsIndex = scanlineQualityContainer.vals.indexOf(appSettings.scanline_quality);
} }
} }
Text{ Text{
@ -120,7 +120,7 @@ Tab{
qsTr("High") qsTr("High")
] ]
onValsIndexChanged: shadersettings.bloom_quality = vals[valsIndex]; onValsIndexChanged: appSettings.bloom_quality = vals[valsIndex];
Text{text: qsTr("Bloom Quality")} Text{text: qsTr("Bloom Quality")}
Slider{ Slider{
@ -131,12 +131,12 @@ Tab{
Component.onCompleted: { Component.onCompleted: {
minimumValue = 0; minimumValue = 0;
maximumValue = 2; maximumValue = 2;
value = parent.vals.indexOf(shadersettings.bloom_quality); value = parent.vals.indexOf(appSettings.bloom_quality);
} }
Connections{ Connections{
target: shadersettings target: appSettings
onBloom_qualityChanged: onBloom_qualityChanged:
bloomQualityContainer.valsIndex = bloomQualityContainer.vals.indexOf(shadersettings.bloom_quality); bloomQualityContainer.valsIndex = bloomQualityContainer.vals.indexOf(appSettings.bloom_quality);
} }
} }
Text{ Text{
@ -150,9 +150,9 @@ Tab{
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
CheckBox{ CheckBox{
checked: shadersettings._frameReflections checked: appSettings._frameReflections
text: qsTr("Frame Reflections") text: qsTr("Frame Reflections")
onCheckedChanged: shadersettings._frameReflections = checked onCheckedChanged: appSettings._frameReflections = checked
} }
} }
} }

View File

@ -33,9 +33,9 @@ Tab{
property string selectedElement: model[currentIndex] property string selectedElement: model[currentIndex]
anchors.fill: parent anchors.fill: parent
model: [qsTr("Default"), qsTr("Scanlines"), qsTr("Pixels")] model: [qsTr("Default"), qsTr("Scanlines"), qsTr("Pixels")]
currentIndex: shadersettings.rasterization currentIndex: appSettings.rasterization
onCurrentIndexChanged: { onCurrentIndexChanged: {
shadersettings.rasterization = currentIndex appSettings.rasterization = currentIndex
fontChanger.updateIndex(); fontChanger.updateIndex();
} }
} }
@ -50,14 +50,14 @@ Tab{
ComboBox{ ComboBox{
id: fontChanger id: fontChanger
Layout.fillWidth: true Layout.fillWidth: true
model: shadersettings.fontlist model: appSettings.fontlist
currentIndex: updateIndex() currentIndex: updateIndex()
onActivated: { onActivated: {
shadersettings.fontIndexes[shadersettings.rasterization] = index; appSettings.fontIndexes[appSettings.rasterization] = index;
shadersettings.handleFontChanged(); appSettings.handleFontChanged();
} }
function updateIndex(){ function updateIndex(){
currentIndex = shadersettings.fontIndexes[shadersettings.rasterization]; currentIndex = appSettings.fontIndexes[appSettings.rasterization];
} }
} }
Text{ text: qsTr("Scaling") } Text{ text: qsTr("Scaling") }
@ -66,18 +66,18 @@ Tab{
Slider{ Slider{
Layout.fillWidth: true Layout.fillWidth: true
id: fontScalingChanger id: fontScalingChanger
onValueChanged: if(enabled) shadersettings.fontScaling = value onValueChanged: if(enabled) appSettings.fontScaling = value
stepSize: 0.05 stepSize: 0.05
enabled: false // Another trick to fix initial bad behavior. enabled: false // Another trick to fix initial bad behavior.
Component.onCompleted: { Component.onCompleted: {
minimumValue = 0.5; minimumValue = 0.5;
maximumValue = 2.5; maximumValue = 2.5;
value = shadersettings.fontScaling; value = appSettings.fontScaling;
enabled = true; enabled = true;
} }
Connections{ Connections{
target: shadersettings target: appSettings
onFontScalingChanged: fontScalingChanger.value = shadersettings.fontScaling; onFontScalingChanged: fontScalingChanger.value = appSettings.fontScaling;
} }
} }
Text{ Text{
@ -90,8 +90,8 @@ Tab{
Slider{ Slider{
Layout.fillWidth: true Layout.fillWidth: true
id: widthChanger id: widthChanger
onValueChanged: shadersettings.fontWidth = value; onValueChanged: appSettings.fontWidth = value;
value: shadersettings.fontWidth value: appSettings.fontWidth
stepSize: 0.05 stepSize: 0.05
Component.onCompleted: minimumValue = 0.5 //Without this value gets set to 0.5 Component.onCompleted: minimumValue = 0.5 //Without this value gets set to 0.5
} }
@ -112,29 +112,29 @@ Tab{
name: qsTr("Font") name: qsTr("Font")
height: 50 height: 50
Layout.fillWidth: true Layout.fillWidth: true
onColorSelected: shadersettings._font_color = color; onColorSelected: appSettings._font_color = color;
button_color: shadersettings._font_color button_color: appSettings._font_color
} }
ColorButton{ ColorButton{
name: qsTr("Background") name: qsTr("Background")
height: 50 height: 50
Layout.fillWidth: true Layout.fillWidth: true
onColorSelected: shadersettings._background_color = color; onColorSelected: appSettings._background_color = color;
button_color: shadersettings._background_color button_color: appSettings._background_color
} }
} }
ColumnLayout{ ColumnLayout{
Layout.fillWidth: true Layout.fillWidth: true
CheckableSlider{ CheckableSlider{
name: qsTr("Chroma Color") name: qsTr("Chroma Color")
onNewValue: shadersettings.chroma_color = newValue onNewValue: appSettings.chroma_color = newValue
value: shadersettings.chroma_color value: appSettings.chroma_color
} }
CheckableSlider{ CheckableSlider{
name: qsTr("Saturation Color") name: qsTr("Saturation Color")
onNewValue: shadersettings.saturation_color = newValue onNewValue: appSettings.saturation_color = newValue
value: shadersettings.saturation_color value: appSettings.saturation_color
enabled: shadersettings.chroma_color !== 0 enabled: appSettings.chroma_color !== 0
} }
} }
} }

View File

@ -28,31 +28,31 @@ ShaderEffect {
property ShaderEffectSource noiseSource property ShaderEffectSource noiseSource
property ShaderEffectSource bloomSource property ShaderEffectSource bloomSource
property color font_color: shadersettings.font_color property color font_color: appSettings.font_color
property color background_color: shadersettings.background_color property color background_color: appSettings.background_color
property real bloom_strength: shadersettings.bloom_strength * 2.5 property real bloom_strength: appSettings.bloom_strength * 2.5
property real jitter: shadersettings.jitter * 0.007 property real jitter: appSettings.jitter * 0.007
property real noise_strength: shadersettings.noise_strength property real noise_strength: appSettings.noise_strength
property real screen_distorsion: shadersettings.screen_distortion property real screen_distorsion: appSettings.screen_distortion
property real glowing_line_strength: shadersettings.glowing_line_strength property real glowing_line_strength: appSettings.glowing_line_strength
property real chroma_color: shadersettings.chroma_color; property real chroma_color: appSettings.chroma_color;
property real rgb_shift: shadersettings.rgb_shift * 0.2 property real rgb_shift: appSettings.rgb_shift * 0.2
property real brightness_flickering: shadersettings.brightness_flickering property real brightness_flickering: appSettings.brightness_flickering
property real horizontal_sincronization: shadersettings.horizontal_sincronization property real horizontal_sincronization: appSettings.horizontal_sincronization
property bool frameReflections: shadersettings.frameReflections property bool frameReflections: appSettings.frameReflections
property real disp_top: (frame.item.displacementTop * shadersettings.window_scaling) / height property real disp_top: (frame.item.displacementTop * appSettings.window_scaling) / height
property real disp_bottom: (frame.item.displacementBottom * shadersettings.window_scaling) / height property real disp_bottom: (frame.item.displacementBottom * appSettings.window_scaling) / height
property real disp_left: (frame.item.displacementLeft * shadersettings.window_scaling) / width property real disp_left: (frame.item.displacementLeft * appSettings.window_scaling) / width
property real disp_right: (frame.item.displacementRight * shadersettings.window_scaling) / width property real disp_right: (frame.item.displacementRight * appSettings.window_scaling) / width
property real screen_brightness: shadersettings.brightness * 1.5 + 0.5 property real screen_brightness: appSettings.brightness * 1.5 + 0.5
TimeManager{ TimeManager{
id: timeManager id: timeManager

View File

@ -6,7 +6,7 @@ ShaderTerminal{
property alias terminalSize: terminal.terminalSize property alias terminalSize: terminal.terminalSize
id: mainShader id: mainShader
opacity: shadersettings.windowOpacity * 0.3 + 0.7 opacity: appSettings.windowOpacity * 0.3 + 0.7
blending: false blending: false
@ -14,7 +14,7 @@ ShaderTerminal{
id: frame id: frame
anchors.fill: parent anchors.fill: parent
z: 2.1 z: 2.1
source: shadersettings.frame_source source: appSettings.frame_source
} }
PreprocessedTerminal{ PreprocessedTerminal{
@ -27,9 +27,9 @@ ShaderTerminal{
// EFFECTS //////////////////////////////////////////////////////////////// // EFFECTS ////////////////////////////////////////////////////////////////
Loader{ Loader{
property real scaling: shadersettings.bloom_quality * shadersettings.window_scaling property real scaling: appSettings.bloom_quality * appSettings.window_scaling
id: bloomEffectLoader id: bloomEffectLoader
active: shadersettings.bloom_strength active: appSettings.bloom_strength
asynchronous: true asynchronous: true
width: parent.width * scaling width: parent.width * scaling
height: parent.height * scaling height: parent.height * scaling
@ -41,7 +41,7 @@ ShaderTerminal{
} }
Loader{ Loader{
id: bloomSourceLoader id: bloomSourceLoader
active: shadersettings.bloom_strength !== 0 active: appSettings.bloom_strength !== 0
asynchronous: true asynchronous: true
sourceComponent: ShaderEffectSource{ sourceComponent: ShaderEffectSource{
id: _bloomEffectSource id: _bloomEffectSource
@ -57,7 +57,7 @@ ShaderTerminal{
ShaderEffect { ShaderEffect {
id: staticNoiseEffect id: staticNoiseEffect
anchors.fill: parent anchors.fill: parent
property real element_size: shadersettings.rasterization == shadersettings.no_rasterization ? 2 : 1 property real element_size: appSettings.rasterization == appSettings.no_rasterization ? 2 : 1
property alias __terminalHeight: terminal.virtualResolution.height property alias __terminalHeight: terminal.virtualResolution.height
property alias __terminalWidth: terminal.virtualResolution.width property alias __terminalWidth: terminal.virtualResolution.width
property size virtual_resolution: Qt.size(__terminalWidth / element_size, __terminalHeight / element_size) property size virtual_resolution: Qt.size(__terminalWidth / element_size, __terminalHeight / element_size)
@ -112,8 +112,8 @@ ShaderTerminal{
width: parent.width width: parent.width
height: parent.height height: parent.height
property real outColor: 0.0 property real outColor: 0.0
property real dispX: (5 / width) * shadersettings.window_scaling property real dispX: (5 / width) * appSettings.window_scaling
property real dispY: 5 / height * shadersettings.window_scaling property real dispY: 5 / height * appSettings.window_scaling
property size virtual_resolution: terminal.virtualResolution property size virtual_resolution: terminal.virtualResolution
blending: false blending: false
@ -130,9 +130,9 @@ ShaderTerminal{
highp float getScanlineIntensity(vec2 coords) { highp float getScanlineIntensity(vec2 coords) {
highp float result = 1.0;" + highp float result = 1.0;" +
(shadersettings.rasterization != shadersettings.no_rasterization ? (appSettings.rasterization != appSettings.no_rasterization ?
"result *= abs(sin(coords.y * virtual_resolution.y * "+Math.PI+"));" : "") + "result *= abs(sin(coords.y * virtual_resolution.y * "+Math.PI+"));" : "") +
(shadersettings.rasterization == shadersettings.pixel_rasterization ? (appSettings.rasterization == appSettings.pixel_rasterization ?
"result *= abs(sin(coords.x * virtual_resolution.x * "+Math.PI+"));" : "") + " "result *= abs(sin(coords.x * virtual_resolution.x * "+Math.PI+"));" : "") + "
return result; return result;

View File

@ -27,13 +27,13 @@ Timer{
NumberAnimation on time { NumberAnimation on time {
from: 0 from: 0
to: 100000 to: 100000
running: shadersettings.fps === 0 && enableTimer running: appSettings.fps === 0 && enableTimer
duration: 100000 duration: 100000
loops: Animation.Infinite loops: Animation.Infinite
} }
onTriggered: time += interval onTriggered: time += interval
running: shadersettings.fps !== 0 && enableTimer running: appSettings.fps !== 0 && enableTimer
interval: Math.round(1000 / shadersettings.fps) interval: Math.round(1000 / appSettings.fps)
repeat: true repeat: true
} }

View File

@ -4,16 +4,16 @@ import QtGraphicalEffects 1.0
ShaderEffect{ ShaderEffect{
property variant source: framesource property variant source: framesource
property variant normals: framesourcenormals property variant normals: framesourcenormals
property real screen_distorsion: shadersettings.screen_distortion * framecontainer.distortionCoefficient property real screen_distorsion: appSettings.screen_distortion * framecontainer.distortionCoefficient
property real ambient_light: shadersettings.ambient_light property real ambient_light: appSettings.ambient_light
property color font_color: shadersettings.font_color property color font_color: appSettings.font_color
property color background_color: shadersettings.background_color property color background_color: appSettings.background_color
property real brightness: shadersettings.brightness * 1.5 + 0.5 property real brightness: appSettings.brightness * 1.5 + 0.5
property bool frameReflections: shadersettings.frameReflections property bool frameReflections: appSettings.frameReflections
property variant lightSource: reflectionEffectSourceLoader.item property variant lightSource: reflectionEffectSourceLoader.item
property real chroma_color: shadersettings.chroma_color property real chroma_color: appSettings.chroma_color
Loader{ Loader{
id: reflectionEffectLoader id: reflectionEffectLoader

View File

@ -33,13 +33,13 @@ ApplicationWindow{
visible: true visible: true
property bool fullscreen: shadersettings.fullscreen property bool fullscreen: appSettings.fullscreen
onFullscreenChanged: visibility = (fullscreen ? Window.FullScreen : Window.Windowed) onFullscreenChanged: visibility = (fullscreen ? Window.FullScreen : Window.Windowed)
//Workaround: if menubar is assigned ugly margins are visible. //Workaround: if menubar is assigned ugly margins are visible.
menuBar: Qt.platform.os === "osx" menuBar: Qt.platform.os === "osx"
? defaultMenuBar ? defaultMenuBar
: shadersettings.showMenubar ? defaultMenuBar : null : appSettings.showMenubar ? defaultMenuBar : null
color: "#00000000" color: "#00000000"
title: terminalContainer.title || qsTr("cool-retro-term") title: terminalContainer.title || qsTr("cool-retro-term")
@ -50,17 +50,17 @@ ApplicationWindow{
enabled: Qt.platform.os !== "osx" enabled: Qt.platform.os !== "osx"
shortcut: "Ctrl+Shift+M" shortcut: "Ctrl+Shift+M"
checkable: true checkable: true
checked: shadersettings.showMenubar checked: appSettings.showMenubar
onTriggered: shadersettings.showMenubar = !shadersettings.showMenubar onTriggered: appSettings.showMenubar = !appSettings.showMenubar
} }
Action { Action {
id: fullscreenAction id: fullscreenAction
text: qsTr("Fullscreen") text: qsTr("Fullscreen")
enabled: Qt.platform.os !== "osx" enabled: Qt.platform.os !== "osx"
shortcut: "Alt+F11" shortcut: "Alt+F11"
onTriggered: shadersettings.fullscreen = !shadersettings.fullscreen; onTriggered: appSettings.fullscreen = !appSettings.fullscreen;
checkable: true checkable: true
checked: shadersettings.fullscreen checked: appSettings.fullscreen
} }
Action { Action {
id: quitAction id: quitAction
@ -87,13 +87,13 @@ ApplicationWindow{
id: zoomIn id: zoomIn
text: qsTr("Zoom In") text: qsTr("Zoom In")
shortcut: "Ctrl++" shortcut: "Ctrl++"
onTriggered: shadersettings.incrementScaling(); onTriggered: appSettings.incrementScaling();
} }
Action{ Action{
id: zoomOut id: zoomOut
text: qsTr("Zoom Out") text: qsTr("Zoom Out")
shortcut: "Ctrl+-" shortcut: "Ctrl+-"
onTriggered: shadersettings.decrementScaling(); onTriggered: appSettings.decrementScaling();
} }
Action{ Action{
id: showAboutAction id: showAboutAction
@ -106,16 +106,16 @@ ApplicationWindow{
id: defaultMenuBar id: defaultMenuBar
} }
ApplicationSettings{ ApplicationSettings{
id: shadersettings id: appSettings
} }
TerminalContainer{ TerminalContainer{
id: terminalContainer id: terminalContainer
width: parent.width * shadersettings.window_scaling width: parent.width * appSettings.window_scaling
height: parent.height * shadersettings.window_scaling height: parent.height * appSettings.window_scaling
transform: Scale { transform: Scale {
xScale: 1 / shadersettings.window_scaling xScale: 1 / appSettings.window_scaling
yScale: 1 / shadersettings.window_scaling yScale: 1 / appSettings.window_scaling
} }
} }
SettingsWindow{ SettingsWindow{
@ -128,11 +128,11 @@ ApplicationWindow{
} }
Loader{ Loader{
anchors.centerIn: parent anchors.centerIn: parent
active: shadersettings.show_terminal_size active: appSettings.show_terminal_size
sourceComponent: SizeOverlay{ sourceComponent: SizeOverlay{
z: 3 z: 3
terminalSize: terminalContainer.terminalSize terminalSize: terminalContainer.terminalSize
} }
} }
Component.onCompleted: shadersettings.handleFontChanged(); Component.onCompleted: appSettings.handleFontChanged();
} }