parent
531b2771a3
commit
d1b46c0226
|
@ -41,11 +41,14 @@ proc init*(self: ProfileController, account: Account) =
|
||||||
let appearance = self.status.settings.getSetting[:int](Setting.Appearance)
|
let appearance = self.status.settings.getSetting[:int](Setting.Appearance)
|
||||||
let messagesFromContactsOnly = self.status.settings.getSetting[:bool](Setting.MessagesFromContactsOnly)
|
let messagesFromContactsOnly = self.status.settings.getSetting[:bool](Setting.MessagesFromContactsOnly)
|
||||||
let sendUserStatus = self.status.settings.getSetting[:bool](Setting.SendUserStatus)
|
let sendUserStatus = self.status.settings.getSetting[:bool](Setting.SendUserStatus)
|
||||||
|
let currentUserStatus = self.status.settings.getSetting[:JsonNode](Setting.CurrentUserStatus)["statusType"].getInt()
|
||||||
|
|
||||||
profile.appearance = appearance
|
profile.appearance = appearance
|
||||||
profile.id = pubKey
|
profile.id = pubKey
|
||||||
profile.address = account.keyUid
|
profile.address = account.keyUid
|
||||||
profile.messagesFromContactsOnly = messagesFromContactsOnly
|
profile.messagesFromContactsOnly = messagesFromContactsOnly
|
||||||
profile.sendUserStatus = sendUserStatus
|
profile.sendUserStatus = sendUserStatus
|
||||||
|
profile.currentUserStatus = currentUserStatus
|
||||||
|
|
||||||
let identityImage = self.status.profile.getIdentityImage(profile.address)
|
let identityImage = self.status.profile.getIdentityImage(profile.address)
|
||||||
|
|
||||||
|
|
|
@ -186,4 +186,3 @@ QtObject:
|
||||||
return
|
return
|
||||||
self.profile.setSendUserStatus(sendUserStatus)
|
self.profile.setSendUserStatus(sendUserStatus)
|
||||||
self.status.saveSetting(Setting.SendUserStatus, sendUserStatus)
|
self.status.saveSetting(Setting.SendUserStatus, sendUserStatus)
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,7 @@ QtObject:
|
||||||
ensVerified*: bool
|
ensVerified*: bool
|
||||||
messagesFromContactsOnly*: bool
|
messagesFromContactsOnly*: bool
|
||||||
sendUserStatus*: bool
|
sendUserStatus*: bool
|
||||||
|
currentUserStatus*: int
|
||||||
|
|
||||||
proc setup(self: ProfileInfoView) =
|
proc setup(self: ProfileInfoView) =
|
||||||
self.QObject.setup
|
self.QObject.setup
|
||||||
|
@ -33,10 +34,12 @@ QtObject:
|
||||||
result.ensVerified = false
|
result.ensVerified = false
|
||||||
result.messagesFromContactsOnly = false
|
result.messagesFromContactsOnly = false
|
||||||
result.sendUserStatus = false
|
result.sendUserStatus = false
|
||||||
|
result.currentUserStatus = 0
|
||||||
result.setup
|
result.setup
|
||||||
|
|
||||||
proc identityImageChanged*(self: ProfileInfoView) {.signal.}
|
proc identityImageChanged*(self: ProfileInfoView) {.signal.}
|
||||||
proc sendUserStatusChanged*(self: ProfileInfoView) {.signal.}
|
proc sendUserStatusChanged*(self: ProfileInfoView) {.signal.}
|
||||||
|
proc currentUserStatusChanged*(self: ProfileInfoView) {.signal.}
|
||||||
proc appearanceChanged*(self: ProfileInfoView) {.signal.}
|
proc appearanceChanged*(self: ProfileInfoView) {.signal.}
|
||||||
proc messagesFromContactsOnlyChanged*(self: ProfileInfoView) {.signal.}
|
proc messagesFromContactsOnlyChanged*(self: ProfileInfoView) {.signal.}
|
||||||
|
|
||||||
|
@ -50,6 +53,7 @@ QtObject:
|
||||||
self.identityImage = profile.identityImage
|
self.identityImage = profile.identityImage
|
||||||
self.messagesFromContactsOnly = profile.messagesFromContactsOnly
|
self.messagesFromContactsOnly = profile.messagesFromContactsOnly
|
||||||
self.sendUserStatus = profile.sendUserStatus
|
self.sendUserStatus = profile.sendUserStatus
|
||||||
|
self.currentUserStatus = profile.currentUserStatus
|
||||||
|
|
||||||
proc username*(self: ProfileInfoView): string {.slot.} = result = self.username
|
proc username*(self: ProfileInfoView): string {.slot.} = result = self.username
|
||||||
|
|
||||||
|
@ -145,4 +149,16 @@ QtObject:
|
||||||
QtProperty[bool] sendUserStatus:
|
QtProperty[bool] sendUserStatus:
|
||||||
read = sendUserStatus
|
read = sendUserStatus
|
||||||
write = setSendUserStatus
|
write = setSendUserStatus
|
||||||
notify = sendUserStatusChanged
|
notify = sendUserStatusChanged
|
||||||
|
|
||||||
|
proc currentUserStatus*(self: ProfileInfoView): int {.slot.} = result = self.currentUserStatus
|
||||||
|
proc setCurrentUserStatus*(self: ProfileInfoView, currentUserStatus: int) {.slot.} =
|
||||||
|
if self.currentUserStatus == currentUserStatus:
|
||||||
|
return
|
||||||
|
self.currentUserStatus = currentUserStatus
|
||||||
|
self.currentUserStatusChanged()
|
||||||
|
|
||||||
|
QtProperty[int] currentUserStatus:
|
||||||
|
read = currentUserStatus
|
||||||
|
write = setCurrentUserStatus
|
||||||
|
notify = currentUserStatusChanged
|
||||||
|
|
|
@ -6,6 +6,7 @@ type Profile* = ref object
|
||||||
ensVerified*: bool
|
ensVerified*: bool
|
||||||
messagesFromContactsOnly*: bool
|
messagesFromContactsOnly*: bool
|
||||||
sendUserStatus*: bool
|
sendUserStatus*: bool
|
||||||
|
currentUserStatus*: int
|
||||||
identityImage*: IdentityImage
|
identityImage*: IdentityImage
|
||||||
appearance*: int
|
appearance*: int
|
||||||
systemTags*: seq[string]
|
systemTags*: seq[string]
|
||||||
|
|
|
@ -203,6 +203,8 @@ type
|
||||||
PinnedMailservers = "pinned-mailservers"
|
PinnedMailservers = "pinned-mailservers"
|
||||||
WakuBloomFilterMode = "waku-bloom-filter-mode"
|
WakuBloomFilterMode = "waku-bloom-filter-mode"
|
||||||
SendUserStatus = "send-status-updates?"
|
SendUserStatus = "send-status-updates?"
|
||||||
|
CurrentUserStatus = "current-user-status"
|
||||||
|
|
||||||
|
|
||||||
UpstreamConfig* = ref object
|
UpstreamConfig* = ref object
|
||||||
enabled* {.serializedFieldName("Enabled").}: bool
|
enabled* {.serializedFieldName("Enabled").}: bool
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit a8e830f76caca16718353b84dfe77b5eac363943
|
Subproject commit 2e1359c9e253b5fa128e892ab6f3f9905b0ce42d
|
|
@ -18,7 +18,6 @@ StatusAppThreePanelLayout {
|
||||||
|
|
||||||
property alias chatColumn: chatColumn
|
property alias chatColumn: chatColumn
|
||||||
property bool stickersLoaded: false
|
property bool stickersLoaded: false
|
||||||
property bool profilePopupOpened: false
|
|
||||||
signal profileButtonClicked()
|
signal profileButtonClicked()
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
|
@ -88,28 +87,6 @@ StatusAppThreePanelLayout {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function openProfilePopup(userNameParam, fromAuthorParam, identiconParam, textParam, nicknameParam, parentPopup){
|
|
||||||
var popup = profilePopupComponent.createObject(chatView);
|
|
||||||
if(parentPopup){
|
|
||||||
popup.parentPopup = parentPopup;
|
|
||||||
}
|
|
||||||
popup.openPopup(profileModel.profile.pubKey !== fromAuthorParam, userNameParam, fromAuthorParam, identiconParam, textParam, nicknameParam);
|
|
||||||
profilePopupOpened = true
|
|
||||||
}
|
|
||||||
|
|
||||||
property Component profilePopupComponent: ProfilePopup {
|
|
||||||
id: profilePopup
|
|
||||||
height: 504
|
|
||||||
onClosed: {
|
|
||||||
if(profilePopup.parentPopup){
|
|
||||||
profilePopup.parentPopup.close();
|
|
||||||
}
|
|
||||||
profilePopupOpened = false
|
|
||||||
destroy()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ConfirmationDialog {
|
ConfirmationDialog {
|
||||||
id: removeContactConfirmationDialog
|
id: removeContactConfirmationDialog
|
||||||
// % "Remove contact"
|
// % "Remove contact"
|
||||||
|
|
|
@ -156,23 +156,6 @@ ScrollView {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Loader {
|
|
||||||
active: onlineUsers.switchChecked
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.right: parent.right
|
|
||||||
sourceComponent: StatusSettingsLineButton {
|
|
||||||
//% "Broadcast user status"
|
|
||||||
text: qsTrId("broadcast-user-status")
|
|
||||||
isSwitch: true
|
|
||||||
switchChecked: profileModel.profile.sendUserStatus
|
|
||||||
onClicked: function (checked) {
|
|
||||||
if (profileModel.profile.sendUserStatus !== checked) {
|
|
||||||
profileModel.setSendUserStatus(checked)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
StatusSettingsLineButton {
|
StatusSettingsLineButton {
|
||||||
//% "GIF Widget"
|
//% "GIF Widget"
|
||||||
text: qsTrId("gif-widget")
|
text: qsTrId("gif-widget")
|
||||||
|
|
|
@ -24,6 +24,9 @@ StatusAppLayout {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
property alias appSettings: appSettings
|
property alias appSettings: appSettings
|
||||||
|
|
||||||
|
property bool profilePopupOpened: false
|
||||||
|
|
||||||
signal settingsLoaded()
|
signal settingsLoaded()
|
||||||
|
|
||||||
function changeAppSection(section) {
|
function changeAppSection(section) {
|
||||||
|
@ -106,6 +109,27 @@ StatusAppLayout {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function openProfilePopup(userNameParam, fromAuthorParam, identiconParam, textParam, nicknameParam, parentPopup){
|
||||||
|
var popup = profilePopupComponent.createObject(appMain);
|
||||||
|
if(parentPopup){
|
||||||
|
popup.parentPopup = parentPopup;
|
||||||
|
}
|
||||||
|
popup.openPopup(profileModel.profile.pubKey !== fromAuthorParam, userNameParam, fromAuthorParam, identiconParam, textParam, nicknameParam);
|
||||||
|
profilePopupOpened = true
|
||||||
|
}
|
||||||
|
|
||||||
|
property Component profilePopupComponent: ProfilePopup {
|
||||||
|
id: profilePopup
|
||||||
|
height: 504
|
||||||
|
onClosed: {
|
||||||
|
if(profilePopup.parentPopup){
|
||||||
|
profilePopup.parentPopup.close();
|
||||||
|
}
|
||||||
|
profilePopupOpened = false
|
||||||
|
destroy()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
appNavBar: StatusAppNavBar {
|
appNavBar: StatusAppNavBar {
|
||||||
height: appMain.height
|
height: appMain.height
|
||||||
|
@ -254,6 +278,37 @@ StatusAppLayout {
|
||||||
badge.border.width: 2
|
badge.border.width: 2
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
navBarProfileButton: StatusNavBarTabButton {
|
||||||
|
id: profileButton
|
||||||
|
icon.source: profileModel.profile.thumbnailImage || ""
|
||||||
|
badge.visible: true
|
||||||
|
badge.anchors.rightMargin: 4
|
||||||
|
badge.anchors.topMargin: 25
|
||||||
|
badge.implicitHeight: 15
|
||||||
|
badge.implicitWidth: 15
|
||||||
|
badge.border.color: hovered ? Theme.palette.statusBadge.hoverBorderColor : Theme.palette.statusAppNavBar.backgroundColor
|
||||||
|
badge.color: {
|
||||||
|
return profileModel.profile.sendUserStatus ? Style.current.green : Style.current.darkGrey
|
||||||
|
/*
|
||||||
|
// Use this code once support for custom user status is added
|
||||||
|
switch(profileModel.profile.currentUserStatus){
|
||||||
|
case Constants.statusType_Online:
|
||||||
|
return Style.current.green;
|
||||||
|
case Constants.statusType_DoNotDisturb:
|
||||||
|
return Style.current.red;
|
||||||
|
default:
|
||||||
|
return Style.current.darkGrey;
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
badge.border.width: 3
|
||||||
|
onClicked: userStatusContextMenu.open()
|
||||||
|
|
||||||
|
UserStatusContextMenu {
|
||||||
|
id: userStatusContextMenu
|
||||||
|
y: profileButton.y - userStatusContextMenu.height
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
appView: StackLayout {
|
appView: StackLayout {
|
||||||
|
|
|
@ -14,8 +14,10 @@ Menu {
|
||||||
topPadding: paddingSize
|
topPadding: paddingSize
|
||||||
bottomPadding: paddingSize
|
bottomPadding: paddingSize
|
||||||
|
|
||||||
|
property string overrideTextColor: ""
|
||||||
|
|
||||||
delegate: MenuItem {
|
delegate: MenuItem {
|
||||||
property color textColor: this.action.icon.color.toString() !== "#00000000" ? this.action.icon.color : Style.current.textColor
|
property color textColor: popupMenu.overrideTextColor !== "" ? popupMenu.overrideTextColor : (this.action.icon.color.toString() !== "#00000000" ? this.action.icon.color : Style.current.textColor)
|
||||||
property color hoverColor: popupMenuItem.action.icon.color === Style.current.danger ? Style.current.buttonWarnBackgroundColor : Style.current.backgroundHover
|
property color hoverColor: popupMenuItem.action.icon.color === Style.current.danger ? Style.current.buttonWarnBackgroundColor : Style.current.backgroundHover
|
||||||
property int subMenuIndex: {
|
property int subMenuIndex: {
|
||||||
if (!this.subMenu) {
|
if (!this.subMenu) {
|
||||||
|
|
|
@ -0,0 +1,110 @@
|
||||||
|
import QtQuick 2.12
|
||||||
|
import QtQuick.Controls 2.3
|
||||||
|
import QtQuick.Layouts 1.3
|
||||||
|
import QtQml.Models 2.3
|
||||||
|
import "../imports"
|
||||||
|
import "status"
|
||||||
|
import "./"
|
||||||
|
|
||||||
|
PopupMenu {
|
||||||
|
id: root
|
||||||
|
width: profileHeader.width
|
||||||
|
closePolicy: Popup.CloseOnPressOutside | Popup.CloseOnEscape
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: profileHeader
|
||||||
|
width: 200
|
||||||
|
height: visible ? profileImage.height + username.height + viewProfileBtn.height + Style.current.padding * 2 : 0
|
||||||
|
Rectangle {
|
||||||
|
anchors.fill: parent
|
||||||
|
visible: mouseArea.containsMouse
|
||||||
|
color: Style.current.backgroundHover
|
||||||
|
}
|
||||||
|
StatusImageIdenticon {
|
||||||
|
id: profileImage
|
||||||
|
source: profileModel.profile.thumbnailImage || ""
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.topMargin: 4
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
id: username
|
||||||
|
text: Utils.removeStatusEns(profileModel.ens.preferredUsername || profileModel.profile.username)
|
||||||
|
elide: Text.ElideRight
|
||||||
|
maximumLineCount: 3
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
wrapMode: Text.Wrap
|
||||||
|
anchors.top: profileImage.bottom
|
||||||
|
anchors.topMargin: 4
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.leftMargin: Style.current.smallPadding
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.rightMargin: Style.current.smallPadding
|
||||||
|
font.weight: Font.Medium
|
||||||
|
font.pixelSize: 13
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
id: viewProfileBtn
|
||||||
|
text: qsTr("My profile →")
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
anchors.top: username.bottom
|
||||||
|
anchors.topMargin: 4
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.leftMargin: Style.current.smallPadding
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.rightMargin: Style.current.smallPadding
|
||||||
|
font.weight: Font.Medium
|
||||||
|
font.pixelSize: 12
|
||||||
|
color: Style.current.secondaryText
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
id: mouseArea
|
||||||
|
anchors.fill: parent
|
||||||
|
hoverEnabled: true
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
onClicked: {
|
||||||
|
openProfilePopup(profileModel.profile.username, profileModel.profile.pubKey, profileModel.profile.thumbnailImage || "");
|
||||||
|
root.close()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Separator {
|
||||||
|
anchors.bottom: viewProfileAction.top
|
||||||
|
}
|
||||||
|
|
||||||
|
overrideTextColor: Style.current.textColor
|
||||||
|
|
||||||
|
Action {
|
||||||
|
text: qsTr("Online")
|
||||||
|
onTriggered: {
|
||||||
|
if (profileModel.profile.sendUserStatus != true) {
|
||||||
|
profileModel.setSendUserStatus(true)
|
||||||
|
}
|
||||||
|
root.close()
|
||||||
|
}
|
||||||
|
icon.color: Style.current.green
|
||||||
|
icon.source: "img/online.svg"
|
||||||
|
icon.width: 16
|
||||||
|
icon.height: 16
|
||||||
|
}
|
||||||
|
|
||||||
|
Action {
|
||||||
|
text: qsTr("Offline")
|
||||||
|
onTriggered: {
|
||||||
|
if (profileModel.profile.sendUserStatus != false) {
|
||||||
|
profileModel.setSendUserStatus(false)
|
||||||
|
}
|
||||||
|
root.close()
|
||||||
|
}
|
||||||
|
|
||||||
|
icon.color: Style.current.darkGrey
|
||||||
|
icon.source: "img/offline.svg"
|
||||||
|
icon.width: 16
|
||||||
|
icon.height: 16
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<circle cx="7.5" cy="7.5" r="5" fill="#939BA1"/>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 152 B |
|
@ -0,0 +1,3 @@
|
||||||
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<circle cx="7.5" cy="7.5" r="5" fill="#4EBC60"/>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 152 B |
Loading…
Reference in New Issue