From 57e835114bda852ebf28fe7f14e6046a3977abc7 Mon Sep 17 00:00:00 2001 From: Pascal Precht Date: Fri, 11 Jun 2021 14:12:51 +0200 Subject: [PATCH] refactor: integrate StatusQ Theming system This integrates the StatusQ Theming system and updates the selected theme based on existing APIs, allowing it to live side by side next to the legacy theming system. Closes #2687 --- ui/StatusQ | 2 +- ui/imports/Style.qml | 30 +++++++++++++++++++++++------- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/ui/StatusQ b/ui/StatusQ index eb87aa4bcb..fd7a5530cf 160000 --- a/ui/StatusQ +++ b/ui/StatusQ @@ -1 +1 @@ -Subproject commit eb87aa4bcbd3401345c18f9ed86c4cf408ab33cd +Subproject commit fd7a5530cf6c4395eec616dbf4622266793cd2b3 diff --git a/ui/imports/Style.qml b/ui/imports/Style.qml index 832a18fd0f..4ed7489ee5 100644 --- a/ui/imports/Style.qml +++ b/ui/imports/Style.qml @@ -2,18 +2,34 @@ pragma Singleton import QtQuick 2.13 import QtQuick.Controls.Universal 2.12 -import "./Themes" +import "./Themes" as Legacy + +import StatusQ.Core.Theme 0.1 QtObject { - property Theme current: lightTheme - property Theme lightTheme: LightTheme {} - property Theme darkTheme: DarkTheme {} + property Legacy.Theme current: lightTheme + property Legacy.Theme lightTheme: Legacy.LightTheme {} + property Legacy.Theme darkTheme: Legacy.DarkTheme {} + + + property ThemePalette statusQLightTheme: StatusLightTheme {} + property ThemePalette statusQDarkTheme: StatusDarkTheme {} + property var changeTheme: function (theme) { switch (theme) { - case Universal.Light: current = lightTheme; break; - case Universal.Dark: current = darkTheme; break; - default: current = lightTheme; console.log('Unknown theme. Valid themes are "light" and "dark"') + case Universal.Light: + current = lightTheme; + Theme.palette = statusQLightTheme + break; + case Universal.Dark: + current = darkTheme; + Theme.palette = statusQDarkTheme + break; + default: + current = lightTheme; + Theme.palette = statusQLightTheme + console.log('Unknown theme. Valid themes are "light" and "dark"') } }