2013-12-28 14:52:10 +01:00
|
|
|
/*******************************************************************************
|
|
|
|
* 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/>.
|
|
|
|
*******************************************************************************/
|
|
|
|
|
2014-04-17 13:56:13 +02:00
|
|
|
import QtQuick 2.2
|
2013-11-23 16:09:46 +01:00
|
|
|
|
|
|
|
Item{
|
2013-12-30 02:28:30 +01:00
|
|
|
property bool fullscreen: false
|
|
|
|
|
2013-11-25 16:46:10 +01:00
|
|
|
property real ambient_light: 0.2
|
2014-04-03 15:29:07 +02:00
|
|
|
property real contrast: 0.85
|
|
|
|
property real brightness: 0.75
|
2014-03-31 17:26:51 +02:00
|
|
|
|
2014-04-20 22:59:46 +02:00
|
|
|
//On resize shows an overlay with the current size
|
2014-04-17 13:27:41 +02:00
|
|
|
property bool show_terminal_size: true
|
|
|
|
|
2014-04-02 22:07:37 +02:00
|
|
|
property real window_scaling: 1.0
|
2014-04-20 22:59:46 +02:00
|
|
|
onWindow_scalingChanged: handleFontChanged();
|
2014-04-02 22:07:37 +02:00
|
|
|
|
2014-04-03 18:44:23 +02:00
|
|
|
property real fps: 60
|
|
|
|
|
2014-03-27 13:59:48 +01:00
|
|
|
function mix(c1, c2, alpha){
|
|
|
|
return Qt.rgba(c1.r * alpha + c2.r * (1-alpha),
|
|
|
|
c1.g * alpha + c2.g * (1-alpha),
|
|
|
|
c1.b * alpha + c2.b * (1-alpha),
|
|
|
|
c1.a * alpha + c2.a * (1-alpha))
|
|
|
|
}
|
2014-03-31 22:23:48 +02:00
|
|
|
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);
|
|
|
|
}
|
2014-03-27 13:59:48 +01:00
|
|
|
|
2014-03-31 22:23:48 +02:00
|
|
|
//Probably there is a better way to cast string to colors.
|
|
|
|
property string _background_color: "#000000"
|
2014-04-03 15:29:07 +02:00
|
|
|
property string _font_color: "#ff9400"
|
2014-03-31 22:23:48 +02:00
|
|
|
property color font_color: mix(strToColor(_font_color), strToColor(_background_color), 0.7 + (contrast * 0.3))
|
|
|
|
property color background_color: mix(strToColor(_background_color), strToColor(_font_color), 0.7 + (contrast * 0.3))
|
2013-11-25 02:19:44 +01:00
|
|
|
|
|
|
|
property real noise_strength: 0.1
|
2013-12-25 19:11:00 +01:00
|
|
|
property real screen_distortion: 0.15
|
2013-11-25 02:19:44 +01:00
|
|
|
property real glowing_line_strength: 0.4
|
2014-03-22 11:11:27 +01:00
|
|
|
property real motion_blur: 0.65
|
2014-03-26 20:26:20 +01:00
|
|
|
property real bloom_strength: 0.6
|
2013-12-25 02:26:18 +01:00
|
|
|
|
2014-03-26 19:23:47 +01:00
|
|
|
property real horizontal_sincronization: 0.1
|
2014-03-31 14:13:51 +02:00
|
|
|
property real brightness_flickering: 0.12
|
2014-03-25 16:30:07 +01:00
|
|
|
|
2014-04-03 15:06:16 +02:00
|
|
|
readonly property int no_rasterization: 0
|
|
|
|
readonly property int scanline_rasterization: 1
|
|
|
|
readonly property int pixel_rasterization: 2
|
|
|
|
|
|
|
|
property int rasterization: no_rasterization
|
2013-12-26 01:12:14 +01:00
|
|
|
|
|
|
|
property string frame_source: frames_list.get(frames_index).source
|
2014-03-31 22:23:48 +02:00
|
|
|
property int frames_index: 1
|
2013-12-26 22:00:35 +01:00
|
|
|
property var frames_list: framelist
|
|
|
|
|
2014-05-29 11:33:45 +02:00
|
|
|
signal terminalFontChanged
|
2014-05-31 19:28:35 +02:00
|
|
|
|
|
|
|
property var _font_scalings: [0.5, 0.75, 1.0, 1.25, 1.50, 1.75, 2.0]
|
2013-12-27 19:11:11 +01:00
|
|
|
property var font: currentfont
|
2013-12-28 14:37:43 +01:00
|
|
|
property int font_index: 0
|
2013-12-27 19:11:11 +01:00
|
|
|
property var fonts_list: fontlist
|
|
|
|
|
2014-04-05 15:14:52 +02:00
|
|
|
property bool frame_reflections: true
|
2014-04-20 23:48:31 +02:00
|
|
|
property real frame_reflection_strength: ((frame_reflections && framelist.get(frames_index).reflections) ? 1.0 : 0.0) * 0.15
|
2014-04-05 15:14:52 +02:00
|
|
|
|
2014-05-18 22:23:19 +02:00
|
|
|
property alias profiles_list: profileslist
|
2014-03-31 22:23:48 +02:00
|
|
|
property int profiles_index: 0
|
2014-05-18 22:23:19 +02:00
|
|
|
onProfiles_indexChanged: loadProfile(profiles_index);
|
2013-12-28 03:40:45 +01:00
|
|
|
|
2013-12-28 02:42:24 +01:00
|
|
|
onFont_indexChanged: handleFontChanged();
|
2014-05-31 19:28:35 +02:00
|
|
|
onFont_scaling_indexChanged: handleFontChanged();
|
2013-12-28 02:42:24 +01:00
|
|
|
|
|
|
|
function handleFontChanged(){
|
2014-05-31 19:28:35 +02:00
|
|
|
var f = fontlist.get(font_index);
|
|
|
|
var metrics = f.metrics.get(font_scaling_index);
|
|
|
|
currentfont.source = f.source;
|
2014-06-06 23:55:33 +02:00
|
|
|
currentfont.pixelSize = metrics.pixelSize;
|
2014-05-31 19:28:35 +02:00
|
|
|
currentfont.lineSpacing = f.lineSpacing;
|
|
|
|
currentfont.virtualResolution = Qt.size(metrics.virtualWidth,
|
|
|
|
metrics.virtualHeight);
|
2014-05-29 11:33:45 +02:00
|
|
|
terminalFontChanged();
|
2013-12-27 22:25:33 +01:00
|
|
|
}
|
|
|
|
|
2013-12-27 19:11:11 +01:00
|
|
|
FontLoader{
|
2014-05-31 19:28:35 +02:00
|
|
|
property int pixelSize
|
|
|
|
property real lineSpacing
|
|
|
|
property size virtualResolution
|
2013-12-27 19:11:11 +01:00
|
|
|
id: currentfont
|
|
|
|
source: fontlist.get(font_index).source
|
|
|
|
}
|
|
|
|
|
2013-12-26 22:00:35 +01:00
|
|
|
ListModel{
|
|
|
|
id: framelist
|
2014-04-05 15:14:52 +02:00
|
|
|
ListElement{text: "No frame"; source: "./frames/NoFrame.qml"; reflections: false}
|
|
|
|
ListElement{text: "Simple white frame"; source: "./frames/WhiteSimpleFrame.qml"; reflections: true}
|
|
|
|
ListElement{text: "Rough black frame"; source: "./frames/BlackRoughFrame.qml"; reflections: true}
|
2013-12-26 01:12:14 +01:00
|
|
|
}
|
2013-12-27 19:11:11 +01:00
|
|
|
|
2014-05-31 19:28:35 +02:00
|
|
|
property int font_scaling_index: 0
|
2013-12-27 19:11:11 +01:00
|
|
|
ListModel{
|
|
|
|
id: fontlist
|
2014-03-24 21:40:04 +01:00
|
|
|
ListElement{
|
|
|
|
text: "Terminus (Modern)"
|
2014-06-06 23:55:33 +02:00
|
|
|
source: "fonts/modern-terminus/TerminusTTF-Bold-4.38.2.ttf"
|
|
|
|
lineSpacing: 2
|
2014-05-31 19:28:35 +02:00
|
|
|
metrics: [
|
2014-06-06 23:55:33 +02:00
|
|
|
ListElement{pixelSize: 18; virtualWidth: 0; virtualHeight: 6},
|
|
|
|
ListElement{pixelSize: 24; virtualWidth: 0; virtualHeight: 8},
|
|
|
|
ListElement{pixelSize: 35; virtualWidth: 5; virtualHeight: 12},
|
2014-06-07 02:19:37 +02:00
|
|
|
ListElement{pixelSize: 43; virtualWidth: 6; virtualHeight: 11},
|
2014-06-06 23:55:33 +02:00
|
|
|
ListElement{pixelSize: 54; virtualWidth: 7; virtualHeight: 11},
|
|
|
|
ListElement{pixelSize: 64; virtualWidth: 8; virtualHeight: 11},
|
|
|
|
ListElement{pixelSize: 75; virtualWidth: 8; virtualHeight: 11}]
|
2014-03-24 21:40:04 +01:00
|
|
|
}
|
2013-12-27 19:11:11 +01:00
|
|
|
ListElement{
|
|
|
|
text: "Commodore PET (1977)"
|
2014-03-24 21:40:04 +01:00
|
|
|
source: "fonts/1977-commodore-pet/COMMODORE_PET.ttf"
|
2014-05-31 19:28:35 +02:00
|
|
|
lineSpacing: 2
|
|
|
|
metrics: [
|
2014-06-06 23:55:33 +02:00
|
|
|
ListElement{pixelSize: 11; virtualWidth: 0; virtualHeight: 0},
|
|
|
|
ListElement{pixelSize: 17; virtualWidth: 0; virtualHeight: 6},
|
|
|
|
ListElement{pixelSize: 24; virtualWidth: 8; virtualHeight: 8},
|
|
|
|
ListElement{pixelSize: 32; virtualWidth: 8; virtualHeight: 8},
|
|
|
|
ListElement{pixelSize: 40; virtualWidth: 8; virtualHeight: 8},
|
|
|
|
ListElement{pixelSize: 48; virtualWidth: 8; virtualHeight: 8},
|
|
|
|
ListElement{pixelSize: 56; virtualWidth: 8; virtualHeight: 8}]
|
2013-12-27 19:11:11 +01:00
|
|
|
}
|
|
|
|
ListElement{
|
2014-03-24 21:40:04 +01:00
|
|
|
text: "Apple ][ (1977)"
|
|
|
|
source: "fonts/1977-apple2/PrintChar21.ttf"
|
2014-05-31 19:28:35 +02:00
|
|
|
lineSpacing: 2
|
|
|
|
metrics: [
|
2014-06-06 23:55:33 +02:00
|
|
|
ListElement{pixelSize: 11; virtualWidth: 0; virtualHeight: 0},
|
|
|
|
ListElement{pixelSize: 17; virtualWidth: 0; virtualHeight: 6},
|
|
|
|
ListElement{pixelSize: 24; virtualWidth: 7; virtualHeight: 8},
|
|
|
|
ListElement{pixelSize: 32; virtualWidth: 7; virtualHeight: 8},
|
|
|
|
ListElement{pixelSize: 40; virtualWidth: 7; virtualHeight: 8},
|
|
|
|
ListElement{pixelSize: 48; virtualWidth: 7; virtualHeight: 8},
|
|
|
|
ListElement{pixelSize: 56; virtualWidth: 7; virtualHeight: 8}]
|
2014-03-24 21:40:04 +01:00
|
|
|
}
|
|
|
|
ListElement{
|
|
|
|
text: "Atari 400-800 (1979)"
|
|
|
|
source: "fonts/1979-atari-400-800/ATARI400800_original.TTF"
|
2014-05-31 19:28:35 +02:00
|
|
|
lineSpacing: 3
|
|
|
|
metrics: [
|
2014-06-06 23:55:33 +02:00
|
|
|
ListElement{pixelSize: 11; virtualWidth: 0; virtualHeight: 0},
|
|
|
|
ListElement{pixelSize: 17; virtualWidth: 0; virtualHeight: 6},
|
|
|
|
ListElement{pixelSize: 24; virtualWidth: 8; virtualHeight: 8},
|
|
|
|
ListElement{pixelSize: 32; virtualWidth: 8; virtualHeight: 8},
|
|
|
|
ListElement{pixelSize: 40; virtualWidth: 8; virtualHeight: 8},
|
|
|
|
ListElement{pixelSize: 48; virtualWidth: 8; virtualHeight: 8},
|
|
|
|
ListElement{pixelSize: 56; virtualWidth: 8; virtualHeight: 8}]
|
2013-12-27 19:11:11 +01:00
|
|
|
}
|
|
|
|
ListElement{
|
|
|
|
text: "Commodore 64 (1982)"
|
2014-03-24 21:40:04 +01:00
|
|
|
source: "fonts/1982-commodore64/C64_User_Mono_v1.0-STYLE.ttf"
|
2014-05-31 19:28:35 +02:00
|
|
|
lineSpacing: 3
|
|
|
|
metrics: [
|
2014-06-06 23:55:33 +02:00
|
|
|
ListElement{pixelSize: 11; virtualWidth: 0; virtualHeight: 0},
|
|
|
|
ListElement{pixelSize: 17; virtualWidth: 0; virtualHeight: 6},
|
|
|
|
ListElement{pixelSize: 24; virtualWidth: 8; virtualHeight: 8},
|
|
|
|
ListElement{pixelSize: 32; virtualWidth: 8; virtualHeight: 8},
|
|
|
|
ListElement{pixelSize: 40; virtualWidth: 8; virtualHeight: 8},
|
|
|
|
ListElement{pixelSize: 48; virtualWidth: 8; virtualHeight: 8},
|
|
|
|
ListElement{pixelSize: 56; virtualWidth: 8; virtualHeight: 8}]
|
2014-03-24 21:40:04 +01:00
|
|
|
}
|
|
|
|
ListElement{
|
|
|
|
text: "Atari ST (1985)"
|
|
|
|
source: "fonts/1985-atari-st/AtariST8x16SystemFont.ttf"
|
2014-06-06 23:55:33 +02:00
|
|
|
lineSpacing: 2
|
2014-05-31 19:28:35 +02:00
|
|
|
metrics: [
|
2014-06-06 23:55:33 +02:00
|
|
|
ListElement{pixelSize: 16; virtualWidth: 0; virtualHeight: 0},
|
|
|
|
ListElement{pixelSize: 23; virtualWidth: 0; virtualHeight: 7},
|
|
|
|
ListElement{pixelSize: 32; virtualWidth: 4; virtualHeight: 8},
|
|
|
|
ListElement{pixelSize: 40; virtualWidth: 4; virtualHeight: 8},
|
|
|
|
ListElement{pixelSize: 48; virtualWidth: 4; virtualHeight: 8},
|
|
|
|
ListElement{pixelSize: 56; virtualWidth: 4; virtualHeight: 8},
|
|
|
|
ListElement{pixelSize: 64; virtualWidth: 8; virtualHeight: 16}]
|
2013-12-27 19:11:11 +01:00
|
|
|
}
|
|
|
|
ListElement{
|
|
|
|
text: "IBM DOS (1985)"
|
2014-03-24 21:40:04 +01:00
|
|
|
source: "fonts/1985-ibm-pc-vga/Perfect DOS VGA 437.ttf"
|
2014-05-31 19:28:35 +02:00
|
|
|
lineSpacing: 2
|
|
|
|
metrics: [
|
2014-06-06 23:55:33 +02:00
|
|
|
ListElement{pixelSize: 18; virtualWidth: 0; virtualHeight: 0},
|
|
|
|
ListElement{pixelSize: 25; virtualWidth: 0; virtualHeight: 0},
|
|
|
|
ListElement{pixelSize: 32; virtualWidth: 6; virtualHeight: 8},
|
|
|
|
ListElement{pixelSize: 36; virtualWidth: 6; virtualHeight: 12},
|
|
|
|
ListElement{pixelSize: 48; virtualWidth: 9; virtualHeight: 16},
|
|
|
|
ListElement{pixelSize: 56; virtualWidth: 9; virtualHeight: 16},
|
|
|
|
ListElement{pixelSize: 64; virtualWidth: 9; virtualHeight: 16}]
|
2013-12-27 19:11:11 +01:00
|
|
|
}
|
|
|
|
}
|
2013-12-28 00:21:12 +01:00
|
|
|
|
|
|
|
Storage{id: storage}
|
|
|
|
|
2014-05-18 22:23:19 +02:00
|
|
|
function composeSettingsString(){
|
|
|
|
var settings = {
|
|
|
|
fps: fps,
|
|
|
|
window_scaling: window_scaling,
|
|
|
|
show_terminal_size: show_terminal_size,
|
|
|
|
brightness: brightness,
|
|
|
|
contrast: contrast,
|
|
|
|
ambient_light: ambient_light,
|
2014-05-31 19:28:35 +02:00
|
|
|
font_scaling_index: font_scaling_index,
|
2014-05-18 22:23:19 +02:00
|
|
|
}
|
|
|
|
return JSON.stringify(settings);
|
|
|
|
}
|
|
|
|
|
|
|
|
function composeProfileString(){
|
|
|
|
var settings = {
|
|
|
|
background_color: _background_color,
|
|
|
|
font_color: _font_color,
|
|
|
|
brightness_flickering: brightness_flickering,
|
|
|
|
horizontal_sincronization: horizontal_sincronization,
|
|
|
|
noise_strength: noise_strength,
|
|
|
|
screen_distortion: screen_distortion,
|
|
|
|
glowing_line_strength: glowing_line_strength,
|
|
|
|
frames_index: frames_index,
|
|
|
|
font_index: font_index,
|
|
|
|
motion_blur: motion_blur,
|
|
|
|
bloom_strength: bloom_strength,
|
|
|
|
rasterization: rasterization
|
|
|
|
}
|
|
|
|
return JSON.stringify(settings);
|
|
|
|
}
|
|
|
|
|
|
|
|
function loadSettings(){
|
|
|
|
var settingsString = storage.getSetting("_CURRENT_SETTINGS");
|
|
|
|
var profileString = storage.getSetting("_CURRENT_PROFILE");
|
|
|
|
|
|
|
|
if(!settingsString) return;
|
|
|
|
if(!profileString) return;
|
|
|
|
|
|
|
|
loadSettingsString(settingsString);
|
|
|
|
loadProfileString(profileString);
|
|
|
|
|
|
|
|
console.log("Loading settings: " + settingsString + profileString);
|
|
|
|
}
|
|
|
|
|
|
|
|
function storeSettings(){
|
|
|
|
var settingsString = composeSettingsString();
|
|
|
|
var profileString = composeProfileString();
|
|
|
|
|
|
|
|
storage.setSetting("_CURRENT_SETTINGS", settingsString);
|
|
|
|
storage.setSetting("_CURRENT_PROFILE", profileString);
|
|
|
|
|
|
|
|
console.log("Storing settings :" + settingsString + profileString);
|
|
|
|
}
|
|
|
|
|
|
|
|
function loadSettingsString(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
|
2013-12-28 00:21:12 +01:00
|
|
|
|
2014-04-17 13:27:41 +02:00
|
|
|
show_terminal_size = settings.show_terminal_size ? settings.show_terminal_size : show_terminal_size
|
|
|
|
|
2014-04-03 18:44:23 +02:00
|
|
|
fps = settings.fps !== undefined ? settings.fps: fps
|
2014-04-20 22:59:46 +02:00
|
|
|
window_scaling = settings.window_scaling ? settings.window_scaling : window_scaling
|
2014-04-03 18:44:23 +02:00
|
|
|
|
2014-05-31 19:28:35 +02:00
|
|
|
font_scaling_index = settings.font_scaling_index !== undefined ? settings.font_scaling_index: font_scaling_index;
|
2014-05-18 22:23:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function loadProfileString(profileString){
|
|
|
|
var settings = JSON.parse(profileString);
|
2014-03-27 13:59:48 +01:00
|
|
|
|
2014-04-03 18:08:07 +02:00
|
|
|
_background_color = settings.background_color !== undefined ? settings.background_color : _background_color;
|
|
|
|
_font_color = settings.font_color !== undefined ? settings.font_color : _font_color;
|
2013-12-28 00:21:12 +01:00
|
|
|
|
2014-04-03 18:08:07 +02:00
|
|
|
horizontal_sincronization = settings.horizontal_sincronization !== undefined ? settings.horizontal_sincronization : horizontal_sincronization
|
|
|
|
brightness_flickering = settings.brightness_flickering !== undefined ? settings.brightness_flickering : brightness_flickering;
|
|
|
|
noise_strength = settings.noise_strength !== undefined ? settings.noise_strength : noise_strength;
|
|
|
|
screen_distortion = settings.screen_distortion !== undefined ? settings.screen_distortion : screen_distortion;
|
|
|
|
glowing_line_strength = settings.glowing_line_strength !== undefined ? settings.glowing_line_strength : glowing_line_strength;
|
2013-12-28 00:21:12 +01:00
|
|
|
|
2014-04-03 18:08:07 +02:00
|
|
|
motion_blur = settings.motion_blur !== undefined ? settings.motion_blur : motion_blur
|
|
|
|
bloom_strength = settings.bloom_strength !== undefined ? settings.bloom_strength : bloom_strength
|
2014-03-22 11:11:27 +01:00
|
|
|
|
2014-04-03 18:08:07 +02:00
|
|
|
frames_index = settings.frames_index !== undefined ? settings.frames_index : frames_index;
|
2013-12-28 02:42:24 +01:00
|
|
|
|
2014-04-03 18:08:07 +02:00
|
|
|
font_index = settings.font_index !== undefined ? settings.font_index : font_index;
|
2014-04-03 15:06:16 +02:00
|
|
|
|
2014-04-03 18:08:07 +02:00
|
|
|
rasterization = settings.rasterization !== undefined ? settings.rasterization : rasterization;
|
2013-12-28 00:21:12 +01:00
|
|
|
}
|
|
|
|
|
2014-05-18 22:23:19 +02:00
|
|
|
function storeCustomProfiles(){
|
|
|
|
storage.setSetting("_CUSTOM_PROFILES", composeCustomProfilesString());
|
|
|
|
}
|
2013-12-28 00:21:12 +01:00
|
|
|
|
2014-05-18 22:23:19 +02:00
|
|
|
function loadCustomProfiles(){
|
|
|
|
var customProfileString = storage.getSetting("_CUSTOM_PROFILES");
|
|
|
|
if(customProfileString === undefined) customProfileString = "[]";
|
|
|
|
loadCustomProfilesString(customProfileString);
|
2013-12-28 00:21:12 +01:00
|
|
|
}
|
|
|
|
|
2014-05-18 22:23:19 +02:00
|
|
|
function loadCustomProfilesString(customProfilesString){
|
|
|
|
var customProfiles = JSON.parse(customProfilesString);
|
|
|
|
for (var i=0; i<customProfiles.length; i++) {
|
|
|
|
var profile = customProfiles[i];
|
|
|
|
console.log("Loading custom profile: " + JSON.stringify(profile));
|
|
|
|
profiles_list.append(profile);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function composeCustomProfilesString(){
|
|
|
|
var customProfiles = []
|
2013-12-28 03:40:45 +01:00
|
|
|
for(var i=0; i<profileslist.count; i++){
|
2014-05-18 22:23:19 +02:00
|
|
|
var profile = profileslist.get(i);
|
|
|
|
if(profile.builtin) continue;
|
|
|
|
customProfiles.push({text: profile.text, obj_string: profile.obj_string, builtin: false})
|
2013-12-28 03:40:45 +01:00
|
|
|
}
|
2014-05-18 22:23:19 +02:00
|
|
|
return JSON.stringify(customProfiles);
|
|
|
|
}
|
2013-12-28 03:40:45 +01:00
|
|
|
|
2014-05-18 22:23:19 +02:00
|
|
|
function loadProfile(index){
|
|
|
|
var profile = profileslist.get(index);
|
|
|
|
loadProfileString(profile.obj_string);
|
|
|
|
}
|
|
|
|
|
|
|
|
function addNewCustomProfile(name){
|
|
|
|
var profileString = composeProfileString();
|
|
|
|
profileslist.append({text: name, obj_string: profileString, builtin: false});
|
|
|
|
}
|
|
|
|
|
|
|
|
Component.onCompleted: {
|
|
|
|
loadSettings();
|
|
|
|
loadCustomProfiles();
|
2013-12-28 00:21:12 +01:00
|
|
|
}
|
|
|
|
Component.onDestruction: {
|
2014-05-18 22:23:19 +02:00
|
|
|
storeSettings();
|
|
|
|
storeCustomProfiles();
|
2014-03-31 22:23:48 +02:00
|
|
|
//storage.dropSettings(); //DROPS THE SETTINGS!.. REMEMBER TO DISABLE ONCE ENABLED!!
|
2013-12-28 03:40:45 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
ListModel{
|
2014-03-22 11:11:27 +01:00
|
|
|
id: profileslist
|
|
|
|
ListElement{
|
|
|
|
text: "Default"
|
2014-05-31 21:28:25 +02:00
|
|
|
obj_string: '{"background_color":"#000000","bloom_strength":0.6,"brightness_flickering":0.12,"font_color":"#ff9400","font_index":0,"frames_index":1,"glowing_line_strength":0.4,"horizontal_sincronization":0.1,"motion_blur":0.65,"noise_strength":0.1,"rasterization":1,"screen_distortion":0.15}'
|
2014-05-18 22:23:19 +02:00
|
|
|
builtin: true
|
|
|
|
}
|
|
|
|
ListElement{
|
|
|
|
text: "Commodore 64"
|
|
|
|
obj_string: '{"ambient_light":0.2,"background_color":"#5048b2","font_color":"#8bcad1","font_index":2,"font_scaling":1,"frames_index":1,"glowing_line_strength":0.2,"noise_strength":0.05,"scanlines":0.0,"screen_distortion":0.1,"brightness_flickering":0.03}'
|
|
|
|
builtin: true
|
|
|
|
}
|
|
|
|
ListElement{
|
|
|
|
text: "IBM Dos"
|
|
|
|
obj_string: '{"ambient_light":0.4,"background_color":"#000000","font_color":"#ffffff","font_index":3,"font_scaling":1,"frames_index":1,"glowing_line_strength":0,"noise_strength":0,"scanlines":0.0,"screen_distortion":0.05,"brightness_flickering":0.00}'
|
|
|
|
builtin: true
|
2014-03-22 11:11:27 +01:00
|
|
|
}
|
2013-12-28 00:21:12 +01:00
|
|
|
}
|
2013-11-23 16:09:46 +01:00
|
|
|
}
|