Some refactoring.

This commit is contained in:
Filippo Scognamiglio 2014-03-30 22:29:15 +02:00
parent 34f61cd86a
commit 5cb3c0c6ba
5 changed files with 46 additions and 58 deletions

View File

@ -50,6 +50,7 @@ ShaderEffect {
_B * Math.sin(b * time + _C) +
_C * Math.cos(c * time + _A))
property real brightness: screen_flickering * randval
property real horizontal_sincronization: shadersettings.horizontal_sincronization
property real _neg_sinc: 1 - horizontal_sincronization

View File

@ -66,11 +66,11 @@ Item{
onFont_scalingChanged: handleFontChanged();
function handleFontChanged(){
terminal.source = "";
terminal.unloadKTerminal();
currentfont.source = fontlist.get(font_index).source;
currentfont.pixelSize = fontlist.get(font_index).pixelSize;
currentfont.lineSpacing = fontlist.get(font_index).lineSpacing;
terminal.source = "Terminal.qml";
terminal.loadKTerminal();
}
FontLoader{

View File

@ -11,47 +11,52 @@ Item{
property real _minBlurCoefficient: 0.015
property real _maxBlurCoefficient: 0.10
function scrollUp(){
kterminal.scrollUp();
function loadKTerminal(){
kterminal.active = true;
}
function unloadKTerminal(){
kterminal.active = false;
}
function scrollDown(){
kterminal.scrollDown();
}
KTerminal {
Loader{
id: kterminal
font.pointSize: shadersettings.fontSize
font.family: shadersettings.font.name
width: parent.width
height: parent.height
active: false
anchors.fill: parent
sourceComponent: KTerminal {
font.pointSize: shadersettings.fontSize
font.family: shadersettings.font.name
colorScheme: "MyWhiteOnBlack"
colorScheme: "MyWhiteOnBlack"
session: KSession {
id: ksession
kbScheme: "linux"
session: KSession {
id: ksession
kbScheme: "linux"
onFinished: {
Qt.quit()
onFinished: {
Qt.quit()
}
}
onUpdatedImage: {blurredSource.live = true;livetimer.restart();}
Component.onCompleted: {
font.pointSize = shadersettings.fontSize;
font.family = shadersettings.font.name;
forceActiveFocus();
}
}
onUpdatedImage: {blurredSource.live = true;livetimer.restart();}
Component.onCompleted: {
font.pointSize = shadersettings.fontSize;
font.family = shadersettings.font.name;
forceActiveFocus();
}
}
MouseArea{
acceptedButtons: Qt.NoButton
anchors.fill: parent
onWheel:
wheel.angleDelta.y > 0 ? kterminal.item.scrollUp() : kterminal.item.scrollDown()
}
ShaderEffectSource{
id: source
sourceItem: kterminal
hideSource: true
}
Loader{
anchors.fill: parent
active: mBlur !== 0
@ -68,7 +73,6 @@ Item{
}
}
}
ShaderEffect {
id: blurredterminal
anchors.fill: parent

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 3.0.1, 2014-03-30T17:53:23. -->
<!-- Written by QtCreator 3.0.1, 2014-03-30T21:12:33. -->
<qtcreator>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>

View File

@ -30,7 +30,9 @@ ApplicationWindow{
width: 1024
height: 768
title: qsTr("Terminal")
title: qsTr("cool-old-term")
visible: true
visibility: shadersettings.fullscreen ? Window.FullScreen : Window.Windowed
Action {
id: fullscreenAction
@ -52,7 +54,6 @@ ApplicationWindow{
menuBar: MenuBar {
id: menubar
Menu {
title: qsTr("File")
visible: shadersettings.fullscreen ? false : true
@ -66,50 +67,34 @@ ApplicationWindow{
}
}
visible: true
visibility: shadersettings.fullscreen ? Window.FullScreen : Window.Windowed
Item{
id: maincontainer
anchors.fill: parent
clip: true
Terminal{
id: terminal
width: parent.width
height: parent.height
}
ShaderEffectSource{
id: theSource
sourceItem: terminal
sourceRect: frame.sourceRect
}
ShaderManager{
id: shadercontainer
anchors.fill: terminal
blending: true
z: 1.9
}
Loader{
id: frame
property rect sourceRect: item.sourceRect
id: frame
anchors.fill: parent
z: 2.1
source: shadersettings.frame_source
}
Loader{
id: terminal
width: parent.width
height: parent.height
}
MouseArea{
acceptedButtons: Qt.NoButton
anchors.fill: parent
onWheel:
wheel.angleDelta.y > 0 ? terminal.item.scrollUp() : terminal.item.scrollDown()
}
RadialGradient{
id: ambientreflection
z: 2.0
@ -122,12 +107,10 @@ ApplicationWindow{
}
}
}
ShaderSettings{
id: shadersettings
Component.onCompleted: terminal.source = "Terminal.qml"
Component.onCompleted: terminal.loadKTerminal();
}
SettingsWindow{
id: settingswindow
visible: false