diff --git a/designer/CMakeLists.txt b/designer/CMakeLists.txt index 0ad0fe1b..fa307270 100644 --- a/designer/CMakeLists.txt +++ b/designer/CMakeLists.txt @@ -1,20 +1,39 @@ set(phononwidgetsplugin_SRCS phononcollection.cpp seeksliderplugin.cpp videoplayerplugin.cpp videoplayertaskmenu.cpp videowidgetplugin.cpp volumesliderplugin.cpp ) qt5_add_resources(phononwidgetsplugin_SRCS phononwidgets.qrc) add_library(phononwidgets MODULE ${phononwidgetsplugin_SRCS}) + +# Techincally since 5.9 we should only need uiplugins and not designer, +# in the interest of simplicity we still look for and use the designer +# target though so things definitely build on <5.9 + +# To bypass warnings about using the wrong/deprecated headers make +# sure to prefer UiPlugins whenever available. +if(Qt5UiPlugin_VERSION AND NOT Qt5UiPlugin_VERSION VERSION_LESS "5.9.0") + target_link_libraries(phononwidgets Qt5::UiPlugin) +else() + # In <5.9 one would ordinarily include QtDesigner/Foo to + # get unified code we'll manually inject the include dir + # into the target so we get away with Foo. + target_include_directories(phononwidgets + PRIVATE ${Qt5UiPlugin_INCLUDE_DIRS} + PRIVATE ${Qt5Designer_INCLUDE_DIRS} + ) +endif() + target_link_libraries(phononwidgets Phonon::${PHONON_LIB_SONAME} Qt5::Core Qt5::Gui Qt5::Widgets Qt5::Designer ) install(TARGETS phononwidgets DESTINATION ${KDE_INSTALL_QTPLUGINDIR}) diff --git a/designer/phononcollection.cpp b/designer/phononcollection.cpp index dadc9373..7f7cda65 100644 --- a/designer/phononcollection.cpp +++ b/designer/phononcollection.cpp @@ -1,100 +1,100 @@ /* Copyright (C) 2011 Harald Sitter This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) version 3, or any later version accepted by the membership of KDE e.V. (or its successor approved by the membership of KDE e.V.), Nokia Corporation (or its successors, if any) and the KDE Free Qt Foundation, which shall act as a proxy defined in Section 6 of version 3 of the license. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library. If not, see . */ /**************************************************************************** ** ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the Qt Designer of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial Usage ** Licensees holding valid Qt Commercial licenses may use this file in ** accordance with the Qt Commercial License Agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Nokia. ** ** 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.1, 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 have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. ** $QT_END_LICENSE$ ** ****************************************************************************/ #include "seeksliderplugin.h" #include "videoplayerplugin.h" #include "videowidgetplugin.h" #include "volumesliderplugin.h" -#include -#include +#include +#include class PhononCollection: public QObject, public QDesignerCustomWidgetCollectionInterface { Q_OBJECT Q_PLUGIN_METADATA(IID "org.kde.phonon.PhononCollection") Q_INTERFACES(QDesignerCustomWidgetCollectionInterface) public: explicit PhononCollection(QObject *parent = nullptr); virtual QList customWidgets() const override; private: QList m_plugins; }; PhononCollection::PhononCollection(QObject *parent) : QObject(parent) { const QString group = QLatin1String("Phonon"); m_plugins.push_back(new SeekSliderPlugin(group, this)); m_plugins.push_back(new VideoPlayerPlugin(group, this)); m_plugins.push_back(new VideoWidgetPlugin(group, this)); m_plugins.push_back(new VolumeSliderPlugin(group, this)); } QList PhononCollection::customWidgets() const { return m_plugins; } #include "phononcollection.moc" diff --git a/designer/seeksliderplugin.h b/designer/seeksliderplugin.h index 79ad9dae..a6f6a786 100644 --- a/designer/seeksliderplugin.h +++ b/designer/seeksliderplugin.h @@ -1,71 +1,71 @@ /**************************************************************************** ** ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the Qt Designer of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial Usage ** Licensees holding valid Qt Commercial licenses may use this file in ** accordance with the Qt Commercial License Agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Nokia. ** ** 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.1, 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 have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. ** $QT_END_LICENSE$ ** ****************************************************************************/ #ifndef SEEKSLIDER_PLUGIN_H #define SEEKSLIDER_PLUGIN_H -#include +#include class SeekSliderPlugin: public QObject, public QDesignerCustomWidgetInterface { Q_OBJECT Q_INTERFACES(QDesignerCustomWidgetInterface) public: explicit SeekSliderPlugin(const QString &group, QObject *parent = 0); virtual QString name() const override; virtual QString group() const override; virtual QString toolTip() const override; virtual QString whatsThis() const override; virtual QString includeFile() const override; virtual QIcon icon() const override; virtual bool isContainer() const override; virtual QWidget *createWidget(QWidget *parent) override; virtual bool isInitialized() const override; virtual void initialize(QDesignerFormEditorInterface *core) override; virtual QString domXml() const override; private: const QString m_group; bool m_initialized; }; #endif // SEEKSLIDER_PLUGIN_H diff --git a/designer/videoplayerplugin.h b/designer/videoplayerplugin.h index 5ca4f686..e48b8cb4 100644 --- a/designer/videoplayerplugin.h +++ b/designer/videoplayerplugin.h @@ -1,71 +1,71 @@ /**************************************************************************** ** ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the Qt Designer of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial Usage ** Licensees holding valid Qt Commercial licenses may use this file in ** accordance with the Qt Commercial License Agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Nokia. ** ** 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.1, 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 have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. ** $QT_END_LICENSE$ ** ****************************************************************************/ #ifndef VIDEOPLAYER_PLUGIN_H #define VIDEOPLAYER_PLUGIN_H -#include +#include class VideoPlayerPlugin: public QObject, public QDesignerCustomWidgetInterface { Q_OBJECT Q_INTERFACES(QDesignerCustomWidgetInterface) public: explicit VideoPlayerPlugin(const QString &group, QObject *parent = 0); virtual QString name() const override; virtual QString group() const override; virtual QString toolTip() const override; virtual QString whatsThis() const override; virtual QString includeFile() const override; virtual QIcon icon() const override; virtual bool isContainer() const override; virtual QWidget *createWidget(QWidget *parent) override; virtual bool isInitialized() const override; virtual void initialize(QDesignerFormEditorInterface *core) override; virtual QString domXml() const override; private: const QString m_group; bool m_initialized; }; #endif // VIDEOPLAYER_PLUGIN_H diff --git a/designer/videowidgetplugin.cpp b/designer/videowidgetplugin.cpp index 1597cad4..71897871 100644 --- a/designer/videowidgetplugin.cpp +++ b/designer/videowidgetplugin.cpp @@ -1,110 +1,106 @@ /* Copyright (C) 2011 Harald Sitter This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) version 3, or any later version accepted by the membership of KDE e.V. (or its successor approved by the membership of KDE e.V.), Nokia Corporation (or its successors, if any) and the KDE Free Qt Foundation, which shall act as a proxy defined in Section 6 of version 3 of the license. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library. If not, see . */ #include "videowidgetplugin.h" -#include -#include -#include - -#include +#include #include static const char *toolTipC = "Phonon Video Widget"; VideoWidgetPlugin::VideoWidgetPlugin(const QString &group, QObject *parent) : QObject(parent), m_group(group), m_initialized(false) { } QString VideoWidgetPlugin::name() const { return QLatin1String("Phonon::VideoWidget"); } QString VideoWidgetPlugin::group() const { return m_group; } QString VideoWidgetPlugin::toolTip() const { return QString(QLatin1String(toolTipC)); } QString VideoWidgetPlugin::whatsThis() const { return QString(QLatin1String(toolTipC)); } QString VideoWidgetPlugin::includeFile() const { return QLatin1String(""); } QIcon VideoWidgetPlugin::icon() const { // TODO: icon return QIcon(); } bool VideoWidgetPlugin::isContainer() const { return false; } QWidget *VideoWidgetPlugin::createWidget(QWidget *parent) { return new Phonon::VideoWidget(parent); } bool VideoWidgetPlugin::isInitialized() const { return m_initialized; } void VideoWidgetPlugin::initialize(QDesignerFormEditorInterface *formEditor) { Q_UNUSED(formEditor); if (m_initialized) return; m_initialized = true; } QString VideoWidgetPlugin::domXml() const { return QLatin1String("\ \ \ \ \ 0\ 0\ 300\ 200\ \ \ \ "); } diff --git a/designer/videowidgetplugin.h b/designer/videowidgetplugin.h index 940e15a3..db59b189 100644 --- a/designer/videowidgetplugin.h +++ b/designer/videowidgetplugin.h @@ -1,51 +1,51 @@ /* Copyright (C) 2011 Harald Sitter This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) version 3, or any later version accepted by the membership of KDE e.V. (or its successor approved by the membership of KDE e.V.), Nokia Corporation (or its successors, if any) and the KDE Free Qt Foundation, which shall act as a proxy defined in Section 6 of version 3 of the license. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library. If not, see . */ #ifndef VIDEOWIDGET_PLUGIN_H #define VIDEOWIDGET_PLUGIN_H -#include +#include class VideoWidgetPlugin: public QObject, public QDesignerCustomWidgetInterface { Q_OBJECT Q_INTERFACES(QDesignerCustomWidgetInterface) public: explicit VideoWidgetPlugin(const QString &group, QObject *parent = 0); virtual QString name() const override; virtual QString group() const override; virtual QString toolTip() const override; virtual QString whatsThis() const override; virtual QString includeFile() const override; virtual QIcon icon() const override; virtual bool isContainer() const override; virtual QWidget *createWidget(QWidget *parent) override; virtual bool isInitialized() const override; virtual void initialize(QDesignerFormEditorInterface *core) override; virtual QString domXml() const override; private: const QString m_group; bool m_initialized; }; #endif // VIDEOWIDGET_PLUGIN_H diff --git a/designer/volumesliderplugin.h b/designer/volumesliderplugin.h index 97a0c98a..9f46023c 100644 --- a/designer/volumesliderplugin.h +++ b/designer/volumesliderplugin.h @@ -1,71 +1,71 @@ /**************************************************************************** ** ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the Qt Designer of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial Usage ** Licensees holding valid Qt Commercial licenses may use this file in ** accordance with the Qt Commercial License Agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Nokia. ** ** 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.1, 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 have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. ** $QT_END_LICENSE$ ** ****************************************************************************/ #ifndef VOLUMESLIDER_PLUGIN_H #define VOLUMESLIDER_PLUGIN_H -#include +#include class VolumeSliderPlugin: public QObject, public QDesignerCustomWidgetInterface { Q_OBJECT Q_INTERFACES(QDesignerCustomWidgetInterface) public: explicit VolumeSliderPlugin(const QString &group, QObject *parent = 0); virtual QString name() const override; virtual QString group() const override; virtual QString toolTip() const override; virtual QString whatsThis() const override; virtual QString includeFile() const override; virtual QIcon icon() const override; virtual bool isContainer() const override; virtual QWidget *createWidget(QWidget *parent) override; virtual bool isInitialized() const override; virtual void initialize(QDesignerFormEditorInterface *core) override; virtual QString domXml() const override; private: const QString m_group; bool m_initialized; }; #endif // VOLUMESLIDER_PLUGIN_H diff --git a/phonon/experimental/abstractaudiodataoutput_p.h b/phonon/experimental/abstractaudiodataoutput_p.h index 14430cfc..5bfa2aa0 100644 --- a/phonon/experimental/abstractaudiodataoutput_p.h +++ b/phonon/experimental/abstractaudiodataoutput_p.h @@ -1,51 +1,51 @@ /* This file is part of the KDE project Copyright (C) 2008 Matthias Kretz This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) version 3, or any later version accepted by the membership of KDE e.V. (or its successor approved by the membership of KDE e.V.), Nokia Corporation (or its successors, if any) and the KDE Free Qt Foundation, which shall act as a proxy defined in Section 6 of version 3 of the license. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library. If not, see . */ #ifndef PHONON_X_ABSTRACTAUDIODATAOUTPUT_P_H #define PHONON_X_ABSTRACTAUDIODATAOUTPUT_P_H #include "abstractaudiodataoutput.h" #include "../medianode_p.h" #include "phonondefs_p.h" namespace Phonon { namespace Experimental { class AbstractAudioDataOutputPrivate : public Phonon::MediaNodePrivate { P_DECLARE_PUBLIC(AbstractAudioDataOutput) protected: - virtual bool aboutToDeleteBackendObject() { return true; } - virtual void createBackendObject(); + virtual bool aboutToDeleteBackendObject() override { return true; } + virtual void createBackendObject() override; void setupBackendObject(); private: bool isRunning; QSet allowedFormats; }; } // namespace Experimental } // namespace Phonon #endif // PHONON_X_ABSTRACTAUDIODATAOUTPUT_P_H diff --git a/phonon/experimental/abstractvideodataoutput_p.h b/phonon/experimental/abstractvideodataoutput_p.h index 0c2a659d..ad2d87dd 100644 --- a/phonon/experimental/abstractvideodataoutput_p.h +++ b/phonon/experimental/abstractvideodataoutput_p.h @@ -1,50 +1,50 @@ /* This file is part of the KDE project Copyright (C) 2008 Matthias Kretz This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) version 3, or any later version accepted by the membership of KDE e.V. (or its successor approved by the membership of KDE e.V.), Nokia Corporation (or its successors, if any) and the KDE Free Qt Foundation, which shall act as a proxy defined in Section 6 of version 3 of the license. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library. If not, see . */ #ifndef PHONON_X_ABSTRACTVIDEODATAOUTPUT_P_H #define PHONON_X_ABSTRACTVIDEODATAOUTPUT_P_H #include "abstractvideodataoutput.h" #include "../abstractvideooutput_p.h" #include namespace Phonon { namespace Experimental { class AbstractVideoDataOutputPrivate : public Phonon::AbstractVideoOutputPrivate { P_DECLARE_PUBLIC(AbstractVideoDataOutput) protected: - virtual bool aboutToDeleteBackendObject(); - virtual void createBackendObject(); + bool aboutToDeleteBackendObject() override; + void createBackendObject() override; void setupBackendObject(); private: bool isRunning; QSet allowedFormats; }; } // namespace Experimental } // namespace Phonon #endif // PHONON_X_ABSTRACTVIDEODATAOUTPUT_P_H diff --git a/phonon/path_p.h b/phonon/path_p.h index e5fb9210..cbfda419 100644 --- a/phonon/path_p.h +++ b/phonon/path_p.h @@ -1,75 +1,75 @@ /* This file is part of the KDE project Copyright (C) 2007 Matthias Kretz This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) version 3, or any later version accepted by the membership of KDE e.V. (or its successor approved by the membership of KDE e.V.), Nokia Corporation (or its successors, if any) and the KDE Free Qt Foundation, which shall act as a proxy defined in Section 6 of version 3 of the license. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library. If not, see . */ #ifndef PATH_P_H #define PATH_P_H #include "path.h" #include #include #include #include "effect.h" #include "medianodedestructionhandler_p.h" class QObject; namespace Phonon { class MediaNode; typedef QPair QObjectPair; class PathPrivate : public QSharedData, private MediaNodeDestructionHandler { friend class Path; public: PathPrivate() : sourceNode(0), sinkNode(0) #ifndef QT_NO_PHONON_EFFECT , effectsParent(0) #endif //QT_NO_PHONON_EFFECT { } ~PathPrivate(); MediaNode *sourceNode; MediaNode *sinkNode; protected: - void phononObjectDestroyed(MediaNodePrivate *); + void phononObjectDestroyed(MediaNodePrivate *) override; #ifndef QT_NO_PHONON_EFFECT QObject *effectsParent; // used as parent for Effects created in insertEffect QList effects; #endif private: bool executeTransaction( const QList &disconnections, const QList &connections); #ifndef QT_NO_PHONON_EFFECT bool removeEffect(Effect *effect); #endif }; } // namespace Phonon #endif // PATH_P_H diff --git a/phonon/seekslider.cpp b/phonon/seekslider.cpp index 7fff8ce0..e2217268 100644 --- a/phonon/seekslider.cpp +++ b/phonon/seekslider.cpp @@ -1,259 +1,261 @@ /* This file is part of the KDE project Copyright (C) 2006-2007 Matthias Kretz This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) version 3, or any later version accepted by the membership of KDE e.V. (or its successor approved by the membership of KDE e.V.), Nokia Corporation (or its successors, if any) and the KDE Free Qt Foundation, which shall act as a proxy defined in Section 6 of version 3 of the license. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library. If not, see . */ #include "seekslider.h" #include "seekslider_p.h" #include "mediaobject.h" #include "phonondefs_p.h" #include #include #ifndef QT_NO_PHONON_SEEKSLIDER namespace Phonon { SeekSlider::SeekSlider(QWidget *parent) : QWidget(parent) , k_ptr(new SeekSliderPrivate(this)) { P_D(SeekSlider); connect(&d->slider, SIGNAL(valueChanged(int)), SLOT(_k_seek(int))); } SeekSlider::SeekSlider(MediaObject *mo, QWidget *parent) : QWidget(parent) , k_ptr(new SeekSliderPrivate(this)) { P_D(SeekSlider); connect(&d->slider, SIGNAL(valueChanged(int)), SLOT(_k_seek(int))); setMediaObject(mo); } /*SeekSlider::SeekSlider(SeekSliderPrivate &_d, QWidget *parent) : QWidget(parent) , k_ptr(&_d) { } */ SeekSlider::~SeekSlider() { delete k_ptr; } void SeekSlider::setMediaObject(MediaObject *media) { P_D(SeekSlider); if (d->media) { - disconnect(d->media, 0, this, 0); + disconnect(d->media, nullptr, this, nullptr); } d->media = media; if (media) { connect(media, SIGNAL(stateChanged(Phonon::State,Phonon::State)), SLOT(_k_stateChanged(Phonon::State))); connect(media, SIGNAL(totalTimeChanged(qint64)), SLOT(_k_length(qint64))); connect(media, SIGNAL(tick(qint64)), SLOT(_k_tick(qint64))); connect(media, SIGNAL(seekableChanged(bool)), SLOT(_k_seekableChanged(bool))); connect(media, SIGNAL(currentSourceChanged(Phonon::MediaSource)), SLOT(_k_currentSourceChanged())); d->_k_stateChanged(media->state()); d->_k_seekableChanged(media->isSeekable()); d->_k_length(media->totalTime()); } else { d->_k_stateChanged(Phonon::StoppedState); d->_k_seekableChanged(false); } } MediaObject *SeekSlider::mediaObject() const { P_D(const SeekSlider); return d->media; } void SeekSliderPrivate::_k_seek(int msec) { if (!ticking && media) { media->seek(msec); } } void SeekSliderPrivate::_k_tick(qint64 msec) { ticking = true; slider.setValue(msec); ticking = false; } void SeekSliderPrivate::_k_length(qint64 msec) { ticking = true; slider.setRange(0, msec); ticking = false; } void SeekSliderPrivate::_k_seekableChanged(bool isSeekable) { if (!isSeekable || !media) { setEnabled(false); } else { switch (media->state()) { case Phonon::PlayingState: if (media->tickInterval() == 0) { // if the tick signal is not enabled the slider is useless // set the tickInterval to some common value media->setTickInterval(350); } + break; case Phonon::BufferingState: case Phonon::PausedState: setEnabled(true); break; case Phonon::StoppedState: case Phonon::LoadingState: case Phonon::ErrorState: setEnabled(false); ticking = true; slider.setValue(0); ticking = false; break; } } } void SeekSliderPrivate::_k_currentSourceChanged() { //this releases the mouse and makes the seek slider stop seeking if the current source has changed - QMouseEvent event(QEvent::MouseButtonRelease, QPoint(), Qt::LeftButton, 0, 0); + QMouseEvent event(QEvent::MouseButtonRelease, QPoint(), Qt::LeftButton, nullptr, nullptr); QApplication::sendEvent(&slider, &event); } void SeekSliderPrivate::setEnabled(bool x) { slider.setEnabled(x); iconLabel.setPixmap(icon.pixmap(iconSize, x ? QIcon::Normal : QIcon::Disabled)); } void SeekSliderPrivate::_k_stateChanged(State newstate) { if (!media || !media->isSeekable()) { setEnabled(false); return; } switch (newstate) { case Phonon::PlayingState: if (media->tickInterval() == 0) { // if the tick signal is not enabled the slider is useless // set the tickInterval to some common value media->setTickInterval(350); } + break; case Phonon::BufferingState: case Phonon::PausedState: setEnabled(true); break; case Phonon::StoppedState: case Phonon::LoadingState: case Phonon::ErrorState: setEnabled(false); ticking = true; slider.setValue(0); ticking = false; break; } } bool SeekSlider::hasTracking() const { return k_ptr->slider.hasTracking(); } void SeekSlider::setTracking(bool tracking) { k_ptr->slider.setTracking(tracking); } int SeekSlider::pageStep() const { return k_ptr->slider.pageStep(); } void SeekSlider::setPageStep(int milliseconds) { k_ptr->slider.setPageStep(milliseconds); } int SeekSlider::singleStep() const { return k_ptr->slider.singleStep(); } void SeekSlider::setSingleStep(int milliseconds) { k_ptr->slider.setSingleStep(milliseconds); } bool SeekSlider::isIconVisible() const { P_D(const SeekSlider); return d->iconLabel.isVisible(); } void SeekSlider::setIconVisible(bool vis) { P_D(SeekSlider); d->iconLabel.setVisible(vis); } Qt::Orientation SeekSlider::orientation() const { return k_ptr->slider.orientation(); } void SeekSlider::setOrientation(Qt::Orientation o) { P_D(SeekSlider); Qt::Alignment align = (o == Qt::Horizontal ? Qt::AlignVCenter : Qt::AlignHCenter); d->layout.setAlignment(&d->iconLabel, align); d->layout.setAlignment(&d->slider, align); d->layout.setDirection(o == Qt::Horizontal ? QBoxLayout::LeftToRight : QBoxLayout::TopToBottom); d->slider.setOrientation(o); } QSize SeekSlider::iconSize() const { return k_ptr->iconSize; } void SeekSlider::setIconSize(const QSize &iconSize) { P_D(SeekSlider); d->iconSize = iconSize; d->iconLabel.setPixmap(d->icon.pixmap(d->iconSize, d->slider.isEnabled() ? QIcon::Normal : QIcon::Disabled)); } } // namespace Phonon #endif //QT_NO_PHONON_SEEKSLIDER #include "moc_seekslider.cpp" // vim: sw=4 ts=4