mirror of
				https://github.com/Swordfish90/cool-retro-term.git
				synced 2025-10-30 22:54:21 +00:00 
			
		
		
		
	Added menu entries and shortcuts to increase and decrease font sizes.
This commit is contained in:
		| @@ -107,11 +107,22 @@ Item{ | |||||||
|         onLoaded: handleFontChanged() |         onLoaded: handleFontChanged() | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     property var fontlist: fontManager.item.fontlist |     signal fontScalingChanged | ||||||
|     property var fontScalingList: fontManager.item.fontScalingList |     property var fontScalingList: fontManager.item.fontScalingList | ||||||
|  |     property var fontScalingIndexes: [5,1,1] | ||||||
|  |  | ||||||
|  |     function setScalingIndex(newScaling){ | ||||||
|  |         fontScalingIndexes[rasterization] = newScaling; | ||||||
|  |         fontScalingChanged(); | ||||||
|  |         handleFontChanged(); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     function getScalingIndex(){ | ||||||
|  |         return fontScalingIndexes[rasterization]; | ||||||
|  |     } | ||||||
|  |  | ||||||
|     property var fontIndexes: [0,0,0] |     property var fontIndexes: [0,0,0] | ||||||
|     property var fontScalingIndexes: [5,1,1] |     property var fontlist: fontManager.item.fontlist | ||||||
|  |  | ||||||
|     function handleFontChanged(){ |     function handleFontChanged(){ | ||||||
|         if(!fontManager.item) return; |         if(!fontManager.item) return; | ||||||
|   | |||||||
| @@ -76,12 +76,12 @@ Tab{ | |||||||
|                         value: updateIndex() |                         value: updateIndex() | ||||||
|                         onValueChanged: { |                         onValueChanged: { | ||||||
|                             if(!enabled) return; //Ugly and hacky solution. Look for a better solution. |                             if(!enabled) return; //Ugly and hacky solution. Look for a better solution. | ||||||
|                             shadersettings.fontScalingIndexes[shadersettings.rasterization] = value; |                             shadersettings.setScalingIndex(value); | ||||||
|                             shadersettings.handleFontChanged(); |  | ||||||
|                         } |                         } | ||||||
|                         function updateIndex(){ |                         function updateIndex(){ | ||||||
|                             value = shadersettings.fontScalingIndexes[shadersettings.rasterization]; |                             value = shadersettings.getScalingIndex(); | ||||||
|                         } |                         } | ||||||
|  |                         Component.onCompleted: shadersettings.fontScalingChanged.connect(updateIndex); | ||||||
|                     } |                     } | ||||||
|                     Text{ |                     Text{ | ||||||
|                         text: shadersettings.fontScalingList[scalingChanger.value].toFixed(2) |                         text: shadersettings.fontScalingList[scalingChanger.value].toFixed(2) | ||||||
|   | |||||||
							
								
								
									
										22
									
								
								app/main.qml
									
									
									
									
									
								
							
							
						
						
									
										22
									
								
								app/main.qml
									
									
									
									
									
								
							| @@ -69,6 +69,25 @@ ApplicationWindow{ | |||||||
|         shortcut: "Ctrl+Shift+V" |         shortcut: "Ctrl+Shift+V" | ||||||
|         onTriggered: terminal.pasteClipboard() |         onTriggered: terminal.pasteClipboard() | ||||||
|     } |     } | ||||||
|  |     Action{ | ||||||
|  |         id: zoomIn | ||||||
|  |         text: qsTr("&Zoom In") | ||||||
|  |         shortcut: "Ctrl++" | ||||||
|  |         onTriggered: { | ||||||
|  |             var oldScaling = shadersettings.fontScalingIndexes[shadersettings.rasterization]; | ||||||
|  |             var maxScalingIndex = shadersettings.fontScalingList.length - 1; | ||||||
|  |             shadersettings.setScalingIndex(Math.min(oldScaling + 1, maxScalingIndex)); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  |     Action{ | ||||||
|  |         id: zoomOut | ||||||
|  |         text: qsTr("&Zoom Out") | ||||||
|  |         shortcut: "Ctrl+-" | ||||||
|  |         onTriggered: { | ||||||
|  |             var oldScaling = shadersettings.fontScalingIndexes[shadersettings.rasterization]; | ||||||
|  |             shadersettings.setScalingIndex(Math.max(oldScaling - 1, 0)); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  |  | ||||||
|     menuBar: MenuBar { |     menuBar: MenuBar { | ||||||
|         id: menubar |         id: menubar | ||||||
| @@ -89,6 +108,9 @@ ApplicationWindow{ | |||||||
|             title: qsTr("View") |             title: qsTr("View") | ||||||
|             visible: shadersettings.fullscreen ? false : true |             visible: shadersettings.fullscreen ? false : true | ||||||
|             MenuItem {action: fullscreenAction} |             MenuItem {action: fullscreenAction} | ||||||
|  |             MenuSeparator{} | ||||||
|  |             MenuItem {action: zoomIn} | ||||||
|  |             MenuItem {action: zoomOut} | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|     ApplicationSettings{ |     ApplicationSettings{ | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user