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
This commit is contained in:
Pascal Precht 2021-06-11 14:12:51 +02:00 committed by Pascal Precht
parent a6ecf6b092
commit 57e835114b
2 changed files with 24 additions and 8 deletions

@ -1 +1 @@
Subproject commit eb87aa4bcbd3401345c18f9ed86c4cf408ab33cd
Subproject commit fd7a5530cf6c4395eec616dbf4622266793cd2b3

View File

@ -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"')
}
}