File indexing completed on 2024-05-05 04:48:23

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 DBUSQUERYHELPER_H
0018 #define DBUSQUERYHELPER_H
0019 
0020 #include "core/meta/forward_declarations.h"
0021 
0022 #include <QDBusConnection>
0023 #include <QDBusMessage>
0024 #include <QList>
0025 #include <QMap>
0026 #include <QObject>
0027 #include <QString>
0028 #include <QVariant>
0029 
0030 namespace Collections {
0031     class QueryMaker;
0032 }
0033 
0034 typedef QList<QVariantMap> VariantMapList;
0035 
0036 class DBusQueryHelper : public QObject
0037 {
0038     Q_OBJECT
0039     
0040     public:
0041         DBusQueryHelper( QObject *parent, Collections::QueryMaker *qm, const QDBusConnection &conn, const QDBusMessage &msg, bool mprisCompatible );
0042         
0043     private Q_SLOTS:
0044         void slotResultReady( const Meta::TrackList &tracks );
0045 
0046         void slotQueryDone();
0047 
0048         void abortQuery();
0049         
0050     private:
0051         QDBusConnection m_connection;
0052         QDBusMessage m_message;
0053         VariantMapList m_result;
0054         bool m_mprisCompatibleResult;
0055         bool m_timeout;
0056 };
0057 
0058 #endif