summaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp18
1 files changed, 18 insertions, 0 deletions
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 <http://www.gnu.org/licenses/>.
#include <QSplashScreen>
#include <QDirIterator>
#include <QDesktopServices>
+#include <QNetworkProxy>
#include <eh.h>
#include <windows_error.h>
#include <boost/scoped_array.hpp>
@@ -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<QNetworkProxy> 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");