From 15cb0bd6b253673e02f3072c5fe604322da87467 Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Tue, 4 Aug 2015 15:34:25 +0200 Subject: Added overlay background and font color to settings This is required as the default white on black may not fit e.g. bright color schemes. --- qml/EmbeddedTerminal.qml | 45 ++++++++++++++++++++++++--------------------- qml/TerminalItem.qml | 3 ++- 2 files changed, 26 insertions(+), 22 deletions(-) diff --git a/qml/EmbeddedTerminal.qml b/qml/EmbeddedTerminal.qml index 382a781..9b89fd1 100644 --- a/qml/EmbeddedTerminal.qml +++ b/qml/EmbeddedTerminal.qml @@ -13,11 +13,13 @@ Item { 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 int initialLines : 20 + property int frameWidth : 10 + property int fontSize : 8 + property string fontFamily : "Monospace" + property string colorScheme : "cool-retro-term" + property color overlayBackground : "black" + property color overlayFontColor : "white" } property int lines : settings.initialLines @@ -73,6 +75,12 @@ Item { } } + Component.onCompleted: { + forceActiveFocus(); + highlighter.select(); + session.startShellProgram(); + } + onTermGetFocus: highlighter.focus() onTermLostFocus: highlighter.unfocus() onHeightChanged: overlay.displayBriefly(); @@ -87,17 +95,18 @@ Item { anchors.fill: parent opacity: 0 - color: "black" + color: settings.overlayBackground NumberAnimation { id: animation - target: overlay + + target: overlay property: "opacity" easing.type: Easing.InSine duration: 500 - from: 0.8 - to: 0 + from: 0.8 + to: 0 } Text { @@ -106,17 +115,17 @@ Item { verticalCenter: overlay.verticalCenter } + font { + family: settings.fontFamily + pointSize: 16 + } + color: settings.overlayFontColor + text: { return item.lines + 'x' + Math.floor(terminal.width / terminal.fontMetrics.width); } - - font { - family: settings.fontFamily - pointSize: 16 - } - color: "white" } } @@ -125,12 +134,6 @@ Item { acceptedButtons: Qt.NoButton onWheel: { } } - - Component.onCompleted: { - forceActiveFocus(); - highlighter.select(); - session.startShellProgram(); - } } } } diff --git a/qml/TerminalItem.qml b/qml/TerminalItem.qml index f81df93..22d4a5e 100644 --- a/qml/TerminalItem.qml +++ b/qml/TerminalItem.qml @@ -161,12 +161,13 @@ Item { } Text { - text: item.index font { family: settings.fontFamily pointSize: 12 } color: settings.fontColor + + text: item.index } } } -- cgit v1.2.3