Some fixes in the settings.

This commit is contained in:
Filippo Scognamiglio 2014-07-16 00:38:16 +02:00
parent 239a1e0a30
commit 1ca30accf2
6 changed files with 39 additions and 32 deletions

View File

@ -156,13 +156,9 @@ Item{
fps: fps, fps: fps,
window_scaling: window_scaling, window_scaling: window_scaling,
show_terminal_size: show_terminal_size, show_terminal_size: show_terminal_size,
brightness: brightness,
contrast: contrast,
ambient_light: ambient_light,
fontScalingIndexes: fontScalingIndexes, fontScalingIndexes: fontScalingIndexes,
fontIndexes: fontIndexes, fontIndexes: fontIndexes,
frameReflections: _frameReflections, frameReflections: _frameReflections,
windowOpacity: windowOpacity
} }
return JSON.stringify(settings); return JSON.stringify(settings);
} }
@ -181,6 +177,10 @@ Item{
bloom_strength: bloom_strength, bloom_strength: bloom_strength,
rasterization: rasterization, rasterization: rasterization,
jitter: jitter, jitter: jitter,
brightness: brightness,
contrast: contrast,
ambient_light: ambient_light,
windowOpacity: windowOpacity,
fontIndex: fontIndexes[rasterization] fontIndex: fontIndexes[rasterization]
} }
return JSON.stringify(settings); return JSON.stringify(settings);
@ -213,11 +213,6 @@ Item{
function loadSettingsString(settingsString){ function loadSettingsString(settingsString){
var settings = JSON.parse(settingsString); var settings = JSON.parse(settingsString);
ambient_light = settings.ambient_light !== undefined ? settings.ambient_light : ambient_light;
contrast = settings.contrast !== undefined ? settings.contrast : contrast;
brightness = settings.brightness !== undefined ? settings.brightness : brightness
show_terminal_size = settings.show_terminal_size !== undefined ? settings.show_terminal_size : show_terminal_size show_terminal_size = settings.show_terminal_size !== undefined ? settings.show_terminal_size : show_terminal_size
fps = settings.fps !== undefined ? settings.fps: fps fps = settings.fps !== undefined ? settings.fps: fps
@ -227,7 +222,6 @@ Item{
fontScalingIndexes = settings.fontScalingIndexes !== undefined ? settings.fontScalingIndexes : fontScalingIndexes fontScalingIndexes = settings.fontScalingIndexes !== undefined ? settings.fontScalingIndexes : fontScalingIndexes
_frameReflections = settings.frameReflections !== undefined ? settings.frameReflections : _frameReflections; _frameReflections = settings.frameReflections !== undefined ? settings.frameReflections : _frameReflections;
windowOpacity = settings.windowOpacity !== undefined ? settings.windowOpacity : windowOpacity;
} }
function loadProfileString(profileString){ function loadProfileString(profileString){
@ -251,6 +245,11 @@ Item{
jitter = settings.jitter !== undefined ? settings.jitter : jitter; jitter = settings.jitter !== undefined ? settings.jitter : jitter;
ambient_light = settings.ambient_light !== undefined ? settings.ambient_light : ambient_light;
contrast = settings.contrast !== undefined ? settings.contrast : contrast;
brightness = settings.brightness !== undefined ? settings.brightness : brightness;
windowOpacity = settings.windowOpacity !== undefined ? settings.windowOpacity : windowOpacity;
fontIndexes[rasterization] = settings.fontIndex !== undefined ? settings.fontIndex : fontIndexes[rasterization]; fontIndexes[rasterization] = settings.fontIndex !== undefined ? settings.fontIndex : fontIndexes[rasterization];
} }
@ -303,37 +302,42 @@ Item{
id: profileslist id: profileslist
ListElement{ ListElement{
text: "Default Amber" text: "Default Amber"
obj_string: '{"background_color":"#000000","bloom_strength":0.65,"brightness_flickering":0.1,"fontIndex":0,"font_color":"#ff8100","frames_index":1,"glowing_line_strength":0.2,"horizontal_sincronization":0.08,"jitter":0.18,"motion_blur":0.45,"noise_strength":0.1,"rasterization":0,"screen_distortion":0.1}' obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.65,"brightness":0.5,"brightness_flickering":0.1,"contrast":0.85,"fontIndex":0,"font_color":"#ff8100","frames_index":1,"glowing_line_strength":0.2,"horizontal_sincronization":0.08,"jitter":0.18,"motion_blur":0.4,"noise_strength":0.1,"rasterization":0,"screen_distortion":0.1,"windowOpacity":1}'
builtin: true builtin: true
} }
ListElement{ ListElement{
text: "Default Green" text: "Default Green"
obj_string: '{"background_color":"#000000","bloom_strength":0.4,"brightness_flickering":0.1,"fontIndex":0,"font_color":"#0ccc68","frames_index":1,"glowing_line_strength":0.2,"horizontal_sincronization":0.08,"jitter":0.18,"motion_blur":0.45,"noise_strength":0.1,"rasterization":0,"screen_distortion":0.1}' obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.4,"brightness":0.5,"brightness_flickering":0.1,"contrast":0.85,"fontIndex":0,"font_color":"#0ccc68","frames_index":1,"glowing_line_strength":0.2,"horizontal_sincronization":0.08,"jitter":0.18,"motion_blur":0.45,"noise_strength":0.1,"rasterization":0,"screen_distortion":0.1,"windowOpacity":1}'
builtin: true builtin: true
} }
ListElement{ ListElement{
text: "Default Scanlines" text: "Default Scanlines"
obj_string: '{"background_color":"#000000","bloom_strength":0.4,"brightness_flickering":0.1,"fontIndex":0,"font_color":"#00ff5b","frames_index":1,"glowing_line_strength":0.2,"horizontal_sincronization":0.07,"jitter":0.11,"motion_blur":0.4,"noise_strength":0.05,"rasterization":1,"screen_distortion":0.1}' obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.4,"brightness":0.5,"brightness_flickering":0.1,"contrast":0.85,"fontIndex":0,"font_color":"#00ff5b","frames_index":1,"glowing_line_strength":0.2,"horizontal_sincronization":0.07,"jitter":0.11,"motion_blur":0.4,"noise_strength":0.05,"rasterization":1,"screen_distortion":0.1,"windowOpacity":1}'
builtin: true builtin: true
} }
ListElement{ ListElement{
text: "Default Pixelated" text: "Default Pixelated"
obj_string: '{"background_color":"#000000","bloom_strength":0.4,"brightness_flickering":0.1,"fontIndex":0,"font_color":"#ff8100","frames_index":1,"glowing_line_strength":0.2,"horizontal_sincronization":0.1,"jitter":0,"motion_blur":0.45,"noise_strength":0.14,"rasterization":2,"screen_distortion":0.05}' obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.4,"brightness":0.5,"brightness_flickering":0.1,"contrast":0.85,"fontIndex":0,"font_color":"#ff8100","frames_index":1,"glowing_line_strength":0.2,"horizontal_sincronization":0.1,"jitter":0,"motion_blur":0.45,"noise_strength":0.14,"rasterization":2,"screen_distortion":0.05,"windowOpacity":1}'
builtin: true builtin: true
} }
ListElement{ ListElement{
text: "Apple ][" text: "Apple ]["
obj_string: '{"background_color":"#000000","bloom_strength":0.5,"brightness_flickering":0.2,"fontIndex":2,"font_color":"#2fff91","frames_index":1,"glowing_line_strength":0.22,"horizontal_sincronization":0.08,"jitter":0.1,"motion_blur":0.65,"noise_strength":0.08,"rasterization":1,"screen_distortion":0.18}' obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.5,"brightness":0.5,"brightness_flickering":0.2,"contrast":0.85,"fontIndex":2,"font_color":"#2fff91","frames_index":1,"glowing_line_strength":0.22,"horizontal_sincronization":0.08,"jitter":0.1,"motion_blur":0.65,"noise_strength":0.08,"rasterization":1,"screen_distortion":0.18,"windowOpacity":1}'
builtin: true builtin: true
} }
ListElement{ ListElement{
text: "Vintage" text: "Vintage"
obj_string: '{"background_color":"#000000","bloom_strength":0.4,"brightness_flickering":0.54,"fontIndex":0,"font_color":"#00ff3e","frames_index":2,"glowing_line_strength":0.3,"horizontal_sincronization":0.2,"jitter":0.4,"motion_blur":0.75,"noise_strength":0.2,"rasterization":1,"screen_distortion":0.1}' obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.4,"brightness":0.5,"brightness_flickering":0.54,"contrast":0.85,"fontIndex":0,"font_color":"#00ff3e","frames_index":2,"glowing_line_strength":0.3,"horizontal_sincronization":0.2,"jitter":0.4,"motion_blur":0.75,"noise_strength":0.2,"rasterization":1,"screen_distortion":0.1,"windowOpacity":1}'
builtin: true builtin: true
} }
ListElement{ ListElement{
text: "IBM Dos" text: "IBM Dos"
obj_string: '{"background_color":"#000000","bloom_strength":0.4,"brightness_flickering":0.07,"fontIndex":7,"font_color":"#ffffff","frames_index":1,"glowing_line_strength":0.13,"horizontal_sincronization":0,"jitter":0.08,"motion_blur":0.3,"noise_strength":0.03,"rasterization":0,"screen_distortion":0.1}' obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.4,"brightness":0.5,"brightness_flickering":0.07,"contrast":0.85,"fontIndex":7,"font_color":"#ffffff","frames_index":1,"glowing_line_strength":0.13,"horizontal_sincronization":0,"jitter":0.08,"motion_blur":0.3,"noise_strength":0.03,"rasterization":0,"screen_distortion":0.1,"windowOpacity":1}'
builtin: true
}
ListElement{
text: "Transparent Green"
obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.4549689440993788,"brightness":0.5,"brightness_flickering":0.20341614906832298,"contrast":0.85,"fontIndex":0,"font_color":"#0ccc68","frames_index":0,"glowing_line_strength":0.15993788819875776,"horizontal_sincronization":0.05045871559633028,"jitter":0.20341614906832298,"motion_blur":0.24999999999999997,"noise_strength":0.20031055900621117,"rasterization":0,"screen_distortion":0.05045871559633028,"windowOpacity":0.5956221198156681}'
builtin: true builtin: true
} }
} }

View File

@ -23,6 +23,7 @@ import QtQuick.Controls 1.1
import QtQuick.Layouts 1.1 import QtQuick.Layouts 1.1
RowLayout { RowLayout {
property bool enabled: true
property alias name: check.text property alias name: check.text
property double value: (check.checked) ? _value : 0.0 property double value: (check.checked) ? _value : 0.0
property alias _value: slider.value property alias _value: slider.value
@ -39,12 +40,13 @@ RowLayout {
id: check id: check
implicitWidth: 150 implicitWidth: 150
Component.onCompleted: checked = (_value !== 0); Component.onCompleted: checked = (_value !== 0);
enabled: parent.enabled
} }
Slider{ Slider{
id: slider id: slider
stepSize: parent.stepSize stepSize: parent.stepSize
Layout.fillWidth: true Layout.fillWidth: true
enabled: check.checked enabled: check.checked && parent.enabled
} }
Text{ Text{
id: textfield id: textfield

View File

@ -22,6 +22,7 @@ import QtQuick 2.2
import QtQuick.Dialogs 1.1 import QtQuick.Dialogs 1.1
Item { Item {
signal colorSelected (color color)
property color button_color property color button_color
property string name property string name
@ -33,7 +34,7 @@ Item {
//This is a workaround to a Qt 5.2 bug. //This is a workaround to a Qt 5.2 bug.
onCurrentColorChanged: colorDialog.color = colorDialog.currentColor; onCurrentColorChanged: colorDialog.color = colorDialog.currentColor;
onAccepted: button_color = color; onAccepted: colorSelected(color)
} }
Rectangle{ Rectangle{
anchors.fill: parent anchors.fill: parent

View File

@ -58,6 +58,12 @@ Tab{
onValueChanged: shadersettings.screen_distortion = value; onValueChanged: shadersettings.screen_distortion = value;
_value: shadersettings.screen_distortion; _value: shadersettings.screen_distortion;
} }
CheckableSlider{
name: qsTr("Ambient light")
onValueChanged: shadersettings.ambient_light = value;
_value: shadersettings.ambient_light
enabled: shadersettings.frames_index !== 0
}
CheckableSlider{ CheckableSlider{
name: qsTr("Brightness flickering") name: qsTr("Brightness flickering")
onValueChanged: shadersettings.brightness_flickering= value; onValueChanged: shadersettings.brightness_flickering= value;

View File

@ -84,11 +84,6 @@ Tab{
onValueChanged: shadersettings.contrast = value onValueChanged: shadersettings.contrast = value
value: shadersettings.contrast value: shadersettings.contrast
} }
Text{ text: qsTr("Ambient") }
SimpleSlider{
onValueChanged: shadersettings.ambient_light = value;
value: shadersettings.ambient_light
}
Text{ text: qsTr("Opacity") } Text{ text: qsTr("Opacity") }
SimpleSlider{ SimpleSlider{
onValueChanged: shadersettings.windowOpacity = value onValueChanged: shadersettings.windowOpacity = value
@ -108,9 +103,9 @@ Tab{
columns: 3 columns: 3
CheckBox{ CheckBox{
Layout.columnSpan: 3 Layout.columnSpan: 3
checked: shadersettings._frameReflections checked: !shadersettings._frameReflections
text: qsTr("Frame reflections") text: qsTr("Disable reflections")
onCheckedChanged: shadersettings._frameReflections = checked onCheckedChanged: shadersettings._frameReflections = !checked
enabled: shadersettings.reflectionsAllowed enabled: shadersettings.reflectionsAllowed
} }
CheckBox{ CheckBox{
@ -133,12 +128,11 @@ Tab{
Slider{ Slider{
Layout.fillWidth: true Layout.fillWidth: true
id: txtslider id: txtslider
stepSize: 0.25
maximumValue: 1
minimumValue: 0.50
onValueChanged: shadersettings.window_scaling = value; onValueChanged: shadersettings.window_scaling = value;
value: shadersettings.window_scaling value: shadersettings.window_scaling
tickmarksEnabled: true tickmarksEnabled: true
stepSize: 0.25
Component.onCompleted: minimumValue = 0.5 //Without this value gets set to 0.5
} }
Text{text: Math.round(txtslider.value * 100) + "%"} Text{text: Math.round(txtslider.value * 100) + "%"}
} }

View File

@ -98,14 +98,14 @@ Tab{
name: qsTr("Font") name: qsTr("Font")
height: 50 height: 50
Layout.fillWidth: true Layout.fillWidth: true
onButton_colorChanged: shadersettings._font_color = button_color onColorSelected: shadersettings._font_color = color;
button_color: shadersettings._font_color button_color: shadersettings._font_color
} }
ColorButton{ ColorButton{
name: qsTr("Background") name: qsTr("Background")
height: 50 height: 50
Layout.fillWidth: true Layout.fillWidth: true
onButton_colorChanged: shadersettings._background_color = button_color onColorSelected: shadersettings._background_color = color;
button_color: shadersettings._background_color button_color: shadersettings._background_color
} }
} }