mirror of
https://github.com/Swordfish90/cool-retro-term.git
synced 2025-02-20 20:09:14 +00:00
Added menu entries and shortcuts to increase and decrease font sizes.
This commit is contained in:
parent
a96f8ec220
commit
b9de57aec1
@ -107,11 +107,22 @@ Item{
|
||||
onLoaded: handleFontChanged()
|
||||
}
|
||||
|
||||
property var fontlist: fontManager.item.fontlist
|
||||
signal fontScalingChanged
|
||||
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 fontScalingIndexes: [5,1,1]
|
||||
property var fontlist: fontManager.item.fontlist
|
||||
|
||||
function handleFontChanged(){
|
||||
if(!fontManager.item) return;
|
||||
|
@ -76,12 +76,12 @@ Tab{
|
||||
value: updateIndex()
|
||||
onValueChanged: {
|
||||
if(!enabled) return; //Ugly and hacky solution. Look for a better solution.
|
||||
shadersettings.fontScalingIndexes[shadersettings.rasterization] = value;
|
||||
shadersettings.handleFontChanged();
|
||||
shadersettings.setScalingIndex(value);
|
||||
}
|
||||
function updateIndex(){
|
||||
value = shadersettings.fontScalingIndexes[shadersettings.rasterization];
|
||||
value = shadersettings.getScalingIndex();
|
||||
}
|
||||
Component.onCompleted: shadersettings.fontScalingChanged.connect(updateIndex);
|
||||
}
|
||||
Text{
|
||||
text: shadersettings.fontScalingList[scalingChanger.value].toFixed(2)
|
||||
|
22
app/main.qml
22
app/main.qml
@ -69,6 +69,25 @@ ApplicationWindow{
|
||||
shortcut: "Ctrl+Shift+V"
|
||||
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 {
|
||||
id: menubar
|
||||
@ -89,6 +108,9 @@ ApplicationWindow{
|
||||
title: qsTr("View")
|
||||
visible: shadersettings.fullscreen ? false : true
|
||||
MenuItem {action: fullscreenAction}
|
||||
MenuSeparator{}
|
||||
MenuItem {action: zoomIn}
|
||||
MenuItem {action: zoomOut}
|
||||
}
|
||||
}
|
||||
ApplicationSettings{
|
||||
|
Loading…
x
Reference in New Issue
Block a user