File indexing completed on 2025-01-19 04:24:25

0001 /****************************************************************************************
0002  * Copyright (c) 2009 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 SQLQUERYMAKERINTERNAL_H
0018 #define SQLQUERYMAKERINTERNAL_H
0019 
0020 #include "core/collections/QueryMaker.h"
0021 #include "core/meta/forward_declarations.h"
0022 
0023 #include <QObject>
0024 #include <QPointer>
0025 #include <QString>
0026 
0027 namespace Collections {
0028 
0029 class SqlCollection;
0030 
0031 class SqlQueryMakerInternal : public QObject
0032 {
0033 Q_OBJECT
0034 public:
0035     explicit SqlQueryMakerInternal( SqlCollection *collection );
0036     ~ SqlQueryMakerInternal() override;
0037 
0038     void run();
0039     void setQuery( const QString &query );
0040     void setQueryType( QueryMaker::QueryType type );
0041     void setResultAsDataPtrs( bool value );
0042 
0043 Q_SIGNALS:
0044     void newTracksReady( const Meta::TrackList& );
0045     void newArtistsReady( const Meta::ArtistList& );
0046     void newAlbumsReady( const Meta::AlbumList& );
0047     void newGenresReady( const Meta::GenreList& );
0048     void newComposersReady( const Meta::ComposerList& );
0049     void newYearsReady( const Meta::YearList& );
0050     void newResultReady( const QStringList& );
0051     void newLabelsReady( const Meta::LabelList& );
0052 
0053 private:
0054     void handleResult( const QStringList &result );
0055     void handleTracks( const QStringList &result );
0056     void handleArtists( const QStringList &result );
0057     void handleAlbums( const QStringList &result );
0058     void handleGenres( const QStringList &result );
0059     void handleComposers( const QStringList &result );
0060     void handleYears( const QStringList &result );
0061     void handleLabels( const QStringList &result );
0062 
0063 private:
0064     QPointer<SqlCollection> m_collection;
0065     QueryMaker::QueryType m_queryType;
0066     QString m_query;
0067 
0068 };
0069 
0070 } //namespace Collections
0071 
0072 #endif // SQLQUERYMAKERINTERNAL_H