aboutsummaryrefslogtreecommitdiff
path: root/src/SettingsHandler.qml
blob: f281da17e0d280144abfe0adcd8de147e8c9406a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
import QtQuick 2.0
import Qt.labs.settings 1.0

QtObject {
	function getSetter(category, name) {
		try {
			var type = typeof eval(category + '.' + name);

			switch ( type ) {
				case 'undefined': {
					throw new ReferenceError();
					break;
				}
				case 'string': {
					return function(value) {
						return eval(category + '.' + name + ' = "' + value + '"');
					}
					break;
				}
				default: {
					return function(value) {
						return eval(category + '.' + name + ' = ' + value);
					}
					break;
				}
			}
		}
		catch (exception) {
			throw category + '.' + name + ' doesnt exist.';
		}
	}

	function read(category, name) {
		try {
			var value = eval(category + '.' + name);

			if ( typeof value === 'undefined' ) {
				throw new ReferenceError();
			} else {
				return value;
			}
		}
		catch (exception) {
			throw category + '.' + name + ' doesnt exist.';
		}
	}

	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"
	}
}