|
|
|
|
@ -19,6 +19,7 @@
|
|
|
|
|
#include <QFile> |
|
|
|
|
#include <QScrollBar> |
|
|
|
|
#include <QApplication> |
|
|
|
|
#include <QPointer> |
|
|
|
|
#include <QDebug> |
|
|
|
|
#include <QFileInfo> |
|
|
|
|
#include <QFile> |
|
|
|
|
@ -749,13 +750,16 @@ void MessageList::onAttachmentDownloaded(const QString& chId, int64_t msgId) {
|
|
|
|
|
QString fp = item->data(MsgVoiceFileRole).toString(); |
|
|
|
|
QString thumbPath = fp + ".jpg"; |
|
|
|
|
if (!fp.isEmpty() && QFile::exists(fp) && !QFile::exists(thumbPath)) { |
|
|
|
|
std::thread([this, fp, thumbPath]() { |
|
|
|
|
QPointer<MessageList> self(this); |
|
|
|
|
std::thread([self, fp, thumbPath]() { |
|
|
|
|
int rc = video_extract_thumbnail(fp.toUtf8().constData(), |
|
|
|
|
thumbPath.toUtf8().constData(), 320); |
|
|
|
|
DEBUG_DEBUG(DEBUG_CATEGORY_VIDEO, "MessageList: thumbnail %s rc=%d", |
|
|
|
|
qPrintable(thumbPath), rc); |
|
|
|
|
QMetaObject::invokeMethod(this, [this]() { m_view->viewport()->update(); }, |
|
|
|
|
Qt::QueuedConnection); |
|
|
|
|
if (self) { |
|
|
|
|
QMetaObject::invokeMethod(self, [self]() { self->m_view->viewport()->update(); }, |
|
|
|
|
Qt::QueuedConnection); |
|
|
|
|
} |
|
|
|
|
}).detach(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|