aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/desktop-utils/lumina-fm/Browser.cpp
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/Browser.cpp
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/Browser.cpp')
-rw-r--r--src-qt5/desktop-utils/lumina-fm/Browser.cpp27
1 files changed, 16 insertions, 11 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;
}
bgstack15