#ifndef HTTPINFORMATION_H #define HTTPINFORMATION_H #include #include #include #include #include #include "Glass_global.h" class GLASSSHARED_EXPORT HttpInformation : public QObject { Q_OBJECT public: HttpInformation(QObject *parent = 0); ~HttpInformation(); void begin(); bool isUpdated(); int offsetSeconds(); QString timestamp() const; QString version() const; QString html() const; signals: void done(bool valid); private: enum Step { Non, One, Two, }; struct Version { int major; int minor; int patch; int build; }; int _reqId; int _beginTime; int _localTime; int _serverTime; bool _isUpdated; Step _step; QHttp* _http; QBuffer* _buffer; QString _timestamp; QString _version; QString _page; QString _html; void parseElement(const QString& name, const QString& value); bool parseVersion(Version& ver, const QString& value); private slots: void httpDone(bool error); void httpRequestFinished(int requestId, bool error); void httpStateChanged(int state); }; #endif // HTTPINFORMATION_H