summaryrefslogtreecommitdiffstats
path: root/MultiMC.cpp
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2013-10-31 09:03:18 +0100
committerPetr Mrázek <peterix@gmail.com>2013-10-31 09:03:18 +0100
commit8cd6604e40ae5d250f6826d0c7a1985e719ec66c (patch)
tree95354efc7f9096cfee0cc0cfdf27d32237dacd2c /MultiMC.cpp
parentf39a83edc6b1de3f99eaf2c1cfc409f50a1df1b2 (diff)
downloadMultiMC-8cd6604e40ae5d250f6826d0c7a1985e719ec66c.tar
MultiMC-8cd6604e40ae5d250f6826d0c7a1985e719ec66c.tar.gz
MultiMC-8cd6604e40ae5d250f6826d0c7a1985e719ec66c.tar.lz
MultiMC-8cd6604e40ae5d250f6826d0c7a1985e719ec66c.tar.xz
MultiMC-8cd6604e40ae5d250f6826d0c7a1985e719ec66c.zip
List available proxies on start
Diffstat (limited to 'MultiMC.cpp')
-rw-r--r--MultiMC.cpp42
1 files changed, 41 insertions, 1 deletions
diff --git a/MultiMC.cpp b/MultiMC.cpp
index e425aa44..d13d1443 100644
--- a/MultiMC.cpp
+++ b/MultiMC.cpp
@@ -152,6 +152,46 @@ MultiMC::MultiMC(int &argc, char **argv) : QApplication(argc, argv)
// set up a basic autodetected proxy (system default)
QNetworkProxyFactory::setUseSystemConfiguration(true);
+ QLOG_INFO() << "Detecting system proxy settings...";
+ auto proxies = QNetworkProxyFactory::systemProxyForQuery();
+ if (proxies.size() == 1 && proxies[0].type() == QNetworkProxy::NoProxy)
+ {
+ QLOG_INFO() << "No proxy found.";
+ }
+ else for (auto proxy : proxies)
+ {
+ QString proxyDesc;
+ if (proxy.type() == QNetworkProxy::NoProxy)
+ {
+ QLOG_INFO() << "Using no proxy is an option!";
+ continue;
+ }
+ switch (proxy.type())
+ {
+ case QNetworkProxy::DefaultProxy:
+ proxyDesc = "Default proxy: ";
+ break;
+ case QNetworkProxy::Socks5Proxy:
+ proxyDesc = "Socks5 proxy: ";
+ break;
+ case QNetworkProxy::HttpProxy:
+ proxyDesc = "HTTP proxy: ";
+ break;
+ case QNetworkProxy::HttpCachingProxy:
+ proxyDesc = "HTTP caching: ";
+ break;
+ case QNetworkProxy::FtpCachingProxy:
+ proxyDesc = "FTP caching: ";
+ break;
+ }
+ proxyDesc += QString("%3@%1:%2 pass %4")
+ .arg(proxy.hostName())
+ .arg(proxy.port())
+ .arg(proxy.user())
+ .arg(proxy.password());
+ QLOG_INFO() << proxyDesc;
+ }
+
// create the global network manager
m_qnam.reset(new QNetworkAccessManager(this));
@@ -354,7 +394,7 @@ std::shared_ptr<JavaVersionList> MultiMC::javalist()
return m_javalist;
}
-int main_gui(MultiMC & app)
+int main_gui(MultiMC &app)
{
// show main window
MainWindow mainWin;