mirror of
				https://github.com/Swordfish90/cool-retro-term.git
				synced 2025-11-04 00:52:11 +00:00 
			
		
		
		
	Refactoring: rename shadersettings in appSettings.
This commit is contained in:
		@@ -77,7 +77,7 @@ Window{
 | 
			
		||||
            Text{
 | 
			
		||||
                anchors.horizontalCenter: parent.horizontalCenter
 | 
			
		||||
                horizontalAlignment: Text.AlignHCenter
 | 
			
		||||
                text: shadersettings.version + "\n" +
 | 
			
		||||
                text: appSettings.version + "\n" +
 | 
			
		||||
                      qsTr("Author: ") + "Filippo Scognamiglio\n" +
 | 
			
		||||
                      qsTr("Email: ")  + "flscogna@gmail.com\n" +
 | 
			
		||||
                      qsTr("Source: ") + "https://github.com/Swordfish90/cool-retro-term\n"
 | 
			
		||||
 
 | 
			
		||||
@@ -20,8 +20,6 @@
 | 
			
		||||
 | 
			
		||||
import QtQuick 2.2
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Item{
 | 
			
		||||
    property string version: "0.9"
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -31,12 +31,12 @@ MenuBar {
 | 
			
		||||
        title: qsTr("Profiles")
 | 
			
		||||
        visible: defaultMenuBar.visible
 | 
			
		||||
        Instantiator{
 | 
			
		||||
            model: shadersettings.profiles_list
 | 
			
		||||
            model: appSettings.profiles_list
 | 
			
		||||
            delegate: MenuItem {
 | 
			
		||||
                text: model.text
 | 
			
		||||
                onTriggered: {
 | 
			
		||||
                    shadersettings.loadProfileString(obj_string);
 | 
			
		||||
                    shadersettings.handleFontChanged();
 | 
			
		||||
                    appSettings.loadProfileString(obj_string);
 | 
			
		||||
                    appSettings.handleFontChanged();
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            onObjectAdded: profilesMenu.insertItem(index, object)
 | 
			
		||||
 
 | 
			
		||||
@@ -45,7 +45,7 @@ Window{
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    function validateName(name){
 | 
			
		||||
        var profile_list = shadersettings.profiles_list;
 | 
			
		||||
        var profile_list = appSettings.profiles_list;
 | 
			
		||||
        if (name === "")
 | 
			
		||||
            return 1;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -33,13 +33,13 @@ Item{
 | 
			
		||||
    property alias title: ksession.title
 | 
			
		||||
    property alias kterminal: kterminal
 | 
			
		||||
 | 
			
		||||
    anchors.leftMargin: frame.item.displacementLeft * shadersettings.window_scaling
 | 
			
		||||
    anchors.rightMargin: frame.item.displacementRight * shadersettings.window_scaling
 | 
			
		||||
    anchors.topMargin: frame.item.displacementTop * shadersettings.window_scaling
 | 
			
		||||
    anchors.bottomMargin: frame.item.displacementBottom * shadersettings.window_scaling
 | 
			
		||||
    anchors.leftMargin: frame.item.displacementLeft * appSettings.window_scaling
 | 
			
		||||
    anchors.rightMargin: frame.item.displacementRight * appSettings.window_scaling
 | 
			
		||||
    anchors.topMargin: frame.item.displacementTop * appSettings.window_scaling
 | 
			
		||||
    anchors.bottomMargin: frame.item.displacementBottom * appSettings.window_scaling
 | 
			
		||||
 | 
			
		||||
    //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 _minBlurCoefficient: 0.70
 | 
			
		||||
    property real _maxBlurCoefficient: 0.90
 | 
			
		||||
@@ -58,7 +58,7 @@ Item{
 | 
			
		||||
 | 
			
		||||
    //When settings are updated sources need to be redrawn.
 | 
			
		||||
    Connections{
 | 
			
		||||
        target: shadersettings
 | 
			
		||||
        target: appSettings
 | 
			
		||||
        onFontScalingChanged: terminalContainer.updateSources();
 | 
			
		||||
        onFontWidthChanged: terminalContainer.updateSources();
 | 
			
		||||
    }
 | 
			
		||||
@@ -109,12 +109,12 @@ Item{
 | 
			
		||||
            font.pixelSize = pixelSize;
 | 
			
		||||
            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);});
 | 
			
		||||
            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 () {
 | 
			
		||||
                return Qt.size(kterminal.width * scaleTexture, kterminal.height * scaleTexture);
 | 
			
		||||
@@ -124,7 +124,7 @@ Item{
 | 
			
		||||
            //update();
 | 
			
		||||
        }
 | 
			
		||||
        Component.onCompleted: {
 | 
			
		||||
            shadersettings.terminalFontChanged.connect(handleFontChange);
 | 
			
		||||
            appSettings.terminalFontChanged.connect(handleFontChange);
 | 
			
		||||
 | 
			
		||||
            // Retrieve the variable set in main.cpp if arguments are passed.
 | 
			
		||||
            if (shellProgram)
 | 
			
		||||
@@ -143,8 +143,8 @@ Item{
 | 
			
		||||
        MenuSeparator{visible: Qt.platform.os !== "osx"}
 | 
			
		||||
        MenuItem{action: fullscreenAction; visible: Qt.platform.os !== "osx"}
 | 
			
		||||
        MenuItem{action: showMenubarAction; visible: Qt.platform.os !== "osx"}
 | 
			
		||||
        MenuSeparator{visible: !shadersettings.showMenubar}
 | 
			
		||||
        CRTMainMenuBar{visible: !shadersettings.showMenubar}
 | 
			
		||||
        MenuSeparator{visible: !appSettings.showMenubar}
 | 
			
		||||
        CRTMainMenuBar{visible: !appSettings.showMenubar}
 | 
			
		||||
    }
 | 
			
		||||
    MouseArea{
 | 
			
		||||
        acceptedButtons: Qt.LeftButton | Qt.MiddleButton | Qt.RightButton
 | 
			
		||||
@@ -183,7 +183,7 @@ Item{
 | 
			
		||||
            y = y / height;
 | 
			
		||||
 | 
			
		||||
            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,
 | 
			
		||||
                           (y - cc.height * (1+distortion) * distortion) * kterminal.height)
 | 
			
		||||
@@ -229,7 +229,7 @@ Item{
 | 
			
		||||
            }
 | 
			
		||||
            // Restart blurred source settings change.
 | 
			
		||||
            Connections{
 | 
			
		||||
                target: shadersettings
 | 
			
		||||
                target: appSettings
 | 
			
		||||
                onScanline_qualityChanged: _blurredSourceEffect.restartBlurSource();
 | 
			
		||||
                onMotion_blurChanged: _blurredSourceEffect.restartBlurSource();
 | 
			
		||||
                onTerminalFontChanged: _blurredSourceEffect.restartBlurSource();
 | 
			
		||||
 
 | 
			
		||||
@@ -30,55 +30,55 @@ Tab{
 | 
			
		||||
            anchors.fill: parent
 | 
			
		||||
            CheckableSlider{
 | 
			
		||||
                name: qsTr("Bloom")
 | 
			
		||||
                onNewValue: shadersettings.bloom_strength = newValue
 | 
			
		||||
                value: shadersettings.bloom_strength
 | 
			
		||||
                onNewValue: appSettings.bloom_strength = newValue
 | 
			
		||||
                value: appSettings.bloom_strength
 | 
			
		||||
            }
 | 
			
		||||
            CheckableSlider{
 | 
			
		||||
                name: qsTr("Motion Blur")
 | 
			
		||||
                onNewValue: shadersettings.motion_blur = newValue
 | 
			
		||||
                value: shadersettings.motion_blur
 | 
			
		||||
                onNewValue: appSettings.motion_blur = newValue
 | 
			
		||||
                value: appSettings.motion_blur
 | 
			
		||||
            }
 | 
			
		||||
            CheckableSlider{
 | 
			
		||||
                name: qsTr("Noise")
 | 
			
		||||
                onNewValue: shadersettings.noise_strength = newValue
 | 
			
		||||
                value: shadersettings.noise_strength
 | 
			
		||||
                onNewValue: appSettings.noise_strength = newValue
 | 
			
		||||
                value: appSettings.noise_strength
 | 
			
		||||
            }
 | 
			
		||||
            CheckableSlider{
 | 
			
		||||
                name: qsTr("Jitter")
 | 
			
		||||
                onNewValue: shadersettings.jitter = newValue
 | 
			
		||||
                value: shadersettings.jitter
 | 
			
		||||
                onNewValue: appSettings.jitter = newValue
 | 
			
		||||
                value: appSettings.jitter
 | 
			
		||||
            }
 | 
			
		||||
            CheckableSlider{
 | 
			
		||||
                name: qsTr("Glow")
 | 
			
		||||
                onNewValue: shadersettings.glowing_line_strength = newValue;
 | 
			
		||||
                value: shadersettings.glowing_line_strength
 | 
			
		||||
                onNewValue: appSettings.glowing_line_strength = newValue;
 | 
			
		||||
                value: appSettings.glowing_line_strength
 | 
			
		||||
            }
 | 
			
		||||
            CheckableSlider{
 | 
			
		||||
                name: qsTr("Screen distortion")
 | 
			
		||||
                onNewValue: shadersettings.screen_distortion = newValue;
 | 
			
		||||
                value: shadersettings.screen_distortion;
 | 
			
		||||
                onNewValue: appSettings.screen_distortion = newValue;
 | 
			
		||||
                value: appSettings.screen_distortion;
 | 
			
		||||
            }
 | 
			
		||||
            CheckableSlider{
 | 
			
		||||
                name: qsTr("Ambient light")
 | 
			
		||||
                onNewValue: shadersettings.ambient_light = newValue;
 | 
			
		||||
                value: shadersettings.ambient_light
 | 
			
		||||
                enabled: shadersettings.frames_index !== 0
 | 
			
		||||
                onNewValue: appSettings.ambient_light = newValue;
 | 
			
		||||
                value: appSettings.ambient_light
 | 
			
		||||
                enabled: appSettings.frames_index !== 0
 | 
			
		||||
            }
 | 
			
		||||
            CheckableSlider{
 | 
			
		||||
                name: qsTr("Brightness flickering")
 | 
			
		||||
                onNewValue: shadersettings.brightness_flickering = newValue;
 | 
			
		||||
                value: shadersettings.brightness_flickering;
 | 
			
		||||
                onNewValue: appSettings.brightness_flickering = newValue;
 | 
			
		||||
                value: appSettings.brightness_flickering;
 | 
			
		||||
            }
 | 
			
		||||
            CheckableSlider{
 | 
			
		||||
                name: qsTr("Horizontal flickering")
 | 
			
		||||
                onNewValue: shadersettings.horizontal_sincronization = newValue;
 | 
			
		||||
                value: shadersettings.horizontal_sincronization;
 | 
			
		||||
                onNewValue: appSettings.horizontal_sincronization = newValue;
 | 
			
		||||
                value: appSettings.horizontal_sincronization;
 | 
			
		||||
            }
 | 
			
		||||
            CheckableSlider{
 | 
			
		||||
                name: qsTr("RGB shift")
 | 
			
		||||
                onNewValue: shadersettings.rgb_shift = newValue;
 | 
			
		||||
                value: shadersettings.rgb_shift;
 | 
			
		||||
                enabled: shadersettings.chroma_color !== 0
 | 
			
		||||
                onNewValue: appSettings.rgb_shift = newValue;
 | 
			
		||||
                value: appSettings.rgb_shift;
 | 
			
		||||
                enabled: appSettings.chroma_color !== 0
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -33,8 +33,8 @@ Tab{
 | 
			
		||||
                ComboBox{
 | 
			
		||||
                    id: profilesbox
 | 
			
		||||
                    Layout.fillWidth: true
 | 
			
		||||
                    model: shadersettings.profiles_list
 | 
			
		||||
                    currentIndex: shadersettings.profiles_index
 | 
			
		||||
                    model: appSettings.profiles_list
 | 
			
		||||
                    currentIndex: appSettings.profiles_index
 | 
			
		||||
                }
 | 
			
		||||
                RowLayout{
 | 
			
		||||
                    Layout.fillWidth: true
 | 
			
		||||
@@ -42,9 +42,9 @@ Tab{
 | 
			
		||||
                        Layout.fillWidth: true
 | 
			
		||||
                        text: qsTr("Load")
 | 
			
		||||
                        onClicked: {
 | 
			
		||||
                            shadersettings.profiles_index = profilesbox.currentIndex
 | 
			
		||||
                            shadersettings.loadCurrentProfile();
 | 
			
		||||
                            shadersettings.handleFontChanged();
 | 
			
		||||
                            appSettings.profiles_index = profilesbox.currentIndex
 | 
			
		||||
                            appSettings.loadCurrentProfile();
 | 
			
		||||
                            appSettings.handleFontChanged();
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                    Button{
 | 
			
		||||
@@ -55,16 +55,16 @@ Tab{
 | 
			
		||||
                    Button{
 | 
			
		||||
                        Layout.fillWidth: true
 | 
			
		||||
                        text: qsTr("Remove Selected")
 | 
			
		||||
                        enabled: !shadersettings.profiles_list.get(profilesbox.currentIndex).builtin
 | 
			
		||||
                        enabled: !appSettings.profiles_list.get(profilesbox.currentIndex).builtin
 | 
			
		||||
                        onClicked: {
 | 
			
		||||
                            shadersettings.profiles_list.remove(profilesbox.currentIndex)
 | 
			
		||||
                            appSettings.profiles_list.remove(profilesbox.currentIndex)
 | 
			
		||||
                            profilesbox.currentIndex = profilesbox.currentIndex - 1
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
                InsertNameDialog{
 | 
			
		||||
                    id: insertname
 | 
			
		||||
                    onNameSelected: shadersettings.addNewCustomProfile(name)
 | 
			
		||||
                    onNameSelected: appSettings.addNewCustomProfile(name)
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
@@ -76,18 +76,18 @@ Tab{
 | 
			
		||||
                columns: 2
 | 
			
		||||
                Text{ text: qsTr("Brightness") }
 | 
			
		||||
                SimpleSlider{
 | 
			
		||||
                    onValueChanged: shadersettings.brightness = value
 | 
			
		||||
                    value: shadersettings.brightness
 | 
			
		||||
                    onValueChanged: appSettings.brightness = value
 | 
			
		||||
                    value: appSettings.brightness
 | 
			
		||||
                }
 | 
			
		||||
                Text{ text: qsTr("Contrast") }
 | 
			
		||||
                SimpleSlider{
 | 
			
		||||
                    onValueChanged: shadersettings.contrast = value
 | 
			
		||||
                    value: shadersettings.contrast
 | 
			
		||||
                    onValueChanged: appSettings.contrast = value
 | 
			
		||||
                    value: appSettings.contrast
 | 
			
		||||
                }
 | 
			
		||||
                Text{ text: qsTr("Opacity") }
 | 
			
		||||
                SimpleSlider{
 | 
			
		||||
                    onValueChanged: shadersettings.windowOpacity = value
 | 
			
		||||
                    value: shadersettings.windowOpacity
 | 
			
		||||
                    onValueChanged: appSettings.windowOpacity = value
 | 
			
		||||
                    value: appSettings.windowOpacity
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
@@ -99,9 +99,9 @@ Tab{
 | 
			
		||||
                ComboBox{
 | 
			
		||||
                    id: framescombobox
 | 
			
		||||
                    Layout.fillWidth: true
 | 
			
		||||
                    model: shadersettings.frames_list
 | 
			
		||||
                    currentIndex: shadersettings.frames_index
 | 
			
		||||
                    onCurrentIndexChanged: shadersettings.frames_index = currentIndex
 | 
			
		||||
                    model: appSettings.frames_list
 | 
			
		||||
                    currentIndex: appSettings.frames_index
 | 
			
		||||
                    onCurrentIndexChanged: appSettings.frames_index = currentIndex
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
@@ -36,8 +36,8 @@ Tab{
 | 
			
		||||
                columns: 3
 | 
			
		||||
                CheckBox{
 | 
			
		||||
                    property int fps: checked ? slider.value : 0
 | 
			
		||||
                    onFpsChanged: shadersettings.fps = fps
 | 
			
		||||
                    checked: shadersettings.fps !== 0
 | 
			
		||||
                    onFpsChanged: appSettings.fps = fps
 | 
			
		||||
                    checked: appSettings.fps !== 0
 | 
			
		||||
                    text: qsTr("Limit FPS")
 | 
			
		||||
                }
 | 
			
		||||
                Slider{
 | 
			
		||||
@@ -46,16 +46,16 @@ Tab{
 | 
			
		||||
                    stepSize: 1
 | 
			
		||||
                    maximumValue: 60
 | 
			
		||||
                    minimumValue: 1
 | 
			
		||||
                    enabled: shadersettings.fps !== 0
 | 
			
		||||
                    value: shadersettings.fps !== 0 ? shadersettings.fps : 60
 | 
			
		||||
                    enabled: appSettings.fps !== 0
 | 
			
		||||
                    value: appSettings.fps !== 0 ? appSettings.fps : 60
 | 
			
		||||
                }
 | 
			
		||||
                Text{text: slider.value}
 | 
			
		||||
                Text{text: qsTr("Texture Quality")}
 | 
			
		||||
                Slider{
 | 
			
		||||
                    Layout.fillWidth: true
 | 
			
		||||
                    id: txtslider
 | 
			
		||||
                    onValueChanged: shadersettings.window_scaling = value;
 | 
			
		||||
                    value: shadersettings.window_scaling
 | 
			
		||||
                    onValueChanged: appSettings.window_scaling = value;
 | 
			
		||||
                    value: appSettings.window_scaling
 | 
			
		||||
                    stepSize: 0.10
 | 
			
		||||
                    Component.onCompleted: minimumValue = 0.3 //Without this value gets set to 0.5
 | 
			
		||||
                }
 | 
			
		||||
@@ -79,7 +79,7 @@ Tab{
 | 
			
		||||
                    qsTr("High")
 | 
			
		||||
                ]
 | 
			
		||||
 | 
			
		||||
                onValsIndexChanged: shadersettings.scanline_quality = vals[valsIndex];
 | 
			
		||||
                onValsIndexChanged: appSettings.scanline_quality = vals[valsIndex];
 | 
			
		||||
 | 
			
		||||
                Text{text: qsTr("Scanlines Quality")}
 | 
			
		||||
                Slider{
 | 
			
		||||
@@ -90,12 +90,12 @@ Tab{
 | 
			
		||||
                    Component.onCompleted: {
 | 
			
		||||
                        minimumValue = 0;
 | 
			
		||||
                        maximumValue = 2;
 | 
			
		||||
                        value = parent.vals.indexOf(shadersettings.scanline_quality);
 | 
			
		||||
                        value = parent.vals.indexOf(appSettings.scanline_quality);
 | 
			
		||||
                    }
 | 
			
		||||
                    Connections{
 | 
			
		||||
                        target: shadersettings
 | 
			
		||||
                        target: appSettings
 | 
			
		||||
                        onScanline_qualityChanged:
 | 
			
		||||
                            scanlineQualityContainer.valsIndex = scanlineQualityContainer.vals.indexOf(shadersettings.scanline_quality);
 | 
			
		||||
                            scanlineQualityContainer.valsIndex = scanlineQualityContainer.vals.indexOf(appSettings.scanline_quality);
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
                Text{
 | 
			
		||||
@@ -120,7 +120,7 @@ Tab{
 | 
			
		||||
                    qsTr("High")
 | 
			
		||||
                ]
 | 
			
		||||
 | 
			
		||||
                onValsIndexChanged: shadersettings.bloom_quality = vals[valsIndex];
 | 
			
		||||
                onValsIndexChanged: appSettings.bloom_quality = vals[valsIndex];
 | 
			
		||||
 | 
			
		||||
                Text{text: qsTr("Bloom Quality")}
 | 
			
		||||
                Slider{
 | 
			
		||||
@@ -131,12 +131,12 @@ Tab{
 | 
			
		||||
                    Component.onCompleted: {
 | 
			
		||||
                        minimumValue = 0;
 | 
			
		||||
                        maximumValue = 2;
 | 
			
		||||
                        value = parent.vals.indexOf(shadersettings.bloom_quality);
 | 
			
		||||
                        value = parent.vals.indexOf(appSettings.bloom_quality);
 | 
			
		||||
                    }
 | 
			
		||||
                    Connections{
 | 
			
		||||
                        target: shadersettings
 | 
			
		||||
                        target: appSettings
 | 
			
		||||
                        onBloom_qualityChanged:
 | 
			
		||||
                            bloomQualityContainer.valsIndex = bloomQualityContainer.vals.indexOf(shadersettings.bloom_quality);
 | 
			
		||||
                            bloomQualityContainer.valsIndex = bloomQualityContainer.vals.indexOf(appSettings.bloom_quality);
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
                Text{
 | 
			
		||||
@@ -150,9 +150,9 @@ Tab{
 | 
			
		||||
            anchors.left: parent.left
 | 
			
		||||
            anchors.right: parent.right
 | 
			
		||||
            CheckBox{
 | 
			
		||||
                checked: shadersettings._frameReflections
 | 
			
		||||
                checked: appSettings._frameReflections
 | 
			
		||||
                text: qsTr("Frame Reflections")
 | 
			
		||||
                onCheckedChanged: shadersettings._frameReflections = checked
 | 
			
		||||
                onCheckedChanged: appSettings._frameReflections = checked
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -33,9 +33,9 @@ Tab{
 | 
			
		||||
                property string selectedElement: model[currentIndex]
 | 
			
		||||
                anchors.fill: parent
 | 
			
		||||
                model: [qsTr("Default"), qsTr("Scanlines"), qsTr("Pixels")]
 | 
			
		||||
                currentIndex: shadersettings.rasterization
 | 
			
		||||
                currentIndex: appSettings.rasterization
 | 
			
		||||
                onCurrentIndexChanged: {
 | 
			
		||||
                    shadersettings.rasterization = currentIndex
 | 
			
		||||
                    appSettings.rasterization = currentIndex
 | 
			
		||||
                    fontChanger.updateIndex();
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
@@ -50,14 +50,14 @@ Tab{
 | 
			
		||||
                ComboBox{
 | 
			
		||||
                    id: fontChanger
 | 
			
		||||
                    Layout.fillWidth: true
 | 
			
		||||
                    model: shadersettings.fontlist
 | 
			
		||||
                    model: appSettings.fontlist
 | 
			
		||||
                    currentIndex: updateIndex()
 | 
			
		||||
                    onActivated: {
 | 
			
		||||
                        shadersettings.fontIndexes[shadersettings.rasterization] = index;
 | 
			
		||||
                        shadersettings.handleFontChanged();
 | 
			
		||||
                        appSettings.fontIndexes[appSettings.rasterization] = index;
 | 
			
		||||
                        appSettings.handleFontChanged();
 | 
			
		||||
                    }
 | 
			
		||||
                    function updateIndex(){
 | 
			
		||||
                        currentIndex = shadersettings.fontIndexes[shadersettings.rasterization];
 | 
			
		||||
                        currentIndex = appSettings.fontIndexes[appSettings.rasterization];
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
                Text{ text: qsTr("Scaling") }
 | 
			
		||||
@@ -66,18 +66,18 @@ Tab{
 | 
			
		||||
                    Slider{
 | 
			
		||||
                        Layout.fillWidth: true
 | 
			
		||||
                        id: fontScalingChanger
 | 
			
		||||
                        onValueChanged: if(enabled) shadersettings.fontScaling = value
 | 
			
		||||
                        onValueChanged: if(enabled) appSettings.fontScaling = value
 | 
			
		||||
                        stepSize: 0.05
 | 
			
		||||
                        enabled: false // Another trick to fix initial bad behavior.
 | 
			
		||||
                        Component.onCompleted: {
 | 
			
		||||
                            minimumValue = 0.5;
 | 
			
		||||
                            maximumValue = 2.5;
 | 
			
		||||
                            value = shadersettings.fontScaling;
 | 
			
		||||
                            value = appSettings.fontScaling;
 | 
			
		||||
                            enabled = true;
 | 
			
		||||
                        }
 | 
			
		||||
                        Connections{
 | 
			
		||||
                            target: shadersettings
 | 
			
		||||
                            onFontScalingChanged: fontScalingChanger.value = shadersettings.fontScaling;
 | 
			
		||||
                            target: appSettings
 | 
			
		||||
                            onFontScalingChanged: fontScalingChanger.value = appSettings.fontScaling;
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                    Text{
 | 
			
		||||
@@ -90,8 +90,8 @@ Tab{
 | 
			
		||||
                    Slider{
 | 
			
		||||
                        Layout.fillWidth: true
 | 
			
		||||
                        id: widthChanger
 | 
			
		||||
                        onValueChanged: shadersettings.fontWidth = value;
 | 
			
		||||
                        value: shadersettings.fontWidth
 | 
			
		||||
                        onValueChanged: appSettings.fontWidth = value;
 | 
			
		||||
                        value: appSettings.fontWidth
 | 
			
		||||
                        stepSize: 0.05
 | 
			
		||||
                        Component.onCompleted: minimumValue = 0.5 //Without this value gets set to 0.5
 | 
			
		||||
                    }
 | 
			
		||||
@@ -112,29 +112,29 @@ Tab{
 | 
			
		||||
                        name: qsTr("Font")
 | 
			
		||||
                        height: 50
 | 
			
		||||
                        Layout.fillWidth: true
 | 
			
		||||
                        onColorSelected: shadersettings._font_color = color;
 | 
			
		||||
                        button_color: shadersettings._font_color
 | 
			
		||||
                        onColorSelected: appSettings._font_color = color;
 | 
			
		||||
                        button_color: appSettings._font_color
 | 
			
		||||
                    }
 | 
			
		||||
                    ColorButton{
 | 
			
		||||
                        name: qsTr("Background")
 | 
			
		||||
                        height: 50
 | 
			
		||||
                        Layout.fillWidth: true
 | 
			
		||||
                        onColorSelected: shadersettings._background_color = color;
 | 
			
		||||
                        button_color: shadersettings._background_color
 | 
			
		||||
                        onColorSelected: appSettings._background_color = color;
 | 
			
		||||
                        button_color: appSettings._background_color
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
                ColumnLayout{
 | 
			
		||||
                    Layout.fillWidth: true
 | 
			
		||||
                    CheckableSlider{
 | 
			
		||||
                        name: qsTr("Chroma Color")
 | 
			
		||||
                        onNewValue: shadersettings.chroma_color = newValue
 | 
			
		||||
                        value: shadersettings.chroma_color
 | 
			
		||||
                        onNewValue: appSettings.chroma_color = newValue
 | 
			
		||||
                        value: appSettings.chroma_color
 | 
			
		||||
                    }
 | 
			
		||||
                    CheckableSlider{
 | 
			
		||||
                        name: qsTr("Saturation Color")
 | 
			
		||||
                        onNewValue: shadersettings.saturation_color = newValue
 | 
			
		||||
                        value: shadersettings.saturation_color
 | 
			
		||||
                        enabled: shadersettings.chroma_color !== 0
 | 
			
		||||
                        onNewValue: appSettings.saturation_color = newValue
 | 
			
		||||
                        value: appSettings.saturation_color
 | 
			
		||||
                        enabled: appSettings.chroma_color !== 0
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 
 | 
			
		||||
@@ -28,31 +28,31 @@ ShaderEffect {
 | 
			
		||||
    property ShaderEffectSource noiseSource
 | 
			
		||||
    property ShaderEffectSource bloomSource
 | 
			
		||||
 | 
			
		||||
    property color font_color: shadersettings.font_color
 | 
			
		||||
    property color background_color: shadersettings.background_color
 | 
			
		||||
    property real bloom_strength: shadersettings.bloom_strength * 2.5
 | 
			
		||||
    property color font_color: appSettings.font_color
 | 
			
		||||
    property color background_color: appSettings.background_color
 | 
			
		||||
    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 screen_distorsion: shadersettings.screen_distortion
 | 
			
		||||
    property real glowing_line_strength: shadersettings.glowing_line_strength
 | 
			
		||||
    property real noise_strength: appSettings.noise_strength
 | 
			
		||||
    property real screen_distorsion: appSettings.screen_distortion
 | 
			
		||||
    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 horizontal_sincronization: shadersettings.horizontal_sincronization
 | 
			
		||||
    property real brightness_flickering: appSettings.brightness_flickering
 | 
			
		||||
    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_bottom: (frame.item.displacementBottom * shadersettings.window_scaling) / height
 | 
			
		||||
    property real disp_left: (frame.item.displacementLeft * shadersettings.window_scaling) / width
 | 
			
		||||
    property real disp_right: (frame.item.displacementRight * shadersettings.window_scaling) / width
 | 
			
		||||
    property real disp_top: (frame.item.displacementTop * appSettings.window_scaling) / height
 | 
			
		||||
    property real disp_bottom: (frame.item.displacementBottom * appSettings.window_scaling) / height
 | 
			
		||||
    property real disp_left: (frame.item.displacementLeft * appSettings.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{
 | 
			
		||||
        id: timeManager
 | 
			
		||||
 
 | 
			
		||||
@@ -6,7 +6,7 @@ ShaderTerminal{
 | 
			
		||||
    property alias terminalSize: terminal.terminalSize
 | 
			
		||||
 | 
			
		||||
    id: mainShader
 | 
			
		||||
    opacity: shadersettings.windowOpacity * 0.3 + 0.7
 | 
			
		||||
    opacity: appSettings.windowOpacity * 0.3 + 0.7
 | 
			
		||||
 | 
			
		||||
    blending: false
 | 
			
		||||
 | 
			
		||||
@@ -14,7 +14,7 @@ ShaderTerminal{
 | 
			
		||||
        id: frame
 | 
			
		||||
        anchors.fill: parent
 | 
			
		||||
        z: 2.1
 | 
			
		||||
        source: shadersettings.frame_source
 | 
			
		||||
        source: appSettings.frame_source
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    PreprocessedTerminal{
 | 
			
		||||
@@ -27,9 +27,9 @@ ShaderTerminal{
 | 
			
		||||
    //  EFFECTS  ////////////////////////////////////////////////////////////////
 | 
			
		||||
 | 
			
		||||
    Loader{
 | 
			
		||||
        property real scaling: shadersettings.bloom_quality * shadersettings.window_scaling
 | 
			
		||||
        property real scaling: appSettings.bloom_quality * appSettings.window_scaling
 | 
			
		||||
        id: bloomEffectLoader
 | 
			
		||||
        active: shadersettings.bloom_strength
 | 
			
		||||
        active: appSettings.bloom_strength
 | 
			
		||||
        asynchronous: true
 | 
			
		||||
        width: parent.width * scaling
 | 
			
		||||
        height: parent.height * scaling
 | 
			
		||||
@@ -41,7 +41,7 @@ ShaderTerminal{
 | 
			
		||||
    }
 | 
			
		||||
    Loader{
 | 
			
		||||
        id: bloomSourceLoader
 | 
			
		||||
        active: shadersettings.bloom_strength !== 0
 | 
			
		||||
        active: appSettings.bloom_strength !== 0
 | 
			
		||||
        asynchronous: true
 | 
			
		||||
        sourceComponent: ShaderEffectSource{
 | 
			
		||||
            id: _bloomEffectSource
 | 
			
		||||
@@ -57,7 +57,7 @@ ShaderTerminal{
 | 
			
		||||
    ShaderEffect {
 | 
			
		||||
        id: staticNoiseEffect
 | 
			
		||||
        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 __terminalWidth: terminal.virtualResolution.width
 | 
			
		||||
        property size virtual_resolution: Qt.size(__terminalWidth / element_size, __terminalHeight / element_size)
 | 
			
		||||
@@ -112,8 +112,8 @@ ShaderTerminal{
 | 
			
		||||
        width: parent.width
 | 
			
		||||
        height: parent.height
 | 
			
		||||
        property real outColor: 0.0
 | 
			
		||||
        property real dispX: (5 / width) * shadersettings.window_scaling
 | 
			
		||||
        property real dispY: 5 / height * shadersettings.window_scaling
 | 
			
		||||
        property real dispX: (5 / width) * appSettings.window_scaling
 | 
			
		||||
        property real dispY: 5 / height * appSettings.window_scaling
 | 
			
		||||
        property size virtual_resolution: terminal.virtualResolution
 | 
			
		||||
 | 
			
		||||
        blending: false
 | 
			
		||||
@@ -130,9 +130,9 @@ ShaderTerminal{
 | 
			
		||||
             highp float getScanlineIntensity(vec2 coords) {
 | 
			
		||||
                 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+"));" : "") +
 | 
			
		||||
                (shadersettings.rasterization == shadersettings.pixel_rasterization ?
 | 
			
		||||
                (appSettings.rasterization == appSettings.pixel_rasterization ?
 | 
			
		||||
                    "result *= abs(sin(coords.x * virtual_resolution.x * "+Math.PI+"));" : "") + "
 | 
			
		||||
 | 
			
		||||
                return result;
 | 
			
		||||
 
 | 
			
		||||
@@ -27,13 +27,13 @@ Timer{
 | 
			
		||||
    NumberAnimation on time {
 | 
			
		||||
        from: 0
 | 
			
		||||
        to: 100000
 | 
			
		||||
        running: shadersettings.fps === 0 && enableTimer
 | 
			
		||||
        running: appSettings.fps === 0 && enableTimer
 | 
			
		||||
        duration: 100000
 | 
			
		||||
        loops: Animation.Infinite
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    onTriggered: time += interval
 | 
			
		||||
    running: shadersettings.fps !== 0 && enableTimer
 | 
			
		||||
    interval: Math.round(1000 / shadersettings.fps)
 | 
			
		||||
    running: appSettings.fps !== 0 && enableTimer
 | 
			
		||||
    interval: Math.round(1000 / appSettings.fps)
 | 
			
		||||
    repeat: true
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -4,16 +4,16 @@ import QtGraphicalEffects 1.0
 | 
			
		||||
ShaderEffect{
 | 
			
		||||
    property variant source: framesource
 | 
			
		||||
    property variant normals: framesourcenormals
 | 
			
		||||
    property real screen_distorsion: shadersettings.screen_distortion * framecontainer.distortionCoefficient
 | 
			
		||||
    property real ambient_light: shadersettings.ambient_light
 | 
			
		||||
    property color font_color: shadersettings.font_color
 | 
			
		||||
    property color background_color: shadersettings.background_color
 | 
			
		||||
    property real brightness: shadersettings.brightness * 1.5 + 0.5
 | 
			
		||||
    property real screen_distorsion: appSettings.screen_distortion * framecontainer.distortionCoefficient
 | 
			
		||||
    property real ambient_light: appSettings.ambient_light
 | 
			
		||||
    property color font_color: appSettings.font_color
 | 
			
		||||
    property color background_color: appSettings.background_color
 | 
			
		||||
    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 real chroma_color: shadersettings.chroma_color
 | 
			
		||||
    property real chroma_color: appSettings.chroma_color
 | 
			
		||||
 | 
			
		||||
    Loader{
 | 
			
		||||
        id: reflectionEffectLoader
 | 
			
		||||
 
 | 
			
		||||
@@ -33,13 +33,13 @@ ApplicationWindow{
 | 
			
		||||
 | 
			
		||||
    visible: true
 | 
			
		||||
 | 
			
		||||
    property bool fullscreen: shadersettings.fullscreen
 | 
			
		||||
    property bool fullscreen: appSettings.fullscreen
 | 
			
		||||
    onFullscreenChanged: visibility = (fullscreen ? Window.FullScreen : Window.Windowed)
 | 
			
		||||
 | 
			
		||||
    //Workaround: if menubar is assigned ugly margins are visible.
 | 
			
		||||
    menuBar: Qt.platform.os === "osx"
 | 
			
		||||
                ? defaultMenuBar
 | 
			
		||||
                : shadersettings.showMenubar ? defaultMenuBar : null
 | 
			
		||||
                : appSettings.showMenubar ? defaultMenuBar : null
 | 
			
		||||
 | 
			
		||||
    color: "#00000000"
 | 
			
		||||
    title: terminalContainer.title || qsTr("cool-retro-term")
 | 
			
		||||
@@ -50,17 +50,17 @@ ApplicationWindow{
 | 
			
		||||
        enabled: Qt.platform.os !== "osx"
 | 
			
		||||
        shortcut: "Ctrl+Shift+M"
 | 
			
		||||
        checkable: true
 | 
			
		||||
        checked: shadersettings.showMenubar
 | 
			
		||||
        onTriggered: shadersettings.showMenubar = !shadersettings.showMenubar
 | 
			
		||||
        checked: appSettings.showMenubar
 | 
			
		||||
        onTriggered: appSettings.showMenubar = !appSettings.showMenubar
 | 
			
		||||
    }
 | 
			
		||||
    Action {
 | 
			
		||||
        id: fullscreenAction
 | 
			
		||||
        text: qsTr("Fullscreen")
 | 
			
		||||
        enabled: Qt.platform.os !== "osx"
 | 
			
		||||
        shortcut: "Alt+F11"
 | 
			
		||||
        onTriggered: shadersettings.fullscreen = !shadersettings.fullscreen;
 | 
			
		||||
        onTriggered: appSettings.fullscreen = !appSettings.fullscreen;
 | 
			
		||||
        checkable: true
 | 
			
		||||
        checked: shadersettings.fullscreen
 | 
			
		||||
        checked: appSettings.fullscreen
 | 
			
		||||
    }
 | 
			
		||||
    Action {
 | 
			
		||||
        id: quitAction
 | 
			
		||||
@@ -87,13 +87,13 @@ ApplicationWindow{
 | 
			
		||||
        id: zoomIn
 | 
			
		||||
        text: qsTr("Zoom In")
 | 
			
		||||
        shortcut: "Ctrl++"
 | 
			
		||||
        onTriggered: shadersettings.incrementScaling();
 | 
			
		||||
        onTriggered: appSettings.incrementScaling();
 | 
			
		||||
    }
 | 
			
		||||
    Action{
 | 
			
		||||
        id: zoomOut
 | 
			
		||||
        text: qsTr("Zoom Out")
 | 
			
		||||
        shortcut: "Ctrl+-"
 | 
			
		||||
        onTriggered: shadersettings.decrementScaling();
 | 
			
		||||
        onTriggered: appSettings.decrementScaling();
 | 
			
		||||
    }
 | 
			
		||||
    Action{
 | 
			
		||||
        id: showAboutAction
 | 
			
		||||
@@ -106,16 +106,16 @@ ApplicationWindow{
 | 
			
		||||
        id: defaultMenuBar
 | 
			
		||||
    }
 | 
			
		||||
    ApplicationSettings{
 | 
			
		||||
        id: shadersettings
 | 
			
		||||
        id: appSettings
 | 
			
		||||
    }
 | 
			
		||||
    TerminalContainer{
 | 
			
		||||
        id: terminalContainer
 | 
			
		||||
        width: parent.width * shadersettings.window_scaling
 | 
			
		||||
        height: parent.height * shadersettings.window_scaling
 | 
			
		||||
        width: parent.width * appSettings.window_scaling
 | 
			
		||||
        height: parent.height * appSettings.window_scaling
 | 
			
		||||
 | 
			
		||||
        transform: Scale {
 | 
			
		||||
            xScale: 1 / shadersettings.window_scaling
 | 
			
		||||
            yScale: 1 / shadersettings.window_scaling
 | 
			
		||||
            xScale: 1 / appSettings.window_scaling
 | 
			
		||||
            yScale: 1 / appSettings.window_scaling
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    SettingsWindow{
 | 
			
		||||
@@ -128,11 +128,11 @@ ApplicationWindow{
 | 
			
		||||
    }
 | 
			
		||||
    Loader{
 | 
			
		||||
        anchors.centerIn: parent
 | 
			
		||||
        active: shadersettings.show_terminal_size
 | 
			
		||||
        active: appSettings.show_terminal_size
 | 
			
		||||
        sourceComponent: SizeOverlay{
 | 
			
		||||
            z: 3
 | 
			
		||||
            terminalSize: terminalContainer.terminalSize
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    Component.onCompleted: shadersettings.handleFontChanged();
 | 
			
		||||
    Component.onCompleted: appSettings.handleFontChanged();
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user