diff --git a/src/mpris2/mediaplayer2.cpp b/src/mpris2/mediaplayer2.cpp index 13dbdcab..20687137 100644 --- a/src/mpris2/mediaplayer2.cpp +++ b/src/mpris2/mediaplayer2.cpp @@ -1,89 +1,97 @@ /*************************************************************************** * Copyright 2014 Sujith Haridasan * * Copyright 2014 Ashish Madeti * * Copyright 2016 Matthieu Gallien * * * * 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 3 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 . * ***************************************************************************/ #include "mediaplayer2.h" #include +#include "config-upnp-qt.h" + +#if defined KF5CoreAddons_FOUND && KF5CoreAddons_FOUND +#include +#endif + MediaPlayer2::MediaPlayer2(QObject* parent) : QDBusAbstractAdaptor(parent) { } MediaPlayer2::~MediaPlayer2() { } bool MediaPlayer2::CanQuit() const { return true; } bool MediaPlayer2::CanRaise() const { return true; } bool MediaPlayer2::HasTrackList() const { return false; } void MediaPlayer2::Quit() const { QCoreApplication::quit(); } void MediaPlayer2::Raise() const { emit raisePlayer(); } QString MediaPlayer2::Identity() const { - return QString(); //KCmdLineArgs::aboutData()->programName(); +#if defined KF5CoreAddons_FOUND && KF5CoreAddons_FOUND + return KAboutData::applicationData().displayName(); +#else + return QString(); +#endif } QString MediaPlayer2::DesktopEntry() const { -// KService::Ptr app = KService::serviceByDesktopName(KCmdLineArgs::aboutData()->appName()); - -// if (app) { -// return app->desktopEntryName(); -// } - +#if defined KF5CoreAddons_FOUND && KF5CoreAddons_FOUND + return KAboutData::applicationData().desktopFileName(); +#else return QString(); +#endif } QStringList MediaPlayer2::SupportedUriSchemes() const { return QStringList() << QStringLiteral("file"); } QStringList MediaPlayer2::SupportedMimeTypes() const { // KService::Ptr app = KService::serviceByDesktopName(KCmdLineArgs::aboutData()->appName()); // if (app) { // return app->mimeTypes(); // } return QStringList(); } diff --git a/src/upnpControl.cpp b/src/upnpControl.cpp index 258d835a..a6ab82e7 100644 --- a/src/upnpControl.cpp +++ b/src/upnpControl.cpp @@ -1,187 +1,187 @@ /* * Copyright 2015-2017 Matthieu Gallien * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 3 of the License, or (at your option) any later version. * * 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 "config-upnp-qt.h" //#define QT_QML_DEBUG #if defined UPNPQT_FOUND && UPNPQT_FOUND #include "upnp/upnpcontrolconnectionmanager.h" #include "upnp/upnpcontrolmediaserver.h" #include "upnp/upnpcontrolcontentdirectory.h" #include "upnp/upnpcontentdirectorymodel.h" #include "upnpdevicedescription.h" #include "upnp/didlparser.h" #include "upnp/upnpdiscoverallmusic.h" #include "upnpssdpengine.h" #include "upnpabstractservice.h" #include "upnpcontrolabstractdevice.h" #include "upnpcontrolabstractservice.h" #include "upnpbasictypes.h" #endif #include "progressindicator.h" #include "mediaplaylist.h" #include "playlistcontroler.h" #include "managemediaplayercontrol.h" #include "manageheaderbar.h" #include "manageaudioplayer.h" #include "musicstatistics.h" #include "allalbumsmodel.h" #include "albummodel.h" #include "allartistsmodel.h" #include "musicaudiotrack.h" #include "musiclistenersmanager.h" #include "albumfilterproxymodel.h" #include "elisaapplication.h" #if defined Qt5DBus_FOUND && Qt5DBus_FOUND #include "mpris2/mpris2.h" #include "mpris2/mediaplayer2player.h" #endif #if defined KF5Declarative_FOUND && KF5Declarative_FOUND #include #endif #include #include #if defined KF5CoreAddons_FOUND && KF5CoreAddons_FOUND #include #endif #include #include #include #include #include #include #include #include #include #include int __attribute__((visibility("default"))) main(int argc, char *argv[]) { QApplication app(argc, argv); QApplication::setWindowIcon(QIcon::fromTheme(QStringLiteral("new-audio-alarm"))); KLocalizedString::setApplicationDomain("elisa"); #if defined UPNPQT_FOUND && UPNPQT_FOUND qmlRegisterType("org.mgallien.QmlExtension", 1, 0, "UpnpSsdpEngine"); qmlRegisterType("org.mgallien.QmlExtension", 1, 0, "UpnpDiscoverAllMusic"); qmlRegisterType("org.mgallien.QmlExtension", 1, 0, "UpnpAbstractDevice"); qmlRegisterType("org.mgallien.QmlExtension", 1, 0, "UpnpAbstractService"); qmlRegisterType("org.mgallien.QmlExtension", 1, 0, "UpnpControlAbstractDevice"); qmlRegisterType("org.mgallien.QmlExtension", 1, 0, "UpnpControlAbstractService"); qmlRegisterType("org.mgallien.QmlExtension", 1, 0, "UpnpControlConnectionManager"); qmlRegisterType("org.mgallien.QmlExtension", 1, 0, "UpnpControlMediaServer"); qmlRegisterType("org.mgallien.QmlExtension", 1, 0, "UpnpContentDirectoryModel"); qmlRegisterType("org.mgallien.QmlExtension", 1, 0, "DidlParser"); qmlRegisterType("org.mgallien.QmlExtension", 1, 0, "UpnpControlContentDirectory"); qmlRegisterType("org.mgallien.QmlExtension", 1, 0, "UpnpDeviceDescription"); qRegisterMetaType(); qRegisterMetaType >(); qRegisterMetaType(); qRegisterMetaType(); qRegisterMetaType(); #endif qmlRegisterType("org.mgallien.QmlExtension", 1, 0, "MediaPlayList"); qmlRegisterType("org.mgallien.QmlExtension", 1, 0, "PlayListControler"); qmlRegisterType("org.mgallien.QmlExtension", 1, 0, "ManageMediaPlayerControl"); qmlRegisterType("org.mgallien.QmlExtension", 1, 0, "ManageHeaderBar"); qmlRegisterType("org.mgallien.QmlExtension", 1, 0, "ManageAudioPlayer"); qmlRegisterType("org.mgallien.QmlExtension", 1, 0, "MusicStatistics"); qmlRegisterType("org.mgallien.QmlExtension", 1, 0, "ProgressIndicator"); qmlRegisterType("org.mgallien.QmlExtension", 1, 0, "AllAlbumsModel"); qmlRegisterType("org.mgallien.QmlExtension", 1, 0, "AllArtistsModel"); qmlRegisterType("org.mgallien.QmlExtension", 1, 0, "AlbumModel"); qmlRegisterType("org.mgallien.QmlExtension", 1, 0, "MusicListenersManager"); qmlRegisterType("org.mgallien.QmlExtension", 1, 0, "SortFilterProxyModel"); qmlRegisterType("org.mgallien.QmlExtension", 1, 0, "AlbumFilterProxyModel"); #if defined Qt5DBus_FOUND && Qt5DBus_FOUND qmlRegisterType("org.mgallien.QmlExtension", 1, 0, "Mpris2"); qRegisterMetaType(); #endif qRegisterMetaType(); qRegisterMetaType>("QHash"); qRegisterMetaType>>("QHash>"); qRegisterMetaType>("QVector"); qRegisterMetaType>("QHash"); qRegisterMetaType("MusicAlbum"); qRegisterMetaType("MusicArtist"); qRegisterMetaType(); qmlRegisterUncreatableType("org.mgallien.QmlExtension", 1, 0, "ElisaApplication", QStringLiteral("only one and done in c++")); qRegisterMetaTypeStreamOperators("PlayListControler::PlayerState"); KLocalizedString::setApplicationDomain("elisa"); ElisaApplication myApp; //QQmlDebuggingEnabler enabler; #if defined KF5CoreAddons_FOUND && KF5CoreAddons_FOUND - KAboutData aboutData( QStringLiteral("Elisa"), + KAboutData aboutData( QStringLiteral("elisa"), i18n("Elisa"), QStringLiteral("0.1"), i18n("A Simple Music Player written with KDE Frameworks"), KAboutLicense::LGPL_V3, i18n("(c) 2015-2017, Matthieu Gallien ")); aboutData.addAuthor(i18n("Matthieu Gallien"),i18n("Author"), QStringLiteral("mgallien@mgallien.fr")); KAboutData::setApplicationData(aboutData); QCommandLineParser parser; parser.addHelpOption(); parser.addVersionOption(); aboutData.setupCommandLine(&parser); parser.process(app); aboutData.processCommandLine(&parser); #endif QQmlApplicationEngine engine; engine.addImportPath(QStringLiteral("qrc:/imports")); QQmlFileSelector selector(&engine); #if defined KF5Declarative_FOUND && KF5Declarative_FOUND KDeclarative::KDeclarative decl; decl.setDeclarativeEngine(&engine); decl.setupBindings(); #endif engine.rootContext()->setContextObject(new KLocalizedContext(&engine)); engine.rootContext()->setContextProperty(QStringLiteral("elisa"), &myApp); engine.load(QUrl(QStringLiteral("qrc:/MediaServer.qml"))); return app.exec(); }