File indexing completed on 2025-02-09 05:31:41
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 #include "videoplayerplugin.h" 0064 #include "videoplayertaskmenu.h" 0065 0066 #include <QtDesigner/QExtensionFactory> 0067 #include <QtDesigner/QExtensionManager> 0068 #include <QtDesigner/QDesignerFormEditorInterface> 0069 0070 #include <qplugin.h> 0071 #include <phonon/videoplayer.h> 0072 0073 static const char *videoPlayerToolTipC = "Phonon Video Player"; 0074 0075 VideoPlayerPlugin::VideoPlayerPlugin(const QString &group, QObject *parent) : 0076 QObject(parent), 0077 m_group(group), 0078 m_initialized(false) 0079 { 0080 } 0081 0082 QString VideoPlayerPlugin::name() const 0083 { 0084 return QLatin1String("Phonon::VideoPlayer"); 0085 } 0086 0087 QString VideoPlayerPlugin::group() const 0088 { 0089 return m_group; 0090 } 0091 0092 QString VideoPlayerPlugin::toolTip() const 0093 { 0094 return QString(QLatin1String(videoPlayerToolTipC)); 0095 } 0096 0097 QString VideoPlayerPlugin::whatsThis() const 0098 { 0099 return QString(QLatin1String(videoPlayerToolTipC)); 0100 } 0101 0102 QString VideoPlayerPlugin::includeFile() const 0103 { 0104 return QLatin1String("<phonon/videoplayer.h>"); 0105 } 0106 0107 QIcon VideoPlayerPlugin::icon() const 0108 { 0109 return QIcon(QLatin1String(":/trolltech/phononwidgets/images/videoplayer.png")); 0110 } 0111 0112 bool VideoPlayerPlugin::isContainer() const 0113 { 0114 return false; 0115 } 0116 0117 QWidget *VideoPlayerPlugin::createWidget(QWidget *parent) 0118 { 0119 return new Phonon::VideoPlayer(Phonon::NoCategory, parent); 0120 } 0121 0122 bool VideoPlayerPlugin::isInitialized() const 0123 { 0124 return m_initialized; 0125 } 0126 0127 void VideoPlayerPlugin::initialize(QDesignerFormEditorInterface *formEditor) 0128 { 0129 if (m_initialized) 0130 return; 0131 0132 QExtensionManager *manager = formEditor->extensionManager(); 0133 Q_ASSERT(manager != nullptr); 0134 0135 manager->registerExtensions(new VideoPlayerTaskMenuFactory(manager), 0136 Q_TYPEID(QDesignerTaskMenuExtension)); 0137 0138 m_initialized = true; 0139 } 0140 0141 QString VideoPlayerPlugin::domXml() const 0142 { 0143 return QLatin1String("\ 0144 <ui language=\"c++\">\ 0145 <widget class=\"Phonon::VideoPlayer\" name=\"videoPlayer\">\ 0146 <property name=\"geometry\">\ 0147 <rect>\ 0148 <x>0</x>\ 0149 <y>0</y>\ 0150 <width>300</width>\ 0151 <height>200</height>\ 0152 </rect>\ 0153 </property>\ 0154 </widget>\ 0155 </ui>"); 0156 }