From 211afe6dcea814cf3531dbbcad38c107ca4b95a5 Mon Sep 17 00:00:00 2001
From: Filippo Scognamiglio <flscogna@gmail.com>
Date: Fri, 27 Jun 2014 23:54:17 +0200
Subject: [PATCH] Some code cleanups.

---
 ...erSettings.qml => ApplicationSettings.qml} | 35 +++++++++++++------
 app/FontPixels.qml                            | 22 +++++++++++-
 app/FontScanlines.qml                         | 22 +++++++++++-
 app/Fonts.qml                                 | 22 +++++++++++-
 app/InsertNameDialog.qml                      | 22 +++++++++++-
 ...{Terminal.qml => PreprocessedTerminal.qml} | 18 +++++-----
 app/SettingsEffectsTab.qml                    | 20 +++++++++++
 app/SettingsGeneralTab.qml                    | 20 +++++++++++
 app/SettingsTerminalTab.qml                   | 20 +++++++++++
 app/{ShaderManager.qml => ShaderTerminal.qml} |  0
 app/SizeOverlay.qml                           | 20 +++++++++++
 app/TimeManager.qml                           | 22 +++++++++++-
 app/main.qml                                  |  7 ++--
 13 files changed, 222 insertions(+), 28 deletions(-)
 rename app/{ShaderSettings.qml => ApplicationSettings.qml} (96%)
 rename app/{Terminal.qml => PreprocessedTerminal.qml} (97%)
 rename app/{ShaderManager.qml => ShaderTerminal.qml} (100%)

diff --git a/app/ShaderSettings.qml b/app/ApplicationSettings.qml
similarity index 96%
rename from app/ShaderSettings.qml
rename to app/ApplicationSettings.qml
index 3facd53..3b21cf2 100644
--- a/app/ShaderSettings.qml
+++ b/app/ApplicationSettings.qml
@@ -20,14 +20,18 @@
 
 import QtQuick 2.2
 
+
+
 Item{
+
+    // GENERAL SETTINGS ///////////////////////////////////////////////////
+
     property bool fullscreen: false
 
     property real ambient_light: 0.2
     property real contrast: 0.85
     property real brightness: 0.5
 
-    //On resize shows an overlay with the current size
     property bool show_terminal_size: true
 
     property real window_scaling: 1.0
@@ -48,7 +52,8 @@ Item{
         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 _font_color: "#ff8100"
     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
 
 
+    // FONTS //////////////////////////////////////////////////////////////////
+
     signal terminalFontChanged(string fontSource, int pixelSize, int lineSpacing, size virtualCharSize)
 
     Loader{
@@ -119,12 +126,16 @@ Item{
         terminalFontChanged(fontSource, pixelSize, lineSpacing, virtualCharSize);
     }
 
+    // FRAMES /////////////////////////////////////////////////////////////////
+
     property bool frame_reflections: true
     property real frame_reflection_strength: ((frame_reflections && framelist.get(frames_index).reflections) ? 1.0 : 0.0) * 0.15
 
     property alias profiles_list: profileslist
     property int profiles_index: 0
 
+    // DB STORAGE /////////////////////////////////////////////////////////////
+
     Storage{id: storage}
 
     function composeSettingsString(){
@@ -268,15 +279,7 @@ Item{
         profileslist.append({text: name, obj_string: profileString, builtin: false});
     }
 
-    Component.onCompleted: {
-        loadSettings();
-        loadCustomProfiles();
-    }
-    Component.onDestruction: {
-        storeSettings();
-        storeCustomProfiles();
-        //storage.dropSettings(); //DROPS THE SETTINGS!.. REMEMBER TO DISABLE ONCE ENABLED!!
-    }
+    // PROFILES ///////////////////////////////////////////////////////////////
 
     ListModel{
         id: profileslist
@@ -316,4 +319,14 @@ Item{
             builtin: true
         }
     }
+
+    Component.onCompleted: {
+        loadSettings();
+        loadCustomProfiles();
+    }
+    Component.onDestruction: {
+        storeSettings();
+        storeCustomProfiles();
+        //storage.dropSettings(); //DROPS THE SETTINGS!.. REMEMBER TO DISABLE ONCE ENABLED!!
+    }
 }
diff --git a/app/FontPixels.qml b/app/FontPixels.qml
index 455346d..1095776 100644
--- a/app/FontPixels.qml
+++ b/app/FontPixels.qml
@@ -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{
     property int selectedFontIndex
diff --git a/app/FontScanlines.qml b/app/FontScanlines.qml
index 7ab57c7..c0b20de 100644
--- a/app/FontScanlines.qml
+++ b/app/FontScanlines.qml
@@ -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{
     property int selectedFontIndex
diff --git a/app/Fonts.qml b/app/Fonts.qml
index 5e85aa2..e851b6f 100644
--- a/app/Fonts.qml
+++ b/app/Fonts.qml
@@ -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{
     property int selectedFontIndex
diff --git a/app/InsertNameDialog.qml b/app/InsertNameDialog.qml
index 08fd980..3e16d81 100644
--- a/app/InsertNameDialog.qml
+++ b/app/InsertNameDialog.qml
@@ -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.Controls 1.1
 import QtQuick.Layouts 1.1
diff --git a/app/Terminal.qml b/app/PreprocessedTerminal.qml
similarity index 97%
rename from app/Terminal.qml
rename to app/PreprocessedTerminal.qml
index e07ff71..c7d4448 100644
--- a/app/Terminal.qml
+++ b/app/PreprocessedTerminal.qml
@@ -57,7 +57,6 @@ Item{
     property size terminalSize: kterminal.terminalSize
     property size paintedTextSize
 
-    //Force reload of the blursource when settings change
     onMBlurChanged: restartBlurredSource()
 
     function restartBlurredSource(){
@@ -98,7 +97,6 @@ Item{
         function isValid(size){
             return size.width >= 0 && size.height >= 0;
         }
-
         function handleFontChange(fontSource, pixelSize, lineSpacing, virtualCharSize){
             fontLoader.source = fontSource;
             font.pixelSize = pixelSize * shadersettings.window_scaling;
@@ -258,10 +256,12 @@ Item{
         "gl_FragColor.a = floor(color) / 256.0;" +
         "}"
     }
-    //////////////////////////////////////////////////////////////////////
-    //EFFECTS
-    //////////////////////////////////////////////////////////////////////
-    //Bloom
+    ///////////////////////////////////////////////////////////////////////////
+    //  EFFECTS  //////////////////////////////////////////////////////////////
+    ///////////////////////////////////////////////////////////////////////////
+
+    //  BLOOM  ////////////////////////////////////////////////////////////////
+
     Loader{
         id: bloomEffectLoader
         active: mBloom != 0
@@ -284,7 +284,8 @@ Item{
         }
     }
 
-    //Rasterization mask
+    //  NOISE  ////////////////////////////////////////////////////////////////
+
     ShaderEffect {
         id: staticNoiseEffect
         anchors.fill: parent
@@ -333,7 +334,8 @@ Item{
         format: ShaderEffectSource.Alpha
     }
 
-    //Rasterization mask
+    // RASTERIZATION //////////////////////////////////////////////////////////
+
     ShaderEffect {
         id: rasterizationEffect
         anchors.fill: parent
diff --git a/app/SettingsEffectsTab.qml b/app/SettingsEffectsTab.qml
index a6e398a..e455d7e 100644
--- a/app/SettingsEffectsTab.qml
+++ b/app/SettingsEffectsTab.qml
@@ -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.Controls 1.1
 import QtQuick.Layouts 1.1
diff --git a/app/SettingsGeneralTab.qml b/app/SettingsGeneralTab.qml
index bf3f3cf..e98e33f 100644
--- a/app/SettingsGeneralTab.qml
+++ b/app/SettingsGeneralTab.qml
@@ -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.Controls 1.1
 import QtQuick.Layouts 1.1
diff --git a/app/SettingsTerminalTab.qml b/app/SettingsTerminalTab.qml
index b09476d..73aeeb5 100644
--- a/app/SettingsTerminalTab.qml
+++ b/app/SettingsTerminalTab.qml
@@ -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.Controls 1.1
 import QtQuick.Layouts 1.1
diff --git a/app/ShaderManager.qml b/app/ShaderTerminal.qml
similarity index 100%
rename from app/ShaderManager.qml
rename to app/ShaderTerminal.qml
diff --git a/app/SizeOverlay.qml b/app/SizeOverlay.qml
index c6323ea..6f0a69c 100644
--- a/app/SizeOverlay.qml
+++ b/app/SizeOverlay.qml
@@ -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
 
 Rectangle{
diff --git a/app/TimeManager.qml b/app/TimeManager.qml
index b25dc47..2b2346f 100644
--- a/app/TimeManager.qml
+++ b/app/TimeManager.qml
@@ -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{
     property int time
diff --git a/app/main.qml b/app/main.qml
index badaad8..c71eb7f 100644
--- a/app/main.qml
+++ b/app/main.qml
@@ -88,7 +88,7 @@ ApplicationWindow{
         }
     }
 
-    ShaderSettings{
+    ApplicationSettings{
         id: shadersettings
     }
 
@@ -110,7 +110,6 @@ ApplicationWindow{
         width: parent.width * shadersettings.window_scaling
         height: parent.height * shadersettings.window_scaling
         scale: 1.0 / shadersettings.window_scaling
-
         Image{
             id: randtexture
             source: "frames/images/randfunction.png"
@@ -130,12 +129,12 @@ ApplicationWindow{
         TimeManager{
             id: timeManager
         }
-        Terminal{
+        PreprocessedTerminal{
             id: terminal
             anchors.fill: parent
             anchors.margins: 30
         }
-        ShaderManager{
+        ShaderTerminal{
             id: shadercontainer
             anchors.fill: parent
             z: 1.9