File indexing completed on 2024-05-05 04:49:16

0001 /****************************************************************************************
0002  * Copyright (c) 2010 Nikolaj Hald Nielsen <nhn@kde.org>                                *
0003  *                                                                                      *
0004  * This program is free software; you can redistribute it and/or modify it under        *
0005  * the terms of the GNU General Public License as published by the Free Software        *
0006  * Foundation; either version 2 of the License, or (at your option) any later           *
0007  * version.                                                                             *
0008  *                                                                                      *
0009  * This program is distributed in the hope that it will be useful, but WITHOUT ANY      *
0010  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A      *
0011  * PARTICULAR PURPOSE. See the GNU General Public License for more details.             *
0012  *                                                                                      *
0013  * You should have received a copy of the GNU General Public License along with         *
0014  * this program.  If not, see <http://www.gnu.org/licenses/>.                           *
0015  ****************************************************************************************/
0016 
0017 
0018 #ifndef SERVICECAPABILITIES_H
0019 #define SERVICECAPABILITIES_H
0020 
0021 
0022 #include "amarok_export.h"
0023 #include "amarokurls/AmarokUrl.h"
0024 
0025 #include "core/capabilities/BookmarkThisCapability.h"
0026 #include "core/capabilities/ActionsCapability.h"
0027 #include "core/capabilities/FindInSourceCapability.h"
0028 #include "core/capabilities/SourceInfoCapability.h"
0029 
0030 
0031 class BookmarkThisProvider;
0032 class ActionsProvider;
0033 class SourceInfoProvider;
0034 
0035 namespace Meta
0036 {
0037     class ServiceTrack;
0038 }
0039 
0040 
0041 /**
0042 A service specific implementation of the BookmarkThisCapability
0043 
0044     @author Nikolaj Hald Nielsen <nhn@kde.org>
0045 */
0046 class AMAROK_EXPORT ServiceBookmarkThisCapability : public Capabilities::BookmarkThisCapability {
0047 public:
0048     explicit ServiceBookmarkThisCapability( BookmarkThisProvider * provider );
0049 
0050     ~ServiceBookmarkThisCapability() override;
0051 
0052     bool isBookmarkable() override;
0053     QString browserName() override;
0054     QString collectionName() override;
0055     bool simpleFiltering() override;
0056     QAction * bookmarkAction() const override;
0057 
0058 private:
0059 
0060     BookmarkThisProvider * m_provider;
0061 };
0062 
0063 
0064 class AMAROK_EXPORT ServiceActionsCapability : public Capabilities::ActionsCapability
0065 {
0066     Q_OBJECT
0067 
0068     public:
0069         explicit ServiceActionsCapability( ActionsProvider * actionsProvider  );
0070         ~ServiceActionsCapability() override;
0071         QList< QAction * > actions() const override;
0072 
0073     private:
0074         ActionsProvider * m_actionsProvider;
0075 };
0076 
0077 
0078 
0079 class AMAROK_EXPORT ServiceSourceInfoCapability : public Capabilities::SourceInfoCapability
0080 {
0081 public:
0082     explicit ServiceSourceInfoCapability( SourceInfoProvider * sourceInfoProvider );
0083 
0084     ~ServiceSourceInfoCapability() override;
0085 
0086     QString sourceName() override;
0087     QString sourceDescription() override;
0088     QPixmap emblem() override;
0089     QString scalableEmblem() override;
0090 
0091 private:
0092     SourceInfoProvider * m_sourceInfoProvider;
0093 
0094 };
0095 
0096 
0097 
0098 class AMAROK_EXPORT ServiceFindInSourceCapability : public Capabilities::FindInSourceCapability
0099 {
0100     Q_OBJECT
0101     public:
0102         explicit ServiceFindInSourceCapability( Meta::ServiceTrack *track );
0103         void findInSource( QFlags<TargetTag> tag ) override;
0104 
0105     private:
0106         Meta::ServiceTrack * m_track;
0107 };
0108 
0109 
0110 
0111 #endif // SERVICECAPABILITIES_H