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