diff options
Diffstat (limited to 'tools/designer/src/plugins/phononwidgets')
15 files changed, 944 insertions, 0 deletions
diff --git a/tools/designer/src/plugins/phononwidgets/images/seekslider.png b/tools/designer/src/plugins/phononwidgets/images/seekslider.png Binary files differnew file mode 100644 index 0000000..a1f4cb0 --- /dev/null +++ b/tools/designer/src/plugins/phononwidgets/images/seekslider.png diff --git a/tools/designer/src/plugins/phononwidgets/images/videoplayer.png b/tools/designer/src/plugins/phononwidgets/images/videoplayer.png Binary files differnew file mode 100644 index 0000000..55d86a6 --- /dev/null +++ b/tools/designer/src/plugins/phononwidgets/images/videoplayer.png diff --git a/tools/designer/src/plugins/phononwidgets/images/videowidget.png b/tools/designer/src/plugins/phononwidgets/images/videowidget.png Binary files differnew file mode 100644 index 0000000..3e8706e --- /dev/null +++ b/tools/designer/src/plugins/phononwidgets/images/videowidget.png diff --git a/tools/designer/src/plugins/phononwidgets/images/volumeslider.png b/tools/designer/src/plugins/phononwidgets/images/volumeslider.png Binary files differnew file mode 100644 index 0000000..ea81dd2 --- /dev/null +++ b/tools/designer/src/plugins/phononwidgets/images/volumeslider.png diff --git a/tools/designer/src/plugins/phononwidgets/phononcollection.cpp b/tools/designer/src/plugins/phononwidgets/phononcollection.cpp new file mode 100644 index 0000000..3d32fd4 --- /dev/null +++ b/tools/designer/src/plugins/phononwidgets/phononcollection.cpp @@ -0,0 +1,82 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the Qt Designer of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "videoplayerplugin.h" +#include "seeksliderplugin.h" +#include "volumesliderplugin.h" + +#include <QtDesigner/QDesignerCustomWidgetCollectionInterface> +#include <QtCore/qplugin.h> + +QT_BEGIN_NAMESPACE + +class PhononCollection: public QObject, public QDesignerCustomWidgetCollectionInterface +{ + Q_OBJECT + Q_INTERFACES(QDesignerCustomWidgetCollectionInterface) +public: + explicit PhononCollection(QObject *parent = 0); + + virtual QList<QDesignerCustomWidgetInterface*> customWidgets() const; + +private: + QList<QDesignerCustomWidgetInterface*> m_plugins; +}; + +PhononCollection::PhononCollection(QObject *parent) : + QObject(parent) +{ + const QString group = QLatin1String("Phonon"); + m_plugins.push_back(new VideoPlayerPlugin(group, this)); + m_plugins.push_back(new SeekSliderPlugin(group, this)); + m_plugins.push_back(new VolumeSliderPlugin(group, this)); +} + +QList<QDesignerCustomWidgetInterface*> PhononCollection::customWidgets() const +{ + return m_plugins; +} + +Q_EXPORT_PLUGIN(PhononCollection) + +QT_END_NAMESPACE + +#include "phononcollection.moc" diff --git a/tools/designer/src/plugins/phononwidgets/phononwidgets.pro b/tools/designer/src/plugins/phononwidgets/phononwidgets.pro new file mode 100644 index 0000000..4e0f0cc --- /dev/null +++ b/tools/designer/src/plugins/phononwidgets/phononwidgets.pro @@ -0,0 +1,24 @@ +TEMPLATE = lib +TARGET = phononwidgets +CONFIG += qt warn_on plugin +QT += phonon + +include(../plugins.pri) +build_all:!build_pass { + CONFIG -= build_all + CONFIG += release +} + +# Input +SOURCES += videoplayerplugin.cpp \ + videoplayertaskmenu.cpp \ + seeksliderplugin.cpp \ + volumesliderplugin.cpp \ + phononcollection.cpp + +HEADERS += videoplayerplugin.h \ + videoplayertaskmenu.h \ + seeksliderplugin.h \ + volumesliderplugin.h + +RESOURCES += phononwidgets.qrc diff --git a/tools/designer/src/plugins/phononwidgets/phononwidgets.qrc b/tools/designer/src/plugins/phononwidgets/phononwidgets.qrc new file mode 100644 index 0000000..aa51330 --- /dev/null +++ b/tools/designer/src/plugins/phononwidgets/phononwidgets.qrc @@ -0,0 +1,8 @@ +<RCC> + <qresource prefix="/trolltech/phononwidgets"> + <file>images/videoplayer.png</file> + <file>images/videowidget.png</file> + <file>images/seekslider.png</file> + <file>images/volumeslider.png</file> + </qresource> +</RCC> diff --git a/tools/designer/src/plugins/phononwidgets/seeksliderplugin.cpp b/tools/designer/src/plugins/phononwidgets/seeksliderplugin.cpp new file mode 100644 index 0000000..9bb1317 --- /dev/null +++ b/tools/designer/src/plugins/phononwidgets/seeksliderplugin.cpp @@ -0,0 +1,117 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the Qt Designer of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "seeksliderplugin.h" + +#include <phonon/seekslider.h> + +static const char *toolTipC = "Phonon Seek Slider"; + +QT_BEGIN_NAMESPACE + +SeekSliderPlugin::SeekSliderPlugin(const QString &group, QObject *parent) : + QObject(parent), + m_group(group), + m_initialized(false) +{ +} + +QString SeekSliderPlugin::name() const +{ + return QLatin1String("Phonon::SeekSlider"); +} + +QString SeekSliderPlugin::group() const +{ + return m_group; +} + +QString SeekSliderPlugin::toolTip() const +{ + return QString(QLatin1String(toolTipC)); +} + +QString SeekSliderPlugin::whatsThis() const +{ + return QString(QLatin1String(toolTipC)); +} + +QString SeekSliderPlugin::includeFile() const +{ + return QLatin1String("<phonon/seekslider.h>"); +} + +QIcon SeekSliderPlugin::icon() const +{ + return QIcon(QLatin1String(":/trolltech/phononwidgets/images/seekslider.png")); +} + +bool SeekSliderPlugin::isContainer() const +{ + return false; +} + +QWidget *SeekSliderPlugin::createWidget(QWidget *parent) +{ + return new Phonon::SeekSlider(parent); +} + +bool SeekSliderPlugin::isInitialized() const +{ + return m_initialized; +} + +void SeekSliderPlugin::initialize(QDesignerFormEditorInterface *) +{ + if (m_initialized) + return; + m_initialized = true; +} + +QString SeekSliderPlugin::domXml() const +{ + return QLatin1String("\ + <ui language=\"c++\">\ + <widget class=\"Phonon::SeekSlider\" name=\"seekSlider\"/>\ + </ui>"); +} + +QT_END_NAMESPACE diff --git a/tools/designer/src/plugins/phononwidgets/seeksliderplugin.h b/tools/designer/src/plugins/phononwidgets/seeksliderplugin.h new file mode 100644 index 0000000..6facefe --- /dev/null +++ b/tools/designer/src/plugins/phononwidgets/seeksliderplugin.h @@ -0,0 +1,75 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the Qt Designer of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef SEEKSLIDER_PLUGIN_H +#define SEEKSLIDER_PLUGIN_H + +#include <QtDesigner/QDesignerCustomWidgetInterface> + +QT_BEGIN_NAMESPACE + +class SeekSliderPlugin: public QObject, public QDesignerCustomWidgetInterface +{ + Q_OBJECT + Q_INTERFACES(QDesignerCustomWidgetInterface) +public: + explicit SeekSliderPlugin(const QString &group, QObject *parent = 0); + + virtual QString name() const; + virtual QString group() const; + virtual QString toolTip() const; + virtual QString whatsThis() const; + virtual QString includeFile() const; + virtual QIcon icon() const; + virtual bool isContainer() const; + virtual QWidget *createWidget(QWidget *parent); + virtual bool isInitialized() const; + virtual void initialize(QDesignerFormEditorInterface *core); + virtual QString domXml() const; + +private: + const QString m_group; + bool m_initialized; +}; + +QT_END_NAMESPACE + +#endif // SEEKSLIDER_PLUGIN_H diff --git a/tools/designer/src/plugins/phononwidgets/videoplayerplugin.cpp b/tools/designer/src/plugins/phononwidgets/videoplayerplugin.cpp new file mode 100644 index 0000000..a111b1a --- /dev/null +++ b/tools/designer/src/plugins/phononwidgets/videoplayerplugin.cpp @@ -0,0 +1,135 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the Qt Designer of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "videoplayerplugin.h" +#include "videoplayertaskmenu.h" + +#include <QtDesigner/QExtensionFactory> +#include <QtDesigner/QExtensionManager> +#include <QtDesigner/QDesignerFormEditorInterface> + +#include <QtCore/qplugin.h> +#include <phonon/videoplayer.h> + +static const char *toolTipC = "Phonon Video Player"; + +QT_BEGIN_NAMESPACE + +VideoPlayerPlugin::VideoPlayerPlugin(const QString &group, QObject *parent) : + QObject(parent), + m_group(group), + m_initialized(false) +{ +} + +QString VideoPlayerPlugin::name() const +{ + return QLatin1String("Phonon::VideoPlayer"); +} + +QString VideoPlayerPlugin::group() const +{ + return m_group; +} + +QString VideoPlayerPlugin::toolTip() const +{ + return QString(QLatin1String(toolTipC)); +} + +QString VideoPlayerPlugin::whatsThis() const +{ + return QString(QLatin1String(toolTipC)); +} + +QString VideoPlayerPlugin::includeFile() const +{ + return QLatin1String("<phonon/videoplayer.h>"); +} + +QIcon VideoPlayerPlugin::icon() const +{ + return QIcon(QLatin1String(":/trolltech/phononwidgets/images/videoplayer.png")); +} + +bool VideoPlayerPlugin::isContainer() const +{ + return false; +} + +QWidget *VideoPlayerPlugin::createWidget(QWidget *parent) +{ + return new Phonon::VideoPlayer(Phonon::NoCategory, parent); +} + +bool VideoPlayerPlugin::isInitialized() const +{ + return m_initialized; +} + +void VideoPlayerPlugin::initialize(QDesignerFormEditorInterface * core) +{ + if (m_initialized) + return; + + QExtensionManager *mgr = core->extensionManager(); + VideoPlayerTaskMenuFactory::registerExtension(mgr, Q_TYPEID(QDesignerTaskMenuExtension)); + m_initialized = true; +} + +QString VideoPlayerPlugin::domXml() const +{ + return QLatin1String("\ + <ui language=\"c++\">\ + <widget class=\"Phonon::VideoPlayer\" name=\"videoPlayer\">\ + <property name=\"geometry\">\ + <rect>\ + <x>0</x>\ + <y>0</y>\ + <width>300</width>\ + <height>200</height>\ + </rect>\ + </property>\ + </widget>\ + </ui>"); +} + +QT_END_NAMESPACE diff --git a/tools/designer/src/plugins/phononwidgets/videoplayerplugin.h b/tools/designer/src/plugins/phononwidgets/videoplayerplugin.h new file mode 100644 index 0000000..1f88dc6 --- /dev/null +++ b/tools/designer/src/plugins/phononwidgets/videoplayerplugin.h @@ -0,0 +1,75 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the Qt Designer of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef VIDEOPLAYER_PLUGIN_H +#define VIDEOPLAYER_PLUGIN_H + +#include <QtDesigner/QDesignerCustomWidgetInterface> + +QT_BEGIN_NAMESPACE + +class VideoPlayerPlugin: public QObject, public QDesignerCustomWidgetInterface +{ + Q_OBJECT + Q_INTERFACES(QDesignerCustomWidgetInterface) +public: + explicit VideoPlayerPlugin(const QString &group, QObject *parent = 0); + + virtual QString name() const; + virtual QString group() const; + virtual QString toolTip() const; + virtual QString whatsThis() const; + virtual QString includeFile() const; + virtual QIcon icon() const; + virtual bool isContainer() const; + virtual QWidget *createWidget(QWidget *parent); + virtual bool isInitialized() const; + virtual void initialize(QDesignerFormEditorInterface *core); + virtual QString domXml() const; + +private: + const QString m_group; + bool m_initialized; +}; + +QT_END_NAMESPACE + +#endif // VIDEOPLAYER_PLUGIN_H diff --git a/tools/designer/src/plugins/phononwidgets/videoplayertaskmenu.cpp b/tools/designer/src/plugins/phononwidgets/videoplayertaskmenu.cpp new file mode 100644 index 0000000..9c1f2f7 --- /dev/null +++ b/tools/designer/src/plugins/phononwidgets/videoplayertaskmenu.cpp @@ -0,0 +1,154 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the Qt Designer of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "videoplayertaskmenu.h" + +#include <QtDesigner/QDesignerFormWindowInterface> +#include <QtDesigner/QDesignerFormWindowCursorInterface> +#include <QtDesigner/QDesignerFormEditorInterface> +#include <QtDesigner/QExtensionManager> + +#include <phonon/videoplayer.h> +#include <phonon/mediaobject.h> + +#include <QtGui/QPlainTextEdit> +#include <QtGui/QDialogButtonBox> +#include <QtGui/QAction> +#include <QtGui/QVBoxLayout> +#include <QtGui/QFileDialog> +#include <QtGui/QMessageBox> + +QT_BEGIN_NAMESPACE + +// ----------------- MimeTypeDialog: Display mime types in scrollable text + +class MimeTypeDialog : public QDialog { + Q_DISABLE_COPY(MimeTypeDialog) +public: + explicit MimeTypeDialog(QWidget *parent = 0); + + void setMimeTypes(const QStringList &); + +private: + QPlainTextEdit *m_plainTextEdit; +}; + +MimeTypeDialog::MimeTypeDialog(QWidget *parent) : + QDialog(parent), + m_plainTextEdit(new QPlainTextEdit) +{ + setModal(true); + setWindowTitle(VideoPlayerTaskMenu::tr("Available Mime Types")); + setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); + + QVBoxLayout *layout = new QVBoxLayout; + m_plainTextEdit->setReadOnly(true); + layout->addWidget(m_plainTextEdit); + + QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok); + connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept())); + connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())); + layout->addWidget(buttonBox); + + setLayout(layout); +} + +void MimeTypeDialog::setMimeTypes(const QStringList &l) +{ + m_plainTextEdit->setPlainText(l.join(QString(1, QLatin1Char('\n')))); +} + +// ----------------- VideoPlayerTaskMenu +VideoPlayerTaskMenu::VideoPlayerTaskMenu(Phonon::VideoPlayer *object, QObject *parent) : + QObject(parent), + m_widget(object), + m_displayMimeTypesAction(new QAction(tr("Display supported mime types..."), this)), + m_loadAction(new QAction(tr("Load..."), this)), + m_playAction(new QAction(tr("Play"), this)), + m_pauseAction(new QAction(tr("Pause"), this)), + m_stopAction(new QAction(tr("Stop"), this)) +{ + m_taskActions << m_displayMimeTypesAction << m_loadAction << m_playAction << m_pauseAction << m_stopAction; + + connect(m_widget->mediaObject(), SIGNAL(stateChanged(Phonon::State,Phonon::State)), this, SLOT(mediaObjectStateChanged(Phonon::State,Phonon::State))); + connect(m_displayMimeTypesAction, SIGNAL(triggered()), this, SLOT(slotMimeTypes())); + connect(m_loadAction, SIGNAL(triggered()), this, SLOT(slotLoad())); + connect(m_playAction, SIGNAL(triggered()), object, SLOT(play())); + connect(m_pauseAction, SIGNAL(triggered()), object, SLOT(pause())); + connect(m_stopAction, SIGNAL(triggered()), object, SLOT(stop())); +} + +QList<QAction*> VideoPlayerTaskMenu::taskActions() const +{ + const bool isPlaying = m_widget->isPlaying(); + const bool isPaused = m_widget->isPlaying(); + m_loadAction->setEnabled(!isPlaying && !isPaused); + m_playAction->setEnabled(!isPlaying); + m_pauseAction->setEnabled(isPlaying); + m_stopAction->setEnabled(isPlaying || isPaused); + return m_taskActions; +} + +void VideoPlayerTaskMenu::slotMimeTypes() +{ + MimeTypeDialog mimeTypeDialog(m_widget->window()); + mimeTypeDialog.setMimeTypes(Phonon::BackendCapabilities::availableMimeTypes()); + mimeTypeDialog.exec(); +} + +void VideoPlayerTaskMenu::slotLoad() +{ + const QString fileName = QFileDialog::getOpenFileName(m_widget->window(), tr("Choose Video Player Media Source")); + if (fileName.isEmpty()) + return; + m_widget->load(Phonon::MediaSource(fileName)); + +} + +void VideoPlayerTaskMenu::mediaObjectStateChanged(Phonon::State newstate, Phonon::State /* oldstate */) +{ + if (newstate == Phonon::ErrorState) { + const QString msg = tr("An error has occurred in '%1': %2").arg(m_widget->objectName(), m_widget->mediaObject()->errorString()); + QMessageBox::warning(m_widget->window(), tr("Video Player Error"), msg); + } +} + +QT_END_NAMESPACE diff --git a/tools/designer/src/plugins/phononwidgets/videoplayertaskmenu.h b/tools/designer/src/plugins/phononwidgets/videoplayertaskmenu.h new file mode 100644 index 0000000..d58d62d --- /dev/null +++ b/tools/designer/src/plugins/phononwidgets/videoplayertaskmenu.h @@ -0,0 +1,82 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the Qt Designer of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef VIDEOPLAYERTASKMENU_H +#define VIDEOPLAYERTASKMENU_H + + +#include <QtCore/QObject> +#include <QtDesigner/QDesignerTaskMenuExtension> +#include <QtDesigner/private/extensionfactory_p.h> + +#include <phonon> + +QT_BEGIN_NAMESPACE + +class VideoPlayerTaskMenu: public QObject, public QDesignerTaskMenuExtension +{ + Q_OBJECT + Q_INTERFACES(QDesignerTaskMenuExtension) +public: + explicit VideoPlayerTaskMenu(Phonon::VideoPlayer *object, QObject *parent = 0); + virtual QList<QAction*> taskActions() const; + +private slots: + void slotLoad(); + void slotMimeTypes(); + void mediaObjectStateChanged(Phonon::State newstate, Phonon::State oldstate); + +private: + Phonon::VideoPlayer *m_widget; + QAction *m_displayMimeTypesAction; + QAction *m_loadAction; + QAction *m_playAction; + QAction *m_pauseAction; + QAction *m_stopAction; + + QList<QAction*> m_taskActions; +}; + +typedef qdesigner_internal::ExtensionFactory<QDesignerTaskMenuExtension, Phonon::VideoPlayer, VideoPlayerTaskMenu> VideoPlayerTaskMenuFactory; + +QT_END_NAMESPACE + +#endif // VIDEOPLAYERTASKMENU_H diff --git a/tools/designer/src/plugins/phononwidgets/volumesliderplugin.cpp b/tools/designer/src/plugins/phononwidgets/volumesliderplugin.cpp new file mode 100644 index 0000000..61625cc --- /dev/null +++ b/tools/designer/src/plugins/phononwidgets/volumesliderplugin.cpp @@ -0,0 +1,117 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the Qt Designer of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "volumesliderplugin.h" + +#include <phonon/volumeslider.h> + +static const char *toolTipC = "Phonon Volume Slider"; + +QT_BEGIN_NAMESPACE + +VolumeSliderPlugin::VolumeSliderPlugin(const QString &group, QObject *parent) : + QObject(parent), + m_group(group), + m_initialized(false) +{ +} + +QString VolumeSliderPlugin::name() const +{ + return QLatin1String("Phonon::VolumeSlider"); +} + +QString VolumeSliderPlugin::group() const +{ + return m_group; +} + +QString VolumeSliderPlugin::toolTip() const +{ + return QString(QLatin1String(toolTipC)); +} + +QString VolumeSliderPlugin::whatsThis() const +{ + return QString(QLatin1String(toolTipC)); +} + +QString VolumeSliderPlugin::includeFile() const +{ + return QLatin1String("<phonon/volumeslider.h>"); +} + +QIcon VolumeSliderPlugin::icon() const +{ + return QIcon(QLatin1String(":/trolltech/phononwidgets/images/volumeslider.png")); +} + +bool VolumeSliderPlugin::isContainer() const +{ + return false; +} + +QWidget *VolumeSliderPlugin::createWidget(QWidget *parent) +{ + return new Phonon::VolumeSlider(parent); +} + +bool VolumeSliderPlugin::isInitialized() const +{ + return m_initialized; +} + +void VolumeSliderPlugin::initialize(QDesignerFormEditorInterface *) +{ + if (m_initialized) + return; + m_initialized = true; +} + +QString VolumeSliderPlugin::domXml() const +{ + return QLatin1String("\ + <ui language=\"c++\">\ + <widget class=\"Phonon::VolumeSlider\" name=\"volumeSlider\"/>\ + </ui>"); +} + +QT_END_NAMESPACE diff --git a/tools/designer/src/plugins/phononwidgets/volumesliderplugin.h b/tools/designer/src/plugins/phononwidgets/volumesliderplugin.h new file mode 100644 index 0000000..02c5fe1 --- /dev/null +++ b/tools/designer/src/plugins/phononwidgets/volumesliderplugin.h @@ -0,0 +1,75 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the Qt Designer of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef VOLUMESLIDER_PLUGIN_H +#define VOLUMESLIDER_PLUGIN_H + +#include <QtDesigner/QDesignerCustomWidgetInterface> + +QT_BEGIN_NAMESPACE + +class VolumeSliderPlugin: public QObject, public QDesignerCustomWidgetInterface +{ + Q_OBJECT + Q_INTERFACES(QDesignerCustomWidgetInterface) +public: + explicit VolumeSliderPlugin(const QString &group, QObject *parent = 0); + + virtual QString name() const; + virtual QString group() const; + virtual QString toolTip() const; + virtual QString whatsThis() const; + virtual QString includeFile() const; + virtual QIcon icon() const; + virtual bool isContainer() const; + virtual QWidget *createWidget(QWidget *parent); + virtual bool isInitialized() const; + virtual void initialize(QDesignerFormEditorInterface *core); + virtual QString domXml() const; + +private: + const QString m_group; + bool m_initialized; +}; + +QT_END_NAMESPACE + +#endif // VOLUMESLIDER_PLUGIN_H |