Update the look of the chatbar to be floating with the rich text controls on top and send buttons inline
This commit is contained in:
@@ -174,6 +174,11 @@ void ChatBarMessageContentModel::connectKeyHelper()
|
||||
insertComponentAtCursor(MessageComponentType::Text);
|
||||
}
|
||||
});
|
||||
connect(m_keyHelper, &ChatKeyHelper::unhandledReturn, this, [this](bool isCompleting) {
|
||||
if (!isCompleting) {
|
||||
postMessage();
|
||||
}
|
||||
});
|
||||
connect(m_keyHelper, &ChatKeyHelper::imagePasted, this, [this](const QString &filePath) {
|
||||
m_room->cacheForType(m_type)->setAttachmentPath(filePath);
|
||||
});
|
||||
@@ -448,6 +453,21 @@ void ChatBarMessageContentModel::removeAttachment()
|
||||
}
|
||||
}
|
||||
|
||||
bool ChatBarMessageContentModel::sendMessageWithEnter() const
|
||||
{
|
||||
return m_sendMessageWithEnter;
|
||||
}
|
||||
|
||||
void ChatBarMessageContentModel::setSendMessageWithEnter(bool sendMessageWithEnter)
|
||||
{
|
||||
if (sendMessageWithEnter == m_sendMessageWithEnter) {
|
||||
return;
|
||||
}
|
||||
m_sendMessageWithEnter = sendMessageWithEnter;
|
||||
m_keyHelper->sendMessageWithEnter = sendMessageWithEnter;
|
||||
Q_EMIT sendMessageWithEnterChanged();
|
||||
}
|
||||
|
||||
ChatBarMessageContentModel::ComponentIt ChatBarMessageContentModel::removeComponent(ComponentIt it)
|
||||
{
|
||||
if (it == m_components.end()) {
|
||||
|
||||
@@ -66,6 +66,11 @@ class ChatBarMessageContentModel : public MessageContentModel
|
||||
*/
|
||||
Q_PROPERTY(bool hasRichFormatting READ hasRichFormatting NOTIFY hasRichFormattingChanged)
|
||||
|
||||
/**
|
||||
* @brief The UserListModel to be used for room completions.
|
||||
*/
|
||||
Q_PROPERTY(bool sendMessageWithEnter READ sendMessageWithEnter WRITE setSendMessageWithEnter NOTIFY sendMessageWithEnterChanged)
|
||||
|
||||
public:
|
||||
explicit ChatBarMessageContentModel(QObject *parent = nullptr);
|
||||
|
||||
@@ -89,12 +94,16 @@ public:
|
||||
|
||||
Q_INVOKABLE void removeAttachment();
|
||||
|
||||
bool sendMessageWithEnter() const;
|
||||
void setSendMessageWithEnter(bool sendMessageWithEnter);
|
||||
|
||||
Q_INVOKABLE void postMessage();
|
||||
|
||||
Q_SIGNALS:
|
||||
void typeChanged();
|
||||
void focusRowChanged();
|
||||
void hasRichFormattingChanged();
|
||||
void sendMessageWithEnterChanged();
|
||||
|
||||
private:
|
||||
ChatBarType::Type m_type = ChatBarType::None;
|
||||
@@ -125,5 +134,7 @@ private:
|
||||
void updateCache() const;
|
||||
QString messageText() const;
|
||||
|
||||
bool m_sendMessageWithEnter = true;
|
||||
|
||||
void clearModel();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user