Add videoplayerlib

This commit is contained in:
Oleg Korshul
2019-04-16 10:03:08 +03:00
parent 3b3cec2809
commit dda96abb24
60 changed files with 2757 additions and 0 deletions

View File

@ -0,0 +1,46 @@
<RCC>
<qresource prefix="/">
<file>icons/add-files.png</file>
<file>icons/add-files.svg</file>
<file>icons/add-files-2x.png</file>
<file>icons/add-files-active.png</file>
<file>icons/add-files-active.svg</file>
<file>icons/add-files-active-2x.png</file>
<file>icons/drop-playlist.png</file>
<file>icons/drop-playlist.svg</file>
<file>icons/drop-playlist-2x.png</file>
<file>icons/drop-playlist-active.png</file>
<file>icons/drop-playlist-active.svg</file>
<file>icons/drop-playlist-active-2x.png</file>
<file>icons/fullscreen-on.png</file>
<file>icons/fullscreen-on.svg</file>
<file>icons/fullscreen-on-2x.png</file>
<file>icons/fullscreen-on-active.png</file>
<file>icons/fullscreen-on-active.svg</file>
<file>icons/pause.png</file>
<file>icons/pause.svg</file>
<file>icons/pause-2x.png</file>
<file>icons/pause-active.png</file>
<file>icons/pause-active.svg</file>
<file>icons/pause-active-2x.png</file>
<file>icons/play.png</file>
<file>icons/play.svg</file>
<file>icons/play-2x.png</file>
<file>icons/play-active.png</file>
<file>icons/play-active.svg</file>
<file>icons/play-active-2x.png</file>
<file>icons/playlist.png</file>
<file>icons/playlist.svg</file>
<file>icons/playlist-2x.png</file>
<file>icons/playlist-active.png</file>
<file>icons/playlist-active.svg</file>
<file>icons/playlist-active-2x.png</file>
<file>icons/volume.png</file>
<file>icons/volume.svg</file>
<file>icons/volume-2x.png</file>
<file>icons/volume-active.png</file>
<file>icons/volume-active.svg</file>
<file>icons/volume-active-2x.png</file>
<file>icons/fullscreen-on-active-2x.png</file>
</qresource>
</RCC>

Binary file not shown.

After

Width:  |  Height:  |  Size: 113 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 B

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 30 30" style="enable-background:new 0 0 30 30;" xml:space="preserve" fill="rgb(255, 255, 255)">
<polygon points="24,14 16,14 16,6 14,6 14,14 6,14 6,16 14,16 14,24 16,24 16,16 24,16 "/>
</svg>

After

Width:  |  Height:  |  Size: 372 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 B

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 30 30" style="enable-background:new 0 0 30 30;" xml:space="preserve" fill="rgb(255, 255, 255)" fill-opacity="0.8">
<polygon points="24,14 16,14 16,6 14,6 14,14 6,14 6,16 14,16 14,24 16,24 16,16 24,16 "/>
</svg>

After

Width:  |  Height:  |  Size: 391 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 140 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 B

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 30 30" style="enable-background:new 0 0 30 30;" xml:space="preserve" fill="rgb(255, 255, 255)">
<rect x="5" y="13" width="2" height="2"/>
<rect x="5" y="18" width="2" height="2"/>
<rect x="5" y="8" width="2" height="2"/>
<rect x="9" y="8" width="13" height="2"/>
<rect x="9" y="18" width="4" height="2"/>
<rect x="9" y="13" width="3" height="2"/>
<rect x="15" y="16" width="9" height="9"/>
<polygon points="21,13 21,12 18,12 18,13 14,13 14,15 25,15 25,13 "/>
</svg>

After

Width:  |  Height:  |  Size: 647 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 111 B

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 30 30" style="enable-background:new 0 0 30 30;" xml:space="preserve" fill="rgb(255, 255, 255)" fill-opacity="0.8">
<rect x="5" y="13" width="2" height="2"/>
<rect x="5" y="18" width="2" height="2"/>
<rect x="5" y="8" width="2" height="2"/>
<rect x="9" y="8" width="13" height="2"/>
<rect x="9" y="18" width="4" height="2"/>
<rect x="9" y="13" width="3" height="2"/>
<rect x="15" y="16" width="9" height="9"/>
<polygon points="21,13 21,12 18,12 18,13 14,13 14,15 25,15 25,13 "/>
</svg>

After

Width:  |  Height:  |  Size: 666 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 189 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 184 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 300 B

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 30 30" style="enable-background:new 0 0 30 30;" xml:space="preserve" fill="rgb(255, 255, 255)">
<path class="st0" d="M12.2,16.3L8,20.6V17H6v7h7v-2H9.4l4.2-4.2L12.2,16.3z M8,22L8,22L8,22L8,22z"/>
<polygon class="st0" points="17,6 17,8 20.6,8 16.3,12.2 17.8,13.7 22,9.4 22,13 24,13 24,6 "/>
</svg>

After

Width:  |  Height:  |  Size: 476 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 141 B

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 30 30" style="enable-background:new 0 0 30 30;" xml:space="preserve" fill="rgb(255, 255, 255)" fill-opacity="0.8">
<path class="st0" d="M12.2,16.3L8,20.6V17H6v7h7v-2H9.4l4.2-4.2L12.2,16.3z M8,22L8,22L8,22L8,22z"/>
<polygon class="st0" points="17,6 17,8 20.6,8 16.3,12.2 17.8,13.7 22,9.4 22,13 24,13 24,6 "/>
</svg>

After

Width:  |  Height:  |  Size: 495 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 87 B

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 30 30" style="enable-background:new 0 0 30 30;" xml:space="preserve" fill="rgb(255, 255, 255)">
<rect x="9" y="7" width="2" height="16"/>
<rect x="19" y="7" width="2" height="16"/>
</svg>

After

Width:  |  Height:  |  Size: 368 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 89 B

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 30 30" style="enable-background:new 0 0 30 30;" xml:space="preserve" fill="rgb(255, 255, 255)" fill-opacity="0.8">
<rect x="9" y="7" width="2" height="16"/>
<rect x="19" y="7" width="2" height="16"/>
</svg>

After

Width:  |  Height:  |  Size: 387 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 290 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 285 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 191 B

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 30 30" style="enable-background:new 0 0 30 30;" xml:space="preserve" fill="rgb(255, 255, 255)">
<path d="M8,7.3L22.7,15L8,22.7V7.3 M6,4v22l21-11L6,4L6,4z"/>
</svg>

After

Width:  |  Height:  |  Size: 344 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 193 B

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 30 30" style="enable-background:new 0 0 30 30;" xml:space="preserve" fill="rgb(255, 255, 255)" fill-opacity="0.8">
<path d="M8,7.3L22.7,15L8,22.7V7.3 M6,4v22l21-11L6,4L6,4z"/>
</svg>

After

Width:  |  Height:  |  Size: 363 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 111 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 B

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 30 30" style="enable-background:new 0 0 30 30;" xml:space="preserve" fill="rgb(255, 255, 255)">
<path id="Playlist" class="st0" d="M10,9h13v2H10V9z M10,14h13v2H10V14z M10,19h13v2H10V19z M6,9h2v2H6V9z M6,14h2v2H6V14z M6,19h2
v2H6V19z"/>
</svg>

After

Width:  |  Height:  |  Size: 424 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 91 B

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 30 30" style="enable-background:new 0 0 30 30;" xml:space="preserve" fill="rgb(255, 255, 255)" fill-opacity="0.8">
<path id="Playlist" class="st0" d="M10,9h13v2H10V9z M10,14h13v2H10V14z M10,19h13v2H10V19z M6,9h2v2H6V9z M6,14h2v2H6V14z M6,19h2
v2H6V19z"/>
</svg>

After

Width:  |  Height:  |  Size: 443 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 422 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 406 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 241 B

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 30 30" style="enable-background:new 0 0 30 30;" xml:space="preserve" fill="rgb(255, 255, 255)">
<path d="M15,7.9v14.2l-3.8-2.7L10.6,19H10H4v-8h6h0.6l0.5-0.4L15,7.9 M17,4l-7,5H2v12h8l7,5V4L17,4z"/>
<path d="M24,15c0-2.5-1.5-4.6-3.6-5.5l-0.8,1.8c1.4,0.6,2.4,2,2.4,3.7s-1,3.1-2.4,3.7l0.8,1.8C22.5,19.6,24,17.5,24,15z"/>
<path d="M29,15c0-4.5-2.7-8.4-6.7-10.1l-0.8,1.8C24.7,8.1,27,11.3,27,15s-2.3,6.9-5.5,8.3l0.8,1.8C26.3,23.4,29,19.5,29,15z"/>
</svg>

After

Width:  |  Height:  |  Size: 628 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 251 B

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 30 30" style="enable-background:new 0 0 30 30;" xml:space="preserve" fill="rgb(255, 255, 255)" fill-opacity="0.8">
<path d="M15,7.9v14.2l-3.8-2.7L10.6,19H10H4v-8h6h0.6l0.5-0.4L15,7.9 M17,4l-7,5H2v12h8l7,5V4L17,4z"/>
<path d="M24,15c0-2.5-1.5-4.6-3.6-5.5l-0.8,1.8c1.4,0.6,2.4,2,2.4,3.7s-1,3.1-2.4,3.7l0.8,1.8C22.5,19.6,24,17.5,24,15z"/>
<path d="M29,15c0-4.5-2.7-8.4-6.7-10.1l-0.8,1.8C24.7,8.1,27,11.3,27,15s-2.3,6.9-5.5,8.3l0.8,1.8C26.3,23.4,29,19.5,29,15z"/>
</svg>

After

Width:  |  Height:  |  Size: 647 B

View File

@ -0,0 +1,16 @@
# debian
sudo apt-get install libgstreamer1.0
sudo apt-get install gstreamer1.0-libav
sudo apt-get install gstreamer1.0-plugins-bad
sudo apt-get install gstreamer1.0-plugins-good
sudo apt-get install gstreamer1.0-plugins-ugly
# centos
yum install gstreamer1
yum install gstreamer1-plugins-base
yum install gstreamer1-plugins-good
yum install gstreamer1-plugins-ugly-free
yum -y install epel-release
yum -y install http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm
yum -y install gstreamer1-libav

View File

@ -0,0 +1,104 @@
#ifndef QASCIMAGEVIEW_H
#define QASCIMAGEVIEW_H
#include <QWidget>
#include <QLabel>
#include <QDir>
#include <QFileInfo>
#include <QResizeEvent>
#include <QDragEnterEvent>
#include <QDropEvent>
#include <QPaintEvent>
#include <QWheelEvent>
#include <QMediaPlayer>
#include <QtCore/QtGlobal>
#if defined(BUILD_VIDEO_LIBRARY)
# define VIDEO_LIB_EXPORT Q_DECL_EXPORT
#else
# define VIDEO_LIB_EXPORT Q_DECL_IMPORT
#endif
namespace NSBaseVideoLibrary
{
VIDEO_LIB_EXPORT void Init(QObject* parent);
VIDEO_LIB_EXPORT void Destroy();
VIDEO_LIB_EXPORT void* GetLibrary();
}
class QAscVideoView_Private;
class VIDEO_LIB_EXPORT QAscVideoView : public QWidget
{
Q_OBJECT
public:
explicit QAscVideoView(QWidget *parent, int r, int g, int b);
virtual ~QAscVideoView();
public:
virtual void resizeEvent(QResizeEvent* e);
virtual void paintEvent(QPaintEvent *);
virtual void dragEnterEvent(QDragEnterEvent *event);
virtual void dropEvent(QDropEvent *event);
void mousePressEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);
#if defined(_LINUX) && !defined(_MAC)
virtual void mouseMoveEvent(QMouseEvent* e);
#endif
void keyPressEvent(QKeyEvent *event);
bool eventFilter(QObject *watched, QEvent *event);
virtual bool getMainWindowFullScreen();
virtual void setMainWindowFullScreen(bool bIsFullScreen);
public:
void PlayPause();
void Volume();
void Fullscreen();
void Playlist(double duration = 100);
void SavePlayListAddons(const QString& sAddon);
void AddFilesToPlaylist(QStringList& files, const bool isStart = false);
void LoadPlaylist();
void SavePlaylist();
void setFooterVisible(bool isVisible);
void setPlayListUsed(bool isUsed);
void setFullScreenUsed(bool isUsed);
void setPresentationMode(bool isPresentationMode);
void setMedia(QString sMedia);
void Stop();
signals:
void OnTitleChanged(const QString& sTitle);
public slots:
void slotPlayPause();
void slotVolume();
void slotFullscreen();
void slotPlaylist();
void slotVolumeChanged(int nValue);
void slotSeekChanged(int nValue);
void slotOpenFile(QString sFile);
void slotPlayerPosChanged(int nPos);
void slotPlayerStateChanged(QMediaPlayer::State state);
void slotVideoAvailableChanged(bool videoAvailable);
protected:
void UpdatePlayPause();
public:
QAscVideoView_Private* m_pInternal;
};
#endif // QASCIMAGEVIEW_H

View File

@ -0,0 +1,68 @@
#include "../qascvideoview.h"
#include "./lib_base.h"
#ifdef USE_VLC_LIBRARY
#include <QCoreApplication>
#include "../../../../core/DesktopEditor/common/File.h"
#include "../../../../core/DesktopEditor/common/Directory.h"
static VlcInstance* g_vlc_instance = NULL;
void NSBaseVideoLibrary::Init(QObject* parent)
{
if (g_vlc_instance)
return;
if (!parent)
return;
QCoreApplication::setAttribute(Qt::AA_X11InitThreads);
std::wstring sProcessDir = NSFile::GetProcessDirectory();
std::wstring sPluginsDir = sProcessDir + L"/plugins";
if (!NSDirectory::Exists(sPluginsDir))
{
std::vector<std::wstring> dirs = NSDirectory::GetDirectories(sProcessDir + L"/..");
for (std::vector<std::wstring>::iterator i = dirs.begin(); i != dirs.end(); i++)
{
std::wstring sTest = *i + L"/plugins";
if (NSDirectory::Exists(sTest))
{
sPluginsDir = sTest;
break;
}
}
}
VlcCommon::setPluginPath(QString::fromStdWString(sPluginsDir));
g_vlc_instance = new VlcInstance(VlcCommon::args(), NULL);
}
void NSBaseVideoLibrary::Destroy()
{
if (g_vlc_instance)
{
delete g_vlc_instance;
g_vlc_instance = NULL;
}
}
void* NSBaseVideoLibrary::GetLibrary()
{
return (void*)g_vlc_instance;
}
#else
void NSBaseVideoLibrary::Init(QObject* parent)
{
}
void NSBaseVideoLibrary::Destroy()
{
}
void* NSBaseVideoLibrary::GetLibrary()
{
return NULL;
}
#endif

View File

@ -0,0 +1,19 @@
#ifndef QUSE_VLC_BASE_H
#define QUSE_VLC_BASE_H
#include <QObject>
#ifdef USE_VLC_LIBRARY
#include <VLCQtCore/Common.h>
#include <VLCQtCore/Instance.h>
#include <VLCQtCore/Media.h>
#include <VLCQtCore/MediaPlayer.h>
#include <VLCQtCore/Audio.h>
#include <VLCQtCore/Video.h>
#include <VLCQtWidgets/WidgetSeek.h>
#include <VLCQtWidgets/WidgetVideo.h>
#endif
#endif // QUSE_VLC_BASE_H

View File

@ -0,0 +1,507 @@
#include <QPrinter>
#include <QPainter>
#include <QPrintDialog>
#include <QMimeData>
#include <QStyleOption>
#include <QPropertyAnimation>
#include "../../../../core/DesktopEditor/common/File.h"
#include "qpushbutton_icons.h"
#include "../qascvideoview.h"
#include "qfooterpanel.h"
#include "qvideoplaylist.h"
#include "qascvideowidget.h"
#include "qvideoslider.h"
#ifdef USE_VLC_LIBRARY
#ifdef WIN32
//#define USE_VLC_LIBRARY_VIDEO
#endif
#endif
#ifdef USE_VLC_LIBRARY_VIDEO
class QVideoWidgetParent : public QVideoWidget
{
Q_OBJECT
public:
QWidget* m_pChild;
public:
explicit QVideoWidgetParent(QWidget *parent = Q_NULLPTR);
public:
virtual void resizeEvent(QResizeEvent* event);
};
#else
typedef QWidget QVideoWidgetParent;
#endif
#ifdef USE_VLC_LIBRARY_VIDEO
QVideoWidgetParent::QVideoWidgetParent(QWidget* parent) : QVideoWidget(parent)
{
m_pChild = NULL;
}
void QVideoWidgetParent::resizeEvent(QResizeEvent *event)
{
QVideoWidget::resizeEvent(event);
if (m_pChild)
m_pChild->setGeometry(0, 0, width(), height());
}
#endif
QAscVideoView::QAscVideoView(QWidget *parent, int r, int g, int b) : QWidget(parent)
{
NSBaseVideoLibrary::Init(parent);
m_pInternal = new QAscVideoView_Private();
QWidget_setBackground(this, 0x22, 0x22, 0x22);
m_pInternal->m_pFooter = new QFooterPanel(this);
QWidget_setBackground(m_pInternal->m_pFooter, r, g, b);
this->setStyleSheet("QFrame {border: none;}");
QWidget* pParentVideo = new QVideoWidgetParent(this);
pParentVideo->setGeometry(0, 0, width(), height());
m_pInternal->m_pPlayer = new QAscVideoWidget(pParentVideo);
m_pInternal->m_pPlayer->m_pView = this;
m_pInternal->m_pPlayer->installEventFilter(this);
m_pInternal->m_pPlaylist = new QVideoPlaylist(this);
m_pInternal->m_pPlaylist->setGeometry(width(), 0, 250, height());
QObject::connect(m_pInternal->m_pPlaylist, SIGNAL(fileChanged(QString)), this, SLOT(slotOpenFile(QString)));
m_pInternal->m_pVolumeControl = new QWidget(this);
m_pInternal->m_pVolumeControl->setHidden(true);
m_pInternal->m_pVolumeControl->setGeometry(0, 0, 60, 160);
m_pInternal->m_pVolumeControl->setStyleSheet("border: none; background-color:#111111");
m_pInternal->m_pVolumeControlV = new QVideoSlider(m_pInternal->m_pVolumeControl);
m_pInternal->m_pVolumeControlV->setOrientation(Qt::Vertical);
m_pInternal->m_pVolumeControlV->setGeometry(15, 20, 30, 120);
m_pInternal->m_pVolumeControlV->setMinimum(0);
m_pInternal->m_pVolumeControlV->setMaximum(100);
m_pInternal->m_pVolumeControlV->setValue(50);
QObject::connect(m_pInternal->m_pVolumeControlV, SIGNAL(valueChanged(int)), this, SLOT(slotVolumeChanged(int)));
// init events
QObject::connect(m_pInternal->m_pFooter->m_pPlayPause, SIGNAL(clicked(bool)), this, SLOT(slotPlayPause()));
QObject::connect(m_pInternal->m_pFooter->m_pVolume, SIGNAL(clicked(bool)), this, SLOT(slotVolume()));
QObject::connect(m_pInternal->m_pFooter->m_pFullscreen, SIGNAL(clicked(bool)), this, SLOT(slotFullscreen()));
QObject::connect(m_pInternal->m_pFooter->m_pPlaylist, SIGNAL(clicked(bool)), this, SLOT(slotPlaylist()));
QObject::connect(m_pInternal->m_pFooter->m_pSlider, SIGNAL(valueChanged(int)), this, SLOT(slotSeekChanged(int)));
QObject::connect(m_pInternal->m_pPlayer, SIGNAL(stateChanged(QMediaPlayer::State)), this, SLOT(slotPlayerStateChanged(QMediaPlayer::State)));
QObject::connect(m_pInternal->m_pPlayer, SIGNAL(posChanged(int)), this, SLOT(slotPlayerPosChanged(int)));
#ifndef USE_VLC_LIBRARY
QObject::connect(m_pInternal->m_pPlayer->getEngine(), SIGNAL(videoAvailableChanged(bool)), this, SLOT(slotVideoAvailableChanged(bool)));
#else
#endif
setAcceptDrops(true);
#if defined(_LINUX) && !defined(_MAC)
this->setMouseTracking(true);
m_pInternal->m_pPlayer->setMouseTracking(true);
m_pInternal->m_pPlaylist->setMouseTracking(true);
#endif
m_pInternal->m_bIsShowingPlaylist = false;
m_pInternal->m_bIsPlay = true;
m_pInternal->m_bIsEnabledPlayList = true;
m_pInternal->m_bIsEnabledFullscreen = true;
m_pInternal->m_bIsPresentationMode = false;
m_pInternal->m_bIsPresentationModeMediaTypeSended = false;
m_pInternal->m_bIsDestroy = false;
UpdatePlayPause();
m_pInternal->m_bIsSeekEnabled = true;
m_pInternal->m_pFooter->installEventFilter(this);
m_pInternal->m_pFooter->m_pFullscreen->installEventFilter(this);
m_pInternal->m_pFooter->m_pVolume->installEventFilter(this);
m_pInternal->m_pFooter->m_pPlaylist->installEventFilter(this);
m_pInternal->m_pFooter->m_pSlider->installEventFilter(this);
m_pInternal->m_pFooter->m_pPlayPause->installEventFilter(this);
}
QAscVideoView::~QAscVideoView()
{
}
void QAscVideoView::resizeEvent(QResizeEvent* e)
{
QWidget::resizeEvent(e);
QSize size = this->size();
double dDpi = QWidget_GetDPI(this);
int nFooterH = QWidget_ScaleDPI(m_pInternal->m_pFooter->m_nHeigth, dDpi);
if (this->getMainWindowFullScreen())
nFooterH = 0;
m_pInternal->m_pFooter->setGeometry(0, size.height() - nFooterH, size.width(), nFooterH);
int nViewHeight = size.height();
if (!m_pInternal->m_bIsPresentationMode)
nViewHeight -= nFooterH;
m_pInternal->m_pPlayer->parentWidget()->setGeometry(0, 0, width(), nViewHeight);
m_pInternal->m_pPlayer->setGeometry(0, 0, width(), nViewHeight);
if (m_pInternal->m_bIsPresentationMode)
nViewHeight -= nFooterH;
int nVolumeVHeight = QWidget_ScaleDPI(160, dDpi);
if (nVolumeVHeight > nViewHeight)
nVolumeVHeight = nViewHeight;
int nVolumeVHeightSlider = nVolumeVHeight - QWidget_ScaleDPI(40, dDpi);
if (30 > nVolumeVHeightSlider)
nVolumeVHeightSlider = 30;
m_pInternal->m_pVolumeControl->setGeometry(0, 0, QWidget_ScaleDPI(60, dDpi), nVolumeVHeight);
m_pInternal->m_pVolumeControlV->setGeometry(QWidget_ScaleDPI(15, dDpi), QWidget_ScaleDPI(20, dDpi), QWidget_ScaleDPI(30, dDpi), nVolumeVHeightSlider);
int nOffsetVolume = QWidget_ScaleDPI(135, dDpi);
if (!m_pInternal->m_bIsEnabledPlayList)
nOffsetVolume -= QWidget_ScaleDPI(35, dDpi);
if (!m_pInternal->m_bIsEnabledFullscreen)
nOffsetVolume -= QWidget_ScaleDPI(35, dDpi);
m_pInternal->m_pVolumeControl->move(width() - nOffsetVolume, nViewHeight - m_pInternal->m_pVolumeControl->height());
m_pInternal->m_pVolumeControlV->resizeEvent(NULL);
m_pInternal->m_pPlaylist->setGeometry(m_pInternal->m_bIsShowingPlaylist ? (width() - QWidget_ScaleDPI(250, dDpi)) : width(), 0, QWidget_ScaleDPI(250, dDpi), nViewHeight);
}
void QAscVideoView::paintEvent(QPaintEvent *)
{
QStyleOption opt;
opt.init(this);
QPainter p(this);
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
}
void QAscVideoView::dragEnterEvent(QDragEnterEvent *event)
{
QList<QUrl> urls = event->mimeData()->urls();
CVideoExt ext;
QSet<QString> _exts = ext.getQSet(false);
for (int i = 0; i < urls.count(); i++)
{
QFileInfo oInfo(urls[i].toString());
if (_exts.contains(oInfo.suffix().toLower()))
{
event->acceptProposedAction();
return;
}
}
}
void QAscVideoView::dropEvent(QDropEvent *event)
{
QList<QUrl> urls = event->mimeData()->urls();
QStringList files;
for (int i = 0; i < urls.count(); i++)
{
files.append(urls[i].toLocalFile());
}
m_pInternal->m_pPlaylist->AddFiles(files, true);
event->acceptProposedAction();
}
void QAscVideoView::mousePressEvent(QMouseEvent *event)
{
if (!m_pInternal->m_pVolumeControl->isHidden())
m_pInternal->m_pVolumeControl->setHidden(true);
if (event->button() == Qt::LeftButton)
{
if (m_pInternal->m_bIsShowingPlaylist)
Playlist();
}
setFocus();
}
void QAscVideoView::mouseReleaseEvent(QMouseEvent *event)
{
if (event->button() == Qt::LeftButton)
{
if (m_pInternal->m_bIsPresentationMode)
{
m_pInternal->m_pFooter->setHidden(!m_pInternal->m_pFooter->isHidden());
if (!m_pInternal->m_pFooter->isHidden())
{
m_pInternal->m_pFooter->raise();
}
}
}
}
#if defined(_LINUX) && !defined(_MAC)
#include <QApplication>
void QAscVideoView::mouseMoveEvent(QMouseEvent* e)
{
QApplication::setOverrideCursor(QCursor(Qt::ArrowCursor));
}
#endif
void QAscVideoView::keyPressEvent(QKeyEvent *event)
{
m_pInternal->m_pPlayer->keyPressEvent(event);
Qt::KeyboardModifiers ee = event->modifiers();
switch (event->key())
{
case Qt::Key_Left:
{
m_pInternal->m_pFooter->m_pSlider->event(event);
break;
}
case Qt::Key_Right:
{
m_pInternal->m_pFooter->m_pSlider->event(event);
break;
}
default:
break;
}
}
bool QAscVideoView::eventFilter(QObject *watched, QEvent *event)
{
if (event->type() == QEvent::KeyPress)
{
this->keyPressEvent((QKeyEvent*)event);
return true;
}
return QWidget::eventFilter(watched, event);
}
void QAscVideoView::PlayPause()
{
if (m_pInternal->m_bIsPlay)
m_pInternal->m_pPlayer->setPlay();
else
m_pInternal->m_pPlayer->setPause();
}
void QAscVideoView::Volume()
{
m_pInternal->m_pVolumeControl->setHidden(!m_pInternal->m_pVolumeControl->isHidden());
}
void QAscVideoView::Fullscreen()
{
m_pInternal->m_pPlayer->setFullScreenOnCurrentScreen(true);
}
void QAscVideoView::Playlist(double duration)
{
m_pInternal->m_bIsShowingPlaylist = !m_pInternal->m_bIsShowingPlaylist;
if (m_pInternal->m_bIsShowingPlaylist)
{
QPropertyAnimation *animation = new QPropertyAnimation(m_pInternal->m_pPlaylist, "pos");
animation->setDuration(duration);
animation->setStartValue(QPoint(m_pInternal->m_pPlaylist->x(), 0));
double dDpi = QWidget_GetDPI(this);
animation->setEndValue(QPoint(width() - QWidget_ScaleDPI(250, dDpi), 0));
animation->start();
}
else
{
QPropertyAnimation *animation = new QPropertyAnimation(m_pInternal->m_pPlaylist, "pos");
animation->setDuration(duration);
animation->setStartValue(QPoint(m_pInternal->m_pPlaylist->x(), 0));
animation->setEndValue(QPoint(width(), 0));
animation->start();
}
}
void QAscVideoView::SavePlayListAddons(const QString& sAddon)
{
m_pInternal->m_pPlaylist->m_sSavePlayListAddon = sAddon;
}
void QAscVideoView::AddFilesToPlaylist(QStringList& files, const bool isStart)
{
m_pInternal->m_pPlaylist->AddFiles(files, isStart);
}
void QAscVideoView::LoadPlaylist()
{
m_pInternal->m_pPlaylist->Load();
}
void QAscVideoView::SavePlaylist()
{
m_pInternal->m_pPlaylist->Save();
}
void QAscVideoView::setPlayListUsed(bool isUsed)
{
m_pInternal->m_bIsEnabledPlayList = isUsed;
m_pInternal->m_pFooter->m_bIsEnabledPlayList = isUsed;
m_pInternal->m_pFooter->m_pPlaylist->setHidden(!isUsed);
}
void QAscVideoView::setFullScreenUsed(bool isUsed)
{
m_pInternal->m_bIsEnabledFullscreen = isUsed;
m_pInternal->m_pFooter->m_bIsEnabledFullscreen = isUsed;
m_pInternal->m_pFooter->m_pFullscreen->setHidden(!isUsed);
}
void QAscVideoView::setPresentationMode(bool isPresentationMode)
{
m_pInternal->m_bIsPresentationMode = isPresentationMode;
}
void QAscVideoView::setMedia(QString sMedia)
{
QStringList files;
files.append(sMedia);
AddFilesToPlaylist(files, true);
}
void QAscVideoView::Stop()
{
m_pInternal->m_bIsDestroy = true;
m_pInternal->m_pPlayer->stop();
}
void QAscVideoView::setFooterVisible(bool isVisible)
{
m_pInternal->m_pFooter->setHidden(!isVisible);
}
void QAscVideoView::slotPlayPause()
{
this->PlayPause();
}
void QAscVideoView::slotVolume()
{
this->Volume();
}
void QAscVideoView::slotFullscreen()
{
if (m_pInternal->m_bIsShowingPlaylist)
Playlist(0);
if (!m_pInternal->m_pVolumeControl->isHidden())
m_pInternal->m_pVolumeControl->setHidden(true);
this->Fullscreen();
}
void QAscVideoView::slotPlaylist()
{
this->Playlist();
}
void QAscVideoView::slotVolumeChanged(int nValue)
{
m_pInternal->m_pPlayer->setVolume(nValue);
}
void QAscVideoView::slotSeekChanged(int nValue)
{
if (m_pInternal->m_bIsSeekEnabled)
m_pInternal->m_pPlayer->setSeek(nValue);
}
void QAscVideoView::UpdatePlayPause()
{
m_pInternal->m_pFooter->SetPlayPause(m_pInternal->m_bIsPlay);
}
void QAscVideoView::slotOpenFile(QString sFile)
{
m_pInternal->m_pPlayer->open(sFile);
if (sFile == "")
return;
std::wstring sFileW = sFile.toStdWString();
std::wstring sFileName = NSFile::GetFileName(sFileW);
emit OnTitleChanged(QString::fromStdWString(sFileName));
}
void QAscVideoView::slotPlayerPosChanged(int nPos)
{
m_pInternal->m_bIsSeekEnabled = false;
m_pInternal->m_pFooter->m_pSlider->setValue(nPos);
m_pInternal->m_bIsSeekEnabled = true;
}
void QAscVideoView::slotPlayerStateChanged(QMediaPlayer::State state)
{
m_pInternal->m_bIsPlay = (state == QMediaPlayer::PlayingState) ? false : true;
UpdatePlayPause();
if (!m_pInternal->m_bIsPlay)
{
if (!m_pInternal->m_pFooter->isHidden())
{
m_pInternal->m_pFooter->raise();
}
#ifdef USE_VLC_LIBRARY
if (m_pInternal->m_bIsPresentationMode && !m_pInternal->m_bIsPresentationModeMediaTypeSended)
{
m_pInternal->m_bIsPresentationModeMediaTypeSended = true;
if (!m_pInternal->m_pPlayer->isAudio() && !m_pInternal->m_bIsDestroy)
this->show();
}
#endif
}
if (state == QMediaPlayer::StoppedState
#ifndef USE_VLC_LIBRARY
&& QMediaPlayer::EndOfMedia == m_pInternal->m_pPlayer->getEngine()->mediaStatus()
#endif
)
{
m_pInternal->m_pPlaylist->Next();
}
}
bool QAscVideoView::getMainWindowFullScreen()
{
return false;
}
void QAscVideoView::setMainWindowFullScreen(bool bIsFullScreen)
{
return;
}
void QAscVideoView::slotVideoAvailableChanged(bool videoAvailable)
{
if (m_pInternal->m_bIsPresentationMode && !m_pInternal->m_bIsPresentationModeMediaTypeSended)
{
m_pInternal->m_bIsPresentationModeMediaTypeSended = true;
if (!m_pInternal->m_pPlayer->isAudio() && !m_pInternal->m_bIsDestroy)
this->show();
}
}

View File

@ -0,0 +1,359 @@
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** You may use this file under the terms of the BSD license as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
** * Neither the name of The Qt Company Ltd nor the names of its
** contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "../qascvideoview.h"
#include "qascvideowidget.h"
#include <QKeyEvent>
#include <QMouseEvent>
#include <QApplication>
#include <QDesktopWidget>
#include <QWindow>
#include <QScreen>
#ifdef ASC_MAIN_WINDOW_HAS_QWINDOW_AS_PARENT
#define USE_ASC_MAINWINDOW_FULLSCREEN
#endif
#ifndef USE_ASC_MAINWINDOW_FULLSCREEN
#ifndef USE_VLC_LIBRARY_VIDEO
#define USE_ASC_MAINWINDOW_FULLSCREEN
#endif
#endif
QAscVideoWidget::QAscVideoWidget(QWidget *parent)
: QASCVIDEOBASE(parent)
{
m_pParent = parent;
m_nVolume = 50;
setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
/*
QPalette p = palette();
p.setColor(QPalette::Window, Qt::black);
setPalette(p);
setAttribute(Qt::WA_OpaquePaintEvent);
*/
m_pEngine = NULL;
#ifdef USE_VLC_LIBRARY
m_pVlcPlayer = NULL;
#endif
#ifndef USE_VLC_LIBRARY
m_pEngine = new QMediaPlayer(parent);
m_pEngine->setVideoOutput(this);
QObject::connect(m_pEngine, SIGNAL(stateChanged(QMediaPlayer::State)), this, SLOT(slotChangeState(QMediaPlayer::State)));
QObject::connect(m_pEngine, SIGNAL(positionChanged(qint64)), this, SLOT(slotPositionChange(qint64)));
#else
m_pVlcPlayer = new VlcMediaPlayer((VlcInstance*)NSBaseVideoLibrary::GetLibrary());
m_pVlcPlayer->setVideoWidget(this);
QObject::connect(m_pVlcPlayer, SIGNAL(stateChanged()), this, SLOT(slotVlcStateChanged()));
QObject::connect(m_pVlcPlayer, SIGNAL(timeChanged(int)), this, SLOT(slotVlcTimeChanged(int)));
m_pMedia = NULL;
#endif
}
QAscVideoWidget::~QAscVideoWidget()
{
#ifdef USE_VLC_LIBRARY
m_pVlcPlayer->stop();
m_pVlcPlayer->deleteLater();
#endif
}
void QAscVideoWidget::keyPressEvent(QKeyEvent *event)
{
if (event->key() == Qt::Key_Escape && isVideoFullScreen())
{
setFullScreenOnCurrentScreen(false);
event->accept();
}
else if (((event->key() == Qt::Key_Enter) || (event->key() == Qt::Key_Return)) && event->modifiers() & Qt::AltModifier)
{
setFullScreenOnCurrentScreen(!isVideoFullScreen());
event->accept();
}
else
{
QASCVIDEOBASE::keyPressEvent(event);
}
}
void QAscVideoWidget::mouseDoubleClickEvent(QMouseEvent *event)
{
QAscVideoView* pView = (QAscVideoView*)(m_pParent->parentWidget());
if (!pView->m_pInternal->m_bIsPresentationMode)
setFullScreenOnCurrentScreen(!isVideoFullScreen());
event->accept();
}
void QAscVideoWidget::mousePressEvent(QMouseEvent *event)
{
QASCVIDEOBASE::mousePressEvent(event);
}
#if defined(_LINUX) && !defined(_MAC)
#include <QApplication>
void QAscVideoWidget::mouseMoveEvent(QMouseEvent* e)
{
QApplication::setOverrideCursor(QCursor(Qt::ArrowCursor));
}
#endif
void QAscVideoWidget::setPlay()
{
#ifndef USE_VLC_LIBRARY
m_pEngine->play();
#else
m_pVlcPlayer->play();
#endif
}
void QAscVideoWidget::setPause()
{
#ifndef USE_VLC_LIBRARY
m_pEngine->pause();
#else
m_pVlcPlayer->pause();
#endif
}
void QAscVideoWidget::setVolume(int nVolume)
{
m_nVolume = nVolume;
#ifndef USE_VLC_LIBRARY
m_pEngine->setVolume(nVolume);
#else
if (m_pVlcPlayer->audio())
m_pVlcPlayer->audio()->setVolume(nVolume * 2);
#endif
}
void QAscVideoWidget::setSeek(int nPos)
{
#ifndef USE_VLC_LIBRARY
qint64 nDuration = m_pEngine->duration();
double dProgress = (double)nPos / 100000.0;
m_pEngine->setPosition((qint64)(dProgress * nDuration));
#else
qint64 nDuration = m_pMedia ? m_pMedia->duration() : 0;
double dProgress = (double)nPos / 100000.0;
m_pVlcPlayer->setTime((int)(dProgress * nDuration));
#endif
}
void QAscVideoWidget::open(QString& sFile)
{
#ifndef USE_VLC_LIBRARY
m_pEngine->setMedia(QMediaContent(QUrl::fromLocalFile(sFile)));
m_pEngine->play();
#else
if (!m_pMedia && !sFile.isEmpty())
{
delete m_pMedia;
m_pMedia = NULL;
}
if (sFile.isEmpty())
{
m_pVlcPlayer->stop();
return;
}
m_pMedia = new VlcMedia(sFile, true, (VlcInstance*)NSBaseVideoLibrary::GetLibrary());
m_pVlcPlayer->open(m_pMedia);
#endif
}
bool QAscVideoWidget::isVideoFullScreen()
{
#ifdef USE_ASC_MAINWINDOW_FULLSCREEN
return ((QAscVideoView*)(m_pParent->parentWidget()))->getMainWindowFullScreen();
#else
return isFullScreen();
#endif
}
void QAscVideoWidget::setFullScreenOnCurrentScreen(bool isFullscreen)
{
if (isFullscreen == isVideoFullScreen())
return;
#ifndef USE_VLC_LIBRARY
#ifdef USE_ASC_MAINWINDOW_FULLSCREEN
((QAscVideoView*)(m_pParent->parentWidget()))->setMainWindowFullScreen(isFullscreen);
#else
setFullScreen(isFullscreen);
#endif
#else
if (isFullscreen)
{
#ifdef USE_VLC_LIBRARY_VIDEO
((QVideoWidget*)m_pParent)->setFullScreen(true);
#endif
#ifdef USE_ASC_MAINWINDOW_FULLSCREEN
((QAscVideoView*)(m_pParent->parentWidget()))->setMainWindowFullScreen(true);
#else
QPoint pt = mapToGlobal(pos());
QRect rect = QApplication::desktop()->screenGeometry(m_pParent);
this->setParent(NULL);
this->showFullScreen();
this->setGeometry(rect);
#endif
}
else
{
#ifdef USE_VLC_LIBRARY_VIDEO
((QVideoWidget*)m_pParent)->setFullScreen(false);
m_pParent->lower();
#endif
#ifdef USE_ASC_MAINWINDOW_FULLSCREEN
((QAscVideoView*)(m_pParent->parentWidget()))->setMainWindowFullScreen(false);
#else
this->setParent(m_pParent);
showNormal();
this->lower();
#endif
QAscVideoView* pView = (QAscVideoView*)(m_pParent->parentWidget());
m_pParent->stackUnder(pView->m_pInternal->m_pVolumeControl);
m_pParent->stackUnder(pView->m_pInternal->m_pPlaylist);
pView->m_pInternal->m_pVolumeControl->raise();
pView->m_pInternal->m_pPlaylist->raise();
this->setGeometry(0, 0, m_pParent->width(), m_pParent->height());
}
#endif
if (!isFullscreen)
{
((QAscVideoView*)this->m_pView)->resizeEvent(NULL);
}
}
void QAscVideoWidget::slotChangeState(QMediaPlayer::State state)
{
if (QMediaPlayer::PlayingState == state)
setVolume(m_nVolume);
emit stateChanged(state);
}
#ifdef USE_VLC_LIBRARY
void QAscVideoWidget::slotVlcStateChanged()
{
Vlc::State state = m_pVlcPlayer->state();
int stateQ = -1;
if (state == Vlc::Playing)
{
stateQ = QMediaPlayer::PlayingState;
setVolume(m_nVolume);
}
else if (state == Vlc::Paused)
stateQ = QMediaPlayer::PausedState;
else if (state == Vlc::Ended)
stateQ = QMediaPlayer::StoppedState;
if (stateQ < 0)
return;
emit stateChanged((QMediaPlayer::State)stateQ);
}
void QAscVideoWidget::slotVlcTimeChanged(int time)
{
qint64 nDuration = m_pMedia->duration();
double dProgress = (double)time / nDuration;
emit posChanged((int)(100000 * dProgress + 0.5));
}
#endif
void QAscVideoWidget::slotPositionChange(qint64 pos)
{
qint64 nDuration = m_pEngine->duration();
double dProgress = (double)pos / nDuration;
emit posChanged((int)(100000 * dProgress + 0.5));
}
QMediaPlayer* QAscVideoWidget::getEngine()
{
return m_pEngine;
}
bool QAscVideoWidget::isAudio()
{
#ifdef USE_VLC_LIBRARY
if (!m_pVlcPlayer || !m_pVlcPlayer->video())
return true;
if (0 == m_pVlcPlayer->video()->trackCount())
return true;
return false;
#else
if (m_pEngine && m_pEngine->isVideoAvailable())
return false;
return true;
#endif
}
void QAscVideoWidget::stop()
{
#ifdef USE_VLC_LIBRARY
if (m_pVlcPlayer)
m_pVlcPlayer->stop();
#else
if (m_pEngine)
m_pEngine->stop();
#endif
}

View File

@ -0,0 +1,102 @@
#pragma once
#include <QWidget>
#include "lib_base.h"
#include <QVideoWidget>
#include <QMediaPlayer>
#include "qfooterpanel.h"
#include "qvideoplaylist.h"
#ifndef USE_VLC_LIBRARY
#define QASCVIDEOBASE QVideoWidget
#else
#define QASCVIDEOBASE VlcWidgetVideo
#endif
class QAscVideoWidget;
class QAscVideoView_Private
{
public:
QFooterPanel* m_pFooter;
QWidget* m_pVolumeControl;
QVideoSlider* m_pVolumeControlV;
QVideoPlaylist* m_pPlaylist;
QAscVideoWidget* m_pPlayer;
bool m_bIsShowingPlaylist;
bool m_bIsPlay;
bool m_bIsSeekEnabled;
bool m_bIsEnabledPlayList;
bool m_bIsEnabledFullscreen;
bool m_bIsPresentationMode;
bool m_bIsPresentationModeMediaTypeSended;
bool m_bIsDestroy;
};
class QAscVideoWidget : public QASCVIDEOBASE
{
Q_OBJECT
QMediaPlayer* m_pEngine;
#ifdef USE_VLC_LIBRARY
VlcMediaPlayer* m_pVlcPlayer;
VlcMedia* m_pMedia;
#endif
int m_nVolume;
public:
QWidget* m_pParent;
public:
QAscVideoWidget(QWidget *parent = 0);
~QAscVideoWidget();
public:
void keyPressEvent(QKeyEvent *event);
void mouseDoubleClickEvent(QMouseEvent *event);
void mousePressEvent(QMouseEvent *event);
#if defined(_LINUX) && !defined(_MAC)
virtual void mouseMoveEvent(QMouseEvent* e);
#endif
public:
void open(QString& sFile);
void setPlay();
void setPause();
void setVolume(int nVolume);
void setSeek(int nPos);
bool isVideoFullScreen();
void setFullScreenOnCurrentScreen(bool isFullscreen);
QMediaPlayer* getEngine();
bool isAudio();
void stop();
signals:
void stateChanged(QMediaPlayer::State);
void posChanged(int);
public slots:
void slotChangeState(QMediaPlayer::State state);
void slotPositionChange(qint64 pos);
#ifdef USE_VLC_LIBRARY
void slotVlcStateChanged();
void slotVlcTimeChanged(int time);
#endif
public:
QWidget* m_pView;
};

View File

@ -0,0 +1,89 @@
#include "qfooterpanel.h"
#include <QStyleOption>
#include <QPainter>
#include "qpushbutton_icons.h"
QFooterPanel::QFooterPanel(QWidget *parent) : QWidget(parent)
{
m_nHeigth = 40;
m_pPlayPause = new QIconPushButton(this, true, "play", "play-active");
m_pVolume = new QIconPushButton(this, true, "volume", "volume-active");
m_pFullscreen = new QIconPushButton(this, true, "fullscreen-on", "fullscreen-on-active");
m_pPlaylist = new QIconPushButton(this, true, "playlist", "playlist-active");
m_pSlider = new QVideoSlider(this);
m_pSlider->setOrientation(Qt::Horizontal);
m_pSlider->setMinimum(0);
m_pSlider->setMaximum(100000);
m_pSlider->setValue(0);
m_pSlider->setSingleStep(1000);
m_pSlider->setShortcutEnabled(QKeySequence::Back, true);
m_pSlider->setShortcutEnabled(QKeySequence::Forward, true);
m_pSlider->SetSeekOnClick(true);
m_bIsEnabledPlayList = true;
m_bIsEnabledFullscreen = true;
#if defined(_LINUX) && !defined(_MAC)
this->setMouseTracking(true);
m_pSlider->setMouseTracking(true);
m_pFullscreen->setMouseTracking(true);
m_pPlaylist->setMouseTracking(true);
m_pVolume->setMouseTracking(true);
m_pPlayPause->setMouseTracking(true);
this->setCursor(QCursor(Qt::ArrowCursor));
#endif
}
void QFooterPanel::resizeEvent(QResizeEvent* e)
{
double dDpi = QWidget_GetDPI(this);
int nWidth = this->width();
int nButW = QWidget_ScaleDPI(30, dDpi);
int nY = QWidget_ScaleDPI(5, dDpi);
int nBetweenButtons = QWidget_ScaleDPI(10, dDpi);
int nLeft = nBetweenButtons;
m_pPlayPause->setGeometry(nLeft, nY, nButW, nButW); nLeft += (nButW + nBetweenButtons);
int nRight = nWidth;
nRight -= (nBetweenButtons + nButW);
if (m_bIsEnabledPlayList)
{
m_pPlaylist->setGeometry(nRight, nY, nButW, nButW); nRight -= (nBetweenButtons + nButW);
}
if (m_bIsEnabledFullscreen)
{
m_pFullscreen->setGeometry(nRight, nY, nButW, nButW); nRight -= (nBetweenButtons + nButW);
}
m_pVolume->setGeometry(nRight, nY, nButW, nButW); nRight -= nBetweenButtons;
m_pSlider->setGeometry(nLeft, nY, nRight - nLeft, nButW);
}
void QFooterPanel::paintEvent(QPaintEvent *)
{
QStyleOption opt;
opt.init(this);
QPainter p(this);
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
}
#if defined(_LINUX) && !defined(_MAC)
#include <QApplication>
void QFooterPanel::mouseMoveEvent(QMouseEvent* e)
{
QApplication::setOverrideCursor(QCursor(Qt::ArrowCursor));
}
#endif
void QFooterPanel::SetPlayPause(bool bIsPlay)
{
QString sI = bIsPlay ? "play" : "pause";
((QIconPushButton*)m_pPlayPause)->changeIcons(sI, sI + "-active");
}

View File

@ -0,0 +1,42 @@
#ifndef QFOOTERPANEL_H
#define QFOOTERPANEL_H
#include <QWidget>
#include <QPushButton>
#include <QResizeEvent>
#include <QPaintEvent>
#include <QSlider>
#include "qvideoslider.h"
class QFooterPanel : public QWidget
{
Q_OBJECT
public:
explicit QFooterPanel(QWidget *parent = 0);
virtual void resizeEvent(QResizeEvent* e);
virtual void paintEvent(QPaintEvent *);
#if defined(_LINUX) && !defined(_MAC)
virtual void mouseMoveEvent(QMouseEvent* e);
#endif
public:
QPushButton* m_pPlayPause;
QPushButton* m_pVolume;
QPushButton* m_pFullscreen;
QPushButton* m_pPlaylist;
QVideoSlider* m_pSlider;
int m_nHeigth;
bool m_bIsEnabledPlayList;
bool m_bIsEnabledFullscreen;
public:
void SetPlayPause(bool bIsPlay);
};
#endif // QFOOTERPANEL_H

View File

@ -0,0 +1,139 @@
#include "qpushbutton_icons.h"
class QIconPushButtonPrivate
{
public:
QString m_sIconR;
QString m_sIconH;
QString m_sIconP;
bool m_bIsSvg;
bool m_bIsSvgSupport;
double m_dDpi;
QPushButton* m_pButton;
public:
QIconPushButtonPrivate(QPushButton* pButton)
{
m_pButton = pButton;
m_bIsSvg = false;
m_bIsSvgSupport = false;
m_dDpi = 0.0;
}
QString getIconPostfix(QPushButton* p)
{
double dDpi = QWidget_GetDPI(p);
QString sPostfix = m_bIsSvg ? ".svg" : ".png";
if (fabs(1.0 - dDpi) < 0.1 || fabs(0.0 - dDpi) < 0.1)
sPostfix = ".png";
else if (fabs(2.0 - dDpi) < 0.1)
sPostfix = "-2x.png";
return sPostfix;
}
void checkDpi(const double dDpi, const bool isAttack = false)
{
if (!isAttack && fabs(dDpi - m_dDpi) < 0.05)
return;
m_dDpi = dDpi;
if (fabs(0.0 - m_dDpi) > 0.05 && fabs(1.0 - m_dDpi) > 0.05 && fabs(2.0 - m_dDpi) > 0.05)
{
if (m_bIsSvgSupport)
{
m_bIsSvg = true;
this->m_pButton->setStyleSheet("QPushButton { background-color: transparent; border: none; margin:0; padding:0; outline:none; }");
this->setIcon(":/icons/" + m_sIconR + ".svg");
this->m_pButton->update();
return;
}
}
m_bIsSvg = false;
QString sPostfix = ".png";
if (fabs(2.0 - m_dDpi) < 0.1)
sPostfix = "-2x.png";
QString sStyle = "QPushButton {border-image:url(:/icons/" + m_sIconR + sPostfix + ") 0 0 0 0 stretch stretch;margin:0;padding:0;outline:none;}";
sStyle += "QPushButton::hover {border-image:url(:/icons/" + m_sIconH + sPostfix + ") 0 0 0 0 stretch stretch;margin:0;padding:0;outline:none;}";
sStyle += "QPushButton::pressed {border-image:url(:/icons/" + m_sIconP + sPostfix + ") 0 0 0 0 stretch stretch;margin:0;padding:0;outline:none;}";
m_pButton->setStyleSheet(sStyle);
}
void setIcon(QString s)
{
if (m_bIsSvg)
{
QIcon icon;
QSize size = m_pButton->size();
icon.addFile(s, size);
m_pButton->setIcon(icon);
m_pButton->setIconSize(size);
}
}
};
QIconPushButton::QIconPushButton(QWidget *parent, bool bIsSvgSupport, QString sIconR, QString sIconH, QString sIconP) : QPushButton(parent)
{
m_internal = new QIconPushButtonPrivate(this);
m_internal->m_bIsSvgSupport = bIsSvgSupport;
changeIcons(sIconR, sIconH, sIconP);
}
void QIconPushButton::changeIcons(QString sIconR, QString sIconH, QString sIconP)
{
m_internal->m_sIconR = sIconR;
if (sIconH.isEmpty() && sIconP.isEmpty())
{
m_internal->m_sIconH = m_internal->m_sIconR + "-hover";
m_internal->m_sIconP = m_internal->m_sIconR + "-active";
}
else if (sIconP.isEmpty())
{
m_internal->m_sIconH = sIconH;
m_internal->m_sIconP = m_internal->m_sIconH;
}
else
{
m_internal->m_sIconH = sIconH;
m_internal->m_sIconP = sIconP;
}
this->m_internal->checkDpi(m_internal->m_dDpi, true);
}
bool QIconPushButton::event(QEvent *e)
{
if (!m_internal->m_bIsSvg)
return QPushButton::event(e);
QPushButton::event(e);
if (e->type() == QEvent::Enter)
{
this->m_internal->setIcon(":/icons/" + m_internal->m_sIconH + ".svg");
}
if (e->type() == QEvent::Leave)
{
this->m_internal->setIcon(":/icons/" + m_internal->m_sIconR + ".svg");
}
return true;
}
void QIconPushButton::resizeEvent(QResizeEvent* e)
{
QPushButton::resizeEvent(e);
m_internal->checkDpi(QWidget_GetDPI(this));
}
QIconPushButton::~QIconPushButton()
{
delete m_internal;
}

View File

@ -0,0 +1,103 @@
#ifndef QASCICONS_ENGINE_H
#define QASCICONS_ENGINE_H
#include <QWidget>
#include <QPushButton>
#include <QResizeEvent>
static QString getButtonBackground(QString src, QString srcH, QString srcP, double dDpi = 0.0)
{
#if 0
QString sRet = "QPushButton {background-image:url(:/icons/" + src + ".png);border:none;margin:0;padding:0;outline:none;}";
sRet += "QPushButton::hover {background-image:url(:/icons/" + srcH + ".png);border:none;margin:0;padding:0;outline:none;}";
sRet += "QPushButton::pressed {background-image:url(:/icons/" + srcP + ".png);border:none;margin:0;padding:0;outline:none;}";
#else
QString sPostfix = ".svg";
if (fabs(1.0 - dDpi) < 0.1 || fabs(0.0 - dDpi) < 0.1)
sPostfix = ".png";
else if (fabs(2.0 - dDpi) < 0.1)
sPostfix = "-2x.png";
QString sRet = "QPushButton {border-image:url(:/icons/" + src + sPostfix + ") 0 0 0 0 stretch stretch;margin:0;padding:0;outline:none;}";
sRet += "QPushButton::hover {border-image:url(:/icons/" + srcH + sPostfix + ") 0 0 0 0 stretch stretch;margin:0;padding:0;outline:none;}";
sRet += "QPushButton::pressed {border-image:url(:/icons/" + srcP + sPostfix + ") 0 0 0 0 stretch stretch;margin:0;padding:0;outline:none;}";
#endif
return sRet;
}
static QString getButtonBackground(QString src, double dDpi = 0.0)
{
return getButtonBackground(src, src + "-hover", src + "-active", dDpi);
}
static QString getButtonBackground2(QString src, double dDpi = 0.0)
{
return getButtonBackground(src, src + "-active", src + "-active", dDpi);
}
static QString getButtonBackgroundSimple(QString src, double dDpi = 0.0)
{
return getButtonBackground(src, src, src, dDpi);
}
class QIconPushButtonPrivate;
class QIconPushButton : public QPushButton
{
Q_OBJECT
public:
QIconPushButton(QWidget *parent, bool bSvgSupport, QString sIconR, QString sIconH = "", QString sIconP = "");
void changeIcons(QString sIconR, QString sIconH = "", QString sIconP = "");
virtual ~QIconPushButton();
protected:
virtual bool event(QEvent *e);
virtual void resizeEvent(QResizeEvent* e);
private:
QIconPushButtonPrivate* m_internal;
};
static void QWidget_SetProperty(QObject* w, const QVariant& p)
{
w->setProperty("native_dpi", p);
QObjectList childs = w->children();
for (int i = childs.count() - 1; i >= 0; --i)
{
QWidget_SetProperty(childs.at(i), p);
}
}
static void QWidget_SetDPI(QWidget* w, const double& v)
{
QVariant p(v);
QWidget_SetProperty(w, p);
}
static double QWidget_GetDPI(QWidget* w)
{
QVariant p = w->property("native_dpi");
if (p.isValid())
return p.toDouble();
return 1.0;
}
static int QWidget_ScaleDPI(const int& v, const double& s)
{
return (int)(v * s + 0.001);
}
#include <QPalette>
static void QWidget_setBackground(QWidget* widget, int r, int g, int b)
{
#if 1
QString s1 = QString::number(r, 16); if (s1.length() == 0) s1 = "0" + s1;
QString s2 = QString::number(g, 16); if (s2.length() == 0) s2 = "0" + s2;
QString s3 = QString::number(b, 16); if (s3.length() == 0) s3 = "0" + s3;
QString sBackColor = "background-color:#" + s1 + s2 + s3 + ";";
widget->setStyleSheet(sBackColor);
#endif
QPalette pal;
pal.setColor(QPalette::Background, QColor(r, g, b));
widget->setAutoFillBackground(true);
widget->setPalette(pal);
}
#endif // QASCICONS_ENGINE_H

View File

@ -0,0 +1,665 @@
#include "qvideoplaylist.h"
#include <QStyleOption>
#include <QPainter>
#include <QStandardItemModel>
#include <QScrollBar>
#include <QHeaderView>
#include <QAbstractItemView>
#include <QAbstractItemModel>
#include <QFileDialog>
#include <QStandardPaths>
#include <QShortcut>
#include <QMediaPlayer>
#include <QDebug>
#include "../../../../core/DesktopEditor/common/Directory.h"
#include "../../../../core/DesktopEditor/common/StringBuilder.h"
#include "../../../../core/DesktopEditor/xml/include/xmlutils.h"
#include "qpushbutton_icons.h"
#include "../qascvideoview.h"
QStandardItem* CreateFileItem(const QString& text, const QString& file)
{
QStandardItem* item = new QStandardItem(text);
item->setAccessibleText(file);
item->setDropEnabled(false);
item->setTextAlignment(Qt::AlignLeft | Qt::AlignVCenter);
return item;
}
QStandardItem* CreateFileDurationItem(const QString& text)
{
QStandardItem* item = new QStandardItem(text);
item->setDropEnabled(false);
item->setTextAlignment(Qt::AlignRight | Qt::AlignVCenter);
return item;
}
QVideoPlaylist::QVideoPlaylist(QWidget *parent) : QWidget(parent)
{
m_oCS.InitializeCriticalSection();
m_sSavePlayListAddon = "/ONLYOFFICE/VideoPlayer";
QWidget_setBackground(this, 0x22, 0x22, 0x22);
m_pAdd = new QIconPushButton(this, true, "add-files", "add-files-active");
m_pClear = new QIconPushButton(this, true, "drop-playlist", "drop-playlist-active");
m_pListView = new QTableView(this);
QStandardItemModel* pModel = new QStandardItemModel();
m_pListView->setModel(pModel);
pModel->setColumnCount(2);
m_pListView->setColumnWidth(0, 150);
m_pListView->setColumnWidth(1, 50);
QHeaderView* pVerticalHeader = m_pListView->verticalHeader();
QHeaderView* pHorizontalHeader = m_pListView->horizontalHeader();
pHorizontalHeader->setHidden(true);
pHorizontalHeader->setStretchLastSection(true);
pVerticalHeader->setHidden(true);
m_pListView->setSelectionBehavior(QAbstractItemView::SelectRows);
m_pListView->setSelectionMode(QAbstractItemView::SingleSelection);
m_pListView->setDragDropMode(QAbstractItemView::DropOnly);
m_pListView->setDefaultDropAction(Qt::IgnoreAction);
m_pListView->setDragDropOverwriteMode(false);
m_pListView->setDragEnabled(true);
m_pListView->setDropIndicatorShown(false);
QObject::connect(m_pAdd, SIGNAL(clicked(bool)), this, SLOT(slotButtonAdd()));
QObject::connect(m_pClear, SIGNAL(clicked(bool)), this, SLOT(slotButtonClear()));
QObject::connect(m_pListView, SIGNAL(clicked(const QModelIndex &)),
this, SLOT(slotClick(const QModelIndex &)));
QObject::connect(m_pListView, SIGNAL(activated(const QModelIndex &)),
this, SLOT(slotActivated(const QModelIndex &)));
m_pListView->setEditTriggers(QAbstractItemView::NoEditTriggers);
m_pListView->setShowGrid(false);
m_dDpi = 0;
private_Style(1.0);
#ifdef _MAC
QShortcut* shortcut1 = new QShortcut(QKeySequence(Qt::Key_Return), m_pListView);
connect(shortcut1, SIGNAL(activated()), this, SLOT(slotActivatedShortcut()));
QShortcut* shortcut2 = new QShortcut(QKeySequence(Qt::Key_Enter), m_pListView);
connect(shortcut2, SIGNAL(activated()), this, SLOT(slotActivatedShortcut()));
#endif
QShortcut* shortcutDelete = new QShortcut(QKeySequence(QKeySequence::Delete), m_pListView);
connect(shortcutDelete, SIGNAL(activated()), this, SLOT(slotDeletedShortcut()));
QObject::connect(this, SIGNAL(_onCheckDuration(QString,QString)), this, SLOT(_onSlotCheckDuration(QString,QString)), Qt::QueuedConnection);
QObject::connect(&m_oTimer, SIGNAL(timeout()), this, SLOT(_onThreadFunc()));
m_oTimer.start(100);
#ifndef USE_VLC_LIBRARY
m_pCheckPlayer = new QMediaPlayer();
QObject::connect(m_pCheckPlayer, SIGNAL(durationChanged(qint64)), this, SLOT(_onSlotDurationChanged(qint64)));
QObject::connect(m_pCheckPlayer, SIGNAL(mediaChanged(QMediaContent)), this, SLOT(_onSlotMediaChanged(QMediaContent)));
QObject::connect(m_pCheckPlayer, SIGNAL(error(QMediaPlayer::Error)), this, SLOT(_onSlotError(QMediaPlayer::Error)));
QObject::connect(m_pCheckPlayer, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)), this, SLOT(_onSlotMediaStatusChanged(QMediaPlayer::MediaStatus)));
#endif
}
QVideoPlaylist::~QVideoPlaylist()
{
m_oCS.DeleteCriticalSection();
}
void QVideoPlaylist::private_Style(double dDpi)
{
if (fabs(dDpi - m_dDpi) < 0.1)
return;
m_dDpi = dDpi;
QScrollBar* pScrollBar = m_pListView->verticalScrollBar();
int n1 = (int)(dDpi * 1);
int n2 = (int)(dDpi * 2);
int n4 = (int)(dDpi * 4);
int n5 = (int)(dDpi * 5);
int n6 = (int)(dDpi * 6);
int n10 = (int)(dDpi * 10);
int n20 = (int)(dDpi * 20);
QString sStyle = QString("\
QScrollBar:vertical {\
border: none;\
background: transparent;\
width: %6px;\
margin-left: 0px;\
margin-top: %4px;\
margin-right: %2px;\
margin-bottom: %4px;\
}\
QScrollBar::handle:vertical {\
background: #545454;\
min-height: %7px;\
border: %1px solid #545454;\
width: %5px;\
border-radius: %3px;\
}\
QScrollBar::handle:vertical:hover {\
background: #9B9B9B;\
min-height: %7px;\
border: %1px solid #9B9B9B;\
width: %5px;\
border-radius: %3px;\
}\
QScrollBar::add-line:vertical {\
background: transparent;\
height: 0px;\
}\
QScrollBar::sub-line:vertical {\
background: transparent;\
height: 0px;\
}\
QScrollBar::up-arrow:vertical, QScrollBar::down-arrow:vertical {\
height: %6px;\
background: transparent;\
}\
QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical {\
background: none;\
height: %6px;\
}").arg(QString::number(n1), QString::number(n2), QString::number(n4), QString::number(n5), QString::number(n6), QString::number(n10), QString::number(n20));
pScrollBar->setStyleSheet(sStyle);
QString sStyleL = QString("\
QTableView {\
background: transparent;\
border: none;\
color: #BBBBBB;\
margin-left: %2px;\
margin-top: %2px;\
margin-right: %1px;\
margin-bottom: %2px;\
border: none;\
outline: none;\
selection-background-color: transparent;\
selection-color: #FFFFFF; \
vertical-align:middle;\
font-family: 'Open Sans'; font-style: normal; font-size: %3px;\
}\
QTableView::item { height: 20px; border: none; outline: none; }\
QTableView::item:selected { border: none; outline: none; background-color: #353535; }\
").arg(QString::number(n5), QString::number(n10), QString::number((int)(dDpi * 12)));
m_pListView->setStyleSheet(sStyleL);
m_pListView->setColumnWidth(0, QWidget_ScaleDPI(150, m_dDpi));
m_pListView->setColumnWidth(1, QWidget_ScaleDPI(50, m_dDpi));
m_pListView->verticalHeader()->setSectionResizeMode(QHeaderView::Fixed);
m_pListView->verticalHeader()->setDefaultSectionSize(QWidget_ScaleDPI(30, m_dDpi));
CheckStyles();
}
void QVideoPlaylist::resizeEvent(QResizeEvent* e)
{
double dDpi = QWidget_GetDPI(this);
int nButW = QWidget_ScaleDPI(30, dDpi);
int n5 = QWidget_ScaleDPI(5, dDpi);
int n10 = QWidget_ScaleDPI(10, dDpi);
int nTopB = height() - nButW;
m_pListView->setGeometry(0, 0, width(), nTopB - n10);
m_pAdd->setGeometry(n10, nTopB - n5, nButW, nButW);
m_pClear->setGeometry(width() - nButW - n10, nTopB - n5, nButW, nButW);
private_Style(dDpi);
}
void QVideoPlaylist::slotClick(const QModelIndex &index)
{
}
void QVideoPlaylist::slotActivated(const QModelIndex &index)
{
QStandardItemModel* pModel = (QStandardItemModel*)m_pListView->model();
int nRows = pModel->rowCount();
int nCurrentRow = index.row();
QFont fontAll("Open Sans", 10, QFont::Normal, false);
QFont fontSelected("Open Sans", 10, QFont::Bold, false);
fontAll.setPixelSize(QWidget_ScaleDPI(12, m_dDpi));
fontSelected.setPixelSize(QWidget_ScaleDPI(12, m_dDpi));
QBrush brushAll(QColor(0xBB, 0xBB, 0xBB));
QBrush brushSelected(QColor(0xFF, 0xFF, 0xFF));
for (int i = 0; i < nRows; i++)
{
QStandardItem* item1 = pModel->item(i, 0);
QStandardItem* item2 = pModel->item(i, 1);
if (i != nCurrentRow)
{
item1->setFont(fontAll);
item1->setForeground(brushAll);
item2->setFont(fontAll);
item2->setForeground(brushAll);
}
else
{
item1->setFont(fontSelected);
item1->setForeground(brushSelected);
item2->setFont(fontSelected);
item2->setForeground(brushSelected);
emit fileChanged(item1->accessibleText());
}
}
}
void QVideoPlaylist::CheckStyles()
{
QStandardItemModel* pModel = (QStandardItemModel*)m_pListView->model();
int nRows = pModel->rowCount();
int nRow = -1;
for (int i = 0; i < nRows; i++)
{
QStandardItem* item1 = pModel->item(i, 0);
if (item1->font().bold())
{
nRow = i;
break;
}
}
int nCurrentRow = nRow;
QFont fontAll("Open Sans", 10, QFont::Normal, false);
QFont fontSelected("Open Sans", 10, QFont::Bold, false);
fontAll.setPixelSize(QWidget_ScaleDPI(12, m_dDpi));
fontSelected.setPixelSize(QWidget_ScaleDPI(12, m_dDpi));
QBrush brushAll(QColor(0xBB, 0xBB, 0xBB));
QBrush brushSelected(QColor(0xFF, 0xFF, 0xFF));
for (int i = 0; i < nRows; i++)
{
QStandardItem* item1 = pModel->item(i, 0);
QStandardItem* item2 = pModel->item(i, 1);
if (i != nCurrentRow)
{
item1->setFont(fontAll);
item1->setForeground(brushAll);
item2->setFont(fontAll);
item2->setForeground(brushAll);
}
else
{
item1->setFont(fontSelected);
item1->setForeground(brushSelected);
item2->setFont(fontSelected);
item2->setForeground(brushSelected);
}
}
}
#ifdef _MAC
void QVideoPlaylist::slotActivatedShortcut()
{
this->slotActivated(m_pListView->selectionModel()->currentIndex());
}
#endif
void QVideoPlaylist::slotDeletedShortcut()
{
this->m_pListView->model()->removeRow(m_pListView->selectionModel()->currentIndex().row());
}
#if defined(_LINUX) && !defined(_MAC)
#include <QApplication>
void QVideoPlaylist::mouseMoveEvent(QMouseEvent* e)
{
QApplication::setOverrideCursor(QCursor(Qt::ArrowCursor));
}
#endif
void QVideoPlaylist::slotButtonAdd()
{
QString sDir = QStandardPaths::writableLocation(QStandardPaths::MoviesLocation);
if (!m_sLastFileDialogFolder.isEmpty())
sDir = m_sLastFileDialogFolder;
QString sTitle = QString::fromUtf8("Добавить файлы в список воспроизведения");
//sTitle = "Add files to playlist";
CVideoExt ext;
QStringList filenames = QFileDialog::getOpenFileNames(this,
sTitle, sDir,
ext.getFilter(), NULL,
#ifdef QFILEDIALOG_DONTUSENATIVEDIALOG
QFileDialog::DontUseNativeDialog
#else
QFileDialog::Option()
#endif
);
AddFiles(filenames);
}
void QVideoPlaylist::slotButtonClear()
{
QStandardItemModel* pModel = (QStandardItemModel*)m_pListView->model();
pModel->clear();
}
void QVideoPlaylist::AddFiles(QStringList& filenames, const bool isStart)
{
int nPrevCount = m_pListView->model()->rowCount();
if (filenames.isEmpty())
return;
QStandardItemModel* pModel = (QStandardItemModel*)m_pListView->model();
QStringList listCheck;
QList<QStandardItem*> rowData;
for (int i = 0; i < filenames.count(); ++i)
{
rowData.clear();
QFileInfo file(filenames.at(i));
if (0 == i)
m_sLastFileDialogFolder = file.absolutePath();
QStandardItem* item = CreateFileItem(file.fileName(), file.absoluteFilePath());
rowData << item;
listCheck.append(file.absoluteFilePath());
item = CreateFileDurationItem("...");
rowData << item;
pModel->appendRow(rowData);
}
m_pListView->setColumnWidth(0, QWidget_ScaleDPI(150, m_dDpi));
m_pListView->setColumnWidth(1, QWidget_ScaleDPI(50, m_dDpi));
AddFilesToCheck(listCheck);
if (isStart)
{
m_pListView->setCurrentIndex(pModel->index(nPrevCount, 0));
m_pListView->activated(pModel->index(nPrevCount, 0));
}
}
void QVideoPlaylist::Load()
{
QString sSettings = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation);
sSettings += m_sSavePlayListAddon;
std::wstring sDir = sSettings.toStdWString();
NSDirectory::CreateDirectories(sDir);
XmlUtils::CXmlNode oNode;
if (!oNode.FromXmlFile(sDir + L"/settings.xml"))
return;
XmlUtils::CXmlNodes oFiles;
if (oNode.GetNodes(L"file", oFiles))
{
QStringList list;
int nCount = oFiles.GetCount();
for (int i = 0; i < nCount; ++i)
{
XmlUtils::CXmlNode nodeFile;
oFiles.GetAt(i, nodeFile);
list.append(QString::fromStdWString(nodeFile.GetText()));
}
this->AddFiles(list);
}
int nIndex = oNode.ReadValueInt(L"index", -1);
if (-1 != nIndex)
{
QModelIndex index = m_pListView->model()->index(nIndex, 0);
m_pListView->setCurrentIndex(index);
}
std::wstring sLastFolder = oNode.ReadValueString(L"lastdirectory");
if (!sLastFolder.empty())
m_sLastFileDialogFolder = QString::fromStdWString(sLastFolder);
}
void QVideoPlaylist::Save()
{
m_oCS.DeleteCriticalSection();
QString sSettings = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation);
sSettings += m_sSavePlayListAddon;
std::wstring sDir = sSettings.toStdWString();
NSDirectory::CreateDirectories(sDir);
std::wstring sFile = sDir + L"/settings.xml";
NSStringUtils::CStringBuilder builder;
builder.WriteString(L"<settings>");
QStandardItemModel* pModel = (QStandardItemModel*)m_pListView->model();
int nRows = pModel->rowCount();
int nCurrentRow = m_pListView->currentIndex().row();
for (int i = 0; i < nRows; i++)
{
QStandardItem* item = pModel->item(i, 0);
builder.WriteString(L"<file>");
builder.WriteEncodeXmlString(item->accessibleText().toStdWString());
builder.WriteString(L"</file>");
}
builder.WriteString(L"<index>");
builder.AddInt(nCurrentRow);
builder.WriteString(L"</index>");
builder.WriteString(L"<lastdirectory>");
builder.WriteEncodeXmlString(m_sLastFileDialogFolder.toStdWString());
builder.WriteString(L"</lastdirectory>");
builder.WriteString(L"</settings>");
std::wstring sXml = builder.GetData();
NSFile::CFileBinary::SaveToFile(sFile, sXml);
}
// check duration methods
void QVideoPlaylist::AddFilesToCheck(QStringList& list)
{
CTemporaryCS oCS(&m_oCS);
for (int i = 0; i < list.count(); ++i)
{
if (!m_mapChecked.contains(list[i].toLower()))
m_mapChecked.insert(list[i], true);
}
}
void QVideoPlaylist::_onSlotCheckDuration(const QString& file, const QString& duration)
{
QStandardItemModel* pModel = (QStandardItemModel*)m_pListView->model();
int nRows = pModel->rowCount();
for (int i = 0; i < nRows; i++)
{
QStandardItem* item = pModel->item(i, 0);
if (item->accessibleText() == file)
pModel->item(i, 1)->setText(duration);
}
}
#ifndef USE_VLC_LIBRARY
void QVideoPlaylist::_onSlotError(QMediaPlayer::Error error)
{
}
void QVideoPlaylist::_onSlotMediaStatusChanged(QMediaPlayer::MediaStatus status)
{
if (status == QMediaPlayer::InvalidMedia)
_onSlotDurationChanged(0);
}
void QVideoPlaylist::_onSlotDurationChanged(qint64 duration)
{
if (m_sCheckFile.isEmpty())
return;
qint64 nH = (qint64)(duration / 3600000);
duration -= (nH * 3600000);
qint64 nM = (qint64)(duration / 60000);
duration -= (nM * 60000);
qint64 nS = (qint64)(duration / 1000);
QString sDur = "";
if (nH > 0)
{
sDur += QString::number((uint)nH);
sDur += ":";
}
if (nM < 10)
sDur += "0";
sDur += QString::number((uint)nM);
sDur += ":";
if (nS < 10)
sDur += "0";
sDur += QString::number((uint)nS);
emit _onCheckDuration(m_sCheckFile, sDur);
m_pCheckPlayer->stop();
m_pCheckPlayer->setMedia(QMediaContent());
}
void QVideoPlaylist::_onSlotMediaChanged(QMediaContent content)
{
if (content.isNull())
{
m_sCheckFile = "";
return;
}
}
#else
void QVideoPlaylist::_onVlcMediaParseChanged(bool isparsed)
{
if (m_sCheckFile.isEmpty())
return;
qint64 duration = m_pCheckMedia->duration();
QString sCheckFile = m_sCheckFile;
m_sCheckFile = "";
delete m_pCheckMedia;
qint64 nH = (qint64)(duration / 3600000);
duration -= (nH * 3600000);
qint64 nM = (qint64)(duration / 60000);
duration -= (nM * 60000);
qint64 nS = (qint64)(duration / 1000);
QString sDur = "";
if (nH > 0)
{
sDur += QString::number((uint)nH);
sDur += ":";
}
if (nM < 10)
sDur += "0";
sDur += QString::number((uint)nM);
sDur += ":";
if (nS < 10)
sDur += "0";
sDur += QString::number((uint)nS);
emit _onCheckDuration(sCheckFile, sDur);
}
#endif
void QVideoPlaylist::_onThreadFunc()
{
if (!m_sCheckFile.isEmpty())
return;
m_oCS.Enter();
if (!m_mapChecked.isEmpty())
{
m_sCheckFile = m_mapChecked.firstKey();
m_mapChecked.remove(m_sCheckFile);
}
else
{
m_sCheckFile = "";
m_oCS.Leave();
return;
}
m_oCS.Leave();
#ifndef USE_VLC_LIBRARY
m_pCheckPlayer->setMedia(QUrl::fromLocalFile(m_sCheckFile));
#else
m_pCheckMedia = new VlcMedia(m_sCheckFile, true, (VlcInstance*)NSBaseVideoLibrary::GetLibrary());
QObject::connect(m_pCheckMedia, SIGNAL(parsedChanged(bool)), this, SLOT(_onVlcMediaParseChanged(bool)));
m_pCheckMedia->parse();
#endif
return;
}
void QVideoPlaylist::Next()
{
QStandardItemModel* pModel = (QStandardItemModel*)m_pListView->model();
int nRows = pModel->rowCount();
int nRow = -1;
for (int i = 0; i < nRows; i++)
{
QStandardItem* item1 = pModel->item(i, 0);
if (item1->font().bold())
{
nRow = i;
break;
}
}
if (nRow >= (nRows - 1))
{
emit fileChanged("");
return;
}
++nRow;
m_pListView->setCurrentIndex(pModel->index(nRow, 0));
m_pListView->activated(pModel->index(nRow, 0));
//m_pListView->selectionModel()->select(pModel->index(nRow, 0), QItemSelectionModel::Toggle | QItemSelectionModel::Rows | QItemSelectionModel::ClearAndSelect);
}

View File

@ -0,0 +1,168 @@
#pragma once
#include <QWidget>
#include <QPaintEvent>
#include <QPushButton>
#include <QTableView>
#include <QResizeEvent>
#include <QMap>
#include <QTimer>
#include "../../../../core/DesktopEditor/graphics/BaseThread.h"
#include "../../../../core/DesktopEditor/graphics/TemporaryCS.h"
#include "lib_base.h"
#ifndef USE_VLC_LIBRARY
#include <QMediaPlayer>
#endif
class CVideoExt
{
private:
QStringList m_video_exts;
QStringList m_audio_exts;
public:
CVideoExt()
{
m_video_exts << "webm" << "mkv" << "flv" << "ogg" << "avi" << "mov" << "wmv" << "mp4" <<
"m4v" << "mpg" << "mp2" << "mpeg" << "mpe" << "mpv" << "m2v" << "m4v" <<
"3gp" << "3g2" << "f4v" << "m2ts" << "mts";
m_audio_exts << "flac" << "mp3" << "ogg" << "wav" << "wma" << "ape";
}
QSet<QString> getQSet(bool isAddPoint = false)
{
QSet<QString> ret;
for (int i = 0; i < m_video_exts.size(); i++)
{
QString tmp = m_video_exts[i];
if (isAddPoint)
tmp = ("*." + tmp);
ret << tmp;
}
for (int i = 0; i < m_audio_exts.size(); i++)
{
QString tmp = m_audio_exts[i];
if (isAddPoint)
tmp = ("*." + tmp);
ret << tmp;
}
return ret;
}
QString getFilter()
{
QString sRes = "All Video Files (";
int size = m_video_exts.size();
for (int i = 0; i < size; i++)
{
sRes += "*.";
sRes += m_video_exts[i];
if (i != (size - 1))
sRes += " ";
}
sRes += ");;All Audio Files (";
size = m_audio_exts.size();
for (int i = 0; i < size; i++)
{
sRes += "*.";
sRes += m_audio_exts[i];
if (i != (size - 1))
sRes += " ";
}
sRes += ");;All files (*.*)";
return sRes;
}
};
class QVideoPlaylist : public QWidget
{
Q_OBJECT
private:
double m_dDpi;
void private_Style(double dDpi);
public:
explicit QVideoPlaylist(QWidget *parent = 0);
virtual ~QVideoPlaylist();
virtual void resizeEvent(QResizeEvent* e);
signals:
void fileChanged(const QString& file);
public slots:
void slotClick(const QModelIndex &index);
void slotActivated(const QModelIndex &index);
void slotButtonAdd();
void slotButtonClear();
#ifdef _MAC
void slotActivatedShortcut();
#endif
void slotDeletedShortcut();
#if defined(_LINUX) && !defined(_MAC)
virtual void mouseMoveEvent(QMouseEvent* e);
#endif
public:
void AddFiles(QStringList& files, const bool isStart = false);
void Load();
void Save();
void Next();
void CheckStyles();
public:
QPushButton* m_pAdd;
QPushButton* m_pClear;
QTableView* m_pListView;
QString m_sLastFileDialogFolder;
QString m_sSavePlayListAddon;
private:
NSCriticalSection::CRITICAL_SECTION m_oCS;
QTimer m_oTimer;
#ifndef USE_VLC_LIBRARY
QMediaPlayer* m_pCheckPlayer;
#else
VlcMedia* m_pCheckMedia;
#endif
QString m_sCheckFile;
QMap<QString, bool> m_mapChecked;
void AddFilesToCheck(QStringList& list);
signals:
void _onCheckDuration(const QString& file, const QString& duration);
private slots:
#ifndef USE_VLC_LIBRARY
void _onSlotError(QMediaPlayer::Error error);
void _onSlotMediaStatusChanged(QMediaPlayer::MediaStatus status);
void _onSlotDurationChanged(qint64 duration);
void _onSlotMediaChanged(QMediaContent content);
#else
void _onVlcMediaParseChanged(bool isparsed);
#endif
void _onSlotCheckDuration(const QString& file, const QString& duration);
void _onThreadFunc();
};

View File

@ -0,0 +1,134 @@
#include "qvideoslider.h"
#include <QStyleOption>
#include <QPainter>
#include "qpushbutton_icons.h"
QVideoSlider::QVideoSlider(QWidget *parent) : QSlider(parent)
{
QString sStyle = "\
QSlider::groove:horizontal { background-color: transparent; border: 1px solid transparent; border-radius: 3px; background: transparent; height: 16px; \
margin-top: -5px; margin-bottom: -5px; margin-left: 0px; margin-right:0px; border-radius: 3px; }\
\
QSlider::groove:vertical { background-color: transparent; border: 1px solid transparent; border-radius: 3px; background: transparent; width: 16px; \
margin-left: -5px; margin-right: -5px; margin-top: 0px; margin-bottom:0px; border-radius: 3px; }\
\
QSlider::sub-page:horizontal { background-color: #9B9B9B; border: 1px solid #9B9B9B; border-radius: 3px; }\
QSlider::add-page:horizontal { background-color: #545454; border: 1px solid #545454; border-radius: 3px; }\
\
QSlider::sub-page:vertical { background-color: #545454; border: 1px solid #545454; border-radius: 3px; }\
QSlider::add-page:vertical { background-color: #9B9B9B; border: 1px solid #9B9B9B; border-radius: 3px; }\
\
QSlider::handle { background-color: #FFFFFF; border: 1px solid #FFFFFF; border-radius: 7px;\
width: 14px; height: 14px; margin-top: 0px; margin-bottom: 0px; }\
\
QSlider::sub-page:disabled { background: #545454; border-color: #545454; }\
\
QSlider::add-page:disabled { background: #545454; border-color: #545454; }\
\
QSlider::handle:disabled { background: #545454; border: 1px solid #545454; border-radius: 8px;\
}\
";
m_dDpi = 1;
this->setStyleSheet(sStyle);
}
void QVideoSlider::mousePressEvent(QMouseEvent *event)
{
if (!m_bIsSeekOnClick)
return QSlider::mousePressEvent(event);
QStyleOptionSlider opt;
initStyleOption(&opt);
QRect sr = style()->subControlRect(QStyle::CC_Slider, &opt, QStyle::SC_SliderHandle, this);
if (event->button() == Qt::LeftButton && !sr.contains(event->pos()))
{
int newVal;
if (orientation() == Qt::Vertical)
{
double halfHandleHeight = (0.5 * sr.height()) + 0.5;
int adaptedPosY = height() - event->y();
if ( adaptedPosY < halfHandleHeight )
adaptedPosY = halfHandleHeight;
if ( adaptedPosY > height() - halfHandleHeight )
adaptedPosY = height() - halfHandleHeight;
double newHeight = (height() - halfHandleHeight) - halfHandleHeight;
double normalizedPosition = (adaptedPosY - halfHandleHeight) / newHeight ;
newVal = minimum() + qRound((maximum()-minimum()) * normalizedPosition);
}
else
{
double halfHandleWidth = (0.5 * sr.width()) + 0.5;
int adaptedPosX = event->x();
if ( adaptedPosX < halfHandleWidth )
adaptedPosX = halfHandleWidth;
if ( adaptedPosX > width() - halfHandleWidth )
adaptedPosX = width() - halfHandleWidth;
double newWidth = (width() - halfHandleWidth) - halfHandleWidth;
double normalizedPosition = (adaptedPosX - halfHandleWidth) / newWidth ;
newVal = minimum() + qRound((maximum()-minimum()) * normalizedPosition);
}
if (invertedAppearance())
this->setValue( maximum() - newVal );
else
this->setValue(newVal);
QSlider::mousePressEvent(event);
}
else
{
QSlider::mousePressEvent(event);
}
}
void QVideoSlider::resizeEvent(QResizeEvent* e)
{
double dDpi = QWidget_GetDPI(this);
if (fabs(dDpi - m_dDpi) > 0.01)
{
m_dDpi = dDpi;
int n8 = (int)(m_dDpi * 7);
int n14 = (int)(m_dDpi * 14);
int n3 = (int)(m_dDpi * 3);
int n5 = (int)(m_dDpi * 5);
int n16 = (int)(m_dDpi * 16);
int n1 = (int)(m_dDpi * 1);
QString sStyle = QString("\
QSlider::groove:horizontal { background-color: transparent; border: %6px solid transparent; border-radius: %3px; background: transparent; height: %5px; \
margin-top: -%4px; margin-bottom: -%4px; margin-left: 0px; margin-right:0px; border-radius: %3px; }\
\
QSlider::groove:vertical { background-color: transparent; border: %6px solid transparent; border-radius: %3px; background: transparent; width: %5px; \
margin-left: -%4px; margin-right: -%4px; margin-top: 0px; margin-bottom:0px; border-radius: %3px; }\
\
QSlider::sub-page:horizontal { background-color: #9B9B9B; border: %6px solid #9B9B9B; border-radius: %3px; }\
QSlider::add-page:horizontal { background-color: #545454; border: %6px solid #545454; border-radius: %3px; }\
\
QSlider::sub-page:vertical { background-color: #545454; border: %6px solid #545454; border-radius: %3px; }\
QSlider::add-page:vertical { background-color: #9B9B9B; border: %6px solid #9B9B9B; border-radius: %3px; }\
\
QSlider::handle { background-color: #FFFFFF; border: %6px solid #FFFFFF; border-radius: %1px;\
width: %2px; height: %2px; margin-top: 0px; margin-bottom: 0px; }\
\
QSlider::sub-page:disabled { background: #545454; border-color: #545454; }\
\
QSlider::add-page:disabled { background: #545454; border-color: #545454; }\
\
QSlider::handle:disabled { background: #545454; border: %6px solid #545454; border-radius: %1px;\
}\
").arg(QString::number(n8), QString::number(n14), QString::number(n3), QString::number(n5), QString::number(n16), QString::number(n1));
this->setStyleSheet(sStyle);
}
}
void QVideoSlider::SetSeekOnClick(bool bValue)
{
m_bIsSeekOnClick = bValue;
}

View File

@ -0,0 +1,23 @@
#pragma once
#include <QWidget>
#include <QPaintEvent>
#include <QSlider>
#include <QMouseEvent>
class QVideoSlider : public QSlider
{
Q_OBJECT
bool m_bIsSeekOnClick;
double m_dDpi;
public:
explicit QVideoSlider(QWidget *parent = 0);
virtual void mousePressEvent(QMouseEvent* e);
virtual void resizeEvent(QResizeEvent* e);
public:
void SetSeekOnClick(bool bValue);
};

View File

@ -0,0 +1,70 @@
QT += core gui printsupport widgets multimedia multimediawidgets
TARGET = videoplayer
TEMPLATE = lib
CONFIG += shared
CONFIG += plugin
DEFINES += QT_DEPRECATED_WARNINGS
DEFINES += BUILD_VIDEO_LIBRARY
CORE_ROOT_DIR = $$PWD/../../../core
PWD_ROOT_DIR = $$PWD
include($$CORE_ROOT_DIR/Common/base.pri)
core_linux {
DEFINES += QFILEDIALOG_DONTUSENATIVEDIALOG
}
LIBS += -L$$CORE_BUILDS_LIBRARIES_PATH -lkernel
HEADERS += \
./src/lib_base.h \
./src/qpushbutton_icons.h \
./src/qfooterpanel.h \
./src/qvideoslider.h \
./src/qvideoplaylist.h \
./src/qascvideowidget.h
SOURCES += \
./src/lib_base.cpp \
./src/qpushbutton_icons.cpp \
./src/qfooterpanel.cpp \
./src/qascvideoview.cpp \
./src/qvideoslider.cpp \
./src/qvideoplaylist.cpp \
./src/qascvideowidget.cpp
HEADERS += \
./qascvideoview.h \
RESOURCES += \
$$PWD_ROOT_DIR/IconsVideoPlayerLib.qrc
libvlc {
DEFINES += USE_VLC_LIBRARY
isEmpty(VLC_DIR) {
VLC_DIR=$$PWD_ROOT_DIR/vlc
}
INCLUDEPATH += $$VLC_DIR/$$CORE_BUILDS_PLATFORM_PREFIX/include
VLC_LIB_PREFIX=
core_windows {
core_debug {
VLC_LIB_PREFIX=d
}
}
core_windows {
LIBS += -L$$VLC_DIR/$$CORE_BUILDS_PLATFORM_PREFIX/lib -lVLCQtCore$$VLC_POSTFIX_LIB -lVLCQtWidgets$$VLC_POSTFIX_LIB
LIBS += -L$$VLC_DIR/$$CORE_BUILDS_PLATFORM_PREFIX/bin
} else {
LIBS += -L$$VLC_DIR/$$CORE_BUILDS_PLATFORM_PREFIX/bin -lVLCQtCore$$VLC_POSTFIX_LIB -lVLCQtWidgets$$VLC_POSTFIX_LIB
LIBS += -L$$VLC_DIR/$$CORE_BUILDS_PLATFORM_PREFIX/bin -lvlc -lvlccore
}
}

View File

@ -0,0 +1,9 @@
QT += core gui printsupport widgets multimedia multimediawidgets
TARGET = videoplayer
TEMPLATE = lib
CONFIG += shared
CONFIG += plugin
include($$PWD/videoplayerlib.pri)