-
Notifications
You must be signed in to change notification settings - Fork 2
/
VideoNoteEditor.cpp
46 lines (38 loc) · 1.32 KB
/
VideoNoteEditor.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include "VideoNoteEditor.h"
#include "VideoNote.h"
#include "player/player.h"
#include <QWidget>
#include <QFileDialog>
#include <QPushButton>
#include <QUrl>
#include <QDebug>
VideoNoteEditor::VideoNoteEditor(VideoNote *v, QWidget* parent)
:BinaryEditor(v, parent), ressource(v)
{
btnAddVideo = new QPushButton("Choose a Video");
videoWidget = new Player(this);
if(!ressource->getMediaPath().isNull())
{
videoWidget->openMedia(QUrl::fromLocalFile(ressource->getMediaPath()));
}
contentLayout->addWidget(videoWidget);
contentLayout->addWidget(new QLabel("Description:"));
contentLayout->addWidget(getDescriptionWidget());
buttonsLayout->addWidget(btnAddVideo);
QObject::connect(btnAddVideo, SIGNAL(clicked()), this, SLOT(LOAD_VIDEO()));
}
void VideoNoteEditor::BACKEND_SET_CONTENT()
{
ressource->setDescription(getDescriptionWidget()->text());
ressource->setMediaPath(ressource->getMediaPath());
}
void VideoNoteEditor::LOAD_VIDEO(){
ressource->setMediaPath(QFileDialog::getOpenFileName(this, "Ouvrir un fichier", QString(), "Video (*.mp4 *.avi)"));
qDebug()<<ressource->getMediaPath();
if(!ressource->getMediaPath().isNull())
videoWidget->openMedia(QUrl::fromLocalFile(ressource->getMediaPath()));
}
void VideoNoteEditor::CLOSING()
{
videoWidget->stop();
}