kmediaplayer: drop the part

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2024-05-17 12:49:48 +03:00
parent 77adca3615
commit 6ed48d922c
4 changed files with 0 additions and 158 deletions

View file

@ -12,37 +12,17 @@ target_link_libraries(kmediaplayer
KDE4::solid KDE4::solid
) )
# part
kde4_add_plugin(kmediaplayerpart kmediaplayerpart.cpp)
target_link_libraries(kmediaplayerpart
KDE4::kdecore
KDE4::kdeui
KDE4::kparts
KDE4::kmediaplayer
)
# install everything # install everything
install( install(
TARGETS kmediaplayer TARGETS kmediaplayer
DESTINATION ${KDE4_BIN_INSTALL_DIR} DESTINATION ${KDE4_BIN_INSTALL_DIR}
) )
install(
TARGETS kmediaplayerpart
DESTINATION ${KDE4_PLUGIN_INSTALL_DIR}
)
install( install(
PROGRAMS kmediaplayer.desktop PROGRAMS kmediaplayer.desktop
DESTINATION ${KDE4_XDG_APPS_INSTALL_DIR} DESTINATION ${KDE4_XDG_APPS_INSTALL_DIR}
) )
install(
PROGRAMS kmediaplayerpart.desktop
DESTINATION ${KDE4_SERVICES_INSTALL_DIR}
)
install( install(
FILES kmediaplayerui.rc FILES kmediaplayerui.rc
DESTINATION ${KDE4_DATA_INSTALL_DIR}/kmediaplayer DESTINATION ${KDE4_DATA_INSTALL_DIR}/kmediaplayer

View file

@ -1,85 +0,0 @@
/* This file is part of the KDE libraries
Copyright (C) 2016 Ivailo Monev <xakepa10@gmail.com>
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 <KAboutData>
#include <KLocale>
#include <KMessageBox>
#include <KPluginFactory>
#include <KDebug>
K_PLUGIN_FACTORY(KMediaPlayerPartFactory, registerPlugin<KMediaPlayerPart>();) // 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<QVariant> &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"

View file

@ -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;

View file

@ -1,44 +0,0 @@
/* This file is part of the KDE libraries
Copyright (C) 2016 Ivailo Monev <xakepa10@gmail.com>
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 <QPointer>
#include <KParts/Part>
#include <KMediaWidget>
#include <KUrl>
class KMediaPlayerPart : public KParts::ReadOnlyPart
{
Q_OBJECT
public:
KMediaPlayerPart(QWidget *parentWidget, QObject *parent, const QList<QVariant> &arguments);
~KMediaPlayerPart();
// reimplementations
bool openFile() final;
bool closeUrl() final;
public Q_SLOTS:
bool openUrl(const KUrl &url) final;
private:
QPointer<KMediaWidget> m_player;
};
#endif // KMEDIAPART_H