diff --git a/app/SettingsWindow.qml b/app/SettingsWindow.qml index 7b12502..f63c76f 100644 --- a/app/SettingsWindow.qml +++ b/app/SettingsWindow.qml @@ -28,7 +28,7 @@ Window { id: settings_window title: qsTr("Settings") width: 640 - height: 460 + height: 480 modality: Qt.ApplicationModal @@ -147,17 +147,6 @@ Window { onValueChanged: shadersettings.brightness = value value: shadersettings.brightness } - //TODO decide later what to do with scaling - // SimpleSlider{ - // name: "Terminal Scaling" - // onValueChanged: shadersettings.terminal_scaling = value - // value: shadersettings.terminal_scaling - // } - // SimpleSlider{ - // name: "Window Scaling" - // onValueChanged: shadersettings.window_scaling = value - // value: shadersettings.window_scaling - // } } } GroupBox{ @@ -166,10 +155,10 @@ Window { Layout.columnSpan: 2 anchors.left: parent.left anchors.right: parent.right - RowLayout{ + GridLayout{ + columns: 3 Layout.columnSpan: 2 - anchors.left: parent.left - anchors.right: parent.right + anchors {left: parent.left; right: parent.right} Text{text: "Animation FPS"} Slider{ Layout.fillWidth: true @@ -180,10 +169,19 @@ Window { onValueChanged: shadersettings.fps = value; value: shadersettings.fps } - Text{ - id: textfield - text: slider.value + Text{text: slider.value} + Text{text: "Texture quality"} + Slider{ + Layout.fillWidth: true + id: txtslider + stepSize: 0.01 + maximumValue: 1 + minimumValue: 0 + onValueChanged: shadersettings.window_scaling = value; + value: shadersettings.window_scaling + updateValueWhileDragging: false } + Text{text: Math.round(txtslider.value * 100) + "%"} } } } diff --git a/app/ShaderManager.qml b/app/ShaderManager.qml index 28ec48b..99aa82f 100644 --- a/app/ShaderManager.qml +++ b/app/ShaderManager.qml @@ -41,10 +41,11 @@ ShaderEffect { property real horizontal_sincronization: shadersettings.horizontal_sincronization property bool frame_reflection_strength: shadersettings.frame_reflection_strength - property real disp_top: frame.item.displacementTop.toFixed(1) - property real disp_bottom: frame.item.displacementBottom - property real disp_left: frame.item.displacementLeft - property real disp_right: frame.item.displacementRight + + property real disp_top: frame.item.displacementTop * shadersettings.window_scaling + property real disp_bottom: frame.item.displacementBottom * shadersettings.window_scaling + property real disp_left: frame.item.displacementLeft * shadersettings.window_scaling + property real disp_right: frame.item.displacementRight * shadersettings.window_scaling property real brightness: shadersettings.brightness * 1.5 + 0.5 diff --git a/app/ShaderSettings.qml b/app/ShaderSettings.qml index 195ae6f..3d708a5 100644 --- a/app/ShaderSettings.qml +++ b/app/ShaderSettings.qml @@ -27,15 +27,11 @@ Item{ property real contrast: 0.85 property real brightness: 0.75 + //On resize shows an overlay with the current size property bool show_terminal_size: true - //Scaling of the preprocessed terminal with respect to the window. - property real terminal_scaling: 1.0 - onTerminal_scalingChanged: handleFontChanged(); - - //Scaling of the whole window property real window_scaling: 1.0 - property real total_scaling: terminal_scaling * window_scaling + onWindow_scalingChanged: handleFontChanged(); property real fps: 60 @@ -172,6 +168,7 @@ Item{ show_terminal_size = settings.show_terminal_size ? settings.show_terminal_size : show_terminal_size fps = settings.fps !== undefined ? settings.fps: fps + window_scaling = settings.window_scaling ? settings.window_scaling : window_scaling contrast = settings.contrast !== undefined ? settings.contrast : contrast; brightness = settings.brightness !== undefined ? settings.brightness : brightness @@ -201,6 +198,7 @@ Item{ function storeCurrentSettings(){ var settings = { fps: fps, + window_scaling: window_scaling, show_terminal_size: show_terminal_size, ambient_light: ambient_light, brightness: brightness, diff --git a/app/Terminal.qml b/app/Terminal.qml index 08f5508..7e83e03 100644 --- a/app/Terminal.qml +++ b/app/Terminal.qml @@ -85,7 +85,7 @@ Item{ onUpdatedImage: {blurredSource.live = true;livetimer.restart();} Component.onCompleted: { - var scaling_factor = shadersettings.font_scaling * shadersettings.terminal_scaling * shadersettings.window_scaling; + var scaling_factor = shadersettings.font_scaling * shadersettings.window_scaling; font.pointSize = shadersettings.font.pixelSize * scaling_factor; font.family = shadersettings.font.name; setLineSpacing(shadersettings.font.lineSpacing); @@ -160,6 +160,9 @@ Item{ recursive: true live: true + smooth: false + antialiasing: false + Timer{ id: livetimer running: true diff --git a/app/frames/BlackRoughFrame.qml b/app/frames/BlackRoughFrame.qml index b8697dd..7bc688a 100644 --- a/app/frames/BlackRoughFrame.qml +++ b/app/frames/BlackRoughFrame.qml @@ -13,10 +13,9 @@ TerminalFrame{ borderBottom: 232 imageSource: "../images/black-frame.png" normalsSource: "../images/black-frame-normals.png" - sourceRect: Qt.rect(-20 * shadersettings.total_scaling, - -20 * shadersettings.total_scaling, - terminal.width + 40 * shadersettings.total_scaling, - terminal.height + 40 * shadersettings.total_scaling) + + rectX: 20 + rectY: 20 distortionCoefficient: 1.9 diff --git a/app/frames/WhiteSimpleFrame.qml b/app/frames/WhiteSimpleFrame.qml index 257a746..207e869 100644 --- a/app/frames/WhiteSimpleFrame.qml +++ b/app/frames/WhiteSimpleFrame.qml @@ -13,10 +13,9 @@ TerminalFrame{ borderBottom: 116 imageSource: "../images/screen-frame.png" normalsSource: "../images/screen-frame-normals.png" - sourceRect: Qt.rect(-15 * shadersettings.total_scaling, - -15 * shadersettings.total_scaling, - terminal.width + 30 * shadersettings.total_scaling, - terminal.height+ 30 * shadersettings.total_scaling) + + rectX: 15 + rectY: 15 distortionCoefficient: 1.5 diff --git a/app/frames/utils/TerminalFrame.qml b/app/frames/utils/TerminalFrame.qml index 9f97585..3735bc4 100644 --- a/app/frames/utils/TerminalFrame.qml +++ b/app/frames/utils/TerminalFrame.qml @@ -13,6 +13,10 @@ Item{ property rect sourceRect property string shaderString + //Value used to create the rect used to add the border to the texture + property real rectX + property real rectY + //Values used to displace the texture in the screen. Used to make reflections correct. property real displacementLeft property real displacementTop diff --git a/app/main.qml b/app/main.qml index 8fd0b31..a00f6ee 100644 --- a/app/main.qml +++ b/app/main.qml @@ -90,7 +90,10 @@ ApplicationWindow{ Loader{ id: frame - property rect sourceRect: item.sourceRect + property rect sourceRect: Qt.rect(-item.rectX * shadersettings.window_scaling, + -item.rectY * shadersettings.window_scaling, + terminal.width + 2*item.rectX * shadersettings.window_scaling, + terminal.height + 2*item.rectY * shadersettings.window_scaling) anchors.fill: parent z: 2.1 source: shadersettings.frame_source @@ -133,8 +136,8 @@ ApplicationWindow{ anchors.centerIn: parent property int frameOffsetX: frame.item.addedWidth - frame.item.borderLeft - frame.item.borderRight property int frameOffsetY: frame.item.addedHeight - frame.item.borderTop - frame.item.borderBottom - width: (parent.width + frameOffsetX) * shadersettings.terminal_scaling - height: (parent.height + frameOffsetY) * shadersettings.terminal_scaling + width: parent.width + frameOffsetX * shadersettings.window_scaling + height: parent.height + frameOffsetY * shadersettings.window_scaling } ShaderEffectSource{ id: theSource @@ -146,15 +149,6 @@ ApplicationWindow{ anchors.fill: parent z: 1.9 } - Loader{ - id: sizeoverlayloader - z: 3 - anchors.centerIn: parent - active: shadersettings.show_terminal_size - sourceComponent: SizeOverlay{ - terminalSize: terminal.terminalSize - } - } } ShaderSettings{ id: shadersettings @@ -166,4 +160,13 @@ ApplicationWindow{ id: settingswindow visible: false } + Loader{ + id: sizeoverlayloader + z: 3 + anchors.centerIn: parent + active: shadersettings.show_terminal_size + sourceComponent: SizeOverlay{ + terminalSize: terminal.terminalSize + } + } }