added settings

This commit is contained in:
Filippo Scognamiglio 2013-11-25 19:05:31 +01:00
parent f73e160a99
commit 3f41a9f2fc
3 changed files with 156 additions and 5 deletions

View File

@ -19,4 +19,6 @@ OTHER_FILES += \
$$PWD/qml/cool-old-term/TerminalScreen.qml \
$$PWD/qml/cool-old-term/TerminalText.qml \
$$PWD/qml/cool-old-term/HighlightArea.qml \
qml/cool-old-term/ShaderSettings.qml
$$PWD/qml/cool-old-term/ShaderSettings.qml \
$$PWD/qml/images/frame.png \
qml/cool-old-term/SettingsWindow.qml

View File

@ -0,0 +1,134 @@
import QtQuick 2.1
import QtQuick.Controls 1.0
import QtQuick.Window 2.1
import QtQuick.Layouts 1.0
ApplicationWindow {
title: qsTr("Settings")
width: 640
height: 480
visible: true
modality: Qt.ApplicationModal
TabView{
anchors.fill: parent
Tab{
title: qsTr("Settings")
anchors.fill: parent
ColumnLayout{
anchors.fill: parent
GridLayout{
width: parent.width
columns: 2
Text{text: "Font color"}
Text{text: " ";
Rectangle{anchors.fill: parent; color: shadersettings.font_color}
MouseArea{anchors.fill: parent}
}
Text{text: "Backgroud color"}
Text{text: " "; Rectangle{anchors.fill: parent; color: shadersettings.background_color}}
}
GridLayout{
columns: 4
CheckBox{
id: noisecheck
onCheckedChanged:
if(checked) shadersettings.noise_strength = noiseslider.value;
else shadersettings.noise_strength = 0;
Component.onCompleted: checked = shadersettings.noise_strength !== 0;
}
Text{
text: qsTr("Noise")
}
Slider{
id: noiseslider
stepSize: 0.01
minimumValue: 0.0
maximumValue: 1.0
onValueChanged: shadersettings.noise_strength = value;
Component.onCompleted: value = shadersettings.noise_strength;
}
TextArea{
text: noiseslider.value.toFixed(2);
enabled: false
}
CheckBox{
id: glowcheck
onCheckedChanged:
if(checked) shadersettings.glowing_line_strength = glowslider.value;
else shadersettings.glowing_line_strength = 0;
Component.onCompleted: checked = shadersettings.glowing_line_strength !== 0;
}
Text{
text: qsTr("Glow")
}
Slider{
id: glowslider
stepSize: 0.01
minimumValue: 0.0
maximumValue: 1.0
onValueChanged: shadersettings.glowing_line_strength = value;
Component.onCompleted: value = shadersettings.glowing_line_strength;
}
TextArea{
text: glowslider.value.toFixed(2);
enabled: false
}
CheckBox{
id: ambientcheck
onCheckedChanged:
if(checked) shadersettings.ambient_light = ambientslider.value;
else shadersettings.ambient_light = 0;
Component.onCompleted: checked = shadersettings.ambient_light !== 0;
}
Text{
text: qsTr("Ambient light")
}
Slider{
id: ambientslider
stepSize: 0.01
minimumValue: 0.1
maximumValue: 0.5
onValueChanged: shadersettings.ambient_light = value;
Component.onCompleted: value = shadersettings.ambient_light;
}
TextArea{
text: ambientslider.value.toFixed(2);
enabled: false
}
// CheckBox{
// id: distortioncheck
// onCheckedChanged:
// if(checked) shadersettings.screen_distortion = distortionslider.value;
// else shadersettings.screen_distortion = 0;
// Component.onCompleted: checked = shadersettings.screen_distortion !== 0;
// }
// Text{
// text: qsTr("Distortion")
// }
// Slider{
// id: distortionslider
// stepSize: 0.01
// minimumValue: 0.0
// maximumValue: 1.0
// onValueChanged: shadersettings.screen_distortion = value;
// Component.onCompleted: value = shadersettings.screen_distortion;
// }
// TextArea{
// text: distortionslider.value.toFixed(2);
// enabled: false
// }
}
}
}
}
}

View File

@ -38,10 +38,21 @@ ApplicationWindow{
menuBar: MenuBar {
Menu {
title: "File"
MenuItem { text: "Open..." }
MenuItem { text: "Close" }
title: qsTr("File")
MenuItem { text: "Close"; onTriggered: mainwindow.close()}
}
Menu {
title: qsTr("Edit")
MenuItem {
text: qsTr("Settings")
onTriggered: {
var component = Qt.createComponent("SettingsWindow.qml");
component.createObject(mainwindow);
component.show();
}
}
}
}
@ -71,6 +82,8 @@ ApplicationWindow{
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 brightness: 1.0
property real deltay: 1.0 / terminal.height
property real deltax: 1.0 / terminal.width
//property real faulty_screen_prob: shadersettings.faulty_screen_prob
@ -92,9 +105,11 @@ ApplicationWindow{
uniform highp vec4 font_color;
uniform highp vec4 background_color;
uniform highp float noise_strength;
uniform highp float screen_distorsion;
uniform highp float glowing_line_strength;
uniform highp float deltax;
uniform highp float deltay;
@ -162,7 +177,7 @@ ApplicationWindow{
Image{
id: frame
source: "/home/swordfish/Pictures/frame.png"
source: "../images/frame.png"
anchors.centerIn: parent
width: parent.width * 1.05
height: parent.height * 1.05