mirror of
				https://github.com/Swordfish90/cool-retro-term.git
				synced 2025-10-30 22:54:21 +00:00 
			
		
		
		
	Added terminal size overlay
This commit is contained in:
		| @@ -27,6 +27,8 @@ Item{ | ||||
|     property real contrast: 0.85 | ||||
|     property real brightness: 0.75 | ||||
|  | ||||
|     property bool show_terminal_size: true | ||||
|  | ||||
|     //Scaling of the preprocessed terminal with respect to the window. | ||||
|     property real terminal_scaling: 1.0 | ||||
|     onTerminal_scalingChanged: handleFontChanged(); | ||||
| @@ -167,6 +169,8 @@ Item{ | ||||
|         console.log(profilename + settings); | ||||
|         settings = JSON.parse(settings); | ||||
|  | ||||
|         show_terminal_size = settings.show_terminal_size ? settings.show_terminal_size : show_terminal_size | ||||
|  | ||||
|         fps = settings.fps !== undefined ? settings.fps: fps | ||||
|  | ||||
|         contrast = settings.contrast !== undefined ? settings.contrast : contrast; | ||||
| @@ -197,9 +201,10 @@ Item{ | ||||
|     function storeCurrentSettings(){ | ||||
|         var settings = { | ||||
|             fps: fps, | ||||
|             ambient_light : ambient_light, | ||||
|             brightness : brightness, | ||||
|             contrast : contrast, | ||||
|             show_terminal_size: show_terminal_size, | ||||
|             ambient_light: ambient_light, | ||||
|             brightness: brightness, | ||||
|             contrast: contrast, | ||||
|             background_color: _background_color, | ||||
|             font_color: _font_color, | ||||
|             brightness_flickering: brightness_flickering, | ||||
|   | ||||
							
								
								
									
										29
									
								
								app/SizeOverlay.qml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								app/SizeOverlay.qml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,29 @@ | ||||
| import QtQuick 2.0 | ||||
|  | ||||
| Rectangle{ | ||||
|     property size terminalSize | ||||
|     property real topOpacity: 0.6 | ||||
|     width: textSize.width * 2 | ||||
|     height: textSize.height * 2 | ||||
|     radius: 5 | ||||
|     border.width: 2 | ||||
|     border.color: "white" | ||||
|     color: "black" | ||||
|     opacity: sizetimer.running ? 0.6 : 0.0 | ||||
|  | ||||
|     Behavior on opacity{NumberAnimation{duration: 200}} | ||||
|  | ||||
|     onTerminalSizeChanged: sizetimer.restart() | ||||
|  | ||||
|     Text{ | ||||
|         id: textSize | ||||
|         anchors.centerIn: parent | ||||
|         color: "white" | ||||
|         text: terminalSize.width + "x" + terminalSize.height | ||||
|     } | ||||
|     Timer{ | ||||
|         id: sizetimer | ||||
|         interval: 1000 | ||||
|         running: false | ||||
|     } | ||||
| } | ||||
| @@ -35,6 +35,8 @@ Item{ | ||||
|  | ||||
|     property real mBloom: shadersettings.bloom_strength | ||||
|  | ||||
|     property size terminalSize | ||||
|  | ||||
|     //Force reload of the blursource when settings change | ||||
|     onMBloomChanged: restartBlurredSource() | ||||
|  | ||||
| @@ -69,6 +71,8 @@ Item{ | ||||
|  | ||||
|             colorScheme: "MyWhiteOnBlack" | ||||
|  | ||||
|             onTerminalSizeChanged: terminalContainer.terminalSize = ktermitem.terminalSize | ||||
|  | ||||
|             session: KSession { | ||||
|                 id: ksession | ||||
|                 kbScheme: "linux" | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| <?xml version="1.0" encoding="UTF-8"?> | ||||
| <!DOCTYPE QtCreatorProject> | ||||
| <!-- Written by QtCreator 3.0.1, 2014-04-16T19:36:46. --> | ||||
| <!-- Written by QtCreator 3.0.1, 2014-04-17T13:17:40. --> | ||||
| <qtcreator> | ||||
|  <data> | ||||
|   <variable>ProjectExplorer.Project.ActiveTarget</variable> | ||||
|   | ||||
							
								
								
									
										18
									
								
								app/main.qml
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								app/main.qml
									
									
									
									
									
								
							| @@ -126,8 +126,8 @@ ApplicationWindow{ | ||||
|         Terminal{ | ||||
|             id: terminal | ||||
|             anchors.centerIn: parent | ||||
|             property int frameOffsetX: frame.item.addedWidth - frame.item.borderLeft - frame.item.borderRight | ||||
|             property int frameOffsetY: frame.item.addedHeight -frame.item.borderTop - frame.item.borderBottom | ||||
|             property int frameOffsetX: frame.item.addedWidth -  frame.item.borderLeft - frame.item.borderRight | ||||
|             property int frameOffsetY: frame.item.addedHeight - frame.item.borderTop  - frame.item.borderBottom | ||||
|             width: (parent.width + frameOffsetX) * shadersettings.terminal_scaling | ||||
|             height: (parent.height + frameOffsetY) * shadersettings.terminal_scaling | ||||
|         } | ||||
| @@ -139,7 +139,6 @@ ApplicationWindow{ | ||||
|         ShaderManager{ | ||||
|             id: shadercontainer | ||||
|             anchors.fill: parent | ||||
|             blending: true | ||||
|             z: 1.9 | ||||
|         } | ||||
|         RadialGradient{ | ||||
| @@ -153,10 +152,21 @@ ApplicationWindow{ | ||||
|                 GradientStop{position: 0.7; color: "#00000000"} | ||||
|             } | ||||
|         } | ||||
|         Loader{ | ||||
|             id: sizeoverlayloader | ||||
|             z: 3 | ||||
|             anchors.centerIn: parent | ||||
|             active: shadersettings.show_terminal_size | ||||
|             sourceComponent: SizeOverlay{ | ||||
|                 terminalSize: terminal.terminalSize | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|     ShaderSettings{ | ||||
|         id: shadersettings | ||||
|         Component.onCompleted: terminal.loadKTerminal(); | ||||
|         Component.onCompleted: { | ||||
|             terminal.loadKTerminal(); | ||||
|         } | ||||
|     } | ||||
|     Loader{ | ||||
|         id: settingswindowloader | ||||
|   | ||||
		Reference in New Issue
	
	Block a user