~ubuntu-branches/ubuntu/wily/kid3/wily-proposed

« back to all changes in this revision

Viewing changes to src/core/import/httpclient.h

  • Committer: Package Import Robot
  • Author(s): Mark Purcell
  • Date: 2013-05-11 21:00:00 UTC
  • mfrom: (1.1.15) (2.1.17 sid)
  • Revision ID: package-import@ubuntu.com-20130511210000-4k2q62ldezhgtxjt
Tags: 2.3-2
Upload to unstable 

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
 * \author Urs Fleisch
7
7
 * \date 30 Dec 2008
8
8
 *
9
 
 * Copyright (C) 2008-2011  Urs Fleisch
 
9
 * Copyright (C) 2008-2012  Urs Fleisch
10
10
 *
11
11
 * This file is part of Kid3.
12
12
 *
31
31
#include <QString>
32
32
#include <QNetworkReply>
33
33
#include <QPointer>
 
34
#include <QMap>
 
35
#include <QDateTime>
 
36
#include <QTimer>
34
37
 
35
38
class QByteArray;
36
39
class QNetworkAccessManager;
42
45
Q_OBJECT
43
46
 
44
47
public:
 
48
  /** Name-value map for raw HTTP headers. */
 
49
  typedef QMap<QByteArray, QByteArray> RawHeaderMap;
 
50
 
45
51
  /**
46
52
   * Constructor.
47
53
   *
59
65
   *
60
66
   * @param server host name
61
67
   * @param path   path of the URL
 
68
   * @param headers optional raw headers to send
62
69
   */
63
 
  void sendRequest(const QString& server, const QString& path);
 
70
  void sendRequest(const QString& server, const QString& path,
 
71
                   const RawHeaderMap& headers = RawHeaderMap());
64
72
 
65
73
  /**
66
74
   * Abort request.
123
131
   */
124
132
  void networkReplyError(QNetworkReply::NetworkError);
125
133
 
 
134
  /**
 
135
   * Called to start delayed sendRequest().
 
136
   */
 
137
  void delayedSendRequest();
 
138
 
126
139
private:
127
140
  /**
128
141
   * Emit a progress signal with step/total steps.
163
176
  unsigned long m_rcvBodyLen;
164
177
  /** content type */
165
178
  QString m_rcvBodyType;
 
179
  /** Timer used to delay requests */
 
180
  QTimer* m_requestTimer;
 
181
  /** Context for delayedSendRequest() */
 
182
  struct {
 
183
    QString server;
 
184
    QString path;
 
185
    RawHeaderMap headers;
 
186
  } m_delayedSendRequestContext;
 
187
 
 
188
  friend struct MinimumRequestIntervalInitializer;
 
189
 
 
190
  /** Time when last request was sent to server */
 
191
#if QT_VERSION >= 0x040700
 
192
  static QMap<QString, QDateTime> s_lastRequestTime;
 
193
#else
 
194
  static QMap<QString, QTime> s_lastRequestTime;
 
195
#endif
 
196
  /** Minimum interval between two requests to server in ms */
 
197
  static QMap<QString, int> s_minimumRequestInterval;
166
198
};
167
199
 
168
200
#endif