From 17729ce662528be1949b3157513d9c4a1db987de Mon Sep 17 00:00:00 2001 From: Loren Burkholder Date: Sat, 4 Sep 2021 20:54:02 -0400 Subject: [PATCH] Fix jdenticons in various places --- resources/qml/dialogs/ImagePackEditorDialog.qml | 4 +++- resources/qml/dialogs/ImagePackSettingsDialog.qml | 3 ++- resources/qml/voip/ActiveCallBar.qml | 4 ++-- resources/qml/voip/CallInvite.qml | 5 +++-- resources/qml/voip/CallInviteBar.qml | 5 +++-- src/CallManager.cpp | 9 +++++++-- src/CallManager.h | 3 +++ 7 files changed, 23 insertions(+), 10 deletions(-) diff --git a/resources/qml/dialogs/ImagePackEditorDialog.qml b/resources/qml/dialogs/ImagePackEditorDialog.qml index 9125e560..f927a745 100644 --- a/resources/qml/dialogs/ImagePackEditorDialog.qml +++ b/resources/qml/dialogs/ImagePackEditorDialog.qml @@ -61,6 +61,7 @@ ApplicationWindow { header: AvatarListTile { title: imagePack.packname avatarUrl: imagePack.avatarUrl + userid: imagePack.packname subtitle: imagePack.statekey index: -1 selectedIndex: currentImageIndex @@ -111,7 +112,6 @@ ApplicationWindow { title: shortCode subtitle: body avatarUrl: url - roomid: imagePack.roomid selectedIndex: currentImageIndex crop: false @@ -143,6 +143,7 @@ ApplicationWindow { Layout.columnSpan: 2 url: imagePack.avatarUrl.replace("mxc://", "image://MxcImage/") displayName: imagePack.packname + userid: imagePack.packname height: 130 width: 130 crop: false @@ -220,6 +221,7 @@ ApplicationWindow { Layout.columnSpan: 2 url: imagePack.data(imagePack.index(currentImageIndex, 0), SingleImagePackModel.Url).replace("mxc://", "image://MxcImage/") displayName: imagePack.data(imagePack.index(currentImageIndex, 0), SingleImagePackModel.ShortCode) + userid: displayName height: 130 width: 130 crop: false diff --git a/resources/qml/dialogs/ImagePackSettingsDialog.qml b/resources/qml/dialogs/ImagePackSettingsDialog.qml index 4cc7bcd3..4aee4a78 100644 --- a/resources/qml/dialogs/ImagePackSettingsDialog.qml +++ b/resources/qml/dialogs/ImagePackSettingsDialog.qml @@ -112,7 +112,7 @@ ApplicationWindow { return qsTr("Globally enabled pack"); } selectedIndex: currentPackIndex - roomid: currentPack.roomid + userid: displayName TapHandler { onSingleTapped: currentPackIndex = index @@ -144,6 +144,7 @@ ApplicationWindow { Avatar { url: packinfo.avatarUrl.replace("mxc://", "image://MxcImage/") displayName: packinfo.packName + userid: packinfo.packName height: 100 width: 100 Layout.alignment: Qt.AlignHCenter diff --git a/resources/qml/voip/ActiveCallBar.qml b/resources/qml/voip/ActiveCallBar.qml index c92b15c9..be698356 100644 --- a/resources/qml/voip/ActiveCallBar.qml +++ b/resources/qml/voip/ActiveCallBar.qml @@ -34,15 +34,15 @@ Rectangle { width: Nheko.avatarSize height: Nheko.avatarSize url: CallManager.callPartyAvatarUrl.replace("mxc://", "image://MxcImage/") - displayName: CallManager.callParty userid: CallManager.callParty + displayName: CallManager.callPartyDisplayName onClicked: TimelineManager.openImageOverlay(room.avatarUrl(userid), room.data.eventId) } Label { Layout.leftMargin: 8 font.pointSize: fontMetrics.font.pointSize * 1.1 - text: CallManager.callParty + text: CallManager.callPartyDisplayName color: "#000000" } diff --git a/resources/qml/voip/CallInvite.qml b/resources/qml/voip/CallInvite.qml index 253fa25c..1bd5eb26 100644 --- a/resources/qml/voip/CallInvite.qml +++ b/resources/qml/voip/CallInvite.qml @@ -40,7 +40,7 @@ Popup { Label { Layout.alignment: Qt.AlignCenter Layout.topMargin: msgView.height / 25 - text: CallManager.callParty + text: CallManager.callPartyDisplayName font.pointSize: fontMetrics.font.pointSize * 2 color: Nheko.colors.windowText } @@ -50,7 +50,8 @@ Popup { width: msgView.height / 5 height: msgView.height / 5 url: CallManager.callPartyAvatarUrl.replace("mxc://", "image://MxcImage/") - displayName: CallManager.callParty + userid: CallManager.callParty + displayName: CallManager.callPartyDisplayName } ColumnLayout { diff --git a/resources/qml/voip/CallInviteBar.qml b/resources/qml/voip/CallInviteBar.qml index f6c1ecde..10f8367a 100644 --- a/resources/qml/voip/CallInviteBar.qml +++ b/resources/qml/voip/CallInviteBar.qml @@ -41,14 +41,15 @@ Rectangle { width: Nheko.avatarSize height: Nheko.avatarSize url: CallManager.callPartyAvatarUrl.replace("mxc://", "image://MxcImage/") - displayName: CallManager.callParty + userid: CallManager.callParty + displayName: CallManager.callPartyDisplayName onClicked: TimelineManager.openImageOverlay(room.avatarUrl(userid), room.data.eventId) } Label { Layout.leftMargin: 8 font.pointSize: fontMetrics.font.pointSize * 1.1 - text: CallManager.callParty + text: CallManager.callPartyDisplayName color: "#000000" } diff --git a/src/CallManager.cpp b/src/CallManager.cpp index 6d41f1c6..601c9d6b 100644 --- a/src/CallManager.cpp +++ b/src/CallManager.cpp @@ -206,7 +206,9 @@ CallManager::sendInvite(const QString &roomid, CallType callType, unsigned int w std::vector members(cache::getMembers(roomid.toStdString())); const RoomMember &callee = members.front().user_id == utils::localUser() ? members.back() : members.front(); - callParty_ = callee.display_name.isEmpty() ? callee.user_id : callee.display_name; + callParty_ = callee.user_id; + callPartyDisplayName_ = + callee.display_name.isEmpty() ? callee.user_id : callee.display_name; callPartyAvatarUrl_ = QString::fromStdString(roomInfo.avatar_url); emit newInviteState(); playRingtone(QUrl("qrc:/media/media/ringback.ogg"), true); @@ -308,7 +310,9 @@ CallManager::handleEvent(const RoomEvent &callInviteEvent) std::vector members(cache::getMembers(callInviteEvent.room_id)); const RoomMember &caller = members.front().user_id == utils::localUser() ? members.back() : members.front(); - callParty_ = caller.display_name.isEmpty() ? caller.user_id : caller.display_name; + callParty_ = caller.user_id; + callPartyDisplayName_ = + caller.display_name.isEmpty() ? caller.user_id : caller.display_name; callPartyAvatarUrl_ = QString::fromStdString(roomInfo.avatar_url); haveCallInvite_ = true; @@ -459,6 +463,7 @@ CallManager::clear() { roomid_.clear(); callParty_.clear(); + callPartyDisplayName_.clear(); callPartyAvatarUrl_.clear(); callid_.clear(); callType_ = CallType::VOICE; diff --git a/src/CallManager.h b/src/CallManager.h index 1d973191..407b8366 100644 --- a/src/CallManager.h +++ b/src/CallManager.h @@ -32,6 +32,7 @@ class CallManager : public QObject Q_PROPERTY(webrtc::CallType callType READ callType NOTIFY newInviteState) Q_PROPERTY(webrtc::State callState READ callState NOTIFY newCallState) Q_PROPERTY(QString callParty READ callParty NOTIFY newInviteState) + Q_PROPERTY(QString callPartyDisplayName READ callPartyDisplayName NOTIFY newInviteState) Q_PROPERTY(QString callPartyAvatarUrl READ callPartyAvatarUrl NOTIFY newInviteState) Q_PROPERTY(bool isMicMuted READ isMicMuted NOTIFY micMuteChanged) Q_PROPERTY(bool haveLocalPiP READ haveLocalPiP NOTIFY newCallState) @@ -48,6 +49,7 @@ public: webrtc::CallType callType() const { return callType_; } webrtc::State callState() const { return session_.state(); } QString callParty() const { return callParty_; } + QString callPartyDisplayName() const { return callPartyDisplayName_; } QString callPartyAvatarUrl() const { return callPartyAvatarUrl_; } bool isMicMuted() const { return session_.isMicMuted(); } bool haveLocalPiP() const { return session_.haveLocalPiP(); } @@ -87,6 +89,7 @@ private: WebRTCSession &session_; QString roomid_; QString callParty_; + QString callPartyDisplayName_; QString callPartyAvatarUrl_; std::string callid_; const uint32_t timeoutms_ = 120000;