aboutsummaryrefslogtreecommitdiff
path: root/src/widget/EmbeddedTerminal.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/widget/EmbeddedTerminal.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/widget/EmbeddedTerminal.qml')
-rw-r--r--src/widget/EmbeddedTerminal.qml38
1 files changed, 12 insertions, 26 deletions
diff --git a/src/widget/EmbeddedTerminal.qml b/src/widget/EmbeddedTerminal.qml
index 6d0dc6e..54dad75 100644
--- a/src/widget/EmbeddedTerminal.qml
+++ b/src/widget/EmbeddedTerminal.qml
@@ -1,31 +1,17 @@
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 string program
+ property string workingDirectory
- Settings {
- id: 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 int lines : settings.initialLines
+ property int lines : settings.terminal.initialLines
height: terminal.height
- width: parent.width - settings.frameWidth
+ width: parent.width - settings.terminal.frameWidth
function select() { highlighter.select() }
function deselect() { highlighter.deselect() }
@@ -44,7 +30,7 @@ Item {
Highlighter {
id: highlighter
- width: settings.frameWidth
+ width: settings.terminal.frameWidth
Layout.fillHeight: true
}
@@ -52,14 +38,14 @@ Item {
id: terminal
font {
- family: settings.fontFamily
- pointSize: settings.fontSize
+ family: settings.terminal.fontFamily
+ pointSize: settings.terminal.fontSize
}
Layout.fillWidth: true
Layout.preferredHeight: fontMetrics.height * item.lines
- colorScheme: settings.colorScheme
+ colorScheme: settings.terminal.colorScheme
session: QMLTermSession {
initialWorkingDirectory: item.workingDirectory
@@ -99,7 +85,7 @@ Item {
anchors.fill: parent
opacity: 0
- color: settings.overlayBackground
+ color: settings.terminal.overlayBackground
SequentialAnimation {
id: animation
@@ -130,10 +116,10 @@ Item {
}
font {
- family: settings.fontFamily
- pointSize: settings.fontSize * 2
+ family: settings.terminal.fontFamily
+ pointSize: settings.terminal.fontSize * 2
}
- color: settings.overlayFontColor
+ color: settings.terminal.overlayFontColor
text: {
return item.lines