From 921a0586cff2f02b46c7a2d6b967f15f34a51e0c Mon Sep 17 00:00:00 2001 From: miruka Date: Wed, 24 Jul 2019 14:58:16 -0400 Subject: [PATCH] Add background image variable to theme --- TODO.md | 1 - src/qml/UI.qml | 4 ++-- src/themes/Default.qpl | 16 ++++++++++++---- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/TODO.md b/TODO.md index 270fe9e8..df181a18 100644 --- a/TODO.md +++ b/TODO.md @@ -75,7 +75,6 @@ - Find icon packs in user data dir - Correctly implement uiScale/fontScale + ctrl+-= keys - See [Text.fontSizeMode](https://doc.qt.io/qt-5/qml-qtquick-text.html#fontSizeMode-prop) - - Selecting background image - Way to round avatar corners to allow box radius - If avatar is set, name color from average color? - Accent color from background diff --git a/src/qml/UI.qml b/src/qml/UI.qml index 8be52e74..b2238c95 100644 --- a/src/qml/UI.qml +++ b/src/qml/UI.qml @@ -35,10 +35,10 @@ HRectangle { accounts.count > 0 || py.loadingAccounts HImage { - visible: false + visible: Boolean(Qt.resolvedUrl(source)) id: mainUIBackground fillMode: Image.PreserveAspectCrop - source: "../images/background.jpg" + source: theme.ui.image sourceSize.width: Screen.width sourceSize.height: Screen.height anchors.fill: parent diff --git a/src/themes/Default.qpl b/src/themes/Default.qpl index d6a8ac3e..e3a39a82 100644 --- a/src/themes/Default.qpl +++ b/src/themes/Default.qpl @@ -2,6 +2,8 @@ // This file is part of harmonyqml, licensed under LGPLv3. // vim: syntax=qml +// Base variables + real uiScale: 1.0 /* TODO: Implement correctly, do not change for now */ real fontScale: uiScale @@ -62,6 +64,8 @@ colors: loops: Animation.Infinite +// Generic UI controls + controls: box: color background: colors.strongBackground @@ -120,7 +124,11 @@ controls: int lightness: 55 +// Special UI parts + ui: + // Supported: local file path or web URL + url image: "" color background: colors.weakBackground @@ -137,19 +145,19 @@ sidePane: color background: colors.strongBackground account: - color background: sidePane.background + color background: "transparent" color name: colors.text room: - color background: sidePane.background + color background: "transparent" color name: colors.text color subtitle: colors.dimText settingsButton: - color background: sidePane.background + color background: "transparent" filterRooms: - color background: sidePane.background + color background: "transparent" chat: