mirror of
				https://github.com/Swordfish90/cool-retro-term.git
				synced 2025-10-30 22:54:21 +00:00 
			
		
		
		
	Some refactoring.
This commit is contained in:
		| @@ -50,6 +50,7 @@ ShaderEffect { | |||||||
|                             _B * Math.sin(b * time + _C) + |                             _B * Math.sin(b * time + _C) + | ||||||
|                             _C * Math.cos(c * time + _A)) |                             _C * Math.cos(c * time + _A)) | ||||||
|  |  | ||||||
|  |  | ||||||
|     property real brightness: screen_flickering * randval |     property real brightness: screen_flickering * randval | ||||||
|     property real horizontal_sincronization: shadersettings.horizontal_sincronization |     property real horizontal_sincronization: shadersettings.horizontal_sincronization | ||||||
|     property real _neg_sinc: 1 - horizontal_sincronization |     property real _neg_sinc: 1 - horizontal_sincronization | ||||||
|   | |||||||
| @@ -66,11 +66,11 @@ Item{ | |||||||
|     onFont_scalingChanged: handleFontChanged(); |     onFont_scalingChanged: handleFontChanged(); | ||||||
|  |  | ||||||
|     function handleFontChanged(){ |     function handleFontChanged(){ | ||||||
|         terminal.source = ""; |         terminal.unloadKTerminal(); | ||||||
|         currentfont.source = fontlist.get(font_index).source; |         currentfont.source = fontlist.get(font_index).source; | ||||||
|         currentfont.pixelSize = fontlist.get(font_index).pixelSize; |         currentfont.pixelSize = fontlist.get(font_index).pixelSize; | ||||||
|         currentfont.lineSpacing = fontlist.get(font_index).lineSpacing; |         currentfont.lineSpacing = fontlist.get(font_index).lineSpacing; | ||||||
|         terminal.source = "Terminal.qml"; |         terminal.loadKTerminal(); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     FontLoader{ |     FontLoader{ | ||||||
|   | |||||||
| @@ -11,47 +11,52 @@ Item{ | |||||||
|     property real _minBlurCoefficient: 0.015 |     property real _minBlurCoefficient: 0.015 | ||||||
|     property real _maxBlurCoefficient: 0.10 |     property real _maxBlurCoefficient: 0.10 | ||||||
|  |  | ||||||
|     function scrollUp(){ |     function loadKTerminal(){ | ||||||
|         kterminal.scrollUp(); |         kterminal.active = true; | ||||||
|  |     } | ||||||
|  |     function unloadKTerminal(){ | ||||||
|  |         kterminal.active = false; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     function scrollDown(){ |     Loader{ | ||||||
|         kterminal.scrollDown(); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     KTerminal { |  | ||||||
|         id: kterminal |         id: kterminal | ||||||
|         font.pointSize: shadersettings.fontSize |         active: false | ||||||
|         font.family: shadersettings.font.name |         anchors.fill: parent | ||||||
|         width: parent.width |         sourceComponent: KTerminal { | ||||||
|         height: parent.height |             font.pointSize: shadersettings.fontSize | ||||||
|  |             font.family: shadersettings.font.name | ||||||
|  |  | ||||||
|         colorScheme: "MyWhiteOnBlack" |             colorScheme: "MyWhiteOnBlack" | ||||||
|  |  | ||||||
|         session: KSession { |             session: KSession { | ||||||
|             id: ksession |                 id: ksession | ||||||
|             kbScheme: "linux" |                 kbScheme: "linux" | ||||||
|  |  | ||||||
|             onFinished: { |                 onFinished: { | ||||||
|                 Qt.quit() |                     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{ |     ShaderEffectSource{ | ||||||
|         id: source |         id: source | ||||||
|         sourceItem: kterminal |         sourceItem: kterminal | ||||||
|         hideSource: true |         hideSource: true | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     Loader{ |     Loader{ | ||||||
|         anchors.fill: parent |         anchors.fill: parent | ||||||
|         active: mBlur !== 0 |         active: mBlur !== 0 | ||||||
| @@ -68,7 +73,6 @@ Item{ | |||||||
|             } |             } | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     ShaderEffect { |     ShaderEffect { | ||||||
|         id: blurredterminal |         id: blurredterminal | ||||||
|         anchors.fill: parent |         anchors.fill: parent | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| <?xml version="1.0" encoding="UTF-8"?> | <?xml version="1.0" encoding="UTF-8"?> | ||||||
| <!DOCTYPE QtCreatorProject> | <!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> | <qtcreator> | ||||||
|  <data> |  <data> | ||||||
|   <variable>ProjectExplorer.Project.ActiveTarget</variable> |   <variable>ProjectExplorer.Project.ActiveTarget</variable> | ||||||
|   | |||||||
							
								
								
									
										37
									
								
								app/main.qml
									
									
									
									
									
								
							
							
						
						
									
										37
									
								
								app/main.qml
									
									
									
									
									
								
							| @@ -30,7 +30,9 @@ ApplicationWindow{ | |||||||
|     width: 1024 |     width: 1024 | ||||||
|     height: 768 |     height: 768 | ||||||
|  |  | ||||||
|     title: qsTr("Terminal") |     title: qsTr("cool-old-term") | ||||||
|  |     visible: true | ||||||
|  |     visibility: shadersettings.fullscreen ? Window.FullScreen : Window.Windowed | ||||||
|  |  | ||||||
|     Action { |     Action { | ||||||
|         id: fullscreenAction |         id: fullscreenAction | ||||||
| @@ -52,7 +54,6 @@ ApplicationWindow{ | |||||||
|  |  | ||||||
|     menuBar: MenuBar { |     menuBar: MenuBar { | ||||||
|         id: menubar |         id: menubar | ||||||
|  |  | ||||||
|         Menu { |         Menu { | ||||||
|             title: qsTr("File") |             title: qsTr("File") | ||||||
|             visible: shadersettings.fullscreen ? false : true |             visible: shadersettings.fullscreen ? false : true | ||||||
| @@ -66,50 +67,34 @@ ApplicationWindow{ | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     visible: true |  | ||||||
|     visibility: shadersettings.fullscreen ? Window.FullScreen : Window.Windowed |  | ||||||
|  |  | ||||||
|     Item{ |     Item{ | ||||||
|         id: maincontainer |         id: maincontainer | ||||||
|         anchors.fill: parent |         anchors.fill: parent | ||||||
|         clip: true |         clip: true | ||||||
|  |         Terminal{ | ||||||
|  |             id: terminal | ||||||
|  |             width: parent.width | ||||||
|  |             height: parent.height | ||||||
|  |         } | ||||||
|         ShaderEffectSource{ |         ShaderEffectSource{ | ||||||
|             id: theSource |             id: theSource | ||||||
|             sourceItem: terminal |             sourceItem: terminal | ||||||
|             sourceRect: frame.sourceRect |             sourceRect: frame.sourceRect | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         ShaderManager{ |         ShaderManager{ | ||||||
|             id: shadercontainer |             id: shadercontainer | ||||||
|             anchors.fill: terminal |             anchors.fill: terminal | ||||||
|             blending: true |             blending: true | ||||||
|             z: 1.9 |             z: 1.9 | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         Loader{ |         Loader{ | ||||||
|  |             id: frame | ||||||
|             property rect sourceRect: item.sourceRect |             property rect sourceRect: item.sourceRect | ||||||
|  |  | ||||||
|             id: frame |  | ||||||
|             anchors.fill: parent |             anchors.fill: parent | ||||||
|             z: 2.1 |             z: 2.1 | ||||||
|             source: shadersettings.frame_source |             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{ |         RadialGradient{ | ||||||
|             id: ambientreflection |             id: ambientreflection | ||||||
|             z: 2.0 |             z: 2.0 | ||||||
| @@ -122,12 +107,10 @@ ApplicationWindow{ | |||||||
|             } |             } | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     ShaderSettings{ |     ShaderSettings{ | ||||||
|         id: shadersettings |         id: shadersettings | ||||||
|         Component.onCompleted: terminal.source = "Terminal.qml" |         Component.onCompleted: terminal.loadKTerminal(); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     SettingsWindow{ |     SettingsWindow{ | ||||||
|         id: settingswindow |         id: settingswindow | ||||||
|         visible: false |         visible: false | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user