Added dialog to setup colors of the terminal.

This commit is contained in:
Filippo Scognamiglio 2013-12-22 18:32:01 +01:00
parent 13a3580c75
commit 013f0be81f
5 changed files with 59 additions and 8 deletions

View File

@ -21,4 +21,5 @@ OTHER_FILES += \
$$PWD/qml/cool-old-term/HighlightArea.qml \
$$PWD/qml/cool-old-term/ShaderSettings.qml \
$$PWD/qml/images/frame.png \
qml/cool-old-term/SettingsWindow.qml
qml/cool-old-term/SettingsWindow.qml \
qml/cool-old-term/MyColorDialog.qml

View File

@ -0,0 +1,25 @@
import QtQuick 2.1
import QtQuick.Dialogs 1.1
ColorDialog {
id: colorDialog
title: qsTr("Choose a color")
modality: Qt.ApplicationModal
property string color_to_change
color: "green"
//This is a workaround to a Qt 5.2 bug.
onCurrentColorChanged: colorDialog.color = colorDialog.currentColor;
onAccepted: {
console.log("[MyColorDialog.qml] Color chosen: " + colorDialog.color);
shadersettings[color_to_change] = colorDialog.color;
}
onRejected: {
console.log("[MyColorDialog.qml] No color selected")
}
Component.onCompleted: visible = true
}

View File

@ -2,8 +2,10 @@ import QtQuick 2.1
import QtQuick.Controls 1.0
import QtQuick.Window 2.1
import QtQuick.Layouts 1.0
import QtQuick.Dialogs 1.1
ApplicationWindow {
id: settings_window
title: qsTr("Settings")
width: 640
height: 480
@ -17,18 +19,42 @@ ApplicationWindow {
Tab{
title: qsTr("Settings")
anchors.fill: parent
anchors.margins: 20
ColumnLayout{
anchors.fill: parent
GridLayout{
width: parent.width
columns: 2
Text{text: "Font color"}
Text{text: " ";
Rectangle{anchors.fill: parent; color: shadersettings.font_color}
MouseArea{anchors.fill: parent}
Text{
text: " ";
Rectangle{
anchors.fill: parent;
color: shadersettings.font_color
}
MouseArea{
anchors.fill: parent;
onClicked: {
var component = Qt.createComponent("MyColorDialog.qml");
component.createObject(settings_window, {"color_to_change": "font_color"});
}
}
}
Text{text: "Backgroud color"}
Text{text: " "; Rectangle{anchors.fill: parent; color: shadersettings.background_color}}
Text{text: " ";
Rectangle{
anchors.fill: parent;
color: shadersettings.background_color
}
MouseArea{
anchors.fill: parent
onClicked: {
var component = Qt.createComponent("MyColorDialog.qml");
component.createObject(settings_window, {"color_to_change": "background_color"});
}
}
}
}
GridLayout{

View File

@ -4,11 +4,11 @@ Item{
property real ambient_light: 0.2
property color background_color: "#000000"
property color font_color: "#ffff77"
property color font_color: "#77ff77"
property real brightness_flickering: 0.4
property real noise_strength: 0.1
property real screen_distortion: 0.20
property real screen_distortion: 0.2
property real glowing_line_strength: 0.4
//property real faulty_screen_prob: 1.0
}

View File

@ -48,7 +48,6 @@ ApplicationWindow{
onTriggered: {
var component = Qt.createComponent("SettingsWindow.qml");
component.createObject(mainwindow);
component.show();
}
}
}