diff options
author | ZackaryWelch <welch.zackary@gmail.com> | 2017-10-03 15:24:26 -0400 |
---|---|---|
committer | ZackaryWelch <welch.zackary@gmail.com> | 2017-10-03 15:24:26 -0400 |
commit | 711b219a001d0c4fdd61367903696fa1c6ff1a3d (patch) | |
tree | 2682e737fb6e90adcb0f9e465d3cfe2ad2b51c09 /src-qt5/desktop-utils/lumina-fileinfo | |
parent | Adjust the border on the simple scrollbar style, and update the pkg-plist. (diff) | |
download | lumina-711b219a001d0c4fdd61367903696fa1c6ff1a3d.tar.gz lumina-711b219a001d0c4fdd61367903696fa1c6ff1a3d.tar.bz2 lumina-711b219a001d0c4fdd61367903696fa1c6ff1a3d.zip |
Added experimental video thumbnails in lumina-fm and fileinfo
Diffstat (limited to 'src-qt5/desktop-utils/lumina-fileinfo')
-rw-r--r-- | src-qt5/desktop-utils/lumina-fileinfo/MainUI.cpp | 25 | ||||
-rw-r--r-- | src-qt5/desktop-utils/lumina-fileinfo/MainUI.h | 9 | ||||
-rw-r--r-- | src-qt5/desktop-utils/lumina-fileinfo/lumina-fileinfo.pro | 3 |
3 files changed, 31 insertions, 6 deletions
diff --git a/src-qt5/desktop-utils/lumina-fileinfo/MainUI.cpp b/src-qt5/desktop-utils/lumina-fileinfo/MainUI.cpp index d82f09ce..4d695ab4 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,12 +23,17 @@ 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->setVideoOutput(surface); INFO = 0; } MainUI::~MainUI(){ terminate_thread = true; this->close(); + delete surface; + delete player; } //============= @@ -86,7 +92,15 @@ 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{ + }/*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))); + //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{ ui->label_file_icon->setPixmap( LXDG::findIcon( INFO->iconfile(), "unknown").pixmap(QSize(64,64)) ); } //Now verify the tab is available in the widget @@ -103,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){ @@ -296,6 +310,13 @@ void MainUI::getXdgCommand(QString prev){ xdgvaluechanged(); } +/*void MainUI::stopVideo(QImage img) { + static bool flag = true; + if(flag) { player->setPosition(player->duration() / 2); flag = false;} + player->pause(); + ui->label_file_icon->setPixmap( QPixmap::fromImage( img.scaledToHeight(64) )); +}*/ + 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..e1f37425 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,8 @@ public slots: private: Ui::MainUI *ui; LFileInfo *INFO; + LVideoSurface *surface; + QMediaPlayer *player; bool canwrite; bool terminate_thread; //flag for terminating the GetDirSize task @@ -51,6 +53,7 @@ private slots: //UI Buttons void on_push_close_clicked(); void on_push_save_clicked(); + //void stopVideo(QImage); 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\ |