Frames now follow the window scaling.

This commit is contained in:
Filippo Scognamiglio 2014-07-09 19:03:02 +02:00
parent ef3303134d
commit 7dead18a56
5 changed files with 36 additions and 21 deletions

View File

@ -107,12 +107,12 @@ Item{
? virtualCharSize ? virtualCharSize
: Qt.size(paintedSize.width / 2, paintedSize.height / 2); : Qt.size(paintedSize.width / 2, paintedSize.height / 2);
var virtualPxSize = Qt.size(paintedSize.width / charSize.width, var virtualPxSize = Qt.size((paintedSize.width / charSize.width) * shadersettings.window_scaling,
paintedSize.height / charSize.height) (paintedSize.height / charSize.height) * shadersettings.window_scaling)
terminalContainer.virtualPxSize = virtualPxSize; terminalContainer.virtualPxSize = virtualPxSize;
setLineSpacing(lineSpacing); setLineSpacing(lineSpacing * shadersettings.window_scaling);
restartBlurredSource(); restartBlurredSource();
} }
Component.onCompleted: { Component.onCompleted: {

View File

@ -128,11 +128,12 @@ Tab{
Slider{ Slider{
Layout.fillWidth: true Layout.fillWidth: true
id: txtslider id: txtslider
stepSize: 0.01 stepSize: 0.25
maximumValue: 1 maximumValue: 1
minimumValue: 0 minimumValue: 0.50
onValueChanged: shadersettings.window_scaling = value; onValueChanged: shadersettings.window_scaling = value;
value: shadersettings.window_scaling value: shadersettings.window_scaling
tickmarksEnabled: true
} }
Text{text: Math.round(txtslider.value * 100) + "%"} Text{text: Math.round(txtslider.value * 100) + "%"}
} }

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject> <!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 3.0.1, 2014-07-09T00:22:58. --> <!-- Written by QtCreator 3.0.1, 2014-07-10T23:48:14. -->
<qtcreator> <qtcreator>
<data> <data>
<variable>ProjectExplorer.Project.ActiveTarget</variable> <variable>ProjectExplorer.Project.ActiveTarget</variable>

View File

@ -2,6 +2,9 @@ import QtQuick 2.2
Item{ Item{
id: framecontainer id: framecontainer
property int textureWidth
property int textureHeight
property int addedWidth property int addedWidth
property int addedHeight property int addedHeight
property int borderLeft property int borderLeft
@ -28,8 +31,8 @@ Item{
BorderImage{ BorderImage{
id: frameimage id: frameimage
anchors.centerIn: parent anchors.centerIn: parent
width: parent.width + addedWidth width: textureWidth + addedWidth
height: parent.height + addedHeight height: textureHeight + addedHeight
border.bottom: borderBottom border.bottom: borderBottom
border.top: borderTop border.top: borderTop
@ -57,14 +60,18 @@ Item{
id: framesource id: framesource
sourceItem: frameimage sourceItem: frameimage
hideSource: true hideSource: true
textureSize: Qt.size(parent.width, parent.height)
} }
ShaderEffectSource{ ShaderEffectSource{
id: framesourcenormals id: framesourcenormals
sourceItem: framenormals sourceItem: framenormals
hideSource: true hideSource: true
textureSize: Qt.size(parent.width, parent.height)
} }
Loader{ Loader{
anchors.fill: frameimage anchors.centerIn: parent
width: parent.width + (addedWidth / textureWidth) * parent.width
height: parent.height + (addedHeight / textureHeight) * parent.height
source: shaderString source: shaderString
} }
} }

View File

@ -95,24 +95,31 @@ ApplicationWindow{
id: shadersettings id: shadersettings
} }
Loader{
id: frame
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
opacity: 1.0
}
Item{ Item{
id: maincontainer id: maincontainer
anchors.centerIn: parent anchors.centerIn: parent
width: parent.width * shadersettings.window_scaling width: parent.width * shadersettings.window_scaling
height: parent.height * shadersettings.window_scaling height: parent.height * shadersettings.window_scaling
scale: 1.0 / shadersettings.window_scaling scale: 1.0 / shadersettings.window_scaling
smooth: false
antialiasing: false
Loader{
id: frame
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
opacity: 1.0
onLoaded: {
item.textureWidth = Qt.binding(function() { return terminalWindow.width;})
item.textureHeight = Qt.binding(function () {return terminalWindow.height;})
console.log(terminalWindow.width);
}
}
Image{ Image{
id: randtexture id: randtexture
source: "frames/images/randfunction.png" source: "frames/images/randfunction.png"