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.cpp37
-rw-r--r--src-qt5/desktop-utils/lumina-fileinfo/MainUI.h4
2 files changed, 24 insertions, 17 deletions
diff --git a/src-qt5/desktop-utils/lumina-fileinfo/MainUI.cpp b/src-qt5/desktop-utils/lumina-fileinfo/MainUI.cpp
index 4d695ab4..40d2d544 100644
--- a/src-qt5/desktop-utils/lumina-fileinfo/MainUI.cpp
+++ b/src-qt5/desktop-utils/lumina-fileinfo/MainUI.cpp
@@ -23,17 +23,20 @@ MainUI::MainUI() : QDialog(), ui(new Ui::MainUI){
terminate_thread = false;
UpdateIcons(); //Set all the icons in the dialog
SetupConnections();
- player = new QMediaPlayer(0, QMediaPlayer::VideoSurface);
- surface = new LVideoSurface();
+ 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();
- delete surface;
- delete player;
}
//=============
@@ -92,15 +95,12 @@ 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()){
+ }else if(INFO->isVideo()){
player->setMedia(QUrl("file://"+INFO->absoluteFilePath()));
player->play();
- player->setPosition(player->duration() / 2);
- connect(surface, SIGNAL(frameReceived(QImage)), this, SLOT(stopVideo(QImage)));
+ player->pause();
//Pixmap set when video is loaded in stopVideo
- //ui->label_file_icon->setPixmap( QPixmap::fromImage(surface->frameImage()).scaledToHeight(64) );
- //ui->label_file_size->setText( ui->label_file_size->text()+" ("+QString::number(pix.width())+" x "+QString::number(pix.height())+" px)" );
- }*/else{
+ }else{
ui->label_file_icon->setPixmap( LXDG::findIcon( INFO->iconfile(), "unknown").pixmap(QSize(64,64)) );
}
//Now verify the tab is available in the widget
@@ -117,7 +117,7 @@ void MainUI::LoadFile(QString path, QString type){
}
//Now load the special XDG desktop info
qDebug() << "Check XDG Info:" << type;
- qDebug() << INFO->isDesktopFile() << type;
+ //qDebug() << INFO->isDesktopFile() << type;
if(INFO->isDesktopFile() || !type.isEmpty()){
if(INFO->XDG()->type == XDGDesktop::APP){
@@ -310,12 +310,17 @@ void MainUI::getXdgCommand(QString prev){
xdgvaluechanged();
}
-/*void MainUI::stopVideo(QImage img) {
- static bool flag = true;
- if(flag) { player->setPosition(player->duration() / 2); flag = false;}
+void MainUI::stopVideo(QPixmap img) {
+ ui->label_file_icon->setPixmap( img.scaledToHeight(64) );
player->pause();
- ui->label_file_icon->setPixmap( QPixmap::fromImage( img.scaledToHeight(64) ));
-}*/
+}
+
+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
diff --git a/src-qt5/desktop-utils/lumina-fileinfo/MainUI.h b/src-qt5/desktop-utils/lumina-fileinfo/MainUI.h
index e1f37425..5ce7b01a 100644
--- a/src-qt5/desktop-utils/lumina-fileinfo/MainUI.h
+++ b/src-qt5/desktop-utils/lumina-fileinfo/MainUI.h
@@ -37,6 +37,7 @@ private:
LFileInfo *INFO;
LVideoSurface *surface;
QMediaPlayer *player;
+ bool flag;
bool canwrite;
bool terminate_thread; //flag for terminating the GetDirSize task
@@ -53,7 +54,8 @@ private slots:
//UI Buttons
void on_push_close_clicked();
void on_push_save_clicked();
- //void stopVideo(QImage);
+ 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();
bgstack15