From e09cef39095b8d675f11a41dd4d152cdecac1809 Mon Sep 17 00:00:00 2001 From: Tannin Date: Sat, 13 Jul 2013 11:52:40 +0200 Subject: - minor fixes to ncc build files - MO will now use system-wide proxy if one is configured --- src/main.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src') diff --git a/src/main.cpp b/src/main.cpp index a1129b8c..583992d1 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -62,6 +62,7 @@ along with Mod Organizer. If not, see . #include #include #include +#include #include #include #include @@ -273,6 +274,21 @@ LONG WINAPI MyUnhandledExceptionFilter(struct _EXCEPTION_POINTERS *exceptionPtrs } +void setupNetworkProxy() +{ + QNetworkProxyQuery query(QUrl("http://www.google.com"), QNetworkProxyQuery::UrlRequest); + query.setProtocolTag("http"); + + QList proxies = QNetworkProxyFactory::systemProxyForQuery(query); + if ((proxies.size() > 0) && (proxies.at(0).type() != QNetworkProxy::NoProxy)) { + qDebug("Using proxy: %s", qPrintable(proxies.at(0).hostName())); + QNetworkProxy::setApplicationProxy(proxies[0]); + } else { + qDebug("Not using proxy"); + } +} + + void registerMetaTypes() { registerExecutable(); @@ -284,6 +300,8 @@ int main(int argc, char *argv[]) qApp->addLibraryPath(application.applicationDirPath() + "/dlls"); + setupNetworkProxy(); + SetUnhandledExceptionFilter(MyUnhandledExceptionFilter); LogBuffer::init(20, QtDebugMsg, application.applicationDirPath() + "/logs/mo_interface.log"); -- cgit v1.3.1