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-09-28 18:04:06 +03:00
|
|
|
import "../Themes" as Legacy
|
2021-06-11 14:12:51 +02:00
|
|
|
|
|
|
|
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)
|
|
|
|
}
|
2021-09-28 18:04:06 +03:00
|
|
|
|
|
|
|
property string assetPath: Qt.resolvedUrl("./../assets/")
|
|
|
|
function png(name) {
|
2022-04-01 23:53:57 +03:00
|
|
|
return assetPath + "png/" + name + ".png";
|
2021-09-28 18:04:06 +03:00
|
|
|
}
|
2022-04-01 23:53:57 +03:00
|
|
|
function svg(name) {
|
|
|
|
return assetPath + "icons/" + name + ".svg";
|
2021-09-28 18:04:06 +03:00
|
|
|
}
|
|
|
|
function emoji(name) {
|
2022-05-13 18:55:42 +03:00
|
|
|
return "qrc:/StatusQ/src/assets/twemoji/svg/" + name + ".svg";
|
2021-09-28 18:04:06 +03:00
|
|
|
}
|
2022-03-04 00:50:53 +02:00
|
|
|
function lottie(name) {
|
2022-04-01 23:53:57 +03:00
|
|
|
return assetPath + "lottie/" + name + ".json";
|
2022-03-04 00:50:53 +02:00
|
|
|
}
|
2022-05-12 13:28:46 +03:00
|
|
|
function gif(name) {
|
|
|
|
return assetPath + "gif/" + name + ".gif";
|
|
|
|
}
|
2020-07-02 11:14:31 -04:00
|
|
|
}
|