aboutsummaryrefslogtreecommitdiff
path: root/src/main.qml
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/main.qml
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/main.qml')
-rw-r--r--src/main.qml29
1 files changed, 10 insertions, 19 deletions
diff --git a/src/main.qml b/src/main.qml
index 2965fa1..db17cda 100644
--- a/src/main.qml
+++ b/src/main.qml
@@ -2,34 +2,32 @@ import QtQuick 2.0
import QtQuick.Window 2.0
import QtQuick.Controls 1.2
import QtQuick.Layouts 1.1
-import Qt.labs.settings 1.0
ApplicationWindow {
id: root
visible: true
-
- property Settings settings : Settings {
- category: "window"
-
- property string background : "#161616"
- }
-
- color: settings.background
+ color: settings.window.background
Component.onCompleted: {
terminalList.createItem();
terminalList.focusCurrent();
}
+ SettingsHandler {
+ id: settings
+ }
+
+ StateHandler {
+ id: mode
+ }
+
ColumnLayout {
anchors.fill: parent
TerminalList {
id: terminalList
- state: state
-
Layout.fillHeight: true
Layout.fillWidth: true
}
@@ -39,14 +37,7 @@ ApplicationWindow {
Layout.fillWidth: true
- onExecuted: state.enterNormalMode()
+ onExecuted: mode.enterNormalMode()
}
}
-
- StateHandler {
- id: state
-
- terminalList: terminalList
- commandInput: command
- }
}