mirror of
https://github.com/Swordfish90/cool-retro-term.git
synced 2025-04-18 16:50:47 +01:00
Reenabled profiles. Fixes in the settings window.
This commit is contained in:
parent
8611f815e7
commit
984c4aaa23
@ -50,9 +50,8 @@ ApplicationWindow {
|
|||||||
ComboBox{
|
ComboBox{
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
model: shadersettings.profiles_list
|
model: shadersettings.profiles_list
|
||||||
onCurrentIndexChanged: {
|
onCurrentIndexChanged: shadersettings.profiles_index = currentIndex
|
||||||
shadersettings.loadProfile(shadersettings.profiles_list.get(currentIndex).obj_name);
|
currentIndex: shadersettings.profiles_index
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,7 +86,7 @@ ApplicationWindow {
|
|||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.columnSpan: 2
|
Layout.columnSpan: 2
|
||||||
onButton_colorChanged: shadersettings._font_color = button_color;
|
onButton_colorChanged: shadersettings._font_color = button_color;
|
||||||
Component.onCompleted: button_color = shadersettings._font_color;
|
button_color: shadersettings._font_color;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -113,24 +112,29 @@ ApplicationWindow {
|
|||||||
Layout.columnSpan: 2
|
Layout.columnSpan: 2
|
||||||
|
|
||||||
onButton_colorChanged: shadersettings._background_color= button_color
|
onButton_colorChanged: shadersettings._background_color= button_color
|
||||||
Component.onCompleted: button_color = shadersettings._background_color;
|
button_color: shadersettings._background_color;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
GroupBox{
|
GroupBox{
|
||||||
title: qsTr("Background")
|
title: qsTr("Background")
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.fillHeight:true
|
Layout.columnSpan: 2
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
ColumnLayout{
|
ColumnLayout{
|
||||||
SettingComponent{
|
Layout.columnSpan: 2
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
SimpleSlider{
|
||||||
name: "Contrast"
|
name: "Contrast"
|
||||||
onValueChanged: shadersettings.contrast = value
|
onValueChanged: shadersettings.contrast = value
|
||||||
_value: shadersettings.contrast
|
value: shadersettings.contrast
|
||||||
}
|
}
|
||||||
SettingComponent{
|
SimpleSlider{
|
||||||
name: "Brightness"
|
name: "Brightness"
|
||||||
onValueChanged: shadersettings.brightness = value
|
onValueChanged: shadersettings.brightness = value
|
||||||
_value: shadersettings.brightness
|
value: shadersettings.brightness
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,12 +34,18 @@ Item{
|
|||||||
c1.b * alpha + c2.b * (1-alpha),
|
c1.b * alpha + c2.b * (1-alpha),
|
||||||
c1.a * alpha + c2.a * (1-alpha))
|
c1.a * alpha + c2.a * (1-alpha))
|
||||||
}
|
}
|
||||||
|
function strToColor(s){
|
||||||
|
var r = parseInt(s.substring(1,3), 16) / 256;
|
||||||
|
var g = parseInt(s.substring(3,5), 16) / 256;
|
||||||
|
var b = parseInt(s.substring(5,7), 16) / 256;
|
||||||
|
return Qt.rgba(r, g, b, 1.0);
|
||||||
|
}
|
||||||
|
|
||||||
//Private atttributes might need processing
|
//Probably there is a better way to cast string to colors.
|
||||||
property color _background_color: "#000000"
|
property string _background_color: "#000000"
|
||||||
property color _font_color: "#00ff00"
|
property string _font_color: "#00ff00"
|
||||||
property color font_color: mix(_font_color, _background_color, 0.5 + (contrast * 0.5))
|
property color font_color: mix(strToColor(_font_color), strToColor(_background_color), 0.7 + (contrast * 0.3))
|
||||||
property color background_color: mix(_background_color, _font_color, 0.5 + (contrast * 0.5))
|
property color background_color: mix(strToColor(_background_color), strToColor(_font_color), 0.7 + (contrast * 0.3))
|
||||||
|
|
||||||
property real noise_strength: 0.1
|
property real noise_strength: 0.1
|
||||||
property real screen_distortion: 0.15
|
property real screen_distortion: 0.15
|
||||||
@ -53,7 +59,7 @@ Item{
|
|||||||
property real scanlines: 0.0
|
property real scanlines: 0.0
|
||||||
|
|
||||||
property string frame_source: frames_list.get(frames_index).source
|
property string frame_source: frames_list.get(frames_index).source
|
||||||
property int frames_index: 2
|
property int frames_index: 1
|
||||||
property var frames_list: framelist
|
property var frames_list: framelist
|
||||||
|
|
||||||
property real font_scaling: 1.0
|
property real font_scaling: 1.0
|
||||||
@ -63,6 +69,8 @@ Item{
|
|||||||
property var fonts_list: fontlist
|
property var fonts_list: fontlist
|
||||||
|
|
||||||
property var profiles_list: profileslist
|
property var profiles_list: profileslist
|
||||||
|
property int profiles_index: 0
|
||||||
|
onProfiles_indexChanged: loadProfile(profiles_list.get(profiles_index).obj_name);
|
||||||
|
|
||||||
onFont_indexChanged: handleFontChanged();
|
onFont_indexChanged: handleFontChanged();
|
||||||
onFont_scalingChanged: handleFontChanged();
|
onFont_scalingChanged: handleFontChanged();
|
||||||
@ -140,14 +148,15 @@ Item{
|
|||||||
function loadProfile(profilename){
|
function loadProfile(profilename){
|
||||||
var settings = storage.getSetting(profilename);
|
var settings = storage.getSetting(profilename);
|
||||||
if(!settings) return;
|
if(!settings) return;
|
||||||
|
console.log(profilename + settings);
|
||||||
settings = JSON.parse(settings);
|
settings = JSON.parse(settings);
|
||||||
|
|
||||||
contrast = settings.contrast ? settings.contrast : contrast;
|
contrast = settings.contrast ? settings.contrast : contrast;
|
||||||
|
brightness = settings.brightness ? settings.brightness : brightness
|
||||||
|
|
||||||
ambient_light = settings.ambient_light ? settings.ambient_light : ambient_light;
|
ambient_light = settings.ambient_light ? settings.ambient_light : ambient_light;
|
||||||
background_color = settings.background_color ? settings.background_color : background_color;
|
_background_color = settings.background_color ? settings.background_color : _background_color;
|
||||||
font_color = settings.font_color ? settings.font_color : font_color;
|
_font_color = settings.font_color ? settings.font_color : _font_color;
|
||||||
|
|
||||||
brightness_flickering = settings.brightness_flickering ? settings.brightness_flickering : brightness_flickering;
|
brightness_flickering = settings.brightness_flickering ? settings.brightness_flickering : brightness_flickering;
|
||||||
noise_strength = settings.noise_strength ? settings.noise_strength : noise_strength;
|
noise_strength = settings.noise_strength ? settings.noise_strength : noise_strength;
|
||||||
@ -167,9 +176,10 @@ Item{
|
|||||||
function storeCurrentSettings(){
|
function storeCurrentSettings(){
|
||||||
var settings = {
|
var settings = {
|
||||||
ambient_light : ambient_light,
|
ambient_light : ambient_light,
|
||||||
|
brightness : brightness,
|
||||||
contrast : contrast,
|
contrast : contrast,
|
||||||
background_color: background_color,
|
background_color: _background_color,
|
||||||
font_color: font_color,
|
font_color: _font_color,
|
||||||
brightness_flickering: brightness_flickering,
|
brightness_flickering: brightness_flickering,
|
||||||
noise_strength: noise_strength,
|
noise_strength: noise_strength,
|
||||||
screen_distortion: screen_distortion,
|
screen_distortion: screen_distortion,
|
||||||
@ -197,7 +207,7 @@ Item{
|
|||||||
}
|
}
|
||||||
Component.onDestruction: {
|
Component.onDestruction: {
|
||||||
storeCurrentSettings();
|
storeCurrentSettings();
|
||||||
storage.dropSettings();
|
//storage.dropSettings(); //DROPS THE SETTINGS!.. REMEMBER TO DISABLE ONCE ENABLED!!
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
48
app/SimpleSlider.qml
Normal file
48
app/SimpleSlider.qml
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2013 "Filippo Scognamiglio"
|
||||||
|
* https://github.com/Swordifish90/cool-old-term
|
||||||
|
*
|
||||||
|
* This file is part of cool-old-term.
|
||||||
|
*
|
||||||
|
* cool-old-term is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
import QtQuick 2.1
|
||||||
|
import QtQuick.Controls 1.1
|
||||||
|
import QtQuick.Layouts 1.1
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
|
property string name
|
||||||
|
property double value: 0.0
|
||||||
|
property double stepSize: 0.01
|
||||||
|
|
||||||
|
id: setting_component
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
spacing: 10
|
||||||
|
Text{
|
||||||
|
text: name
|
||||||
|
}
|
||||||
|
Slider{
|
||||||
|
id: slider
|
||||||
|
stepSize: parent.stepSize
|
||||||
|
onValueChanged: setting_component.value = slider.value;
|
||||||
|
Layout.fillWidth: true
|
||||||
|
value: setting_component.value
|
||||||
|
}
|
||||||
|
Text{
|
||||||
|
id: textfield
|
||||||
|
text: Math.round(value * 100) + "%"
|
||||||
|
}
|
||||||
|
}
|
@ -1,3 +1,23 @@
|
|||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2013 "Filippo Scognamiglio"
|
||||||
|
* https://github.com/Swordifish90/cool-old-term
|
||||||
|
*
|
||||||
|
* This file is part of cool-old-term.
|
||||||
|
*
|
||||||
|
* cool-old-term is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
import QtQuick 2.0
|
import QtQuick 2.0
|
||||||
import QtGraphicalEffects 1.0
|
import QtGraphicalEffects 1.0
|
||||||
|
|
||||||
|
@ -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-03-31T13:42:02. -->
|
<!-- Written by QtCreator 3.0.1, 2014-03-31T21:06:48. -->
|
||||||
<qtcreator>
|
<qtcreator>
|
||||||
<data>
|
<data>
|
||||||
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
||||||
|
11
app/main.qml
11
app/main.qml
@ -49,7 +49,7 @@ ApplicationWindow{
|
|||||||
Action{
|
Action{
|
||||||
id: showsettingsAction
|
id: showsettingsAction
|
||||||
text: "&Settings"
|
text: "&Settings"
|
||||||
onTriggered: settingswindow.show();
|
onTriggered: settingswindowloader.active = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
menuBar: MenuBar {
|
menuBar: MenuBar {
|
||||||
@ -132,8 +132,13 @@ ApplicationWindow{
|
|||||||
id: shadersettings
|
id: shadersettings
|
||||||
Component.onCompleted: terminal.loadKTerminal();
|
Component.onCompleted: terminal.loadKTerminal();
|
||||||
}
|
}
|
||||||
SettingsWindow{
|
Loader{
|
||||||
|
id: settingswindowloader
|
||||||
|
active: false
|
||||||
|
sourceComponent: SettingsWindow{
|
||||||
id: settingswindow
|
id: settingswindow
|
||||||
visible: false
|
visible: true
|
||||||
|
onClosing: settingswindowloader.active = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user