Initial Support for Rich Replies

Add placeholder UI for showing replies in the text entry widget.
Existing quoting capability has been removed (Temporarily), as
it was replaced with the new reply capability.  Replies sent from
nheko do not currently appear correctly in the timeline (this
will be fixed in a future commit).
This commit is contained in:
Joseph Donofry 2019-06-11 21:04:30 -04:00
parent b9dde957a8
commit 9159b9ce22
No known key found for this signature in database
GPG key ID: E8A1D78EF044B0CB
11 changed files with 412 additions and 255 deletions

View file

@ -28,7 +28,8 @@
#include <QTextEdit>
#include <QWidget>
#include "SuggestionsPopup.h"
#include "popups/SuggestionsPopup.h"
#include "popups/ReplyPopup.h"
#include "dialogs/PreviewUploadOverlay.h"
#include "emoji/PickButton.h"
@ -55,6 +56,7 @@ public:
void submit();
void setRelatedEvent(const QString &event) { related_event_ = event; }
void showReplyPopup(const QString &user, const QString &msg, const QString &event_id);
signals:
void heightChanged(int height);
@ -85,7 +87,7 @@ protected:
void insertFromMimeData(const QMimeData *source) override;
void focusOutEvent(QFocusEvent *event) override
{
popup_.hide();
suggestionsPopup_.hide();
QTextEdit::focusOutEvent(event);
}
@ -94,7 +96,8 @@ private:
size_t history_index_;
QTimer *typingTimer_;
SuggestionsPopup popup_;
SuggestionsPopup suggestionsPopup_;
ReplyPopup replyPopup_;
// Used for replies
QString related_event_;
@ -109,7 +112,8 @@ private:
int anchorWidth(AnchorType anchor) { return static_cast<int>(anchor); }
void closeSuggestions() { popup_.hide(); }
void closeSuggestions() { suggestionsPopup_.hide(); }
void closeReply() { replyPopup_.hide(); }
void resetAnchor() { atTriggerPosition_ = -1; }
bool isAnchorValid() { return atTriggerPosition_ != -1; }
bool hasAnchor(int pos, AnchorType anchor)