File indexing completed on 2024-09-15 04:28:34
0001 // SPDX-FileCopyrightText: 2024 Tobias Fella <tobias.fella@kde.org> 0002 // SPDX-License-Identifier: LGPL-2.0-or-later 0003 0004 #include "proxycontroller.h" 0005 0006 #include <QNetworkProxy> 0007 0008 #include "neochatconfig.h" 0009 0010 void ProxyController::setApplicationProxy() 0011 { 0012 auto cfg = NeoChatConfig::self(); 0013 QNetworkProxy proxy; 0014 0015 switch (cfg->proxyType()) { 0016 case 1: 0017 proxy.setType(QNetworkProxy::HttpProxy); 0018 break; 0019 case 2: 0020 proxy.setType(QNetworkProxy::Socks5Proxy); 0021 break; 0022 default: 0023 break; 0024 } 0025 proxy.setHostName(cfg->proxyHost()); 0026 proxy.setPort(cfg->proxyPort()); 0027 proxy.setUser(cfg->proxyUser()); 0028 proxy.setPassword(cfg->proxyPassword()); 0029 QNetworkProxy::setApplicationProxy(proxy); 0030 } 0031 0032 ProxyController::ProxyController(QObject *parent) 0033 : QObject(parent) 0034 { 0035 }