Merge pull request #1077 from hunbernd/feature/image-embed3

Make it possible to send images over chat lobby
This commit is contained in:
csoler 2017-10-24 18:47:34 +02:00 committed by GitHub
commit 1c2d17b5c1
8 changed files with 262 additions and 64 deletions

View file

@ -69,7 +69,7 @@ void MimeTextEdit::insertFromMimeData(const QMimeData* source)
QImage image = qvariant_cast<QImage>(source->imageData());
if (image.isNull() == false) {
QString encodedImage;
if (RsHtml::makeEmbeddedImage(image, encodedImage, 640*480)) {
if (RsHtml::makeEmbeddedImage(image, encodedImage, 640*480, mMaxBytes)) {
QTextDocumentFragment fragment = QTextDocumentFragment::fromHtml(encodedImage);
textCursor().insertFragment(fragment);
return;

View file

@ -50,6 +50,8 @@ public:
QColor textColorQuote() const { return highliter->textColorQuote();}
bool onlyPlainText() const {return mOnlyPlainText;}
void setMaxBytes(int limit) {mMaxBytes = limit;}
public slots:
void setTextColorQuote(QColor textColorQuote) { highliter->setTextColorQuote(textColorQuote);}
void setOnlyPlainText(bool bOnlyPlainText) {mOnlyPlainText = bOnlyPlainText;}
@ -83,6 +85,7 @@ private:
QList<QAction*> mContextMenuActions;
RsSyntaxHighlighter *highliter;
bool mOnlyPlainText;
int mMaxBytes = -1; //limit content size, for pasting images
};
#endif // MIMETEXTEDIT_H