aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/desktop-utils/lumina-fm
diff options
context:
space:
mode:
authorCoupon <coupon@coupon.govschool>2017-10-03 20:45:30 -0400
committerCoupon <coupon@coupon.govschool>2017-10-03 20:45:30 -0400
commit7de2db7ab54f9c82eaa8b2a494a745c37923f4db (patch)
tree36322c771a47a84309e2c25317acd221ec4d47d2 /src-qt5/desktop-utils/lumina-fm
parentReworked the video thumnail system with lumina-fm (diff)
downloadlumina-7de2db7ab54f9c82eaa8b2a494a745c37923f4db.tar.gz
lumina-7de2db7ab54f9c82eaa8b2a494a745c37923f4db.tar.bz2
lumina-7de2db7ab54f9c82eaa8b2a494a745c37923f4db.zip
Further lumina-fm changes for video thumbnails
Diffstat (limited to 'src-qt5/desktop-utils/lumina-fm')
-rw-r--r--src-qt5/desktop-utils/lumina-fm/Browser.cpp27
-rw-r--r--src-qt5/desktop-utils/lumina-fm/Browser.h4
2 files changed, 18 insertions, 13 deletions
diff --git a/src-qt5/desktop-utils/lumina-fm/Browser.cpp b/src-qt5/desktop-utils/lumina-fm/Browser.cpp
index bebb92e7..211ef8d0 100644
--- a/src-qt5/desktop-utils/lumina-fm/Browser.cpp
+++ b/src-qt5/desktop-utils/lumina-fm/Browser.cpp
@@ -71,12 +71,12 @@ void Browser::loadItem(QString info, Browser *obj){
obj->emit threadDone(info, pix);
}
-QIcon Browser::loadIcon(QString icon){
+QIcon* Browser::loadIcon(QString icon){
if(!mimeIcons.contains(icon)){
mimeIcons.insert(icon, LXDG::findIcon(icon, "unknown"));
}
- return mimeIcons[icon];
+ return &mimeIcons[icon];
}
@@ -103,21 +103,21 @@ void Browser::stopVideo(QMediaPlayer *player, QMediaPlayer::MediaStatus status)
}
}
-void Browser::captureFrame(QPixmap pix) {
+void Browser::captureFrame(QPixmap pix, QIcon *ico) {
qDebug() << "grabbing frame";
- videoFrame = pix.scaledToHeight(64);
+ *ico = pix.scaledToHeight(64);
emit frameChanged();
}
void Browser::futureFinished(QString name, QImage icon){
//Note: this will be called once for every item that loads
- QIcon ico;
+ QIcon *ico = new QIcon();
LFileInfo *info = new LFileInfo(name);
if(!icon.isNull() && showThumbs){
QPixmap pix = QPixmap::fromImage(icon);
- ico.addPixmap(pix);
+ ico->addPixmap(pix);
}
- if(ico.isNull()){
+ if(ico->isNull()){
if(videoFormats.contains(name.section(".",-1).toLower())) {
qDebug() << "Loading Video for" << name;
//qDebug() << "VIDEO" << info;
@@ -125,22 +125,27 @@ void Browser::futureFinished(QString name, QImage icon){
qDebug() << " - created player";
LVideoSurface *surface = new LVideoSurface();
qDebug() << " - Create objects";
- connect(surface, SIGNAL(frameReceived(QPixmap)), this, SLOT(captureFrame(QPixmap)));
+ connect(surface, &LVideoSurface::frameReceived, this, [&] (QPixmap pix) { captureFrame(pix, ico); });
connect(player, &QMediaPlayer::mediaStatusChanged, this, [&]{ stopVideo(player, player->mediaStatus()); });
player->setVideoOutput(surface);
player->setMuted(true);
player->setMedia(QUrl("file://"+info->absoluteFilePath()));
player->play();
player->pause();
- //ico.addPixmap(videoFrame);
- ico = loadIcon(info->iconfile());
+
+ QEventLoop loop;
+ connect(this, SIGNAL(frameChanged()), &loop, SLOT(quit()));
+ loop.exec();
+
+ ico->addPixmap(videoFrame);
+ //ico = loadIcon(info->iconfile());
delete player;
delete surface;
}else {
ico = loadIcon(info->iconfile());
}
}
- this->emit itemDataAvailable( ico, info);
+ this->emit itemDataAvailable( *ico, info);
//qDebug() << " -- done:" << name;
}
diff --git a/src-qt5/desktop-utils/lumina-fm/Browser.h b/src-qt5/desktop-utils/lumina-fm/Browser.h
index 2dfae0be..379753ab 100644
--- a/src-qt5/desktop-utils/lumina-fm/Browser.h
+++ b/src-qt5/desktop-utils/lumina-fm/Browser.h
@@ -51,12 +51,12 @@ private:
QHash<QString, QIcon> mimeIcons; //cache for quickly re-using QIcons
void loadItem(QString info, Browser *obj); //this is the main loader class - multiple instances each run in a separate thread
- QIcon loadIcon(QString icon); //simplification for using/populating the mimIcons cache
+ QIcon* loadIcon(QString icon); //simplification for using/populating the mimIcons cache
private slots:
void fileChanged(QString); //tied into the watcher - for file change notifications
void dirChanged(QString); // tied into the watcher - for new/removed files in the current dir
- void captureFrame(QPixmap);
+ void captureFrame(QPixmap, QIcon*);
void stopVideo(QMediaPlayer*, QMediaPlayer::MediaStatus);
void futureFinished(QString, QImage);
bgstack15