From 6366dc2d884dc74fe784d4318fbf97c73e3d79a2 Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Mon, 6 Feb 2023 15:01:18 -0600 Subject: [PATCH] an attempt at creating a thumbnailer --- src/cpp/slidemodel.cpp | 13 +++++++++++++ src/cpp/slidemodel.h | 2 ++ 2 files changed, 15 insertions(+) diff --git a/src/cpp/slidemodel.cpp b/src/cpp/slidemodel.cpp index 539a589..b142724 100644 --- a/src/cpp/slidemodel.cpp +++ b/src/cpp/slidemodel.cpp @@ -18,6 +18,7 @@ #include #include +#include SlideModel::SlideModel(QObject *parent) : QAbstractListModel(parent) { @@ -639,3 +640,15 @@ void SlideModel::moveRowFromService(const int &fromIndex, } } } + +QString SlideModel::thumbnailVideo(QString video) { + + std::system("ffmpeg -i Rust\ Tutorial\ Full\ Course.webm -vframes 1 -an -s 576x324 -ss 35 OutputFile.jpg"); + + QTemporaryFile thumbnail; + if (thumbnail.open()) { + + return thumbnail.fileName(); + } + +} diff --git a/src/cpp/slidemodel.h b/src/cpp/slidemodel.h index 14c39d7..1f69d5b 100644 --- a/src/cpp/slidemodel.h +++ b/src/cpp/slidemodel.h @@ -79,6 +79,8 @@ public: Q_INVOKABLE QVariantMap getItem(int index) const; Q_INVOKABLE QVariantList getItems(); Q_INVOKABLE int findSlideIdFromServItm(int index); + Q_INVOKABLE void thumbnailVideo(QString video); + public slots: Q_INVOKABLE bool select(int id);