2020-06-17 19:18:31 +00:00
|
|
|
import QtQuick 2.13
|
|
|
|
import QtQuick.Controls 2.13
|
|
|
|
import QtQuick.Layouts 1.13
|
2020-05-11 21:24:08 +00:00
|
|
|
import Qt.labs.platform 1.1
|
2020-06-04 07:38:24 +00:00
|
|
|
import QtQml.StateMachine 1.14 as DSM
|
2020-07-09 17:02:58 +00:00
|
|
|
import QtMultimedia 5.13
|
2020-06-23 20:49:04 +00:00
|
|
|
import Qt.labs.settings 1.0
|
2020-07-10 21:47:31 +00:00
|
|
|
import QtQuick.Window 2.12
|
2020-06-23 20:49:04 +00:00
|
|
|
import QtQml 2.13
|
2020-07-12 16:47:46 +00:00
|
|
|
import QtQuick.Window 2.0
|
|
|
|
|
2020-05-13 02:51:26 +00:00
|
|
|
import "./onboarding"
|
|
|
|
import "./app"
|
2020-07-09 17:02:58 +00:00
|
|
|
import "./sounds"
|
2020-07-10 21:47:31 +00:00
|
|
|
import "./shared"
|
2020-06-19 18:06:58 +00:00
|
|
|
import "./imports"
|
2020-05-11 21:24:08 +00:00
|
|
|
|
|
|
|
ApplicationWindow {
|
2020-06-23 20:49:04 +00:00
|
|
|
property alias appSettings: settings
|
2020-07-01 15:37:36 +00:00
|
|
|
property bool hasAccounts: !!loginModel.rowCount()
|
2020-06-23 20:49:04 +00:00
|
|
|
|
2020-05-11 21:24:08 +00:00
|
|
|
id: applicationWindow
|
|
|
|
width: 1232
|
|
|
|
height: 770
|
2020-07-13 18:45:54 +00:00
|
|
|
color: Style.current.background
|
2020-06-23 20:49:04 +00:00
|
|
|
title: {
|
|
|
|
// Set application settings
|
2020-07-06 20:39:55 +00:00
|
|
|
//% "Nim Status Client"
|
|
|
|
Qt.application.name = qsTrId("nim-status-client")
|
2020-06-23 20:49:04 +00:00
|
|
|
Qt.application.organization = "Status"
|
|
|
|
Qt.application.domain = "status.im"
|
|
|
|
return Qt.application.name
|
|
|
|
}
|
2020-05-11 21:24:08 +00:00
|
|
|
visible: true
|
2020-05-18 15:07:30 +00:00
|
|
|
|
2020-07-12 16:47:46 +00:00
|
|
|
Component.onCompleted: {
|
2020-07-16 22:04:47 +00:00
|
|
|
if (settings.locale !== "en") {
|
|
|
|
profileModel.changeLocale(settings.locale)
|
|
|
|
}
|
|
|
|
|
2020-07-14 16:20:08 +00:00
|
|
|
setX(Qt.application.screens[0].width / 2 - width / 2);
|
|
|
|
setY(Qt.application.screens[0].height / 2 - height / 2);
|
2020-07-12 16:47:46 +00:00
|
|
|
}
|
|
|
|
|
2020-06-04 07:38:24 +00:00
|
|
|
signal navigateTo(string path)
|
|
|
|
|
2020-07-10 18:31:12 +00:00
|
|
|
ErrorSound {
|
|
|
|
id: errorSound
|
2020-07-09 17:02:58 +00:00
|
|
|
}
|
|
|
|
|
2020-07-10 18:31:12 +00:00
|
|
|
Audio {
|
|
|
|
id: sendMessageSound
|
|
|
|
audioRole: Audio.NotificationRole
|
|
|
|
source: "../../../../sounds/send_message.wav"
|
2020-07-09 17:02:58 +00:00
|
|
|
}
|
|
|
|
|
2020-07-10 21:47:31 +00:00
|
|
|
Audio {
|
|
|
|
id: notificationSound
|
|
|
|
audioRole: Audio.NotificationRole
|
|
|
|
source: "../../../../sounds/notification.wav"
|
|
|
|
}
|
|
|
|
|
2020-06-23 20:49:04 +00:00
|
|
|
Settings {
|
2020-07-16 22:04:47 +00:00
|
|
|
id: settings
|
|
|
|
property var chatSplitView
|
|
|
|
property var walletSplitView
|
|
|
|
property var profileSplitView
|
|
|
|
property bool displayChatImages: false
|
|
|
|
property bool compactMode
|
|
|
|
property string locale: "en"
|
|
|
|
}
|
2020-06-23 20:49:04 +00:00
|
|
|
|
2020-05-18 15:07:30 +00:00
|
|
|
SystemTrayIcon {
|
|
|
|
visible: true
|
|
|
|
icon.source: "shared/img/status-logo.png"
|
|
|
|
menu: Menu {
|
|
|
|
MenuItem {
|
2020-07-06 20:39:55 +00:00
|
|
|
//% "Quit"
|
|
|
|
text: qsTrId("quit")
|
2020-05-18 15:07:30 +00:00
|
|
|
onTriggered: Qt.quit()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
onActivated: {
|
|
|
|
applicationWindow.show()
|
|
|
|
applicationWindow.raise()
|
|
|
|
applicationWindow.requestActivate()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-06-04 07:38:24 +00:00
|
|
|
DSM.StateMachine {
|
|
|
|
id: stateMachine
|
|
|
|
initialState: onboardingState
|
|
|
|
running: true
|
|
|
|
|
|
|
|
DSM.State {
|
|
|
|
id: onboardingState
|
2020-07-01 15:37:36 +00:00
|
|
|
initialState: hasAccounts ? stateLogin : stateIntro
|
2020-06-04 07:38:24 +00:00
|
|
|
|
|
|
|
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"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-06-12 20:47:44 +00:00
|
|
|
DSM.SignalTransition {
|
2020-07-01 15:37:36 +00:00
|
|
|
targetState: hasAccounts ? stateLogin : stateIntro
|
2020-06-12 20:47:44 +00:00
|
|
|
signal: applicationWindow.navigateTo
|
|
|
|
guard: path === "InitialState"
|
|
|
|
}
|
|
|
|
|
|
|
|
DSM.SignalTransition {
|
|
|
|
targetState: existingKeyState
|
|
|
|
signal: applicationWindow.navigateTo
|
|
|
|
guard: path === "ExistingKey"
|
|
|
|
}
|
|
|
|
|
2020-07-01 15:37:36 +00:00
|
|
|
DSM.SignalTransition {
|
|
|
|
targetState: keysMainState
|
|
|
|
signal: applicationWindow.navigateTo
|
|
|
|
guard: path === "KeysMain"
|
|
|
|
}
|
|
|
|
|
2020-06-04 07:38:24 +00:00
|
|
|
DSM.FinalState {
|
|
|
|
id: onboardingDoneState
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
DSM.State {
|
|
|
|
id: appState
|
|
|
|
onEntered: loader.sourceComponent = app
|
|
|
|
|
|
|
|
DSM.SignalTransition {
|
|
|
|
targetState: stateLogin
|
|
|
|
signal: loginModel.onLoggedOut
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Loader {
|
|
|
|
id: loader
|
2020-05-18 15:07:30 +00:00
|
|
|
anchors.fill: parent
|
2020-05-19 13:22:38 +00:00
|
|
|
}
|
2020-05-18 15:07:30 +00:00
|
|
|
|
2020-06-04 07:38:24 +00:00
|
|
|
Component {
|
2020-05-19 13:22:38 +00:00
|
|
|
id: app
|
2020-06-23 20:49:04 +00:00
|
|
|
AppMain {
|
|
|
|
appSettings: applicationWindow.appSettings
|
|
|
|
}
|
2020-06-04 07:38:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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
|
2020-06-12 20:47:44 +00:00
|
|
|
ExistingKey {
|
|
|
|
onClosed: function () {
|
2020-07-01 15:37:36 +00:00
|
|
|
if (hasAccounts) {
|
|
|
|
applicationWindow.navigateTo("InitialState")
|
|
|
|
} else {
|
|
|
|
applicationWindow.navigateTo("KeysMain")
|
|
|
|
}
|
2020-06-12 20:47:44 +00:00
|
|
|
}
|
|
|
|
}
|
2020-06-04 07:38:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: genKey
|
|
|
|
GenKey {
|
2020-06-13 15:17:54 +00:00
|
|
|
onClosed: function () {
|
2020-07-01 15:37:36 +00:00
|
|
|
if (hasAccounts) {
|
|
|
|
applicationWindow.navigateTo("InitialState")
|
|
|
|
} else {
|
|
|
|
applicationWindow.navigateTo("KeysMain")
|
|
|
|
}
|
2020-06-13 15:17:54 +00:00
|
|
|
}
|
2020-06-04 07:38:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: login
|
|
|
|
Login {
|
2020-06-12 20:47:44 +00:00
|
|
|
onGenKeyClicked: function () {
|
|
|
|
applicationWindow.navigateTo("GenKey")
|
|
|
|
}
|
|
|
|
onExistingKeyClicked: function () {
|
|
|
|
applicationWindow.navigateTo("ExistingKey")
|
|
|
|
}
|
2020-06-04 07:38:24 +00:00
|
|
|
}
|
2020-05-11 21:24:08 +00:00
|
|
|
}
|
2020-07-10 21:47:31 +00:00
|
|
|
|
|
|
|
NotificationWindow {
|
|
|
|
id: notificationWindow
|
|
|
|
}
|
2020-05-11 21:24:08 +00:00
|
|
|
}
|
2020-07-01 17:35:57 +00:00
|
|
|
|
|
|
|
/*##^##
|
|
|
|
Designer {
|
|
|
|
D{i:0;formeditorZoom:0.5}
|
|
|
|
}
|
|
|
|
##^##*/
|