From c35cb6cf457337f8ba0d8b840ce9ce88f2f67211 Mon Sep 17 00:00:00 2001 From: Filippo Scognamiglio Date: Tue, 23 Dec 2014 13:58:22 +0100 Subject: [PATCH 01/16] Fix: horizontal sync should not go outside screen boundaries. --- app/qml/ShaderTerminal.qml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/qml/ShaderTerminal.qml b/app/qml/ShaderTerminal.qml index 22e81ec..328aac9 100644 --- a/app/qml/ShaderTerminal.qml +++ b/app/qml/ShaderTerminal.qml @@ -232,9 +232,11 @@ ShaderEffect { (screen_distorsion !== 0 ? " float distortion = dot(cc, cc) * screen_distorsion; - vec2 coords = (qt_TexCoord0 - cc * (1.0 + distortion) * distortion);" + vec2 staticCoords = (qt_TexCoord0 - cc * (1.0 + distortion) * distortion);" :" - vec2 coords = qt_TexCoord0;") + + vec2 staticCoords = qt_TexCoord0;") + + + "vec2 coords = staticCoords;" + (horizontal_sincronization !== 0 ? " float dst = sin((coords.y + time * 0.001) * distortionFreq); @@ -298,8 +300,8 @@ ShaderEffect { "finalColor += bloomColor * bloom_strength * bloomAlpha;" : "") + - "finalColor *= smoothstep(-dispX, 0.0, coords.x) - smoothstep(1.0, 1.0 + dispX, coords.x); - finalColor *= smoothstep(-dispY, 0.0, coords.y) - smoothstep(1.0, 1.0 + dispY, coords.y);" + + "finalColor *= smoothstep(-dispX, 0.0, staticCoords.x) - smoothstep(1.0, 1.0 + dispX, staticCoords.x); + finalColor *= smoothstep(-dispY, 0.0, staticCoords.y) - smoothstep(1.0, 1.0 + dispY, staticCoords.y);" + (brightness_flickering !== 0 ? " finalColor *= brightness;" : "") + From 23a1033787860e1434274c170817f5f73827e2b9 Mon Sep 17 00:00:00 2001 From: Filippo Scognamiglio Date: Tue, 23 Dec 2014 14:02:46 +0100 Subject: [PATCH 02/16] Refactor: different platforms contextual menus. --- app/qml/PreprocessedTerminal.qml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/app/qml/PreprocessedTerminal.qml b/app/qml/PreprocessedTerminal.qml index 91d4035..0e9c361 100644 --- a/app/qml/PreprocessedTerminal.qml +++ b/app/qml/PreprocessedTerminal.qml @@ -149,9 +149,9 @@ Item{ id: contextmenu MenuItem{action: copyAction} MenuItem{action: pasteAction} - MenuSeparator{visible: Qt.platform.os !== "osx"} - MenuItem{action: fullscreenAction; visible: Qt.platform.os !== "osx"} - MenuItem{action: showMenubarAction; visible: Qt.platform.os !== "osx"} + MenuSeparator{} + MenuItem{action: fullscreenAction} + MenuItem{action: showMenubarAction} MenuSeparator{visible: !appSettings.showMenubar} CRTMainMenuBar{visible: !appSettings.showMenubar} } @@ -162,9 +162,6 @@ Item{ id: contextmenu MenuItem{action: copyAction} MenuItem{action: pasteAction} - MenuSeparator{visible: Qt.platform.os !== "osx"} - MenuItem{action: fullscreenAction; visible: Qt.platform.os !== "osx"} - MenuItem{action: showMenubarAction; visible: Qt.platform.os !== "osx"} } } Loader { From 9d5896b62c6a017836da7e7c27801ccc0b70c904 Mon Sep 17 00:00:00 2001 From: Filippo Scognamiglio Date: Tue, 23 Dec 2014 17:07:10 +0100 Subject: [PATCH 03/16] Improvement: allow arguments to be passed to the process launched with the terminal. --- app/main.cpp | 25 +++++++++++++++++-------- app/qml/PreprocessedTerminal.qml | 7 ++++--- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/app/main.cpp b/app/main.cpp index c648430..a5893b3 100644 --- a/app/main.cpp +++ b/app/main.cpp @@ -31,18 +31,27 @@ int main(int argc, char *argv[]) QStringList args = app.arguments(); if (args.contains("-h") || args.contains("--help")) { qDebug() << "Usage: " + args.at(0) + " [--default-settings] [--workdir ] [--program ] [-p|--profile ] [--fullscreen] [-h|--help]"; - qDebug() << " --default-settings Run cool-retro-term with the default settings"; - qDebug() << " --workdir Change working directory to 'dir'"; - qDebug() << " --program Run the 'prog' in the new terminal."; - qDebug() << " --fullscreen Run cool-retro-term in fullscreen."; - qDebug() << " -p|--profile Run cool-retro-term with the given profile."; - qDebug() << " -h|--help Print this help."; - qDebug() << " --verbose Print additional informations such as profiles and settings."; + qDebug() << " --default-settings Run cool-retro-term with the default settings"; + qDebug() << " --workdir Change working directory to 'dir'"; + qDebug() << " -e Command to execute. This option will catch all following arguments, so use it as the last option."; + qDebug() << " --fullscreen Run cool-retro-term in fullscreen."; + qDebug() << " -p|--profile Run cool-retro-term with the given profile."; + qDebug() << " -h|--help Print this help."; + qDebug() << " --verbose Print additional informations such as profiles and settings."; return 0; } + // Manage default command + QStringList cmdList; + if (args.contains("-e")) { + cmdList << args.mid(args.indexOf("-e") + 1); + } + QVariant command(cmdList.empty() ? QVariant() : cmdList[0]); + QVariant commandArgs(cmdList.size() <= 1 ? QVariant() : QVariant(cmdList.mid(1))); + engine.rootContext()->setContextProperty("defaultCmd", command); + engine.rootContext()->setContextProperty("defaultCmdArgs", commandArgs); + engine.rootContext()->setContextProperty("workdir", getNamedArgument(args, "--workdir", "$HOME")); - engine.rootContext()->setContextProperty("shellProgram", getNamedArgument(args, "--program")); // Manage import paths for Linux and OSX. QStringList importPathList = engine.importPathList(); diff --git a/app/qml/PreprocessedTerminal.qml b/app/qml/PreprocessedTerminal.qml index 0e9c361..911b93e 100644 --- a/app/qml/PreprocessedTerminal.qml +++ b/app/qml/PreprocessedTerminal.qml @@ -129,9 +129,10 @@ Item{ appSettings.terminalFontChanged.connect(handleFontChange); // Retrieve the variable set in main.cpp if arguments are passed. - if (shellProgram) { - ksession.setShellProgram(shellProgram); - } else if (!shellProgram && Qt.platform.os === "osx") { + if (defaultCmd) { + ksession.setShellProgram(defaultCmd); + ksession.setArgs(defaultCmdArgs); + } else if (!defaultCmd && Qt.platform.os === "osx") { // OSX Requires the following default parameters for auto login. ksession.setArgs(["-i", "-l"]); } From 4d3c16fabcbdd72f0720e1c137bb63f82146d197 Mon Sep 17 00:00:00 2001 From: Filippo Scognamiglio Date: Tue, 23 Dec 2014 18:13:34 +0100 Subject: [PATCH 04/16] Refactoting: change names in settings, and using camelCase for settings name. --- app/qml/ApplicationSettings.qml | 162 ++++++++++++------------- app/qml/CRTMainMenuBar.qml | 2 +- app/qml/InsertNameDialog.qml | 2 +- app/qml/PreprocessedTerminal.qml | 18 +-- app/qml/SettingsEffectsTab.qml | 56 ++++----- app/qml/SettingsGeneralTab.qml | 16 +-- app/qml/SettingsPerformanceTab.qml | 18 +-- app/qml/SettingsTerminalTab.qml | 18 +-- app/qml/ShaderTerminal.qml | 158 ++++++++++++------------ app/qml/Storage.qml | 2 +- app/qml/TerminalContainer.qml | 20 +-- app/qml/frames/utils/TerminalFrame.qml | 32 ++--- app/qml/main.qml | 10 +- 13 files changed, 257 insertions(+), 257 deletions(-) diff --git a/app/qml/ApplicationSettings.qml b/app/qml/ApplicationSettings.qml index 24f8214..e790c35 100644 --- a/app/qml/ApplicationSettings.qml +++ b/app/qml/ApplicationSettings.qml @@ -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 Date: Wed, 24 Dec 2014 15:41:08 +0100 Subject: [PATCH 05/16] Fix: font was not updated when profile changed. --- app/qml/SettingsTerminalTab.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/qml/SettingsTerminalTab.qml b/app/qml/SettingsTerminalTab.qml index 0748aa4..578e590 100644 --- a/app/qml/SettingsTerminalTab.qml +++ b/app/qml/SettingsTerminalTab.qml @@ -63,7 +63,7 @@ Tab{ } Connections{ target: appSettings - onRasterizationChanged: fontChanger.updateIndex(); + onTerminalFontChanged: fontChanger.updateIndex(); } Component.onCompleted: updateIndex(); } From f03fa298367c2838a7553eb86748b277762929d5 Mon Sep 17 00:00:00 2001 From: Filippo Scognamiglio Date: Fri, 26 Dec 2014 00:00:35 +0100 Subject: [PATCH 06/16] Improvement: index frames by name and not position. --- app/qml/ApplicationSettings.qml | 71 +++++++++++++++++++++++---------- app/qml/SettingsGeneralTab.qml | 15 ++++++- 2 files changed, 64 insertions(+), 22 deletions(-) diff --git a/app/qml/ApplicationSettings.qml b/app/qml/ApplicationSettings.qml index e790c35..ee9b704 100644 --- a/app/qml/ApplicationSettings.qml +++ b/app/qml/ApplicationSettings.qml @@ -109,7 +109,7 @@ QtObject{ if (name === fontlist.get(i).name) return i; } - return 0; // If the font is not available returns the first one. + return 0; // If the font is not available default to 0. } function incrementScaling(){ @@ -142,18 +142,47 @@ QtObject{ // FRAMES ///////////////////////////////////////////////////////////////// - property bool _frameReflections: false - property bool reflectionsAllowed: framesList.get(framesIndex).reflections - property bool frameReflections: _frameReflections && reflectionsAllowed - 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} + ListElement{ + name: "NO_FRAME" + text: "No frame" + source: "" + reflections: false + } + ListElement{ + name: "SIMPLE_WHITE_FRAME" + text: "Simple white frame" + source: "./frames/WhiteSimpleFrame.qml" + reflections: true + } + ListElement{ + name: "ROUGH_BLACK_FRAME" + text: "Rough black frame" + source: "./frames/BlackRoughFrame.qml" + reflections: true + } } - property string frameSource: framesList.get(framesIndex).source - property int framesIndex: 1 + function getFrameIndexByName(name) { + for (var i = 0; i < framesList.count; i++) { + if (name === framesList.get(i).name) + return i; + } + return 0; // If the frame is not available default to 0. + } + + property string frameSource: "./frames/WhiteSimpleFrame.qml" + property string frameName: "SIMPLE_WHITE_FRAME" + + property bool _frameReflections: false + property bool reflectionsAllowed: true + property bool frameReflections: _frameReflections && reflectionsAllowed + + onFrameNameChanged: { + var index = getFrameIndexByName(frameName); + frameSource = framesList.get(index).source; + reflectionsAllowed = framesList.get(index).reflections; + } // DB STORAGE ///////////////////////////////////////////////////////////// @@ -192,7 +221,7 @@ QtObject{ saturationColor: saturationColor, screenCurvature: screenCurvature, glowingLine: glowingLine, - framesIndex: framesIndex, + frameName: frameName, burnIn: burnIn, bloom: bloom, rasterization: rasterization, @@ -271,7 +300,7 @@ QtObject{ burnIn = settings.burnIn !== undefined ? settings.burnIn : burnIn bloom = settings.bloom !== undefined ? settings.bloom : bloom - framesIndex = settings.framesIndex !== undefined ? settings.framesIndex : framesIndex; + frameName = settings.frameName !== undefined ? settings.frameName : frameName; rasterization = settings.rasterization !== undefined ? settings.rasterization : rasterization; @@ -336,47 +365,47 @@ QtObject{ property ListModel profilesList: ListModel{ ListElement{ text: "Default Amber" - 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}' + obj_string: '{"ambientLight":0.2,"backgroundColor":"#000000","bloom":0.65,"brightness":0.5,"flickering":0.1,"contrast":0.85,"fontName":"TERMINUS","fontColor":"#ff8100","frameName":"SIMPLE_WHITE_FRAME","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: '{"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}' + obj_string: '{"ambientLight":0.2,"backgroundColor":"#000000","bloom":0.4,"brightness":0.5,"flickering":0.1,"contrast":0.85,"fontName":"TERMINUS","fontColor":"#0ccc68","frameName":"SIMPLE_WHITE_FRAME","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: '{"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}' + obj_string: '{"ambientLight":0.2,"backgroundColor":"#000000","bloom":0.4,"brightness":0.5,"flickering":0.1,"contrast":0.85,"fontName":"TERMINUS","fontColor":"#00ff5b","frameName":"SIMPLE_WHITE_FRAME","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: '{"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}' + obj_string: '{"ambientLight":0.2,"backgroundColor":"#000000","bloom":0.4,"brightness":0.5,"flickering":0.1,"contrast":0.85,"fontName":"TERMINUS","fontColor":"#ff8100","frameName":"SIMPLE_WHITE_FRAME","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: '{"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}' + obj_string: '{"ambientLight":0.2,"backgroundColor":"#000000","bloom":0.5,"brightness":0.5,"flickering":0.2,"contrast":0.85,"fontName":"APPLE_II","fontColor":"#2fff91","frameName":"SIMPLE_WHITE_FRAME","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: '{"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}' + obj_string: '{"ambientLight":0.2,"backgroundColor":"#000000","bloom":0.4,"brightness":0.5,"flickering":0.54,"contrast":0.85,"fontName":"TERMINUS","fontColor":"#00ff3e","frameName":"ROUGH_BLACK_FRAME","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: '{"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}' + obj_string: '{"ambientLight":0.2,"backgroundColor":"#000000","bloom":0.4,"brightness":0.5,"flickering":0.07,"contrast":0.85,"fontName":"IBM_DOS","fontColor":"#ffffff","frameName":"SIMPLE_WHITE_FRAME","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: '{"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}' + obj_string: '{"ambientLight":0.1,"backgroundColor":"#000000","bloom":0.15,"brightness":0.5,"flickering":0,"contrast":0.95,"fontName":"IBM_3278","fontColor":"#0ccc68","frameName":"SIMPLE_WHITE_FRAME","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: '{"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}' + obj_string: '{"ambientLight":0.2,"backgroundColor":"#000000","bloom":0.45,"brightness":0.5,"flickering":0.20,"contrast":0.85,"fontName":"TERMINUS","fontColor":"#0ccc68","frameName":"NO_FRAME","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 } } diff --git a/app/qml/SettingsGeneralTab.qml b/app/qml/SettingsGeneralTab.qml index 0b77917..0f32fc5 100644 --- a/app/qml/SettingsGeneralTab.qml +++ b/app/qml/SettingsGeneralTab.qml @@ -101,7 +101,20 @@ Tab{ Layout.fillWidth: true model: appSettings.framesList currentIndex: appSettings.framesIndex - onCurrentIndexChanged: appSettings.framesIndex = currentIndex + onActivated: { + appSettings.frameName = appSettings.framesList.get(index).name; + } + function updateIndex(){ + var name = appSettings.frameName; + var index = appSettings.getFrameIndexByName(name); + if (index !== undefined) + currentIndex = index; + } + Component.onCompleted: updateIndex(); + Connections { + target: appSettings + onFrameNameChanged: framescombobox.updateIndex(); + } } } } From b1139a39119ab53cb776b9ef96b6fd3628932fbf Mon Sep 17 00:00:00 2001 From: Filippo Scognamiglio Date: Fri, 26 Dec 2014 00:44:32 +0100 Subject: [PATCH 07/16] Fix: tiny tiny fixes. --- app/qml/ApplicationSettings.qml | 5 ++++- app/qml/PreprocessedTerminal.qml | 1 + app/qml/SettingsPerformanceTab.qml | 34 ++++++++++++++++++++---------- 3 files changed, 28 insertions(+), 12 deletions(-) diff --git a/app/qml/ApplicationSettings.qml b/app/qml/ApplicationSettings.qml index ee9b704..627748b 100644 --- a/app/qml/ApplicationSettings.qml +++ b/app/qml/ApplicationSettings.qml @@ -331,7 +331,10 @@ QtObject{ var customProfiles = JSON.parse(customProfilesString); for (var i=0; i Date: Fri, 26 Dec 2014 02:28:51 +0100 Subject: [PATCH 08/16] Improvement: port profile selector to TableView. --- app/qml/ApplicationSettings.qml | 6 ---- app/qml/SettingsGeneralTab.qml | 52 +++++++++++++++++++++------------ 2 files changed, 34 insertions(+), 24 deletions(-) diff --git a/app/qml/ApplicationSettings.qml b/app/qml/ApplicationSettings.qml index 627748b..e31cbdf 100644 --- a/app/qml/ApplicationSettings.qml +++ b/app/qml/ApplicationSettings.qml @@ -76,8 +76,6 @@ QtObject{ property int rasterization: no_rasterization - property int profilesIndex: 0 - // FONTS ////////////////////////////////////////////////////////////////// property real fontScaling: 1.0 @@ -349,10 +347,6 @@ QtObject{ return stringify(customProfiles); } - function loadCurrentProfile(){ - loadProfile(profilesIndex); - } - function loadProfile(index){ var profile = profilesList.get(index); loadProfileString(profile.obj_string); diff --git a/app/qml/SettingsGeneralTab.qml b/app/qml/SettingsGeneralTab.qml index 0f32fc5..4391fb8 100644 --- a/app/qml/SettingsGeneralTab.qml +++ b/app/qml/SettingsGeneralTab.qml @@ -26,45 +26,61 @@ Tab{ ColumnLayout{ anchors.fill: parent GroupBox{ + anchors {left: parent.left; right: parent.right} Layout.fillWidth: true + Layout.fillHeight: true title: qsTr("Profile") - ColumnLayout{ + RowLayout { anchors.fill: parent - ComboBox{ - id: profilesbox + TableView { + id: profilesView Layout.fillWidth: true + anchors { top: parent.top; bottom: parent.bottom; } model: appSettings.profilesList - currentIndex: appSettings.profilesIndex + headerVisible: false + TableViewColumn { + title: qsTr("Profile") + role: "text" + width: parent.width * 0.5 + } + onActivated: { + appSettings.loadProfile(row); + } } - RowLayout{ - Layout.fillWidth: true + ColumnLayout { + anchors { top: parent.top; bottom: parent.bottom } + Layout.fillWidth: false Button{ Layout.fillWidth: true + property alias currentIndex: profilesView.currentRow + enabled: currentIndex >= 0 text: qsTr("Load") onClicked: { - appSettings.profilesIndex = profilesbox.currentIndex - appSettings.loadCurrentProfile(); - appSettings.handleFontChanged(); + var index = profilesView.currentRow; + if (index >= 0) + appSettings.loadProfile(index); } } Button{ Layout.fillWidth: true - text: qsTr("Save New Profile") + text: qsTr("New") onClicked: insertname.show() } Button{ Layout.fillWidth: true - text: qsTr("Remove Selected") - enabled: !appSettings.profilesList.get(profilesbox.currentIndex).builtin + text: qsTr("Remove") + property alias currentIndex: profilesView.currentRow + + enabled: currentIndex >= 0 && !appSettings.profilesList.get(currentIndex).builtin onClicked: { - appSettings.profilesList.remove(profilesbox.currentIndex) - profilesbox.currentIndex = profilesbox.currentIndex - 1 + appSettings.profilesList.remove(profilesView.currentRow); + profilesView.activated(currentIndex); } } - } - InsertNameDialog{ - id: insertname - onNameSelected: appSettings.addNewCustomProfile(name) + InsertNameDialog{ + id: insertname + onNameSelected: appSettings.addNewCustomProfile(name) + } } } } From 88079a3ee4f9e28e8763cc01f95f837c9391722e Mon Sep 17 00:00:00 2001 From: Filippo Scognamiglio Date: Fri, 26 Dec 2014 02:54:38 +0100 Subject: [PATCH 09/16] Improvement: initial implementation of profiles json IO. --- app/app.pro | 7 ++++- app/fileio.cpp | 37 +++++++++++++++++++++++ app/fileio.h | 21 +++++++++++++ app/main.cpp | 3 ++ app/qml/ApplicationSettings.qml | 8 +++-- app/qml/SettingsGeneralTab.qml | 53 +++++++++++++++++++++++++++++++++ 6 files changed, 126 insertions(+), 3 deletions(-) create mode 100644 app/fileio.cpp create mode 100644 app/fileio.h diff --git a/app/app.pro b/app/app.pro index f521a1f..33e1a9e 100644 --- a/app/app.pro +++ b/app/app.pro @@ -2,7 +2,12 @@ QT += qml quick widgets sql TARGET = cool-retro-term DESTDIR = $$OUT_PWD/../ -SOURCES = main.cpp + +HEADERS += \ + fileio.h + +SOURCES = main.cpp \ + fileio.cpp macx:ICON = icons/crt.icns diff --git a/app/fileio.cpp b/app/fileio.cpp new file mode 100644 index 0000000..27b07cc --- /dev/null +++ b/app/fileio.cpp @@ -0,0 +1,37 @@ +#include "fileio.h" + +FileIO::FileIO() +{ +} + +bool FileIO::write(const QString& sourceUrl, const QString& data) { + if (sourceUrl.isEmpty()) + return false; + + QUrl url(sourceUrl); + QFile file(url.toLocalFile()); + if (!file.open(QFile::WriteOnly | QFile::Truncate)) + return false; + + QTextStream out(&file); + out << data; + file.close(); + return true; +} + +QString FileIO::read(const QString& sourceUrl) { + if (sourceUrl.isEmpty()) + return ""; + + QUrl url(sourceUrl); + QFile file(url.toLocalFile()); + if (!file.open(QFile::ReadOnly)) + return ""; + + QTextStream in(&file); + QString result = in.readAll(); + + file.close(); + + return result; +} diff --git a/app/fileio.h b/app/fileio.h new file mode 100644 index 0000000..56421f4 --- /dev/null +++ b/app/fileio.h @@ -0,0 +1,21 @@ +#ifndef FILEIO_H +#define FILEIO_H + +#include +#include +#include +#include + +class FileIO : public QObject +{ + Q_OBJECT + +public: + FileIO(); + +public slots: + bool write(const QString& sourceUrl, const QString& data); + QString read(const QString& sourceUrl); +}; + +#endif // FILEIO_H diff --git a/app/main.cpp b/app/main.cpp index a5893b3..2010de5 100644 --- a/app/main.cpp +++ b/app/main.cpp @@ -9,6 +9,7 @@ #include #include +#include QString getNamedArgument(QStringList args, QString name, QString defaultName) { @@ -26,6 +27,7 @@ int main(int argc, char *argv[]) setenv("QT_QPA_PLATFORMTHEME", "", 1); QApplication app(argc, argv); QQmlApplicationEngine engine; + FileIO fileIO; // Manage command line arguments from the cpp side QStringList args = app.arguments(); @@ -52,6 +54,7 @@ int main(int argc, char *argv[]) engine.rootContext()->setContextProperty("defaultCmdArgs", commandArgs); engine.rootContext()->setContextProperty("workdir", getNamedArgument(args, "--workdir", "$HOME")); + engine.rootContext()->setContextProperty("fileIO", &fileIO); // Manage import paths for Linux and OSX. QStringList importPathList = engine.importPathList(); diff --git a/app/qml/ApplicationSettings.qml b/app/qml/ApplicationSettings.qml index e31cbdf..4bcd5af 100644 --- a/app/qml/ApplicationSettings.qml +++ b/app/qml/ApplicationSettings.qml @@ -208,7 +208,7 @@ QtObject{ return stringify(settings); } - function composeProfileString(){ + function composeProfileObject(){ var settings = { backgroundColor: _backgroundColor, fontColor: _fontColor, @@ -232,7 +232,11 @@ QtObject{ fontName: fontNames[rasterization], fontWidth: fontWidth } - return stringify(settings); + return settings; + } + + function composeProfileString() { + return stringify(composeProfileObject()); } function loadSettings(){ diff --git a/app/qml/SettingsGeneralTab.qml b/app/qml/SettingsGeneralTab.qml index 4391fb8..cc56de9 100644 --- a/app/qml/SettingsGeneralTab.qml +++ b/app/qml/SettingsGeneralTab.qml @@ -21,6 +21,7 @@ import QtQuick 2.2 import QtQuick.Controls 1.1 import QtQuick.Layouts 1.1 +import QtQuick.Dialogs 1.1 Tab{ ColumnLayout{ @@ -77,10 +78,62 @@ Tab{ profilesView.activated(currentIndex); } } + Button{ + text: qsTr("Import") + onClicked: { + fileDialog.selectExisting = true; + fileDialog.callBack = function (url) {loadFile(url);}; + fileDialog.open(); + } + function loadFile(url) { + if (true) + console.log("Loading file: " + url); + var profileStirng = fileIO.read(url); + appSettings.loadProfileString(profileStirng); + } + } + Button{ + text: qsTr("Export") + onClicked: { + fileDialog.selectExisting = false; + fileDialog.callBack = function (url) {storeFile(url);}; + fileDialog.open(); + } + function storeFile(url) { + if (true) + console.log("Storing file: " + url); + var profileObject = appSettings.composeProfileObject(); + fileIO.write(url, JSON.stringify(profileObject, undefined, 2)); + } + } InsertNameDialog{ id: insertname onNameSelected: appSettings.addNewCustomProfile(name) } + Loader { + property var callBack + property bool selectExisting: false + id: fileDialog + + sourceComponent: FileDialog{ + nameFilters: ["Json files (*.json)"] + selectMultiple: false + selectFolder: false + selectExisting: fileDialog.selectExisting + onAccepted: callBack(fileUrl); + } + + onSelectExistingChanged: reload() + + function open() { + item.open(); + } + + function reload() { + active = false; + active = true; + } + } } } } From a62645f0b7c30a46ccf2059b8fe6418980a79186 Mon Sep 17 00:00:00 2001 From: Filippo Scognamiglio Date: Fri, 26 Dec 2014 17:19:34 +0100 Subject: [PATCH 10/16] Improve profiles management, redesign a bit the settings window. --- app/qml/ApplicationSettings.qml | 3 +- app/qml/InsertNameDialog.qml | 1 + app/qml/SettingsEffectsTab.qml | 1 + app/qml/SettingsGeneralTab.qml | 172 ++++++++++++++++---------------- app/qml/SettingsScreenTab.qml | 94 +++++++++++++++++ app/qml/SettingsTerminalTab.qml | 17 +--- app/qml/SettingsWindow.qml | 6 ++ app/qml/resources.qrc | 1 + 8 files changed, 193 insertions(+), 102 deletions(-) create mode 100644 app/qml/SettingsScreenTab.qml diff --git a/app/qml/ApplicationSettings.qml b/app/qml/ApplicationSettings.qml index 4bcd5af..1d9cde1 100644 --- a/app/qml/ApplicationSettings.qml +++ b/app/qml/ApplicationSettings.qml @@ -356,8 +356,7 @@ QtObject{ loadProfileString(profile.obj_string); } - function addNewCustomProfile(name){ - var profileString = composeProfileString(); + function appendCustomProfile(name, profileString) { profilesList.append({text: name, obj_string: profileString, builtin: false}); } diff --git a/app/qml/InsertNameDialog.qml b/app/qml/InsertNameDialog.qml index 99c5c52..535c8f4 100644 --- a/app/qml/InsertNameDialog.qml +++ b/app/qml/InsertNameDialog.qml @@ -31,6 +31,7 @@ Window{ modality: Qt.ApplicationModal title: qsTr("Save new profile") + property alias profileName: namefield.text signal nameSelected(string name) MessageDialog { diff --git a/app/qml/SettingsEffectsTab.qml b/app/qml/SettingsEffectsTab.qml index ba8bf6c..e88998d 100644 --- a/app/qml/SettingsEffectsTab.qml +++ b/app/qml/SettingsEffectsTab.qml @@ -28,6 +28,7 @@ Tab{ anchors.fill: parent ColumnLayout{ anchors.fill: parent + spacing: 2 CheckableSlider{ name: qsTr("Bloom") onNewValue: appSettings.bloom = newValue diff --git a/app/qml/SettingsGeneralTab.qml b/app/qml/SettingsGeneralTab.qml index cc56de9..66b9721 100644 --- a/app/qml/SettingsGeneralTab.qml +++ b/app/qml/SettingsGeneralTab.qml @@ -51,6 +51,14 @@ Tab{ ColumnLayout { anchors { top: parent.top; bottom: parent.bottom } Layout.fillWidth: false + Button{ + Layout.fillWidth: true + text: qsTr("New") + onClicked: { + insertname.profileName = ""; + insertname.show() + } + } Button{ Layout.fillWidth: true property alias currentIndex: profilesView.currentRow @@ -62,11 +70,6 @@ Tab{ appSettings.loadProfile(index); } } - Button{ - Layout.fillWidth: true - text: qsTr("New") - onClicked: insertname.show() - } Button{ Layout.fillWidth: true text: qsTr("Remove") @@ -74,11 +77,12 @@ Tab{ enabled: currentIndex >= 0 && !appSettings.profilesList.get(currentIndex).builtin onClicked: { - appSettings.profilesList.remove(profilesView.currentRow); - profilesView.activated(currentIndex); + appSettings.profilesList.remove(currentIndex); + currentIndex = -1; // Unselect the profile. } } Button{ + Layout.fillWidth: true text: qsTr("Import") onClicked: { fileDialog.selectExisting = true; @@ -86,105 +90,103 @@ Tab{ fileDialog.open(); } function loadFile(url) { - if (true) - console.log("Loading file: " + url); - var profileStirng = fileIO.read(url); - appSettings.loadProfileString(profileStirng); + try { + if (appSettings.verbose) + console.log("Loading file: " + url); + + var profileObject = JSON.parse(fileIO.read(url)); + var name = profileObject.name; + + if (!name) + throw "Profile doesn't have a name"; + + delete profileObject.name; + + appSettings.appendCustomProfile(name, JSON.stringify(profileObject)); + } catch (err) { + console.log(err); + messageDialog.text = qsTr("There has been an error reading the file.") + messageDialog.open(); + } } } Button{ + property alias currentIndex: profilesView.currentRow + + Layout.fillWidth: true + text: qsTr("Export") + enabled: currentIndex >= 0 && !appSettings.profilesList.get(currentIndex).builtin onClicked: { fileDialog.selectExisting = false; fileDialog.callBack = function (url) {storeFile(url);}; fileDialog.open(); } function storeFile(url) { - if (true) - console.log("Storing file: " + url); - var profileObject = appSettings.composeProfileObject(); - fileIO.write(url, JSON.stringify(profileObject, undefined, 2)); - } - } - InsertNameDialog{ - id: insertname - onNameSelected: appSettings.addNewCustomProfile(name) - } - Loader { - property var callBack - property bool selectExisting: false - id: fileDialog + try { + var urlString = url.toString(); - sourceComponent: FileDialog{ - nameFilters: ["Json files (*.json)"] - selectMultiple: false - selectFolder: false - selectExisting: fileDialog.selectExisting - onAccepted: callBack(fileUrl); - } + // Fix the extension if it's missing. + var extension = urlString.substring(urlString.length - 5, urlString.length); + var urlTail = (extension === ".json" ? "" : ".json"); + url += urlTail; - onSelectExistingChanged: reload() + if (true) + console.log("Storing file: " + url); - function open() { - item.open(); - } + var profileObject = appSettings.profilesList.get(currentIndex); + var profileSettings = JSON.parse(profileObject.obj_string); + profileSettings["name"] = profileObject.text; - function reload() { - active = false; - active = true; + var result = fileIO.write(url, JSON.stringify(profileSettings, undefined, 2)); + if (!result) + throw "The file could not be written."; + } catch (err) { + console.log(err); + messageDialog.text = qsTr("There has been an error storing the file.") + messageDialog.open(); + } } } } } } - GroupBox{ - title: qsTr("Lights") - Layout.fillWidth: true - GridLayout{ - anchors.fill: parent - columns: 2 - Text{ text: qsTr("Brightness") } - SimpleSlider{ - onValueChanged: appSettings.brightness = value - value: appSettings.brightness - } - Text{ text: qsTr("Contrast") } - SimpleSlider{ - onValueChanged: appSettings.contrast = value - value: appSettings.contrast - } - Text{ text: qsTr("Opacity") } - SimpleSlider{ - onValueChanged: appSettings.windowOpacity = value - value: appSettings.windowOpacity - } + // DIALOGS //////////////////////////////////////////////////////////////// + InsertNameDialog{ + id: insertname + onNameSelected: { + appSettings.appendCustomProfile(name, appSettings.composeProfileString()); } } - GroupBox{ - title: qsTr("Frame") - Layout.fillWidth: true - RowLayout{ - anchors.fill: parent - ComboBox{ - id: framescombobox - Layout.fillWidth: true - model: appSettings.framesList - currentIndex: appSettings.framesIndex - onActivated: { - appSettings.frameName = appSettings.framesList.get(index).name; - } - function updateIndex(){ - var name = appSettings.frameName; - var index = appSettings.getFrameIndexByName(name); - if (index !== undefined) - currentIndex = index; - } - Component.onCompleted: updateIndex(); - Connections { - target: appSettings - onFrameNameChanged: framescombobox.updateIndex(); - } - } + MessageDialog { + id: messageDialog + title: qsTr("File Error") + onAccepted: { + messageDialog.close(); + } + } + Loader { + property var callBack + property bool selectExisting: false + id: fileDialog + + sourceComponent: FileDialog{ + nameFilters: ["Json files (*.json)"] + selectMultiple: false + selectFolder: false + selectExisting: fileDialog.selectExisting + onAccepted: callBack(fileUrl); + } + + onSelectExistingChanged: reload() + + function open() { + item.open(); + } + + function reload() { + active = false; + active = true; } } } diff --git a/app/qml/SettingsScreenTab.qml b/app/qml/SettingsScreenTab.qml new file mode 100644 index 0000000..7374624 --- /dev/null +++ b/app/qml/SettingsScreenTab.qml @@ -0,0 +1,94 @@ +/******************************************************************************* +* Copyright (c) 2013 "Filippo Scognamiglio" +* https://github.com/Swordfish90/cool-retro-term +* +* This file is part of cool-retro-term. +* +* cool-retro-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 . +*******************************************************************************/ + +import QtQuick 2.2 +import QtQuick.Controls 1.1 +import QtQuick.Layouts 1.1 +import QtQuick.Dialogs 1.1 + +Tab{ + ColumnLayout{ + anchors.fill: parent + GroupBox{ + title: qsTr("Rasterization Mode") + Layout.fillWidth: true + ComboBox { + id: rasterizationBox + property string selectedElement: model[currentIndex] + anchors.fill: parent + model: [qsTr("Default"), qsTr("Scanlines"), qsTr("Pixels")] + currentIndex: appSettings.rasterization + onCurrentIndexChanged: { + appSettings.rasterization = currentIndex + } + } + } + GroupBox{ + title: qsTr("Lights") + Layout.fillWidth: true + GridLayout{ + anchors.fill: parent + columns: 2 + Text{ text: qsTr("Brightness") } + SimpleSlider{ + onValueChanged: appSettings.brightness = value + value: appSettings.brightness + } + Text{ text: qsTr("Contrast") } + SimpleSlider{ + onValueChanged: appSettings.contrast = value + value: appSettings.contrast + } + Text{ text: qsTr("Opacity") } + SimpleSlider{ + onValueChanged: appSettings.windowOpacity = value + value: appSettings.windowOpacity + } + } + } + GroupBox{ + title: qsTr("Frame") + Layout.fillWidth: true + RowLayout{ + anchors.fill: parent + ComboBox{ + id: framescombobox + Layout.fillWidth: true + model: appSettings.framesList + currentIndex: appSettings.framesIndex + onActivated: { + appSettings.frameName = appSettings.framesList.get(index).name; + } + function updateIndex(){ + var name = appSettings.frameName; + var index = appSettings.getFrameIndexByName(name); + if (index !== undefined) + currentIndex = index; + } + Component.onCompleted: updateIndex(); + Connections { + target: appSettings + onFrameNameChanged: framescombobox.updateIndex(); + } + } + } + } + } +} diff --git a/app/qml/SettingsTerminalTab.qml b/app/qml/SettingsTerminalTab.qml index 578e590..e3649cd 100644 --- a/app/qml/SettingsTerminalTab.qml +++ b/app/qml/SettingsTerminalTab.qml @@ -26,21 +26,8 @@ Tab{ ColumnLayout{ anchors.fill: parent GroupBox{ - title: qsTr("Rasterization Mode") - Layout.fillWidth: true - ComboBox { - id: rasterizationBox - property string selectedElement: model[currentIndex] - anchors.fill: parent - model: [qsTr("Default"), qsTr("Scanlines"), qsTr("Pixels")] - currentIndex: appSettings.rasterization - onCurrentIndexChanged: { - appSettings.rasterization = currentIndex - } - } - } - GroupBox{ - title: qsTr("Font") + " (" + rasterizationBox.selectedElement + ")" + property var rasterization: [qsTr("Default"), qsTr("Scanlines"), qsTr("Pixels")][appSettings.rasterization] + title: qsTr("Font" + "(" + rasterization + ")") Layout.fillWidth: true GridLayout{ anchors.fill: parent diff --git a/app/qml/SettingsWindow.qml b/app/qml/SettingsWindow.qml index 7726402..9f4653f 100644 --- a/app/qml/SettingsWindow.qml +++ b/app/qml/SettingsWindow.qml @@ -42,6 +42,12 @@ Window { anchors.fill: parent anchors.margins: tabmargins } + SettingsScreenTab{ + id: screenTab + title: qsTr("Screen") + anchors.fill: parent + anchors.margins: tabmargins + } SettingsTerminalTab{ id: terminalTab title: qsTr("Terminal") diff --git a/app/qml/resources.qrc b/app/qml/resources.qrc index b521f67..2f76dfa 100644 --- a/app/qml/resources.qrc +++ b/app/qml/resources.qrc @@ -49,5 +49,6 @@ fonts/modern-hermit/Hermit-medium.otf fonts/modern-envy-code-r/Envy Code R.ttf fonts/modern-inconsolata/Inconsolata.otf + SettingsScreenTab.qml From 7dd61c89fc990be7acb017d6da1bc54a94cabcfc Mon Sep 17 00:00:00 2001 From: Filippo Scognamiglio Date: Fri, 26 Dec 2014 17:36:03 +0100 Subject: [PATCH 11/16] Fix: osx shortcuts. --- app/qml/main.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/qml/main.qml b/app/qml/main.qml index c527ec6..7a201a1 100644 --- a/app/qml/main.qml +++ b/app/qml/main.qml @@ -82,12 +82,12 @@ ApplicationWindow{ Action{ id: copyAction text: qsTr("Copy") - shortcut: Qt.platform.os === "osx" ? "Ctrl+C" : "Ctrl+Shift+C" + shortcut: Qt.platform.os === "osx" ? StandardKey.Copy : "Ctrl+Shift+C" } Action{ id: pasteAction text: qsTr("Paste") - shortcut: Qt.platform.os === "osx" ? "Ctrl+V" : "Ctrl+Shift+V" + shortcut: Qt.platform.os === "osx" ? StandardKey.Paste : "Ctrl+Shift+V" } Action{ id: zoomIn From 0264fbebcdcf4752723fdc6f8c28845c74265216 Mon Sep 17 00:00:00 2001 From: Filippo Scognamiglio Date: Fri, 26 Dec 2014 17:51:10 +0100 Subject: [PATCH 12/16] Small adjustments in the settings dialog. --- app/qml/SettingsGeneralTab.qml | 4 ++++ app/qml/SettingsTerminalTab.qml | 32 ++++++++++++++++---------------- app/qml/SettingsWindow.qml | 4 ++-- 3 files changed, 22 insertions(+), 18 deletions(-) diff --git a/app/qml/SettingsGeneralTab.qml b/app/qml/SettingsGeneralTab.qml index 66b9721..9e0f55c 100644 --- a/app/qml/SettingsGeneralTab.qml +++ b/app/qml/SettingsGeneralTab.qml @@ -81,6 +81,10 @@ Tab{ currentIndex = -1; // Unselect the profile. } } + Item { + // Spacing + Layout.fillHeight: true + } Button{ Layout.fillWidth: true text: qsTr("Import") diff --git a/app/qml/SettingsTerminalTab.qml b/app/qml/SettingsTerminalTab.qml index e3649cd..83f338d 100644 --- a/app/qml/SettingsTerminalTab.qml +++ b/app/qml/SettingsTerminalTab.qml @@ -28,7 +28,7 @@ Tab{ GroupBox{ property var rasterization: [qsTr("Default"), qsTr("Scanlines"), qsTr("Pixels")][appSettings.rasterization] title: qsTr("Font" + "(" + rasterization + ")") - Layout.fillWidth: true + anchors { left: parent.left; right: parent.right } GridLayout{ anchors.fill: parent columns: 2 @@ -101,9 +101,23 @@ Tab{ } GroupBox{ title: qsTr("Colors") - Layout.fillWidth: true + anchors { left: parent.left; right: parent.right } ColumnLayout{ anchors.fill: parent + ColumnLayout{ + Layout.fillWidth: true + CheckableSlider{ + name: qsTr("Chroma Color") + onNewValue: appSettings.chromaColor = newValue + value: appSettings.chromaColor + } + CheckableSlider{ + name: qsTr("Saturation Color") + onNewValue: appSettings.saturationColor = newValue + value: appSettings.saturationColor + enabled: appSettings.chromaColor !== 0 + } + } RowLayout{ Layout.fillWidth: true ColorButton{ @@ -121,20 +135,6 @@ Tab{ button_color: appSettings._backgroundColor } } - ColumnLayout{ - Layout.fillWidth: true - CheckableSlider{ - name: qsTr("Chroma Color") - onNewValue: appSettings.chromaColor = newValue - value: appSettings.chromaColor - } - CheckableSlider{ - name: qsTr("Saturation Color") - onNewValue: appSettings.saturationColor = newValue - value: appSettings.saturationColor - enabled: appSettings.chromaColor !== 0 - } - } } } } diff --git a/app/qml/SettingsWindow.qml b/app/qml/SettingsWindow.qml index 9f4653f..cb93959 100644 --- a/app/qml/SettingsWindow.qml +++ b/app/qml/SettingsWindow.qml @@ -27,8 +27,8 @@ import QtQuick.Dialogs 1.1 Window { id: settings_window title: qsTr("Settings") - width: 640 - height: 440 + width: 560 + height: 360 property int tabmargins: 15 From e4c7ffe201b55d050dabc4c88adc33ea6b3829ce Mon Sep 17 00:00:00 2001 From: Filippo Scognamiglio Date: Fri, 26 Dec 2014 19:47:11 +0100 Subject: [PATCH 13/16] Fix: various small improvements. --- app/qml/ApplicationSettings.qml | 22 ++++++++++++---------- app/qml/FontPixels.qml | 18 +++++++++--------- app/qml/FontScanlines.qml | 18 +++++++++--------- app/qml/SettingsGeneralTab.qml | 6 +++++- app/qml/SettingsWindow.qml | 4 ++-- app/qml/ShaderTerminal.qml | 16 ++++++++-------- app/qml/frames/utils/TerminalFrame.qml | 8 ++++---- 7 files changed, 49 insertions(+), 43 deletions(-) diff --git a/app/qml/ApplicationSettings.qml b/app/qml/ApplicationSettings.qml index 1d9cde1..6702d82 100644 --- a/app/qml/ApplicationSettings.qml +++ b/app/qml/ApplicationSettings.qml @@ -81,7 +81,7 @@ QtObject{ property real fontScaling: 1.0 property real fontWidth: 1.0 - property var fontNames: ["TERMINUS", "COMMODORE_PET", "COMMODORE_PET"] + property var fontNames: ["HERMIT", "COMMODORE_PET", "COMMODORE_PET"] property var fontlist: fontManager.item.fontlist signal terminalFontChanged(string fontSource, int pixelSize, int lineSpacing, real screenScaling, real fontWidth) @@ -317,6 +317,8 @@ QtObject{ fontNames[rasterization] = settings.fontName !== undefined ? settings.fontName : fontNames[rasterization]; fontWidth = settings.fontWidth !== undefined ? settings.fontWidth : fontWidth; + + handleFontChanged(); } function storeCustomProfiles(){ @@ -365,47 +367,47 @@ QtObject{ property ListModel profilesList: ListModel{ ListElement{ text: "Default Amber" - obj_string: '{"ambientLight":0.2,"backgroundColor":"#000000","bloom":0.65,"brightness":0.5,"flickering":0.1,"contrast":0.85,"fontName":"TERMINUS","fontColor":"#ff8100","frameName":"SIMPLE_WHITE_FRAME","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}' + obj_string: '{"ambientLight":0.16,"backgroundColor":"#000000","bloom":0.65,"brightness":0.5,"flickering":0.1,"contrast":0.85,"fontName":"HERMIT","fontColor":"#ff8100","frameName":"SIMPLE_WHITE_FRAME","glowingLine":0.2,"horizontalSync":0.16,"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: '{"ambientLight":0.2,"backgroundColor":"#000000","bloom":0.4,"brightness":0.5,"flickering":0.1,"contrast":0.85,"fontName":"TERMINUS","fontColor":"#0ccc68","frameName":"SIMPLE_WHITE_FRAME","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}' + obj_string: '{"ambientLight":0.16,"backgroundColor":"#000000","bloom":0.4,"brightness":0.5,"flickering":0.1,"contrast":0.85,"fontName":"HERMIT","fontColor":"#0ccc68","frameName":"SIMPLE_WHITE_FRAME","glowingLine":0.2,"horizontalSync":0.16,"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: '{"ambientLight":0.2,"backgroundColor":"#000000","bloom":0.4,"brightness":0.5,"flickering":0.1,"contrast":0.85,"fontName":"TERMINUS","fontColor":"#00ff5b","frameName":"SIMPLE_WHITE_FRAME","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}' + obj_string: '{"ambientLight":0.16,"backgroundColor":"#000000","bloom":0.4,"brightness":0.5,"flickering":0.1,"contrast":0.85,"fontName":"COMMODORE_PET","fontColor":"#00ff5b","frameName":"SIMPLE_WHITE_FRAME","glowingLine":0.2,"horizontalSync":0.14,"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: '{"ambientLight":0.2,"backgroundColor":"#000000","bloom":0.4,"brightness":0.5,"flickering":0.1,"contrast":0.85,"fontName":"TERMINUS","fontColor":"#ff8100","frameName":"SIMPLE_WHITE_FRAME","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}' + obj_string: '{"ambientLight":0.16,"backgroundColor":"#000000","bloom":0,"brightness":0.5,"flickering":0.2,"contrast":0.85,"fontName":"COMMODORE_PET","fontColor":"#ffffff","frameName":"ROUGH_BLACK_FRAME","glowingLine":0.2,"horizontalSync":0.2,"jitter":0,"burnIn":0.45,"staticNoise":0.19,"rasterization":2,"screenCurvature":0.05,"windowOpacity":1,"chromaColor":0,"saturationColor":0,"rbgShift":0,"fontWidth":1.0}' builtin: true } ListElement{ text: "Apple ][" - obj_string: '{"ambientLight":0.2,"backgroundColor":"#000000","bloom":0.5,"brightness":0.5,"flickering":0.2,"contrast":0.85,"fontName":"APPLE_II","fontColor":"#2fff91","frameName":"SIMPLE_WHITE_FRAME","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}' + obj_string: '{"ambientLight":0.16,"backgroundColor":"#000000","bloom":0.5,"brightness":0.5,"flickering":0.2,"contrast":0.85,"fontName":"APPLE_II","fontColor":"#2fff91","frameName":"SIMPLE_WHITE_FRAME","glowingLine":0.22,"horizontalSync":0.16,"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: '{"ambientLight":0.2,"backgroundColor":"#000000","bloom":0.4,"brightness":0.5,"flickering":0.54,"contrast":0.85,"fontName":"TERMINUS","fontColor":"#00ff3e","frameName":"ROUGH_BLACK_FRAME","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}' + obj_string: '{"ambientLight":0.5,"backgroundColor":"#000000","bloom":0.4,"brightness":0.5,"flickering":0.9,"contrast":0.80,"fontName":"COMMODORE_PET","fontColor":"#00ff3e","frameName":"ROUGH_BLACK_FRAME","glowingLine":0.3,"horizontalSync":0.42,"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: '{"ambientLight":0.2,"backgroundColor":"#000000","bloom":0.4,"brightness":0.5,"flickering":0.07,"contrast":0.85,"fontName":"IBM_DOS","fontColor":"#ffffff","frameName":"SIMPLE_WHITE_FRAME","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}' + obj_string: '{"ambientLight":0.16,"backgroundColor":"#000000","bloom":0.4,"brightness":0.5,"flickering":0.07,"contrast":0.85,"fontName":"IBM_DOS","fontColor":"#ffffff","frameName":"SIMPLE_WHITE_FRAME","glowingLine":0.13,"horizontalSync":0,"jitter":0.16,"burnIn":0.3,"staticNoise":0.03,"rasterization":0,"screenCurvature":0.1,"windowOpacity":1,"chromaColor":1,"saturationColor":0,"rbgShift":0.35,"fontWidth":1.0}' builtin: true } ListElement{ text: "IBM 3278" - obj_string: '{"ambientLight":0.1,"backgroundColor":"#000000","bloom":0.15,"brightness":0.5,"flickering":0,"contrast":0.95,"fontName":"IBM_3278","fontColor":"#0ccc68","frameName":"SIMPLE_WHITE_FRAME","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}' + obj_string: '{"ambientLight":0.1,"backgroundColor":"#000000","bloom":0.15,"brightness":0.5,"flickering":0,"contrast":0.85,"fontName":"IBM_3278","fontColor":"#0ccc68","frameName":"SIMPLE_WHITE_FRAME","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: '{"ambientLight":0.2,"backgroundColor":"#000000","bloom":0.45,"brightness":0.5,"flickering":0.20,"contrast":0.85,"fontName":"TERMINUS","fontColor":"#0ccc68","frameName":"NO_FRAME","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}' + obj_string: '{"ambientLight":0.2,"backgroundColor":"#000000","bloom":0.45,"brightness":0.5,"flickering":0.20,"contrast":0.85,"fontName":"HERMIT","fontColor":"#0ccc68","frameName":"NO_FRAME","glowingLine":0.16,"horizontalSync":0.1,"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 } } diff --git a/app/qml/FontPixels.qml b/app/qml/FontPixels.qml index b0c8d35..e79d7ef 100644 --- a/app/qml/FontPixels.qml +++ b/app/qml/FontPixels.qml @@ -31,15 +31,6 @@ QtObject{ property real defaultFontWidth: fontlist.get(selectedFontIndex).fontWidth property ListModel fontlist: ListModel{ - ListElement{ - name: "PROGGY_TINY" - text: "Proggy Tiny (Modern)" - source: "fonts/modern-proggy-tiny/ProggyTiny.ttf" - lineSpacing: 1 - pixelSize: 16 - baseScaling: 3.5 - fontWidth: 0.9 - } ListElement{ name: "COMMODORE_PET" text: "Commodore PET (1977)" @@ -49,6 +40,15 @@ QtObject{ baseScaling: 4.0 fontWidth: 0.8 } + ListElement{ + name: "PROGGY_TINY" + text: "Proggy Tiny (Modern)" + source: "fonts/modern-proggy-tiny/ProggyTiny.ttf" + lineSpacing: 1 + pixelSize: 16 + baseScaling: 4.0 + fontWidth: 0.9 + } ListElement{ name: "APPLE_II" text: "Apple ][ (1977)" diff --git a/app/qml/FontScanlines.qml b/app/qml/FontScanlines.qml index e6ab81e..c9f1762 100644 --- a/app/qml/FontScanlines.qml +++ b/app/qml/FontScanlines.qml @@ -31,15 +31,6 @@ QtObject{ property real defaultFontWidth: fontlist.get(selectedFontIndex).fontWidth property ListModel fontlist: ListModel{ - ListElement{ - name: "PROGGY_TINY" - text: "Proggy Tiny (Modern)" - source: "fonts/modern-proggy-tiny/ProggyTiny.ttf" - lineSpacing: 1 - pixelSize: 16 - baseScaling: 3.5 - fontWidth: 0.9 - } ListElement{ name: "COMMODORE_PET" text: "Commodore PET (1977)" @@ -49,6 +40,15 @@ QtObject{ baseScaling: 4.0 fontWidth: 0.7 } + ListElement{ + name: "PROGGY_TINY" + text: "Proggy Tiny (Modern)" + source: "fonts/modern-proggy-tiny/ProggyTiny.ttf" + lineSpacing: 1 + pixelSize: 16 + baseScaling: 4.0 + fontWidth: 0.9 + } ListElement{ name: "APPLE_II" text: "Apple ][ (1977)" diff --git a/app/qml/SettingsGeneralTab.qml b/app/qml/SettingsGeneralTab.qml index 9e0f55c..18f72a6 100644 --- a/app/qml/SettingsGeneralTab.qml +++ b/app/qml/SettingsGeneralTab.qml @@ -78,7 +78,11 @@ Tab{ enabled: currentIndex >= 0 && !appSettings.profilesList.get(currentIndex).builtin onClicked: { appSettings.profilesList.remove(currentIndex); - currentIndex = -1; // Unselect the profile. + profilesView.selection.clear(); + + // TODO This is a very ugly workaround. The view didn't update on Qt 5.3.2. + profilesView.model = 0; + profilesView.model = appSettings.profilesList; } } Item { diff --git a/app/qml/SettingsWindow.qml b/app/qml/SettingsWindow.qml index cb93959..247c2e5 100644 --- a/app/qml/SettingsWindow.qml +++ b/app/qml/SettingsWindow.qml @@ -27,8 +27,8 @@ import QtQuick.Dialogs 1.1 Window { id: settings_window title: qsTr("Settings") - width: 560 - height: 360 + width: 580 + height: 400 property int tabmargins: 15 diff --git a/app/qml/ShaderTerminal.qml b/app/qml/ShaderTerminal.qml index 0a2cea0..aa024b0 100644 --- a/app/qml/ShaderTerminal.qml +++ b/app/qml/ShaderTerminal.qml @@ -37,7 +37,7 @@ ShaderEffect { property size scaleNoiseSize: Qt.size((width) / (noiseTexture.width * appSettings.windowScaling * appSettings.fontScaling), (height) / (noiseTexture.height * appSettings.windowScaling * appSettings.fontScaling)) - property real screen_distorsion: appSettings.screenCurvature + property real screenCurvature: appSettings.screenCurvature property real glowingLine: appSettings.glowingLine property real chromaColor: appSettings.chromaColor; @@ -45,7 +45,7 @@ ShaderEffect { property real rbgShift: appSettings.rbgShift * 0.2 property real flickering: appSettings.flickering - property real horizontalSync: appSettings.horizontalSync + property real horizontalSync: appSettings.horizontalSync * 0.5 property bool frameReflections: appSettings.frameReflections @@ -66,7 +66,7 @@ ShaderEffect { } property alias time: timeManager.time - property variant noiseSource: noiseShaderSource + property ShaderEffectSource noiseSource: noiseShaderSource // If something goes wrong activate the fallback version of the shader. property bool fallBack: false @@ -167,8 +167,8 @@ ShaderEffect { ||(fallBack && (flickering || horizontalSync))) ? " uniform lowp sampler2D noiseSource; uniform highp vec2 scaleNoiseSize;" : "") + - (screen_distorsion !== 0 ? " - uniform highp float screen_distorsion;" : "") + + (screenCurvature !== 0 ? " + uniform highp float screenCurvature;" : "") + (glowingLine !== 0 ? " uniform highp float glowingLine;" : "") + (chromaColor !== 0 ? " @@ -230,8 +230,8 @@ ShaderEffect { (staticNoise ? " float noise = staticNoise;" : "") + - (screen_distorsion !== 0 ? " - float distortion = dot(cc, cc) * screen_distorsion; + (screenCurvature !== 0 ? " + float distortion = dot(cc, cc) * screenCurvature; vec2 staticCoords = (qt_TexCoord0 - cc * (1.0 + distortion) * distortion);" :" vec2 staticCoords = qt_TexCoord0;") + @@ -242,7 +242,7 @@ ShaderEffect { float dst = sin((coords.y + time * 0.001) * distortionFreq); coords.x += dst * distortionScale;" + (staticNoise ? " - noise += distortionScale * 3.0;" : "") + noise += distortionScale * 7.0;" : "") : "") + (jitter !== 0 || staticNoise !== 0 ? diff --git a/app/qml/frames/utils/TerminalFrame.qml b/app/qml/frames/utils/TerminalFrame.qml index 646c1c9..1db72ca 100644 --- a/app/qml/frames/utils/TerminalFrame.qml +++ b/app/qml/frames/utils/TerminalFrame.qml @@ -105,9 +105,9 @@ Item{ id: staticLight property alias source: framesource property alias normals: framesourcenormals - property real screen_distorsion: appSettings.screenCurvature + property real screenCurvature: appSettings.screenCurvature property size curvature_coefficients: Qt.size(width / mainShader.width, height / mainShader.height) - property real ambientLight: appSettings.ambientLight + property real ambientLight: appSettings.ambientLight * 0.9 + 0.1 property color fontColor: appSettings.fontColor property color backgroundColor: appSettings.backgroundColor property color reflectionColor: Utils.mix(fontColor, backgroundColor, 0.2) @@ -122,7 +122,7 @@ Item{ fragmentShader: " uniform highp sampler2D normals; uniform highp sampler2D source; - uniform lowp float screen_distorsion; + uniform lowp float screenCurvature; uniform highp vec2 curvature_coefficients; uniform lowp float ambientLight; uniform highp float qt_Opacity; @@ -133,7 +133,7 @@ Item{ vec2 distortCoordinates(vec2 coords){ vec2 cc = (coords - vec2(0.5)) * curvature_coefficients; - float dist = dot(cc, cc) * screen_distorsion; + float dist = dot(cc, cc) * screenCurvature; return (coords + cc * (1.0 + dist) * dist); } From 025ef61de1100b60b9525a586fd765a169252cc2 Mon Sep 17 00:00:00 2001 From: Filippo Scognamiglio Date: Fri, 26 Dec 2014 19:57:03 +0100 Subject: [PATCH 14/16] Allow profiles with the same name. --- app/qml/InsertNameDialog.qml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/app/qml/InsertNameDialog.qml b/app/qml/InsertNameDialog.qml index 535c8f4..d617862 100644 --- a/app/qml/InsertNameDialog.qml +++ b/app/qml/InsertNameDialog.qml @@ -49,12 +49,6 @@ Window{ var profile_list = appSettings.profilesList; if (name === "") return 1; - - for (var i = 0; i < profile_list.count; i++){ - if(profile_list.get(i).text === name) - return 2; - } - return 0; } @@ -83,9 +77,6 @@ Window{ case 1: errorDialog.showError(qsTr("The name you inserted is empty. Please choose a different one.")); break; - case 2: - errorDialog.showError(qsTr("The name you inserted already exists. Please choose a different one.")); - break; default: nameSelected(name); close(); From bc441116e27820003bd83a6074fba73f63a9e2dc Mon Sep 17 00:00:00 2001 From: Filippo Scognamiglio Date: Fri, 26 Dec 2014 23:16:31 +0100 Subject: [PATCH 15/16] Enable terminal smoothing when rasterization is not used. --- app/qml/PreprocessedTerminal.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/qml/PreprocessedTerminal.qml b/app/qml/PreprocessedTerminal.qml index 7c40c74..e53506d 100644 --- a/app/qml/PreprocessedTerminal.qml +++ b/app/qml/PreprocessedTerminal.qml @@ -83,7 +83,7 @@ Item{ colorScheme: "cool-retro-term" - smooth: false + smooth: appSettings.rasterization === appSettings.no_rasterization enableBold: false fullCursorHeight: true From a63135045e0306e266ce8e54e08fe5c34528853a Mon Sep 17 00:00:00 2001 From: Filippo Scognamiglio Date: Fri, 26 Dec 2014 23:41:03 +0100 Subject: [PATCH 16/16] Bump terminal version and prepare for release. --- app/qml/ApplicationSettings.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/qml/ApplicationSettings.qml b/app/qml/ApplicationSettings.qml index 6702d82..dab640d 100644 --- a/app/qml/ApplicationSettings.qml +++ b/app/qml/ApplicationSettings.qml @@ -23,7 +23,7 @@ import QtQuick 2.2 import "utils.js" as Utils QtObject{ - property string version: "0.9" + property string version: "1.0.0 RC1" // GENERAL SETTINGS ///////////////////////////////////////////////////