Set Application Proxy from Operating System

Uses the QT proxy query and application wide proxy setting
to allow users behind a corporate firewall to use network
functions (maps, TP.com, ergDB etc).

Fixes #27.
This commit is contained in:
Mark Liversedge
2012-11-24 10:03:39 +00:00
parent 84efeef7df
commit a628ea1c44
2 changed files with 10 additions and 3 deletions

View File

@@ -134,6 +134,13 @@ MainWindow::MainWindow(const QDir &home) :
mainwindows.append(this); // add us to the list of open windows
// Network proxy
QNetworkProxyQuery npq(QUrl("http://www.google.com"));
QList<QNetworkProxy> listOfProxies = QNetworkProxyFactory::systemProxyForQuery(npq);
if (listOfProxies.count() > 0) {
QNetworkProxy::setApplicationProxy(listOfProxies.first());
}
/*----------------------------------------------------------------------
* Basic GUI setup
*--------------------------------------------------------------------*/

View File

@@ -27,7 +27,7 @@ ConfigurationPage::ConfigurationPage(MainWindow *main) : main(main)
intervalMetrics = new IntervalMetricsPage;
metadataPage = new MetadataPage(main);
measuresPage = new MeasuresPage(main);
proxyPage = new ProxyPage(this, main);
//proxyPage = new ProxyPage(this, main); // we use system settings
tabs->addTab(config, tr("Settings"));
tabs->addTab(colorsPage, tr("Appearance"));
@@ -35,7 +35,7 @@ ConfigurationPage::ConfigurationPage(MainWindow *main) : main(main)
tabs->addTab(intervalMetrics, tr("Interval Metrics"));
tabs->addTab(metadataPage, tr("Ride Data"));
tabs->addTab(measuresPage, tr("Athlete Data"));
tabs->addTab(proxyPage, tr("Proxy"));
//tabs->addTab(proxyPage, tr("Proxy")); // we use system settings
langLabel = new QLabel(tr("Language:"));
@@ -247,7 +247,7 @@ ConfigurationPage::saveClicked()
intervalMetrics->saveClicked();
metadataPage->saveClicked();
measuresPage->saveClicked();
proxyPage->saveClicked();
//proxyPage->saveClicked(); // We use system settings
}
void