1
0
mirror of https://github.com/Swordfish90/cool-retro-term.git synced 2025-01-31 02:01:19 +00:00

Fix merge conflicts.

This commit is contained in:
Filippo Scognamiglio 2015-01-20 01:13:26 +01:00
commit 2911960482
12 changed files with 131 additions and 66 deletions

View File

@ -19,13 +19,19 @@
*******************************************************************************/
import QtQuick 2.2
import QtQuick.Controls 1.0
import "utils.js" as Utils
QtObject{
property string version: "1.0.0 RC1"
// GENERAL SETTINGS ///////////////////////////////////////////////////
// STATIC CONSTANTS ////////////////////////////////////////////////////////
readonly property real minimumFontScaling: 0.25
readonly property real maximumFontScaling: 2.50
// GENERAL SETTINGS ///////////////////////////////////////////////////////
property bool fullscreen: false
property bool showMenubar: true
@ -113,12 +119,12 @@ QtObject{
}
function incrementScaling(){
fontScaling = Math.min(fontScaling + 0.05, 2.50);
fontScaling = Math.min(fontScaling + 0.05, maximumFontScaling);
handleFontChanged();
}
function decrementScaling(){
fontScaling = Math.max(fontScaling - 0.05, 0.50);
fontScaling = Math.max(fontScaling - 0.05, minimumFontScaling);
handleFontChanged();
}
@ -455,4 +461,11 @@ QtObject{
storeCustomProfiles();
//storage.dropSettings(); //DROPS THE SETTINGS!.. REMEMBER TO DISABLE ONCE ENABLED!!
}
// VARS ///////////////////////////////////////////////////////////////////
property Label _sampleLabel: Label {
text: "100%"
}
property real labelWidth: _sampleLabel.width
}

View File

@ -22,6 +22,8 @@ import QtQuick 2.2
import QtQuick.Controls 1.1
import QtQuick.Layouts 1.1
import "Components"
RowLayout {
property alias name: check.text
@ -35,7 +37,6 @@ RowLayout {
id: setting_component
anchors.left: parent.left
anchors.right: parent.right
spacing: 25
onValueChanged: {
check.checked = !(value == 0);
@ -45,7 +46,7 @@ RowLayout {
CheckBox{
id: check
implicitWidth: 150
implicitWidth: 160
onClicked: {
if(!checked){
checked = false;
@ -66,16 +67,8 @@ RowLayout {
newValue(value);
}
}
Text{
id: textfield
property string unformattedText: Math.round(((value - min_value) / (max_value - min_value)) * 100)
text: formatNumber(unformattedText)
}
function formatNumber(num) {
var n = "" + num;
while (n.length < 3) {
n = " " + n;
}
return n + "%";
SizedLabel {
anchors { top: parent.top; bottom: parent.bottom }
text: Math.round(((value - min_value) / (max_value - min_value)) * 100) + "%"
}
}

View File

@ -0,0 +1,35 @@
/*******************************************************************************
* 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.0
import QtQuick.Controls 1.0
// This component is simply a label with a predifined size.
// Used to improve alignment.
Item {
property alias text: textfield.text
width: appSettings.labelWidth
Label{
id: textfield
anchors { right: parent.right; verticalCenter: parent.verticalCenter }
}
}

View File

@ -44,11 +44,13 @@ Item{
anchors.topMargin: frame.displacementTop * appSettings.windowScaling
anchors.bottomMargin: frame.displacementBottom * appSettings.windowScaling
//The blur effect has to take into account the framerate
property real mBlur: Math.sqrt(appSettings.burnIn)
property real motionBlurCoefficient: Utils.lint(_minBlurCoefficient, _maxBlurCoefficient, mBlur)
property real _minBlurCoefficient: 0.2
property real _maxBlurCoefficient: 0.02
//Parameters for the burnIn effect.
property real burnIn: appSettings.burnIn
property real fps: appSettings.fps !== 0 ? appSettings.fps : 60
property real burnInFadeTime: Utils.lint(_minBurnInFadeTime, _maxBurnInFadeTime, burnIn)
property real motionBlurCoefficient: 1.0 / (fps * burnInFadeTime)
property real _minBurnInFadeTime: 0.16
property real _maxBurnInFadeTime: 1.6
property size terminalSize: kterminal.terminalSize
property size fontMetrics: kterminal.fontMetrics
@ -176,7 +178,7 @@ Item{
MouseArea{
acceptedButtons: Qt.LeftButton | Qt.MiddleButton | Qt.RightButton
anchors.fill: parent
cursorShape: Qt.IBeamCursor
cursorShape: kterminal.terminalUsesMouse ? Qt.ArrowCursor : Qt.IBeamCursor
onWheel:{
if(wheel.modifiers & Qt.ControlModifier){
wheel.angleDelta.y > 0 ? zoomIn.trigger() : zoomOut.trigger();
@ -228,13 +230,15 @@ Item{
Loader{
id: blurredSourceLoader
asynchronous: true
active: mBlur !== 0
active: burnIn !== 0
sourceComponent: ShaderEffectSource{
property bool updateBurnIn: false
id: _blurredSourceEffect
sourceItem: blurredTerminalLoader.item
recursive: true
live: true
live: false
hideSource: true
wrapMode: kterminalSource.wrapMode
@ -244,6 +248,13 @@ Item{
livetimer.restart();
}
// This updates the burnin synched with the timer.
Connections {
target: updateBurnIn ? mainShader : null
ignoreUnknownSignals: false
onTimeChanged: _blurredSourceEffect.scheduleUpdate();
}
Timer{
id: livetimer
@ -251,14 +262,15 @@ Item{
// We multiply 1.1 to have a little bit of margin over the theoretical value.
// This solution is not extremely clean, but it's probably the best to avoid measuring fps.
interval: (1 / motionBlurCoefficient) * 60 * 1.1
interval: burnInFadeTime * 1000 * 1.1
running: true
onTriggered: _blurredSourceEffect.live = false;
onTriggered: _blurredSourceEffect.updateBurnIn = false;
}
Connections{
target: kterminal
onImagePainted:{
_blurredSourceEffect.live = true;
_blurredSourceEffect.scheduleUpdate();
_blurredSourceEffect.updateBurnIn = true;
livetimer.restart();
}
}
@ -289,7 +301,7 @@ Item{
? kterminal.height * Math.max(1, burnInScaling)
: kterminal.height * scaleTexture * appSettings.burnInQuality
active: mBlur !== 0
active: burnIn !== 0
asynchronous: true
sourceComponent: ShaderEffect {

View File

@ -22,6 +22,8 @@ import QtQuick 2.2
import QtQuick.Controls 1.1
import QtQuick.Layouts 1.1
import "Components"
Tab{
ColumnLayout{
anchors.fill: parent
@ -47,10 +49,10 @@ Tab{
maximumValue: 60
minimumValue: 1
enabled: appSettings.fps !== 0
value: appSettings.fps !== 0 ? appSettings.fps : 60
value: appSettings.fps !== 0 ? appSettings.fps : 24
}
Text{text: slider.value}
Text{text: qsTr("Texture Quality")}
SizedLabel { text: slider.value }
Label{text: qsTr("Texture Quality")}
Slider{
Layout.fillWidth: true
id: txtslider
@ -63,7 +65,7 @@ Tab{
enabled = true;
}
}
Text{text: Math.round(txtslider.value * 100) + "%"}
SizedLabel{text: Math.round(txtslider.value * 100) + "%"}
}
}
GroupBox{
@ -74,8 +76,7 @@ Tab{
GridLayout{
id: bloomQualityContainer
anchors.fill: parent
Text{text: qsTr("Bloom Quality")}
Label{text: qsTr("Bloom Quality")}
Slider{
Layout.fillWidth: true
id: bloomSlider
@ -88,7 +89,7 @@ Tab{
enabled = true;
}
}
Text{text: Math.round(bloomSlider.value * 100) + "%"}
SizedLabel{text: Math.round(bloomSlider.value * 100) + "%"}
}
}
GroupBox{
@ -100,7 +101,7 @@ Tab{
id: blurQualityContainer
anchors.fill: parent
Text{text: qsTr("BurnIn Quality")}
Label{text: qsTr("BurnIn Quality")}
Slider{
Layout.fillWidth: true
id: burnInSlider
@ -113,7 +114,7 @@ Tab{
enabled = true;
}
}
Text{text: Math.round(burnInSlider.value * 100) + "%"}
SizedLabel{text: Math.round(burnInSlider.value * 100) + "%"}
}
}
GroupBox{

View File

@ -46,17 +46,17 @@ Tab{
GridLayout{
anchors.fill: parent
columns: 2
Text{ text: qsTr("Brightness") }
Label{ text: qsTr("Brightness") }
SimpleSlider{
onValueChanged: appSettings.brightness = value
value: appSettings.brightness
}
Text{ text: qsTr("Contrast") }
Label{ text: qsTr("Contrast") }
SimpleSlider{
onValueChanged: appSettings.contrast = value
value: appSettings.contrast
}
Text{ text: qsTr("Opacity") }
Label{ text: qsTr("Opacity") }
SimpleSlider{
onValueChanged: appSettings.windowOpacity = value
value: appSettings.windowOpacity

View File

@ -22,6 +22,8 @@ import QtQuick 2.2
import QtQuick.Controls 1.1
import QtQuick.Layouts 1.1
import "Components"
Tab{
ColumnLayout{
anchors.fill: parent
@ -32,7 +34,7 @@ Tab{
GridLayout{
anchors.fill: parent
columns: 2
Text{ text: qsTr("Name") }
Label{ text: qsTr("Name") }
ComboBox{
id: fontChanger
Layout.fillWidth: true
@ -54,7 +56,7 @@ Tab{
}
Component.onCompleted: updateIndex();
}
Text{ text: qsTr("Scaling") }
Label{ text: qsTr("Scaling") }
RowLayout{
Layout.fillWidth: true
Slider{
@ -64,8 +66,8 @@ Tab{
stepSize: 0.05
enabled: false // Another trick to fix initial bad behavior.
Component.onCompleted: {
minimumValue = 0.5;
maximumValue = 2.5;
minimumValue = appSettings.minimumFontScaling;
maximumValue = appSettings.maximumFontScaling;
value = appSettings.fontScaling;
enabled = true;
}
@ -74,11 +76,11 @@ Tab{
onFontScalingChanged: fontScalingChanger.value = appSettings.fontScaling;
}
}
Text{
SizedLabel{
text: Math.round(fontScalingChanger.value * 100) + "%"
}
}
Text{ text: qsTr("Font Width") }
Label{ text: qsTr("Font Width") }
RowLayout{
Layout.fillWidth: true
Slider{
@ -93,7 +95,7 @@ Tab{
maximumValue = 1.5;
}
}
Text{
SizedLabel{
text: Math.round(widthChanger.value * 100) + "%"
}
}

View File

@ -21,13 +21,13 @@
import QtQuick 2.2
import QtGraphicalEffects 1.0
import "utils.js" as Utils
ShaderEffect {
property ShaderEffectSource source
property ShaderEffectSource blurredSource
property ShaderEffectSource bloomSource
property real liveBlur: blurredSource && blurredSource.live ? 1.0 : 0.0
property color fontColor: appSettings.fontColor
property color backgroundColor: appSettings.backgroundColor
property real bloom: appSettings.bloom * 2.5
@ -58,6 +58,12 @@ ShaderEffect {
property real screen_brightness: appSettings.brightness * 1.5 + 0.5
// This is the average value of the abs(sin) function. Needed to avoid aliasing.
readonly property real absSinAvg: 0.63661828335466886
property size rasterizationSmooth: Qt.size(
Utils.clamp(2.0 * virtual_resolution.width / width, 0.0, 1.0),
Utils.clamp(2.0 * virtual_resolution.height / height, 0.0, 1.0))
property real dispX
property real dispY
property size virtual_resolution
@ -155,6 +161,7 @@ ShaderEffect {
uniform lowp float screen_brightness;
uniform highp vec2 virtual_resolution;
uniform highp vec2 rasterizationSmooth;
uniform highp float dispX;
uniform highp float dispY;" +
@ -162,8 +169,7 @@ ShaderEffect {
uniform highp sampler2D bloomSource;
uniform lowp float bloom;" : "") +
(burnIn !== 0 ? "
uniform sampler2D blurredSource;
uniform lowp float liveBlur;" : "") +
uniform sampler2D blurredSource;" : "") +
(staticNoise !== 0 ? "
uniform highp float staticNoise;" : "") +
(((staticNoise !== 0 || jitter !== 0 || rbgShift)
@ -201,9 +207,11 @@ ShaderEffect {
highp float result = 1.0;" +
(appSettings.rasterization != appSettings.no_rasterization ?
"result *= abs(sin(coords.y * virtual_resolution.y * "+Math.PI+"));" : "") +
"float val = abs(sin(coords.y * virtual_resolution.y * "+Math.PI+"));
result *= mix(val, " + absSinAvg + ", rasterizationSmooth.y);" : "") +
(appSettings.rasterization == appSettings.pixel_rasterization ?
"result *= abs(sin(coords.x * virtual_resolution.x * "+Math.PI+"));" : "") + "
"val = abs(sin(coords.x * virtual_resolution.x * "+Math.PI+"));
result *= mix(val, " + absSinAvg + ", rasterizationSmooth.x);" : "") + "
return result;
}
@ -269,7 +277,7 @@ ShaderEffect {
"vec3 txt_color = texture2D(source, txt_coords).rgb;" +
(burnIn !== 0 ? "
vec4 txt_blur = liveBlur * texture2D(blurredSource, txt_coords);
vec4 txt_blur = texture2D(blurredSource, txt_coords);
txt_color = txt_color + txt_blur.rgb * txt_blur.a;"
: "") +

View File

@ -22,6 +22,8 @@ import QtQuick 2.2
import QtQuick.Controls 1.1
import QtQuick.Layouts 1.1
import "Components"
RowLayout {
property alias value: slider.value
property alias stepSize: slider.stepSize
@ -36,15 +38,7 @@ RowLayout {
stepSize: parent.stepSize
Layout.fillWidth: true
}
Text{
id: textfield
text: formatNumber(Math.round(value * maxMultiplier))
}
function formatNumber(num) {
var n = "" + num;
while (n.length < 3) {
n = " " + n;
}
return n + "%";
SizedLabel{
text: Math.round(value * maxMultiplier) + "%"
}
}

View File

@ -52,5 +52,6 @@
<file>SettingsScreenTab.qml</file>
<file>fonts/modern-fixedsys-excelsior/FSEX301-L2.ttf</file>
<file>../icons/32x32/cool-retro-term.png</file>
<file>Components/SizedLabel.qml</file>
</qresource>
</RCC>

View File

@ -1,5 +1,11 @@
.pragma library
function clamp(x, min, max) {
if (x <= min)
return min;
if (x >= max)
return max;
return x;
}
function lint(a, b, t) {
return (1 - t) * a + (t) * b;
}

@ -1 +1 @@
Subproject commit 4b3fd2729bac10a8e292bcf027737509d10e9c74
Subproject commit dbf93d175c66ab9d6cdbf42443569d4a1c83c5b2