diff options
author | Adrian Kummerlaender | 2015-07-26 22:23:08 +0200 |
---|---|---|
committer | Adrian Kummerlaender | 2015-07-26 22:23:08 +0200 |
commit | e2d2c1232d10511693d058e0790183ba57ecd5d1 (patch) | |
tree | b783c60b19eadc8db54c54d7a4ab7b0ee5c5f504 | |
parent | 3af7553b2e7cf4f301d61eeac563f07bd405c66c (diff) | |
download | MetaTerm-e2d2c1232d10511693d058e0790183ba57ecd5d1.tar MetaTerm-e2d2c1232d10511693d058e0790183ba57ecd5d1.tar.gz MetaTerm-e2d2c1232d10511693d058e0790183ba57ecd5d1.tar.bz2 MetaTerm-e2d2c1232d10511693d058e0790183ba57ecd5d1.tar.lz MetaTerm-e2d2c1232d10511693d058e0790183ba57ecd5d1.tar.xz MetaTerm-e2d2c1232d10511693d058e0790183ba57ecd5d1.tar.zst MetaTerm-e2d2c1232d10511693d058e0790183ba57ecd5d1.zip |
Extended available settings and changed them to value properties
Otherwise each runtime change of a property leads to storing the new value to disk which we don't want - setting changes should be explicit and visible as such.
-rw-r--r-- | qml/EmbeddedTerminal.qml | 29 | ||||
-rw-r--r-- | qml/TerminalItem.qml | 27 | ||||
-rw-r--r-- | qml/main.qml | 16 |
3 files changed, 43 insertions, 29 deletions
diff --git a/qml/EmbeddedTerminal.qml b/qml/EmbeddedTerminal.qml index ef53b12..7e021b3 100644 --- a/qml/EmbeddedTerminal.qml +++ b/qml/EmbeddedTerminal.qml @@ -9,21 +9,22 @@ Item { property string program property string workingDirectory - property int lines : 20 - property int frameWidth : 10 - - height: terminal.height - width: parent.width - frameWidth - Settings { + id: settings category: "terminal" - property alias frameWidth : item.frameWidth - property alias colorScheme : terminal.colorScheme - property alias fontFamily : terminal.font.family - property alias fontSize : terminal.font.pointSize + property int initialLines : 20 + property int frameWidth : 10 + property int fontSize : 8 + property string fontFamily : "Monospace" + property string colorScheme : "cool-retro-term" } + property int lines : settings.initialLines + + height: terminal.height + width: parent.width - settings.frameWidth + function select() { highlighter.select() } function deselect() { highlighter.deselect() } @@ -40,7 +41,7 @@ Item { Highlighter { id: highlighter - width: item.frameWidth + width: settings.frameWidth Layout.fillHeight: true } @@ -48,14 +49,14 @@ Item { id: terminal font { - family: "Monospace" - pointSize: 8 + family: settings.fontFamily + pointSize: settings.fontSize } Layout.fillWidth: true Layout.preferredHeight: fontMetrics.height * item.lines - colorScheme: "cool-retro-term" + colorScheme: settings.colorScheme session: QMLTermSession { initialWorkingDirectory: item.workingDirectory diff --git a/qml/TerminalItem.qml b/qml/TerminalItem.qml index eeeed1c..f81df93 100644 --- a/qml/TerminalItem.qml +++ b/qml/TerminalItem.qml @@ -1,6 +1,7 @@ import QtQuick 2.0 import QtQuick.Controls 1.2 import QtQuick.Layouts 1.1 +import Qt.labs.settings 1.0 Item { id: item @@ -10,6 +11,15 @@ Item { signal executed (int index) + Settings { + id: settings + category: "item" + + property int fontSize : 18 + property string fontFamily : "Monospace" + property color fontColor : "white" + } + anchors { left: parent.left right: parent.right @@ -126,15 +136,16 @@ Item { id: command font { - family: "Monospace" - pointSize: 18 + family: settings.fontFamily + pointSize: settings.fontSize } - color: "white" - selectionColor: "white" + + color: settings.fontColor + selectionColor: settings.fontColor selectedTextColor: "#161616" - selectByMouse: true - focus: true + selectByMouse: true + focus: true Layout.fillWidth: true onAccepted: { @@ -152,10 +163,10 @@ Item { Text { text: item.index font { - family: "Monospace" + family: settings.fontFamily pointSize: 12 } - color: "white" + color: settings.fontColor } } } diff --git a/qml/main.qml b/qml/main.qml index a45ee73..19d19fc 100644 --- a/qml/main.qml +++ b/qml/main.qml @@ -7,17 +7,19 @@ ApplicationWindow { id: root visible: true - color: "#161616" - - Component.onCompleted: { - terminalList.createItem(); - terminalList.focusCurrent(); - } Settings { + id: settings category: "window" - property alias color : root.color + property color background : "#161616" + } + + color: settings.background + + Component.onCompleted: { + terminalList.createItem(); + terminalList.focusCurrent(); } Flickable { |