File indexing completed on 2024-05-05 04:48:36
0001 /**************************************************************************************** 0002 * Copyright (c) 2010 Sergey Ivanov <123kash@gmail.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 MUSICDNSXMLPARSER_H 0018 #define MUSICDNSXMLPARSER_H 0019 0020 #include <QDomDocument> 0021 #include <QStringList> 0022 0023 #include <ThreadWeaver/Job> 0024 0025 class MusicDNSXmlParser : public QObject, public ThreadWeaver::Job 0026 { 0027 Q_OBJECT 0028 public: 0029 explicit MusicDNSXmlParser(QString &doc ); 0030 void run(ThreadWeaver::JobPointer self = QSharedPointer<ThreadWeaver::Job>(), ThreadWeaver::Thread *thread = nullptr) override; 0031 QStringList puid(); 0032 0033 private: 0034 void parseElement( const QDomElement &e ); 0035 void parseChildren( const QDomElement &e ); 0036 0037 void parseTrack( const QDomElement &e ); 0038 0039 void parsePUIDList( const QDomElement &e ); 0040 void parsePUID( const QDomElement &e ); 0041 0042 QDomDocument m_doc; 0043 QStringList m_puid; 0044 0045 Q_SIGNALS: 0046 /** This signal is emitted when this job is being processed by a thread. */ 0047 void started(ThreadWeaver::JobPointer); 0048 /** This signal is emitted when the job has been finished (no matter if it succeeded or not). */ 0049 void done(ThreadWeaver::JobPointer); 0050 /** This job has failed. 0051 * This signal is emitted when success() returns false after the job is executed. */ 0052 void failed(ThreadWeaver::JobPointer); 0053 0054 protected: 0055 void defaultBegin(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) override; 0056 void defaultEnd(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) override; 0057 0058 }; 0059 0060 #endif // MUSICDNSXMLPARSER_H