2020-07-02 11:14:31 -04:00
|
|
|
pragma Singleton
|
|
|
|
|
|
|
|
import QtQuick 2.13
|
2021-04-16 12:37:53 +02:00
|
|
|
import QtQuick.Controls.Universal 2.12
|
2021-06-11 14:12:51 +02:00
|
|
|
import "./Themes" as Legacy
|
|
|
|
|
|
|
|
import StatusQ.Core.Theme 0.1
|
2020-07-02 11:14:31 -04:00
|
|
|
|
|
|
|
QtObject {
|
2021-06-11 14:12:51 +02:00
|
|
|
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 {}
|
|
|
|
|
2021-08-12 13:52:04 +02:00
|
|
|
property var changeTheme: function (theme, isCurrentSystemThemeDark) {
|
2020-07-01 13:35:57 -04:00
|
|
|
|
|
|
|
switch (theme) {
|
2021-06-11 14:12:51 +02:00
|
|
|
case Universal.Light:
|
2021-08-12 13:52:04 +02:00
|
|
|
current = lightTheme;
|
2021-06-11 14:12:51 +02:00
|
|
|
Theme.palette = statusQLightTheme
|
|
|
|
break;
|
|
|
|
case Universal.Dark:
|
2021-08-12 13:52:04 +02:00
|
|
|
current = darkTheme;
|
2021-06-11 14:12:51 +02:00
|
|
|
Theme.palette = statusQDarkTheme
|
|
|
|
break;
|
2021-08-12 13:52:04 +02:00
|
|
|
case Universal.System:
|
|
|
|
current = isCurrentSystemThemeDark? darkTheme : lightTheme;
|
|
|
|
Theme.palette = isCurrentSystemThemeDark? statusQDarkTheme : statusQLightTheme
|
|
|
|
break;
|
|
|
|
default:
|
2021-06-11 14:12:51 +02:00
|
|
|
console.log('Unknown theme. Valid themes are "light" and "dark"')
|
2020-07-01 13:35:57 -04:00
|
|
|
}
|
|
|
|
}
|
2020-11-25 11:46:18 +01:00
|
|
|
|
|
|
|
property var changeFontSize: function (fontSize) {
|
|
|
|
current.updateFontSize(fontSize)
|
|
|
|
}
|
2020-07-02 11:14:31 -04:00
|
|
|
}
|