mirror of
https://github.com/status-im/status-desktop.git
synced 2025-01-09 05:52:41 +00:00
04ca90a7d0
App is responsive to the OS theme change event. Now we're following system set theme when the app is started. Corresponding part on the side on nimqml is added. Corresponding part on the side on dotherside is added. On the side of dother side we had kind of a memory leak, cause objects added to the filter were not deleted ever. When the app is closing, it just removes filters, but doesn't delete them. I faced a logical issue, that we were sending qmlengine pointer to the installEventFilter method, instead object which may or may not rely on the qqmlengine instance, that is fixed also. Fixes: #1725
42 lines
1.2 KiB
QML
42 lines
1.2 KiB
QML
pragma Singleton
|
|
|
|
import QtQuick 2.13
|
|
import QtQuick.Controls.Universal 2.12
|
|
import "./Themes" as Legacy
|
|
|
|
import StatusQ.Core.Theme 0.1
|
|
|
|
QtObject {
|
|
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, isCurrentSystemThemeDark) {
|
|
|
|
switch (theme) {
|
|
case Universal.Light:
|
|
current = lightTheme;
|
|
Theme.palette = statusQLightTheme
|
|
break;
|
|
case Universal.Dark:
|
|
current = darkTheme;
|
|
Theme.palette = statusQDarkTheme
|
|
break;
|
|
case Universal.System:
|
|
current = isCurrentSystemThemeDark? darkTheme : lightTheme;
|
|
Theme.palette = isCurrentSystemThemeDark? statusQDarkTheme : statusQLightTheme
|
|
break;
|
|
default:
|
|
console.log('Unknown theme. Valid themes are "light" and "dark"')
|
|
}
|
|
}
|
|
|
|
property var changeFontSize: function (fontSize) {
|
|
current.updateFontSize(fontSize)
|
|
}
|
|
}
|