File indexing completed on 2024-05-19 04:49:36
0001 /*********************************************************************** 0002 * Copyright 2010 Canonical Ltd 0003 * (author: Aurelien Gateau <aurelien.gateau@canonical.com>) 0004 * Copyright 2012 Eike Hein <hein@kde.org> 0005 * Copyright 2012 Alex Merry <alex.merry@kdemail.net> 0006 * 0007 * This program is free software; you can redistribute it and/or 0008 * modify it under the terms of the GNU General Public License as 0009 * published by the Free Software Foundation; either version 2 of 0010 * the License or (at your option) version 3 or any later version 0011 * accepted by the membership of KDE e.V. (or its successor approved 0012 * by the membership of KDE e.V.), which shall act as a proxy 0013 * defined in Section 14 of version 3 of the license. 0014 * 0015 * This program is distributed in the hope that it will be useful, 0016 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0018 * GNU General Public License for more details. 0019 * 0020 * You should have received a copy of the GNU General Public License 0021 * along with this program. If not, see <http://www.gnu.org/licenses/>. 0022 ***********************************************************************/ 0023 0024 #include "MediaPlayer2.h" 0025 0026 #include "App.h" 0027 #include "core/support/Debug.h" 0028 #include "EngineController.h" 0029 #include "MainWindow.h" 0030 0031 #include <QApplication> 0032 #include <QWidget> 0033 0034 #include <KAboutData> 0035 #include <KWindowSystem> 0036 0037 using namespace Amarok; 0038 0039 MediaPlayer2::MediaPlayer2(QObject* parent) 0040 : DBusAbstractAdaptor(parent) 0041 { 0042 } 0043 0044 MediaPlayer2::~MediaPlayer2() 0045 { 0046 } 0047 0048 bool MediaPlayer2::CanRaise() const 0049 { 0050 return true; 0051 } 0052 0053 void MediaPlayer2::Raise() const 0054 { 0055 MainWindow *window = pApp->mainWindow(); 0056 if( !window ) 0057 { 0058 warning() << "No window!"; 0059 return; 0060 } 0061 window->show(); 0062 KWindowSystem::forceActiveWindow( window->winId() ); 0063 } 0064 0065 bool MediaPlayer2::CanQuit() const 0066 { 0067 return true; 0068 } 0069 0070 void MediaPlayer2::Quit() const 0071 { 0072 pApp->quit(); 0073 } 0074 0075 bool MediaPlayer2::CanSetFullscreen() const 0076 { 0077 return false; 0078 } 0079 0080 bool MediaPlayer2::Fullscreen() const 0081 { 0082 return false; 0083 } 0084 0085 bool MediaPlayer2::HasTrackList() const 0086 { 0087 return false; 0088 } 0089 0090 QString MediaPlayer2::Identity() const 0091 { 0092 return pApp->applicationName(); 0093 } 0094 0095 QString MediaPlayer2::DesktopEntry() const 0096 { 0097 return QStringLiteral("org.kde.amarok"); 0098 } 0099 0100 QStringList MediaPlayer2::SupportedUriSchemes() const 0101 { 0102 return QStringList() << QStringLiteral("file") << QStringLiteral("http"); 0103 } 0104 0105 QStringList MediaPlayer2::SupportedMimeTypes() const 0106 { 0107 // FIXME: this is likely to change when 0108 // Phonon::BackendCapabilities::notifier()'s capabilitiesChanged signal 0109 // is emitted (and so a propertiesChanged D-Bus signal should be emitted) 0110 return The::engineController()->supportedMimeTypes(); 0111 } 0112