blob: 90a43f2bac0e5abefb5db9bbf6fdbd4e28e180e3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
|
/*!
* \file mgmedia.h
* \brief Top level access to media in vdr plugin muggle
*
* \version $Revision: 1.11 $
* \date $Date$
* \author Ralf Klueber, Lars von Wedel, Andreas Kellner
* \author Responsible author: $Author$
*/
// makes sure we dont use parse the same declarations twice
#ifndef _MG_MEDIA_H
#define _MG_MEDIA_H
#include <string>
#include <vector>
#include <mysql/mysql.h>
class mgPlaylist;
class mgTracklist;
class mgSelectionTreeNode;
class mgFilter;
class mgFilterSets;
/*!
* \class mgFilterSets
*
* Represents one or several sets of filters to set and memorize search constraint
*/
class mgFilterSets
{
protected:
int m_activeSetId;
std::vector<mgFilter*> *m_activeSet; // pointer to the active filter set
// stores name-value pairs, even if a different set is active
std::vector< std::vector<mgFilter*>*> m_sets;
// stores the titles for all filters
std::vector<std::string> m_titles;
public:
/*!
* \brief a constructor
*
* constracts a number >=1 of filter sets the first set (index 0 ) is active by default
*/
mgFilterSets();
/*!
* \brief the destructor
*/
virtual ~mgFilterSets();
/*!
* \brief returns the number of available sets
*/
int numSets();
/*!
* \brief proceeds to the next one in a circular fashion
*/
void nextSet();
/*!
* \brief activates a specific set by index
*/
void select(int n);
/*!
* \brief restore empty state
*
* Restores the default values for all filter values in the active set
* normally, the default values represent 'no restrictions'
*/
virtual void clear();
/*!
* \brief stores the current filter values
*/
void accept();
/*!
* \brief returns the active set to the application
*
* The application may temporarily modify the filter values
* accept() needs to be called to memorize the changed values
*/
std::vector<mgFilter*> *getFilters();
/*!
* \brief compute restrictions
*
* computes the (e.g. sql-) restrictions specified by the active filter set
* and returns the index of the appropriate defualt view in viewPrt
*/
virtual std::string computeRestriction(int *viewPrt) = 0;
/*!
* \brief returns title of active filter set
*/
std::string getTitle();
};
/*!
* \class mgMedia
*
* \brief main class to access content in the vdr plugin muggle
*
* The constructor of this class should be the only point in the plugin,
* where the data type is explicitelymentioned.
* The class provides a set of objects that abstract from the data
* type and source
*/
class mgMedia
{
public:
typedef enum contentType
{
GD_MP3
} contentType;
private:
MYSQL m_db;
contentType m_mediatype;
std::string m_sql_filter;
int m_defaultView;
mgFilterSets *m_filters;
public:
mgMedia(contentType mediatype);
~mgMedia();
std::string getMediaTypeName();
mgSelectionTreeNode* getSelectionRoot();
/*! \brief playlist management */
//@{
mgPlaylist* createTemporaryPlaylist();
mgPlaylist* loadPlaylist( std::string name );
std::vector<std::string> *getStoredPlaylists();
//@}
std::vector<int> getDefaultCols();
mgTracklist* getTracks();
// filter management
void initFilterSet(int num=0);
// creates FiliterSetObject for the selected media type
// and activates set n (if available)
std::vector<mgFilter*> *getActiveFilters();
// returns pointer to the activen filter set to be modified by the osd
// Note: Modifications become only active by calling applyActiveFilter()
std::string getActiveFilterTitle();
void nextFilterSet();
// proceeds to the next filter set in a cirlucar fashion
void clearActiveFilter();
// clears the current filter values and restores defaults
mgSelectionTreeNode *applyActiveFilter();
// Applies the active filter set and returns a root node for the
// selection in the default view for this filter set
};
/* -------------------- begin CVS log ---------------------------------
* $Log: mg_media.h,v $
* Revision 1.11 2004/05/28 15:29:18 lvw
* Merged player branch back on HEAD branch.
*
* Revision 1.10 2004/02/12 09:15:07 LarsAC
* Moved filter classes into separate files
*
* Revision 1.9.2.2 2004/05/25 00:10:45 lvw
* Code cleanup and added use of real database source files
*
* Revision 1.9.2.1 2004/03/02 07:05:50 lvw
* Initial adaptations from MP3 plugin added (untested)
*
* Revision 1.10 2004/02/12 09:15:07 LarsAC
* Moved filter classes into separate files
*
* Revision 1.9 2004/02/09 22:07:44 RaK
* secound filter set (album search incl. special view #101
*
* Revision 1.8 2004/02/09 19:27:52 MountainMan
* filter set implemented
*
* Revision 1.7 2004/02/02 23:33:41 MountainMan
* impementation of gdTrackFilters
*
* Revision 1.6 2004/02/02 22:48:04 MountainMan
* added CVS $Log
*
*
* --------------------- end CVS log ----------------------------------
*/
#endif /* END _MG_MEDIA_H */
|