Added to show the message length on Composer and Message Widget

This commit is contained in:
defnax 2021-01-10 19:20:17 +01:00
parent cf05c86691
commit 39a89dd2a9
5 changed files with 82 additions and 1 deletions

View file

@ -509,6 +509,7 @@ void MessageWidget::fill(const std::string &msgId)
ui.msgText->resetImagesStatus(false);
clearTagLabels();
checkLength();
ui.inviteFrame->hide();
ui.expandFilesButton->setChecked(false);
@ -690,6 +691,7 @@ void MessageWidget::fill(const std::string &msgId)
ui.filesSize->setText(QString(misc::friendlyUnit(msgInfo.size)));
showTagLabels();
checkLength();
currMsgFlags = msgInfo.msgflags;
}
@ -903,3 +905,15 @@ void MessageWidget::viewSource()
delete dialog;
}
void MessageWidget::checkLength()
{
QString text;
RsHtml::optimizeHtml(ui.msgText, text);
std::wstring msg = text.toStdWString();
int charlength = msg.length();
text = tr("%1 (%2) ").arg(charlength).arg(misc::friendlyUnit(charlength));
ui.sizeLabel->setText(text);
}