cool-retro-term/app/qml/SettingsTerminalTab.qml

157 lines
6.2 KiB
QML
Raw Normal View History

2014-06-27 23:54:17 +02:00
/*******************************************************************************
* Copyright (c) 2013 "Filippo Scognamiglio"
* https://github.com/Swordfish90/cool-retro-term
2014-06-27 23:54:17 +02:00
*
* This file is part of cool-retro-term.
2014-06-27 23:54:17 +02:00
*
* cool-retro-term is free software: you can redistribute it and/or modify
2014-06-27 23:54:17 +02:00
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*******************************************************************************/
import QtQuick 2.2
import QtQuick.Controls 1.1
import QtQuick.Layouts 1.1
2015-01-08 03:55:19 +01:00
import "Components"
Tab{
ColumnLayout{
anchors.fill: parent
2018-12-03 16:39:20 +01:00
GroupBox{
2018-12-03 16:39:20 +01:00
title: qsTr("Font")
2018-10-28 01:08:21 +02:00
Layout.fillWidth: true
GridLayout{
anchors.fill: parent
columns: 2
2018-12-03 16:39:20 +01:00
Label { text: qsTr("Rasterization") }
ComboBox {
id: rasterizationBox
property string selectedElement: model[currentIndex]
Layout.fillWidth: true
model: [qsTr("Default"), qsTr("Scanlines"), qsTr("Pixels")]
currentIndex: appSettings.rasterization
onCurrentIndexChanged: {
appSettings.rasterization = currentIndex
}
}
2015-01-08 03:55:19 +01:00
Label{ text: qsTr("Name") }
ComboBox{
2014-06-25 14:29:10 +02:00
id: fontChanger
Layout.fillWidth: true
model: appSettings.fontlist
2014-06-25 14:29:10 +02:00
onActivated: {
var name = appSettings.fontlist.get(index).name;
appSettings.fontNames[appSettings.rasterization] = name;
appSettings.handleFontChanged();
}
2014-06-25 14:29:10 +02:00
function updateIndex(){
var name = appSettings.fontNames[appSettings.rasterization];
var index = appSettings.getIndexByName(name);
if (index !== undefined)
currentIndex = index;
2014-06-25 14:29:10 +02:00
}
Connections{
target: appSettings
onTerminalFontChanged: fontChanger.updateIndex();
}
Component.onCompleted: updateIndex();
}
2015-01-08 03:55:19 +01:00
Label{ text: qsTr("Scaling") }
RowLayout{
Layout.fillWidth: true
Slider{
Layout.fillWidth: true
id: fontScalingChanger
onValueChanged: if(enabled) appSettings.fontScaling = value
stepSize: 0.05
enabled: false // Another trick to fix initial bad behavior.
Component.onCompleted: {
minimumValue = appSettings.minimumFontScaling;
maximumValue = appSettings.maximumFontScaling;
value = appSettings.fontScaling;
enabled = true;
}
Connections{
target: appSettings
onFontScalingChanged: fontScalingChanger.value = appSettings.fontScaling;
2014-06-25 14:29:10 +02:00
}
}
2015-01-08 03:55:19 +01:00
SizedLabel{
text: Math.round(fontScalingChanger.value * 100) + "%"
}
}
2015-01-08 03:55:19 +01:00
Label{ text: qsTr("Font Width") }
RowLayout{
Layout.fillWidth: true
Slider{
Layout.fillWidth: true
id: widthChanger
onValueChanged: appSettings.fontWidth = value;
value: appSettings.fontWidth
stepSize: 0.05
Component.onCompleted: {
// This is needed to avoid unnecessary chnaged events.
minimumValue = 0.5;
maximumValue = 1.5;
}
}
2015-01-08 03:55:19 +01:00
SizedLabel{
text: Math.round(widthChanger.value * 100) + "%"
}
}
}
}
GroupBox{
title: qsTr("Colors")
2018-10-28 01:08:21 +02:00
Layout.fillWidth: true
2014-08-01 00:04:59 +02:00
ColumnLayout{
2014-08-02 20:03:16 +02:00
anchors.fill: parent
ColumnLayout{
Layout.fillWidth: true
CheckableSlider{
name: qsTr("Chroma Color")
onNewValue: appSettings.chromaColor = newValue
value: appSettings.chromaColor
}
CheckableSlider{
name: qsTr("Saturation Color")
onNewValue: appSettings.saturationColor = newValue
value: appSettings.saturationColor
enabled: appSettings.chromaColor !== 0
}
}
2014-08-01 00:04:59 +02:00
RowLayout{
2014-08-02 20:03:16 +02:00
Layout.fillWidth: true
2014-08-01 00:04:59 +02:00
ColorButton{
name: qsTr("Font")
height: 50
Layout.fillWidth: true
onColorSelected: appSettings._fontColor = color;
color: appSettings._fontColor
2014-08-01 00:04:59 +02:00
}
ColorButton{
name: qsTr("Background")
height: 50
Layout.fillWidth: true
onColorSelected: appSettings._backgroundColor = color;
color: appSettings._backgroundColor
2014-08-01 00:04:59 +02:00
}
}
}
}
}
}