lbajardsilogic@8: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ lbajardsilogic@8: lbajardsilogic@8: /* Sound Access lbajardsilogic@8: EASAIER client application. lbajardsilogic@8: Silogic 2007. Laure Bajard. lbajardsilogic@8: lbajardsilogic@8: This program is free software; you can redistribute it and/or lbajardsilogic@8: modify it under the terms of the GNU General Public License as lbajardsilogic@8: published by the Free Software Foundation; either version 2 of the lbajardsilogic@8: License, or (at your option) any later version. See the file lbajardsilogic@8: COPYING included with this distribution for more information. lbajardsilogic@8: */ lbajardsilogic@8: lbajardsilogic@8: #ifndef _HTTP_CLIENT_H_ lbajardsilogic@8: #define _HTTP_CLIENT_H_ lbajardsilogic@8: lbajardsilogic@8: #include lbajardsilogic@8: #include lbajardsilogic@8: #include benoitrigolleau@104: #include lbajardsilogic@8: lbajardsilogic@8: #include "widgets/ConnectionSettings.h" lbajardsilogic@8: #include "base/XmlExportable.h" lbajardsilogic@8: lbajardsilogic@8: class ConnectionSettings; lbajardsilogic@8: lbajardsilogic@8: class HttpClient : public QHttp, public XmlExportable lbajardsilogic@8: { lbajardsilogic@8: Q_OBJECT lbajardsilogic@8: lbajardsilogic@8: public: lbajardsilogic@8: HttpClient(const QString& configFileName); lbajardsilogic@8: virtual ~HttpClient(); lbajardsilogic@8: lbajardsilogic@8: inline bool useProxy() const {return m_useProxy;} lbajardsilogic@8: inline QString getProxy() const {return m_proxy;} lbajardsilogic@8: inline int getProxyPort() const {return m_proxyPort;} lbajardsilogic@8: inline QString getUserProxyId() const {return m_userProxyId;} lbajardsilogic@8: inline QString getPwdProxyId() const {return m_pwdProxyId;} lbajardsilogic@8: lbajardsilogic@8: inline QString getHost() const {return m_host;} lbajardsilogic@8: inline quint16 getHostPort() const {return m_hostPort;} lbajardsilogic@8: lbajardsilogic@95: inline QString getServletName() const {return m_servletName;} lbajardsilogic@95: lbajardsilogic@8: inline void setUseProxy(const bool& ok) { m_useProxy = ok;} lbajardsilogic@8: inline void setProxyInfo(const QString& proxy) { m_proxy = proxy;} lbajardsilogic@8: inline void setProxyPortInfo(const int& port) { m_proxyPort = port;} lbajardsilogic@8: inline void setUserProxyId(const QString& user) { m_userProxyId = user;} lbajardsilogic@8: inline void setPwdProxyId(const QString& pwd) { m_pwdProxyId = pwd;} lbajardsilogic@8: lbajardsilogic@8: inline void setHostInfo(const QString& host) { m_host = host;} lbajardsilogic@8: inline void setHostPortInfo(const quint16 port) { m_hostPort = port;} benoitrigolleau@104: inline void setServletNameInfo(const QString& servletName) { m_servletName = servletName;} lbajardsilogic@8: lbajardsilogic@8: void valuesChanged(ConnectionSettings* dialogBox); lbajardsilogic@8: lbajardsilogic@8: virtual QString toXmlString(QString indent = "", QString extraAttributes = "") const; lbajardsilogic@8: bool fromXmlString(QIODevice *file); benoitrigolleau@104: static QString encodeString(const QString& str); benoitrigolleau@104: static QString decodeString(const QString& str) ; lbajardsilogic@8: private: lbajardsilogic@8: lbajardsilogic@8: bool m_useProxy; lbajardsilogic@8: QString m_proxy; lbajardsilogic@8: int m_proxyPort; lbajardsilogic@8: QString m_userProxyId; lbajardsilogic@8: QString m_pwdProxyId; lbajardsilogic@8: lbajardsilogic@8: QString m_host; lbajardsilogic@8: quint16 m_hostPort; lbajardsilogic@95: lbajardsilogic@95: QString m_servletName; benoitrigolleau@104: benoitrigolleau@104: lbajardsilogic@8: }; lbajardsilogic@8: lbajardsilogic@8: lbajardsilogic@8: class HttpClientConfigXmlHandler : public QXmlDefaultHandler lbajardsilogic@8: { lbajardsilogic@8: public: lbajardsilogic@8: HttpClientConfigXmlHandler(HttpClient *httpClient); lbajardsilogic@8: lbajardsilogic@8: bool startElement(const QString &namespaceURI, const QString &localName, lbajardsilogic@8: const QString &qName, const QXmlAttributes &attributes); lbajardsilogic@8: bool endElement(const QString &namespaceURI, const QString &localName, lbajardsilogic@8: const QString &qName); lbajardsilogic@8: bool characters(const QString &str); lbajardsilogic@8: bool error(const QXmlParseException &exception); lbajardsilogic@8: bool fatalError(const QXmlParseException &exception); lbajardsilogic@8: lbajardsilogic@8: private: lbajardsilogic@8: lbajardsilogic@8: HttpClient *m_httpClient; lbajardsilogic@8: lbajardsilogic@8: }; lbajardsilogic@8: #endif