mirror of
				https://github.com/Swordfish90/cool-retro-term.git
				synced 2025-10-31 15:12:28 +00:00 
			
		
		
		
	Merge pull request #195 from Swordfish90/unstable
Added profiles import/export, reorganized settings, fixes, fixes and fixes
This commit is contained in:
		| @@ -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 | ||||
|  | ||||
|   | ||||
							
								
								
									
										37
									
								
								app/fileio.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								app/fileio.cpp
									
									
									
									
									
										Normal file
									
								
							| @@ -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; | ||||
| } | ||||
							
								
								
									
										21
									
								
								app/fileio.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								app/fileio.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,21 @@ | ||||
| #ifndef FILEIO_H | ||||
| #define FILEIO_H | ||||
|  | ||||
| #include <QObject> | ||||
| #include <QFile> | ||||
| #include <QTextStream> | ||||
| #include <QUrl> | ||||
|  | ||||
| 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 | ||||
							
								
								
									
										28
									
								
								app/main.cpp
									
									
									
									
									
								
							
							
						
						
									
										28
									
								
								app/main.cpp
									
									
									
									
									
								
							| @@ -9,6 +9,7 @@ | ||||
| #include <QDebug> | ||||
| #include <stdlib.h> | ||||
|  | ||||
| #include <fileio.h> | ||||
|  | ||||
| QString getNamedArgument(QStringList args, QString name, QString defaultName) | ||||
| { | ||||
| @@ -26,23 +27,34 @@ 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(); | ||||
|     if (args.contains("-h") || args.contains("--help")) { | ||||
|         qDebug() << "Usage: " + args.at(0) + " [--default-settings] [--workdir <dir>] [--program <prog>] [-p|--profile <prof>] [--fullscreen] [-h|--help]"; | ||||
|         qDebug() << "    --default-settings  Run cool-retro-term with the default settings"; | ||||
|         qDebug() << "    --workdir <dir>     Change working directory to 'dir'"; | ||||
|         qDebug() << "    --program <prog>    Run the 'prog' in the new terminal."; | ||||
|         qDebug() << "    --fullscreen        Run cool-retro-term in fullscreen."; | ||||
|         qDebug() << "    -p|--profile <prof> 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 <dir>     Change working directory to 'dir'"; | ||||
|         qDebug() << "  -e <cmd>            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 <prof> 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")); | ||||
|     engine.rootContext()->setContextProperty("fileIO", &fileIO); | ||||
|  | ||||
|     // Manage import paths for Linux and OSX. | ||||
|     QStringList importPathList = engine.importPathList(); | ||||
|   | ||||
| @@ -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 /////////////////////////////////////////////////// | ||||
|  | ||||
| @@ -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,14 +76,12 @@ QtObject{ | ||||
|  | ||||
|     property int rasterization: no_rasterization | ||||
|  | ||||
|     property int profiles_index: 0 | ||||
|  | ||||
|     // FONTS ////////////////////////////////////////////////////////////////// | ||||
|  | ||||
|     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) | ||||
| @@ -109,7 +107,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(){ | ||||
| @@ -129,7 +127,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; | ||||
| @@ -142,18 +140,47 @@ QtObject{ | ||||
|  | ||||
|     // FRAMES ///////////////////////////////////////////////////////////////// | ||||
|  | ||||
|     property bool _frameReflections: false | ||||
|     property bool reflectionsAllowed: frames_list.get(frames_index).reflections | ||||
|     property bool frameReflections: _frameReflections && reflectionsAllowed | ||||
|  | ||||
|     property ListModel frames_list: 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 ListModel framesList: ListModel{ | ||||
|         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 frame_source: frames_list.get(frames_index).source | ||||
|     property int frames_index: 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 ///////////////////////////////////////////////////////////// | ||||
|  | ||||
| @@ -169,43 +196,47 @@ 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(){ | ||||
|     function composeProfileObject(){ | ||||
|         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, | ||||
|             frameName: frameName, | ||||
|             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 | ||||
|         } | ||||
|         return stringify(settings); | ||||
|         return settings; | ||||
|     } | ||||
|  | ||||
|     function composeProfileString() { | ||||
|         return stringify(composeProfileObject()); | ||||
|     } | ||||
|  | ||||
|     function loadSettings(){ | ||||
| @@ -238,10 +269,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,42 +281,44 @@ 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; | ||||
|         frameName = settings.frameName !== undefined ? settings.frameName : frameName; | ||||
|  | ||||
|         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; | ||||
|  | ||||
|         fontNames[rasterization] = settings.fontName !== undefined ? settings.fontName : fontNames[rasterization]; | ||||
|         fontWidth = settings.fontWidth !== undefined ? settings.fontWidth : fontWidth; | ||||
|  | ||||
|         handleFontChanged(); | ||||
|     } | ||||
|  | ||||
|     function storeCustomProfiles(){ | ||||
| @@ -302,88 +335,86 @@ QtObject{ | ||||
|         var customProfiles = JSON.parse(customProfilesString); | ||||
|         for (var i=0; i<customProfiles.length; i++) { | ||||
|             var profile = customProfiles[i]; | ||||
|             console.log("Loading custom profile: " + stringify(profile)); | ||||
|             profiles_list.append(profile); | ||||
|  | ||||
|             if (verbose) | ||||
|                 console.log("Loading custom profile: " + stringify(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}) | ||||
|         } | ||||
|         return stringify(customProfiles); | ||||
|     } | ||||
|  | ||||
|     function loadCurrentProfile(){ | ||||
|         loadProfile(profiles_index); | ||||
|     } | ||||
|  | ||||
|     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}); | ||||
|     function appendCustomProfile(name, profileString) { | ||||
|         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.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: '{"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.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: '{"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.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: '{"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.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: '{"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.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: '{"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.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: '{"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.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: '{"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.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: '{"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":"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 | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     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; | ||||
|   | ||||
| @@ -31,7 +31,7 @@ MenuBar { | ||||
|         title: qsTr("Profiles") | ||||
|         visible: defaultMenuBar.visible | ||||
|         Instantiator{ | ||||
|             model: appSettings.profiles_list | ||||
|             model: appSettings.profilesList | ||||
|             delegate: MenuItem { | ||||
|                 text: model.text | ||||
|                 onTriggered: { | ||||
|   | ||||
| @@ -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)" | ||||
|   | ||||
| @@ -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)" | ||||
|   | ||||
| @@ -31,6 +31,7 @@ Window{ | ||||
|     modality: Qt.ApplicationModal | ||||
|     title: qsTr("Save new profile") | ||||
|  | ||||
|     property alias profileName: namefield.text | ||||
|     signal nameSelected(string name) | ||||
|  | ||||
|     MessageDialog { | ||||
| @@ -45,15 +46,9 @@ Window{ | ||||
|     } | ||||
|  | ||||
|     function validateName(name){ | ||||
|         var profile_list = appSettings.profiles_list; | ||||
|         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; | ||||
|     } | ||||
|  | ||||
| @@ -82,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(); | ||||
|   | ||||
| @@ -37,13 +37,13 @@ Item{ | ||||
|     property alias title: ksession.title | ||||
|     property alias kterminal: kterminal | ||||
|  | ||||
|     anchors.leftMargin: frame.displacementLeft * appSettings.window_scaling | ||||
|     anchors.rightMargin: frame.displacementRight * appSettings.window_scaling | ||||
|     anchors.topMargin: frame.displacementTop * appSettings.window_scaling | ||||
|     anchors.bottomMargin: frame.displacementBottom * appSettings.window_scaling | ||||
|     anchors.leftMargin: frame.displacementLeft * appSettings.windowScaling | ||||
|     anchors.rightMargin: frame.displacementRight * appSettings.windowScaling | ||||
|     anchors.topMargin: frame.displacementTop * appSettings.windowScaling | ||||
|     anchors.bottomMargin: frame.displacementBottom * appSettings.windowScaling | ||||
|  | ||||
|     //The blur effect has to take into account the framerate | ||||
|     property real mBlur: appSettings.motion_blur | ||||
|     property real mBlur: appSettings.burnIn | ||||
|     property real motionBlurCoefficient: (_maxBlurCoefficient * Math.sqrt(mBlur) + _minBlurCoefficient * (1 - Math.sqrt(mBlur))) | ||||
|     property real _minBlurCoefficient: 0.50 | ||||
|     property real _maxBlurCoefficient: 0.90 | ||||
| @@ -83,7 +83,7 @@ Item{ | ||||
|  | ||||
|         colorScheme: "cool-retro-term" | ||||
|  | ||||
|         smooth: false | ||||
|         smooth: appSettings.rasterization === appSettings.no_rasterization | ||||
|         enableBold: false | ||||
|         fullCursorHeight: true | ||||
|  | ||||
| @@ -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"]); | ||||
|             } | ||||
| @@ -149,9 +150,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 +163,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 { | ||||
| @@ -210,7 +208,7 @@ Item{ | ||||
|             y = y / height; | ||||
|  | ||||
|             var cc = Qt.size(0.5 - x, 0.5 - y); | ||||
|             var distortion = (cc.height * cc.height + cc.width * cc.width) * appSettings.screen_distortion; | ||||
|             var distortion = (cc.height * cc.height + cc.width * cc.width) * appSettings.screenCurvature; | ||||
|  | ||||
|             return Qt.point((x - cc.width  * (1+distortion) * distortion) * kterminal.width, | ||||
|                            (y - cc.height * (1+distortion) * distortion) * kterminal.height) | ||||
| @@ -258,9 +256,10 @@ Item{ | ||||
|             // Restart blurred source settings change. | ||||
|             Connections{ | ||||
|                 target: appSettings | ||||
|                 onMotion_blurChanged: _blurredSourceEffect.restartBlurSource(); | ||||
|                 onBurnInChanged: _blurredSourceEffect.restartBlurSource(); | ||||
|                 onTerminalFontChanged: _blurredSourceEffect.restartBlurSource(); | ||||
|                 onRasterizationChanged: _blurredSourceEffect.restartBlurSource(); | ||||
|                 onBurnInQualityChanged: _blurredSourceEffect.restartBlurSource(); | ||||
|             } | ||||
|             Connections { | ||||
|                 target: kterminalScrollbar | ||||
| @@ -272,8 +271,8 @@ Item{ | ||||
|     Loader{ | ||||
|         id: blurredTerminalLoader | ||||
|  | ||||
|         width: kterminal.width * scaleTexture * appSettings.blur_quality | ||||
|         height: kterminal.height * scaleTexture * appSettings.blur_quality | ||||
|         width: kterminal.width * scaleTexture * appSettings.burnInQuality | ||||
|         height: kterminal.height * scaleTexture * appSettings.burnInQuality | ||||
|         active: mBlur !== 0 | ||||
|         asynchronous: true | ||||
|  | ||||
|   | ||||
| @@ -28,20 +28,21 @@ Tab{ | ||||
|         anchors.fill: parent | ||||
|         ColumnLayout{ | ||||
|             anchors.fill: parent | ||||
|             spacing: 2 | ||||
|             CheckableSlider{ | ||||
|                 name: qsTr("Bloom") | ||||
|                 onNewValue: appSettings.bloom_strength = newValue | ||||
|                 value: appSettings.bloom_strength | ||||
|                 onNewValue: appSettings.bloom = newValue | ||||
|                 value: appSettings.bloom | ||||
|             } | ||||
|             CheckableSlider{ | ||||
|                 name: qsTr("Motion Blur") | ||||
|                 onNewValue: appSettings.motion_blur = newValue | ||||
|                 value: appSettings.motion_blur | ||||
|                 name: qsTr("BurnIn") | ||||
|                 onNewValue: appSettings.burnIn = newValue | ||||
|                 value: appSettings.burnIn | ||||
|             } | ||||
|             CheckableSlider{ | ||||
|                 name: qsTr("Noise") | ||||
|                 onNewValue: appSettings.noise_strength = newValue | ||||
|                 value: appSettings.noise_strength | ||||
|                 name: qsTr("Static Noise") | ||||
|                 onNewValue: appSettings.staticNoise = newValue | ||||
|                 value: appSettings.staticNoise | ||||
|             } | ||||
|             CheckableSlider{ | ||||
|                 name: qsTr("Jitter") | ||||
| @@ -49,36 +50,36 @@ Tab{ | ||||
|                 value: appSettings.jitter | ||||
|             } | ||||
|             CheckableSlider{ | ||||
|                 name: qsTr("Glow") | ||||
|                 onNewValue: appSettings.glowing_line_strength = newValue; | ||||
|                 value: appSettings.glowing_line_strength | ||||
|                 name: qsTr("Glow Line") | ||||
|                 onNewValue: appSettings.glowingLine = newValue; | ||||
|                 value: appSettings.glowingLine | ||||
|             } | ||||
|             CheckableSlider{ | ||||
|                 name: qsTr("Screen distortion") | ||||
|                 onNewValue: appSettings.screen_distortion = newValue; | ||||
|                 value: appSettings.screen_distortion; | ||||
|                 name: qsTr("Screen Curvature") | ||||
|                 onNewValue: appSettings.screenCurvature = newValue; | ||||
|                 value: appSettings.screenCurvature; | ||||
|             } | ||||
|             CheckableSlider{ | ||||
|                 name: qsTr("Ambient light") | ||||
|                 onNewValue: appSettings.ambient_light = newValue; | ||||
|                 value: appSettings.ambient_light | ||||
|                 enabled: appSettings.frames_index !== 0 | ||||
|                 name: qsTr("Ambient Light") | ||||
|                 onNewValue: appSettings.ambientLight = newValue; | ||||
|                 value: appSettings.ambientLight | ||||
|                 enabled: appSettings.framesIndex !== 0 | ||||
|             } | ||||
|             CheckableSlider{ | ||||
|                 name: qsTr("Brightness flickering") | ||||
|                 onNewValue: appSettings.brightness_flickering = newValue; | ||||
|                 value: appSettings.brightness_flickering; | ||||
|                 name: qsTr("Flickering") | ||||
|                 onNewValue: appSettings.flickering = newValue; | ||||
|                 value: appSettings.flickering; | ||||
|             } | ||||
|             CheckableSlider{ | ||||
|                 name: qsTr("Horizontal flickering") | ||||
|                 onNewValue: appSettings.horizontal_sincronization = newValue; | ||||
|                 value: appSettings.horizontal_sincronization; | ||||
|                 name: qsTr("Horizontal Sync") | ||||
|                 onNewValue: appSettings.horizontalSync = newValue; | ||||
|                 value: appSettings.horizontalSync; | ||||
|             } | ||||
|             CheckableSlider{ | ||||
|                 name: qsTr("RGB shift") | ||||
|                 onNewValue: appSettings.rgb_shift = newValue; | ||||
|                 value: appSettings.rgb_shift; | ||||
|                 enabled: appSettings.chroma_color !== 0 | ||||
|                 name: qsTr("RGB Shift") | ||||
|                 onNewValue: appSettings.rbgShift = newValue; | ||||
|                 value: appSettings.rbgShift; | ||||
|                 enabled: appSettings.chromaColor !== 0 | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|   | ||||
| @@ -21,88 +21,180 @@ | ||||
| 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{ | ||||
|             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 | ||||
|                     model: appSettings.profiles_list | ||||
|                     currentIndex: appSettings.profiles_index | ||||
|                     anchors { top: parent.top; bottom: parent.bottom; } | ||||
|                     model: appSettings.profilesList | ||||
|                     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 | ||||
|                         text: qsTr("New") | ||||
|                         onClicked: { | ||||
|                             insertname.profileName = ""; | ||||
|                             insertname.show() | ||||
|                         } | ||||
|                     } | ||||
|                     Button{ | ||||
|                         Layout.fillWidth: true | ||||
|                         property alias currentIndex: profilesView.currentRow | ||||
|                         enabled: currentIndex >= 0 | ||||
|                         text: qsTr("Load") | ||||
|                         onClicked: { | ||||
|                             appSettings.profiles_index = 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") | ||||
|                         onClicked: insertname.show() | ||||
|                     } | ||||
|                     Button{ | ||||
|                         Layout.fillWidth: true | ||||
|                         text: qsTr("Remove Selected") | ||||
|                         enabled: !appSettings.profiles_list.get(profilesbox.currentIndex).builtin | ||||
|                         text: qsTr("Remove") | ||||
|                         property alias currentIndex: profilesView.currentRow | ||||
|  | ||||
|                         enabled: currentIndex >= 0 && !appSettings.profilesList.get(currentIndex).builtin | ||||
|                         onClicked: { | ||||
|                             appSettings.profiles_list.remove(profilesbox.currentIndex) | ||||
|                             profilesbox.currentIndex = profilesbox.currentIndex - 1 | ||||
|                             appSettings.profilesList.remove(currentIndex); | ||||
|                             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 { | ||||
|                         // Spacing | ||||
|                         Layout.fillHeight: true | ||||
|                     } | ||||
|                     Button{ | ||||
|                         Layout.fillWidth: true | ||||
|                         text: qsTr("Import") | ||||
|                         onClicked: { | ||||
|                             fileDialog.selectExisting = true; | ||||
|                             fileDialog.callBack = function (url) {loadFile(url);}; | ||||
|                             fileDialog.open(); | ||||
|                         } | ||||
|                         function loadFile(url) { | ||||
|                             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) { | ||||
|                             try { | ||||
|                                 var urlString = url.toString(); | ||||
|  | ||||
|                                 // Fix the extension if it's missing. | ||||
|                                 var extension = urlString.substring(urlString.length - 5, urlString.length); | ||||
|                                 var urlTail = (extension === ".json" ? "" : ".json"); | ||||
|                                 url += urlTail; | ||||
|  | ||||
|                                 if (true) | ||||
|                                     console.log("Storing file: " + url); | ||||
|  | ||||
|                                 var profileObject = appSettings.profilesList.get(currentIndex); | ||||
|                                 var profileSettings = JSON.parse(profileObject.obj_string); | ||||
|                                 profileSettings["name"] = profileObject.text; | ||||
|  | ||||
|                                 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(); | ||||
|                             } | ||||
|                         } | ||||
|                     } | ||||
|                 } | ||||
|                 InsertNameDialog{ | ||||
|                     id: insertname | ||||
|                     onNameSelected: appSettings.addNewCustomProfile(name) | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|         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.frames_list | ||||
|                     currentIndex: appSettings.frames_index | ||||
|                     onCurrentIndexChanged: appSettings.frames_index = currentIndex | ||||
|                 } | ||||
|         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; | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|   | ||||
| @@ -38,7 +38,7 @@ Tab{ | ||||
|                     property int fps: checked ? slider.value : 0 | ||||
|                     onFpsChanged: appSettings.fps = fps | ||||
|                     checked: appSettings.fps !== 0 | ||||
|                     text: qsTr("Limit FPS") | ||||
|                     text: qsTr("Effects FPS") | ||||
|                 } | ||||
|                 Slider{ | ||||
|                     id: slider | ||||
| @@ -54,10 +54,14 @@ Tab{ | ||||
|                 Slider{ | ||||
|                     Layout.fillWidth: true | ||||
|                     id: txtslider | ||||
|                     onValueChanged: appSettings.window_scaling = value; | ||||
|                     value: appSettings.window_scaling | ||||
|                     onValueChanged: if (enabled) appSettings.windowScaling = value; | ||||
|                     stepSize: 0.10 | ||||
|                     Component.onCompleted: minimumValue = 0.3 //Without this value gets set to 0.5 | ||||
|                     enabled: false | ||||
|                     Component.onCompleted: { | ||||
|                         minimumValue = 0.3 //Without this value gets set to 0.5 | ||||
|                         value = appSettings.windowScaling; | ||||
|                         enabled = true; | ||||
|                     } | ||||
|                 } | ||||
|                 Text{text: Math.round(txtslider.value * 100) + "%"} | ||||
|             } | ||||
| @@ -75,16 +79,20 @@ Tab{ | ||||
|                 Slider{ | ||||
|                     Layout.fillWidth: true | ||||
|                     id: bloomSlider | ||||
|                     onValueChanged: appSettings.bloom_quality = value; | ||||
|                     value: appSettings.bloom_quality | ||||
|                     onValueChanged: if (enabled) appSettings.bloomQuality = value; | ||||
|                     stepSize: 0.10 | ||||
|                     Component.onCompleted: minimumValue = 0.3 //Without this value gets set to 0.5 | ||||
|                     enabled: false | ||||
|                     Component.onCompleted: { | ||||
|                         minimumValue = 0.3 | ||||
|                         value = appSettings.bloomQuality; | ||||
|                         enabled = true; | ||||
|                     } | ||||
|                 } | ||||
|                 Text{text: Math.round(bloomSlider.value * 100) + "%"} | ||||
|             } | ||||
|         } | ||||
|         GroupBox{ | ||||
|             title: qsTr("Motion Blur") | ||||
|             title: qsTr("BurnIn") | ||||
|             Layout.fillWidth: true | ||||
|             anchors.left: parent.left | ||||
|             anchors.right: parent.right | ||||
| @@ -92,16 +100,20 @@ Tab{ | ||||
|                 id: blurQualityContainer | ||||
|                 anchors.fill: parent | ||||
|  | ||||
|                 Text{text: qsTr("Blur Quality")} | ||||
|                 Text{text: qsTr("BurnIn Quality")} | ||||
|                 Slider{ | ||||
|                     Layout.fillWidth: true | ||||
|                     id: blurSlider | ||||
|                     onValueChanged: appSettings.blur_quality = value; | ||||
|                     value: appSettings.blur_quality | ||||
|                     id: burnInSlider | ||||
|                     onValueChanged: if (enabled) appSettings.burnInQuality = value; | ||||
|                     stepSize: 0.10 | ||||
|                     Component.onCompleted: minimumValue = 0.3 //Without this value gets set to 0.5 | ||||
|                     enabled: false | ||||
|                     Component.onCompleted: { | ||||
|                         minimumValue = 0.3 | ||||
|                         value = appSettings.burnInQuality; | ||||
|                         enabled = true; | ||||
|                     } | ||||
|                 } | ||||
|                 Text{text: Math.round(blurSlider.value * 100) + "%"} | ||||
|                 Text{text: Math.round(burnInSlider.value * 100) + "%"} | ||||
|             } | ||||
|         } | ||||
|         GroupBox{ | ||||
|   | ||||
							
								
								
									
										94
									
								
								app/qml/SettingsScreenTab.qml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										94
									
								
								app/qml/SettingsScreenTab.qml
									
									
									
									
									
										Normal file
									
								
							| @@ -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 <http://www.gnu.org/licenses/>. | ||||
| *******************************************************************************/ | ||||
|  | ||||
| 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(); | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -26,22 +26,9 @@ 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 + ")" | ||||
|             Layout.fillWidth: true | ||||
|             property var rasterization: [qsTr("Default"), qsTr("Scanlines"), qsTr("Pixels")][appSettings.rasterization] | ||||
|             title: qsTr("Font" + "(" + rasterization + ")") | ||||
|             anchors { left: parent.left; right: parent.right } | ||||
|             GridLayout{ | ||||
|                 anchors.fill: parent | ||||
|                 columns: 2 | ||||
| @@ -63,7 +50,7 @@ Tab{ | ||||
|                     } | ||||
|                     Connections{ | ||||
|                         target: appSettings | ||||
|                         onRasterizationChanged: fontChanger.updateIndex(); | ||||
|                         onTerminalFontChanged: fontChanger.updateIndex(); | ||||
|                     } | ||||
|                     Component.onCompleted: updateIndex(); | ||||
|                 } | ||||
| @@ -114,38 +101,38 @@ 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{ | ||||
|                         name: qsTr("Font") | ||||
|                         height: 50 | ||||
|                         Layout.fillWidth: true | ||||
|                         onColorSelected: appSettings._font_color = color; | ||||
|                         button_color: appSettings._font_color | ||||
|                         onColorSelected: appSettings._fontColor = color; | ||||
|                         button_color: appSettings._fontColor | ||||
|                     } | ||||
|                     ColorButton{ | ||||
|                         name: qsTr("Background") | ||||
|                         height: 50 | ||||
|                         Layout.fillWidth: true | ||||
|                         onColorSelected: appSettings._background_color = color; | ||||
|                         button_color: appSettings._background_color | ||||
|                     } | ||||
|                 } | ||||
|                 ColumnLayout{ | ||||
|                     Layout.fillWidth: true | ||||
|                     CheckableSlider{ | ||||
|                         name: qsTr("Chroma Color") | ||||
|                         onNewValue: appSettings.chroma_color = newValue | ||||
|                         value: appSettings.chroma_color | ||||
|                     } | ||||
|                     CheckableSlider{ | ||||
|                         name: qsTr("Saturation Color") | ||||
|                         onNewValue: appSettings.saturation_color = newValue | ||||
|                         value: appSettings.saturation_color | ||||
|                         enabled: appSettings.chroma_color !== 0 | ||||
|                         onColorSelected: appSettings._backgroundColor = color; | ||||
|                         button_color: appSettings._backgroundColor | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|   | ||||
| @@ -27,8 +27,8 @@ import QtQuick.Dialogs 1.1 | ||||
| Window { | ||||
|     id: settings_window | ||||
|     title: qsTr("Settings") | ||||
|     width: 640 | ||||
|     height: 440 | ||||
|     width: 580 | ||||
|     height: 400 | ||||
|  | ||||
|     property int tabmargins: 15 | ||||
|  | ||||
| @@ -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") | ||||
|   | ||||
| @@ -26,33 +26,33 @@ ShaderEffect { | ||||
|     property ShaderEffectSource blurredSource | ||||
|     property ShaderEffectSource bloomSource | ||||
|  | ||||
|     property color font_color: appSettings.font_color | ||||
|     property color background_color: appSettings.background_color | ||||
|     property real bloom_strength: appSettings.bloom_strength * 2.5 | ||||
|     property color fontColor: appSettings.fontColor | ||||
|     property color backgroundColor: appSettings.backgroundColor | ||||
|     property real bloom: appSettings.bloom * 2.5 | ||||
|  | ||||
|     property real motion_blur: appSettings.motion_blur | ||||
|     property real burnIn: appSettings.burnIn | ||||
|  | ||||
|     property real jitter: appSettings.jitter * 0.007 | ||||
|     property real noise_strength: appSettings.noise_strength | ||||
|     property size scaleNoiseSize: Qt.size((width) / (noiseTexture.width * appSettings.window_scaling * appSettings.fontScaling), | ||||
|                                           (height) / (noiseTexture.height * appSettings.window_scaling * appSettings.fontScaling)) | ||||
|     property real staticNoise: appSettings.staticNoise | ||||
|     property size scaleNoiseSize: Qt.size((width) / (noiseTexture.width * appSettings.windowScaling * appSettings.fontScaling), | ||||
|                                           (height) / (noiseTexture.height * appSettings.windowScaling * appSettings.fontScaling)) | ||||
|  | ||||
|     property real screen_distorsion: appSettings.screen_distortion | ||||
|     property real glowing_line_strength: appSettings.glowing_line_strength | ||||
|     property real screenCurvature: appSettings.screenCurvature | ||||
|     property real glowingLine: appSettings.glowingLine | ||||
|  | ||||
|     property real chroma_color: appSettings.chroma_color; | ||||
|     property real chromaColor: appSettings.chromaColor; | ||||
|  | ||||
|     property real rgb_shift: appSettings.rgb_shift * 0.2 | ||||
|     property real rbgShift: appSettings.rbgShift * 0.2 | ||||
|  | ||||
|     property real brightness_flickering: appSettings.brightness_flickering | ||||
|     property real horizontal_sincronization: appSettings.horizontal_sincronization | ||||
|     property real flickering: appSettings.flickering | ||||
|     property real horizontalSync: appSettings.horizontalSync * 0.5 | ||||
|  | ||||
|     property bool frameReflections: appSettings.frameReflections | ||||
|  | ||||
|     property real disp_top: (frame.displacementTop * appSettings.window_scaling) / height | ||||
|     property real disp_bottom: (frame.displacementBottom * appSettings.window_scaling) / height | ||||
|     property real disp_left: (frame.displacementLeft * appSettings.window_scaling) / width | ||||
|     property real disp_right: (frame.displacementRight * appSettings.window_scaling) / width | ||||
|     property real disp_top: (frame.displacementTop * appSettings.windowScaling) / height | ||||
|     property real disp_bottom: (frame.displacementBottom * appSettings.windowScaling) / height | ||||
|     property real disp_left: (frame.displacementLeft * appSettings.windowScaling) / width | ||||
|     property real disp_right: (frame.displacementRight * appSettings.windowScaling) / width | ||||
|  | ||||
|     property real screen_brightness: appSettings.brightness * 1.5 + 0.5 | ||||
|  | ||||
| @@ -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 | ||||
| @@ -112,11 +112,11 @@ ShaderEffect { | ||||
|         (!fallBack ? " | ||||
|             uniform sampler2D noiseSource;" : "") + | ||||
|  | ||||
|         (!fallBack && brightness_flickering !== 0.0 ?" | ||||
|         (!fallBack && flickering !== 0.0 ?" | ||||
|             varying lowp float brightness; | ||||
|             uniform lowp float brightness_flickering;" : "") + | ||||
|         (!fallBack && horizontal_sincronization !== 0.0 ?" | ||||
|             uniform lowp float horizontal_sincronization; | ||||
|             uniform lowp float flickering;" : "") + | ||||
|         (!fallBack && horizontalSync !== 0.0 ?" | ||||
|             uniform lowp float horizontalSync; | ||||
|             varying lowp float distortionScale; | ||||
|             varying lowp float distortionFreq;" : "") + | ||||
|  | ||||
| @@ -126,16 +126,16 @@ ShaderEffect { | ||||
|             qt_TexCoord0.y = (qt_MultiTexCoord0.y - disp_top) / (1.0 - disp_top - disp_bottom); | ||||
|             vec2 coords = vec2(fract(time/(1024.0*2.0)), fract(time/(1024.0*1024.0)));" + | ||||
|  | ||||
|             (!fallBack && (brightness_flickering !== 0.0 || horizontal_sincronization !== 0.0) ? | ||||
|             (!fallBack && (flickering !== 0.0 || horizontalSync !== 0.0) ? | ||||
|                 "vec4 initialNoiseTexel = texture2D(noiseSource, coords);" | ||||
|             : "") + | ||||
|             (!fallBack && brightness_flickering !== 0.0 ? " | ||||
|                 brightness = 1.0 + (initialNoiseTexel.g - 0.5) * brightness_flickering;" | ||||
|             (!fallBack && flickering !== 0.0 ? " | ||||
|                 brightness = 1.0 + (initialNoiseTexel.g - 0.5) * flickering;" | ||||
|             : "") + | ||||
|  | ||||
|             (!fallBack && horizontal_sincronization !== 0.0 ? " | ||||
|                 float randval = horizontal_sincronization - initialNoiseTexel.r; | ||||
|                 distortionScale = step(0.0, randval) * randval * horizontal_sincronization; | ||||
|             (!fallBack && horizontalSync !== 0.0 ? " | ||||
|                 float randval = horizontalSync - initialNoiseTexel.r; | ||||
|                 distortionScale = step(0.0, randval) * randval * horizontalSync; | ||||
|                 distortionFreq = mix(4.0, 40.0, initialNoiseTexel.g);" | ||||
|             : "") + | ||||
|  | ||||
| @@ -148,50 +148,50 @@ ShaderEffect { | ||||
|         uniform highp float time; | ||||
|         varying highp vec2 qt_TexCoord0; | ||||
|  | ||||
|         uniform highp vec4 font_color; | ||||
|         uniform highp vec4 background_color; | ||||
|         uniform highp vec4 fontColor; | ||||
|         uniform highp vec4 backgroundColor; | ||||
|         uniform lowp float screen_brightness; | ||||
|  | ||||
|         uniform highp vec2 virtual_resolution; | ||||
|         uniform highp float dispX; | ||||
|         uniform highp float dispY;" + | ||||
|  | ||||
|         (bloom_strength !== 0 ? " | ||||
|         (bloom !== 0 ? " | ||||
|             uniform highp sampler2D bloomSource; | ||||
|             uniform lowp float bloom_strength;" : "") + | ||||
|         (motion_blur !== 0 ? " | ||||
|             uniform lowp float bloom;" : "") + | ||||
|         (burnIn !== 0 ? " | ||||
|             uniform sampler2D blurredSource;" : "") + | ||||
|         (noise_strength !== 0 ? " | ||||
|             uniform highp float noise_strength;" : "") + | ||||
|         (((noise_strength !== 0 || jitter !== 0 || rgb_shift) | ||||
|           ||(fallBack && (brightness_flickering || horizontal_sincronization))) ? " | ||||
|         (staticNoise !== 0 ? " | ||||
|             uniform highp float staticNoise;" : "") + | ||||
|         (((staticNoise !== 0 || jitter !== 0 || rbgShift) | ||||
|           ||(fallBack && (flickering || horizontalSync))) ? " | ||||
|             uniform lowp sampler2D noiseSource; | ||||
|             uniform highp vec2 scaleNoiseSize;" : "") + | ||||
|         (screen_distorsion !== 0 ? " | ||||
|             uniform highp float screen_distorsion;" : "") + | ||||
|         (glowing_line_strength !== 0 ? " | ||||
|             uniform highp float glowing_line_strength;" : "") + | ||||
|         (chroma_color !== 0 ? " | ||||
|             uniform lowp float chroma_color;" : "") + | ||||
|         (screenCurvature !== 0 ? " | ||||
|             uniform highp float screenCurvature;" : "") + | ||||
|         (glowingLine !== 0 ? " | ||||
|             uniform highp float glowingLine;" : "") + | ||||
|         (chromaColor !== 0 ? " | ||||
|             uniform lowp float chromaColor;" : "") + | ||||
|         (jitter !== 0 ? " | ||||
|             uniform lowp float jitter;" : "") + | ||||
|         (rgb_shift !== 0 ? " | ||||
|             uniform lowp float rgb_shift;" : "") + | ||||
|         (rbgShift !== 0 ? " | ||||
|             uniform lowp float rbgShift;" : "") + | ||||
|  | ||||
|         (fallBack && horizontal_sincronization !== 0 ? " | ||||
|             uniform lowp float horizontal_sincronization;" : "") + | ||||
|         (fallBack && brightness_flickering !== 0.0 ?" | ||||
|             uniform lowp float brightness_flickering;" : "") + | ||||
|         (!fallBack && brightness_flickering !== 0 ? " | ||||
|         (fallBack && horizontalSync !== 0 ? " | ||||
|             uniform lowp float horizontalSync;" : "") + | ||||
|         (fallBack && flickering !== 0.0 ?" | ||||
|             uniform lowp float flickering;" : "") + | ||||
|         (!fallBack && flickering !== 0 ? " | ||||
|             varying lowp float brightness;" | ||||
|         : "") + | ||||
|         (!fallBack && horizontal_sincronization !== 0 ? " | ||||
|         (!fallBack && horizontalSync !== 0 ? " | ||||
|             varying lowp float distortionScale; | ||||
|             varying lowp float distortionFreq;" : "") + | ||||
|  | ||||
|         (glowing_line_strength !== 0 ? " | ||||
|         (glowingLine !== 0 ? " | ||||
|             float randomPass(vec2 coords){ | ||||
|                 return fract(smoothstep(-0.2, 0.0, coords.y - 3.0 * fract(time * 0.0001))) * glowing_line_strength; | ||||
|                 return fract(smoothstep(-0.2, 0.0, coords.y - 3.0 * fract(time * 0.0001))) * glowingLine; | ||||
|             }" : "") + | ||||
|  | ||||
|         "highp float getScanlineIntensity(vec2 coords) { | ||||
| @@ -214,36 +214,38 @@ ShaderEffect { | ||||
|             "float distance = length(cc);" + | ||||
|  | ||||
|             //FallBack if there are problems | ||||
|             (fallBack && (brightness_flickering !== 0.0 || horizontal_sincronization !== 0.0) ? | ||||
|             (fallBack && (flickering !== 0.0 || horizontalSync !== 0.0) ? | ||||
|                 "vec2 initialCoords = vec2(fract(time/(1024.0*2.0)), fract(time/(1024.0*1024.0))); | ||||
|                  vec4 initialNoiseTexel = texture2D(noiseSource, initialCoords);" | ||||
|             : "") + | ||||
|             (fallBack && brightness_flickering !== 0.0 ? " | ||||
|                 float brightness = 1.0 + (initialNoiseTexel.g - 0.5) * brightness_flickering;" | ||||
|             (fallBack && flickering !== 0.0 ? " | ||||
|                 float brightness = 1.0 + (initialNoiseTexel.g - 0.5) * flickering;" | ||||
|             : "") + | ||||
|             (fallBack && horizontal_sincronization !== 0.0 ? " | ||||
|                 float randval = horizontal_sincronization - initialNoiseTexel.r; | ||||
|                 float distortionScale = step(0.0, randval) * randval * horizontal_sincronization; | ||||
|             (fallBack && horizontalSync !== 0.0 ? " | ||||
|                 float randval = horizontalSync - initialNoiseTexel.r; | ||||
|                 float distortionScale = step(0.0, randval) * randval * horizontalSync; | ||||
|                 float distortionFreq = mix(4.0, 40.0, initialNoiseTexel.g);" | ||||
|             : "") + | ||||
|  | ||||
|             (noise_strength ? " | ||||
|                 float noise = noise_strength;" : "") + | ||||
|             (staticNoise ? " | ||||
|                 float noise = staticNoise;" : "") + | ||||
|  | ||||
|             (screen_distorsion !== 0 ? " | ||||
|                 float distortion = dot(cc, cc) * screen_distorsion; | ||||
|                 vec2 coords = (qt_TexCoord0 - cc * (1.0 + distortion) * distortion);" | ||||
|             (screenCurvature !== 0 ? " | ||||
|                 float distortion = dot(cc, cc) * screenCurvature; | ||||
|                 vec2 staticCoords = (qt_TexCoord0 - cc * (1.0 + distortion) * distortion);" | ||||
|             :" | ||||
|                 vec2 coords = qt_TexCoord0;") + | ||||
|                 vec2 staticCoords = qt_TexCoord0;") + | ||||
|  | ||||
|             (horizontal_sincronization !== 0 ? " | ||||
|             "vec2 coords = staticCoords;" + | ||||
|  | ||||
|             (horizontalSync !== 0 ? " | ||||
|                 float dst = sin((coords.y + time * 0.001) * distortionFreq); | ||||
|                 coords.x += dst * distortionScale;" + | ||||
|                 (noise_strength ? " | ||||
|                     noise += distortionScale * 3.0;" : "") | ||||
|                 (staticNoise ? " | ||||
|                     noise += distortionScale * 7.0;" : "") | ||||
|             : "") + | ||||
|  | ||||
|             (jitter !== 0 || noise_strength !== 0 ? | ||||
|             (jitter !== 0 || staticNoise !== 0 ? | ||||
|                 "vec4 noiseTexel = texture2D(noiseSource, scaleNoiseSize * coords + vec2(fract(time / 51.0), fract(time / 237.0)));" | ||||
|             : "") + | ||||
|  | ||||
| @@ -254,54 +256,54 @@ ShaderEffect { | ||||
|  | ||||
|             "float color = 0.0;" + | ||||
|  | ||||
|             (noise_strength !== 0 ? " | ||||
|             (staticNoise !== 0 ? " | ||||
|                 float noiseVal = noiseTexel.a; | ||||
|                 color += noiseVal * noise * (1.0 - distance * 1.3);" : "") + | ||||
|  | ||||
|             (glowing_line_strength !== 0 ? " | ||||
|                 color += randomPass(coords) * glowing_line_strength;" : "") + | ||||
|             (glowingLine !== 0 ? " | ||||
|                 color += randomPass(coords) * glowingLine;" : "") + | ||||
|  | ||||
|             "vec3 txt_color = texture2D(source, txt_coords).rgb;" + | ||||
|  | ||||
|             (motion_blur !== 0 ? " | ||||
|             (burnIn !== 0 ? " | ||||
|                 vec4 txt_blur = texture2D(blurredSource, txt_coords); | ||||
|                 txt_color = txt_color + txt_blur.rgb * txt_blur.a;" | ||||
|             : "") + | ||||
|  | ||||
|              "float greyscale_color = rgb2grey(txt_color) + color;" + | ||||
|  | ||||
|             (chroma_color !== 0 ? | ||||
|                 (rgb_shift !== 0 ? " | ||||
|             (chromaColor !== 0 ? | ||||
|                 (rbgShift !== 0 ? " | ||||
|                     float rgb_noise = abs(texture2D(noiseSource, vec2(fract(time/(1024.0 * 256.0)), fract(time/(1024.0*1024.0)))).a - 0.5); | ||||
|                     float rcolor = texture2D(source, txt_coords + vec2(0.1, 0.0) * rgb_shift * rgb_noise).r; | ||||
|                     float bcolor = texture2D(source, txt_coords - vec2(0.1, 0.0) * rgb_shift * rgb_noise).b; | ||||
|                     float rcolor = texture2D(source, txt_coords + vec2(0.1, 0.0) * rbgShift * rgb_noise).r; | ||||
|                     float bcolor = texture2D(source, txt_coords - vec2(0.1, 0.0) * rbgShift * rgb_noise).b; | ||||
|                     txt_color.r = rcolor; | ||||
|                     txt_color.b = bcolor; | ||||
|                     greyscale_color = 0.33 * (rcolor + bcolor);" : "") + | ||||
|  | ||||
|                 "vec3 mixedColor = mix(font_color.rgb, txt_color * font_color.rgb, chroma_color); | ||||
|                  vec3 finalBackColor = mix(background_color.rgb, mixedColor, greyscale_color); | ||||
|                  vec3 finalColor = mix(finalBackColor, font_color.rgb, color).rgb;" | ||||
|                 "vec3 mixedColor = mix(fontColor.rgb, txt_color * fontColor.rgb, chromaColor); | ||||
|                  vec3 finalBackColor = mix(backgroundColor.rgb, mixedColor, greyscale_color); | ||||
|                  vec3 finalColor = mix(finalBackColor, fontColor.rgb, color).rgb;" | ||||
|             : | ||||
|                 "vec3 finalColor = mix(background_color.rgb, font_color.rgb, greyscale_color);") + | ||||
|                 "vec3 finalColor = mix(backgroundColor.rgb, fontColor.rgb, greyscale_color);") + | ||||
|  | ||||
|             "finalColor *= getScanlineIntensity(coords);" + | ||||
|  | ||||
|             (bloom_strength !== 0 ? | ||||
|             (bloom !== 0 ? | ||||
|                 "vec4 bloomFullColor = texture2D(bloomSource, coords); | ||||
|                  vec3 bloomColor = bloomFullColor.rgb; | ||||
|                  float bloomAlpha = bloomFullColor.a;" + | ||||
|                 (chroma_color !== 0 ? | ||||
|                     "bloomColor = font_color.rgb * mix(vec3(rgb2grey(bloomColor)), bloomColor, chroma_color);" | ||||
|                 (chromaColor !== 0 ? | ||||
|                     "bloomColor = fontColor.rgb * mix(vec3(rgb2grey(bloomColor)), bloomColor, chromaColor);" | ||||
|                 : | ||||
|                     "bloomColor = font_color.rgb * rgb2grey(bloomColor);") + | ||||
|                 "finalColor += bloomColor * bloom_strength * bloomAlpha;" | ||||
|                     "bloomColor = fontColor.rgb * rgb2grey(bloomColor);") + | ||||
|                 "finalColor += bloomColor * bloom * 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 ? " | ||||
|             (flickering !== 0 ? " | ||||
|                 finalColor *= brightness;" : "") + | ||||
|  | ||||
|             "gl_FragColor = vec4(finalColor * screen_brightness, qt_Opacity);" + | ||||
|   | ||||
| @@ -25,7 +25,7 @@ QtObject { | ||||
|     property bool initialized: false | ||||
|  | ||||
|     function getDatabase() { | ||||
|          return LocalStorage.openDatabaseSync("coololdterm", "1.0", "StorageDatabase", 100000); | ||||
|          return LocalStorage.openDatabaseSync("coolretroterm", "1.0", "StorageDatabase", 100000); | ||||
|     } | ||||
|  | ||||
|     function initialize() { | ||||
|   | ||||
| @@ -12,8 +12,8 @@ ShaderTerminal{ | ||||
|  | ||||
|     source: terminal.mainSource | ||||
|     blurredSource: terminal.blurredSource | ||||
|     dispX: (12 / width) * appSettings.window_scaling | ||||
|     dispY: (12 / height) * appSettings.window_scaling | ||||
|     dispX: (12 / width) * appSettings.windowScaling | ||||
|     dispY: (12 / height) * appSettings.windowScaling | ||||
|     virtual_resolution: terminal.virtualResolution | ||||
|  | ||||
|     Loader{ | ||||
| @@ -29,7 +29,7 @@ ShaderTerminal{ | ||||
|         visible: status === Loader.Ready | ||||
|  | ||||
|         z: 2.1 | ||||
|         source: appSettings.frame_source | ||||
|         source: appSettings.frameSource | ||||
|     } | ||||
|  | ||||
|     PreprocessedTerminal{ | ||||
| @@ -41,19 +41,19 @@ ShaderTerminal{ | ||||
|  | ||||
|     Loader{ | ||||
|         id: bloomEffectLoader | ||||
|         active: appSettings.bloom_strength | ||||
|         active: appSettings.bloom | ||||
|         asynchronous: true | ||||
|         width: parent.width * appSettings.bloom_quality | ||||
|         height: parent.height * appSettings.bloom_quality | ||||
|         width: parent.width * appSettings.bloomQuality | ||||
|         height: parent.height * appSettings.bloomQuality | ||||
|         sourceComponent: FastBlur{ | ||||
|             radius: 48 * appSettings.bloom_quality * appSettings.window_scaling | ||||
|             radius: 48 * appSettings.bloomQuality * appSettings.windowScaling | ||||
|             source: terminal.mainTerminal | ||||
|             transparentBorder: true | ||||
|         } | ||||
|     } | ||||
|     Loader{ | ||||
|         id: bloomSourceLoader | ||||
|         active: appSettings.bloom_strength !== 0 | ||||
|         active: appSettings.bloom !== 0 | ||||
|         asynchronous: true | ||||
|         sourceComponent: ShaderEffectSource{ | ||||
|             id: _bloomEffectSource | ||||
| @@ -75,8 +75,8 @@ ShaderTerminal{ | ||||
| //        width: parent.width | ||||
| //        height: parent.height | ||||
| //        property real outColor: 0.0 | ||||
| //        property real dispX: (5 / width) * appSettings.window_scaling | ||||
| //        property real dispY: (5 / height) * appSettings.window_scaling | ||||
| //        property real dispX: (5 / width) * appSettings.windowScaling | ||||
| //        property real dispY: (5 / height) * appSettings.windowScaling | ||||
| //        property size virtual_resolution: terminal.virtualResolution | ||||
|  | ||||
| //        blending: false | ||||
|   | ||||
| @@ -5,8 +5,8 @@ import "../../utils.js" as Utils | ||||
|  | ||||
| Item{ | ||||
|     id: framecontainer | ||||
|     property int textureWidth: terminalContainer.width / appSettings.window_scaling | ||||
|     property int textureHeight: terminalContainer.height / appSettings.window_scaling | ||||
|     property int textureWidth: terminalContainer.width / appSettings.windowScaling | ||||
|     property int textureHeight: terminalContainer.height / appSettings.windowScaling | ||||
|  | ||||
|     property int addedWidth | ||||
|     property int addedHeight | ||||
| @@ -105,12 +105,12 @@ Item{ | ||||
|         id: staticLight | ||||
|         property alias source: framesource | ||||
|         property alias normals: framesourcenormals | ||||
|         property real screen_distorsion: appSettings.screen_distortion | ||||
|         property real screenCurvature: appSettings.screenCurvature | ||||
|         property size curvature_coefficients: Qt.size(width / mainShader.width, height / mainShader.height) | ||||
|         property real ambient_light: appSettings.ambient_light | ||||
|         property color font_color: appSettings.font_color | ||||
|         property color background_color: appSettings.background_color | ||||
|         property color reflectionColor: Utils.mix(font_color, background_color, 0.2) | ||||
|         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) | ||||
|         property real diffuseComponent: staticDiffuseComponent | ||||
|  | ||||
|         anchors.centerIn: parent | ||||
| @@ -122,9 +122,9 @@ 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 ambient_light; | ||||
|             uniform lowp float ambientLight; | ||||
|             uniform highp float qt_Opacity; | ||||
|             uniform lowp vec4 reflectionColor; | ||||
|             uniform lowp float diffuseComponent; | ||||
| @@ -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); | ||||
|             } | ||||
|  | ||||
| @@ -151,7 +151,7 @@ Item{ | ||||
|                 float dotProd = dot(normal, vec3(lightDirection, 0.0)) * diffuseComponent * txtNormal.a; | ||||
|  | ||||
|                 vec3 darkColor = dotProd * reflectionColor.rgb; | ||||
|                 gl_FragColor = vec4(mix(darkColor, txtColor.rgb, ambient_light), dotProd); | ||||
|                 gl_FragColor = vec4(mix(darkColor, txtColor.rgb, ambientLight), dotProd); | ||||
|             } | ||||
|         " | ||||
|  | ||||
| @@ -174,8 +174,8 @@ Item{ | ||||
|             property ShaderEffectSource lightMask: staticLightSource | ||||
|             property ShaderEffectSource reflectionSource: reflectionEffectSourceLoader.item | ||||
|             property real diffuseComponent: dinamycDiffuseComponent | ||||
|             property real chroma_color: appSettings.chroma_color | ||||
|             property color font_color: appSettings.font_color | ||||
|             property real chromaColor: appSettings.chromaColor | ||||
|             property color fontColor: appSettings.fontColor | ||||
|  | ||||
|             visible: true | ||||
|             blending: true | ||||
| @@ -184,8 +184,8 @@ Item{ | ||||
|                 uniform sampler2D lightMask; | ||||
|                 uniform sampler2D reflectionSource; | ||||
|                 uniform lowp float diffuseComponent; | ||||
|                 uniform lowp float chroma_color; | ||||
|                 uniform highp vec4 font_color; | ||||
|                 uniform lowp float chromaColor; | ||||
|                 uniform highp vec4 fontColor; | ||||
|                 uniform highp float qt_Opacity; | ||||
|  | ||||
|                 varying highp vec2 qt_TexCoord0; | ||||
| @@ -197,9 +197,9 @@ Item{ | ||||
|                 void main() { | ||||
|                     float alpha = texture2D(lightMask, qt_TexCoord0).a * diffuseComponent; | ||||
|                     vec3 reflectionColor = texture2D(reflectionSource, qt_TexCoord0).rgb; | ||||
|                     vec3 color = font_color.rgb * rgb2grey(reflectionColor);" + | ||||
|                     (chroma_color !== 0 ? | ||||
|                         "color = mix(color, font_color.rgb * reflectionColor, chroma_color);" | ||||
|                     vec3 color = fontColor.rgb * rgb2grey(reflectionColor);" + | ||||
|                     (chromaColor !== 0 ? | ||||
|                         "color = mix(color, fontColor.rgb * reflectionColor, chromaColor);" | ||||
|                     : "") + | ||||
|                     "gl_FragColor = vec4(color, 1.0) * alpha; | ||||
|                 } | ||||
|   | ||||
| @@ -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 | ||||
| @@ -116,12 +116,12 @@ ApplicationWindow{ | ||||
|     TerminalContainer{ | ||||
|         id: terminalContainer | ||||
|         y: appSettings.showMenubar ? 0 : -2 // Workaroud to hide the margin in the menubar. | ||||
|         width: parent.width * appSettings.window_scaling | ||||
|         height: (parent.height + Math.abs(y)) * appSettings.window_scaling | ||||
|         width: parent.width * appSettings.windowScaling | ||||
|         height: (parent.height + Math.abs(y)) * appSettings.windowScaling | ||||
|  | ||||
|         transform: Scale { | ||||
|             xScale: 1 / appSettings.window_scaling | ||||
|             yScale: 1 / appSettings.window_scaling | ||||
|             xScale: 1 / appSettings.windowScaling | ||||
|             yScale: 1 / appSettings.windowScaling | ||||
|         } | ||||
|     } | ||||
|     SettingsWindow{ | ||||
| @@ -134,7 +134,7 @@ ApplicationWindow{ | ||||
|     } | ||||
|     Loader{ | ||||
|         anchors.centerIn: parent | ||||
|         active: appSettings.show_terminal_size | ||||
|         active: appSettings.showTerminalSize | ||||
|         sourceComponent: SizeOverlay{ | ||||
|             z: 3 | ||||
|             terminalSize: terminalContainer.terminalSize | ||||
|   | ||||
| @@ -49,5 +49,6 @@ | ||||
|         <file>fonts/modern-hermit/Hermit-medium.otf</file> | ||||
|         <file>fonts/modern-envy-code-r/Envy Code R.ttf</file> | ||||
|         <file>fonts/modern-inconsolata/Inconsolata.otf</file> | ||||
|         <file>SettingsScreenTab.qml</file> | ||||
|     </qresource> | ||||
| </RCC> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user