| 1 |
/**************************************************************************************** |
| 2 |
* Copyright (c) 2008 Nikolaj Hald Nielsen <nhn@kde.org> * |
| 3 |
* * |
| 4 |
* This program is free software; you can redistribute it and/or modify it under * |
| 5 |
* the terms of the GNU General Public License as published by the Free Software * |
| 6 |
* Foundation; either version 2 of the License, or (at your option) any later * |
| 7 |
* version. * |
| 8 |
* * |
| 9 |
* This program is distributed in the hope that it will be useful, but WITHOUT ANY * |
| 10 |
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * |
| 11 |
* PARTICULAR PURPOSE. See the GNU General Public License for more details. * |
| 12 |
* * |
| 13 |
* You should have received a copy of the GNU General Public License along with * |
| 14 |
* this program. If not, see <http://www.gnu.org/licenses/>. * |
| 15 |
****************************************************************************************/ |
| 16 |
|
| 17 |
#ifndef GLOBALCOLLECTIONACTIONS_H |
| 18 |
#define GLOBALCOLLECTIONACTIONS_H |
| 19 |
|
| 20 |
#include "amarok_export.h" |
| 21 |
#include "core/meta/Meta.h" |
| 22 |
#include "core/support/SmartPointerList.h" |
| 23 |
|
| 24 |
#include <QAction> |
| 25 |
|
| 26 |
|
| 27 |
class AMAROK_EXPORT GlobalCollectionAction : public QAction |
| 28 |
{ |
| 29 |
public: |
| 30 |
GlobalCollectionAction( const QString &text, QObject * parent ); |
| 31 |
}; |
| 32 |
|
| 33 |
|
| 34 |
class AMAROK_EXPORT GlobalCollectionGenreAction : public GlobalCollectionAction |
| 35 |
{ |
| 36 |
public: |
| 37 |
|
| 38 |
GlobalCollectionGenreAction( const QString &text, QObject * parent ); |
| 39 |
void setGenre( Meta::GenrePtr genre ); |
| 40 |
|
| 41 |
protected: |
| 42 |
Meta::GenrePtr genre(); |
| 43 |
|
| 44 |
private: |
| 45 |
Meta::GenrePtr m_currentGenre; |
| 46 |
}; |
| 47 |
|
| 48 |
|
| 49 |
class AMAROK_EXPORT GlobalCollectionArtistAction : public GlobalCollectionAction |
| 50 |
{ |
| 51 |
public: |
| 52 |
|
| 53 |
GlobalCollectionArtistAction( const QString &text, QObject * parent ); |
| 54 |
void setArtist( Meta::ArtistPtr artist ); |
| 55 |
|
| 56 |
protected: |
| 57 |
Meta::ArtistPtr artist(); |
| 58 |
|
| 59 |
private: |
| 60 |
Meta::ArtistPtr m_currentArtist; |
| 61 |
}; |
| 62 |
|
| 63 |
|
| 64 |
class AMAROK_EXPORT GlobalCollectionAlbumAction : public GlobalCollectionAction |
| 65 |
{ |
| 66 |
public: |
| 67 |
|
| 68 |
GlobalCollectionAlbumAction( const QString &text, QObject * parent ); |
| 69 |
void setAlbum( Meta::AlbumPtr album ); |
| 70 |
|
| 71 |
protected: |
| 72 |
Meta::AlbumPtr album(); |
| 73 |
|
| 74 |
private: |
| 75 |
Meta::AlbumPtr m_currentAlbum; |
| 76 |
}; |
| 77 |
|
| 78 |
|
| 79 |
class AMAROK_EXPORT GlobalCollectionTrackAction : public GlobalCollectionAction |
| 80 |
{ |
| 81 |
public: |
| 82 |
|
| 83 |
GlobalCollectionTrackAction( const QString &text, QObject * parent ); |
| 84 |
void setTrack( Meta::TrackPtr track ); |
| 85 |
|
| 86 |
protected: |
| 87 |
Meta::TrackPtr track(); |
| 88 |
|
| 89 |
private: |
| 90 |
Meta::TrackPtr m_currentTrack; |
| 91 |
|
| 92 |
}; |
| 93 |
|
| 94 |
class AMAROK_EXPORT GlobalCollectionYearAction : public GlobalCollectionAction |
| 95 |
{ |
| 96 |
public: |
| 97 |
|
| 98 |
GlobalCollectionYearAction( const QString &text, QObject * parent ); |
| 99 |
void setYear( Meta::YearPtr year ); |
| 100 |
|
| 101 |
protected: |
| 102 |
Meta::YearPtr year(); |
| 103 |
|
| 104 |
private: |
| 105 |
Meta::YearPtr m_currentYear; |
| 106 |
|
| 107 |
}; |
| 108 |
|
| 109 |
class GlobalCollectionComposerAction : public GlobalCollectionAction |
| 110 |
{ |
| 111 |
public: |
| 112 |
|
| 113 |
GlobalCollectionComposerAction( const QString &text, QObject * parent ); |
| 114 |
void setComposer( Meta::ComposerPtr composer ); |
| 115 |
|
| 116 |
protected: |
| 117 |
Meta::ComposerPtr composer(); |
| 118 |
|
| 119 |
private: |
| 120 |
Meta::ComposerPtr m_currentComposer; |
| 121 |
}; |
| 122 |
|
| 123 |
|
| 124 |
class GlobalCollectionActions; |
| 125 |
|
| 126 |
namespace The { |
| 127 |
AMAROK_EXPORT GlobalCollectionActions* globalCollectionActions(); |
| 128 |
} |
| 129 |
|
| 130 |
/** |
| 131 |
This class keeps track of global context actions that should be added to all genre, artists or another meta type in all collections. |
| 132 |
*/ |
| 133 |
class AMAROK_EXPORT GlobalCollectionActions |
| 134 |
{ |
| 135 |
friend GlobalCollectionActions* The::globalCollectionActions(); |
| 136 |
|
| 137 |
public: |
| 138 |
QList<QAction *> actionsFor( Meta::DataPtr item ); |
| 139 |
|
| 140 |
void addGenreAction( GlobalCollectionGenreAction * action ); |
| 141 |
void addArtistAction( GlobalCollectionArtistAction * action ); |
| 142 |
void addAlbumAction( GlobalCollectionAlbumAction * action ); |
| 143 |
void addTrackAction( GlobalCollectionTrackAction * action ); |
| 144 |
void addYearAction( GlobalCollectionYearAction * action ); |
| 145 |
void addComposerAction( GlobalCollectionComposerAction * action ); |
| 146 |
|
| 147 |
private: |
| 148 |
GlobalCollectionActions(); |
| 149 |
~GlobalCollectionActions(); |
| 150 |
|
| 151 |
QList<QAction *> actionsFor( Meta::GenrePtr genre ); |
| 152 |
QList<QAction *> actionsFor( Meta::ArtistPtr artist ); |
| 153 |
QList<QAction *> actionsFor( Meta::AlbumPtr album ); |
| 154 |
QList<QAction *> actionsFor( Meta::TrackPtr track ); |
| 155 |
QList<QAction *> actionsFor( Meta::YearPtr year ); |
| 156 |
QList<QAction *> actionsFor( Meta::ComposerPtr composer ); |
| 157 |
|
| 158 |
SmartPointerList<GlobalCollectionGenreAction> m_genreActions; |
| 159 |
SmartPointerList<GlobalCollectionArtistAction> m_artistActions; |
| 160 |
SmartPointerList<GlobalCollectionAlbumAction> m_albumActions; |
| 161 |
SmartPointerList<GlobalCollectionTrackAction> m_trackActions; |
| 162 |
SmartPointerList<GlobalCollectionYearAction> m_yearActions; |
| 163 |
SmartPointerList<GlobalCollectionComposerAction> m_composerActions; |
| 164 |
}; |
| 165 |
|
| 166 |
#endif |