1
0
mirror of https://github.com/Swordfish90/cool-retro-term.git synced 2025-11-01 23:52:06 +00:00

Refactoting: change names in settings, and using camelCase for settings name.

This commit is contained in:
Filippo Scognamiglio
2014-12-23 18:13:34 +01:00
parent 9d5896b62c
commit 4d3c16fabc
13 changed files with 257 additions and 257 deletions

View File

@@ -31,44 +31,44 @@ QtObject{
property bool showMenubar: true
property real windowOpacity: 1.0
property real ambient_light: 0.2
property real ambientLight: 0.2
property real contrast: 0.85
property real brightness: 0.5
property bool show_terminal_size: true
property real window_scaling: 1.0
property bool showTerminalSize: true
property real windowScaling: 1.0
property real fps: 24
property bool verbose: false
onWindow_scalingChanged: handleFontChanged();
onWindowScalingChanged: handleFontChanged();
// PROFILE SETTINGS ///////////////////////////////////////////////////////
property string _background_color: "#000000"
property string _font_color: "#ff8100"
property string saturated_color: Utils.mix(Utils.strToColor("#FFFFFF"), Utils.strToColor(_font_color), saturation_color * 0.5)
property color font_color: Utils.mix(Utils.strToColor(saturated_color), Utils.strToColor(_background_color), 0.7 + (contrast * 0.3))
property color background_color: Utils.mix(Utils.strToColor(_background_color), Utils.strToColor(saturated_color), 0.7 + (contrast * 0.3))
property string _backgroundColor: "#000000"
property string _fontColor: "#ff8100"
property string saturatedColor: Utils.mix(Utils.strToColor("#FFFFFF"), Utils.strToColor(_fontColor), saturationColor * 0.5)
property color fontColor: Utils.mix(Utils.strToColor(saturatedColor), Utils.strToColor(_backgroundColor), 0.7 + (contrast * 0.3))
property color backgroundColor: Utils.mix(Utils.strToColor(_backgroundColor), Utils.strToColor(saturatedColor), 0.7 + (contrast * 0.3))
property real noise_strength: 0.1
property real screen_distortion: 0.1
property real glowing_line_strength: 0.2
property real motion_blur: 0.40
property real bloom_strength: 0.65
property real staticNoise: 0.1
property real screenCurvature: 0.1
property real glowingLine: 0.2
property real burnIn: 0.40
property real bloom: 0.65
property real bloom_quality: 0.5
property real blur_quality: 0.5
property real bloomQuality: 0.5
property real burnInQuality: 0.5
property real chroma_color: 0.0
property real saturation_color: 0.0
property real chromaColor: 0.0
property real saturationColor: 0.0
property real jitter: 0.18
property real horizontal_sincronization: 0.08
property real brightness_flickering: 0.1
property real horizontalSync: 0.08
property real flickering: 0.1
property real rgb_shift: 0.0
property real rbgShift: 0.0
readonly property int no_rasterization: 0
readonly property int scanline_rasterization: 1
@@ -76,7 +76,7 @@ QtObject{
property int rasterization: no_rasterization
property int profiles_index: 0
property int profilesIndex: 0
// FONTS //////////////////////////////////////////////////////////////////
@@ -129,7 +129,7 @@ QtObject{
if (index === undefined) return;
fontManager.item.selectedFontIndex = index;
fontManager.item.scaling = fontScaling * window_scaling;
fontManager.item.scaling = fontScaling * windowScaling;
var fontSource = fontManager.item.source;
var pixelSize = fontManager.item.pixelSize;
@@ -143,17 +143,17 @@ QtObject{
// FRAMES /////////////////////////////////////////////////////////////////
property bool _frameReflections: false
property bool reflectionsAllowed: frames_list.get(frames_index).reflections
property bool reflectionsAllowed: framesList.get(framesIndex).reflections
property bool frameReflections: _frameReflections && reflectionsAllowed
property ListModel frames_list: ListModel{
property ListModel framesList: ListModel{
ListElement{text: "No frame"; source: ""; reflections: false}
ListElement{text: "Simple white frame"; source: "./frames/WhiteSimpleFrame.qml"; reflections: true}
ListElement{text: "Rough black frame"; source: "./frames/BlackRoughFrame.qml"; reflections: true}
}
property string frame_source: frames_list.get(frames_index).source
property int frames_index: 1
property string frameSource: framesList.get(framesIndex).source
property int framesIndex: 1
// DB STORAGE /////////////////////////////////////////////////////////////
@@ -169,38 +169,38 @@ QtObject{
function composeSettingsString(){
var settings = {
fps: fps,
window_scaling: window_scaling,
show_terminal_size: show_terminal_size,
windowScaling: windowScaling,
showTerminalSize: showTerminalSize,
fontScaling: fontScaling,
fontNames: fontNames,
frameReflections: _frameReflections,
showMenubar: showMenubar,
bloom_quality: bloom_quality,
blur_quality: blur_quality
bloomQuality: bloomQuality,
burnInQuality: burnInQuality
}
return 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,
chroma_color: chroma_color,
saturation_color: saturation_color,
screen_distortion: screen_distortion,
glowing_line_strength: glowing_line_strength,
frames_index: frames_index,
motion_blur: motion_blur,
bloom_strength: bloom_strength,
backgroundColor: _backgroundColor,
fontColor: _fontColor,
flickering: flickering,
horizontalSync: horizontalSync,
staticNoise: staticNoise,
chromaColor: chromaColor,
saturationColor: saturationColor,
screenCurvature: screenCurvature,
glowingLine: glowingLine,
framesIndex: framesIndex,
burnIn: burnIn,
bloom: bloom,
rasterization: rasterization,
jitter: jitter,
rgb_shift: rgb_shift,
rbgShift: rbgShift,
brightness: brightness,
contrast: contrast,
ambient_light: ambient_light,
ambientLight: ambientLight,
windowOpacity: windowOpacity,
fontName: fontNames[rasterization],
fontWidth: fontWidth
@@ -238,10 +238,10 @@ QtObject{
function loadSettingsString(settingsString){
var settings = JSON.parse(settingsString);
show_terminal_size = settings.show_terminal_size !== undefined ? settings.show_terminal_size : show_terminal_size
showTerminalSize = settings.showTerminalSize !== undefined ? settings.showTerminalSize : showTerminalSize
fps = settings.fps !== undefined ? settings.fps: fps
window_scaling = settings.window_scaling !== undefined ? settings.window_scaling : window_scaling
windowScaling = settings.windowScaling !== undefined ? settings.windowScaling : windowScaling
fontNames = settings.fontNames !== undefined ? settings.fontNames : fontNames
fontScaling = settings.fontScaling !== undefined ? settings.fontScaling : fontScaling
@@ -250,36 +250,36 @@ QtObject{
showMenubar = settings.showMenubar !== undefined ? settings.showMenubar : showMenubar;
bloom_quality = settings.bloom_quality !== undefined ? settings.bloom_quality : bloom_quality;
blur_quality = settings.blur_quality !== undefined ? settings.blur_quality : blur_quality;
bloomQuality = settings.bloomQuality !== undefined ? settings.bloomQuality : bloomQuality;
burnInQuality = settings.burnInQuality !== undefined ? settings.burnInQuality : burnInQuality;
}
function loadProfileString(profileString){
var settings = JSON.parse(profileString);
_background_color = settings.background_color !== undefined ? settings.background_color : _background_color;
_font_color = settings.font_color !== undefined ? settings.font_color : _font_color;
_backgroundColor = settings.backgroundColor !== undefined ? settings.backgroundColor : _backgroundColor;
_fontColor = settings.fontColor !== undefined ? settings.fontColor : _fontColor;
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;
chroma_color = settings.chroma_color !== undefined ? settings.chroma_color : chroma_color;
saturation_color = settings.saturation_color !== undefined ? settings.saturation_color : saturation_color;
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;
horizontalSync = settings.horizontalSync !== undefined ? settings.horizontalSync : horizontalSync
flickering = settings.flickering !== undefined ? settings.flickering : flickering;
staticNoise = settings.staticNoise !== undefined ? settings.staticNoise : staticNoise;
chromaColor = settings.chromaColor !== undefined ? settings.chromaColor : chromaColor;
saturationColor = settings.saturationColor !== undefined ? settings.saturationColor : saturationColor;
screenCurvature = settings.screenCurvature !== undefined ? settings.screenCurvature : screenCurvature;
glowingLine = settings.glowingLine !== undefined ? settings.glowingLine : glowingLine;
motion_blur = settings.motion_blur !== undefined ? settings.motion_blur : motion_blur
bloom_strength = settings.bloom_strength !== undefined ? settings.bloom_strength : bloom_strength
burnIn = settings.burnIn !== undefined ? settings.burnIn : burnIn
bloom = settings.bloom !== undefined ? settings.bloom : bloom
frames_index = settings.frames_index !== undefined ? settings.frames_index : frames_index;
framesIndex = settings.framesIndex !== undefined ? settings.framesIndex : framesIndex;
rasterization = settings.rasterization !== undefined ? settings.rasterization : rasterization;
jitter = settings.jitter !== undefined ? settings.jitter : jitter;
rgb_shift = settings.rgb_shift !== undefined ? settings.rgb_shift : rgb_shift;
rbgShift = settings.rbgShift !== undefined ? settings.rbgShift : rbgShift;
ambient_light = settings.ambient_light !== undefined ? settings.ambient_light : ambient_light;
ambientLight = settings.ambientLight !== undefined ? settings.ambientLight : ambientLight;
contrast = settings.contrast !== undefined ? settings.contrast : contrast;
brightness = settings.brightness !== undefined ? settings.brightness : brightness;
windowOpacity = settings.windowOpacity !== undefined ? settings.windowOpacity : windowOpacity;
@@ -303,14 +303,14 @@ QtObject{
for (var i=0; i<customProfiles.length; i++) {
var profile = customProfiles[i];
console.log("Loading custom profile: " + stringify(profile));
profiles_list.append(profile);
profilesList.append(profile);
}
}
function composeCustomProfilesString(){
var customProfiles = []
for(var i=0; i<profiles_list.count; i++){
var profile = profiles_list.get(i);
for(var i=0; i<profilesList.count; i++){
var profile = profilesList.get(i);
if(profile.builtin) continue;
customProfiles.push({text: profile.text, obj_string: profile.obj_string, builtin: false})
}
@@ -318,72 +318,72 @@ QtObject{
}
function loadCurrentProfile(){
loadProfile(profiles_index);
loadProfile(profilesIndex);
}
function loadProfile(index){
var profile = profiles_list.get(index);
var profile = profilesList.get(index);
loadProfileString(profile.obj_string);
}
function addNewCustomProfile(name){
var profileString = composeProfileString();
profiles_list.append({text: name, obj_string: profileString, builtin: false});
profilesList.append({text: name, obj_string: profileString, builtin: false});
}
// PROFILES ///////////////////////////////////////////////////////////////
property ListModel profiles_list: ListModel{
property ListModel profilesList: ListModel{
ListElement{
text: "Default Amber"
obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.65,"brightness":0.5,"brightness_flickering":0.1,"contrast":0.85,"fontName":"TERMINUS","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,"chroma_color":0,"saturation_color":0,"rgb_shift":0,"fontWidth":1.0}'
obj_string: '{"ambientLight":0.2,"backgroundColor":"#000000","bloom":0.65,"brightness":0.5,"flickering":0.1,"contrast":0.85,"fontName":"TERMINUS","fontColor":"#ff8100","framesIndex":1,"glowingLine":0.2,"horizontalSync":0.08,"jitter":0.18,"burnIn":0.4,"staticNoise":0.1,"rasterization":0,"screenCurvature":0.1,"windowOpacity":1,"chromaColor":0,"saturationColor":0,"rbgShift":0,"fontWidth":1.0}'
builtin: true
}
ListElement{
text: "Default Green"
obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.4,"brightness":0.5,"brightness_flickering":0.1,"contrast":0.85,"fontName":"TERMINUS","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,"chroma_color":0,"saturation_color":0,"rgb_shift":0,"fontWidth":1.0}'
obj_string: '{"ambientLight":0.2,"backgroundColor":"#000000","bloom":0.4,"brightness":0.5,"flickering":0.1,"contrast":0.85,"fontName":"TERMINUS","fontColor":"#0ccc68","framesIndex":1,"glowingLine":0.2,"horizontalSync":0.08,"jitter":0.18,"burnIn":0.45,"staticNoise":0.1,"rasterization":0,"screenCurvature":0.1,"windowOpacity":1,"chromaColor":0,"saturationColor":0,"rbgShift":0,"fontWidth":1.0}'
builtin: true
}
ListElement{
text: "Default Scanlines"
obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.4,"brightness":0.5,"brightness_flickering":0.1,"contrast":0.85,"fontName":"TERMINUS","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,"chroma_color":0,"saturation_color":0,"rgb_shift":0,"fontWidth":1.0}'
obj_string: '{"ambientLight":0.2,"backgroundColor":"#000000","bloom":0.4,"brightness":0.5,"flickering":0.1,"contrast":0.85,"fontName":"TERMINUS","fontColor":"#00ff5b","framesIndex":1,"glowingLine":0.2,"horizontalSync":0.07,"jitter":0.11,"burnIn":0.4,"staticNoise":0.05,"rasterization":1,"screenCurvature":0.1,"windowOpacity":1,"chromaColor":0,"saturationColor":0,"rbgShift":0,"fontWidth":1.0}'
builtin: true
}
ListElement{
text: "Default Pixelated"
obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.4,"brightness":0.5,"brightness_flickering":0.1,"contrast":0.85,"fontName":"TERMINUS","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,"chroma_color":0,"saturation_color":0,"rgb_shift":0,"fontWidth":1.0}'
obj_string: '{"ambientLight":0.2,"backgroundColor":"#000000","bloom":0.4,"brightness":0.5,"flickering":0.1,"contrast":0.85,"fontName":"TERMINUS","fontColor":"#ff8100","framesIndex":1,"glowingLine":0.2,"horizontalSync":0.1,"jitter":0,"burnIn":0.45,"staticNoise":0.14,"rasterization":2,"screenCurvature":0.05,"windowOpacity":1,"chromaColor":0,"saturationColor":0,"rbgShift":0,"fontWidth":1.0}'
builtin: true
}
ListElement{
text: "Apple ]["
obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.5,"brightness":0.5,"brightness_flickering":0.2,"contrast":0.85,"fontName":"APPLE_II","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,"chroma_color":0,"saturation_color":0,"rgb_shift":0,"fontWidth":1.0}'
obj_string: '{"ambientLight":0.2,"backgroundColor":"#000000","bloom":0.5,"brightness":0.5,"flickering":0.2,"contrast":0.85,"fontName":"APPLE_II","fontColor":"#2fff91","framesIndex":1,"glowingLine":0.22,"horizontalSync":0.08,"jitter":0.1,"burnIn":0.65,"staticNoise":0.08,"rasterization":1,"screenCurvature":0.18,"windowOpacity":1,"chromaColor":0,"saturationColor":0,"rbgShift":0,"fontWidth":1.0}'
builtin: true
}
ListElement{
text: "Vintage"
obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.4,"brightness":0.5,"brightness_flickering":0.54,"contrast":0.85,"fontName":"TERMINUS","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,"chroma_color":0,"saturation_color":0,"rgb_shift":0,"fontWidth":1.0}'
obj_string: '{"ambientLight":0.2,"backgroundColor":"#000000","bloom":0.4,"brightness":0.5,"flickering":0.54,"contrast":0.85,"fontName":"TERMINUS","fontColor":"#00ff3e","framesIndex":2,"glowingLine":0.3,"horizontalSync":0.2,"jitter":0.4,"burnIn":0.75,"staticNoise":0.2,"rasterization":1,"screenCurvature":0.1,"windowOpacity":1,"chromaColor":0,"saturationColor":0,"rbgShift":0,"fontWidth":1.0}'
builtin: true
}
ListElement{
text: "IBM Dos"
obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.4,"brightness":0.5,"brightness_flickering":0.07,"contrast":0.85,"fontName":"IBM_DOS","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,"chroma_color":1,"saturation_color":0,"rgb_shift":0.5,"fontWidth":1.0}'
obj_string: '{"ambientLight":0.2,"backgroundColor":"#000000","bloom":0.4,"brightness":0.5,"flickering":0.07,"contrast":0.85,"fontName":"IBM_DOS","fontColor":"#ffffff","framesIndex":1,"glowingLine":0.13,"horizontalSync":0,"jitter":0.08,"burnIn":0.3,"staticNoise":0.03,"rasterization":0,"screenCurvature":0.1,"windowOpacity":1,"chromaColor":1,"saturationColor":0,"rbgShift":0.5,"fontWidth":1.0}'
builtin: true
}
ListElement{
text: "IBM 3278"
obj_string: '{"ambient_light":0.1,"background_color":"#000000","bloom_strength":0.15,"brightness":0.5,"brightness_flickering":0,"contrast":0.95,"fontName":"IBM_3278","font_color":"#0ccc68","frames_index":1,"glowing_line_strength":0,"horizontal_sincronization":0,"jitter":0,"motion_blur":0.6,"noise_strength":0,"rasterization":0,"screen_distortion":0.1,"windowOpacity":1,"chroma_color":0,"saturation_color":0,"rgb_shift":0,"fontWidth":1.0}'
obj_string: '{"ambientLight":0.1,"backgroundColor":"#000000","bloom":0.15,"brightness":0.5,"flickering":0,"contrast":0.95,"fontName":"IBM_3278","fontColor":"#0ccc68","framesIndex":1,"glowingLine":0,"horizontalSync":0,"jitter":0,"burnIn":0.6,"staticNoise":0,"rasterization":0,"screenCurvature":0.1,"windowOpacity":1,"chromaColor":0,"saturationColor":0,"rbgShift":0,"fontWidth":1.0}'
builtin: true
}
ListElement{
text: "Transparent Green"
obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.45,"brightness":0.5,"brightness_flickering":0.20,"contrast":0.85,"fontName":"TERMINUS","font_color":"#0ccc68","frames_index":0,"glowing_line_strength":0.16,"horizontal_sincronization":0.05,"jitter":0.20,"motion_blur":0.25,"noise_strength":0.20,"rasterization":0,"screen_distortion":0.05,"windowOpacity":0.60,"chroma_color":0,"saturation_color":0,"rgb_shift":0,"fontWidth":1.0}'
obj_string: '{"ambientLight":0.2,"backgroundColor":"#000000","bloom":0.45,"brightness":0.5,"flickering":0.20,"contrast":0.85,"fontName":"TERMINUS","fontColor":"#0ccc68","framesIndex":0,"glowingLine":0.16,"horizontalSync":0.05,"jitter":0.20,"burnIn":0.25,"staticNoise":0.20,"rasterization":0,"screenCurvature":0.05,"windowOpacity":0.60,"chromaColor":0,"saturationColor":0,"rbgShift":0,"fontWidth":1.0}'
builtin: true
}
}
function getProfileIndexByName(name) {
for (var i = 0; i < profiles_list.count; i++) {
if(profiles_list.get(i).text === name)
for (var i = 0; i < profilesList.count; i++) {
if(profilesList.get(i).text === name)
return i;
}
return -1;