File indexing completed on 2024-05-05 04:48:21
0001 /**************************************************************************************** 0002 * Copyright (c) 2008 Seb Ruiz <ruiz@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 #ifndef COVERFETCHINGACTIONS_H 0018 #define COVERFETCHINGACTIONS_H 0019 0020 #include "amarok_export.h" 0021 #include "core/meta/forward_declarations.h" 0022 0023 #include <QAction> 0024 0025 /** 0026 * This collection of actions handles fetching, displaying and removing of album art 0027 * 0028 * @author Seb Ruiz 0029 */ 0030 0031 class AMAROK_EXPORT BaseCoverAction : public QAction 0032 { 0033 Q_OBJECT 0034 public: 0035 BaseCoverAction( QObject *parent, const Meta::AlbumPtr &album ) 0036 : QAction( parent ) 0037 { 0038 m_albums.append( album ); 0039 connect( this, &QAction::triggered, this, &BaseCoverAction::slotTriggered ); 0040 } 0041 BaseCoverAction( QObject *parent, const Meta::AlbumList &albums ) 0042 : QAction( parent ) 0043 { 0044 m_albums = albums; 0045 connect( this, &QAction::triggered, this, &BaseCoverAction::slotTriggered ); 0046 } 0047 0048 protected Q_SLOTS: 0049 virtual void slotTriggered() = 0; 0050 protected: 0051 Meta::AlbumList m_albums; 0052 }; 0053 0054 class AMAROK_EXPORT FetchCoverAction : public BaseCoverAction 0055 { 0056 Q_OBJECT 0057 public: 0058 FetchCoverAction( QObject *parent, const Meta::AlbumPtr &album ) 0059 : BaseCoverAction( parent, album ) { init(); } 0060 FetchCoverAction( QObject *parent, const Meta::AlbumList &albums ) 0061 : BaseCoverAction( parent, albums ) { init(); } 0062 0063 protected Q_SLOTS: 0064 void slotTriggered() override; 0065 protected: 0066 virtual void init(); 0067 }; 0068 0069 class AMAROK_EXPORT DisplayCoverAction : public BaseCoverAction 0070 { 0071 Q_OBJECT 0072 public: 0073 DisplayCoverAction( QObject *parent, const Meta::AlbumPtr &album ) 0074 : BaseCoverAction( parent, album ) { init(); } 0075 DisplayCoverAction( QObject *parent, const Meta::AlbumList &albums ) 0076 : BaseCoverAction( parent, albums ) { init(); } 0077 0078 protected Q_SLOTS: 0079 void slotTriggered() override; 0080 protected: 0081 virtual void init(); 0082 }; 0083 0084 class AMAROK_EXPORT UnsetCoverAction : public BaseCoverAction 0085 { 0086 Q_OBJECT 0087 public: 0088 UnsetCoverAction( QObject *parent, const Meta::AlbumPtr &album ) 0089 : BaseCoverAction( parent, album ) { init(); } 0090 UnsetCoverAction( QObject *parent, const Meta::AlbumList &albums ) 0091 : BaseCoverAction( parent, albums ) { init(); } 0092 0093 protected Q_SLOTS: 0094 void slotTriggered() override; 0095 protected: 0096 virtual void init(); 0097 }; 0098 0099 class AMAROK_EXPORT SetCustomCoverAction : public BaseCoverAction 0100 { 0101 Q_OBJECT 0102 public: 0103 SetCustomCoverAction( QObject *parent, const Meta::AlbumPtr &album ) 0104 : BaseCoverAction( parent, album ) { init(); } 0105 SetCustomCoverAction( QObject *parent, const Meta::AlbumList &albums ) 0106 : BaseCoverAction( parent, albums ) { init(); } 0107 0108 protected Q_SLOTS: 0109 void slotTriggered() override; 0110 protected: 0111 virtual void init(); 0112 }; 0113 0114 #endif