2020-06-17 15:18:31 -04:00
|
|
|
import QtQuick 2.13
|
|
|
|
import QtQuick.Controls 2.13
|
|
|
|
import QtQuick.Layouts 1.13
|
2020-05-12 07:24:08 +10:00
|
|
|
import "../imports"
|
2020-06-23 14:59:16 -04:00
|
|
|
import "../shared"
|
2020-10-27 13:46:19 +01:00
|
|
|
import "../shared/status"
|
2020-05-13 13:27:06 -04:00
|
|
|
import "./AppLayouts"
|
2020-10-15 14:57:43 -04:00
|
|
|
import "./AppLayouts/Wallet"
|
2020-05-12 07:24:08 +10:00
|
|
|
|
|
|
|
RowLayout {
|
2020-09-15 15:47:13 -04:00
|
|
|
id: appMain
|
2020-10-08 14:08:50 -04:00
|
|
|
spacing: 0
|
2020-05-13 10:40:51 -04:00
|
|
|
Layout.fillHeight: true
|
|
|
|
Layout.fillWidth: true
|
2020-05-12 07:24:08 +10:00
|
|
|
|
2020-09-11 13:31:13 -04:00
|
|
|
ToastMessage {
|
|
|
|
id: toastMessage
|
|
|
|
}
|
|
|
|
|
2020-10-15 14:57:43 -04:00
|
|
|
// Add SenmdModal here as it is used by the Wallet as well as the Browser
|
|
|
|
SendModal{
|
|
|
|
id: sendModal
|
|
|
|
onOpened: {
|
|
|
|
walletModel.getGasPricePredictions()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-21 10:45:28 -04:00
|
|
|
function changeAppSection(section) {
|
|
|
|
let sectionId = -1
|
|
|
|
switch (section) {
|
|
|
|
case Constants.chat: sectionId = 0; break;
|
|
|
|
case Constants.wallet: sectionId = 1; break;
|
|
|
|
case Constants.browser: sectionId = 2; break;
|
|
|
|
case Constants.profile: sectionId = 3; break;
|
|
|
|
case Constants.node: sectionId = 4; break;
|
|
|
|
case Constants.ui: sectionId = 5; break;
|
|
|
|
}
|
|
|
|
if (sectionId === -1) {
|
|
|
|
throw new Exception ("Unknown section name. Check the Constants to know the available ones")
|
|
|
|
}
|
|
|
|
tabBar.setCurrentIndex(sectionId)
|
|
|
|
}
|
|
|
|
|
2020-05-12 07:24:08 +10:00
|
|
|
TabBar {
|
|
|
|
id: tabBar
|
2020-06-23 14:59:16 -04:00
|
|
|
width: 78
|
2020-05-13 10:40:51 -04:00
|
|
|
Layout.maximumWidth: 80
|
|
|
|
Layout.preferredWidth: 80
|
|
|
|
Layout.minimumWidth: 80
|
2020-05-12 07:24:08 +10:00
|
|
|
currentIndex: 0
|
|
|
|
topPadding: 57
|
|
|
|
rightPadding: 19
|
|
|
|
leftPadding: 19
|
|
|
|
transformOrigin: Item.Top
|
|
|
|
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
|
|
|
|
Layout.fillHeight: true
|
|
|
|
spacing: 5
|
|
|
|
background: Rectangle {
|
|
|
|
color: "#00000000"
|
2020-07-13 14:45:54 -04:00
|
|
|
border.color: Style.current.border
|
2020-05-12 07:24:08 +10:00
|
|
|
}
|
|
|
|
|
2020-10-27 13:46:19 +01:00
|
|
|
StatusIconTabButton {
|
|
|
|
id: chatBtn
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
icon.name: "message"
|
2020-10-30 15:40:53 -04:00
|
|
|
anchors.topMargin: 0
|
2020-10-27 13:46:19 +01:00
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
visible: chatsModel.unreadMessagesCount > 0
|
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.left: parent.right
|
|
|
|
anchors.leftMargin: -10
|
|
|
|
anchors.topMargin: -5
|
2020-10-28 11:15:39 +01:00
|
|
|
radius: width / 2
|
2020-10-27 13:46:19 +01:00
|
|
|
color: Style.current.blue
|
|
|
|
width: chatsModel.unreadMessagesCount < 10 ? 18 : messageCount.width + 10
|
|
|
|
height: 18
|
|
|
|
Text {
|
|
|
|
id: messageCount
|
|
|
|
font.pixelSize: chatsModel.unreadMessagesCount > 99 ? 10 : 12
|
|
|
|
color: Style.current.white
|
|
|
|
anchors.centerIn: parent
|
|
|
|
text: chatsModel.unreadMessagesCount
|
|
|
|
}
|
|
|
|
}
|
2020-05-12 07:24:08 +10:00
|
|
|
}
|
|
|
|
|
2020-10-27 13:46:19 +01:00
|
|
|
StatusIconTabButton {
|
|
|
|
id: walletBtn
|
|
|
|
anchors.top: chatBtn.top
|
|
|
|
enabled: isExperimental === "1" || appSettings.walletEnabled
|
|
|
|
icon.name: "wallet"
|
2020-05-12 07:24:08 +10:00
|
|
|
}
|
|
|
|
|
2020-10-27 13:46:19 +01:00
|
|
|
StatusIconTabButton {
|
|
|
|
id: browserBtn
|
|
|
|
anchors.top: walletBtn.top
|
|
|
|
enabled: isExperimental === "1" || appSettings.browserEnabled
|
|
|
|
icon.name: "compass"
|
2020-09-22 10:12:48 -05:00
|
|
|
}
|
|
|
|
|
2020-10-27 13:46:19 +01:00
|
|
|
StatusIconTabButton {
|
|
|
|
id: profileBtn
|
|
|
|
anchors.top: browserBtn.top
|
|
|
|
icon.name: "profile"
|
2020-10-26 16:20:31 -04:00
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
id: profileBadge
|
|
|
|
visible: !profileModel.isMnemonicBackedUp && sLayout.children[sLayout.currentIndex] !== profileLayoutContainer
|
2020-10-28 11:15:39 +01:00
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.left: parent.right
|
2020-10-26 16:20:31 -04:00
|
|
|
anchors.leftMargin: -10
|
|
|
|
anchors.topMargin: -5
|
2020-10-28 11:15:39 +01:00
|
|
|
radius: width / 2
|
2020-10-26 16:20:31 -04:00
|
|
|
color: Style.current.blue
|
|
|
|
width: 18
|
|
|
|
height: 18
|
|
|
|
Text {
|
|
|
|
font.pixelSize: 12
|
|
|
|
color: Style.current.white
|
|
|
|
anchors.centerIn: parent
|
|
|
|
text: "1"
|
|
|
|
}
|
|
|
|
}
|
2020-05-12 07:24:08 +10:00
|
|
|
}
|
2020-05-15 17:10:00 -04:00
|
|
|
|
2020-10-27 13:46:19 +01:00
|
|
|
StatusIconTabButton {
|
|
|
|
id: nodeBtn
|
|
|
|
enabled: isExperimental === "1"
|
|
|
|
anchors.top: profileBtn.top
|
|
|
|
icon.name: "node"
|
2020-05-15 17:10:00 -04:00
|
|
|
}
|
2020-08-25 11:00:03 +02:00
|
|
|
|
2020-10-27 13:46:19 +01:00
|
|
|
StatusIconTabButton {
|
|
|
|
id: uiComponentBtn
|
|
|
|
enabled: isExperimental === "1"
|
|
|
|
anchors.top: nodeBtn.top
|
|
|
|
icon.name: "node"
|
2020-08-25 11:00:03 +02:00
|
|
|
}
|
2020-05-12 07:24:08 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
StackLayout {
|
2020-10-26 16:20:31 -04:00
|
|
|
id: sLayout
|
2020-05-13 10:40:51 -04:00
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
|
|
|
|
Layout.fillHeight: true
|
2020-05-12 07:24:08 +10:00
|
|
|
currentIndex: tabBar.currentIndex
|
2020-09-23 09:28:20 +02:00
|
|
|
onCurrentIndexChanged: {
|
|
|
|
if (typeof this.children[currentIndex].onActivated === "function") {
|
|
|
|
this.children[currentIndex].onActivated()
|
|
|
|
}
|
2020-10-07 15:49:26 -04:00
|
|
|
|
|
|
|
if(this.children[currentIndex] === browserLayoutContainer && browserLayoutContainer.active == false){
|
|
|
|
browserLayoutContainer.active = true;
|
|
|
|
}
|
2020-09-23 09:28:20 +02:00
|
|
|
}
|
2020-05-12 07:24:08 +10:00
|
|
|
|
2020-05-13 13:27:06 -04:00
|
|
|
ChatLayout {
|
|
|
|
id: chatLayoutContainer
|
2020-05-12 07:24:08 +10:00
|
|
|
Layout.fillWidth: true
|
2020-05-13 13:27:06 -04:00
|
|
|
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
|
|
|
|
Layout.fillHeight: true
|
2020-05-12 07:24:08 +10:00
|
|
|
}
|
2020-05-13 14:17:18 -04:00
|
|
|
|
|
|
|
WalletLayout {
|
|
|
|
id: walletLayoutContainer
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
|
|
|
|
Layout.fillHeight: true
|
|
|
|
}
|
2020-05-15 17:10:00 -04:00
|
|
|
|
2020-10-07 15:49:26 -04:00
|
|
|
Component {
|
|
|
|
id: browserLayoutComponent
|
|
|
|
BrowserLayout { }
|
|
|
|
}
|
|
|
|
|
|
|
|
Loader {
|
2020-09-22 10:12:48 -05:00
|
|
|
id: browserLayoutContainer
|
2020-10-07 15:49:26 -04:00
|
|
|
sourceComponent: browserLayoutComponent
|
|
|
|
active: false
|
2020-09-22 10:12:48 -05:00
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
|
|
|
|
Layout.fillHeight: true
|
2020-10-07 15:49:26 -04:00
|
|
|
// Loaders do not have access to the context, so props need to be set
|
|
|
|
// Adding a "_" to avoid a binding loop
|
|
|
|
property var _chatsModel: chatsModel
|
|
|
|
property var _walletModel: walletModel
|
|
|
|
property var _utilsModel: utilsModel
|
|
|
|
property var _web3Provider: web3Provider
|
2020-09-22 10:12:48 -05:00
|
|
|
}
|
|
|
|
|
2020-05-19 14:44:45 -05:00
|
|
|
ProfileLayout {
|
|
|
|
id: profileLayoutContainer
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
|
|
|
|
Layout.fillHeight: true
|
2020-05-15 17:10:00 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
NodeLayout {
|
|
|
|
id: nodeLayoutContainer
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
|
|
|
|
Layout.fillHeight: true
|
|
|
|
}
|
2020-08-25 11:00:03 +02:00
|
|
|
|
|
|
|
UIComponents {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
|
|
|
|
Layout.fillHeight: true
|
|
|
|
}
|
2020-05-12 07:24:08 +10:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*##^##
|
|
|
|
Designer {
|
2020-05-13 13:27:06 -04:00
|
|
|
D{i:0;formeditorZoom:0.33000001311302185;height:770;width:1232}
|
2020-05-12 07:24:08 +10:00
|
|
|
}
|
|
|
|
##^##*/
|