mirror of
				https://github.com/Swordfish90/cool-retro-term.git
				synced 2025-11-04 09:02:14 +00:00 
			
		
		
		
	Refactor: simplify main terminal.
This commit is contained in:
		@@ -30,24 +30,13 @@ Item{
 | 
				
			|||||||
    property alias mainTerminal: kterminal
 | 
					    property alias mainTerminal: kterminal
 | 
				
			||||||
    property ShaderEffectSource mainSource: mBlur !== 0 ? blurredSourceLoader.item : kterminalSource
 | 
					    property ShaderEffectSource mainSource: mBlur !== 0 ? blurredSourceLoader.item : kterminalSource
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    //Frame displacement properties. This makes the terminal the same size of the texture.
 | 
					 | 
				
			||||||
    property real dtop: frame.item.displacementTop * shadersettings.window_scaling
 | 
					 | 
				
			||||||
    property real dleft:frame.item.displacementLeft * shadersettings.window_scaling
 | 
					 | 
				
			||||||
    property real dright: frame.item.displacementRight * shadersettings.window_scaling
 | 
					 | 
				
			||||||
    property real dbottom: frame.item.displacementBottom * shadersettings.window_scaling
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    property alias title: ksession.title
 | 
					    property alias title: ksession.title
 | 
				
			||||||
 | 
					 | 
				
			||||||
    anchors.leftMargin: dleft
 | 
					 | 
				
			||||||
    anchors.rightMargin: dright
 | 
					 | 
				
			||||||
    anchors.topMargin: dtop
 | 
					 | 
				
			||||||
    anchors.bottomMargin: dbottom
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    property alias kterminal: kterminal
 | 
					    property alias kterminal: kterminal
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    signal sizeChanged
 | 
					    anchors.leftMargin: frame.item.displacementLeft * shadersettings.window_scaling
 | 
				
			||||||
    onWidthChanged: sizeChanged()
 | 
					    anchors.rightMargin: frame.item.displacementRight * shadersettings.window_scaling
 | 
				
			||||||
    onHeightChanged: sizeChanged()
 | 
					    anchors.topMargin: frame.item.displacementTop * shadersettings.window_scaling
 | 
				
			||||||
 | 
					    anchors.bottomMargin: frame.item.displacementBottom * shadersettings.window_scaling
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    //The blur effect has to take into account the framerate
 | 
					    //The blur effect has to take into account the framerate
 | 
				
			||||||
    property real mBlur: shadersettings.motion_blur
 | 
					    property real mBlur: shadersettings.motion_blur
 | 
				
			||||||
@@ -56,7 +45,6 @@ Item{
 | 
				
			|||||||
    property real _maxBlurCoefficient: 0.90
 | 
					    property real _maxBlurCoefficient: 0.90
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    property size terminalSize: kterminal.terminalSize
 | 
					    property size terminalSize: kterminal.terminalSize
 | 
				
			||||||
    property size paintedTextSize
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Manage copy and paste
 | 
					    // Manage copy and paste
 | 
				
			||||||
    Connections{
 | 
					    Connections{
 | 
				
			||||||
@@ -160,9 +148,7 @@ Item{
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
    MouseArea{
 | 
					    MouseArea{
 | 
				
			||||||
        acceptedButtons: Qt.LeftButton | Qt.MiddleButton | Qt.RightButton
 | 
					        acceptedButtons: Qt.LeftButton | Qt.MiddleButton | Qt.RightButton
 | 
				
			||||||
        // This is incredibly ugly. All this file should be reorganized.
 | 
					        anchors.fill: parent
 | 
				
			||||||
        width: (parent.width + dleft + dright) - dleft -dright
 | 
					 | 
				
			||||||
        height: (parent.height + dtop + dbottom) - dtop - dbottom
 | 
					 | 
				
			||||||
        onWheel:{
 | 
					        onWheel:{
 | 
				
			||||||
            if(wheel.modifiers & Qt.ControlModifier){
 | 
					            if(wheel.modifiers & Qt.ControlModifier){
 | 
				
			||||||
               wheel.angleDelta.y > 0 ? zoomIn.trigger() : zoomOut.trigger();
 | 
					               wheel.angleDelta.y > 0 ? zoomIn.trigger() : zoomOut.trigger();
 | 
				
			||||||
@@ -232,15 +218,12 @@ Item{
 | 
				
			|||||||
            Timer{
 | 
					            Timer{
 | 
				
			||||||
                id: livetimer
 | 
					                id: livetimer
 | 
				
			||||||
                running: true
 | 
					                running: true
 | 
				
			||||||
                onRunningChanged: {
 | 
					                onTriggered: _blurredSourceEffect.live = false;
 | 
				
			||||||
                    running ?
 | 
					 | 
				
			||||||
                        _blurredSourceEffect.live = true :
 | 
					 | 
				
			||||||
                        _blurredSourceEffect.live = false
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            Connections{
 | 
					            Connections{
 | 
				
			||||||
                target: kterminal
 | 
					                target: kterminal
 | 
				
			||||||
                onImagePainted:{
 | 
					                onImagePainted:{
 | 
				
			||||||
 | 
					                    _blurredSourceEffect.live = true;
 | 
				
			||||||
                    livetimer.restart();
 | 
					                    livetimer.restart();
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user