Migrate everything to use the new Preferences class and not access directly the qbittorrent.ini file.

This commit is contained in:
sledgehammer999 2014-07-05 15:44:13 +03:00
parent da6ce859c0
commit d8d95d2195
44 changed files with 748 additions and 908 deletions

View file

@ -34,6 +34,9 @@
#include <QXmlStreamReader>
#include <QNetworkProxy>
#include <QDesktopServices>
#include <QDebug>
#include <QRegExp>
#include <QStringList>
#include "programupdater.h"
#include "fs_utils.h"
@ -47,17 +50,15 @@ const QUrl RSS_URL("http://sourceforge.net/api/file/index/project-id/163414/mtim
const QString FILE_EXT = "EXE";
#endif
using namespace libtorrent;
ProgramUpdater::ProgramUpdater(QObject *parent, bool invokedByUser) :
QObject(parent), m_invokedByUser(invokedByUser)
{
mp_manager = new QNetworkAccessManager(this);
Preferences pref;
Preferences* const pref = Preferences::instance();
// Proxy support
if (pref.isProxyEnabled()) {
if (pref->isProxyEnabled()) {
QNetworkProxy proxy;
switch(pref.getProxyType()) {
switch(pref->getProxyType()) {
case Proxy::SOCKS4:
case Proxy::SOCKS5:
case Proxy::SOCKS5_PW:
@ -66,12 +67,12 @@ ProgramUpdater::ProgramUpdater(QObject *parent, bool invokedByUser) :
proxy.setType(QNetworkProxy::HttpProxy);
break;
}
proxy.setHostName(pref.getProxyIp());
proxy.setPort(pref.getProxyPort());
proxy.setHostName(pref->getProxyIp());
proxy.setPort(pref->getProxyPort());
// Proxy authentication
if (pref.isProxyAuthEnabled()) {
proxy.setUser(pref.getProxyUsername());
proxy.setPassword(pref.getProxyPassword());
if (pref->isProxyAuthEnabled()) {
proxy.setUser(pref->getProxyUsername());
proxy.setPassword(pref->getProxyPassword());
}
mp_manager->setProxy(proxy);
}