From 1dd633be0bf3c66cfd4960eac557cb54a67f9f5f Mon Sep 17 00:00:00 2001 From: Filippo Scognamiglio Date: Mon, 29 Sep 2014 02:00:54 +0200 Subject: [PATCH] Reorganize settings window. --- app/qml/SettingsGeneralTab.qml | 46 +++-------------- app/qml/SettingsPerformanceTab.qml | 82 ++++++++++++++++++++++++++++++ app/qml/SettingsTerminalTab.qml | 14 ----- app/qml/SettingsWindow.qml | 12 ++++- app/qml/resources.qrc | 1 + 5 files changed, 101 insertions(+), 54 deletions(-) create mode 100644 app/qml/SettingsPerformanceTab.qml diff --git a/app/qml/SettingsGeneralTab.qml b/app/qml/SettingsGeneralTab.qml index c4ea35a..8c6cb47 100644 --- a/app/qml/SettingsGeneralTab.qml +++ b/app/qml/SettingsGeneralTab.qml @@ -92,49 +92,17 @@ Tab{ } } GroupBox{ - title: qsTr("Performace") + title: qsTr("Frame") Layout.fillWidth: true - Layout.columnSpan: 2 - anchors.left: parent.left - anchors.right: parent.right - GridLayout{ + RowLayout{ anchors.fill: parent - rows: 3 - columns: 3 - CheckBox{ - Layout.columnSpan: 3 - checked: !shadersettings._frameReflections - text: qsTr("Disable reflections") - onCheckedChanged: shadersettings._frameReflections = !checked - enabled: shadersettings.reflectionsAllowed - } - CheckBox{ - property int fps: checked ? slider.value : 0 - onFpsChanged: shadersettings.fps = fps - checked: shadersettings.fps !== 0 - text: qsTr("Limit FPS") - } - Slider{ - id: slider + ComboBox{ + id: framescombobox Layout.fillWidth: true - stepSize: 1 - maximumValue: 60 - minimumValue: 1 - enabled: shadersettings.fps !== 0 - value: shadersettings.fps !== 0 ? shadersettings.fps : 60 + model: shadersettings.frames_list + currentIndex: shadersettings.frames_index + onCurrentIndexChanged: shadersettings.frames_index = currentIndex } - Text{text: slider.value} - Text{text: qsTr("Texture quality")} - Slider{ - Layout.fillWidth: true - id: txtslider - onValueChanged: shadersettings.window_scaling = value; - value: shadersettings.window_scaling - tickmarksEnabled: true - stepSize: 0.25 - Component.onCompleted: minimumValue = 0.5 //Without this value gets set to 0.5 - } - Text{text: Math.round(txtslider.value * 100) + "%"} } } } diff --git a/app/qml/SettingsPerformanceTab.qml b/app/qml/SettingsPerformanceTab.qml new file mode 100644 index 0000000..66c555e --- /dev/null +++ b/app/qml/SettingsPerformanceTab.qml @@ -0,0 +1,82 @@ +/******************************************************************************* +* Copyright (c) 2013 "Filippo Scognamiglio" +* https://github.com/Swordfish90/cool-retro-term +* +* This file is part of cool-retro-term. +* +* cool-retro-term is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +*******************************************************************************/ + +import QtQuick 2.2 +import QtQuick.Controls 1.1 +import QtQuick.Layouts 1.1 + +Tab{ + ColumnLayout{ + anchors.fill: parent + GroupBox{ + title: qsTr("General") + Layout.fillWidth: true + Layout.columnSpan: 2 + anchors.left: parent.left + anchors.right: parent.right + GridLayout{ + anchors.fill: parent + rows: 2 + columns: 3 + CheckBox{ + property int fps: checked ? slider.value : 0 + onFpsChanged: shadersettings.fps = fps + checked: shadersettings.fps !== 0 + text: qsTr("Limit FPS") + } + Slider{ + id: slider + Layout.fillWidth: true + stepSize: 1 + maximumValue: 60 + minimumValue: 1 + enabled: shadersettings.fps !== 0 + value: shadersettings.fps !== 0 ? shadersettings.fps : 60 + } + Text{text: slider.value} + Text{text: qsTr("Texture quality")} + Slider{ + Layout.fillWidth: true + id: txtslider + onValueChanged: shadersettings.window_scaling = value; + value: shadersettings.window_scaling + tickmarksEnabled: true + stepSize: 0.25 + Component.onCompleted: minimumValue = 0.5 //Without this value gets set to 0.5 + } + Text{text: Math.round(txtslider.value * 100) + "%"} + } + } + GroupBox{ + title: qsTr("Frame") + Layout.fillWidth: true + Layout.columnSpan: 2 + anchors.left: parent.left + anchors.right: parent.right + CheckBox{ + Layout.columnSpan: 3 + checked: !shadersettings._frameReflections + text: qsTr("Disable reflections") + onCheckedChanged: shadersettings._frameReflections = !checked + enabled: shadersettings.reflectionsAllowed + } + } + } +} diff --git a/app/qml/SettingsTerminalTab.qml b/app/qml/SettingsTerminalTab.qml index 2b2dcc8..7cdc9d1 100644 --- a/app/qml/SettingsTerminalTab.qml +++ b/app/qml/SettingsTerminalTab.qml @@ -142,19 +142,5 @@ Tab{ } } } - GroupBox{ - title: qsTr("Frame") - Layout.fillWidth: true - RowLayout{ - anchors.fill: parent - ComboBox{ - id: framescombobox - Layout.fillWidth: true - model: shadersettings.frames_list - currentIndex: shadersettings.frames_index - onCurrentIndexChanged: shadersettings.frames_index = currentIndex - } - } - } } } diff --git a/app/qml/SettingsWindow.qml b/app/qml/SettingsWindow.qml index a121bcc..7726402 100644 --- a/app/qml/SettingsWindow.qml +++ b/app/qml/SettingsWindow.qml @@ -28,27 +28,37 @@ Window { id: settings_window title: qsTr("Settings") width: 640 - height: 480 + height: 440 property int tabmargins: 15 TabView{ + id: tabView anchors.fill: parent anchors.margins: 10 SettingsGeneralTab{ + id: generalTab title: qsTr("General") anchors.fill: parent anchors.margins: tabmargins } SettingsTerminalTab{ + id: terminalTab title: qsTr("Terminal") anchors.fill: parent anchors.margins: tabmargins } SettingsEffectsTab{ + id: effectsTab title: qsTr("Effects") anchors.fill: parent anchors.margins: tabmargins } + SettingsPerformanceTab{ + id: performanceTab + title: qsTr("Performance") + anchors.fill: parent + anchors.margins: tabmargins + } } } diff --git a/app/qml/resources.qrc b/app/qml/resources.qrc index a9df1ff..dfc44ca 100644 --- a/app/qml/resources.qrc +++ b/app/qml/resources.qrc @@ -64,5 +64,6 @@ fonts/1985-ibm-pc-vga/dos437.txt Storage.qml CRTMainMenuBar.qml + SettingsPerformanceTab.qml