8 Commits

Author SHA1 Message Date
Filippo Scognamiglio
a24cbbcc93 Burnin is now subtractive. Better looking and more predictable. 2015-01-06 01:35:35 +01:00
Filippo Scognamiglio
17b70b47ce Fix OSX keys issues. 2015-01-05 22:35:07 +01:00
Filippo Scognamiglio
295912fbb3 Reduce minimum quality and allower finer tuning of performance settings. 2015-01-05 22:08:06 +01:00
Filippo Scognamiglio
859adf966a Use IBeamCursor instead of normal arrow. 2015-01-05 22:01:14 +01:00
Filippo Scognamiglio
cf404f980d Use already available shaderEffectSource and improve bloom look at low quality by limiting minimum radius. 2015-01-05 21:47:42 +01:00
Filippo Scognamiglio
6979abe96a Merge pull request #198 from Swordfish90/fix-color-dialog-2
Fix bad behaving color dialog on some platforms.
2015-01-02 22:16:33 +01:00
Filippo Scognamiglio
c685cbd640 Merge pull request #197 from Swordfish90/add-pixelated-fonts
Add pixelated fonts and use them as default
2015-01-02 22:15:11 +01:00
Filippo Scognamiglio
d10bf29493 Fix bad behaving color dialog on some platforms. 2014-12-30 10:25:33 +01:00
10 changed files with 56 additions and 26 deletions

View File

@@ -24,7 +24,16 @@ QString getNamedArgument(QStringList args, QString name)
int main(int argc, char *argv[])
{
// Some environmental variable are necessary on certain platforms.
// This disables QT appmenu under Ubuntu, which is not working with QML apps.
setenv("QT_QPA_PLATFORMTHEME", "", 1);
#if defined(Q_OS_MAC)
// This allows UTF-8 characters usage in OSX.
setenv("LC_CTYPE", "UTF-8", 1);
#endif
QApplication app(argc, argv);
QQmlApplicationEngine engine;
FileIO fileIO;
@@ -60,6 +69,7 @@ int main(int argc, char *argv[])
QStringList importPathList = engine.importPathList();
importPathList.prepend(QCoreApplication::applicationDirPath() + "/qmltermwidget");
importPathList.prepend(QCoreApplication::applicationDirPath() + "/../PlugIns");
importPathList.prepend(QCoreApplication::applicationDirPath() + "/../../../qmltermwidget");
engine.setImportPathList(importPathList);
engine.load(QUrl("qrc:/main.qml"));

View File

@@ -22,8 +22,10 @@ import QtQuick 2.2
import QtQuick.Dialogs 1.1
Item {
id: rootItem
signal colorSelected (color color)
property color button_color
property color color
property string name
ColorDialog {
@@ -33,13 +35,13 @@ Item {
visible: false
//This is a workaround to a Qt 5.2 bug.
onCurrentColorChanged: colorDialog.color = colorDialog.currentColor;
onAccepted: colorSelected(color)
onColorChanged: if (Qt.platform.os !== "osx") colorSelected(color)
onAccepted: if (Qt.platform.os === "osx") colorSelected(color)
}
Rectangle{
anchors.fill: parent
radius: 10
color: button_color
color: rootItem.color
border.color: "black"
Glossy {}
Rectangle {
@@ -52,7 +54,7 @@ Item {
Text{
anchors.centerIn: parent
z: parent.z + 1
text: name + ": " + button_color
text: name + ": " + rootItem.color
}
}
MouseArea{

View File

@@ -23,6 +23,8 @@ import QtQuick.Controls 1.1
import QMLTermWidget 1.0
import "utils.js" as Utils
Item{
id: terminalContainer
@@ -43,10 +45,10 @@ Item{
anchors.bottomMargin: frame.displacementBottom * appSettings.windowScaling
//The blur effect has to take into account the framerate
property real mBlur: appSettings.burnIn
property real motionBlurCoefficient: (_maxBlurCoefficient * Math.sqrt(mBlur) + _minBlurCoefficient * (1 - Math.sqrt(mBlur)))
property real _minBlurCoefficient: 0.50
property real _maxBlurCoefficient: 0.90
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
property size terminalSize: kterminal.terminalSize
property size fontMetrics: kterminal.fontMetrics
@@ -174,6 +176,7 @@ Item{
MouseArea{
acceptedButtons: Qt.LeftButton | Qt.MiddleButton | Qt.RightButton
anchors.fill: parent
cursorShape: Qt.IBeamCursor
onWheel:{
if(wheel.modifiers & Qt.ControlModifier){
wheel.angleDelta.y > 0 ? zoomIn.trigger() : zoomOut.trigger();
@@ -243,6 +246,12 @@ Item{
Timer{
id: livetimer
// The interval assumes 60 fps. This is the time needed burnout a white pixel.
// 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
running: true
onTriggered: _blurredSourceEffect.live = false;
}
@@ -286,7 +295,7 @@ Item{
sourceComponent: ShaderEffect {
property variant txt_source: kterminalSource
property variant blurredSource: blurredSourceLoader.item
property real blurCoefficient: (1.0 - motionBlurCoefficient)
property real blurCoefficient: motionBlurCoefficient
blending: false
@@ -306,10 +315,10 @@ Item{
"void main() {" +
"vec2 coords = qt_TexCoord0;" +
"vec3 origColor = texture2D(txt_source, coords).rgb;" +
"vec3 blur_color = texture2D(blurredSource, coords).rgb * (1.0 - blurCoefficient);" +
"vec3 blur_color = texture2D(blurredSource, coords).rgb - vec3(blurCoefficient);" +
"vec3 color = min(origColor + blur_color, max(origColor, blur_color));" +
"gl_FragColor = vec4(color, step(0.02, rgb2grey(color - origColor)));" +
"gl_FragColor = vec4(color, rgb2grey(color - origColor));" +
"}"
onStatusChanged: if (log) console.log(log) //Print warning messages

View File

@@ -55,10 +55,10 @@ Tab{
Layout.fillWidth: true
id: txtslider
onValueChanged: if (enabled) appSettings.windowScaling = value;
stepSize: 0.10
stepSize: 0.05
enabled: false
Component.onCompleted: {
minimumValue = 0.3 //Without this value gets set to 0.5
minimumValue = 0.25 //Without this value gets set to 0.5
value = appSettings.windowScaling;
enabled = true;
}
@@ -80,10 +80,10 @@ Tab{
Layout.fillWidth: true
id: bloomSlider
onValueChanged: if (enabled) appSettings.bloomQuality = value;
stepSize: 0.10
stepSize: 0.05
enabled: false
Component.onCompleted: {
minimumValue = 0.3
minimumValue = 0.25
value = appSettings.bloomQuality;
enabled = true;
}
@@ -105,10 +105,10 @@ Tab{
Layout.fillWidth: true
id: burnInSlider
onValueChanged: if (enabled) appSettings.burnInQuality = value;
stepSize: 0.10
stepSize: 0.05
enabled: false
Component.onCompleted: {
minimumValue = 0.3
minimumValue = 0.25
value = appSettings.burnInQuality;
enabled = true;
}

View File

@@ -125,14 +125,14 @@ Tab{
height: 50
Layout.fillWidth: true
onColorSelected: appSettings._fontColor = color;
button_color: appSettings._fontColor
color: appSettings._fontColor
}
ColorButton{
name: qsTr("Background")
height: 50
Layout.fillWidth: true
onColorSelected: appSettings._backgroundColor = color;
button_color: appSettings._backgroundColor
color: appSettings._backgroundColor
}
}
}

View File

@@ -26,6 +26,8 @@ ShaderEffect {
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
@@ -160,7 +162,8 @@ ShaderEffect {
uniform highp sampler2D bloomSource;
uniform lowp float bloom;" : "") +
(burnIn !== 0 ? "
uniform sampler2D blurredSource;" : "") +
uniform sampler2D blurredSource;
uniform lowp float liveBlur;" : "") +
(staticNoise !== 0 ? "
uniform highp float staticNoise;" : "") +
(((staticNoise !== 0 || jitter !== 0 || rbgShift)
@@ -266,7 +269,7 @@ ShaderEffect {
"vec3 txt_color = texture2D(source, txt_coords).rgb;" +
(burnIn !== 0 ? "
vec4 txt_blur = texture2D(blurredSource, txt_coords);
vec4 txt_blur = liveBlur * texture2D(blurredSource, txt_coords);
txt_color = txt_color + txt_blur.rgb * txt_blur.a;"
: "") +

View File

@@ -1,6 +1,8 @@
import QtQuick 2.2
import QtGraphicalEffects 1.0
import "utils.js" as Utils
ShaderTerminal{
property alias title: terminal.title
property alias terminalSize: terminal.terminalSize
@@ -45,9 +47,10 @@ ShaderTerminal{
asynchronous: true
width: parent.width * appSettings.bloomQuality
height: parent.height * appSettings.bloomQuality
sourceComponent: FastBlur{
radius: 48 * appSettings.bloomQuality * appSettings.windowScaling
source: terminal.mainTerminal
radius: Utils.lint(16, 48, appSettings.bloomQuality * appSettings.windowScaling);
source: terminal.mainSource
transparentBorder: true
}
}

View File

@@ -83,7 +83,7 @@ Item{
sourceComponent: FastBlur{
id: frameReflectionEffect
radius: 128
source: terminal.kterminal
source: terminal.mainSource
smooth: false
}
}

View File

@@ -1,5 +1,8 @@
.pragma library
function lint(a, b, t) {
return (1 - t) * a + (t) * b;
}
function mix(c1, c2, alpha){
return Qt.rgba(c1.r * alpha + c2.r * (1-alpha),
c1.g * alpha + c2.g * (1-alpha),