aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/desktop-utils/lumina-fileinfo
diff options
context:
space:
mode:
Diffstat (limited to 'src-qt5/desktop-utils/lumina-fileinfo')
-rw-r--r--src-qt5/desktop-utils/lumina-fileinfo/MainUI.cpp26
-rw-r--r--src-qt5/desktop-utils/lumina-fileinfo/MainUI.h11
-rw-r--r--src-qt5/desktop-utils/lumina-fileinfo/lumina-fileinfo.pro3
3 files changed, 36 insertions, 4 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();
diff --git a/src-qt5/desktop-utils/lumina-fileinfo/MainUI.h b/src-qt5/desktop-utils/lumina-fileinfo/MainUI.h
index cbe23d9e..5ce7b01a 100644
--- a/src-qt5/desktop-utils/lumina-fileinfo/MainUI.h
+++ b/src-qt5/desktop-utils/lumina-fileinfo/MainUI.h
@@ -14,11 +14,11 @@
#define _LUMINA_FILE_INFO_MAIN_UI_H
#include <QDialog>
-
+#include <QMediaPlayer>
#include <LuminaXDG.h>
+#include <LVideoSurface.h>
-namespace Ui{
- class MainUI;
+namespace Ui{ class MainUI;
};
class MainUI : public QDialog{
@@ -35,6 +35,9 @@ public slots:
private:
Ui::MainUI *ui;
LFileInfo *INFO;
+ LVideoSurface *surface;
+ QMediaPlayer *player;
+ bool flag;
bool canwrite;
bool terminate_thread; //flag for terminating the GetDirSize task
@@ -51,6 +54,8 @@ private slots:
//UI Buttons
void on_push_close_clicked();
void on_push_save_clicked();
+ void stopVideo(QPixmap);
+ void setDuration(QMediaPlayer::MediaStatus);
void getXdgCommand(QString prev = "");
//void on_tool_xdg_getCommand_clicked(QString prev = "");
void on_tool_xdg_getDir_clicked();
diff --git a/src-qt5/desktop-utils/lumina-fileinfo/lumina-fileinfo.pro b/src-qt5/desktop-utils/lumina-fileinfo/lumina-fileinfo.pro
index bbaf842e..b53d8cba 100644
--- a/src-qt5/desktop-utils/lumina-fileinfo/lumina-fileinfo.pro
+++ b/src-qt5/desktop-utils/lumina-fileinfo/lumina-fileinfo.pro
@@ -1,7 +1,7 @@
include("$${PWD}/../../OS-detect.pri")
QT += core gui
-greaterThan(QT_MAJOR_VERSION, 4): QT += widgets concurrent
+greaterThan(QT_MAJOR_VERSION, 4): QT += widgets concurrent multimedia
TARGET = lumina-fileinfo
@@ -13,6 +13,7 @@ target.path = $${L_BINDIR}
include(../../core/libLumina/LUtils.pri) #includes LUtils
include(../../core/libLumina/LuminaXDG.pri)
#include(../../core/libLumina/LuminaSingleApplication.pri)
+include(../../core/libLumina/LVideoSurface.pri)
include(../../core/libLumina/LuminaThemes.pri)
SOURCES += main.cpp\
bgstack15