mirror of
https://github.com/Swordfish90/cool-retro-term.git
synced 2025-02-21 20:39:00 +00:00
Merge pull request #131 from Swordfish90/2yscanlines
Much improved scanlines rendering. Font width can be customized. Redisigned settings. Bloom and scanline quality can be selected.
This commit is contained in:
commit
f8db912f5f
@ -69,6 +69,8 @@ Item{
|
||||
property real motion_blur: 0.40
|
||||
property real bloom_strength: 0.65
|
||||
|
||||
property real bloom_quality: 1.0
|
||||
|
||||
property real chroma_color: 0.0
|
||||
property real saturation_color: 0.0
|
||||
|
||||
@ -85,6 +87,9 @@ Item{
|
||||
|
||||
property int rasterization: no_rasterization
|
||||
|
||||
property int scanline_quality: 3
|
||||
onScanline_qualityChanged: handleFontChanged();
|
||||
|
||||
ListModel{
|
||||
id: framelist
|
||||
ListElement{text: "No frame"; source: "./frames/NoFrame.qml"; reflections: false}
|
||||
@ -116,27 +121,29 @@ Item{
|
||||
onLoaded: handleFontChanged()
|
||||
}
|
||||
|
||||
signal fontScalingChanged
|
||||
property var fontScalingList: [0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5]
|
||||
property int fontScalingIndex: 5
|
||||
property real fontScaling: 1.0
|
||||
onFontScalingChanged: handleFontChanged();
|
||||
|
||||
function setScalingIndex(newScaling){
|
||||
fontScalingIndex = newScaling;
|
||||
fontScalingChanged();
|
||||
function incrementScaling(){
|
||||
fontScaling = Math.min(fontScaling + 0.05, 2.50);
|
||||
handleFontChanged();
|
||||
}
|
||||
|
||||
function getScalingIndex(){
|
||||
return fontScalingIndex;
|
||||
function decrementScaling(){
|
||||
fontScaling = Math.max(fontScaling - 0.05, 0.50);
|
||||
handleFontChanged();
|
||||
}
|
||||
|
||||
property real fontWidth: 1.0
|
||||
onFontWidthChanged: handleFontChanged();
|
||||
|
||||
property var fontIndexes: [0,0,0]
|
||||
property var fontlist: fontManager.item.fontlist
|
||||
|
||||
function handleFontChanged(){
|
||||
if(!fontManager.item) return;
|
||||
fontManager.item.selectedFontIndex = fontIndexes[rasterization];
|
||||
fontManager.item.scaling = fontScalingList[fontScalingIndex];
|
||||
fontManager.item.scaling = fontScaling;
|
||||
|
||||
var fontSource = fontManager.item.source;
|
||||
var pixelSize = fontManager.item.pixelSize;
|
||||
@ -164,10 +171,12 @@ Item{
|
||||
fps: fps,
|
||||
window_scaling: window_scaling,
|
||||
show_terminal_size: show_terminal_size,
|
||||
fontScalingIndex: fontScalingIndex,
|
||||
fontScaling: fontScaling,
|
||||
fontIndexes: fontIndexes,
|
||||
frameReflections: _frameReflections,
|
||||
showMenubar: showMenubar
|
||||
showMenubar: showMenubar,
|
||||
scanline_quality: scanline_quality,
|
||||
bloom_quality: bloom_quality
|
||||
}
|
||||
return JSON.stringify(settings);
|
||||
}
|
||||
@ -193,7 +202,8 @@ Item{
|
||||
contrast: contrast,
|
||||
ambient_light: ambient_light,
|
||||
windowOpacity: windowOpacity,
|
||||
fontIndex: fontIndexes[rasterization]
|
||||
fontIndex: fontIndexes[rasterization],
|
||||
fontWidth: fontWidth
|
||||
}
|
||||
return JSON.stringify(settings);
|
||||
}
|
||||
@ -231,11 +241,14 @@ Item{
|
||||
window_scaling = settings.window_scaling !== undefined ? settings.window_scaling : window_scaling
|
||||
|
||||
fontIndexes = settings.fontIndexes !== undefined ? settings.fontIndexes : fontIndexes
|
||||
fontScalingIndex = settings.fontScalingIndex !== undefined ? settings.fontScalingIndex : fontScalingIndex
|
||||
fontScaling = settings.fontScaling !== undefined ? settings.fontScaling : fontScaling
|
||||
|
||||
_frameReflections = settings.frameReflections !== undefined ? settings.frameReflections : _frameReflections;
|
||||
|
||||
showMenubar = settings.showMenubar !== undefined ? settings.showMenubar : showMenubar;
|
||||
|
||||
scanline_quality = settings.scanline_quality !== undefined ? settings.scanline_quality : scanline_quality;
|
||||
bloom_quality = settings.bloom_quality !== undefined ? settings.bloom_quality : bloom_quality;
|
||||
}
|
||||
|
||||
function loadProfileString(profileString){
|
||||
@ -269,6 +282,7 @@ Item{
|
||||
windowOpacity = settings.windowOpacity !== undefined ? settings.windowOpacity : windowOpacity;
|
||||
|
||||
fontIndexes[rasterization] = settings.fontIndex !== undefined ? settings.fontIndex : fontIndexes[rasterization];
|
||||
fontWidth = settings.fontWidth !== undefined ? settings.fontWidth : fontWidth;
|
||||
}
|
||||
|
||||
function storeCustomProfiles(){
|
||||
@ -320,47 +334,47 @@ Item{
|
||||
id: profileslist
|
||||
ListElement{
|
||||
text: "Default Amber"
|
||||
obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.65,"brightness":0.5,"brightness_flickering":0.1,"contrast":0.85,"fontIndex":0,"font_color":"#ff8100","frames_index":1,"glowing_line_strength":0.2,"horizontal_sincronization":0.08,"jitter":0.18,"motion_blur":0.4,"noise_strength":0.1,"rasterization":0,"screen_distortion":0.1,"windowOpacity":1,"chroma_color":0,"saturation_color":0,"rgb_shift":0}'
|
||||
obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.65,"brightness":0.5,"brightness_flickering":0.1,"contrast":0.85,"fontIndex":0,"font_color":"#ff8100","frames_index":1,"glowing_line_strength":0.2,"horizontal_sincronization":0.08,"jitter":0.18,"motion_blur":0.4,"noise_strength":0.1,"rasterization":0,"screen_distortion":0.1,"windowOpacity":1,"chroma_color":0,"saturation_color":0,"rgb_shift":0,"fontWidth":1.0}'
|
||||
builtin: true
|
||||
}
|
||||
ListElement{
|
||||
text: "Default Green"
|
||||
obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.4,"brightness":0.5,"brightness_flickering":0.1,"contrast":0.85,"fontIndex":0,"font_color":"#0ccc68","frames_index":1,"glowing_line_strength":0.2,"horizontal_sincronization":0.08,"jitter":0.18,"motion_blur":0.45,"noise_strength":0.1,"rasterization":0,"screen_distortion":0.1,"windowOpacity":1,"chroma_color":0,"saturation_color":0,"rgb_shift":0}'
|
||||
obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.4,"brightness":0.5,"brightness_flickering":0.1,"contrast":0.85,"fontIndex":0,"font_color":"#0ccc68","frames_index":1,"glowing_line_strength":0.2,"horizontal_sincronization":0.08,"jitter":0.18,"motion_blur":0.45,"noise_strength":0.1,"rasterization":0,"screen_distortion":0.1,"windowOpacity":1,"chroma_color":0,"saturation_color":0,"rgb_shift":0,"fontWidth":1.0}'
|
||||
builtin: true
|
||||
}
|
||||
ListElement{
|
||||
text: "Default Scanlines"
|
||||
obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.4,"brightness":0.5,"brightness_flickering":0.1,"contrast":0.85,"fontIndex":0,"font_color":"#00ff5b","frames_index":1,"glowing_line_strength":0.2,"horizontal_sincronization":0.07,"jitter":0.11,"motion_blur":0.4,"noise_strength":0.05,"rasterization":1,"screen_distortion":0.1,"windowOpacity":1,"chroma_color":0,"saturation_color":0,"rgb_shift":0}'
|
||||
obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.4,"brightness":0.5,"brightness_flickering":0.1,"contrast":0.85,"fontIndex":0,"font_color":"#00ff5b","frames_index":1,"glowing_line_strength":0.2,"horizontal_sincronization":0.07,"jitter":0.11,"motion_blur":0.4,"noise_strength":0.05,"rasterization":1,"screen_distortion":0.1,"windowOpacity":1,"chroma_color":0,"saturation_color":0,"rgb_shift":0,"fontWidth":1.0}'
|
||||
builtin: true
|
||||
}
|
||||
ListElement{
|
||||
text: "Default Pixelated"
|
||||
obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.4,"brightness":0.5,"brightness_flickering":0.1,"contrast":0.85,"fontIndex":0,"font_color":"#ff8100","frames_index":1,"glowing_line_strength":0.2,"horizontal_sincronization":0.1,"jitter":0,"motion_blur":0.45,"noise_strength":0.14,"rasterization":2,"screen_distortion":0.05,"windowOpacity":1,"chroma_color":0,"saturation_color":0,"rgb_shift":0}'
|
||||
obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.4,"brightness":0.5,"brightness_flickering":0.1,"contrast":0.85,"fontIndex":0,"font_color":"#ff8100","frames_index":1,"glowing_line_strength":0.2,"horizontal_sincronization":0.1,"jitter":0,"motion_blur":0.45,"noise_strength":0.14,"rasterization":2,"screen_distortion":0.05,"windowOpacity":1,"chroma_color":0,"saturation_color":0,"rgb_shift":0,"fontWidth":1.0}'
|
||||
builtin: true
|
||||
}
|
||||
ListElement{
|
||||
text: "Apple ]["
|
||||
obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.5,"brightness":0.5,"brightness_flickering":0.2,"contrast":0.85,"fontIndex":2,"font_color":"#2fff91","frames_index":1,"glowing_line_strength":0.22,"horizontal_sincronization":0.08,"jitter":0.1,"motion_blur":0.65,"noise_strength":0.08,"rasterization":1,"screen_distortion":0.18,"windowOpacity":1,"chroma_color":0,"saturation_color":0,"rgb_shift":0}'
|
||||
obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.5,"brightness":0.5,"brightness_flickering":0.2,"contrast":0.85,"fontIndex":2,"font_color":"#2fff91","frames_index":1,"glowing_line_strength":0.22,"horizontal_sincronization":0.08,"jitter":0.1,"motion_blur":0.65,"noise_strength":0.08,"rasterization":1,"screen_distortion":0.18,"windowOpacity":1,"chroma_color":0,"saturation_color":0,"rgb_shift":0,"fontWidth":1.0}'
|
||||
builtin: true
|
||||
}
|
||||
ListElement{
|
||||
text: "Vintage"
|
||||
obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.4,"brightness":0.5,"brightness_flickering":0.54,"contrast":0.85,"fontIndex":0,"font_color":"#00ff3e","frames_index":2,"glowing_line_strength":0.3,"horizontal_sincronization":0.2,"jitter":0.4,"motion_blur":0.75,"noise_strength":0.2,"rasterization":1,"screen_distortion":0.1,"windowOpacity":1,"chroma_color":0,"saturation_color":0,"rgb_shift":0}'
|
||||
obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.4,"brightness":0.5,"brightness_flickering":0.54,"contrast":0.85,"fontIndex":0,"font_color":"#00ff3e","frames_index":2,"glowing_line_strength":0.3,"horizontal_sincronization":0.2,"jitter":0.4,"motion_blur":0.75,"noise_strength":0.2,"rasterization":1,"screen_distortion":0.1,"windowOpacity":1,"chroma_color":0,"saturation_color":0,"rgb_shift":0,"fontWidth":1.0}'
|
||||
builtin: true
|
||||
}
|
||||
ListElement{
|
||||
text: "IBM Dos"
|
||||
obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.4,"brightness":0.5,"brightness_flickering":0.07,"contrast":0.85,"fontIndex":7,"font_color":"#ffffff","frames_index":1,"glowing_line_strength":0.13,"horizontal_sincronization":0,"jitter":0.08,"motion_blur":0.3,"noise_strength":0.03,"rasterization":0,"screen_distortion":0.1,"windowOpacity":1,"chroma_color":1,"saturation_color":0,"rgb_shift":0.5}'
|
||||
obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.4,"brightness":0.5,"brightness_flickering":0.07,"contrast":0.85,"fontIndex":7,"font_color":"#ffffff","frames_index":1,"glowing_line_strength":0.13,"horizontal_sincronization":0,"jitter":0.08,"motion_blur":0.3,"noise_strength":0.03,"rasterization":0,"screen_distortion":0.1,"windowOpacity":1,"chroma_color":1,"saturation_color":0,"rgb_shift":0.5,"fontWidth":1.0}'
|
||||
builtin: true
|
||||
}
|
||||
ListElement{
|
||||
text: "IBM 3278"
|
||||
obj_string: '{"ambient_light":0.1,"background_color":"#000000","bloom_strength":0.15,"brightness":0.5,"brightness_flickering":0,"contrast":0.95,"fontIndex":8,"font_color":"#0ccc68","frames_index":1,"glowing_line_strength":0,"horizontal_sincronization":0,"jitter":0,"motion_blur":0.6,"noise_strength":0,"rasterization":0,"screen_distortion":0.1,"windowOpacity":1,"chroma_color":0,"saturation_color":0,"rgb_shift":0}'
|
||||
obj_string: '{"ambient_light":0.1,"background_color":"#000000","bloom_strength":0.15,"brightness":0.5,"brightness_flickering":0,"contrast":0.95,"fontIndex":8,"font_color":"#0ccc68","frames_index":1,"glowing_line_strength":0,"horizontal_sincronization":0,"jitter":0,"motion_blur":0.6,"noise_strength":0,"rasterization":0,"screen_distortion":0.1,"windowOpacity":1,"chroma_color":0,"saturation_color":0,"rgb_shift":0,"fontWidth":1.0}'
|
||||
builtin: true
|
||||
}
|
||||
ListElement{
|
||||
text: "Transparent Green"
|
||||
obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.4549689440993788,"brightness":0.5,"brightness_flickering":0.20341614906832298,"contrast":0.85,"fontIndex":0,"font_color":"#0ccc68","frames_index":0,"glowing_line_strength":0.15993788819875776,"horizontal_sincronization":0.05045871559633028,"jitter":0.20341614906832298,"motion_blur":0.24999999999999997,"noise_strength":0.20031055900621117,"rasterization":0,"screen_distortion":0.05045871559633028,"windowOpacity":0.5956221198156681,"chroma_color":0,"saturation_color":0,"rgb_shift":0}'
|
||||
obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.4549689440993788,"brightness":0.5,"brightness_flickering":0.20341614906832298,"contrast":0.85,"fontIndex":0,"font_color":"#0ccc68","frames_index":0,"glowing_line_strength":0.15993788819875776,"horizontal_sincronization":0.05045871559633028,"jitter":0.20341614906832298,"motion_blur":0.24999999999999997,"noise_strength":0.20031055900621117,"rasterization":0,"screen_distortion":0.05045871559633028,"windowOpacity":0.5956221198156681,"chroma_color":0,"saturation_color":0,"rgb_shift":0,"fontWidth":1.0}'
|
||||
builtin: true
|
||||
}
|
||||
}
|
||||
|
@ -32,13 +32,6 @@ Item{
|
||||
|
||||
ListModel{
|
||||
id: fontlist
|
||||
ListElement{
|
||||
text: "Commodore PET 2Y (1977)"
|
||||
source: "fonts/1977-commodore-pet/COMMODORE_PET_2y.ttf"
|
||||
lineSpacing: 2
|
||||
pixelSize: 16
|
||||
baseScaling: 3.0
|
||||
}
|
||||
ListElement{
|
||||
text: "Commodore PET (1977)"
|
||||
source: "fonts/1977-commodore-pet/COMMODORE_PET.ttf"
|
||||
|
@ -32,13 +32,6 @@ Item{
|
||||
|
||||
ListModel{
|
||||
id: fontlist
|
||||
ListElement{
|
||||
text: "Commodore PET 2Y (1977)"
|
||||
source: "fonts/1977-commodore-pet/COMMODORE_PET_2y.ttf"
|
||||
lineSpacing: 2
|
||||
pixelSize: 16
|
||||
baseScaling: 3.0
|
||||
}
|
||||
ListElement{
|
||||
text: "Commodore PET (1977)"
|
||||
source: "fonts/1977-commodore-pet/COMMODORE_PET.ttf"
|
||||
|
@ -77,6 +77,23 @@ Item{
|
||||
kterminal.copyClipboard();
|
||||
}
|
||||
|
||||
//When settings are updated sources need to be redrawn.
|
||||
Connections{
|
||||
target: shadersettings
|
||||
onFontScalingChanged: terminalContainer.updateSources();
|
||||
onFontWidthChanged: terminalContainer.updateSources();
|
||||
}
|
||||
Connections{
|
||||
target: terminalContainer
|
||||
onWidthChanged: terminalContainer.updateSources();
|
||||
onHeightChanged: terminalContainer.updateSources();
|
||||
}
|
||||
function updateSources() {
|
||||
kterminal.update();
|
||||
kterminal.updateImage();
|
||||
}
|
||||
|
||||
|
||||
KTerminal {
|
||||
id: kterminal
|
||||
width: parent.width
|
||||
@ -84,6 +101,8 @@ Item{
|
||||
|
||||
colorScheme: "cool-retro-term"
|
||||
|
||||
smooth: false
|
||||
|
||||
session: KSession {
|
||||
id: ksession
|
||||
kbScheme: "xterm"
|
||||
@ -93,9 +112,6 @@ Item{
|
||||
}
|
||||
}
|
||||
|
||||
onWidthChanged: update();
|
||||
onHeightChanged: update();
|
||||
|
||||
FontLoader{ id: fontLoader }
|
||||
Text{id: fontMetrics; text: "B"; visible: false}
|
||||
|
||||
@ -104,9 +120,17 @@ Item{
|
||||
font.pixelSize = pixelSize;
|
||||
font.family = fontLoader.name;
|
||||
|
||||
width = Qt.binding(function() {return Math.floor(terminalContainer.width / screenScaling);});
|
||||
var fontWidth = 1.0 / shadersettings.fontWidth;
|
||||
|
||||
width = Qt.binding(function() {return Math.floor(fontWidth * terminalContainer.width / screenScaling);});
|
||||
height = Qt.binding(function() {return Math.floor(terminalContainer.height / screenScaling);});
|
||||
|
||||
var scaleTexture = Math.max(Math.round(screenScaling / shadersettings.scanline_quality), 1.0);
|
||||
|
||||
kterminalSource.textureSize = Qt.binding(function () {
|
||||
return Qt.size(kterminal.width * scaleTexture, kterminal.height * scaleTexture);
|
||||
});
|
||||
|
||||
setLineSpacing(lineSpacing);
|
||||
update();
|
||||
restartBlurredSource();
|
||||
@ -174,7 +198,6 @@ Item{
|
||||
id: kterminalSource
|
||||
sourceItem: kterminal
|
||||
hideSource: true
|
||||
smooth: mScanlines == shadersettings.no_rasterization
|
||||
wrapMode: ShaderEffectSource.ClampToEdge
|
||||
live: false
|
||||
|
||||
@ -190,6 +213,7 @@ Item{
|
||||
}
|
||||
Loader{
|
||||
id: blurredSourceLoader
|
||||
asynchronous: true
|
||||
active: mBlur !== 0
|
||||
|
||||
sourceComponent: ShaderEffectSource{
|
||||
@ -200,8 +224,6 @@ Item{
|
||||
hideSource: true
|
||||
wrapMode: kterminalSource.wrapMode
|
||||
|
||||
smooth: mScanlines == shadersettings.no_rasterization
|
||||
|
||||
function restartBlurSource(){
|
||||
livetimer.restart();
|
||||
}
|
||||
@ -228,13 +250,19 @@ Item{
|
||||
livetimer.restart();
|
||||
}
|
||||
}
|
||||
Connections{
|
||||
target: shadersettings
|
||||
onScanline_qualityChanged: restartBlurredSource();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loader{
|
||||
id: blurredTerminalLoader
|
||||
anchors.fill: kterminal
|
||||
width: kterminalSource.textureSize.width
|
||||
height: kterminalSource.textureSize.height
|
||||
active: mBlur !== 0
|
||||
asynchronous: true
|
||||
|
||||
sourceComponent: ShaderEffect {
|
||||
property variant txt_source: kterminalSource
|
||||
@ -277,23 +305,32 @@ Item{
|
||||
// BLOOM ////////////////////////////////////////////////////////////////
|
||||
|
||||
Loader{
|
||||
property real scaling: shadersettings.bloom_quality
|
||||
id: bloomEffectLoader
|
||||
active: mBloom != 0
|
||||
anchors.fill: parent
|
||||
asynchronous: true
|
||||
width: parent.width * scaling
|
||||
height: parent.height * scaling
|
||||
sourceComponent: FastBlur{
|
||||
radius: 48
|
||||
radius: 48 * scaling
|
||||
source: kterminal
|
||||
transparentBorder: true
|
||||
smooth: false
|
||||
}
|
||||
}
|
||||
Loader{
|
||||
id: bloomSourceLoader
|
||||
active: mBloom != 0
|
||||
asynchronous: true
|
||||
sourceComponent: ShaderEffectSource{
|
||||
id: _bloomEffectSource
|
||||
sourceItem: bloomEffectLoader.item
|
||||
hideSource: true
|
||||
smooth: false
|
||||
live: false
|
||||
smooth: true
|
||||
Connections{
|
||||
target: kterminalSource
|
||||
onSourceUpdate: _bloomEffectSource.scheduleUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -92,49 +92,17 @@ Tab{
|
||||
}
|
||||
}
|
||||
GroupBox{
|
||||
title: qsTr("Performace")
|
||||
title: qsTr("Frame")
|
||||
Layout.fillWidth: true
|
||||
Layout.columnSpan: 2
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
GridLayout{
|
||||
RowLayout{
|
||||
anchors.fill: parent
|
||||
rows: 3
|
||||
columns: 3
|
||||
CheckBox{
|
||||
Layout.columnSpan: 3
|
||||
checked: !shadersettings._frameReflections
|
||||
text: qsTr("Disable reflections")
|
||||
onCheckedChanged: shadersettings._frameReflections = !checked
|
||||
enabled: shadersettings.reflectionsAllowed
|
||||
}
|
||||
CheckBox{
|
||||
property int fps: checked ? slider.value : 0
|
||||
onFpsChanged: shadersettings.fps = fps
|
||||
checked: shadersettings.fps !== 0
|
||||
text: qsTr("Limit FPS")
|
||||
}
|
||||
Slider{
|
||||
id: slider
|
||||
ComboBox{
|
||||
id: framescombobox
|
||||
Layout.fillWidth: true
|
||||
stepSize: 1
|
||||
maximumValue: 60
|
||||
minimumValue: 1
|
||||
enabled: shadersettings.fps !== 0
|
||||
value: shadersettings.fps !== 0 ? shadersettings.fps : 60
|
||||
model: shadersettings.frames_list
|
||||
currentIndex: shadersettings.frames_index
|
||||
onCurrentIndexChanged: shadersettings.frames_index = currentIndex
|
||||
}
|
||||
Text{text: slider.value}
|
||||
Text{text: qsTr("Texture quality")}
|
||||
Slider{
|
||||
Layout.fillWidth: true
|
||||
id: txtslider
|
||||
onValueChanged: shadersettings.window_scaling = value;
|
||||
value: shadersettings.window_scaling
|
||||
tickmarksEnabled: true
|
||||
stepSize: 0.25
|
||||
Component.onCompleted: minimumValue = 0.5 //Without this value gets set to 0.5
|
||||
}
|
||||
Text{text: Math.round(txtslider.value * 100) + "%"}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
160
app/qml/SettingsPerformanceTab.qml
Normal file
160
app/qml/SettingsPerformanceTab.qml
Normal file
@ -0,0 +1,160 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2013 "Filippo Scognamiglio"
|
||||
* https://github.com/Swordfish90/cool-retro-term
|
||||
*
|
||||
* This file is part of cool-retro-term.
|
||||
*
|
||||
* cool-retro-term is free software: you can redistribute it and/or modify
|
||||
* 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
|
||||
|
||||
Tab{
|
||||
ColumnLayout{
|
||||
anchors.fill: parent
|
||||
GroupBox{
|
||||
title: qsTr("General")
|
||||
Layout.fillWidth: true
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
GridLayout{
|
||||
anchors.fill: parent
|
||||
rows: 2
|
||||
columns: 3
|
||||
CheckBox{
|
||||
property int fps: checked ? slider.value : 0
|
||||
onFpsChanged: shadersettings.fps = fps
|
||||
checked: shadersettings.fps !== 0
|
||||
text: qsTr("Limit FPS")
|
||||
}
|
||||
Slider{
|
||||
id: slider
|
||||
Layout.fillWidth: true
|
||||
stepSize: 1
|
||||
maximumValue: 60
|
||||
minimumValue: 1
|
||||
enabled: shadersettings.fps !== 0
|
||||
value: shadersettings.fps !== 0 ? shadersettings.fps : 60
|
||||
}
|
||||
Text{text: slider.value}
|
||||
Text{text: qsTr("Texture Quality")}
|
||||
Slider{
|
||||
Layout.fillWidth: true
|
||||
id: txtslider
|
||||
onValueChanged: shadersettings.window_scaling = value;
|
||||
value: shadersettings.window_scaling
|
||||
tickmarksEnabled: true
|
||||
stepSize: 0.25
|
||||
Component.onCompleted: minimumValue = 0.5 //Without this value gets set to 0.5
|
||||
}
|
||||
Text{text: Math.round(txtslider.value * 100) + "%"}
|
||||
}
|
||||
}
|
||||
GroupBox{
|
||||
title: qsTr("Rasterization")
|
||||
Layout.fillWidth: true
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
GridLayout{
|
||||
id: scanlineQualityContainer
|
||||
anchors.fill: parent
|
||||
columns: 3
|
||||
property alias valsIndex: scanlineQualitySlider.value
|
||||
property var vals: [4,3,2]
|
||||
property var valsStrings: [
|
||||
qsTr("Low"),
|
||||
qsTr("Medium"),
|
||||
qsTr("High")
|
||||
]
|
||||
|
||||
onValsIndexChanged: shadersettings.scanline_quality = vals[valsIndex];
|
||||
|
||||
Text{text: qsTr("Scanlines Quality")}
|
||||
Slider{
|
||||
id: scanlineQualitySlider
|
||||
Layout.fillWidth: true
|
||||
onValueChanged: parent.valsIndex = value;
|
||||
stepSize: 1
|
||||
Component.onCompleted: {
|
||||
minimumValue = 0;
|
||||
maximumValue = 2;
|
||||
value = parent.vals.indexOf(shadersettings.scanline_quality);
|
||||
}
|
||||
Connections{
|
||||
target: shadersettings
|
||||
onScanline_qualityChanged:
|
||||
scanlineQualityContainer.valsIndex = scanlineQualityContainer.vals.indexOf(shadersettings.scanline_quality);
|
||||
}
|
||||
}
|
||||
Text{
|
||||
text: parent.valsStrings[parent.valsIndex];
|
||||
}
|
||||
}
|
||||
}
|
||||
GroupBox{
|
||||
title: qsTr("Bloom")
|
||||
Layout.fillWidth: true
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
GridLayout{
|
||||
id: bloomQualityContainer
|
||||
anchors.fill: parent
|
||||
columns: 3
|
||||
property alias valsIndex: bloomQualitySlider.value
|
||||
property var vals: [0.25, 0.50, 1.00]
|
||||
property var valsStrings: [
|
||||
qsTr("Low"),
|
||||
qsTr("Medium"),
|
||||
qsTr("High")
|
||||
]
|
||||
|
||||
onValsIndexChanged: shadersettings.bloom_quality = vals[valsIndex];
|
||||
|
||||
Text{text: qsTr("Bloom Quality")}
|
||||
Slider{
|
||||
id: bloomQualitySlider
|
||||
Layout.fillWidth: true
|
||||
onValueChanged: parent.valsIndex = value;
|
||||
stepSize: 1
|
||||
Component.onCompleted: {
|
||||
minimumValue = 0;
|
||||
maximumValue = 2;
|
||||
value = parent.vals.indexOf(shadersettings.bloom_quality);
|
||||
}
|
||||
Connections{
|
||||
target: shadersettings
|
||||
onBloom_qualityChanged:
|
||||
bloomQualityContainer.valsIndex = bloomQualityContainer.vals.indexOf(shadersettings.bloom_quality);
|
||||
}
|
||||
}
|
||||
Text{
|
||||
text: parent.valsStrings[parent.valsIndex];
|
||||
}
|
||||
}
|
||||
}
|
||||
GroupBox{
|
||||
title: qsTr("Frame")
|
||||
Layout.fillWidth: true
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
CheckBox{
|
||||
checked: shadersettings._frameReflections
|
||||
text: qsTr("Frame Reflections")
|
||||
onCheckedChanged: shadersettings._frameReflections = checked
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -35,11 +35,8 @@ Tab{
|
||||
model: [qsTr("Default"), qsTr("Scanlines"), qsTr("Pixels")]
|
||||
currentIndex: shadersettings.rasterization
|
||||
onCurrentIndexChanged: {
|
||||
scalingChanger.enabled = false;
|
||||
shadersettings.rasterization = currentIndex
|
||||
fontChanger.updateIndex();
|
||||
scalingChanger.updateIndex();
|
||||
scalingChanger.enabled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -67,24 +64,39 @@ Tab{
|
||||
RowLayout{
|
||||
Layout.fillWidth: true
|
||||
Slider{
|
||||
id: scalingChanger
|
||||
Layout.fillWidth: true
|
||||
minimumValue: 0
|
||||
maximumValue: shadersettings.fontScalingList.length - 1
|
||||
stepSize: 1
|
||||
tickmarksEnabled: true
|
||||
value: updateIndex()
|
||||
onValueChanged: {
|
||||
if(!enabled) return; //Ugly and hacky solution. Look for a better solution.
|
||||
shadersettings.setScalingIndex(value);
|
||||
id: fontScalingChanger
|
||||
onValueChanged: if(enabled) shadersettings.fontScaling = value
|
||||
stepSize: 0.05
|
||||
enabled: false // Another trick to fix initial bad behavior.
|
||||
Component.onCompleted: {
|
||||
minimumValue = 0.5;
|
||||
maximumValue = 2.5;
|
||||
value = shadersettings.fontScaling;
|
||||
enabled = true;
|
||||
}
|
||||
function updateIndex(){
|
||||
value = shadersettings.getScalingIndex();
|
||||
Connections{
|
||||
target: shadersettings
|
||||
onFontScalingChanged: fontScalingChanger.value = shadersettings.fontScaling;
|
||||
}
|
||||
Component.onCompleted: shadersettings.fontScalingChanged.connect(updateIndex);
|
||||
}
|
||||
Text{
|
||||
text: shadersettings.fontScalingList[scalingChanger.value].toFixed(2)
|
||||
text: Math.round(fontScalingChanger.value * 100) + "%"
|
||||
}
|
||||
}
|
||||
Text{ text: qsTr("Font Width") }
|
||||
RowLayout{
|
||||
Layout.fillWidth: true
|
||||
Slider{
|
||||
Layout.fillWidth: true
|
||||
id: widthChanger
|
||||
onValueChanged: shadersettings.fontWidth = value;
|
||||
value: shadersettings.fontWidth
|
||||
stepSize: 0.05
|
||||
Component.onCompleted: minimumValue = 0.5 //Without this value gets set to 0.5
|
||||
}
|
||||
Text{
|
||||
text: Math.round(widthChanger.value * 100) + "%"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -127,19 +139,5 @@ Tab{
|
||||
}
|
||||
}
|
||||
}
|
||||
GroupBox{
|
||||
title: qsTr("Frame")
|
||||
Layout.fillWidth: true
|
||||
RowLayout{
|
||||
anchors.fill: parent
|
||||
ComboBox{
|
||||
id: framescombobox
|
||||
Layout.fillWidth: true
|
||||
model: shadersettings.frames_list
|
||||
currentIndex: shadersettings.frames_index
|
||||
onCurrentIndexChanged: shadersettings.frames_index = currentIndex
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -28,27 +28,37 @@ Window {
|
||||
id: settings_window
|
||||
title: qsTr("Settings")
|
||||
width: 640
|
||||
height: 450
|
||||
height: 440
|
||||
|
||||
property int tabmargins: 15
|
||||
|
||||
TabView{
|
||||
id: tabView
|
||||
anchors.fill: parent
|
||||
anchors.margins: 10
|
||||
SettingsGeneralTab{
|
||||
id: generalTab
|
||||
title: qsTr("General")
|
||||
anchors.fill: parent
|
||||
anchors.margins: tabmargins
|
||||
}
|
||||
SettingsTerminalTab{
|
||||
id: terminalTab
|
||||
title: qsTr("Terminal")
|
||||
anchors.fill: parent
|
||||
anchors.margins: tabmargins
|
||||
}
|
||||
SettingsEffectsTab{
|
||||
id: effectsTab
|
||||
title: qsTr("Effects")
|
||||
anchors.fill: parent
|
||||
anchors.margins: tabmargins
|
||||
}
|
||||
SettingsPerformanceTab{
|
||||
id: performanceTab
|
||||
title: qsTr("Performance")
|
||||
anchors.fill: parent
|
||||
anchors.margins: tabmargins
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -85,20 +85,13 @@ ApplicationWindow{
|
||||
id: zoomIn
|
||||
text: qsTr("Zoom In")
|
||||
shortcut: "Ctrl++"
|
||||
onTriggered: {
|
||||
var oldScaling = shadersettings.fontScalingIndex;
|
||||
var maxScalingIndex = shadersettings.fontScalingList.length - 1;
|
||||
shadersettings.setScalingIndex(Math.min(oldScaling + 1, maxScalingIndex));
|
||||
}
|
||||
onTriggered: shadersettings.incrementScaling();
|
||||
}
|
||||
Action{
|
||||
id: zoomOut
|
||||
text: qsTr("Zoom Out")
|
||||
shortcut: "Ctrl+-"
|
||||
onTriggered: {
|
||||
var oldScaling = shadersettings.fontScalingIndex;
|
||||
shadersettings.setScalingIndex(Math.max(oldScaling - 1, 0));
|
||||
}
|
||||
onTriggered: shadersettings.decrementScaling();
|
||||
}
|
||||
Action{
|
||||
id: showAboutAction
|
||||
|
@ -64,5 +64,6 @@
|
||||
<file>fonts/1985-ibm-pc-vga/dos437.txt</file>
|
||||
<file>Storage.qml</file>
|
||||
<file>CRTMainMenuBar.qml</file>
|
||||
<file>SettingsPerformanceTab.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
Loading…
x
Reference in New Issue
Block a user