File indexing completed on 2024-05-12 16:35:05

0001 /* This file is part of the KDE project
0002  * Copyright (C) 2008 Jan Hambrecht <jaham@gmx.net>
0003  * Copyright (C) 2012 Gopalakrishna Bhat A <gopalakbhat@gmail.com>
0004  *
0005  * This library is free software; you can redistribute it and/or
0006  * modify it under the terms of the GNU Library General Public
0007  * License as published by the Free Software Foundation; either
0008  * version 2 of the License, or (at your option) any later version.
0009  *
0010  * This library is distributed in the hope that it will be useful,
0011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0013  * Library General Public License for more details.
0014  *
0015  * You should have received a copy of the GNU Library General Public License
0016  * along with this library; see the file COPYING.LIB.  If not, write to
0017  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0018  * Boston, MA 02110-1301, USA.
0019  */
0020 
0021 #include "SelectVideoWidget.h"
0022 
0023 #include <klocalizedstring.h>
0024 #include <kfilewidget.h>
0025 #include <phonon/BackendCapabilities>
0026 
0027 #include <QVBoxLayout>
0028 #include <QCheckBox>
0029 #include <QUrl>
0030 
0031 SelectVideoWidget::SelectVideoWidget(QWidget *parent)
0032     : QWidget(parent)
0033 {
0034     QVBoxLayout *layout = new QVBoxLayout(this);
0035     m_fileWidget = new KFileWidget(QUrl(/*QT5TODO:"kfiledialog:///OpenVideoDialog"*/), this);
0036     m_fileWidget->setOperationMode(KFileWidget::Opening);
0037     m_fileWidget->setMimeFilter(Phonon::BackendCapabilities::availableMimeTypes());
0038     layout->addWidget(m_fileWidget);
0039 
0040     m_saveEmbedded = new QCheckBox(i18n("Save as part of document"));
0041     m_fileWidget->setCustomWidget("", m_saveEmbedded);
0042     setLayout(layout);
0043 }
0044 
0045 SelectVideoWidget::~SelectVideoWidget()
0046 {
0047 
0048 }
0049 
0050 void SelectVideoWidget::accept()
0051 {
0052     m_fileWidget->slotOk();
0053     m_fileWidget->accept();
0054 }
0055 
0056 void SelectVideoWidget::cancel()
0057 {
0058     m_fileWidget->slotCancel();
0059 }
0060 
0061 
0062 QUrl SelectVideoWidget::selectedUrl() const
0063 {
0064     return m_fileWidget->selectedUrl();
0065 }
0066 
0067 bool SelectVideoWidget::saveEmbedded()
0068 {
0069     return m_saveEmbedded->isChecked();
0070 }