mirror of
				https://github.com/Swordfish90/cool-retro-term.git
				synced 2025-10-30 22:54:21 +00:00 
			
		
		
		
	Added dialog to setup colors of the terminal.
This commit is contained in:
		| @@ -21,4 +21,5 @@ OTHER_FILES += \ | |||||||
|     $$PWD/qml/cool-old-term/HighlightArea.qml \ |     $$PWD/qml/cool-old-term/HighlightArea.qml \ | ||||||
|     $$PWD/qml/cool-old-term/ShaderSettings.qml \ |     $$PWD/qml/cool-old-term/ShaderSettings.qml \ | ||||||
|     $$PWD/qml/images/frame.png \ |     $$PWD/qml/images/frame.png \ | ||||||
|     qml/cool-old-term/SettingsWindow.qml |     qml/cool-old-term/SettingsWindow.qml \ | ||||||
|  |     qml/cool-old-term/MyColorDialog.qml | ||||||
|   | |||||||
							
								
								
									
										25
									
								
								qml/cool-old-term/MyColorDialog.qml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								qml/cool-old-term/MyColorDialog.qml
									
									
									
									
									
										Normal 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 | ||||||
|  | } | ||||||
| @@ -2,8 +2,10 @@ import QtQuick 2.1 | |||||||
| import QtQuick.Controls 1.0 | import QtQuick.Controls 1.0 | ||||||
| import QtQuick.Window 2.1 | import QtQuick.Window 2.1 | ||||||
| import QtQuick.Layouts 1.0 | import QtQuick.Layouts 1.0 | ||||||
|  | import QtQuick.Dialogs 1.1 | ||||||
|  |  | ||||||
| ApplicationWindow { | ApplicationWindow { | ||||||
|  |     id: settings_window | ||||||
|     title: qsTr("Settings") |     title: qsTr("Settings") | ||||||
|     width: 640 |     width: 640 | ||||||
|     height: 480 |     height: 480 | ||||||
| @@ -17,18 +19,42 @@ ApplicationWindow { | |||||||
|         Tab{ |         Tab{ | ||||||
|             title: qsTr("Settings") |             title: qsTr("Settings") | ||||||
|             anchors.fill: parent |             anchors.fill: parent | ||||||
|  |             anchors.margins: 20 | ||||||
|  |  | ||||||
|             ColumnLayout{ |             ColumnLayout{ | ||||||
|                 anchors.fill: parent |                 anchors.fill: parent | ||||||
|                 GridLayout{ |                 GridLayout{ | ||||||
|                     width: parent.width |                     width: parent.width | ||||||
|                     columns: 2 |                     columns: 2 | ||||||
|                     Text{text: "Font color"} |                     Text{text: "Font color"} | ||||||
|                     Text{text: "         "; |                     Text{ | ||||||
|                         Rectangle{anchors.fill: parent; color: shadersettings.font_color} |                         text: "         "; | ||||||
|                         MouseArea{anchors.fill: parent} |                         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: "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{ |                 GridLayout{ | ||||||
|   | |||||||
| @@ -4,11 +4,11 @@ Item{ | |||||||
|     property real ambient_light: 0.2 |     property real ambient_light: 0.2 | ||||||
|  |  | ||||||
|     property color background_color: "#000000" |     property color background_color: "#000000" | ||||||
|     property color font_color: "#ffff77" |     property color font_color: "#77ff77" | ||||||
|  |  | ||||||
|     property real brightness_flickering: 0.4 |     property real brightness_flickering: 0.4 | ||||||
|     property real noise_strength: 0.1 |     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 glowing_line_strength: 0.4 | ||||||
|     //property real faulty_screen_prob: 1.0 |     //property real faulty_screen_prob: 1.0 | ||||||
| } | } | ||||||
|   | |||||||
| @@ -48,7 +48,6 @@ ApplicationWindow{ | |||||||
|                 onTriggered: { |                 onTriggered: { | ||||||
|                     var component = Qt.createComponent("SettingsWindow.qml"); |                     var component = Qt.createComponent("SettingsWindow.qml"); | ||||||
|                     component.createObject(mainwindow); |                     component.createObject(mainwindow); | ||||||
|                     component.show(); |  | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user