aboutsummaryrefslogtreecommitdiff
path: root/src/SettingsHandler.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/SettingsHandler.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/SettingsHandler.qml')
-rw-r--r--src/SettingsHandler.qml62
1 files changed, 62 insertions, 0 deletions
diff --git a/src/SettingsHandler.qml b/src/SettingsHandler.qml
new file mode 100644
index 0000000..8a9a862
--- /dev/null
+++ b/src/SettingsHandler.qml
@@ -0,0 +1,62 @@
+import QtQuick 2.0
+import Qt.labs.settings 1.0
+
+QtObject {
+ property Settings window : Settings {
+ category: "window"
+
+ property string background : "#161616"
+ }
+
+ property Settings keybinding : Settings {
+ category: "keybinding"
+
+ property string insertMode : "i"
+ property string normalMode : "Shift+ESC"
+ property string commandMode : ":"
+ property string nextItem : "j"
+ property string prevItem : "k"
+ property string firstItem : "g"
+ property string resetItem : "d"
+ property string lastItem : "Shift+G"
+ property string heightenItem : "Shift+J"
+ property string shortenItem : "Shift+K"
+ }
+
+ property Settings item : Settings {
+ category: "item"
+
+ property int fontSize : 18
+ property string fontFamily : "Monospace"
+ property string fontColor : "white"
+ }
+
+ property Settings highlighter : Settings {
+ category: "highlighter"
+
+ property string defaultColor : "#909636"
+ property string focusColor : "#352F6A"
+ }
+
+ property Settings terminal : Settings {
+ category: "terminal"
+
+ property int initialLines : 20
+ property int frameWidth : 10
+ property int fontSize : 8
+ property string fontFamily : "Monospace"
+ property string colorScheme : "cool-retro-term"
+ property string overlayBackground : "black"
+ property string overlayFontColor : "white"
+ }
+
+ property Settings command : Settings {
+ category: "command"
+
+ property string background : "black"
+ property int fontSize : 12
+ property string fontFamily : "Monospace"
+ property string fontColor : "white"
+ property string errorColor : "red"
+ }
+}