merge master into reactions
This commit is contained in:
parent
7beaf868ef
commit
a1661f7006
@ -3,7 +3,8 @@ import QtQuick.Controls 2.3
|
|||||||
|
|
||||||
AbstractButton {
|
AbstractButton {
|
||||||
property string image: undefined
|
property string image: undefined
|
||||||
|
width: 16
|
||||||
|
height: 16
|
||||||
id: button
|
id: button
|
||||||
|
|
||||||
Image {
|
Image {
|
||||||
|
@ -71,7 +71,18 @@ MouseArea {
|
|||||||
Layout.preferredHeight: 16
|
Layout.preferredHeight: 16
|
||||||
width: 16
|
width: 16
|
||||||
}
|
}
|
||||||
|
ImageButton {
|
||||||
|
visible: timelineSettings.buttons
|
||||||
|
Layout.alignment: Qt.AlignRight | Qt.AlignTop
|
||||||
|
Layout.preferredHeight: 16
|
||||||
|
width: 16
|
||||||
|
id: reactButton
|
||||||
|
hoverEnabled: true
|
||||||
|
image: ":/icons/icons/ui/smile.png"
|
||||||
|
ToolTip.visible: hovered
|
||||||
|
ToolTip.text: qsTr("React")
|
||||||
|
onClicked: chat.model.reactAction(model.id)
|
||||||
|
}
|
||||||
ImageButton {
|
ImageButton {
|
||||||
visible: timelineSettings.buttons
|
visible: timelineSettings.buttons
|
||||||
Layout.alignment: Qt.AlignRight | Qt.AlignTop
|
Layout.alignment: Qt.AlignRight | Qt.AlignTop
|
||||||
|
@ -48,7 +48,10 @@ Page {
|
|||||||
property string eventId
|
property string eventId
|
||||||
property int eventType
|
property int eventType
|
||||||
property bool isEncrypted
|
property bool isEncrypted
|
||||||
|
MenuItem {
|
||||||
|
text: qsTr("React")
|
||||||
|
onClicked: chat.model.reactAction(messageContextMenu.eventId)
|
||||||
|
}
|
||||||
MenuItem {
|
MenuItem {
|
||||||
text: qsTr("Reply")
|
text: qsTr("Reply")
|
||||||
onClicked: chat.model.replyAction(messageContextMenu.eventId)
|
onClicked: chat.model.replyAction(messageContextMenu.eventId)
|
||||||
|
@ -2,6 +2,9 @@ import QtQuick 2.5
|
|||||||
import QtQuick.Controls 2.1
|
import QtQuick.Controls 2.1
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
|
id: pillComponent
|
||||||
|
property color userColor: "red"
|
||||||
|
|
||||||
color: colors.brightText
|
color: colors.brightText
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
|
||||||
@ -10,6 +13,6 @@ Label {
|
|||||||
|
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
radius: parent.height / 2
|
radius: parent.height / 2
|
||||||
color: colors.dark
|
color: Qt.rgba(userColor.r, userColor.g, userColor.b, 0.2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -582,6 +582,14 @@ ChatPage::resetUI()
|
|||||||
showUnreadMessageNotification(0);
|
showUnreadMessageNotification(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ChatPage::reactMessage(const QString &id)
|
||||||
|
{
|
||||||
|
view_manager_->queueReactionMessage(current_room_,
|
||||||
|
id,
|
||||||
|
"👀");
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ChatPage::focusMessageInput()
|
ChatPage::focusMessageInput()
|
||||||
{
|
{
|
||||||
|
@ -85,6 +85,7 @@ public:
|
|||||||
//! Show the room/group list (if it was visible).
|
//! Show the room/group list (if it was visible).
|
||||||
void showSideBars();
|
void showSideBars();
|
||||||
void initiateLogout();
|
void initiateLogout();
|
||||||
|
void reactMessage(const QString &eventId);
|
||||||
void focusMessageInput();
|
void focusMessageInput();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
@ -914,6 +914,13 @@ TimelineModel::decryptEvent(const mtx::events::EncryptedEvent<mtx::events::msg::
|
|||||||
return {dummy, false};
|
return {dummy, false};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
TimelineModel::reactAction(QString id)
|
||||||
|
{
|
||||||
|
setReaction(id);
|
||||||
|
ChatPage::instance()->reactMessage(id);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
TimelineModel::replyAction(QString id)
|
TimelineModel::replyAction(QString id)
|
||||||
{
|
{
|
||||||
|
@ -126,6 +126,7 @@ class TimelineModel : public QAbstractListModel
|
|||||||
int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentIndexChanged)
|
int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentIndexChanged)
|
||||||
Q_PROPERTY(std::vector<QString> typingUsers READ typingUsers WRITE updateTypingUsers NOTIFY
|
Q_PROPERTY(std::vector<QString> typingUsers READ typingUsers WRITE updateTypingUsers NOTIFY
|
||||||
typingUsersChanged)
|
typingUsersChanged)
|
||||||
|
Q_PROPERTY(QString reaction READ reaction WRITE setReaction NOTIFY reactionChanged RESET resetReaction)
|
||||||
Q_PROPERTY(QString reply READ reply WRITE setReply NOTIFY replyChanged RESET resetReply)
|
Q_PROPERTY(QString reply READ reply WRITE setReply NOTIFY replyChanged RESET resetReply)
|
||||||
Q_PROPERTY(
|
Q_PROPERTY(
|
||||||
bool paginationInProgress READ paginationInProgress NOTIFY paginationInProgressChanged)
|
bool paginationInProgress READ paginationInProgress NOTIFY paginationInProgressChanged)
|
||||||
@ -187,6 +188,7 @@ public:
|
|||||||
Q_INVOKABLE void viewRawMessage(QString id) const;
|
Q_INVOKABLE void viewRawMessage(QString id) const;
|
||||||
Q_INVOKABLE void viewDecryptedRawMessage(QString id) const;
|
Q_INVOKABLE void viewDecryptedRawMessage(QString id) const;
|
||||||
Q_INVOKABLE void openUserProfile(QString userid) const;
|
Q_INVOKABLE void openUserProfile(QString userid) const;
|
||||||
|
Q_INVOKABLE void reactAction(QString id);
|
||||||
Q_INVOKABLE void replyAction(QString id);
|
Q_INVOKABLE void replyAction(QString id);
|
||||||
Q_INVOKABLE void readReceiptsAction(QString id) const;
|
Q_INVOKABLE void readReceiptsAction(QString id) const;
|
||||||
Q_INVOKABLE void redactEvent(QString id);
|
Q_INVOKABLE void redactEvent(QString id);
|
||||||
@ -215,7 +217,21 @@ public slots:
|
|||||||
}
|
}
|
||||||
std::vector<QString> typingUsers() const { return typingUsers_; }
|
std::vector<QString> typingUsers() const { return typingUsers_; }
|
||||||
bool paginationInProgress() const { return m_paginationInProgress; }
|
bool paginationInProgress() const { return m_paginationInProgress; }
|
||||||
|
QString reaction() const { return reaction_; }
|
||||||
|
void setReaction(QString reaction)
|
||||||
|
{
|
||||||
|
if (reaction_ != reaction) {
|
||||||
|
reaction_ = reaction;
|
||||||
|
emit reactionChanged(reaction_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void resetReaction()
|
||||||
|
{
|
||||||
|
if (!reaction_.isEmpty()) {
|
||||||
|
reaction_ = "";
|
||||||
|
emit reactionChanged(reaction_);
|
||||||
|
}
|
||||||
|
}
|
||||||
QString reply() const { return reply_; }
|
QString reply() const { return reply_; }
|
||||||
void setReply(QString newReply)
|
void setReply(QString newReply)
|
||||||
{
|
{
|
||||||
@ -252,6 +268,7 @@ signals:
|
|||||||
void newEncryptedImage(mtx::crypto::EncryptedFile encryptionInfo);
|
void newEncryptedImage(mtx::crypto::EncryptedFile encryptionInfo);
|
||||||
void eventFetched(QString requestingEvent, mtx::events::collections::TimelineEvents event);
|
void eventFetched(QString requestingEvent, mtx::events::collections::TimelineEvents event);
|
||||||
void typingUsersChanged(std::vector<QString> users);
|
void typingUsersChanged(std::vector<QString> users);
|
||||||
|
void reactionChanged(QString reaction);
|
||||||
void replyChanged(QString reply);
|
void replyChanged(QString reply);
|
||||||
void paginationInProgressChanged(const bool);
|
void paginationInProgressChanged(const bool);
|
||||||
|
|
||||||
@ -285,6 +302,7 @@ private:
|
|||||||
bool m_paginationInProgress = false;
|
bool m_paginationInProgress = false;
|
||||||
|
|
||||||
QString currentId;
|
QString currentId;
|
||||||
|
QString reaction_;
|
||||||
QString reply_;
|
QString reply_;
|
||||||
std::vector<QString> typingUsers_;
|
std::vector<QString> typingUsers_;
|
||||||
|
|
||||||
|
@ -282,6 +282,20 @@ TimelineViewManager::queueEmoteMessage(const QString &msg)
|
|||||||
timeline_->sendMessage(emote);
|
timeline_->sendMessage(emote);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
TimelineViewManager::queueReactionMessage(const QString &roomId,
|
||||||
|
const QString &reactedEvent,
|
||||||
|
const QString &reactionKey)
|
||||||
|
{
|
||||||
|
mtx::events::msg::Reaction reaction;
|
||||||
|
reaction.relates_to.rel_type = mtx::common::RelationType::Annotation;
|
||||||
|
reaction.relates_to.event_id = reactedEvent.toStdString();
|
||||||
|
reaction.relates_to.key = reactionKey.toStdString();
|
||||||
|
|
||||||
|
auto model = models.value(roomId);
|
||||||
|
model->sendMessage(reaction);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
TimelineViewManager::queueImageMessage(const QString &roomid,
|
TimelineViewManager::queueImageMessage(const QString &roomid,
|
||||||
const QString &filename,
|
const QString &filename,
|
||||||
|
@ -55,7 +55,9 @@ public slots:
|
|||||||
|
|
||||||
void setHistoryView(const QString &room_id);
|
void setHistoryView(const QString &room_id);
|
||||||
void updateColorPalette();
|
void updateColorPalette();
|
||||||
|
void queueReactionMessage(const QString &roomId,
|
||||||
|
const QString &reactedEvent,
|
||||||
|
const QString &reaction);
|
||||||
void queueTextMessage(const QString &msg);
|
void queueTextMessage(const QString &msg);
|
||||||
void queueEmoteMessage(const QString &msg);
|
void queueEmoteMessage(const QString &msg);
|
||||||
void queueImageMessage(const QString &roomid,
|
void queueImageMessage(const QString &roomid,
|
||||||
|
Loading…
Reference in New Issue
Block a user