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