~ubuntu-branches/ubuntu/raring/recorditnow/raring

« back to all changes in this revision

Viewing changes to joschy-snapshot-23-02-10/Provider/YouTube/src/responseparser.h

  • Committer: Bazaar Package Importer
  • Author(s): Felix Geyer
  • Date: 2011-01-09 14:54:01 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20110109145401-gyckb4airz4fio50
Tags: 0.8.1-0ubuntu1
* New upstream release. (LP: #681270)
  - Update debian/copyright.
* Build-depend on recordmydesktop.
* Add a watch file.
* Drop 01_fix_ftbfs_kwarning_call.diff, fixed upstream.
* Add 01_joschy_install_to_usr_lib.diff.
* Add 02_fix_ftbfs_no-add-needed.diff.
* Add 03_dont_install_header_files.diff.
* Replace dependency on libpolkit-qt-1-0 with policykit-1.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
    Copyright (C) 2010  Kai Dombrowe <just89@gmx.de>
 
3
 
 
4
    This library is free software; you can redistribute it and/or
 
5
    modify it under the terms of the GNU Lesser General Public
 
6
    License as published by the Free Software Foundation; either
 
7
    version 2.1 of the License, or (at your option) any later version.
 
8
 
 
9
    This library 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 GNU
 
12
    Lesser General Public License for more details.
 
13
 
 
14
    You should have received a copy of the GNU Lesser General Public
 
15
    License along with this library; if not, write to the Free Software
 
16
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 
17
*/
 
18
 
 
19
#ifndef RESPONSEPARSER_H
 
20
#define RESPONSEPARSER_H
 
21
 
 
22
 
 
23
// Joschy
 
24
#include <joschycore/video.h>
 
25
#include <joschycore/plugin.h>
 
26
#include <joschycore/abstractresponseparser.h>
 
27
 
 
28
// Qt
 
29
#include <QtCore/QByteArray>
 
30
 
 
31
 
 
32
class QXmlStreamReader;
 
33
namespace Joschy {
 
34
 
 
35
 
 
36
class ResponseParser : public Joschy::AbstractResponseParser
 
37
{
 
38
    Q_OBJECT
 
39
 
 
40
 
 
41
public:
 
42
    explicit ResponseParser(const Type &type, const QString &id, const QVariantMap &data,
 
43
                                    QObject *parent = 0);
 
44
 
 
45
    Joschy::Video getVideo() const;
 
46
    QList<Joschy::Video> getVideos() const;
 
47
    QString token() const;
 
48
    QString login() const;
 
49
    QByteArray image() const;
 
50
    QHash<QString, QString> getCategorys() const;
 
51
 
 
52
    void parseLogin(const QVariantMap &data);
 
53
    void parseSearch(const QVariantMap &data);
 
54
    void parseUpload(const QVariantMap &data);
 
55
    void parseThumbnail(const QVariantMap &data);
 
56
    void parseCategorys(const QVariantMap &data);
 
57
 
 
58
 
 
59
private:
 
60
    QString m_login;
 
61
    QString m_token;
 
62
    QList<Joschy::Video> m_videos;
 
63
    QByteArray m_image;
 
64
    QHash<QString, QString> m_categorys;
 
65
 
 
66
 
 
67
    void parseXML(const QByteArray &response);
 
68
    void readEntry(QXmlStreamReader *reader);
 
69
    void readErrors(QXmlStreamReader *reader);
 
70
    void parseAuth(const QByteArray &response);
 
71
    void parseError(const QByteArray &response);
 
72
    void parseErrorReply(const QString &reply);
 
73
    void parseAdditionalErrorCodes(const int &code);
 
74
 
 
75
 
 
76
 
 
77
protected:
 
78
    void startJob();
 
79
    bool cancelJob();
 
80
 
 
81
 
 
82
};
 
83
 
 
84
 
 
85
} // namespace Joschy
 
86
 
 
87
 
 
88
 
 
89
#endif // RESPONSEPARSER_H