From 767a61b86e936d642b90ab0835a1906531b0a613 Mon Sep 17 00:00:00 2001 From: Filippo Scognamiglio Date: Sun, 16 Dec 2018 23:46:05 +0100 Subject: [PATCH] Improve settings layout. --- ...ormanceTab.qml => SettingsAdvancedTab.qml} | 55 +++++++++++++------ app/qml/SettingsEffectsTab.qml | 29 ---------- app/qml/SettingsGeneralTab.qml | 46 +++++++--------- app/qml/SettingsWindow.qml | 12 ++-- app/qml/resources.qrc | 2 +- 5 files changed, 66 insertions(+), 78 deletions(-) rename app/qml/{SettingsPerformanceTab.qml => SettingsAdvancedTab.qml} (76%) diff --git a/app/qml/SettingsPerformanceTab.qml b/app/qml/SettingsAdvancedTab.qml similarity index 76% rename from app/qml/SettingsPerformanceTab.qml rename to app/qml/SettingsAdvancedTab.qml index 0044574..06d20f5 100644 --- a/app/qml/SettingsPerformanceTab.qml +++ b/app/qml/SettingsAdvancedTab.qml @@ -27,13 +27,48 @@ import "Components" Tab{ ColumnLayout{ anchors.fill: parent + GroupBox{ - title: qsTr("General") + Layout.fillWidth: true + title: qsTr("Command") + ColumnLayout { + anchors.fill: parent + CheckBox{ + id: useCustomCommand + text: qsTr("Use custom command instead of shell at startup") + checked: appSettings.useCustomCommand + onCheckedChanged: appSettings.useCustomCommand = checked + } + // Workaround for QTBUG-31627 for pre 5.3.0 + Binding{ + target: useCustomCommand + property: "checked" + value: appSettings.useCustomCommand + } + TextField{ + id: customCommand + Layout.fillWidth: true + text: appSettings.customCommand + enabled: useCustomCommand.checked + onEditingFinished: appSettings.customCommand = text + + // Save text even if user forgets to press enter or unfocus + function saveSetting() { + appSettings.customCommand = text; + } + Component.onCompleted: settings_window.closing.connect(saveSetting) + } + } + } + + GroupBox{ + title: qsTr("Performance") Layout.fillWidth: true GridLayout{ anchors.fill: parent rows: 2 columns: 3 + Label{text: qsTr("Effects FPS")} Slider{ Layout.fillWidth: true @@ -52,6 +87,7 @@ Tab{ enabled = true; } } + SizedLabel{text: appSettings.fps !== 0 ? appSettings.fps : qsTr("Max")} Label{text: qsTr("Texture Quality")} Slider{ @@ -67,14 +103,7 @@ Tab{ } } SizedLabel{text: Math.round(txtslider.value * 100) + "%"} - } - } - GroupBox{ - title: qsTr("Bloom") - Layout.fillWidth: true - GridLayout{ - id: bloomQualityContainer - anchors.fill: parent + Label{text: qsTr("Bloom Quality")} Slider{ Layout.fillWidth: true @@ -89,14 +118,6 @@ Tab{ } } SizedLabel{text: Math.round(bloomSlider.value * 100) + "%"} - } - } - GroupBox{ - title: qsTr("BurnIn") - Layout.fillWidth: true - GridLayout{ - id: blurQualityContainer - anchors.fill: parent Label{text: qsTr("BurnIn Quality")} Slider{ diff --git a/app/qml/SettingsEffectsTab.qml b/app/qml/SettingsEffectsTab.qml index 55e67ab..c14ede2 100644 --- a/app/qml/SettingsEffectsTab.qml +++ b/app/qml/SettingsEffectsTab.qml @@ -87,34 +87,5 @@ Tab{ } } } - - GroupBox{ - title: qsTr("Lights") - Layout.fillWidth: true - GridLayout{ - anchors.fill: parent - columns: 2 - Label{ text: qsTr("Brightness") } - SimpleSlider{ - onValueChanged: appSettings.brightness = value - value: appSettings.brightness - } - Label{ text: qsTr("Contrast") } - SimpleSlider{ - onValueChanged: appSettings.contrast = value - value: appSettings.contrast - } - Label{ text: qsTr("Opacity") } - SimpleSlider{ - onValueChanged: appSettings.windowOpacity = value - value: appSettings.windowOpacity - } - Label{ text: qsTr("Margin") } - SimpleSlider{ - onValueChanged: appSettings._margin = value - value: appSettings._margin - } - } - } } } diff --git a/app/qml/SettingsGeneralTab.qml b/app/qml/SettingsGeneralTab.qml index ec4cf55..9efaedb 100644 --- a/app/qml/SettingsGeneralTab.qml +++ b/app/qml/SettingsGeneralTab.qml @@ -52,7 +52,7 @@ Tab{ Layout.fillWidth: false Button{ Layout.fillWidth: true - text: qsTr("New") + text: qsTr("Save") onClicked: { insertname.profileName = ""; insertname.show() @@ -164,34 +164,30 @@ Tab{ } GroupBox{ + title: qsTr("Screen") Layout.fillWidth: true - title: qsTr("Command") - ColumnLayout { + GridLayout{ anchors.fill: parent - CheckBox{ - id: useCustomCommand - text: qsTr("Use custom command instead of shell at startup") - checked: appSettings.useCustomCommand - onCheckedChanged: appSettings.useCustomCommand = checked + columns: 2 + Label{ text: qsTr("Brightness") } + SimpleSlider{ + onValueChanged: appSettings.brightness = value + value: appSettings.brightness } - // Workaround for QTBUG-31627 for pre 5.3.0 - Binding{ - target: useCustomCommand - property: "checked" - value: appSettings.useCustomCommand + Label{ text: qsTr("Contrast") } + SimpleSlider{ + onValueChanged: appSettings.contrast = value + value: appSettings.contrast } - TextField{ - id: customCommand - Layout.fillWidth: true - text: appSettings.customCommand - enabled: useCustomCommand.checked - onEditingFinished: appSettings.customCommand = text - - // Save text even if user forgets to press enter or unfocus - function saveSetting() { - appSettings.customCommand = text; - } - Component.onCompleted: settings_window.closing.connect(saveSetting) + Label{ text: qsTr("Margin") } + SimpleSlider{ + onValueChanged: appSettings._margin = value + value: appSettings._margin + } + Label{ text: qsTr("Opacity") } + SimpleSlider{ + onValueChanged: appSettings.windowOpacity = value + value: appSettings.windowOpacity } } } diff --git a/app/qml/SettingsWindow.qml b/app/qml/SettingsWindow.qml index 7995ec3..78a0031 100644 --- a/app/qml/SettingsWindow.qml +++ b/app/qml/SettingsWindow.qml @@ -28,7 +28,7 @@ Window { id: settings_window title: qsTr("Settings") width: 580 - height: 500 + height: 400 property int tabmargins: 15 @@ -36,27 +36,27 @@ Window { id: tabView anchors.fill: parent anchors.margins: 10 - SettingsGeneralTab{ + SettingsGeneralTab { id: generalTab title: qsTr("General") anchors.fill: parent anchors.margins: tabmargins } - SettingsTerminalTab{ + SettingsTerminalTab { id: terminalTab title: qsTr("Terminal") anchors.fill: parent anchors.margins: tabmargins } - SettingsEffectsTab{ + SettingsEffectsTab { id: effectsTab title: qsTr("Effects") anchors.fill: parent anchors.margins: tabmargins } - SettingsPerformanceTab{ + SettingsAdvancedTab { id: performanceTab - title: qsTr("Performance") + title: qsTr("Advanced") anchors.fill: parent anchors.margins: tabmargins } diff --git a/app/qml/resources.qrc b/app/qml/resources.qrc index 6132447..65ca840 100644 --- a/app/qml/resources.qrc +++ b/app/qml/resources.qrc @@ -23,7 +23,7 @@ fonts/1971-ibm-3278/3270Medium.ttf Storage.qml CRTMainMenuBar.qml - SettingsPerformanceTab.qml + SettingsAdvancedTab.qml TerminalContainer.qml images/crt256.png utils.js