Skip to content
Snippets Groups Projects
Commit 8c5a331c authored by Jani Mustonen's avatar Jani Mustonen Committed by mujx
Browse files

Simple SOCKS proxy support (#110)

parent 7e03ca43
No related branches found
No related tags found
No related merge requests found
......@@ -19,11 +19,38 @@
#include <QDesktopWidget>
#include <QFontDatabase>
#include <QLibraryInfo>
#include <QNetworkProxy>
#include <QSettings>
#include <QTranslator>
#include "MainWindow.h"
void
setupProxy()
{
QSettings settings;
/**
To set up a SOCKS proxy:
[user]
proxy\socks\host=<>
proxy\socks\port=<>
proxy\socks\user=<>
proxy\socks\password=<>
**/
if (settings.contains("user/proxy/socks/host")) {
QNetworkProxy proxy;
proxy.setType(QNetworkProxy::Socks5Proxy);
proxy.setHostName(settings.value("user/proxy/socks/host").toString());
proxy.setPort(settings.value("user/proxy/socks/port").toInt());
if (settings.contains("user/proxy/socks/user"))
proxy.setUser(settings.value("user/proxy/socks/user").toString());
if (settings.contains("user/proxy/socks/password"))
proxy.setPassword(settings.value("user/proxy/socks/password").toString());
QNetworkProxy::setApplicationProxy(proxy);
}
}
int
main(int argc, char *argv[])
{
......@@ -62,6 +89,8 @@ main(int argc, char *argv[])
appTranslator.load("nheko_" + lang, ":/translations");
app.installTranslator(&appTranslator);
setupProxy();
MainWindow w;
// Move the MainWindow to the center
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment