1
0
mirror of https://github.com/Swordfish90/cool-retro-term.git synced 2025-01-18 12:15:27 +00:00

Some code cleanups.

This commit is contained in:
Filippo Scognamiglio 2014-06-27 23:54:17 +02:00
parent df49f1d1c6
commit 211afe6dce
13 changed files with 222 additions and 28 deletions

View File

@ -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!!
}
}

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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{

View File

@ -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

View File

@ -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