diff --git a/kmediaplayer/CMakeLists.txt b/kmediaplayer/CMakeLists.txt index 0111082c..e341dc3f 100644 --- a/kmediaplayer/CMakeLists.txt +++ b/kmediaplayer/CMakeLists.txt @@ -12,37 +12,17 @@ target_link_libraries(kmediaplayer KDE4::solid ) -# part -kde4_add_plugin(kmediaplayerpart kmediaplayerpart.cpp) - -target_link_libraries(kmediaplayerpart - KDE4::kdecore - KDE4::kdeui - KDE4::kparts - KDE4::kmediaplayer -) - # install everything install( TARGETS kmediaplayer DESTINATION ${KDE4_BIN_INSTALL_DIR} ) -install( - TARGETS kmediaplayerpart - DESTINATION ${KDE4_PLUGIN_INSTALL_DIR} -) - install( PROGRAMS kmediaplayer.desktop DESTINATION ${KDE4_XDG_APPS_INSTALL_DIR} ) -install( - PROGRAMS kmediaplayerpart.desktop - DESTINATION ${KDE4_SERVICES_INSTALL_DIR} -) - install( FILES kmediaplayerui.rc DESTINATION ${KDE4_DATA_INSTALL_DIR}/kmediaplayer diff --git a/kmediaplayer/kmediaplayerpart.cpp b/kmediaplayer/kmediaplayerpart.cpp deleted file mode 100644 index 13e04b1d..00000000 --- a/kmediaplayer/kmediaplayerpart.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/* This file is part of the KDE libraries - Copyright (C) 2016 Ivailo Monev - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License version 2, as published by the Free Software Foundation. - - 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "kmediaplayerpart.h" - -#include -#include -#include -#include -#include - -K_PLUGIN_FACTORY(KMediaPlayerPartFactory, registerPlugin();) // produce a factory -K_EXPORT_PLUGIN(KMediaPlayerPartFactory(KAboutData( - "kmediaplayerpart", - "kmediaplayer", - ki18n("KMediaPlayerPart"), - "1.1.0", - ki18n("Simple media player part for KDE."), - KAboutData::License_GPL_V2, - ki18n("(c) 2016 Ivailo Monev")). - setProgramIconName(QLatin1String("KMediaPlayerPart")))) - -KMediaPlayerPart::KMediaPlayerPart(QWidget *parentWidget, QObject *parent, const QList &arguments) - : KParts::ReadOnlyPart(parent) - , m_player(new KMediaWidget(parentWidget, KMediaWidget::SmoothVolume)) -{ - Q_UNUSED(arguments); - setObjectName(QString::fromLatin1("KMediaPlayerPart")); - setComponentData(KMediaPlayerPartFactory::componentData()); - setWidget(m_player); - setAutoDeleteWidget(false); // will be deleted in destructor, if still valid - m_player->player()->setPlayerID("kmediaplayerpart"); -} - -KMediaPlayerPart::~KMediaPlayerPart() -{ - if (m_player) { - delete m_player.data(); - } -} - -bool KMediaPlayerPart::openUrl(const KUrl &url) -{ - setUrl(url); - return openFile(); -} - -bool KMediaPlayerPart::openFile() -{ - const KUrl kurl = url(); - const QString kurlstring = kurl.prettyUrl(); - if (!kurl.isValid()) { - KMessageBox::error(widget(), i18n("The URL is not valid: %1", kurlstring)); - } else if (!m_player->player()->isProtocolSupported(kurl.protocol())) { - KMessageBox::error(widget(), i18n("The URL protocol is not valid: %1", kurl.protocol())); - } else { - m_player->open(kurlstring); - return true; - } - - return false; -} - -bool KMediaPlayerPart::closeUrl() -{ - m_player->player()->stop(); - return ReadOnlyPart::closeUrl(); -} - -#include "moc_kmediaplayerpart.cpp" diff --git a/kmediaplayer/kmediaplayerpart.desktop b/kmediaplayer/kmediaplayerpart.desktop deleted file mode 100644 index 3a0c9535..00000000 --- a/kmediaplayer/kmediaplayerpart.desktop +++ /dev/null @@ -1,9 +0,0 @@ -[Desktop Entry] -Icon=applications-multimedia -Name=KMediaPlayerPart -Comment=Simple media player part for KDE -X-KDE-ServiceTypes=KParts/ReadOnlyPart -X-KDE-Library=kmediaplayerpart -X-KDE-MediaPlayer=kmediaplayerpart -Type=Service -MimeType=application/ogg;application/x-ogg;application/sdp;application/smil;application/x-smil;application/streamingmedia;application/x-streamingmedia;application/vnd.rn-realmedia;application/vnd.rn-realmedia-vbr;audio/aac;audio/x-aac;audio/m4a;audio/x-m4a;audio/mp1;audio/x-mp1;audio/mp2;audio/x-mp2;audio/mp3;audio/x-mp3;audio/mpeg;audio/x-mpeg;audio/mpegurl;audio/x-mpegurl;audio/mpg;audio/x-mpg;audio/rn-mpeg;audio/ogg;audio/scpls;audio/x-scpls;audio/vnd.rn-realaudio;audio/wav;audio/x-pn-windows-pcm;audio/x-realaudio;audio/x-pn-realaudio;audio/x-ms-wma;audio/x-pls;audio/x-wav;video/mpeg;video/x-mpeg;video/x-mpeg2;video/mp4;video/msvideo;video/x-msvideo;video/ogg;video/quicktime;video/vnd.rn-realvideo;video/x-ms-afs;video/x-ms-asf;video/x-ms-wmv;video/x-ms-wmx;video/x-ms-wvxvideo;video/x-avi;video/x-fli;video/x-flv;video/x-theora;video/x-matroska;video/webm;audio/x-flac;audio/x-vorbis+ogg;video/x-ogm+ogg;audio/x-shorten;audio/x-ape;audio/x-wavpack;audio/x-tta;audio/AMR;audio/ac3;video/mp2t;audio/flac;audio/mp4; \ No newline at end of file diff --git a/kmediaplayer/kmediaplayerpart.h b/kmediaplayer/kmediaplayerpart.h deleted file mode 100644 index f1542717..00000000 --- a/kmediaplayer/kmediaplayerpart.h +++ /dev/null @@ -1,44 +0,0 @@ -/* This file is part of the KDE libraries - Copyright (C) 2016 Ivailo Monev - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License version 2, as published by the Free Software Foundation. - - 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#ifndef KMEDIAPART_H -#define KMEDIAPART_H - -#include -#include -#include -#include - -class KMediaPlayerPart : public KParts::ReadOnlyPart -{ - Q_OBJECT -public: - KMediaPlayerPart(QWidget *parentWidget, QObject *parent, const QList &arguments); - ~KMediaPlayerPart(); - - // reimplementations - bool openFile() final; - bool closeUrl() final; -public Q_SLOTS: - bool openUrl(const KUrl &url) final; - -private: - QPointer m_player; -}; - -#endif // KMEDIAPART_H