Ignore:
Timestamp:
2009-01-19T17:19:55+01:00 (16 years ago)
Author:
stoecker
Message:

added proxy stuff

Location:
applications/editors/josm/plugins/wmsplugin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/wmsplugin/Makefile

    r12609 r13262  
    11#!/usr/bin/make
     2
     3MOC=moc
     4#MOC=/usr/share/qt4/bin/moc
     5CFLAGS  =
    26LDFLAGS = `pkg-config --libs --cflags QtCore QtGui QtWebKit`
    37
    4 compile: webkit-image.cpp webkit-image.h
    5         g++ -W -o webkit-image -I/usr/include/qt4/ -O2 $(LDFLAGS) webkit-image.cpp
     8webkit-image: webkit-image.cpp webkit-image.h
     9        g++ -W -o $@ -O2 $(CFLAGS) $(LDFLAGS) webkit-image.cpp
    610
    711webkit-image.h: webkit-image.cpp
    8         /usr/share/qt4/bin/moc webkit-image.cpp >webkit-image.h
     12        $(MOC) webkit-image.cpp >$@
    913
    1014clean:
  • applications/editors/josm/plugins/wmsplugin/webkit-image.cpp

    r12588 r13262  
    1313#include <QtWebKit/QWebPage>
    1414#include <QtWebKit/QWebFrame>
     15#include <QtNetwork/QNetworkProxy>
     16#include <QtCore/QProcess>
    1517
    1618/* using mingw to set binary mode */
     
    7072  Save * s = new Save(page);
    7173
     74  QStringList environment = QProcess::systemEnvironment();
     75  int idx = environment.indexOf(QRegExp("http_proxy=.*"));
     76  if(idx != -1)
     77  {
     78     QString proxyHost;
     79     int proxyPort = 8080;
     80     QStringList tmpList = environment.at(idx).split("=");
     81     QStringList host_port = tmpList.at(1).split(":");
     82     proxyHost = host_port.at(0);
     83     if(host_port.size() == 2)
     84     {
     85       bool ok;
     86       int port = host_port.at(1).toInt(&ok);
     87       if(ok)
     88         proxyPort = port;
     89     }
     90
     91     QNetworkProxy proxy;
     92     proxy.setType(QNetworkProxy::HttpCachingProxy);
     93     proxy.setHostName(proxyHost);
     94     proxy.setPort(proxyPort);
     95     page->networkAccessManager()->setProxy(proxy);
     96  }
     97
    7298  QObject::connect(page, SIGNAL(loadFinished(bool)), s, SLOT(loaded(bool)));
    7399  QObject::connect(s, SIGNAL(finish(void)), &a, SLOT(quit()));
Note: See TracChangeset for help on using the changeset viewer.