Pascal Precht c804bb243a feat: store appearance settings globally across accounts
As discussed in https://github.com/status-im/status-desktop/issues/2144#issuecomment-817791172 and https://github.com/status-im/status-desktop/discussions/2145, it's no longer desired
to have different appearance settings across multiple accounts.
Instead, the appearance setting should apply globally to all accounts,
essentially bypassing the individual setting stored in status-go.

This commit introduces a new global setting called `theme` which,
at the time of introducing this commit, can be either:

0 => Light
1 => Dark
2 => System

Because those enum values matches the `AppearanceContainer.Theme` enum,
this commit removes it completely and simply relies on QML's built-in
`Universal.[Light|Dark|System] variants respectively.

Closes #2144
2021-04-19 13:53:14 +02:00

24 lines
663 B
QML

pragma Singleton
import QtQuick 2.13
import QtQuick.Controls.Universal 2.12
import "./Themes"
QtObject {
property Theme current: lightTheme
property Theme lightTheme: LightTheme {}
property Theme darkTheme: DarkTheme {}
property var changeTheme: function (theme) {
switch (theme) {
case Universal.Light: current = lightTheme; break;
case Universal.Dark: current = darkTheme; break;
default: current = lightTheme; console.log('Unknown theme. Valid themes are "light" and "dark"')
}
}
property var changeFontSize: function (fontSize) {
current.updateFontSize(fontSize)
}
}