1 /*
2     Copyright (C) 2011 Harald Sitter <sitter@kde.org>
3 
4     This library is free software; you can redistribute it and/or
5     modify it under the terms of the GNU Lesser General Public
6     License as published by the Free Software Foundation; either
7     version 2.1 of the License, or (at your option) version 3, or any
8     later version accepted by the membership of KDE e.V. (or its
9     successor approved by the membership of KDE e.V.), Nokia Corporation
10     (or its successors, if any) and the KDE Free Qt Foundation, which shall
11     act as a proxy defined in Section 6 of version 3 of the license.
12 
13     This library is distributed in the hope that it will be useful,
14     but WITHOUT ANY WARRANTY; without even the implied warranty of
15     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16     Lesser General Public License for more details.
17 
18     You should have received a copy of the GNU Lesser General Public
19     License along with this library.  If not, see <http://www.gnu.org/licenses/>.
20 */
21 
22 /****************************************************************************
23 **
24 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
25 ** All rights reserved.
26 ** Contact: Nokia Corporation (qt-info@nokia.com)
27 **
28 ** This file is part of the Qt Designer of the Qt Toolkit.
29 **
30 ** $QT_BEGIN_LICENSE:LGPL$
31 ** Commercial Usage
32 ** Licensees holding valid Qt Commercial licenses may use this file in
33 ** accordance with the Qt Commercial License Agreement provided with the
34 ** Software or, alternatively, in accordance with the terms contained in
35 ** a written agreement between you and Nokia.
36 **
37 ** GNU Lesser General Public License Usage
38 ** Alternatively, this file may be used under the terms of the GNU Lesser
39 ** General Public License version 2.1 as published by the Free Software
40 ** Foundation and appearing in the file LICENSE.LGPL included in the
41 ** packaging of this file.  Please review the following information to
42 ** ensure the GNU Lesser General Public License version 2.1 requirements
43 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
44 **
45 ** In addition, as a special exception, Nokia gives you certain additional
46 ** rights.  These rights are described in the Nokia Qt LGPL Exception
47 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
48 **
49 ** GNU General Public License Usage
50 ** Alternatively, this file may be used under the terms of the GNU
51 ** General Public License version 3.0 as published by the Free Software
52 ** Foundation and appearing in the file LICENSE.GPL included in the
53 ** packaging of this file.  Please review the following information to
54 ** ensure the GNU General Public License version 3.0 requirements will be
55 ** met: http://www.gnu.org/copyleft/gpl.html.
56 **
57 ** If you have questions regarding the use of this file, please contact
58 ** Nokia at qt-info@nokia.com.
59 ** $QT_END_LICENSE$
60 **
61 ****************************************************************************/
62 
63 #ifndef VIDEOPLAYERTASKMENU_H
64 #define VIDEOPLAYERTASKMENU_H
65 
66 #include <QtCore/QObject>
67 #include <QtDesigner/QDesignerTaskMenuExtension>
68 #include <QtDesigner/QExtensionFactory>
69 
70 #include <phonon/phononnamespace.h>
71 
72 namespace Phonon
73 {
74 class VideoPlayer;
75 }
76 
77 class VideoPlayerTaskMenu: public QObject, public QDesignerTaskMenuExtension
78 {
79     Q_OBJECT
80     Q_INTERFACES(QDesignerTaskMenuExtension)
81 public:
82     explicit VideoPlayerTaskMenu(Phonon::VideoPlayer *object, QObject *parent = 0);
83     virtual QList<QAction*> taskActions() const override;
84 
85 private slots:
86     void slotLoad();
87     void slotMimeTypes();
88     void mediaObjectStateChanged(Phonon::State newstate, Phonon::State oldstate);
89 
90 private:
91     Phonon::VideoPlayer *m_widget;
92     QAction *m_displayMimeTypesAction;
93     QAction *m_loadAction;
94     QAction *m_playAction;
95     QAction *m_pauseAction;
96     QAction *m_stopAction;
97 
98     QList<QAction*> m_taskActions;
99 };
100 
101 class VideoPlayerTaskMenuFactory : public QExtensionFactory
102 {
103     Q_OBJECT
104 public:
105     VideoPlayerTaskMenuFactory(QExtensionManager *parent = 0);
106 
107 protected:
108     QObject *createExtension(QObject *object,
109                              const QString &iid, QObject *parent) const override;
110 };
111 
112 #endif // VIDEOPLAYERTASKMENU_H
113