mirror of
				https://github.com/Swordfish90/cool-retro-term.git
				synced 2025-10-31 07:04:20 +00:00 
			
		
		
		
	Refactored settings window...
This commit is contained in:
		| @@ -22,4 +22,5 @@ OTHER_FILES += \ | |||||||
|     $$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 |     qml/cool-old-term/MyColorDialog.qml \ | ||||||
|  |     qml/cool-old-term/SettingComponent.qml | ||||||
|   | |||||||
							
								
								
									
										50
									
								
								qml/cool-old-term/SettingComponent.qml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										50
									
								
								qml/cool-old-term/SettingComponent.qml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,50 @@ | |||||||
|  | import QtQuick 2.0 | ||||||
|  | import QtQuick.Controls 1.1 | ||||||
|  | import QtQuick.Layouts 1.1 | ||||||
|  |  | ||||||
|  | RowLayout { | ||||||
|  |     property string name | ||||||
|  |     property double value | ||||||
|  |     property double prev_value: 0.0 | ||||||
|  |     property double min_value: 0.0 | ||||||
|  |     property double max_value: 1.0 | ||||||
|  |  | ||||||
|  |     id: setting_component | ||||||
|  |     anchors.left: parent.left | ||||||
|  |     anchors.right: parent.right | ||||||
|  |     spacing: 10 | ||||||
|  |  | ||||||
|  |     CheckBox{ | ||||||
|  |         id: check | ||||||
|  |         implicitWidth: 150 | ||||||
|  |  | ||||||
|  |         text: name | ||||||
|  |         onCheckedChanged:{ | ||||||
|  |             if(checked) value = prev_value; | ||||||
|  |             else { | ||||||
|  |                 prev_value = value; | ||||||
|  |                 value = 0; | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         Component.onCompleted: checked = (value !== 0); | ||||||
|  |     } | ||||||
|  |     Slider{ | ||||||
|  |         id: slider | ||||||
|  |         stepSize: 0.01 | ||||||
|  |         minimumValue: min_value | ||||||
|  |         maximumValue: max_value | ||||||
|  |         onValueChanged: setting_component.value = value; | ||||||
|  |         Layout.fillWidth: true | ||||||
|  |  | ||||||
|  |         Component.onCompleted: slider.value = setting_component.value | ||||||
|  |     } | ||||||
|  |     TextField{ | ||||||
|  |         id: textfield | ||||||
|  |  | ||||||
|  |         text: value.toFixed(2) | ||||||
|  |         implicitWidth: 50 | ||||||
|  |         enabled: false | ||||||
|  |  | ||||||
|  |         Component.onCompleted: text = value.toFixed(2) | ||||||
|  |     } | ||||||
|  | } | ||||||
| @@ -57,103 +57,26 @@ ApplicationWindow { | |||||||
|                     } |                     } | ||||||
|                 } |                 } | ||||||
|  |  | ||||||
|                 GridLayout{ |                 ColumnLayout{ | ||||||
|                     columns: 4 |                     anchors.left: parent.left | ||||||
|                     CheckBox{ |                     anchors.right: parent.right | ||||||
|                         id: noisecheck |  | ||||||
|                         onCheckedChanged: |  | ||||||
|                             if(checked) shadersettings.noise_strength = noiseslider.value; |  | ||||||
|                             else shadersettings.noise_strength = 0; |  | ||||||
|                         Component.onCompleted: checked = shadersettings.noise_strength !== 0; |  | ||||||
|                     } |  | ||||||
|                     Text{ |  | ||||||
|                         text: qsTr("Noise") |  | ||||||
|                     } |  | ||||||
|                     Slider{ |  | ||||||
|                         id: noiseslider |  | ||||||
|                         stepSize: 0.01 |  | ||||||
|                         minimumValue: 0.0 |  | ||||||
|                         maximumValue: 1.0 |  | ||||||
|                         onValueChanged: shadersettings.noise_strength = value; |  | ||||||
|                         Component.onCompleted: value = shadersettings.noise_strength; |  | ||||||
|                     } |  | ||||||
|                     TextArea{ |  | ||||||
|                         text: noiseslider.value.toFixed(2); |  | ||||||
|                         enabled: false |  | ||||||
|                     } |  | ||||||
|  |  | ||||||
|  |                     SettingComponent{ | ||||||
|                     CheckBox{ |                         name: "Noise" | ||||||
|                         id: glowcheck |                         onValueChanged: shadersettings.noise_strength = value | ||||||
|                         onCheckedChanged: |                         Component.onCompleted: value = shadersettings.noise_strength | ||||||
|                             if(checked) shadersettings.glowing_line_strength = glowslider.value; |  | ||||||
|                             else shadersettings.glowing_line_strength = 0; |  | ||||||
|                         Component.onCompleted: checked = shadersettings.glowing_line_strength !== 0; |  | ||||||
|                     } |                     } | ||||||
|                     Text{ |                     SettingComponent{ | ||||||
|                         text: qsTr("Glow") |                         name: "Glow" | ||||||
|                     } |  | ||||||
|                     Slider{ |  | ||||||
|                         id: glowslider |  | ||||||
|                         stepSize: 0.01 |  | ||||||
|                         minimumValue: 0.0 |  | ||||||
|                         maximumValue: 1.0 |  | ||||||
|                         onValueChanged: shadersettings.glowing_line_strength = value; |                         onValueChanged: shadersettings.glowing_line_strength = value; | ||||||
|                         Component.onCompleted: value = shadersettings.glowing_line_strength; |                         Component.onCompleted: value = shadersettings.glowing_line_strength | ||||||
|                     } |                     } | ||||||
|                     TextArea{ |                     SettingComponent{ | ||||||
|                         text: glowslider.value.toFixed(2); |                         name: "Ambient light" | ||||||
|                         enabled: false |  | ||||||
|                     } |  | ||||||
|  |  | ||||||
|  |  | ||||||
|                     CheckBox{ |  | ||||||
|                         id: ambientcheck |  | ||||||
|                         onCheckedChanged: |  | ||||||
|                             if(checked) shadersettings.ambient_light = ambientslider.value; |  | ||||||
|                             else shadersettings.ambient_light = 0; |  | ||||||
|                         Component.onCompleted: checked = shadersettings.ambient_light !== 0; |  | ||||||
|                     } |  | ||||||
|                     Text{ |  | ||||||
|                         text: qsTr("Ambient light") |  | ||||||
|                     } |  | ||||||
|                     Slider{ |  | ||||||
|                         id: ambientslider |  | ||||||
|                         stepSize: 0.01 |  | ||||||
|                         minimumValue: 0.1 |  | ||||||
|                         maximumValue: 0.5 |  | ||||||
|                         onValueChanged: shadersettings.ambient_light = value; |                         onValueChanged: shadersettings.ambient_light = value; | ||||||
|                         Component.onCompleted: value = shadersettings.ambient_light; |                         Component.onCompleted: value = shadersettings.ambient_light | ||||||
|                     } |                     } | ||||||
|                     TextArea{ |                 } | ||||||
|                         text: ambientslider.value.toFixed(2); |  | ||||||
|                         enabled: false |  | ||||||
|                     } |  | ||||||
|  |  | ||||||
|                     //                CheckBox{ |  | ||||||
|                     //                    id: distortioncheck |  | ||||||
|                     //                    onCheckedChanged: |  | ||||||
|                     //                        if(checked) shadersettings.screen_distortion = distortionslider.value; |  | ||||||
|                     //                        else shadersettings.screen_distortion = 0; |  | ||||||
|                     //                    Component.onCompleted: checked = shadersettings.screen_distortion !== 0; |  | ||||||
|                     //                } |  | ||||||
|                     //                Text{ |  | ||||||
|                     //                    text: qsTr("Distortion") |  | ||||||
|                     //                } |  | ||||||
|                     //                Slider{ |  | ||||||
|                     //                    id: distortionslider |  | ||||||
|                     //                    stepSize: 0.01 |  | ||||||
|                     //                    minimumValue: 0.0 |  | ||||||
|                     //                    maximumValue: 1.0 |  | ||||||
|                     //                    onValueChanged: shadersettings.screen_distortion = value; |  | ||||||
|                     //                    Component.onCompleted: value = shadersettings.screen_distortion; |  | ||||||
|                     //                } |  | ||||||
|                     //                TextArea{ |  | ||||||
|                     //                    text: distortionslider.value.toFixed(2); |  | ||||||
|                     //                    enabled: false |  | ||||||
|                     //                } |  | ||||||
|                 } |  | ||||||
|  |  | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user