mirror of
				https://github.com/Swordfish90/cool-retro-term.git
				synced 2025-10-30 22:54:21 +00:00 
			
		
		
		
	Some code cleanups.
This commit is contained in:
		| @@ -20,14 +20,18 @@ | |||||||
| 
 | 
 | ||||||
| import QtQuick 2.2 | import QtQuick 2.2 | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| Item{ | Item{ | ||||||
|  | 
 | ||||||
|  |     // GENERAL SETTINGS /////////////////////////////////////////////////// | ||||||
|  | 
 | ||||||
|     property bool fullscreen: false |     property bool fullscreen: false | ||||||
| 
 | 
 | ||||||
|     property real ambient_light: 0.2 |     property real ambient_light: 0.2 | ||||||
|     property real contrast: 0.85 |     property real contrast: 0.85 | ||||||
|     property real brightness: 0.5 |     property real brightness: 0.5 | ||||||
| 
 | 
 | ||||||
|     //On resize shows an overlay with the current size |  | ||||||
|     property bool show_terminal_size: true |     property bool show_terminal_size: true | ||||||
| 
 | 
 | ||||||
|     property real window_scaling: 1.0 |     property real window_scaling: 1.0 | ||||||
| @@ -48,7 +52,8 @@ Item{ | |||||||
|         return Qt.rgba(r, g, b, 1.0); |         return Qt.rgba(r, g, b, 1.0); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     //Probably there is a better way to cast string to colors. |     // PROFILE SETTINGS /////////////////////////////////////////////////////// | ||||||
|  | 
 | ||||||
|     property string _background_color: "#000000" |     property string _background_color: "#000000" | ||||||
|     property string _font_color: "#ff8100" |     property string _font_color: "#ff8100" | ||||||
|     property color font_color: mix(strToColor(_font_color), strToColor(_background_color), 0.7 + (contrast * 0.3)) |     property color font_color: mix(strToColor(_font_color), strToColor(_background_color), 0.7 + (contrast * 0.3)) | ||||||
| @@ -83,6 +88,8 @@ Item{ | |||||||
|     property var frames_list: framelist |     property var frames_list: framelist | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  |     // FONTS ////////////////////////////////////////////////////////////////// | ||||||
|  | 
 | ||||||
|     signal terminalFontChanged(string fontSource, int pixelSize, int lineSpacing, size virtualCharSize) |     signal terminalFontChanged(string fontSource, int pixelSize, int lineSpacing, size virtualCharSize) | ||||||
| 
 | 
 | ||||||
|     Loader{ |     Loader{ | ||||||
| @@ -119,12 +126,16 @@ Item{ | |||||||
|         terminalFontChanged(fontSource, pixelSize, lineSpacing, virtualCharSize); |         terminalFontChanged(fontSource, pixelSize, lineSpacing, virtualCharSize); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     // FRAMES ///////////////////////////////////////////////////////////////// | ||||||
|  | 
 | ||||||
|     property bool frame_reflections: true |     property bool frame_reflections: true | ||||||
|     property real frame_reflection_strength: ((frame_reflections && framelist.get(frames_index).reflections) ? 1.0 : 0.0) * 0.15 |     property real frame_reflection_strength: ((frame_reflections && framelist.get(frames_index).reflections) ? 1.0 : 0.0) * 0.15 | ||||||
| 
 | 
 | ||||||
|     property alias profiles_list: profileslist |     property alias profiles_list: profileslist | ||||||
|     property int profiles_index: 0 |     property int profiles_index: 0 | ||||||
| 
 | 
 | ||||||
|  |     // DB STORAGE ///////////////////////////////////////////////////////////// | ||||||
|  | 
 | ||||||
|     Storage{id: storage} |     Storage{id: storage} | ||||||
| 
 | 
 | ||||||
|     function composeSettingsString(){ |     function composeSettingsString(){ | ||||||
| @@ -268,15 +279,7 @@ Item{ | |||||||
|         profileslist.append({text: name, obj_string: profileString, builtin: false}); |         profileslist.append({text: name, obj_string: profileString, builtin: false}); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     Component.onCompleted: { |     // PROFILES /////////////////////////////////////////////////////////////// | ||||||
|         loadSettings(); |  | ||||||
|         loadCustomProfiles(); |  | ||||||
|     } |  | ||||||
|     Component.onDestruction: { |  | ||||||
|         storeSettings(); |  | ||||||
|         storeCustomProfiles(); |  | ||||||
|         //storage.dropSettings(); //DROPS THE SETTINGS!.. REMEMBER TO DISABLE ONCE ENABLED!! |  | ||||||
|     } |  | ||||||
| 
 | 
 | ||||||
|     ListModel{ |     ListModel{ | ||||||
|         id: profileslist |         id: profileslist | ||||||
| @@ -316,4 +319,14 @@ Item{ | |||||||
|             builtin: true |             builtin: true | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  | 
 | ||||||
|  |     Component.onCompleted: { | ||||||
|  |         loadSettings(); | ||||||
|  |         loadCustomProfiles(); | ||||||
|  |     } | ||||||
|  |     Component.onDestruction: { | ||||||
|  |         storeSettings(); | ||||||
|  |         storeCustomProfiles(); | ||||||
|  |         //storage.dropSettings(); //DROPS THE SETTINGS!.. REMEMBER TO DISABLE ONCE ENABLED!! | ||||||
|  |     } | ||||||
| } | } | ||||||
| @@ -1,4 +1,24 @@ | |||||||
| import QtQuick 2.0 | /******************************************************************************* | ||||||
|  | * Copyright (c) 2013 "Filippo Scognamiglio" | ||||||
|  | * https://github.com/Swordifish90/cool-old-term | ||||||
|  | * | ||||||
|  | * This file is part of cool-old-term. | ||||||
|  | * | ||||||
|  | * cool-old-term is free software: you can redistribute it and/or modify | ||||||
|  | * it under the terms of the GNU General Public License as published by | ||||||
|  | * the Free Software Foundation, either version 3 of the License, or | ||||||
|  | * (at your option) any later version. | ||||||
|  | * | ||||||
|  | * This program is distributed in the hope that it will be useful, | ||||||
|  | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||
|  | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||||
|  | * GNU General Public License for more details. | ||||||
|  | * | ||||||
|  | * You should have received a copy of the GNU General Public License | ||||||
|  | * along with this program.  If not, see <http://www.gnu.org/licenses/>. | ||||||
|  | *******************************************************************************/ | ||||||
|  |  | ||||||
|  | import QtQuick 2.2 | ||||||
|  |  | ||||||
| Item{ | Item{ | ||||||
|     property int selectedFontIndex |     property int selectedFontIndex | ||||||
|   | |||||||
| @@ -1,4 +1,24 @@ | |||||||
| import QtQuick 2.0 | /******************************************************************************* | ||||||
|  | * Copyright (c) 2013 "Filippo Scognamiglio" | ||||||
|  | * https://github.com/Swordifish90/cool-old-term | ||||||
|  | * | ||||||
|  | * This file is part of cool-old-term. | ||||||
|  | * | ||||||
|  | * cool-old-term is free software: you can redistribute it and/or modify | ||||||
|  | * it under the terms of the GNU General Public License as published by | ||||||
|  | * the Free Software Foundation, either version 3 of the License, or | ||||||
|  | * (at your option) any later version. | ||||||
|  | * | ||||||
|  | * This program is distributed in the hope that it will be useful, | ||||||
|  | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||
|  | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||||
|  | * GNU General Public License for more details. | ||||||
|  | * | ||||||
|  | * You should have received a copy of the GNU General Public License | ||||||
|  | * along with this program.  If not, see <http://www.gnu.org/licenses/>. | ||||||
|  | *******************************************************************************/ | ||||||
|  |  | ||||||
|  | import QtQuick 2.2 | ||||||
|  |  | ||||||
| Item{ | Item{ | ||||||
|     property int selectedFontIndex |     property int selectedFontIndex | ||||||
|   | |||||||
| @@ -1,4 +1,24 @@ | |||||||
| import QtQuick 2.0 | /******************************************************************************* | ||||||
|  | * Copyright (c) 2013 "Filippo Scognamiglio" | ||||||
|  | * https://github.com/Swordifish90/cool-old-term | ||||||
|  | * | ||||||
|  | * This file is part of cool-old-term. | ||||||
|  | * | ||||||
|  | * cool-old-term is free software: you can redistribute it and/or modify | ||||||
|  | * it under the terms of the GNU General Public License as published by | ||||||
|  | * the Free Software Foundation, either version 3 of the License, or | ||||||
|  | * (at your option) any later version. | ||||||
|  | * | ||||||
|  | * This program is distributed in the hope that it will be useful, | ||||||
|  | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||
|  | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||||
|  | * GNU General Public License for more details. | ||||||
|  | * | ||||||
|  | * You should have received a copy of the GNU General Public License | ||||||
|  | * along with this program.  If not, see <http://www.gnu.org/licenses/>. | ||||||
|  | *******************************************************************************/ | ||||||
|  |  | ||||||
|  | import QtQuick 2.2 | ||||||
|  |  | ||||||
| Item{ | Item{ | ||||||
|     property int selectedFontIndex |     property int selectedFontIndex | ||||||
|   | |||||||
| @@ -1,4 +1,24 @@ | |||||||
| import QtQuick 2.1 | /******************************************************************************* | ||||||
|  | * Copyright (c) 2013 "Filippo Scognamiglio" | ||||||
|  | * https://github.com/Swordifish90/cool-old-term | ||||||
|  | * | ||||||
|  | * This file is part of cool-old-term. | ||||||
|  | * | ||||||
|  | * cool-old-term is free software: you can redistribute it and/or modify | ||||||
|  | * it under the terms of the GNU General Public License as published by | ||||||
|  | * the Free Software Foundation, either version 3 of the License, or | ||||||
|  | * (at your option) any later version. | ||||||
|  | * | ||||||
|  | * This program is distributed in the hope that it will be useful, | ||||||
|  | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||
|  | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||||
|  | * GNU General Public License for more details. | ||||||
|  | * | ||||||
|  | * You should have received a copy of the GNU General Public License | ||||||
|  | * along with this program.  If not, see <http://www.gnu.org/licenses/>. | ||||||
|  | *******************************************************************************/ | ||||||
|  |  | ||||||
|  | import QtQuick 2.2 | ||||||
| import QtQuick.Window 2.0 | import QtQuick.Window 2.0 | ||||||
| import QtQuick.Controls 1.1 | import QtQuick.Controls 1.1 | ||||||
| import QtQuick.Layouts 1.1 | import QtQuick.Layouts 1.1 | ||||||
|   | |||||||
| @@ -57,7 +57,6 @@ Item{ | |||||||
|     property size terminalSize: kterminal.terminalSize |     property size terminalSize: kterminal.terminalSize | ||||||
|     property size paintedTextSize |     property size paintedTextSize | ||||||
| 
 | 
 | ||||||
|     //Force reload of the blursource when settings change |  | ||||||
|     onMBlurChanged: restartBlurredSource() |     onMBlurChanged: restartBlurredSource() | ||||||
| 
 | 
 | ||||||
|     function restartBlurredSource(){ |     function restartBlurredSource(){ | ||||||
| @@ -98,7 +97,6 @@ Item{ | |||||||
|         function isValid(size){ |         function isValid(size){ | ||||||
|             return size.width >= 0 && size.height >= 0; |             return size.width >= 0 && size.height >= 0; | ||||||
|         } |         } | ||||||
| 
 |  | ||||||
|         function handleFontChange(fontSource, pixelSize, lineSpacing, virtualCharSize){ |         function handleFontChange(fontSource, pixelSize, lineSpacing, virtualCharSize){ | ||||||
|             fontLoader.source = fontSource; |             fontLoader.source = fontSource; | ||||||
|             font.pixelSize = pixelSize * shadersettings.window_scaling; |             font.pixelSize = pixelSize * shadersettings.window_scaling; | ||||||
| @@ -258,10 +256,12 @@ Item{ | |||||||
|         "gl_FragColor.a = floor(color) / 256.0;" + |         "gl_FragColor.a = floor(color) / 256.0;" + | ||||||
|         "}" |         "}" | ||||||
|     } |     } | ||||||
|     ////////////////////////////////////////////////////////////////////// |     /////////////////////////////////////////////////////////////////////////// | ||||||
|     //EFFECTS |     //  EFFECTS  ////////////////////////////////////////////////////////////// | ||||||
|     ////////////////////////////////////////////////////////////////////// |     /////////////////////////////////////////////////////////////////////////// | ||||||
|     //Bloom | 
 | ||||||
|  |     //  BLOOM  //////////////////////////////////////////////////////////////// | ||||||
|  | 
 | ||||||
|     Loader{ |     Loader{ | ||||||
|         id: bloomEffectLoader |         id: bloomEffectLoader | ||||||
|         active: mBloom != 0 |         active: mBloom != 0 | ||||||
| @@ -284,7 +284,8 @@ Item{ | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     //Rasterization mask |     //  NOISE  //////////////////////////////////////////////////////////////// | ||||||
|  | 
 | ||||||
|     ShaderEffect { |     ShaderEffect { | ||||||
|         id: staticNoiseEffect |         id: staticNoiseEffect | ||||||
|         anchors.fill: parent |         anchors.fill: parent | ||||||
| @@ -333,7 +334,8 @@ Item{ | |||||||
|         format: ShaderEffectSource.Alpha |         format: ShaderEffectSource.Alpha | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     //Rasterization mask |     // RASTERIZATION ////////////////////////////////////////////////////////// | ||||||
|  | 
 | ||||||
|     ShaderEffect { |     ShaderEffect { | ||||||
|         id: rasterizationEffect |         id: rasterizationEffect | ||||||
|         anchors.fill: parent |         anchors.fill: parent | ||||||
| @@ -1,3 +1,23 @@ | |||||||
|  | /******************************************************************************* | ||||||
|  | * Copyright (c) 2013 "Filippo Scognamiglio" | ||||||
|  | * https://github.com/Swordifish90/cool-old-term | ||||||
|  | * | ||||||
|  | * This file is part of cool-old-term. | ||||||
|  | * | ||||||
|  | * cool-old-term is free software: you can redistribute it and/or modify | ||||||
|  | * it under the terms of the GNU General Public License as published by | ||||||
|  | * the Free Software Foundation, either version 3 of the License, or | ||||||
|  | * (at your option) any later version. | ||||||
|  | * | ||||||
|  | * This program is distributed in the hope that it will be useful, | ||||||
|  | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||
|  | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||||
|  | * GNU General Public License for more details. | ||||||
|  | * | ||||||
|  | * You should have received a copy of the GNU General Public License | ||||||
|  | * along with this program.  If not, see <http://www.gnu.org/licenses/>. | ||||||
|  | *******************************************************************************/ | ||||||
|  |  | ||||||
| import QtQuick 2.2 | import QtQuick 2.2 | ||||||
| import QtQuick.Controls 1.1 | import QtQuick.Controls 1.1 | ||||||
| import QtQuick.Layouts 1.1 | import QtQuick.Layouts 1.1 | ||||||
|   | |||||||
| @@ -1,3 +1,23 @@ | |||||||
|  | /******************************************************************************* | ||||||
|  | * Copyright (c) 2013 "Filippo Scognamiglio" | ||||||
|  | * https://github.com/Swordifish90/cool-old-term | ||||||
|  | * | ||||||
|  | * This file is part of cool-old-term. | ||||||
|  | * | ||||||
|  | * cool-old-term is free software: you can redistribute it and/or modify | ||||||
|  | * it under the terms of the GNU General Public License as published by | ||||||
|  | * the Free Software Foundation, either version 3 of the License, or | ||||||
|  | * (at your option) any later version. | ||||||
|  | * | ||||||
|  | * This program is distributed in the hope that it will be useful, | ||||||
|  | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||
|  | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||||
|  | * GNU General Public License for more details. | ||||||
|  | * | ||||||
|  | * You should have received a copy of the GNU General Public License | ||||||
|  | * along with this program.  If not, see <http://www.gnu.org/licenses/>. | ||||||
|  | *******************************************************************************/ | ||||||
|  |  | ||||||
| import QtQuick 2.2 | import QtQuick 2.2 | ||||||
| import QtQuick.Controls 1.1 | import QtQuick.Controls 1.1 | ||||||
| import QtQuick.Layouts 1.1 | import QtQuick.Layouts 1.1 | ||||||
|   | |||||||
| @@ -1,3 +1,23 @@ | |||||||
|  | /******************************************************************************* | ||||||
|  | * Copyright (c) 2013 "Filippo Scognamiglio" | ||||||
|  | * https://github.com/Swordifish90/cool-old-term | ||||||
|  | * | ||||||
|  | * This file is part of cool-old-term. | ||||||
|  | * | ||||||
|  | * cool-old-term is free software: you can redistribute it and/or modify | ||||||
|  | * it under the terms of the GNU General Public License as published by | ||||||
|  | * the Free Software Foundation, either version 3 of the License, or | ||||||
|  | * (at your option) any later version. | ||||||
|  | * | ||||||
|  | * This program is distributed in the hope that it will be useful, | ||||||
|  | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||
|  | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||||
|  | * GNU General Public License for more details. | ||||||
|  | * | ||||||
|  | * You should have received a copy of the GNU General Public License | ||||||
|  | * along with this program.  If not, see <http://www.gnu.org/licenses/>. | ||||||
|  | *******************************************************************************/ | ||||||
|  |  | ||||||
| import QtQuick 2.2 | import QtQuick 2.2 | ||||||
| import QtQuick.Controls 1.1 | import QtQuick.Controls 1.1 | ||||||
| import QtQuick.Layouts 1.1 | import QtQuick.Layouts 1.1 | ||||||
|   | |||||||
| @@ -1,3 +1,23 @@ | |||||||
|  | /******************************************************************************* | ||||||
|  | * Copyright (c) 2013 "Filippo Scognamiglio" | ||||||
|  | * https://github.com/Swordifish90/cool-old-term | ||||||
|  | * | ||||||
|  | * This file is part of cool-old-term. | ||||||
|  | * | ||||||
|  | * cool-old-term is free software: you can redistribute it and/or modify | ||||||
|  | * it under the terms of the GNU General Public License as published by | ||||||
|  | * the Free Software Foundation, either version 3 of the License, or | ||||||
|  | * (at your option) any later version. | ||||||
|  | * | ||||||
|  | * This program is distributed in the hope that it will be useful, | ||||||
|  | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||
|  | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||||
|  | * GNU General Public License for more details. | ||||||
|  | * | ||||||
|  | * You should have received a copy of the GNU General Public License | ||||||
|  | * along with this program.  If not, see <http://www.gnu.org/licenses/>. | ||||||
|  | *******************************************************************************/ | ||||||
|  |  | ||||||
| import QtQuick 2.2 | import QtQuick 2.2 | ||||||
|  |  | ||||||
| Rectangle{ | Rectangle{ | ||||||
|   | |||||||
| @@ -1,4 +1,24 @@ | |||||||
| import QtQuick 2.0 | /******************************************************************************* | ||||||
|  | * Copyright (c) 2013 "Filippo Scognamiglio" | ||||||
|  | * https://github.com/Swordifish90/cool-old-term | ||||||
|  | * | ||||||
|  | * This file is part of cool-old-term. | ||||||
|  | * | ||||||
|  | * cool-old-term is free software: you can redistribute it and/or modify | ||||||
|  | * it under the terms of the GNU General Public License as published by | ||||||
|  | * the Free Software Foundation, either version 3 of the License, or | ||||||
|  | * (at your option) any later version. | ||||||
|  | * | ||||||
|  | * This program is distributed in the hope that it will be useful, | ||||||
|  | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||
|  | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||||
|  | * GNU General Public License for more details. | ||||||
|  | * | ||||||
|  | * You should have received a copy of the GNU General Public License | ||||||
|  | * along with this program.  If not, see <http://www.gnu.org/licenses/>. | ||||||
|  | *******************************************************************************/ | ||||||
|  |  | ||||||
|  | import QtQuick 2.2 | ||||||
|  |  | ||||||
| Timer{ | Timer{ | ||||||
|     property int time |     property int time | ||||||
|   | |||||||
| @@ -88,7 +88,7 @@ ApplicationWindow{ | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     ShaderSettings{ |     ApplicationSettings{ | ||||||
|         id: shadersettings |         id: shadersettings | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -110,7 +110,6 @@ ApplicationWindow{ | |||||||
|         width: parent.width * shadersettings.window_scaling |         width: parent.width * shadersettings.window_scaling | ||||||
|         height: parent.height * shadersettings.window_scaling |         height: parent.height * shadersettings.window_scaling | ||||||
|         scale: 1.0 / shadersettings.window_scaling |         scale: 1.0 / shadersettings.window_scaling | ||||||
|  |  | ||||||
|         Image{ |         Image{ | ||||||
|             id: randtexture |             id: randtexture | ||||||
|             source: "frames/images/randfunction.png" |             source: "frames/images/randfunction.png" | ||||||
| @@ -130,12 +129,12 @@ ApplicationWindow{ | |||||||
|         TimeManager{ |         TimeManager{ | ||||||
|             id: timeManager |             id: timeManager | ||||||
|         } |         } | ||||||
|         Terminal{ |         PreprocessedTerminal{ | ||||||
|             id: terminal |             id: terminal | ||||||
|             anchors.fill: parent |             anchors.fill: parent | ||||||
|             anchors.margins: 30 |             anchors.margins: 30 | ||||||
|         } |         } | ||||||
|         ShaderManager{ |         ShaderTerminal{ | ||||||
|             id: shadercontainer |             id: shadercontainer | ||||||
|             anchors.fill: parent |             anchors.fill: parent | ||||||
|             z: 1.9 |             z: 1.9 | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user