1
0
mirror of https://github.com/Swordfish90/cool-retro-term.git synced 2025-01-18 12:15:27 +00:00

Redisigned color settings...

This commit is contained in:
Filippo Scognamiglio 2013-12-23 00:13:47 +01:00
parent 73a5c791ec
commit a23651acf3
4 changed files with 65 additions and 56 deletions

View File

@ -22,5 +22,5 @@ OTHER_FILES += \
$$PWD/qml/cool-old-term/ShaderSettings.qml \
$$PWD/qml/images/frame.png \
qml/cool-old-term/SettingsWindow.qml \
qml/cool-old-term/MyColorDialog.qml \
qml/cool-old-term/SettingComponent.qml
qml/cool-old-term/SettingComponent.qml \
qml/cool-old-term/ColorButton.qml

View File

@ -0,0 +1,43 @@
import QtQuick 2.1
import QtQuick.Dialogs 1.1
Item {
property color button_color;
ColorDialog {
id: colorDialog
title: qsTr("Choose a color")
modality: Qt.ApplicationModal
visible: false
//This is a workaround to a Qt 5.2 bug.
onCurrentColorChanged: colorDialog.color = colorDialog.currentColor;
onAccepted: button_color = color;
}
Rectangle{
radius: 10
anchors.fill: parent
color: button_color
Text{
id: text_color
anchors.centerIn: parent
z: 1.1
text: button_color
}
Rectangle{
anchors.centerIn: parent
width: text_color.width * 1.4
height: text_color.height * 1.4
radius: 10
border.color: "black"
border.width: 2
color: "white"
}
}
MouseArea{
anchors.fill: parent
onClicked: colorDialog.visible = true;
}
}

View File

@ -1,25 +0,0 @@
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

@ -23,40 +23,31 @@ ApplicationWindow {
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;
onClicked: {
var component = Qt.createComponent("MyColorDialog.qml");
component.createObject(settings_window, {"color_to_change": "font_color"});
}
RowLayout{
ColumnLayout{
Text{text: qsTr("Font color")}
ColorButton{
height: 200
width: 200
onButton_colorChanged: shadersettings.font_color = button_color
Component.onCompleted: button_color = shadersettings.font_color;
}
}
Text{text: "Backgroud 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"});
}
Item{
Layout.fillWidth: true
}
ColumnLayout{
Text{text: qsTr("Backgroud color")}
ColorButton{
height: 200
width: 200
onButton_colorChanged: shadersettings.background_color= button_color
Component.onCompleted: button_color = shadersettings.background_color;
}
}
}
ColumnLayout{
anchors.left: parent.left
anchors.right: parent.right