X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/4c9952683a7f977402353f1b9a3fd5271e51740e..781e8e9e18579c0fe368ed9fe295f908493272b3:/src/panels/information/phononwidget.cpp diff --git a/src/panels/information/phononwidget.cpp b/src/panels/information/phononwidget.cpp index 6911f79bd..3365998f4 100644 --- a/src/panels/information/phononwidget.cpp +++ b/src/panels/information/phononwidget.cpp @@ -1,33 +1,19 @@ -/* This file is part of the KDE project - Copyright (C) 2007 Matthias Kretz - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of - the License, or (at your option) any later version. - - This program 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 General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. +/* + SPDX-FileCopyrightText: 2007 Matthias Kretz + SPDX-License-Identifier: GPL-2.0-or-later */ #include "phononwidget.h" -#include #include -#include -#include -#include -#include +#include +#include +#include +#include #include +#include #include #include @@ -35,37 +21,37 @@ class EmbeddedVideoPlayer : public Phonon::VideoWidget { Q_OBJECT - public: - EmbeddedVideoPlayer(QWidget *parent = nullptr) : - Phonon::VideoWidget(parent) - { - } +public: + EmbeddedVideoPlayer(QWidget *parent = nullptr) + : Phonon::VideoWidget(parent) + { + } - void setSizeHint(const QSize& size) - { - m_sizeHint = size; - updateGeometry(); - } + void setSizeHint(const QSize &size) + { + m_sizeHint = size; + updateGeometry(); + } - QSize sizeHint() const override - { - return m_sizeHint.isValid() ? m_sizeHint : Phonon::VideoWidget::sizeHint(); - } + QSize sizeHint() const override + { + return m_sizeHint.isValid() ? m_sizeHint : Phonon::VideoWidget::sizeHint(); + } - private: - QSize m_sizeHint; +private: + QSize m_sizeHint; }; PhononWidget::PhononWidget(QWidget *parent) - : QWidget(parent), - m_url(), - m_playButton(nullptr), - m_pauseButton(nullptr), - m_topLayout(nullptr), - m_media(nullptr), - m_seekSlider(nullptr), - m_audioOutput(nullptr), - m_videoPlayer(nullptr) + : QWidget(parent) + , m_url() + , m_playButton(nullptr) + , m_pauseButton(nullptr) + , m_topLayout(nullptr) + , m_media(nullptr) + , m_seekSlider(nullptr) + , m_audioOutput(nullptr) + , m_videoPlayer(nullptr) { } @@ -113,7 +99,7 @@ bool PhononWidget::eventFilter(QObject *object, QEvent *event) { Q_UNUSED(object) if (event->type() == QEvent::MouseButtonPress) { - const QMouseEvent *mouseEvent = static_cast(event); + const QMouseEvent *mouseEvent = static_cast(event); if (mouseEvent->button() == Qt::LeftButton) { // toggle playback togglePlayback(); @@ -123,7 +109,7 @@ bool PhononWidget::eventFilter(QObject *object, QEvent *event) return false; } -void PhononWidget::setVideoSize(const QSize& size) +void PhononWidget::setVideoSize(const QSize &size) { if (m_videoSize != size) { m_videoSize = size; @@ -161,7 +147,7 @@ void PhononWidget::showEvent(QShowEvent *event) m_topLayout->addLayout(controlsLayout); - const int smallIconSize = IconSize(KIconLoader::Small); + const int smallIconSize = style()->pixelMetric(QStyle::PM_SmallIconSize); const QSize buttonSize(smallIconSize, smallIconSize); m_playButton->setToolTip(i18n("play")); @@ -215,10 +201,8 @@ void PhononWidget::play() { if (!m_media) { m_media = new Phonon::MediaObject(this); - connect(m_media, &Phonon::MediaObject::stateChanged, - this, &PhononWidget::stateChanged); - connect(m_media, &Phonon::MediaObject::finished, - this, &PhononWidget::finished); + connect(m_media, &Phonon::MediaObject::stateChanged, this, &PhononWidget::stateChanged); + connect(m_media, &Phonon::MediaObject::finished, this, &PhononWidget::finished); m_seekSlider->setMediaObject(m_media); } @@ -237,7 +221,7 @@ void PhononWidget::play() } if (m_isVideo) { - emit hasVideoChanged(true); + Q_EMIT hasVideoChanged(true); } if (m_url != m_media->currentSource().url()) { @@ -252,7 +236,7 @@ void PhononWidget::finished() { if (m_isVideo) { m_videoPlayer->hide(); - emit hasVideoChanged(false); + Q_EMIT hasVideoChanged(false); } } @@ -266,7 +250,7 @@ void PhononWidget::stop() if (m_media) { m_media->stop(); m_videoPlayer->hide(); - emit hasVideoChanged(false); + Q_EMIT hasVideoChanged(false); } } @@ -277,4 +261,5 @@ void PhononWidget::applyVideoSize() } } +#include "moc_phononwidget.cpp" #include "phononwidget.moc"