Sayonara Player
LFMWebAccess.h
1 /* WebAccess.h */
2 
3 /* Copyright (C) 2011-2020 Michael Lugmair (Lucio Carreras)
4  *
5  * This file is part of sayonara player
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11 
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16 
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 
22 /*
23  * WebAccess.h
24  *
25  * Created on: Oct 22, 2011
26  * Author: Michael Lugmair (Lucio Carreras)
27  */
28 
29 #ifndef WebAccess_H_
30 #define WebAccess_H_
31 
32 #include <QObject>
33 #include <QMap>
34 
35 class QByteArray;
36 
37 namespace LastFM
38 {
39  class UrlParams : public QMap<QByteArray, QByteArray>
40  {
41  public:
42  UrlParams();
43  void appendSignature();
44  };
45 
46  class WebAccess : public QObject
47  {
48  Q_OBJECT
49 
50  signals:
51  void sigFinished();
52  void sigResponse(const QByteArray& response);
53  void sigError(const QString& error);
54 
55  public:
56  void callUrl(const QString& url);
57  void callPostUrl(const QString& url, const QByteArray& data);
58 
59  public:
60  static QString parseTokenAnswer(const QString& content);
61  static QString createStandardUrl(const QString& base_url, const UrlParams& data);
62  static QString createPostUrl(const QString& base_url, const UrlParams& data, QByteArray& postData);
63 
64  private:
65  QString parseErrorMessage(const QString& response);
66  bool checkError(const QByteArray& data);
67 
68  private slots:
69  void awaFinished();
70 
71 
72 
73 
74  };
75 }
76 #endif /* WebAccess_H_ */
LastFM::UrlParams
Definition: LFMWebAccess.h:40
QMap
Definition: org_mpris_media_player2_adaptor.h:21
LastFM::WebAccess
Definition: LFMWebAccess.h:47