From 4cb435f2a7bbeafb53f067d95ec83e0b3a1a17f8 Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Wed, 19 Aug 2015 11:13:35 +0200 Subject: Extract all settings into `SettingsHandler` object This enables the user to straight forwardly change all application settings via command mode. During the implementation of this change I discovered that the way I was passing around `StateHandler` and `SettingsHandler` instances using properties was unnecessary. If all object instances are created in a common hierarchy they can access each other by their `id` property - i.e. `settings` and `mode` are available to the whole application without property trickery. --- src/command/CommandInput.qml | 31 ++++++++++--------------------- 1 file changed, 10 insertions(+), 21 deletions(-) (limited to 'src/command/CommandInput.qml') diff --git a/src/command/CommandInput.qml b/src/command/CommandInput.qml index e980c80..dbc1d54 100644 --- a/src/command/CommandInput.qml +++ b/src/command/CommandInput.qml @@ -1,6 +1,5 @@ import QtQuick 2.0 import QtQuick.Layouts 1.1 -import Qt.labs.settings 1.0 import "commands.js" as Commands @@ -13,16 +12,6 @@ Item { Layout.preferredHeight: container.height - property Settings settings : Settings { - category: "command" - - property string background : "black" - property int fontSize : 12 - property string fontFamily : "Monospace" - property string fontColor : "white" - property string errorColor : "red" - } - onVisibleChanged: container.reset() function focus(prefix) { @@ -44,7 +33,7 @@ Item { height: container.height - color: settings.background + color: settings.command.background ColumnLayout { id: container @@ -60,13 +49,13 @@ Item { Layout.fillWidth: true font { - family: settings.fontFamily - pointSize: settings.fontSize + family: settings.command.fontFamily + pointSize: settings.command.fontSize } - color: settings.fontColor - selectionColor: settings.fontColor - selectedTextColor: settings.background + color: settings.command.fontColor + selectionColor: settings.command.fontColor + selectedTextColor: settings.command.background selectByMouse: true function initialize() { @@ -102,11 +91,11 @@ Item { Layout.preferredHeight: 0 font { - family: settings.fontFamily - pointSize: settings.fontSize + family: settings.command.fontFamily + pointSize: settings.command.fontSize } - color: settings.fontColor + color: settings.command.fontColor function isInitial() { return text === ''; @@ -126,7 +115,7 @@ Item { function error(msg) { text = '' + msg + ''; -- cgit v1.2.3