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