mirror of
				https://github.com/Swordfish90/cool-retro-term.git
				synced 2025-11-04 00:52:11 +00:00 
			
		
		
		
	Fix: improve profile and settings printing and disable it by default.
This commit is contained in:
		@@ -37,6 +37,7 @@ int main(int argc, char *argv[])
 | 
			
		||||
        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;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -36,10 +36,13 @@ Item{
 | 
			
		||||
    property bool show_terminal_size: true
 | 
			
		||||
 | 
			
		||||
    property real window_scaling: 1.0
 | 
			
		||||
    onWindow_scalingChanged: handleFontChanged();
 | 
			
		||||
 | 
			
		||||
    property real fps: 24
 | 
			
		||||
 | 
			
		||||
    property bool verbose: false
 | 
			
		||||
 | 
			
		||||
    onWindow_scalingChanged: handleFontChanged();
 | 
			
		||||
 | 
			
		||||
    function mix(c1, c2, alpha){
 | 
			
		||||
        return Qt.rgba(c1.r * alpha + c2.r * (1-alpha),
 | 
			
		||||
                       c1.g * alpha + c2.g * (1-alpha),
 | 
			
		||||
@@ -165,6 +168,13 @@ Item{
 | 
			
		||||
 | 
			
		||||
    Storage{id: storage}
 | 
			
		||||
 | 
			
		||||
    function stringify(obj) {
 | 
			
		||||
        var replacer = function(key, val) {
 | 
			
		||||
            return val.toFixed ? Number(val.toFixed(4)) : val;
 | 
			
		||||
        }
 | 
			
		||||
        return JSON.stringify(obj, replacer, 2);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    function composeSettingsString(){
 | 
			
		||||
        var settings = {
 | 
			
		||||
            fps: fps,
 | 
			
		||||
@@ -177,7 +187,7 @@ Item{
 | 
			
		||||
            scanline_quality: scanline_quality,
 | 
			
		||||
            bloom_quality: bloom_quality
 | 
			
		||||
        }
 | 
			
		||||
        return JSON.stringify(settings);
 | 
			
		||||
        return stringify(settings);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    function composeProfileString(){
 | 
			
		||||
@@ -204,7 +214,7 @@ Item{
 | 
			
		||||
            fontIndex: fontIndexes[rasterization],
 | 
			
		||||
            fontWidth: fontWidth
 | 
			
		||||
        }
 | 
			
		||||
        return JSON.stringify(settings);
 | 
			
		||||
        return stringify(settings);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    function loadSettings(){
 | 
			
		||||
@@ -217,6 +227,7 @@ Item{
 | 
			
		||||
        loadSettingsString(settingsString);
 | 
			
		||||
        loadProfileString(profileString);
 | 
			
		||||
 | 
			
		||||
        if (verbose)
 | 
			
		||||
            console.log("Loading settings: " + settingsString + profileString);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -227,9 +238,11 @@ Item{
 | 
			
		||||
        storage.setSetting("_CURRENT_SETTINGS", settingsString);
 | 
			
		||||
        storage.setSetting("_CURRENT_PROFILE", profileString);
 | 
			
		||||
 | 
			
		||||
        if (verbose) {
 | 
			
		||||
            console.log("Storing settings: " + settingsString);
 | 
			
		||||
            console.log("Storing profile: " + profileString);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    function loadSettingsString(settingsString){
 | 
			
		||||
        var settings = JSON.parse(settingsString);
 | 
			
		||||
@@ -298,7 +311,7 @@ Item{
 | 
			
		||||
        var customProfiles = JSON.parse(customProfilesString);
 | 
			
		||||
        for (var i=0; i<customProfiles.length; i++) {
 | 
			
		||||
            var profile = customProfiles[i];
 | 
			
		||||
            console.log("Loading custom profile: " + JSON.stringify(profile));
 | 
			
		||||
            console.log("Loading custom profile: " + stringify(profile));
 | 
			
		||||
            profiles_list.append(profile);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
@@ -310,7 +323,7 @@ Item{
 | 
			
		||||
            if(profile.builtin) continue;
 | 
			
		||||
            customProfiles.push({text: profile.text, obj_string: profile.obj_string, builtin: false})
 | 
			
		||||
        }
 | 
			
		||||
        return JSON.stringify(customProfiles);
 | 
			
		||||
        return stringify(customProfiles);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    function loadCurrentProfile(){
 | 
			
		||||
@@ -389,6 +402,9 @@ Item{
 | 
			
		||||
    Component.onCompleted: {
 | 
			
		||||
        // Manage the arguments from the QML side.
 | 
			
		||||
        var args = Qt.application.arguments;
 | 
			
		||||
        if (args.indexOf("--verbose") !== -1) {
 | 
			
		||||
            verbose = true;
 | 
			
		||||
        }
 | 
			
		||||
        if (args.indexOf("--default-settings") === -1) {
 | 
			
		||||
            loadSettings();
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user