parent
faff23ed38
commit
df5d24c87f
36 changed files with 809 additions and 3 deletions
|
|
@ -513,8 +513,22 @@ TextInputWidget::TextInputWidget(QWidget *parent)
|
|||
sendMessageBtn_->setIcon(send_message_icon);
|
||||
sendMessageBtn_->setIconSize(QSize(ButtonHeight, ButtonHeight));
|
||||
|
||||
emojiBtn_ = new emoji::PickButton(this);
|
||||
emojiBtn_->setToolTip(tr("Emoji"));
|
||||
|
||||
#if defined(Q_OS_MAC)
|
||||
// macOS has a native emoji picker.
|
||||
emojiBtn_->hide();
|
||||
#endif
|
||||
|
||||
QIcon emoji_icon;
|
||||
emoji_icon.addFile(":/icons/icons/ui/smile.png");
|
||||
emojiBtn_->setIcon(emoji_icon);
|
||||
emojiBtn_->setIconSize(QSize(ButtonHeight, ButtonHeight));
|
||||
|
||||
topLayout_->addWidget(sendFileBtn_);
|
||||
topLayout_->addWidget(input_);
|
||||
topLayout_->addWidget(emojiBtn_);
|
||||
topLayout_->addWidget(sendMessageBtn_);
|
||||
|
||||
setLayout(topLayout_);
|
||||
|
|
@ -527,6 +541,11 @@ TextInputWidget::TextInputWidget(QWidget *parent)
|
|||
connect(input_, &FilteredTextEdit::audio, this, &TextInputWidget::uploadAudio);
|
||||
connect(input_, &FilteredTextEdit::video, this, &TextInputWidget::uploadVideo);
|
||||
connect(input_, &FilteredTextEdit::file, this, &TextInputWidget::uploadFile);
|
||||
connect(emojiBtn_,
|
||||
SIGNAL(emojiSelected(const QString &)),
|
||||
this,
|
||||
SLOT(addSelectedEmoji(const QString &)));
|
||||
|
||||
connect(input_, &FilteredTextEdit::startedTyping, this, &TextInputWidget::startedTyping);
|
||||
|
||||
connect(input_, &FilteredTextEdit::stoppedTyping, this, &TextInputWidget::stoppedTyping);
|
||||
|
|
@ -535,6 +554,22 @@ TextInputWidget::TextInputWidget(QWidget *parent)
|
|||
input_, &FilteredTextEdit::startedUpload, this, &TextInputWidget::showUploadSpinner);
|
||||
}
|
||||
|
||||
void
|
||||
TextInputWidget::addSelectedEmoji(const QString &emoji)
|
||||
{
|
||||
QTextCursor cursor = input_->textCursor();
|
||||
|
||||
QTextCharFormat charfmt;
|
||||
input_->setCurrentCharFormat(charfmt);
|
||||
|
||||
input_->insertPlainText(emoji);
|
||||
cursor.movePosition(QTextCursor::End);
|
||||
|
||||
input_->setCurrentCharFormat(charfmt);
|
||||
|
||||
input_->show();
|
||||
}
|
||||
|
||||
void
|
||||
TextInputWidget::command(QString command, QString args)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue