diff options
author | Ken Moore <ken@ixsystems.com> | 2017-10-04 09:52:01 -0400 |
---|---|---|
committer | Ken Moore <ken@ixsystems.com> | 2017-10-04 09:52:01 -0400 |
commit | 15d8dac497768350ea429d6c6682ed9723d0464c (patch) | |
tree | b6238a9d934b8aca88122306fa1f90f06cc394fe /src-qt5/desktop-utils/lumina-fileinfo/MainUI.cpp | |
parent | Finish up the auto archive/extract within lumina-archiver (with JT) (diff) | |
parent | Further lumina-fm changes for video thumbnails (diff) | |
download | lumina-15d8dac497768350ea429d6c6682ed9723d0464c.tar.gz lumina-15d8dac497768350ea429d6c6682ed9723d0464c.tar.bz2 lumina-15d8dac497768350ea429d6c6682ed9723d0464c.zip |
Merge branch 'master' of github.com:trueos/lumina
Diffstat (limited to 'src-qt5/desktop-utils/lumina-fileinfo/MainUI.cpp')
-rw-r--r-- | src-qt5/desktop-utils/lumina-fileinfo/MainUI.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src-qt5/desktop-utils/lumina-fileinfo/MainUI.cpp b/src-qt5/desktop-utils/lumina-fileinfo/MainUI.cpp index d82f09ce..40d2d544 100644 --- a/src-qt5/desktop-utils/lumina-fileinfo/MainUI.cpp +++ b/src-qt5/desktop-utils/lumina-fileinfo/MainUI.cpp @@ -8,6 +8,7 @@ #include "MainUI.h" #include "ui_MainUI.h" +#include <QVideoFrame> #include <QFileDialog> #include <QMessageBox> @@ -22,11 +23,19 @@ MainUI::MainUI() : QDialog(), ui(new Ui::MainUI){ terminate_thread = false; UpdateIcons(); //Set all the icons in the dialog SetupConnections(); + player = new QMediaPlayer(this, QMediaPlayer::VideoSurface); + surface = new LVideoSurface(this); + player->setVideoOutput(surface); + player->setMuted(true); + connect(player, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)), this, SLOT(setDuration(QMediaPlayer::MediaStatus))); + connect(surface, SIGNAL(frameReceived(QPixmap)), this, SLOT(stopVideo(QPixmap))); INFO = 0; } MainUI::~MainUI(){ terminate_thread = true; + surface->deleteLater(); + player->deleteLater(); this->close(); } @@ -86,6 +95,11 @@ void MainUI::LoadFile(QString path, QString type){ ui->label_file_icon->setPixmap( pix.scaledToHeight(64) ); ui->label_file_size->setText( ui->label_file_size->text()+" ("+QString::number(pix.width())+" x "+QString::number(pix.height())+" px)" ); //qDebug() << " - done with image"; + }else if(INFO->isVideo()){ + player->setMedia(QUrl("file://"+INFO->absoluteFilePath())); + player->play(); + player->pause(); + //Pixmap set when video is loaded in stopVideo }else{ ui->label_file_icon->setPixmap( LXDG::findIcon( INFO->iconfile(), "unknown").pixmap(QSize(64,64)) ); } @@ -296,6 +310,18 @@ void MainUI::getXdgCommand(QString prev){ xdgvaluechanged(); } +void MainUI::stopVideo(QPixmap img) { + ui->label_file_icon->setPixmap( img.scaledToHeight(64) ); + player->pause(); +} + +void MainUI::setDuration(QMediaPlayer::MediaStatus status) { + if(status == QMediaPlayer::BufferedMedia) { + player->setPosition(player->duration() / 2); + player->play(); + } +} + void MainUI::on_tool_xdg_getDir_clicked(){ //Find a directory QString dir = ui->line_xdg_wdir->text(); |