File indexing completed on 2024-05-19 04:49:28
0001 /**************************************************************************************** 0002 * Copyright (c) 2007 Maximilian Kossick <maximilian.kossick@googlemail.com> * 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 COLLECTION_METAQUERYMAKER_H 0018 #define COLLECTION_METAQUERYMAKER_H 0019 0020 #include "core/collections/QueryMaker.h" 0021 #include "core/collections/Collection.h" 0022 0023 #include <QList> 0024 #include <QMutex> 0025 0026 namespace Collections { 0027 0028 class AMAROKCORE_EXPORT MetaQueryMaker : public QueryMaker 0029 { 0030 Q_OBJECT 0031 0032 public: 0033 explicit MetaQueryMaker( const QList<Collections::Collection*> &collections ); 0034 explicit MetaQueryMaker( const QList<QueryMaker*> &queryMakers ); 0035 ~MetaQueryMaker() override; 0036 0037 void run() override; 0038 void abortQuery() override; 0039 0040 QueryMaker* setQueryType( QueryType type ) override; 0041 0042 QueryMaker* addReturnValue( qint64 value) override; 0043 QueryMaker* addReturnFunction( ReturnFunction function, qint64 value ) override; 0044 QueryMaker* orderBy( qint64 value, bool descending = false ) override; 0045 0046 QueryMaker* addMatch( const Meta::TrackPtr &track ) override; 0047 QueryMaker* addMatch( const Meta::ArtistPtr &artist, ArtistMatchBehaviour behaviour = TrackArtists ) override; 0048 QueryMaker* addMatch( const Meta::AlbumPtr &album ) override; 0049 QueryMaker* addMatch( const Meta::ComposerPtr &composer ) override; 0050 QueryMaker* addMatch( const Meta::GenrePtr &genre ) override; 0051 QueryMaker* addMatch( const Meta::YearPtr &year ) override; 0052 QueryMaker* addMatch( const Meta::LabelPtr &label ) override; 0053 0054 QueryMaker* addFilter( qint64 value, const QString &filter, bool matchBegin, bool matchEnd ) override; 0055 QueryMaker* excludeFilter( qint64 value, const QString &filter, bool matchBegin, bool matchEnd ) override; 0056 0057 QueryMaker* addNumberFilter( qint64 value, qint64 filter, QueryMaker::NumberComparison compare ) override; 0058 QueryMaker* excludeNumberFilter( qint64 value, qint64 filter, QueryMaker::NumberComparison compare ) override; 0059 0060 QueryMaker* limitMaxResultSize( int size ) override; 0061 0062 QueryMaker* beginAnd() override; 0063 QueryMaker* beginOr() override; 0064 QueryMaker* endAndOr() override; 0065 0066 QueryMaker* setAlbumQueryMode( AlbumQueryMode mode ) override; 0067 QueryMaker* setLabelQueryMode( LabelQueryMode mode ) override; 0068 0069 private Q_SLOTS: 0070 void slotQueryDone(); 0071 0072 private: 0073 QList<QueryMaker*> builders; 0074 int m_queryDoneCount; 0075 QMutex m_queryDoneCountMutex; 0076 0077 }; 0078 0079 } //namespace Collections 0080 0081 #endif /* COLLECTION_METAQUERYMAKER_H */