File indexing completed on 2024-04-21 04:43:12

0001 /*
0002     Copyright (C) 2011 Harald Sitter <sitter@kde.org>
0003 
0004     This library is free software; you can redistribute it and/or
0005     modify it under the terms of the GNU Lesser General Public
0006     License as published by the Free Software Foundation; either
0007     version 2.1 of the License, or (at your option) version 3, or any
0008     later version accepted by the membership of KDE e.V. (or its
0009     successor approved by the membership of KDE e.V.), Nokia Corporation
0010     (or its successors, if any) and the KDE Free Qt Foundation, which shall
0011     act as a proxy defined in Section 6 of version 3 of the license.
0012 
0013     This library is distributed in the hope that it will be useful,
0014     but WITHOUT ANY WARRANTY; without even the implied warranty of
0015     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0016     Lesser General Public License for more details.
0017 
0018     You should have received a copy of the GNU Lesser General Public
0019     License along with this library.  If not, see <http://www.gnu.org/licenses/>.
0020 */
0021 
0022 /****************************************************************************
0023 **
0024 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
0025 ** All rights reserved.
0026 ** Contact: Nokia Corporation (qt-info@nokia.com)
0027 **
0028 ** This file is part of the Qt Designer of the Qt Toolkit.
0029 **
0030 ** $QT_BEGIN_LICENSE:LGPL$
0031 ** Commercial Usage
0032 ** Licensees holding valid Qt Commercial licenses may use this file in
0033 ** accordance with the Qt Commercial License Agreement provided with the
0034 ** Software or, alternatively, in accordance with the terms contained in
0035 ** a written agreement between you and Nokia.
0036 **
0037 ** GNU Lesser General Public License Usage
0038 ** Alternatively, this file may be used under the terms of the GNU Lesser
0039 ** General Public License version 2.1 as published by the Free Software
0040 ** Foundation and appearing in the file LICENSE.LGPL included in the
0041 ** packaging of this file.  Please review the following information to
0042 ** ensure the GNU Lesser General Public License version 2.1 requirements
0043 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
0044 **
0045 ** In addition, as a special exception, Nokia gives you certain additional
0046 ** rights.  These rights are described in the Nokia Qt LGPL Exception
0047 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
0048 **
0049 ** GNU General Public License Usage
0050 ** Alternatively, this file may be used under the terms of the GNU
0051 ** General Public License version 3.0 as published by the Free Software
0052 ** Foundation and appearing in the file LICENSE.GPL included in the
0053 ** packaging of this file.  Please review the following information to
0054 ** ensure the GNU General Public License version 3.0 requirements will be
0055 ** met: http://www.gnu.org/copyleft/gpl.html.
0056 **
0057 ** If you have questions regarding the use of this file, please contact
0058 ** Nokia at qt-info@nokia.com.
0059 ** $QT_END_LICENSE$
0060 **
0061 ****************************************************************************/
0062 
0063 #ifndef VIDEOPLAYERTASKMENU_H
0064 #define VIDEOPLAYERTASKMENU_H
0065 
0066 #include <QObject>
0067 #include <QtDesigner/QDesignerTaskMenuExtension>
0068 #include <QtDesigner/QExtensionFactory>
0069 
0070 #include <phonon/phononnamespace.h>
0071 
0072 namespace Phonon
0073 {
0074 class VideoPlayer;
0075 }
0076 
0077 class VideoPlayerTaskMenu: public QObject, public QDesignerTaskMenuExtension
0078 {
0079     Q_OBJECT
0080     Q_INTERFACES(QDesignerTaskMenuExtension)
0081 public:
0082     explicit VideoPlayerTaskMenu(Phonon::VideoPlayer *object, QObject *parent = nullptr);
0083     QList<QAction*> taskActions() const override;
0084 
0085 private slots:
0086     void slotLoad();
0087     void slotMimeTypes();
0088     void mediaObjectStateChanged(Phonon::State newstate, Phonon::State oldstate);
0089 
0090 private:
0091     Phonon::VideoPlayer *m_widget;
0092     QAction *m_displayMimeTypesAction;
0093     QAction *m_loadAction;
0094     QAction *m_playAction;
0095     QAction *m_pauseAction;
0096     QAction *m_stopAction;
0097 
0098     QList<QAction*> m_taskActions;
0099 };
0100 
0101 class VideoPlayerTaskMenuFactory : public QExtensionFactory
0102 {
0103     Q_OBJECT
0104 public:
0105     VideoPlayerTaskMenuFactory(QExtensionManager *parent = nullptr);
0106 
0107 protected:
0108     QObject *createExtension(QObject *object,
0109                              const QString &iid, QObject *parent) const override;
0110 };
0111 
0112 #endif // VIDEOPLAYERTASKMENU_H