QGpGuiTools/HttpProxyList.h
Go to the documentation of this file.
00001 /***************************************************************************
00002 **
00003 **  This file is part of QGpGuiTools.
00004 **
00005 **  This library is free software; you can redistribute it and/or
00006 **  modify it under the terms of the GNU Lesser General Public
00007 **  License as published by the Free Software Foundation; either
00008 **  version 2.1 of the License, or (at your option) any later version.
00009 **
00010 **  This file is distributed in the hope that it will be useful, but WITHOUT
00011 **  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 **  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
00013 **  License for more details.
00014 **
00015 **  You should have received a copy of the GNU Lesser General Public
00016 **  License along with this library; if not, write to the Free Software
00017 **  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00018 **
00019 **  See http://www.geopsy.org for more information.
00020 **
00021 **  Created: 2011-01-04
00022 **  Authors:
00023 **    Marc Wathelet (ISTerre, Grenoble, France)
00024 **
00025 ***************************************************************************/
00026 
00027 #ifndef HTTPPROXYLIST_H
00028 #define HTTPPROXYLIST_H
00029 
00030 #include "QGpGuiToolsDLLExport.h"
00031 #include "HttpProxy.h"
00032 
00033 class QNetworkReply;
00034 
00035 namespace QGpGuiTools {
00036 
00037   class QGPGUITOOLS_EXPORT HttpProxyList : public QObject
00038   {
00039     Q_OBJECT
00040   public:
00041     HttpProxyList(const QString& testUrl, QObject * parent=0);
00042     ~HttpProxyList();
00043 
00044     void collect();
00045     bool isReady() const {return _replies.isEmpty();}
00046 
00047     const HttpProxy& at(int index) {return _proxies[index];}
00048     int count() const {return _proxies.count();}
00049 
00050     const QUrl& testUrl() const {return _testUrl;}
00051 
00052     void printDebug(const QString& s, bool list=false) const;
00053   signals:
00054     void ready();
00055   private slots:
00056     void getScriptFinished();
00057   private:
00058     void sort();
00059     void getScript(const QString& url);
00060     void autoDetectProxies();
00061     void dnsDetectRequest(const QString& domainName);
00062     void replyReceived(QNetworkReply * reply);
00063 
00064     void firefoxProxies();
00065 #if defined Q_WS_X11
00066     void kdeProxies();
00067 #elif defined Q_WS_WIN
00068     void internetExplorerProxies();
00069 #elif defined Q_WS_MAC
00070     void macProxies();
00071 #endif
00072     void systemProxies();
00073     void firefoxProxies(const QString& file);
00074 #if defined Q_WS_X11
00075     void kdeProxies(const QString& file);
00076 #endif
00077     QStringList firefoxFiles();
00078     QStringList findFiles(QDir in, QString pattern);
00079     QStringList findFiles(QDir in, QStringList patternList);
00080 
00081     QUrl _testUrl;
00082     QList<HttpProxy> _proxies;
00083     QList<QNetworkReply *> _replies;
00084   };
00085 
00086 } // namespace QGpGuiTools
00087 
00088 #endif // HTTPPROXYLIST_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines