mirror of
https://github.com/status-im/status-desktop.git
synced 2025-01-10 06:16:32 +00:00
c236e01fc8
Supports system dark mode. Changes the user appearance setting to a 3-way setting of System, Light, Dark. New accounts will have their appearance setting set to "System", which uses the system setting to determine if dark mode should be applied. Breaking change: Users who had their settings on Light Theme, will now get the system theme (light or dark). Users who had their theme set to Dark, will now get the Light theme. At startup, the onboarding screens will have the system-level setting of dark mode applied or not. Once, logged in, the user settings will be applied. ## Note An appearance setting of "System" is not dynamic to the system-level setting. This means that if a user has "System" set for their appearance (and ie, the user has light mode set), and then user then changes their system setting from light to dark, the app will not respond until it is restarted. This is due to a limitation of Qt not having a reliable way to propagate these changes to QML.
279 lines
7.1 KiB
QML
279 lines
7.1 KiB
QML
import QtQuick 2.13
|
|
import QtQuick.Controls 2.13
|
|
import QtQuick.Layouts 1.13
|
|
import Qt.labs.platform 1.1
|
|
import QtQml.StateMachine 1.14 as DSM
|
|
import QtMultimedia 5.13
|
|
import Qt.labs.settings 1.0
|
|
import QtQuick.Window 2.12
|
|
import QtQml 2.13
|
|
import QtQuick.Window 2.0
|
|
import QtQuick.Controls.Universal 2.12
|
|
|
|
import "./onboarding"
|
|
import "./app"
|
|
import "./sounds"
|
|
import "./shared"
|
|
import "./imports"
|
|
|
|
ApplicationWindow {
|
|
property bool hasAccounts: !!loginModel.rowCount()
|
|
|
|
Universal.theme: Universal.System
|
|
|
|
id: applicationWindow
|
|
width: 1232
|
|
height: 770
|
|
color: Style.current.background
|
|
title: {
|
|
// Set application settings
|
|
//% "Status Desktop"
|
|
Qt.application.name = qsTrId("status-desktop")
|
|
Qt.application.organization = "Status"
|
|
Qt.application.domain = "status.im"
|
|
return Qt.application.name
|
|
}
|
|
visible: true
|
|
|
|
Component.onCompleted: {
|
|
// Change the theme to the system theme (dark/light) until we get the
|
|
// user's saved setting from status-go (after login)
|
|
Style.changeTheme(Universal.theme === Universal.Dark ? "dark" : "light")
|
|
setX(Qt.application.screens[0].width / 2 - width / 2);
|
|
setY(Qt.application.screens[0].height / 2 - height / 2);
|
|
}
|
|
|
|
signal navigateTo(string path)
|
|
|
|
ErrorSound {
|
|
id: errorSound
|
|
}
|
|
|
|
Audio {
|
|
id: sendMessageSound
|
|
audioRole: Audio.NotificationRole
|
|
source: "../../../../sounds/send_message.wav"
|
|
volume: appSettings.volume
|
|
}
|
|
|
|
Audio {
|
|
id: notificationSound
|
|
audioRole: Audio.NotificationRole
|
|
source: "../../../../sounds/notification.wav"
|
|
volume: appSettings.volume
|
|
}
|
|
|
|
signal settingsLoaded()
|
|
Settings {
|
|
id: appSettings
|
|
fileName: profileModel.profileSettingsFile
|
|
property var chatSplitView
|
|
property var walletSplitView
|
|
property var profileSplitView
|
|
property bool walletEnabled: false
|
|
property bool displayChatImages: false
|
|
property bool compactMode
|
|
property string locale: "en"
|
|
property var recentEmojis: []
|
|
property real volume: 0.2
|
|
}
|
|
Connections {
|
|
target: profileModel
|
|
onProfileSettingsFileChanged: {
|
|
settingsLoaded()
|
|
if (appSettings.locale !== "en") {
|
|
profileModel.changeLocale(appSettings.locale)
|
|
}
|
|
}
|
|
}
|
|
|
|
SystemTrayIcon {
|
|
visible: true
|
|
icon.source: "shared/img/status-logo.png"
|
|
menu: Menu {
|
|
MenuItem {
|
|
//% "Quit"
|
|
text: qsTrId("quit")
|
|
onTriggered: Qt.quit()
|
|
}
|
|
}
|
|
|
|
onActivated: {
|
|
applicationWindow.show()
|
|
applicationWindow.raise()
|
|
applicationWindow.requestActivate()
|
|
}
|
|
}
|
|
|
|
DSM.StateMachine {
|
|
id: stateMachine
|
|
initialState: onboardingState
|
|
running: true
|
|
|
|
DSM.State {
|
|
id: onboardingState
|
|
initialState: hasAccounts ? stateLogin : stateIntro
|
|
|
|
DSM.State {
|
|
id: stateIntro
|
|
onEntered: loader.sourceComponent = intro
|
|
}
|
|
|
|
DSM.State {
|
|
id: keysMainState
|
|
onEntered: loader.sourceComponent = keysMain
|
|
|
|
DSM.SignalTransition {
|
|
targetState: genKeyState
|
|
signal: applicationWindow.navigateTo
|
|
guard: path === "GenKey"
|
|
}
|
|
}
|
|
|
|
DSM.State {
|
|
id: existingKeyState
|
|
onEntered: loader.sourceComponent = existingKey
|
|
|
|
DSM.SignalTransition {
|
|
targetState: appState
|
|
signal: onboardingModel.loginResponseChanged
|
|
guard: !error
|
|
}
|
|
}
|
|
|
|
DSM.State {
|
|
id: genKeyState
|
|
onEntered: loader.sourceComponent = genKey
|
|
|
|
DSM.SignalTransition {
|
|
targetState: appState
|
|
signal: onboardingModel.loginResponseChanged
|
|
guard: !error
|
|
}
|
|
}
|
|
|
|
DSM.State {
|
|
id: stateLogin
|
|
onEntered: loader.sourceComponent = login
|
|
|
|
DSM.SignalTransition {
|
|
targetState: appState
|
|
signal: loginModel.loginResponseChanged
|
|
guard: !error
|
|
}
|
|
|
|
DSM.SignalTransition {
|
|
targetState: genKeyState
|
|
signal: applicationWindow.navigateTo
|
|
guard: path === "GenKey"
|
|
}
|
|
}
|
|
|
|
DSM.SignalTransition {
|
|
targetState: hasAccounts ? stateLogin : stateIntro
|
|
signal: applicationWindow.navigateTo
|
|
guard: path === "InitialState"
|
|
}
|
|
|
|
DSM.SignalTransition {
|
|
targetState: existingKeyState
|
|
signal: applicationWindow.navigateTo
|
|
guard: path === "ExistingKey"
|
|
}
|
|
|
|
DSM.SignalTransition {
|
|
targetState: keysMainState
|
|
signal: applicationWindow.navigateTo
|
|
guard: path === "KeysMain"
|
|
}
|
|
|
|
DSM.FinalState {
|
|
id: onboardingDoneState
|
|
}
|
|
}
|
|
|
|
DSM.State {
|
|
id: appState
|
|
onEntered: loader.sourceComponent = app
|
|
|
|
DSM.SignalTransition {
|
|
targetState: stateLogin
|
|
signal: loginModel.onLoggedOut
|
|
}
|
|
}
|
|
}
|
|
|
|
Loader {
|
|
id: loader
|
|
anchors.fill: parent
|
|
}
|
|
|
|
Component {
|
|
id: app
|
|
AppMain {}
|
|
}
|
|
|
|
Component {
|
|
id: intro
|
|
Intro {
|
|
btnGetStarted.onClicked: applicationWindow.navigateTo("KeysMain")
|
|
}
|
|
}
|
|
|
|
Component {
|
|
id: keysMain
|
|
KeysMain {
|
|
btnGenKey.onClicked: applicationWindow.navigateTo("GenKey")
|
|
btnExistingKey.onClicked: applicationWindow.navigateTo("ExistingKey")
|
|
}
|
|
}
|
|
|
|
Component {
|
|
id: existingKey
|
|
ExistingKey {
|
|
onClosed: function () {
|
|
if (hasAccounts) {
|
|
applicationWindow.navigateTo("InitialState")
|
|
} else {
|
|
applicationWindow.navigateTo("KeysMain")
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
Component {
|
|
id: genKey
|
|
GenKey {
|
|
onClosed: function () {
|
|
if (hasAccounts) {
|
|
applicationWindow.navigateTo("InitialState")
|
|
} else {
|
|
applicationWindow.navigateTo("KeysMain")
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
Component {
|
|
id: login
|
|
Login {
|
|
onGenKeyClicked: function () {
|
|
applicationWindow.navigateTo("GenKey")
|
|
}
|
|
onExistingKeyClicked: function () {
|
|
applicationWindow.navigateTo("ExistingKey")
|
|
}
|
|
}
|
|
}
|
|
|
|
NotificationWindow {
|
|
id: notificationWindow
|
|
}
|
|
}
|
|
|
|
/*##^##
|
|
Designer {
|
|
D{i:0;formeditorZoom:0.5}
|
|
}
|
|
##^##*/
|