Revert previous commit, was incorrect
[amarok.git] / src / servicebrowser / DynamicServiceQueryMaker.h
blob0cc52b403826353afee7fc7a3e8e30d1c87d78df
1 /***************************************************************************
2 * Copyright (c) 2007 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 ***************************************************************************/
20 #ifndef DYNAMICSERVICEQUERYMAKER_H
21 #define DYNAMICSERVICEQUERYMAKER_H
23 #include "amarok_export.h"
24 #include "QueryMaker.h"
26 #include "Meta.h"
28 #include "servicecollection.h"
30 #include <kio/jobclasses.h>
32 namespace ThreadWeaver
34 class Job;
38 /**
39 A base class for implementing custom querymakers that fetch data from an external source.
40 Basically just stubs out the stuff that not every dynamic querymaker will need
42 @author
44 class AMAROK_EXPORT DynamicServiceQueryMaker : public QueryMaker
46 Q_OBJECT
47 public:
48 DynamicServiceQueryMaker( );
49 virtual ~DynamicServiceQueryMaker() {};
52 //this is the stuff that must be implmeneted
53 virtual QueryMaker* reset() = 0;
54 virtual void run() = 0;
55 virtual void abortQuery() = 0;
57 virtual QueryMaker* returnResultAsDataPtrs ( bool resultAsDataPtrs ) = 0;
60 //below here is the stuf that each dynamic querymaker will most likely only need
61 //Some of, hense they are all stubbed out:
63 virtual QueryMaker* startTrackQuery() { return this; }
64 virtual QueryMaker* startComposerQuery() { return this; }
65 virtual QueryMaker* startArtistQuery() { return this; }
66 virtual QueryMaker* startAlbumQuery() { return this; }
67 virtual QueryMaker* startGenreQuery() { return this; };
68 virtual QueryMaker* startYearQuery() { return this; }
69 virtual QueryMaker* startCustomQuery() { return this; }
71 virtual QueryMaker* addReturnValue ( qint64 value );
72 virtual QueryMaker* orderBy ( qint64 value, bool descending = false );
74 virtual QueryMaker* includeCollection ( const QString &collectionId );
75 virtual QueryMaker* excludeCollection ( const QString &collectionId );
78 virtual QueryMaker* addMatch ( const Meta::TrackPtr &track );
79 virtual QueryMaker* addMatch ( const Meta::ArtistPtr &artist );
80 virtual QueryMaker* addMatch ( const Meta::AlbumPtr &album );
81 virtual QueryMaker* addMatch ( const Meta::GenrePtr &genre );
82 virtual QueryMaker* addMatch ( const Meta::ComposerPtr &composer );
83 virtual QueryMaker* addMatch ( const Meta::YearPtr &year );
85 //this function must be reimplemented if the QueryMaker accepts any kind of qualifiers
86 virtual QueryMaker* addMatch ( const Meta::DataPtr &data );
88 virtual QueryMaker* addFilter ( qint64 value, const QString &filter, bool matchBegin, bool matchEnd );
89 virtual QueryMaker* excludeFilter ( qint64 value, const QString &filter, bool matchBegin, bool matchEnd );
91 virtual QueryMaker* limitMaxResultSize ( int size );
93 virtual QueryMaker* beginAnd() { return this; }
94 virtual QueryMaker* beginOr() { return this; }
95 virtual QueryMaker* endAndOr() { return this; }
100 #endif