File indexing completed on 2025-01-05 03:57:28
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2017-05-25 0007 * Description : a dialog to play video. 0008 * 0009 * SPDX-FileCopyrightText: 2017-2024 by Gilles Caulier <caulier dot gilles at gmail dot com> 0010 * 0011 * SPDX-License-Identifier: GPL-2.0-or-later 0012 * 0013 * ============================================================ */ 0014 0015 #include "vidplayerdlg.h" 0016 0017 // Qt includes 0018 0019 #include <QGridLayout> 0020 #include <QApplication> 0021 #include <QStyle> 0022 0023 // Local includes 0024 0025 #include "mediaplayerview.h" 0026 0027 namespace Digikam 0028 { 0029 0030 class Q_DECL_HIDDEN VidPlayerDlg::Private 0031 { 0032 public: 0033 0034 Private() = default; 0035 0036 public: 0037 0038 MediaPlayerView* player = nullptr; 0039 }; 0040 0041 VidPlayerDlg::VidPlayerDlg(const QString& file, QWidget* const parent) 0042 : QDialog(parent), 0043 d (new Private) 0044 { 0045 setModal(false); 0046 setWindowTitle(file); 0047 0048 d->player = new MediaPlayerView(this); 0049 d->player->setCurrentItem(QUrl::fromLocalFile(file)); 0050 0051 // ---------------------- 0052 0053 QGridLayout* const grid = new QGridLayout(this); 0054 grid->setSpacing(qMin(QApplication::style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing), 0055 QApplication::style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing))); 0056 grid->addWidget(d->player, 0, 0, 1, 1); 0057 grid->setColumnStretch(0, 10); 0058 setLayout(grid); 0059 0060 // ---------------------- 0061 0062 connect(d->player, SIGNAL(signalEscapePreview()), 0063 this, SLOT(accept())); 0064 } 0065 0066 VidPlayerDlg::~VidPlayerDlg() 0067 { 0068 delete d; 0069 } 0070 0071 } // namespace Digikam 0072 0073 #include "moc_vidplayerdlg.cpp"