2022-10-20 15:12:38 +00:00
|
|
|
import QtQuick 2.14
|
|
|
|
import QtQuick.Controls 2.14
|
2022-10-24 10:58:00 +00:00
|
|
|
import QtQuick.Layouts 1.14
|
2022-10-20 15:12:38 +00:00
|
|
|
|
|
|
|
import Storybook 1.0
|
|
|
|
|
|
|
|
import utils 1.0
|
|
|
|
import shared.views 1.0
|
|
|
|
|
|
|
|
SplitView {
|
|
|
|
id: root
|
|
|
|
|
2022-10-24 10:58:00 +00:00
|
|
|
property bool globalUtilsReady: false
|
|
|
|
property bool mainModuleReady: false
|
|
|
|
|
|
|
|
// globalUtilsInst mock
|
2022-10-20 15:12:38 +00:00
|
|
|
QtObject {
|
2022-10-24 10:58:00 +00:00
|
|
|
function getEmojiHashAsJson(publicKey) {
|
|
|
|
return JSON.stringify(["👨🏻🍼", "🏃🏿♂️", "🌇", "🤶🏿", "🏮","🤷🏻♂️", "🤦🏻", "📣", "🤎", "👷🏽", "😺", "🥞", "🔃", "🧝🏽♂️"])
|
|
|
|
}
|
|
|
|
function getColorId(publicKey) { return colorId.value }
|
|
|
|
|
|
|
|
function getCompressedPk(publicKey) { return "zx3sh" + publicKey }
|
|
|
|
|
|
|
|
function getColorHashAsJson(publicKey) { return JSON.stringify("") } // TODO
|
|
|
|
|
2022-10-20 15:12:38 +00:00
|
|
|
Component.onCompleted: {
|
2022-10-24 10:58:00 +00:00
|
|
|
Utils.globalUtilsInst = this
|
|
|
|
root.globalUtilsReady = true
|
|
|
|
|
|
|
|
}
|
|
|
|
Component.onDestruction: {
|
|
|
|
root.globalUtilsReady = false
|
|
|
|
Utils.globalUtilsInst = {}
|
2022-10-20 15:12:38 +00:00
|
|
|
}
|
2022-10-24 10:58:00 +00:00
|
|
|
}
|
2022-10-20 15:12:38 +00:00
|
|
|
|
2022-10-24 10:58:00 +00:00
|
|
|
// mainModuleInst mock
|
|
|
|
QtObject {
|
|
|
|
function getContactDetailsAsJson(publicKey, getVerificationRequest) {
|
|
|
|
return JSON.stringify({ displayName: displayName.text || "Mock User Name",
|
|
|
|
optionalName: optionalName.text,
|
|
|
|
displayIcon: "",
|
|
|
|
publicKey: publicKey,
|
|
|
|
name: name.text,
|
|
|
|
ensVerified: ensVerified.checked,
|
|
|
|
alias: "Mock Alias Triplet",
|
|
|
|
lastUpdated: Date.now(),
|
|
|
|
lastUpdatedLocally: Date.now(),
|
|
|
|
localNickname: "MockNickname",
|
|
|
|
thumbnailImage: "",
|
|
|
|
largeImage: userImage.checked ? Style.png("status-logo") : "",
|
|
|
|
isContact: isContact.checked,
|
|
|
|
isAdded: isAdded.checked,
|
|
|
|
isBlocked: isBlocked.checked,
|
|
|
|
removed: removed.checked,
|
|
|
|
requestReceived: hasAddedUs.checked,
|
|
|
|
hasAddedUs: hasAddedUs.checked, // same as above
|
|
|
|
isSyncing: false,
|
|
|
|
trustStatus: trustStatus.currentValue,
|
|
|
|
verificationStatus: Constants.verificationStatus.unverified,
|
|
|
|
incomingVerificationStatus: Constants.verificationStatus.unverified,
|
|
|
|
bio: bio.text,
|
|
|
|
socialLinks: "" // TODO
|
|
|
|
})
|
|
|
|
}
|
|
|
|
Component.onCompleted: {
|
|
|
|
root.mainModuleReady = true
|
|
|
|
Utils.mainModuleInst = this
|
|
|
|
}
|
2022-10-20 15:12:38 +00:00
|
|
|
Component.onDestruction: {
|
2022-10-24 10:58:00 +00:00
|
|
|
root.mainModuleReady = false
|
|
|
|
Utils.mainModuleInst = {}
|
2022-10-20 15:12:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Logs { id: logs }
|
|
|
|
|
|
|
|
SplitView {
|
|
|
|
orientation: Qt.Vertical
|
|
|
|
SplitView.fillWidth: true
|
|
|
|
|
|
|
|
Item {
|
|
|
|
SplitView.fillWidth: true
|
|
|
|
SplitView.fillHeight: true
|
|
|
|
|
|
|
|
ScrollView {
|
|
|
|
width: parent.width
|
|
|
|
height: parent.height
|
|
|
|
clip: true
|
|
|
|
|
2022-10-24 10:58:00 +00:00
|
|
|
Loader {
|
|
|
|
active: root.globalUtilsReady && root.mainModuleReady
|
|
|
|
width: parent.availableWidth
|
|
|
|
height: parent.availableHeight
|
2022-10-20 15:12:38 +00:00
|
|
|
|
2022-10-24 10:58:00 +00:00
|
|
|
sourceComponent: ProfileDialogView {
|
|
|
|
implicitWidth: 640
|
2022-10-20 15:12:38 +00:00
|
|
|
|
2022-10-24 10:58:00 +00:00
|
|
|
publicKey: switchOwnProfile.checked ? "0xdeadbeef" : "0xrandomguy"
|
2022-10-20 15:12:38 +00:00
|
|
|
|
2022-10-24 10:58:00 +00:00
|
|
|
Component.onCompleted: {
|
|
|
|
Global.appMain = root // FIXME this is here for the popups to work
|
2022-10-20 15:12:38 +00:00
|
|
|
}
|
|
|
|
|
2022-10-24 10:58:00 +00:00
|
|
|
profileStore: QtObject {
|
|
|
|
readonly property string pubkey: "0xdeadbeef"
|
|
|
|
readonly property string ensName: name.text
|
2022-10-20 15:12:38 +00:00
|
|
|
|
2022-10-24 10:58:00 +00:00
|
|
|
function getQrCodeSource() {
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
function copyToClipboard(text) {
|
|
|
|
logs.logEvent("profileStore::copyToClipboard", ["text"], arguments)
|
|
|
|
}
|
2022-10-20 15:12:38 +00:00
|
|
|
}
|
|
|
|
|
2022-10-24 10:58:00 +00:00
|
|
|
contactsStore: QtObject {
|
|
|
|
readonly property string myPublicKey: "0xdeadbeef"
|
2022-10-20 15:12:38 +00:00
|
|
|
|
2022-10-24 10:58:00 +00:00
|
|
|
function hasReceivedVerificationRequestFrom(publicKey) {
|
|
|
|
return false
|
|
|
|
}
|
2022-10-20 15:12:38 +00:00
|
|
|
|
2022-10-24 10:58:00 +00:00
|
|
|
function joinPrivateChat(publicKey) {
|
|
|
|
logs.logEvent("contactsStore::joinPrivateChat", ["publicKey"], arguments)
|
|
|
|
}
|
2022-10-20 15:12:38 +00:00
|
|
|
|
2022-10-24 10:58:00 +00:00
|
|
|
function markUntrustworthy(publicKey) {
|
|
|
|
logs.logEvent("contactsStore::markUntrustworthy", ["publicKey"], arguments)
|
|
|
|
}
|
2022-10-20 15:12:38 +00:00
|
|
|
|
2022-10-24 10:58:00 +00:00
|
|
|
function removeContact(publicKey) {
|
|
|
|
logs.logEvent("contactsStore::removeContact", ["publicKey"], arguments)
|
|
|
|
}
|
2022-10-20 15:12:38 +00:00
|
|
|
|
2022-10-24 10:58:00 +00:00
|
|
|
function acceptContactRequest(publicKey) {
|
|
|
|
logs.logEvent("contactsStore::acceptContactRequest", ["publicKey"], arguments)
|
|
|
|
}
|
2022-10-20 15:12:38 +00:00
|
|
|
|
2022-10-24 10:58:00 +00:00
|
|
|
function dismissContactRequest(publicKey) {
|
|
|
|
logs.logEvent("contactsStore::dismissContactRequest", ["publicKey"], arguments)
|
|
|
|
}
|
2022-10-20 15:12:38 +00:00
|
|
|
|
2022-10-24 10:58:00 +00:00
|
|
|
function removeTrustStatus(publicKey) {
|
|
|
|
logs.logEvent("contactsStore::removeTrustStatus", ["publicKey"], arguments)
|
|
|
|
}
|
|
|
|
|
|
|
|
function removeContactRequestRejection(publicKey) {
|
|
|
|
logs.logEvent("contactsStore::removeContactRequestRejection", ["publicKey"], arguments)
|
|
|
|
}
|
|
|
|
|
|
|
|
function verifiedUntrustworthy(publicKey) {
|
|
|
|
logs.logEvent("contactsStore::verifiedUntrustworthy", ["publicKey"], arguments)
|
|
|
|
}
|
2022-10-20 15:12:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
LogsAndControlsPanel {
|
|
|
|
SplitView.minimumHeight: 100
|
2022-10-24 10:58:00 +00:00
|
|
|
SplitView.preferredHeight: 350
|
2022-10-20 15:12:38 +00:00
|
|
|
|
|
|
|
logsView.logText: logs.logText
|
|
|
|
|
2022-10-24 10:58:00 +00:00
|
|
|
ColumnLayout {
|
|
|
|
width: parent.width
|
|
|
|
RowLayout {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Switch {
|
|
|
|
id: switchOwnProfile
|
|
|
|
text: "Own profile"
|
|
|
|
checked: false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
RowLayout {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Label { text: "displayName:" }
|
|
|
|
TextField {
|
|
|
|
id: displayName
|
|
|
|
placeholderText: "Display Name"
|
|
|
|
}
|
|
|
|
Label { text: "optionalName:" }
|
|
|
|
TextField {
|
|
|
|
id: optionalName
|
|
|
|
placeholderText: "Optional/Original Name"
|
|
|
|
text: ""
|
|
|
|
}
|
|
|
|
}
|
|
|
|
RowLayout {
|
|
|
|
CheckBox {
|
|
|
|
id: userImage
|
|
|
|
text: "User image"
|
|
|
|
checked: true
|
|
|
|
}
|
|
|
|
Label {
|
|
|
|
font.italic: true
|
|
|
|
text: "or"
|
|
|
|
}
|
|
|
|
Label {
|
|
|
|
enabled: !userImage.checked
|
|
|
|
text: "colorId"
|
|
|
|
}
|
|
|
|
SpinBox {
|
|
|
|
id: colorId
|
|
|
|
enabled: !userImage.checked
|
|
|
|
from: 0
|
|
|
|
to: 11 // Theme.palette.userCustomizationColors.length
|
|
|
|
}
|
|
|
|
}
|
|
|
|
RowLayout {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
CheckBox {
|
|
|
|
id: ensVerified
|
|
|
|
checked: true
|
|
|
|
text: "ensVerified"
|
|
|
|
}
|
|
|
|
|
|
|
|
Label { text: "name:" }
|
|
|
|
TextField {
|
|
|
|
id: name
|
|
|
|
enabled: ensVerified.checked
|
|
|
|
text: ensVerified.checked ? "mock-ens-name" : ""
|
|
|
|
placeholderText: "ENS name"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
RowLayout {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
enabled: !switchOwnProfile.checked
|
|
|
|
CheckBox {
|
|
|
|
id: isContact
|
|
|
|
enabled: false
|
|
|
|
checked: isAdded.checked && hasAddedUs.checked
|
|
|
|
text: "isContact"
|
|
|
|
}
|
|
|
|
CheckBox {
|
|
|
|
id: isAdded
|
|
|
|
checked: true
|
|
|
|
text: "isAdded"
|
|
|
|
}
|
|
|
|
CheckBox {
|
|
|
|
id: hasAddedUs
|
|
|
|
checked: true
|
|
|
|
text: "hasAddedUs"
|
|
|
|
}
|
|
|
|
CheckBox {
|
|
|
|
id: removed
|
|
|
|
text: "removed"
|
|
|
|
}
|
|
|
|
CheckBox {
|
|
|
|
id: isBlocked
|
|
|
|
text: "isBlocked"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
RowLayout {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
enabled: !switchOwnProfile.checked
|
|
|
|
Label { text: "trustStatus:" }
|
|
|
|
ComboBox {
|
|
|
|
id: trustStatus
|
|
|
|
textRole: "text"
|
|
|
|
valueRole: "value"
|
|
|
|
model: [
|
|
|
|
{ value: Constants.trustStatus.unknown, text: "unknown" },
|
|
|
|
{ value: Constants.trustStatus.trusted, text: "trusted" },
|
|
|
|
{ value: Constants.trustStatus.untrustworthy, text: "untrustworthy" }
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
RowLayout {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Label { text: "Bio:" }
|
|
|
|
TextField {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
id: bio
|
|
|
|
text: "Hello from MockMainModule, I am a mock user and this is my bio."
|
|
|
|
}
|
2022-10-20 15:12:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|