From 3af7553b2e7cf4f301d61eeac563f07bd405c66c Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Sun, 26 Jul 2015 20:54:57 +0200 Subject: Added support for permanently storing settings --- qml/EmbeddedTerminal.qml | 21 +++++++++++++++++---- qml/TerminalItem.qml | 1 - qml/main.qml | 7 +++++++ 3 files changed, 24 insertions(+), 5 deletions(-) (limited to 'qml') diff --git a/qml/EmbeddedTerminal.qml b/qml/EmbeddedTerminal.qml index aa22328..ef53b12 100644 --- a/qml/EmbeddedTerminal.qml +++ b/qml/EmbeddedTerminal.qml @@ -1,18 +1,29 @@ import QtQuick 2.0 import QMLTermWidget 1.0 import QtQuick.Layouts 1.1 +import Qt.labs.settings 1.0 Item { id: item property string program property string workingDirectory - property int lines + + property int lines : 20 property int frameWidth : 10 height: terminal.height width: parent.width - frameWidth + 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 + } + function select() { highlighter.select() } function deselect() { highlighter.deselect() } @@ -36,10 +47,12 @@ Item { QMLTermWidget { id: terminal - font.family: "Monospace" - font.pointSize: 8 + font { + family: "Monospace" + pointSize: 8 + } - Layout.fillWidth: true + Layout.fillWidth: true Layout.preferredHeight: fontMetrics.height * item.lines colorScheme: "cool-retro-term" diff --git a/qml/TerminalItem.qml b/qml/TerminalItem.qml index 48fb9f7..eeeed1c 100644 --- a/qml/TerminalItem.qml +++ b/qml/TerminalItem.qml @@ -96,7 +96,6 @@ Item { var terminalComponent = Qt.createComponent("qrc:/EmbeddedTerminal.qml"); var instantiateTerminal = function() { item.terminal = terminalComponent.createObject(elementList, { - "lines" : 20, "program" : program, "workingDirectory" : "$HOME", "focus" : true diff --git a/qml/main.qml b/qml/main.qml index 836f97c..a45ee73 100644 --- a/qml/main.qml +++ b/qml/main.qml @@ -1,6 +1,7 @@ import QtQuick 2.0 import QtQuick.Window 2.0 import QtQuick.Controls 1.2 +import Qt.labs.settings 1.0 ApplicationWindow { id: root @@ -13,6 +14,12 @@ ApplicationWindow { terminalList.focusCurrent(); } + Settings { + category: "window" + + property alias color : root.color + } + Flickable { id: terminalListFlickable -- cgit v1.2.3