aboutsummaryrefslogtreecommitdiff
path: root/src/command
diff options
context:
space:
mode:
authorAdrian Kummerlaender2015-08-19 11:13:35 +0200
committerAdrian Kummerlaender2015-08-19 11:13:35 +0200
commit4cb435f2a7bbeafb53f067d95ec83e0b3a1a17f8 (patch)
treead308460ab5f47f498b4d2432e36c7511c5e9aab /src/command
parent90da724a56c2ff20617d3e231a6ef877928df482 (diff)
downloadMetaTerm-4cb435f2a7bbeafb53f067d95ec83e0b3a1a17f8.tar
MetaTerm-4cb435f2a7bbeafb53f067d95ec83e0b3a1a17f8.tar.gz
MetaTerm-4cb435f2a7bbeafb53f067d95ec83e0b3a1a17f8.tar.bz2
MetaTerm-4cb435f2a7bbeafb53f067d95ec83e0b3a1a17f8.tar.lz
MetaTerm-4cb435f2a7bbeafb53f067d95ec83e0b3a1a17f8.tar.xz
MetaTerm-4cb435f2a7bbeafb53f067d95ec83e0b3a1a17f8.tar.zst
MetaTerm-4cb435f2a7bbeafb53f067d95ec83e0b3a1a17f8.zip
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.
Diffstat (limited to 'src/command')
-rw-r--r--src/command/CommandInput.qml31
1 files changed, 10 insertions, 21 deletions
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 = '<i><font color="'
- + settings.errorColor
+ + settings.command.errorColor
+ '">'
+ msg
+ '</font></i>';