1 /* ============================================================
2 *
3 * This file is a part of digiKam project
4 * https://www.digikam.org
5 *
6 * Date : 2017-05-25
7 * Description : a tool to generate video slideshow from images.
8 *
9 * Copyright (C) 2017-2021 by Gilles Caulier <caulier dot gilles at gmail dot com>
10 *
11 * This program is free software; you can redistribute it
12 * and/or modify it under the terms of the GNU General
13 * Public License as published by the Free Software Foundation;
14 * either version 2, or (at your option)
15 * any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * ============================================================ */
23
24 #include "vidplayerdlg.h"
25
26 // Qt includes
27
28 #include <QGridLayout>
29 #include <QApplication>
30 #include <QStyle>
31
32 // Local includes
33
34 #include "mediaplayerview.h"
35
36 namespace Digikam
37 {
38
39 class Q_DECL_HIDDEN VidPlayerDlg::Private
40 {
41 public:
42
Private()43 explicit Private()
44 : player(nullptr)
45 {
46 }
47
48 public:
49
50 MediaPlayerView* player;
51 };
52
VidPlayerDlg(const QString & file,QWidget * const parent)53 VidPlayerDlg::VidPlayerDlg(const QString& file, QWidget* const parent)
54 : QDialog(parent),
55 d(new Private)
56 {
57 setModal(false);
58 setWindowTitle(file);
59
60 d->player = new MediaPlayerView(this);
61 d->player->setCurrentItem(QUrl::fromLocalFile(file));
62
63 // ----------------------
64
65 QGridLayout* const grid = new QGridLayout(this);
66 grid->setSpacing(QApplication::style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing));
67 grid->addWidget(d->player, 0, 0, 1, 1);
68 grid->setColumnStretch(0, 10);
69 setLayout(grid);
70
71 // ----------------------
72
73 connect(d->player, SIGNAL(signalEscapePreview()),
74 this, SLOT(accept()));
75 }
76
~VidPlayerDlg()77 VidPlayerDlg::~VidPlayerDlg()
78 {
79 delete d;
80 }
81
82 } // namespace Digikam
83