Browse Source

- Split Preferences from the GUI so that Options dialog does not need to be created on startup to retrieve the preferences:

* This speeds up startup
  * Bittorrent session settings are now applied at bittorrent class level (Required for headless running)
adaptive-webui-19844
Christophe Dumez 15 years ago
parent
commit
51ebfadd85
  1. 1
      Changelog
  2. 305
      src/GUI.cpp
  3. 3
      src/GUI.h
  4. 229
      src/bittorrent.cpp
  5. 1
      src/bittorrent.h
  6. 33
      src/options.ui
  7. 520
      src/options_imp.cpp
  8. 50
      src/options_imp.h
  9. 406
      src/preferences.h
  10. 3
      src/src.pro

1
Changelog

@ -17,6 +17,7 @@ @@ -17,6 +17,7 @@
- FEATURE: Display more information regarding the torrent in its properties
- FEATURE: Various optimizations to save CPU and memory
- FEATURE: Folder scanning now works with CIFS and NFS mounted folders
- FEATURE: Speed up qBittorrent startup
- COSMETIC: Merged download / upload lists
- COSMETIC: Torrents can be filtered based on their status
- COSMETIC: Torrent properties are now displayed in main window

305
src/GUI.cpp

@ -59,6 +59,7 @@ @@ -59,6 +59,7 @@
#include "trackerLogin.h"
#include "options_imp.h"
#include "allocationDlg.h"
#include "preferences.h"
#include <stdlib.h>
#include "console_imp.h"
#include "httpserver.h"
@ -126,9 +127,7 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), dis @@ -126,9 +127,7 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), dis
actionCreate_torrent->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/new.png")));
// Fix Tool bar layout
toolBar->layout()->setSpacing(7);
// creating options
options = new options_imp(this);
connect(options, SIGNAL(status_changed(bool)), this, SLOT(OptionsSaved(bool)));
// Creating Bittorrent session
BTSession = new bittorrent();
connect(BTSession, SIGNAL(fullDiskError(QTorrentHandle&, QString)), this, SLOT(fullDiskError(QTorrentHandle&, QString)));
connect(BTSession, SIGNAL(finishedTorrent(QTorrentHandle&)), this, SLOT(finishedTorrent(QTorrentHandle&)));
@ -174,7 +173,7 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), dis @@ -174,7 +173,7 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), dis
rssWidget = 0;
// Configure BT session according to options
configureSession(true);
loadPreferences(false);
// Resume unfinished torrents
BTSession->startUpTorrents();
// FIXME: Sorting
@ -765,95 +764,49 @@ void GUI::processDownloadedFiles(QString path, QString url) { @@ -765,95 +764,49 @@ void GUI::processDownloadedFiles(QString path, QString url) {
}
}
// Set BT session configuration
void GUI::configureSession(bool deleteOptions) {
qDebug("Configuring session");
// Load program preferences
void GUI::loadPreferences(bool configure_session) {
BTSession->addConsoleMessage(tr("Options were saved successfully."));
bool newSystrayIntegration = Preferences::systrayIntegration();
if(newSystrayIntegration != systrayIntegration) {
if(newSystrayIntegration) {
// create the trayicon
createTrayIcon();
} else {
// Destroy trayicon
delete myTrayIcon;
delete myTrayIconMenu;
}
systrayIntegration = newSystrayIntegration;
}
// XXX: Should probably be done in bittorrent, not here
// Update Web UI
if (Preferences::isWebUiEnabled()) {
quint16 port = Preferences::getWebUiPort();
QString username = Preferences::getWebUiUsername();
QString password = Preferences::getWebUiPassword();
initWebUi(username, password, port);
} else if(httpServer) {
delete httpServer;
}
// General
bool new_displaySpeedInTitle = options->speedInTitleBar();
bool new_displaySpeedInTitle = Preferences::speedInTitleBar();
if(!new_displaySpeedInTitle && new_displaySpeedInTitle != displaySpeedInTitle) {
// Reset title
setWindowTitle(tr("qBittorrent %1", "e.g: qBittorrent v0.x").arg(QString::fromUtf8(VERSION)));
}
displaySpeedInTitle = new_displaySpeedInTitle;
if(options->isToolbarDisplayed()) {
if(Preferences::isToolbarDisplayed()) {
toolBar->setVisible(true);
toolBar->layout()->setSpacing(7);
} else {
toolBar->setVisible(false);
}
unsigned int new_refreshInterval = options->getRefreshInterval();
unsigned int new_refreshInterval = Preferences::getRefreshInterval();
transferList->setRefreshInterval(new_refreshInterval);
// Downloads
// * Save path
BTSession->setDefaultSavePath(options->getSavePath());
if(options->isTempPathEnabled()) {
BTSession->setDefaultTempPath(options->getTempPath());
} else {
BTSession->setDefaultTempPath(QString::null);
}
BTSession->preAllocateAllFiles(options->preAllocateAllFiles());
BTSession->startTorrentsInPause(options->addTorrentsInPause());
// * Scan dir
if(options->getScanDir().isNull()) {
BTSession->disableDirectoryScanning();
}else{
//Interval first
BTSession->enableDirectoryScanning(options->getScanDir());
}
// Connection
// * Ports binding
unsigned short old_listenPort = BTSession->getListenPort();
BTSession->setListeningPort(options->getPort());
unsigned short new_listenPort = BTSession->getListenPort();
if(new_listenPort != old_listenPort) {
BTSession->addConsoleMessage(tr("qBittorrent is bound to port: TCP/%1", "e.g: qBittorrent is bound to port: 6881").arg( misc::toQString(new_listenPort)));
}
// * Global download limit
QPair<int, int> limits = options->getGlobalBandwidthLimits();
if(limits.first <= 0) {
// Download limit disabled
BTSession->setDownloadRateLimit(-1);
} else {
// Enabled
BTSession->setDownloadRateLimit(limits.first*1024);
}
// * Global Upload limit
if(limits.second <= 0) {
// Upload limit disabled
BTSession->setUploadRateLimit(-1);
} else {
// Enabled
BTSession->setUploadRateLimit(limits.second*1024);
}
// * UPnP
if(options->isUPnPEnabled()) {
BTSession->enableUPnP(true);
BTSession->addConsoleMessage(tr("UPnP support [ON]"), QString::fromUtf8("blue"));
} else {
BTSession->enableUPnP(false);
BTSession->addConsoleMessage(tr("UPnP support [OFF]"), QString::fromUtf8("blue"));
}
// * NAT-PMP
if(options->isNATPMPEnabled()) {
BTSession->enableNATPMP(true);
BTSession->addConsoleMessage(tr("NAT-PMP support [ON]"), QString::fromUtf8("blue"));
} else {
BTSession->enableNATPMP(false);
BTSession->addConsoleMessage(tr("NAT-PMP support [OFF]"), QString::fromUtf8("blue"));
}
// * Session settings
session_settings sessionSettings;
if(options->shouldSpoofAzureus()) {
sessionSettings.user_agent = "Azureus 3.0.5.2";
} else {
sessionSettings.user_agent = "qBittorrent "VERSION;
}
sessionSettings.upnp_ignore_nonrouters = true;
sessionSettings.use_dht_as_fallback = false;
// To keep same behavior as in qbittorrent v1.2.0
sessionSettings.rate_limit_ip_overhead = false;
// Queueing System
if(options->isQueueingSystemEnabled()) {
if(Preferences::isQueueingSystemEnabled()) {
if(!BTSession->isQueueingEnabled()) {
transferList->hidePriorityColumn(false);
actionDecreasePriority->setVisible(true);
@ -862,20 +815,8 @@ void GUI::configureSession(bool deleteOptions) { @@ -862,20 +815,8 @@ void GUI::configureSession(bool deleteOptions) {
prioSeparator2->setVisible(true);
toolBar->layout()->setSpacing(7);
}
int max_torrents = options->getMaxActiveTorrents();
int max_uploads = options->getMaxActiveUploads();
int max_downloads = options->getMaxActiveDownloads();
sessionSettings.active_downloads = max_downloads;
sessionSettings.active_seeds = max_uploads;
sessionSettings.active_limit = max_torrents;
sessionSettings.dont_count_slow_torrents = false;
BTSession->setQueueingEnabled(true);
} else {
if(BTSession->isQueueingEnabled()) {
sessionSettings.active_downloads = -1;
sessionSettings.active_seeds = -1;
sessionSettings.active_limit = -1;
BTSession->setQueueingEnabled(false);
transferList->hidePriorityColumn(true);
actionDecreasePriority->setVisible(false);
actionIncreasePriority->setVisible(false);
@ -884,153 +825,18 @@ void GUI::configureSession(bool deleteOptions) { @@ -884,153 +825,18 @@ void GUI::configureSession(bool deleteOptions) {
toolBar->layout()->setSpacing(7);
}
}
BTSession->setSessionSettings(sessionSettings);
// Bittorrent
// * Max connections limit
BTSession->setMaxConnections(options->getMaxConnecs());
// * Max connections per torrent limit
BTSession->setMaxConnectionsPerTorrent(options->getMaxConnecsPerTorrent());
// * Max uploads per torrent limit
BTSession->setMaxUploadsPerTorrent(options->getMaxUploadsPerTorrent());
// * DHT
if(options->isDHTEnabled()) {
// Set DHT Port
BTSession->setDHTPort(options->getDHTPort());
if(BTSession->enableDHT(true)) {
int dht_port = new_listenPort;
if(options->getDHTPort())
dht_port = options->getDHTPort();
BTSession->addConsoleMessage(tr("DHT support [ON], port: UDP/%1").arg(dht_port), QString::fromUtf8("blue"));
} else {
BTSession->addConsoleMessage(tr("DHT support [OFF]"), QString::fromUtf8("red"));
}
} else {
BTSession->enableDHT(false);
BTSession->addConsoleMessage(tr("DHT support [OFF]"), QString::fromUtf8("blue"));
}
// * PeX
BTSession->addConsoleMessage(tr("PeX support [ON]"), QString::fromUtf8("blue"));
// * LSD
if(options->isLSDEnabled()) {
BTSession->enableLSD(true);
BTSession->addConsoleMessage(tr("Local Peer Discovery [ON]"), QString::fromUtf8("blue"));
} else {
BTSession->enableLSD(false);
BTSession->addConsoleMessage(tr("Local Peer Discovery support [OFF]"), QString::fromUtf8("blue"));
}
// * Encryption
int encryptionState = options->getEncryptionSetting();
// The most secure, rc4 only so that all streams and encrypted
pe_settings encryptionSettings;
encryptionSettings.allowed_enc_level = pe_settings::rc4;
encryptionSettings.prefer_rc4 = true;
switch(encryptionState) {
case 0: //Enabled
encryptionSettings.out_enc_policy = pe_settings::enabled;
encryptionSettings.in_enc_policy = pe_settings::enabled;
BTSession->addConsoleMessage(tr("Encryption support [ON]"), QString::fromUtf8("blue"));
break;
case 1: // Forced
encryptionSettings.out_enc_policy = pe_settings::forced;
encryptionSettings.in_enc_policy = pe_settings::forced;
BTSession->addConsoleMessage(tr("Encryption support [FORCED]"), QString::fromUtf8("blue"));
break;
default: // Disabled
encryptionSettings.out_enc_policy = pe_settings::disabled;
encryptionSettings.in_enc_policy = pe_settings::disabled;
BTSession->addConsoleMessage(tr("Encryption support [OFF]"), QString::fromUtf8("blue"));
}
BTSession->applyEncryptionSettings(encryptionSettings);
// * Desired ratio
BTSession->setGlobalRatio(options->getDesiredRatio());
// * Maximum ratio
BTSession->setDeleteRatio(options->getDeleteRatio());
// Ip Filter
if(options->isFilteringEnabled()) {
BTSession->enableIPFilter(options->getFilter());
}else{
BTSession->disableIPFilter();
}
// RSS
if(options->isRSSEnabled()) {
if(Preferences::isRSSEnabled()) {
displayRSSTab(true);
} else {
displayRSSTab(false);
}
// * Proxy settings
proxy_settings proxySettings;
if(options->isProxyEnabled()) {
qDebug("Enabling P2P proxy");
proxySettings.hostname = options->getProxyIp().toStdString();
qDebug("hostname is %s", proxySettings.hostname.c_str());
proxySettings.port = options->getProxyPort();
qDebug("port is %d", proxySettings.port);
if(options->isProxyAuthEnabled()) {
proxySettings.username = options->getProxyUsername().toStdString();
proxySettings.password = options->getProxyPassword().toStdString();
qDebug("username is %s", proxySettings.username.c_str());
qDebug("password is %s", proxySettings.password.c_str());
}
switch(options->getProxyType()) {
case HTTP:
qDebug("type: http");
proxySettings.type = proxy_settings::http;
break;
case HTTP_PW:
qDebug("type: http_pw");
proxySettings.type = proxy_settings::http_pw;
break;
case SOCKS5:
qDebug("type: socks5");
proxySettings.type = proxy_settings::socks5;
break;
default:
qDebug("type: socks5_pw");
proxySettings.type = proxy_settings::socks5_pw;
break;
}
qDebug("booleans: %d %d %d %d", options->useProxyForTrackers(), options->useProxyForPeers(), options->useProxyForWebseeds(), options->useProxyForDHT());
BTSession->setProxySettings(proxySettings, options->useProxyForTrackers(), options->useProxyForPeers(), options->useProxyForWebseeds(), options->useProxyForDHT());
} else {
qDebug("Disabling P2P proxy");
BTSession->setProxySettings(proxySettings, false, false, false, false);
}
if(options->isHTTPProxyEnabled()) {
qDebug("Enabling Search HTTP proxy");
// HTTP Proxy
QString proxy_str;
switch(options->getHTTPProxyType()) {
case HTTP_PW:
proxy_str = misc::toQString("http://")+options->getHTTPProxyUsername()+":"+options->getHTTPProxyPassword()+"@"+options->getHTTPProxyIp()+":"+misc::toQString(options->getHTTPProxyPort());
break;
default:
proxy_str = misc::toQString("http://")+options->getHTTPProxyIp()+":"+misc::toQString(options->getHTTPProxyPort());
}
// We need this for urllib in search engine plugins
#ifdef Q_WS_WIN
char proxystr[512];
snprintf(proxystr, 512, "http_proxy=%s", proxy_str.toLocal8Bit().data());
putenv(proxystr);
#else
qDebug("HTTP: proxy string: %s", proxy_str.toLocal8Bit().data());
setenv("http_proxy", proxy_str.toLocal8Bit().data(), 1);
#endif
} else {
qDebug("Disabling search proxy");
#ifdef Q_WS_WIN
putenv("http_proxy=");
#else
unsetenv("http_proxy");
#endif
}
// Clean up
if(deleteOptions && options) {
qDebug("Deleting options");
//delete options;
options->deleteLater();
}
qDebug("Session configured");
if(configure_session)
BTSession->configureSession();
qDebug("GUI settings loaded");
}
void GUI::addUnauthenticatedTracker(QPair<QTorrentHandle,QString> tracker) {
@ -1198,36 +1004,7 @@ void GUI::createTrayIcon() { @@ -1198,36 +1004,7 @@ void GUI::createTrayIcon() {
// Display Program Options
void GUI::on_actionOptions_triggered() {
options = new options_imp(this);
connect(options, SIGNAL(status_changed(bool)), this, SLOT(OptionsSaved(bool)));
options->show();
}
// Is executed each time options are saved
void GUI::OptionsSaved(bool deleteOptions) {
BTSession->addConsoleMessage(tr("Options were saved successfully."));
bool newSystrayIntegration = options->systrayIntegration();
if(newSystrayIntegration != systrayIntegration) {
if(newSystrayIntegration) {
// create the trayicon
createTrayIcon();
} else {
// Destroy trayicon
delete myTrayIcon;
delete myTrayIconMenu;
}
systrayIntegration = newSystrayIntegration;
}
// Update Web UI
if (options->isWebUiEnabled()) {
quint16 port = options->webUiPort();
QString username = options->webUiUsername();
QString password = options->webUiPassword();
initWebUi(username, password, port);
} else if(httpServer) {
delete httpServer;
}
// Update session
configureSession(deleteOptions);
connect(options, SIGNAL(status_changed()), this, SLOT(loadPreferences(bool)));
}
bool GUI::initWebUi(QString username, QString password, int port) {

3
src/GUI.h

@ -144,7 +144,7 @@ class GUI : public QMainWindow, private Ui::MainWindow{ @@ -144,7 +144,7 @@ class GUI : public QMainWindow, private Ui::MainWindow{
void on_actionDocumentation_triggered() const;
void on_actionOpen_triggered();
void checkConnectionStatus();
void configureSession(bool deleteOptions);
void loadPreferences(bool configure_session=true);
void processParams(const QStringList& params);
void addTorrent(QString path);
void addUnauthenticatedTracker(QPair<QTorrentHandle,QString> tracker);
@ -156,7 +156,6 @@ class GUI : public QMainWindow, private Ui::MainWindow{ @@ -156,7 +156,6 @@ class GUI : public QMainWindow, private Ui::MainWindow{
void scrapeTrackers();
// Options slots
void on_actionOptions_triggered();
void OptionsSaved(bool deleteOptions);
// HTTP slots
void on_actionDownload_from_URL_triggered();

229
src/bittorrent.cpp

@ -39,6 +39,7 @@ @@ -39,6 +39,7 @@
#include "misc.h"
#include "downloadThread.h"
#include "filterParserThread.h"
#include "preferences.h"
#include "torrentPersistentData.h"
#include <libtorrent/extensions/ut_metadata.hpp>
#include <libtorrent/extensions/lt_trackers.hpp>
@ -54,6 +55,7 @@ @@ -54,6 +55,7 @@
#define MAX_TRACKER_ERRORS 2
#define MAX_RATIO 100.
enum ProxyType {HTTP=1, SOCKS5=2, HTTP_PW=3, SOCKS5_PW=4};
// Main constructor
bittorrent::bittorrent() : DHTEnabled(false), preAllocateAll(false), addInPause(false), maxConnecsPerTorrent(500), maxUploadsPerTorrent(4), ratio_limit(-1), UPnPEnabled(false), NATPMPEnabled(false), LSDEnabled(false), queueingEnabled(false) {
@ -61,8 +63,7 @@ bittorrent::bittorrent() : DHTEnabled(false), preAllocateAll(false), addInPause( @@ -61,8 +63,7 @@ bittorrent::bittorrent() : DHTEnabled(false), preAllocateAll(false), addInPause(
fs::path::default_name_check(fs::no_check);
// Creating bittorrent session
// Check if we should spoof utorrent
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
if(settings.value(QString::fromUtf8("Preferences/Bittorrent/AzureusSpoof"), false).toBool()) {
if(Preferences::isUtorrentSpoofingEnabled()) {
s = new session(fingerprint("UT", 1, 8, 5, 0), 0);
qDebug("Peer ID: %s", fingerprint("UT", 1, 8, 5, 0).to_string().c_str());
} else {
@ -88,6 +89,8 @@ bittorrent::bittorrent() : DHTEnabled(false), preAllocateAll(false), addInPause( @@ -88,6 +89,8 @@ bittorrent::bittorrent() : DHTEnabled(false), preAllocateAll(false), addInPause(
downloader = new downloadThread(this);
connect(downloader, SIGNAL(downloadFinished(QString, QString)), this, SLOT(processDownloadedFile(QString, QString)));
connect(downloader, SIGNAL(downloadFailure(QString, QString)), this, SLOT(handleDownloadFailure(QString, QString)));
// Apply user settings to Bittorrent session
configureSession();
qDebug("* BTSession constructed");
}
@ -212,6 +215,228 @@ int bittorrent::getUpTorrentPriority(QString hash) const { @@ -212,6 +215,228 @@ int bittorrent::getUpTorrentPriority(QString hash) const {
return h.queue_position();
}
// Set BT session configuration
void bittorrent::configureSession() {
qDebug("Configuring session");
// Downloads
// * Save path
setDefaultSavePath(Preferences::getSavePath());
if(Preferences::isTempPathEnabled()) {
setDefaultTempPath(Preferences::getTempPath());
} else {
setDefaultTempPath(QString::null);
}
preAllocateAllFiles(Preferences::preAllocateAllFiles());
startTorrentsInPause(Preferences::addTorrentsInPause());
// * Scan dir
QString scan_dir = Preferences::getScanDir();
if(scan_dir.isEmpty()) {
disableDirectoryScanning();
}else{
//Interval first
enableDirectoryScanning(scan_dir);
}
// Connection
// * Ports binding
unsigned short old_listenPort = getListenPort();
setListeningPort(Preferences::getSessionPort());
unsigned short new_listenPort = getListenPort();
if(new_listenPort != old_listenPort) {
addConsoleMessage(tr("qBittorrent is bound to port: TCP/%1", "e.g: qBittorrent is bound to port: 6881").arg( misc::toQString(new_listenPort)));
}
// * Global download limit
int down_limit = Preferences::getGlobalDownloadLimit();
if(down_limit <= 0) {
// Download limit disabled
setDownloadRateLimit(-1);
} else {
// Enabled
setDownloadRateLimit(down_limit*1024);
}
int up_limit = Preferences::getGlobalUploadLimit();
// * Global Upload limit
if(up_limit <= 0) {
// Upload limit disabled
setUploadRateLimit(-1);
} else {
// Enabled
setUploadRateLimit(up_limit*1024);
}
// * UPnP
if(Preferences::isUPnPEnabled()) {
enableUPnP(true);
addConsoleMessage(tr("UPnP support [ON]"), QString::fromUtf8("blue"));
} else {
enableUPnP(false);
addConsoleMessage(tr("UPnP support [OFF]"), QString::fromUtf8("blue"));
}
// * NAT-PMP
if(Preferences::isNATPMPEnabled()) {
enableNATPMP(true);
addConsoleMessage(tr("NAT-PMP support [ON]"), QString::fromUtf8("blue"));
} else {
enableNATPMP(false);
addConsoleMessage(tr("NAT-PMP support [OFF]"), QString::fromUtf8("blue"));
}
// * Session settings
session_settings sessionSettings;
if(Preferences::isUtorrentSpoofingEnabled()) {
sessionSettings.user_agent = "uTorrent/1850";
} else {
sessionSettings.user_agent = "qBittorrent "VERSION;
}
sessionSettings.upnp_ignore_nonrouters = true;
sessionSettings.use_dht_as_fallback = false;
// To keep same behavior as in qbittorrent v1.2.0
sessionSettings.rate_limit_ip_overhead = false;
// Queueing System
if(Preferences::isQueueingSystemEnabled()) {
sessionSettings.active_downloads = Preferences::getMaxActiveDownloads();
sessionSettings.active_seeds = Preferences::getMaxActiveUploads();
sessionSettings.active_limit = Preferences::getMaxActiveTorrents();
sessionSettings.dont_count_slow_torrents = false;
setQueueingEnabled(true);
} else {
sessionSettings.active_downloads = -1;
sessionSettings.active_seeds = -1;
sessionSettings.active_limit = -1;
setQueueingEnabled(false);
}
setSessionSettings(sessionSettings);
// Bittorrent
// * Max connections limit
setMaxConnections(Preferences::getMaxConnecs());
// * Max connections per torrent limit
setMaxConnectionsPerTorrent(Preferences::getMaxConnecsPerTorrent());
// * Max uploads per torrent limit
setMaxUploadsPerTorrent(Preferences::getMaxUploadsPerTorrent());
// * DHT
if(Preferences::isDHTEnabled()) {
// Set DHT Port
if(enableDHT(true)) {
int dht_port = new_listenPort;
if(!Preferences::isDHTPortSameAsBT())
dht_port = Preferences::getDHTPort();
setDHTPort(dht_port);
addConsoleMessage(tr("DHT support [ON], port: UDP/%1").arg(dht_port), QString::fromUtf8("blue"));
} else {
addConsoleMessage(tr("DHT support [OFF]"), QString::fromUtf8("red"));
}
} else {
enableDHT(false);
addConsoleMessage(tr("DHT support [OFF]"), QString::fromUtf8("blue"));
}
// * PeX
addConsoleMessage(tr("PeX support [ON]"), QString::fromUtf8("blue"));
// * LSD
if(Preferences::isLSDEnabled()) {
enableLSD(true);
addConsoleMessage(tr("Local Peer Discovery [ON]"), QString::fromUtf8("blue"));
} else {
enableLSD(false);
addConsoleMessage(tr("Local Peer Discovery support [OFF]"), QString::fromUtf8("blue"));
}
// * Encryption
int encryptionState = Preferences::getEncryptionSetting();
// The most secure, rc4 only so that all streams and encrypted
pe_settings encryptionSettings;
encryptionSettings.allowed_enc_level = pe_settings::rc4;
encryptionSettings.prefer_rc4 = true;
switch(encryptionState) {
case 0: //Enabled
encryptionSettings.out_enc_policy = pe_settings::enabled;
encryptionSettings.in_enc_policy = pe_settings::enabled;
addConsoleMessage(tr("Encryption support [ON]"), QString::fromUtf8("blue"));
break;
case 1: // Forced
encryptionSettings.out_enc_policy = pe_settings::forced;
encryptionSettings.in_enc_policy = pe_settings::forced;
addConsoleMessage(tr("Encryption support [FORCED]"), QString::fromUtf8("blue"));
break;
default: // Disabled
encryptionSettings.out_enc_policy = pe_settings::disabled;
encryptionSettings.in_enc_policy = pe_settings::disabled;
addConsoleMessage(tr("Encryption support [OFF]"), QString::fromUtf8("blue"));
}
applyEncryptionSettings(encryptionSettings);
// * Desired ratio
setGlobalRatio(Preferences::getDesiredRatio());
// * Maximum ratio
setDeleteRatio(Preferences::getDeleteRatio());
// Ip Filter
if(Preferences::isFilteringEnabled()) {
enableIPFilter(Preferences::getFilter());
}else{
disableIPFilter();
}
// * Proxy settings
proxy_settings proxySettings;
if(Preferences::isProxyEnabled()) {
qDebug("Enabling P2P proxy");
proxySettings.hostname = Preferences::getProxyIp().toStdString();
qDebug("hostname is %s", proxySettings.hostname.c_str());
proxySettings.port = Preferences::getProxyPort();
qDebug("port is %d", proxySettings.port);
if(Preferences::isProxyAuthEnabled()) {
proxySettings.username = Preferences::getProxyUsername().toStdString();
proxySettings.password = Preferences::getProxyPassword().toStdString();
qDebug("username is %s", proxySettings.username.c_str());
qDebug("password is %s", proxySettings.password.c_str());
}
switch(Preferences::getProxyType()) {
case HTTP:
qDebug("type: http");
proxySettings.type = proxy_settings::http;
break;
case HTTP_PW:
qDebug("type: http_pw");
proxySettings.type = proxy_settings::http_pw;
break;
case SOCKS5:
qDebug("type: socks5");
proxySettings.type = proxy_settings::socks5;
break;
default:
qDebug("type: socks5_pw");
proxySettings.type = proxy_settings::socks5_pw;
break;
}
setProxySettings(proxySettings, Preferences::useProxyForTrackers(), Preferences::useProxyForPeers(), Preferences::useProxyForWebseeds(), Preferences::useProxyForDHT());
} else {
qDebug("Disabling P2P proxy");
setProxySettings(proxySettings, false, false, false, false);
}
if(Preferences::isHTTPProxyEnabled()) {
qDebug("Enabling Search HTTP proxy");
// HTTP Proxy
QString proxy_str;
switch(Preferences::getHTTPProxyType()) {
case HTTP_PW:
proxy_str = "http://"+Preferences::getHTTPProxyUsername()+":"+Preferences::getHTTPProxyPassword()+"@"+Preferences::getHTTPProxyIp()+":"+QString::number(Preferences::getHTTPProxyPort());
break;
default:
proxy_str = "http://"+Preferences::getHTTPProxyIp()+":"+QString::number(Preferences::getHTTPProxyPort());
}
// We need this for urllib in search engine plugins
#ifdef Q_WS_WIN
char proxystr[512];
snprintf(proxystr, 512, "http_proxy=%s", proxy_str.toLocal8Bit().data());
putenv(proxystr);
#else
qDebug("HTTP: proxy string: %s", proxy_str.toLocal8Bit().data());
setenv("http_proxy", proxy_str.toLocal8Bit().data(), 1);
#endif
} else {
qDebug("Disabling search proxy");
#ifdef Q_WS_WIN
putenv("http_proxy=");
#else
unsetenv("http_proxy");
#endif
}
qDebug("Session configured");
}
// Calculate the ETA using GASA
// GASA: global Average Speed Algorithm
qlonglong bittorrent::getETA(QString hash) const {

1
src/bittorrent.h

@ -168,6 +168,7 @@ class bittorrent : public QObject { @@ -168,6 +168,7 @@ class bittorrent : public QObject {
void saveTrackerFile(QString hash);
void addMagnetSkipAddDlg(QString uri);
void downloadFromURLList(const QStringList& urls);
void configureSession();
protected slots:
void addTorrentsFromScanFolder(QStringList&);

33
src/options.ui

@ -209,7 +209,7 @@ @@ -209,7 +209,7 @@
<item>
<widget class="QStackedWidget" name="tabOption">
<property name="currentIndex">
<number>0</number>
<number>2</number>
</property>
<widget class="QWidget" name="tabOptionPage1">
<layout class="QVBoxLayout" name="verticalLayout_10">
@ -382,7 +382,7 @@ @@ -382,7 +382,7 @@
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string>transfer lists refresh interval:</string>
<string>Transfer list refresh interval:</string>
</property>
</widget>
</item>
@ -1081,9 +1081,9 @@ @@ -1081,9 +1081,9 @@
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>620</width>
<height>480</height>
<y>-4</y>
<width>602</width>
<height>513</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_18">
@ -1443,6 +1443,29 @@ @@ -1443,6 +1443,29 @@
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Peer connections</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_25">
<item>
<widget class="QCheckBox" name="checkResolveCountries">
<property name="text">
<string>Resolve peer countries</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkResolveHosts">
<property name="text">
<string>Resolve peer host names</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer_7">
<property name="orientation">

520
src/options_imp.cpp

@ -42,22 +42,24 @@ @@ -42,22 +42,24 @@
#include <QCloseEvent>
#include <QDesktopWidget>
#ifdef Q_WS_WIN
#include <QWindowsXPStyle>
#include <QWindowsXPStyle>
#endif
#ifdef Q_WS_MAC
#include <QMacStyle>
#include <QMacStyle>
#endif
#include <time.h>
#include <stdlib.h>
#include "options_imp.h"
#include "preferences.h"
#include "misc.h"
// Constructor
options_imp::options_imp(QWidget *parent):QDialog(parent){
qDebug("-> Constructing Options");
setAttribute(Qt::WA_DeleteOnClose);
QString savePath;
setupUi(this);
// Get apply button in button box
@ -140,32 +142,32 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){ @@ -140,32 +142,32 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
}
// Connect signals / slots
// General tab
connect(checkNoSystray, SIGNAL(stateChanged(int)), this, SLOT(setSystrayOptionsState(int)));
connect(checkNoSystray, SIGNAL(toggled(bool)), this, SLOT(setSystrayOptionsState(bool)));
// Downloads tab
connect(checkTempFolder, SIGNAL(stateChanged(int)), this, SLOT(enableTempPathInput(int)));
connect(checkScanDir, SIGNAL(stateChanged(int)), this, SLOT(enableDirScan(int)));
connect(checkTempFolder, SIGNAL(toggled(bool)), this, SLOT(enableTempPathInput(bool)));
connect(checkScanDir, SIGNAL(toggled(bool)), this, SLOT(enableDirScan(bool)));
connect(actionTorrentDlOnDblClBox, SIGNAL(currentIndexChanged(int)), this, SLOT(enableApplyButton()));
connect(actionTorrentFnOnDblClBox, SIGNAL(currentIndexChanged(int)), this, SLOT(enableApplyButton()));
connect(checkTempFolder, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
connect(checkTempFolder, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
// Connection tab
connect(checkUploadLimit, SIGNAL(stateChanged(int)), this, SLOT(enableUploadLimit(int)));
connect(checkDownloadLimit, SIGNAL(stateChanged(int)), this, SLOT(enableDownloadLimit(int)));
connect(checkUploadLimit, SIGNAL(toggled(bool)), this, SLOT(enableUploadLimit(bool)));
connect(checkDownloadLimit, SIGNAL(toggled(bool)), this, SLOT(enableDownloadLimit(bool)));
// Bittorrent tab
connect(checkMaxConnecs, SIGNAL(stateChanged(int)), this, SLOT(enableMaxConnecsLimit(int)));
connect(checkMaxConnecsPerTorrent, SIGNAL(stateChanged(int)), this, SLOT(enableMaxConnecsLimitPerTorrent(int)));
connect(checkMaxUploadsPerTorrent, SIGNAL(stateChanged(int)), this, SLOT(enableMaxUploadsLimitPerTorrent(int)));
connect(checkRatioLimit, SIGNAL(stateChanged(int)), this, SLOT(enableShareRatio(int)));
connect(checkRatioRemove, SIGNAL(stateChanged(int)), this, SLOT(enableDeleteRatio(int)));
connect(checkSameDHTPort, SIGNAL(stateChanged(int)), this, SLOT(enableDHTPortSettings(int)));
connect(checkMaxConnecs, SIGNAL(toggled(bool)), this, SLOT(enableMaxConnecsLimit(bool)));
connect(checkMaxConnecsPerTorrent, SIGNAL(toggled(bool)), this, SLOT(enableMaxConnecsLimitPerTorrent(bool)));
connect(checkMaxUploadsPerTorrent, SIGNAL(toggled(bool)), this, SLOT(enableMaxUploadsLimitPerTorrent(bool)));
connect(checkRatioLimit, SIGNAL(toggled(bool)), this, SLOT(enableShareRatio(bool)));
connect(checkRatioRemove, SIGNAL(toggled(bool)), this, SLOT(enableDeleteRatio(bool)));
connect(checkSameDHTPort, SIGNAL(toggled(bool)), this, SLOT(enableDHTPortSettings(bool)));
// Proxy tab
connect(comboProxyType_http, SIGNAL(currentIndexChanged(int)),this, SLOT(enableProxyHTTP(int)));
connect(checkProxyAuth_http, SIGNAL(stateChanged(int)), this, SLOT(enableProxyAuthHTTP(int)));
connect(checkProxyAuth_http, SIGNAL(toggled(bool)), this, SLOT(enableProxyAuthHTTP(bool)));
connect(comboProxyType, SIGNAL(currentIndexChanged(int)),this, SLOT(enableProxy(int)));
connect(checkProxyAuth, SIGNAL(stateChanged(int)), this, SLOT(enableProxyAuth(int)));
connect(checkProxyAuth, SIGNAL(toggled(bool)), this, SLOT(enableProxyAuth(bool)));
// Misc tab
connect(checkIPFilter, SIGNAL(stateChanged(int)), this, SLOT(enableFilter(int)));
connect(checkEnableRSS, SIGNAL(stateChanged(int)), this, SLOT(enableRSS(int)));
connect(checkEnableQueueing, SIGNAL(stateChanged(int)), this, SLOT(enableQueueingSystem(int)));
connect(checkIPFilter, SIGNAL(toggled(bool)), this, SLOT(enableFilter(bool)));
connect(checkEnableRSS, SIGNAL(toggled(bool)), this, SLOT(enableRSS(bool)));
connect(checkEnableQueueing, SIGNAL(toggled(bool)), this, SLOT(enableQueueingSystem(bool)));
// Web UI tab
connect(checkWebUi, SIGNAL(toggled(bool)), this, SLOT(enableWebUi(bool)));
@ -173,72 +175,74 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){ @@ -173,72 +175,74 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
// General tab
connect(comboI18n, SIGNAL(currentIndexChanged(int)), this, SLOT(enableApplyButton()));
connect(comboStyle, SIGNAL(currentIndexChanged(int)), this, SLOT(enableApplyButton()));
connect(checkConfirmExit, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
connect(checkSpeedInTitle, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
connect(checkConfirmExit, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(checkSpeedInTitle, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(spinRefreshInterval, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton()));
connect(checkNoSystray, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
connect(checkCloseToSystray, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
connect(checkMinimizeToSysTray, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
connect(checkStartMinimized, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
connect(checkSystrayBalloons, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
connect(checkDisplayToolbar, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
connect(checkNoSplash, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
connect(checkNoSystray, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(checkCloseToSystray, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(checkMinimizeToSysTray, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(checkStartMinimized, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(checkSystrayBalloons, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(checkDisplayToolbar, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(checkNoSplash, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
// Downloads tab
connect(textSavePath, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton()));
connect(checkPreallocateAll, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
connect(checkAdditionDialog, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
connect(checkStartPaused, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
connect(checkScanDir, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
connect(checkPreallocateAll, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(checkAdditionDialog, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(checkStartPaused, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(checkScanDir, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(textScanDir, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton()));
// Connection tab
connect(spinPort, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton()));
connect(checkUPnP, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
connect(checkNATPMP, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
connect(checkUploadLimit, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
connect(checkDownloadLimit, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
connect(checkUPnP, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(checkNATPMP, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(checkUploadLimit, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(checkDownloadLimit, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(spinUploadLimit, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton()));
connect(spinDownloadLimit, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton()));
connect(checkResolveCountries, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(checkResolveHosts, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
// Bittorrent tab
connect(checkMaxConnecs, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
connect(checkMaxConnecsPerTorrent, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
connect(checkMaxUploadsPerTorrent, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
connect(checkMaxConnecs, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(checkMaxConnecsPerTorrent, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(checkMaxUploadsPerTorrent, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(spinMaxConnec, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton()));
connect(spinMaxConnecPerTorrent, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton()));
connect(spinMaxUploadsPerTorrent, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton()));
connect(checkDHT, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
connect(checkSameDHTPort, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
connect(checkDHT, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(checkSameDHTPort, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(spinDHTPort, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton()));
connect(checkLSD, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
connect(checkAzureusSpoof, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
connect(checkLSD, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(checkAzureusSpoof, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(comboEncryption, SIGNAL(currentIndexChanged(int)), this, SLOT(enableApplyButton()));
connect(checkRatioLimit, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
connect(checkRatioRemove, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
connect(checkRatioLimit, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(checkRatioRemove, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(spinRatio, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton()));
connect(spinMaxRatio, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton()));
// Proxy tab
connect(comboProxyType_http, SIGNAL(currentIndexChanged(int)), this, SLOT(enableApplyButton()));
connect(textProxyIP_http, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton()));
connect(spinProxyPort_http, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton()));
connect(checkProxyAuth_http, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
connect(checkProxyAuth_http, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(textProxyUsername_http, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton()));
connect(textProxyPassword_http, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton()));
connect(comboProxyType, SIGNAL(currentIndexChanged(int)), this, SLOT(enableApplyButton()));
connect(textProxyIP, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton()));
connect(spinProxyPort, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton()));
connect(checkProxyAuth, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
connect(checkProxyAuth, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(textProxyUsername, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton()));
connect(textProxyPassword, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton()));
connect(checkProxyTrackers, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
connect(checkProxyPeers, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
connect(checkProxyWebseeds, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
connect(checkProxyDHT, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
connect(checkProxyTrackers, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(checkProxyPeers, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(checkProxyWebseeds, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(checkProxyDHT, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
// Misc tab
connect(checkIPFilter, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
connect(checkIPFilter, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(textFilterPath, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton()));
connect(spinRSSRefresh, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton()));
connect(spinRSSMaxArticlesPerFeed, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton()));
connect(checkEnableRSS, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
connect(checkEnableQueueing, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
connect(checkEnableRSS, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(checkEnableQueueing, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(spinMaxActiveDownloads, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton()));
connect(spinMaxActiveUploads, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton()));
connect(spinMaxActiveTorrents, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton()));
@ -258,6 +262,7 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){ @@ -258,6 +262,7 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
connect(tabSelection, SIGNAL(currentItemChanged(QListWidgetItem *, QListWidgetItem *)), this, SLOT(changePage(QListWidgetItem *, QListWidgetItem*)));
// Adapt size
adaptToScreenSize();
show();
}
// Main destructor
@ -269,7 +274,7 @@ void options_imp::changePage(QListWidgetItem *current, QListWidgetItem *previous @@ -269,7 +274,7 @@ void options_imp::changePage(QListWidgetItem *current, QListWidgetItem *previous
if (!current)
current = previous;
tabOption->setCurrentIndex(tabSelection->row(current));
}
}
void options_imp::useStyle(){
int style = getStyle();
@ -403,7 +408,7 @@ void options_imp::saveOptions(){ @@ -403,7 +408,7 @@ void options_imp::saveOptions(){
settings.setValue(QString::fromUtf8("sameDHTPortAsBT"), isDHTPortSameAsBT());
settings.setValue(QString::fromUtf8("DHTPort"), getDHTPort());
settings.setValue(QString::fromUtf8("LSD"), isLSDEnabled());
settings.setValue(QString::fromUtf8("AzureusSpoof"), shouldSpoofAzureus());
settings.setValue(QString::fromUtf8("utorrentSpoof"), isUtorrentSpoofingEnabled());
settings.setValue(QString::fromUtf8("Encryption"), getEncryptionSetting());
settings.setValue(QString::fromUtf8("DesiredRatio"), getDesiredRatio());
settings.setValue(QString::fromUtf8("MaxRatio"), getDeleteRatio());
@ -448,7 +453,7 @@ void options_imp::saveOptions(){ @@ -448,7 +453,7 @@ void options_imp::saveOptions(){
settings.endGroup();
}
bool options_imp::shouldSpoofAzureus() const {
bool options_imp::isUtorrentSpoofingEnabled() const {
return checkAzureusSpoof->isChecked();
}
@ -512,83 +517,72 @@ void options_imp::setStyle(int style){ @@ -512,83 +517,72 @@ void options_imp::setStyle(int style){
comboStyle->setCurrentIndex(style);
}
bool options_imp::isHTTPProxyAuthEnabled() const{
return checkProxyAuth_http->isChecked();
}
void options_imp::loadOptions(){
int intValue;
float floatValue;
QString strValue;
QSettings settings("qBittorrent", "qBittorrent");
settings.beginGroup("Preferences");
// General preferences
settings.beginGroup("General");
setLocale(settings.value(QString::fromUtf8("Locale"), "en_GB").toString());
setStyle(settings.value(QString::fromUtf8("Style"), 0).toInt());
checkConfirmExit->setChecked(settings.value(QString::fromUtf8("ExitConfirm"), true).toBool());
checkSpeedInTitle->setChecked(settings.value(QString::fromUtf8("SpeedInTitleBar"), false).toBool());
spinRefreshInterval->setValue(settings.value(QString::fromUtf8("RefreshInterval"), 1500).toInt());
checkNoSystray->setChecked(!settings.value(QString::fromUtf8("SystrayEnabled"), true).toBool());
checkDisplayToolbar->setChecked(settings.value(QString::fromUtf8("ToolbarDisplayed"), true).toBool());
checkNoSplash->setChecked(settings.value(QString::fromUtf8("NoSplashScreen"), false).toBool());
if(!systrayIntegration()) {
setLocale(Preferences::getLocale());
setStyle(Preferences::getStyle());
checkConfirmExit->setChecked(Preferences::confirmOnExit());
checkSpeedInTitle->setChecked(Preferences::speedInTitleBar());
spinRefreshInterval->setValue(Preferences::getRefreshInterval());
checkNoSystray->setChecked(!Preferences::systrayIntegration());
checkDisplayToolbar->setChecked(Preferences::isToolbarDisplayed());
checkNoSplash->setChecked(Preferences::isSlashScreenDisabled());
if(checkNoSystray->isChecked()) {
disableSystrayOptions();
} else {
enableSystrayOptions();
checkCloseToSystray->setChecked(settings.value(QString::fromUtf8("CloseToTray"), false).toBool());
checkMinimizeToSysTray->setChecked(settings.value(QString::fromUtf8("MinimizeToTray"), false).toBool());
checkStartMinimized->setChecked(settings.value(QString::fromUtf8("StartMinimized"), false).toBool());
checkSystrayBalloons->setChecked(settings.value(QString::fromUtf8("NotificationBaloons"), true).toBool());
checkCloseToSystray->setChecked(Preferences::closeToTray());
checkMinimizeToSysTray->setChecked(Preferences::minimizeToTray());
checkStartMinimized->setChecked(Preferences::startMinimized());
checkSystrayBalloons->setChecked(Preferences::OSDEnabled());
}
// End General preferences
settings.endGroup();
// Downloads preferences
settings.beginGroup("Downloads");
#ifdef Q_WS_WIN
QString home = QDir::rootPath();
#else
QString home = QDir::homePath();
#endif
if(home[home.length()-1] != QDir::separator()){
home += QDir::separator();
}
textSavePath->setText(settings.value(QString::fromUtf8("SavePath"), home+"qBT_dir").toString());
if(settings.value(QString::fromUtf8("TempPathEnabled"), false).toBool()) {
textSavePath->setText(Preferences::getSavePath());
if(Preferences::isTempPathEnabled()) {
// enable
checkTempFolder->setChecked(true);
enableTempPathInput(2);
enableTempPathInput(checkTempFolder->isChecked());
} else {
checkTempFolder->setChecked(false);
enableTempPathInput(0);
enableTempPathInput(checkTempFolder->isChecked());
}
textTempPath->setText(settings.value(QString::fromUtf8("TempPath"), home+"qBT_dir"+QDir::separator()+"temp").toString());
checkPreallocateAll->setChecked(settings.value(QString::fromUtf8("PreAllocation"), false).toBool());
checkAdditionDialog->setChecked(settings.value(QString::fromUtf8("AdditionDialog"), true).toBool());
checkStartPaused->setChecked(settings.value(QString::fromUtf8("StartInPause"), false).toBool());
strValue = settings.value(QString::fromUtf8("ScanDir"), QString()).toString();
textTempPath->setText(Preferences::getTempPath());
checkPreallocateAll->setChecked(Preferences::preAllocateAllFiles());
checkAdditionDialog->setChecked(Preferences::useAdditionDialog());
checkStartPaused->setChecked(Preferences::addTorrentsInPause());
strValue = Preferences::getSavePath();
if(strValue.isEmpty()) {
// Disable
checkScanDir->setChecked(false);
enableDirScan(0);
enableDirScan(checkScanDir->isChecked());
} else {
// enable
checkScanDir->setChecked(true);
textScanDir->setText(strValue);
enableDirScan(2);
enableDirScan(checkScanDir->isChecked());
}
intValue = settings.value(QString::fromUtf8("DblClOnTorDl"), 0).toInt();
intValue = Preferences::getActionOnDblClOnTorrentDl();
if(intValue >= actionTorrentDlOnDblClBox->count())
intValue = 0;
actionTorrentDlOnDblClBox->setCurrentIndex(intValue);
intValue = settings.value(QString::fromUtf8("DblClOnTorFn"), 1).toInt();
intValue = Preferences::getActionOnDblClOnTorrentFn();
if(intValue >= actionTorrentFnOnDblClBox->count())
intValue = 1;
actionTorrentFnOnDblClBox->setCurrentIndex(intValue);
// End Downloads preferences
settings.endGroup();
// Connection preferences
settings.beginGroup("Connection");
spinPort->setValue(settings.value(QString::fromUtf8("PortRangeMin"), 6881).toInt());
checkUPnP->setChecked(settings.value(QString::fromUtf8("UPnP"), true).toBool());
checkNATPMP->setChecked(settings.value(QString::fromUtf8("NAT-PMP"), true).toBool());
intValue = settings.value(QString::fromUtf8("GlobalDLLimit"), -1).toInt();
spinPort->setValue(Preferences::getSessionPort());
checkUPnP->setChecked(Preferences::isUPnPEnabled());
checkNATPMP->setChecked(Preferences::isNATPMPEnabled());
intValue = Preferences::getGlobalDownloadLimit();
if(intValue > 0) {
// Enabled
checkDownloadLimit->setChecked(true);
@ -599,7 +593,7 @@ void options_imp::loadOptions(){ @@ -599,7 +593,7 @@ void options_imp::loadOptions(){
checkDownloadLimit->setChecked(false);
spinDownloadLimit->setEnabled(false);
}
intValue = settings.value(QString::fromUtf8("GlobalUPLimit"), 50).toInt();
intValue = Preferences::getGlobalUploadLimit();
if(intValue != -1) {
// Enabled
checkUploadLimit->setChecked(true);
@ -610,7 +604,7 @@ void options_imp::loadOptions(){ @@ -610,7 +604,7 @@ void options_imp::loadOptions(){
checkUploadLimit->setChecked(false);
spinUploadLimit->setEnabled(false);
}
intValue = settings.value(QString::fromUtf8("ProxyType"), 0).toInt();
intValue = Preferences::getProxyType();
if(intValue <= 0) {
intValue = 0;
} else {
@ -623,27 +617,20 @@ void options_imp::loadOptions(){ @@ -623,27 +617,20 @@ void options_imp::loadOptions(){
comboProxyType->setCurrentIndex(intValue);
enableProxy(intValue);
//if(isProxyEnabled()) {
settings.beginGroup("Proxy");
// Proxy is enabled, save settings
textProxyIP->setText(settings.value(QString::fromUtf8("IP"), "0.0.0.0").toString());
spinProxyPort->setValue(settings.value(QString::fromUtf8("Port"), 8080).toInt());
checkProxyAuth->setChecked(settings.value(QString::fromUtf8("Authentication"), false).toBool());
textProxyUsername->setText(settings.value(QString::fromUtf8("Username"), QString()).toString());
textProxyPassword->setText(settings.value(QString::fromUtf8("Password"), QString()).toString());
if(isProxyAuthEnabled()) {
enableProxyAuth(2); // Enable
// Credentials
} else {
enableProxyAuth(0); // Disable
}
textProxyIP->setText(Preferences::getProxyIp());
spinProxyPort->setValue(Preferences::getProxyPort());
checkProxyAuth->setChecked(Preferences::isProxyAuthEnabled());
textProxyUsername->setText(Preferences::getProxyUsername());
textProxyPassword->setText(Preferences::getProxyPassword());
enableProxyAuth(checkProxyAuth->isChecked());
// Affected connections
checkProxyTrackers->setChecked(settings.value(QString::fromUtf8("AffectTrackers"), true).toBool());
checkProxyPeers->setChecked(settings.value(QString::fromUtf8("AffectPeers"), true).toBool());
checkProxyWebseeds->setChecked(settings.value(QString::fromUtf8("AffectWebSeeds"), true).toBool());
checkProxyDHT->setChecked(settings.value(QString::fromUtf8("AffectDHT"), true).toBool());
settings.endGroup(); // End Proxy
checkProxyTrackers->setChecked(Preferences::useProxyForTrackers());
checkProxyPeers->setChecked(Preferences::useProxyForPeers());
checkProxyWebseeds->setChecked(Preferences::useProxyForWebseeds());
checkProxyDHT->setChecked(Preferences::useProxyForDHT());
//}
intValue = settings.value(QString::fromUtf8("HTTPProxyType"), 0).toInt();
intValue = Preferences::getHTTPProxyType();
if(intValue <= 0) {
intValue = 0;
} else {
@ -651,28 +638,17 @@ void options_imp::loadOptions(){ @@ -651,28 +638,17 @@ void options_imp::loadOptions(){
}
comboProxyType_http->setCurrentIndex(intValue);
enableProxyHTTP(intValue);
settings.beginGroup("HTTPProxy");
textProxyUsername_http->setText(settings.value(QString::fromUtf8("Username"), QString()).toString());
textProxyPassword_http->setText(settings.value(QString::fromUtf8("Password"), QString()).toString());
textProxyIP_http->setText(settings.value(QString::fromUtf8("IP"), "0.0.0.0").toString());
spinProxyPort_http->setValue(settings.value(QString::fromUtf8("Port"), 8080).toInt());
checkProxyAuth_http->setChecked(settings.value(QString::fromUtf8("Authentication"), false).toBool());
if(isHTTPProxyEnabled()) {
if(isHTTPProxyAuthEnabled()) {
enableProxyAuthHTTP(2); // Enable
} else {
enableProxyAuthHTTP(0); // Disable
}
} else {
enableProxyAuthHTTP(0); // Disable
}
settings.endGroup(); // End HTTPProxy
textProxyUsername_http->setText(Preferences::getHTTPProxyUsername());
textProxyPassword_http->setText(Preferences::getHTTPProxyPassword());
textProxyIP_http->setText(Preferences::getHTTPProxyIp());
spinProxyPort_http->setValue(Preferences::getHTTPProxyPort());
checkProxyAuth_http->setChecked(Preferences::isHTTPProxyAuthEnabled());
enableProxyAuthHTTP(checkProxyAuth_http->isChecked());
// End HTTPProxy
// End Connection preferences
settings.endGroup();
// Bittorrent preferences
settings.beginGroup("Bittorrent");
intValue = settings.value(QString::fromUtf8("MaxConnecs"), 500).toInt();
if(intValue != -1) {
intValue = Preferences::getMaxConnecs();
if(intValue > 0) {
// enable
checkMaxConnecs->setChecked(true);
spinMaxConnec->setEnabled(true);
@ -682,8 +658,8 @@ void options_imp::loadOptions(){ @@ -682,8 +658,8 @@ void options_imp::loadOptions(){
checkMaxConnecs->setChecked(false);
spinMaxConnec->setEnabled(false);
}
intValue = settings.value(QString::fromUtf8("MaxConnecsPerTorrent"), 100).toInt();
if(intValue != -1) {
intValue = Preferences::getMaxConnecsPerTorrent();
if(intValue > 0) {
// enable
checkMaxConnecsPerTorrent->setChecked(true);
spinMaxConnecPerTorrent->setEnabled(true);
@ -693,8 +669,8 @@ void options_imp::loadOptions(){ @@ -693,8 +669,8 @@ void options_imp::loadOptions(){
checkMaxConnecsPerTorrent->setChecked(false);
spinMaxConnecPerTorrent->setEnabled(false);
}
intValue = settings.value(QString::fromUtf8("MaxUploadsPerTorrent"), 4).toInt();
if(intValue != -1) {
intValue = Preferences::getMaxUploadsPerTorrent();
if(intValue > 0) {
// enable
checkMaxUploadsPerTorrent->setChecked(true);
spinMaxUploadsPerTorrent->setEnabled(true);
@ -704,14 +680,14 @@ void options_imp::loadOptions(){ @@ -704,14 +680,14 @@ void options_imp::loadOptions(){
checkMaxUploadsPerTorrent->setChecked(false);
spinMaxUploadsPerTorrent->setEnabled(false);
}
checkDHT->setChecked(settings.value(QString::fromUtf8("DHT"), true).toBool());
checkSameDHTPort->setChecked(settings.value(QString::fromUtf8("sameDHTPortAsBT"), true).toBool());
enableDHTPortSettings(checkSameDHTPort->checkState());
spinDHTPort->setValue(settings.value(QString::fromUtf8("DHTPort"), 6882).toInt());
checkLSD->setChecked(settings.value(QString::fromUtf8("LSD"), true).toBool());
checkAzureusSpoof->setChecked(settings.value(QString::fromUtf8("AzureusSpoof"), false).toBool());
comboEncryption->setCurrentIndex(settings.value(QString::fromUtf8("Encryption"), 0).toInt());
floatValue = settings.value(QString::fromUtf8("DesiredRatio"), -1).toDouble();
checkDHT->setChecked(Preferences::isDHTEnabled());
checkSameDHTPort->setChecked(Preferences::isDHTPortSameAsBT());
enableDHTPortSettings(checkSameDHTPort->isChecked());
spinDHTPort->setValue(Preferences::getDHTPort());
checkLSD->setChecked(Preferences::isLSDEnabled());
checkAzureusSpoof->setChecked(Preferences::isUtorrentSpoofingEnabled());
comboEncryption->setCurrentIndex(Preferences::getEncryptionSetting());
floatValue = Preferences::getDesiredRatio();
if(floatValue >= 1.) {
// Enable
checkRatioLimit->setChecked(true);
@ -722,7 +698,7 @@ void options_imp::loadOptions(){ @@ -722,7 +698,7 @@ void options_imp::loadOptions(){
checkRatioLimit->setChecked(false);
spinRatio->setEnabled(false);
}
floatValue = settings.value(QString::fromUtf8("MaxRatio"), -1).toDouble();
floatValue = Preferences::getDeleteRatio();
if(floatValue >= 1.) {
// Enable
checkRatioRemove->setChecked(true);
@ -734,53 +710,32 @@ void options_imp::loadOptions(){ @@ -734,53 +710,32 @@ void options_imp::loadOptions(){
spinMaxRatio->setEnabled(false);
}
// End Bittorrent preferences
settings.endGroup();
// Misc preferences
// * IP Filter
settings.beginGroup("IPFilter");
checkIPFilter->setChecked(settings.value(QString::fromUtf8("Enabled"), false).toBool());
if(isFilteringEnabled()) {
enableFilter(2); // Enable
textFilterPath->setText(settings.value(QString::fromUtf8("File"), QString()).toString());
} else {
enableFilter(0); // Disable
}
checkIPFilter->setChecked(Preferences::isFilteringEnabled());
enableFilter(checkIPFilter->isChecked());
textFilterPath->setText(Preferences::getFilter());
// End IP Filter
settings.endGroup();
// * RSS
settings.beginGroup("RSS");
checkEnableRSS->setChecked(settings.value(QString::fromUtf8("RSSEnabled"), false).toBool());
if(isRSSEnabled()) {
enableRSS(2); // Enable
} else {
enableRSS(0); // Disable
}
spinRSSRefresh->setValue(settings.value(QString::fromUtf8("RSSRefresh"), 5).toInt());
spinRSSMaxArticlesPerFeed->setValue(settings.value(QString::fromUtf8("RSSMaxArticlesPerFeed"), 50).toInt());
checkEnableRSS->setChecked(Preferences::isRSSEnabled());
enableRSS(checkEnableRSS->isChecked());
spinRSSRefresh->setValue(Preferences::getRSSRefreshInterval());
spinRSSMaxArticlesPerFeed->setValue(Preferences::getRSSMaxArticlesPerFeed());
// End RSS preferences
settings.endGroup();
// Queueing system preferences
settings.beginGroup("Queueing");
checkEnableQueueing->setChecked(settings.value("QueueingEnabled", false).toBool());
if(isQueueingSystemEnabled()) {
enableQueueingSystem(2); // Enable
spinMaxActiveDownloads->setValue(settings.value(QString::fromUtf8("MaxActiveDownloads"), 3).toInt());
spinMaxActiveUploads->setValue(settings.value(QString::fromUtf8("MaxActiveUploads"), 3).toInt());
spinMaxActiveTorrents->setValue(settings.value(QString::fromUtf8("MaxActiveTorrents"), 5).toInt());
} else {
enableQueueingSystem(0); // Disable
}
checkEnableQueueing->setChecked(Preferences::isQueueingSystemEnabled());
enableQueueingSystem(checkEnableQueueing->isChecked());
spinMaxActiveDownloads->setValue(Preferences::getMaxActiveDownloads());
spinMaxActiveUploads->setValue(Preferences::getMaxActiveUploads());
spinMaxActiveTorrents->setValue(Preferences::getMaxActiveTorrents());
// End Queueing system preferences
settings.endGroup();
// Web UI
settings.beginGroup("WebUI");
checkWebUi->setChecked(settings.value("Enabled", false).toBool());
enableWebUi(isWebUiEnabled());
spinWebUiPort->setValue(settings.value("Port", 8080).toInt());
textWebUiUsername->setText(settings.value("Username", "user").toString());
textWebUiPassword->setText(settings.value("Password", "").toString());
checkWebUi->setChecked(Preferences::isWebUiEnabled());
enableWebUi(checkWebUi->isChecked());
spinWebUiPort->setValue(Preferences::getWebUiPort());
textWebUiUsername->setText(Preferences::getWebUiUsername());
textWebUiPassword->setText(Preferences::getWebUiPassword());
// End Web UI
settings.endGroup();
// Random stuff
srand(time(0));
}
@ -887,9 +842,9 @@ bool options_imp::systrayIntegration() const{ @@ -887,9 +842,9 @@ bool options_imp::systrayIntegration() const{
}
int options_imp::getDHTPort() const {
if(isDHTPortSameAsBT())
if(isDHTPortSameAsBT())
return 0;
return spinDHTPort->value();
return spinDHTPort->value();
}
// Return Share ratio
@ -961,19 +916,16 @@ void options_imp::on_buttonBox_accepted(){ @@ -961,19 +916,16 @@ void options_imp::on_buttonBox_accepted(){
if(applyButton->isEnabled()){
saveOptions();
applyButton->setEnabled(false);
// set infobar text
this->hide();
emit status_changed(true);
}else{
setAttribute(Qt::WA_DeleteOnClose);
accept();
emit status_changed();
}
accept();
}
void options_imp::applySettings(QAbstractButton* button) {
if(button == applyButton){
saveOptions();
emit status_changed(false);
emit status_changed();
}
}
@ -987,25 +939,21 @@ void options_imp::on_buttonBox_rejected(){ @@ -987,25 +939,21 @@ void options_imp::on_buttonBox_rejected(){
reject();
}
void options_imp::enableDownloadLimit(int checkBoxValue){
if(checkBoxValue != 2){
//Disable
spinDownloadLimit->setEnabled(false);
}else{
//enable
void options_imp::enableDownloadLimit(bool checked){
if(checked){
spinDownloadLimit->setEnabled(true);
}else{
spinDownloadLimit->setEnabled(false);
}
}
void options_imp::enableTempPathInput(int checkBoxValue){
if(checkBoxValue != 2){
//Disable
textTempPath->setEnabled(false);
browseTempDirButton->setEnabled(false);
}else{
//enable
void options_imp::enableTempPathInput(bool checked){
if(checked){
textTempPath->setEnabled(true);
browseTempDirButton->setEnabled(true);
}else{
textTempPath->setEnabled(false);
browseTempDirButton->setEnabled(false);
}
}
@ -1013,43 +961,37 @@ bool options_imp::useAdditionDialog() const{ @@ -1013,43 +961,37 @@ bool options_imp::useAdditionDialog() const{
return checkAdditionDialog->isChecked();
}
void options_imp::enableMaxConnecsLimit(int checkBoxValue){
if(checkBoxValue != 2){
//Disable
spinMaxConnec->setEnabled(false);
}else{
//enable
void options_imp::enableMaxConnecsLimit(bool checked){
if(checked) {
spinMaxConnec->setEnabled(true);
}else{
spinMaxConnec->setEnabled(false);
}
}
void options_imp::enableQueueingSystem(int checkBoxValue) {
if(checkBoxValue != 2) {
//Disable
spinMaxActiveDownloads->setEnabled(false);
spinMaxActiveUploads->setEnabled(false);
label_max_active_dl->setEnabled(false);
label_max_active_up->setEnabled(false);
maxActiveTorrents_lbl->setEnabled(false);
spinMaxActiveTorrents->setEnabled(false);
}else{
//enable
void options_imp::enableQueueingSystem(bool checked) {
if(checked) {
spinMaxActiveDownloads->setEnabled(true);
spinMaxActiveUploads->setEnabled(true);
label_max_active_dl->setEnabled(true);
label_max_active_up->setEnabled(true);
maxActiveTorrents_lbl->setEnabled(true);
spinMaxActiveTorrents->setEnabled(true);
}else{
spinMaxActiveDownloads->setEnabled(false);
spinMaxActiveUploads->setEnabled(false);
label_max_active_dl->setEnabled(false);
label_max_active_up->setEnabled(false);
maxActiveTorrents_lbl->setEnabled(false);
spinMaxActiveTorrents->setEnabled(false);
}
}
void options_imp::enableMaxConnecsLimitPerTorrent(int checkBoxValue){
if(checkBoxValue != 2){
//Disable
spinMaxConnecPerTorrent->setEnabled(false);
}else{
//enable
void options_imp::enableMaxConnecsLimitPerTorrent(bool checked){
if(checked) {
spinMaxConnecPerTorrent->setEnabled(true);
}else{
spinMaxConnecPerTorrent->setEnabled(false);
}
}
@ -1065,55 +1007,47 @@ void options_imp::disableSystrayOptions() { @@ -1065,55 +1007,47 @@ void options_imp::disableSystrayOptions() {
checkSystrayBalloons->setEnabled(false);
}
void options_imp::setSystrayOptionsState(int checkBoxValue) {
if(checkBoxValue == 2) {
void options_imp::setSystrayOptionsState(bool checked) {
if(checked) {
disableSystrayOptions();
} else {
enableSystrayOptions();
}
}
void options_imp::enableMaxUploadsLimitPerTorrent(int checkBoxValue){
if(checkBoxValue != 2){
//Disable
spinMaxUploadsPerTorrent->setEnabled(false);
}else{
//enable
void options_imp::enableMaxUploadsLimitPerTorrent(bool checked){
if(checked){
spinMaxUploadsPerTorrent->setEnabled(true);
}else{
spinMaxUploadsPerTorrent->setEnabled(false);
}
}
void options_imp::enableFilter(int checkBoxValue){
if(checkBoxValue != 2){
//Disable
lblFilterPath->setEnabled(false);
textFilterPath->setEnabled(false);
browseFilterButton->setEnabled(false);
}else{
//enable
void options_imp::enableFilter(bool checked){
if(checked){
lblFilterPath->setEnabled(true);
textFilterPath->setEnabled(true);
browseFilterButton->setEnabled(true);
}else{
lblFilterPath->setEnabled(false);
textFilterPath->setEnabled(false);
browseFilterButton->setEnabled(false);
}
}
void options_imp::enableRSS(int checkBoxValue) {
if(checkBoxValue != 2){
//Disable
groupRSSSettings->setEnabled(false);
}else{
//enable
void options_imp::enableRSS(bool checked) {
if(checked){
groupRSSSettings->setEnabled(true);
}else{
groupRSSSettings->setEnabled(false);
}
}
void options_imp::enableUploadLimit(int checkBoxValue){
if(checkBoxValue != 2){
//Disable
spinUploadLimit->setEnabled(false);
}else{
//enable
void options_imp::enableUploadLimit(bool checked){
if(checked){
spinUploadLimit->setEnabled(true);
}else{
spinUploadLimit->setEnabled(false);
}
}
@ -1123,35 +1057,29 @@ void options_imp::enableApplyButton(){ @@ -1123,35 +1057,29 @@ void options_imp::enableApplyButton(){
}
}
void options_imp::enableShareRatio(int checkBoxValue){
if(checkBoxValue != 2){
//Disable
spinRatio->setEnabled(false);
}else{
//enable
void options_imp::enableShareRatio(bool checked){
if(checked){
spinRatio->setEnabled(true);
}else{
spinRatio->setEnabled(false);
}
}
void options_imp::enableDHTPortSettings(int checkBoxValue) {
if(checkBoxValue == 2){
//Disable
spinDHTPort->setEnabled(false);
dh_port_lbl->setEnabled(false);
}else{
//enable
void options_imp::enableDHTPortSettings(bool checked) {
if(checked){
spinDHTPort->setEnabled(true);
dh_port_lbl->setEnabled(true);
}else{
spinDHTPort->setEnabled(false);
dh_port_lbl->setEnabled(false);
}
}
void options_imp::enableDeleteRatio(int checkBoxValue){
if(checkBoxValue != 2){
//Disable
spinMaxRatio->setEnabled(false);
}else{
//enable
void options_imp::enableDeleteRatio(bool checked){
if(checked){
spinMaxRatio->setEnabled(true);
}else{
spinMaxRatio->setEnabled(false);
}
}
@ -1195,15 +1123,13 @@ void options_imp::enableProxyHTTP(int index){ @@ -1195,15 +1123,13 @@ void options_imp::enableProxyHTTP(int index){
}
}
void options_imp::enableProxyAuth(int checkBoxValue){
if(checkBoxValue==2){
//enable
void options_imp::enableProxyAuth(bool checked){
if(checked){
lblProxyUsername->setEnabled(true);
lblProxyPassword->setEnabled(true);
textProxyUsername->setEnabled(true);
textProxyPassword->setEnabled(true);
}else{
//disable
lblProxyUsername->setEnabled(false);
lblProxyPassword->setEnabled(false);
textProxyUsername->setEnabled(false);
@ -1211,15 +1137,13 @@ void options_imp::enableProxyAuth(int checkBoxValue){ @@ -1211,15 +1137,13 @@ void options_imp::enableProxyAuth(int checkBoxValue){
}
}
void options_imp::enableProxyAuthHTTP(int checkBoxValue){
if(checkBoxValue==2){
//enable
void options_imp::enableProxyAuthHTTP(bool checked){
if(checked){
lblProxyUsername_http->setEnabled(true);
lblProxyPassword_http->setEnabled(true);
textProxyUsername_http->setEnabled(true);
textProxyPassword_http->setEnabled(true);
}else{
//disable
lblProxyUsername_http->setEnabled(false);
lblProxyPassword_http->setEnabled(false);
textProxyUsername_http->setEnabled(false);
@ -1227,13 +1151,11 @@ void options_imp::enableProxyAuthHTTP(int checkBoxValue){ @@ -1227,13 +1151,11 @@ void options_imp::enableProxyAuthHTTP(int checkBoxValue){
}
}
void options_imp::enableDirScan(int checkBoxValue){
if(checkBoxValue==2){
//enable
void options_imp::enableDirScan(bool checked){
if(checked){
textScanDir->setEnabled(true);
browseScanDirButton->setEnabled(true);
}else{
//disable
textScanDir->setEnabled(false);
browseScanDirButton->setEnabled(false);
}
@ -1269,11 +1191,7 @@ bool options_imp::isHTTPProxyEnabled() const { @@ -1269,11 +1191,7 @@ bool options_imp::isHTTPProxyEnabled() const {
}
bool options_imp::isProxyAuthEnabled() const{
return checkProxyAuth->isEnabled() && checkProxyAuth->isChecked();
}
bool options_imp::isHTTPProxyAuthEnabled() const{
return checkProxyAuth_http->isEnabled() && checkProxyAuth_http->isChecked();
return checkProxyAuth->isChecked();
}
QString options_imp::getProxyIp() const{

50
src/options_imp.h

@ -34,15 +34,10 @@ @@ -34,15 +34,10 @@
#include "ui_options.h"
#include <libtorrent/ip_filter.hpp>
#define HTTP 1
#define SOCKS5 2
#define HTTP_PW 3
#define SOCKS5_PW 4
enum ProxyType {HTTP=1, SOCKS5=2, HTTP_PW=3, SOCKS5_PW=4};
// actions on double-click on torrents
#define TOGGLE_PAUSE 0
#define OPEN_DEST 1
#define SHOW_PROPERTIES 2
enum DoubleClickAction {TOGGLE_PAUSE, OPEN_DEST};
using namespace libtorrent;
@ -100,23 +95,22 @@ class options_imp : public QDialog, private Ui::Dialog { @@ -100,23 +95,22 @@ class options_imp : public QDialog, private Ui::Dialog {
bool isDHTEnabled() const;
bool isDHTPortSameAsBT() const;
int getDHTPort() const;
bool isPeXEnabled() const;
bool isLSDEnabled() const;
bool isRSSEnabled() const;
bool shouldSpoofAzureus() const;
bool isUtorrentSpoofingEnabled() const;
int getEncryptionSetting() const;
float getDesiredRatio() const;
float getDeleteRatio() const;
// Proxy options
bool isHTTPProxyEnabled() const;
bool isHTTPProxyAuthEnabled() const;
QString getHTTPProxyIp() const;
unsigned short getHTTPProxyPort() const;
QString getHTTPProxyUsername() const;
QString getHTTPProxyPassword() const;
int getHTTPProxyType() const;
bool isProxyEnabled() const;
bool isHTTPProxyEnabled() const;
bool isProxyAuthEnabled() const;
bool isHTTPProxyAuthEnabled() const;
QString getProxyIp() const;
unsigned short getProxyPort() const;
QString getProxyUsername() const;
@ -140,23 +134,23 @@ class options_imp : public QDialog, private Ui::Dialog { @@ -140,23 +134,23 @@ class options_imp : public QDialog, private Ui::Dialog {
QString webUiPassword() const;
protected slots:
void enableUploadLimit(int checkBoxValue);
void enableDownloadLimit(int checkBoxValue);
void enableTempPathInput(int checkBoxValue);
void enableDirScan(int checkBoxValue);
void enableUploadLimit(bool checked);
void enableDownloadLimit(bool checked);
void enableTempPathInput(bool checked);
void enableDirScan(bool checked);
void enableProxy(int comboIndex);
void enableProxyAuth(int checkBoxValue);
void enableProxyAuth(bool checked);
void enableProxyHTTP(int comboIndex);
void enableProxyAuthHTTP(int checkBoxValue);
void enableMaxConnecsLimit(int);
void enableMaxConnecsLimitPerTorrent(int checkBoxValue);
void enableMaxUploadsLimitPerTorrent(int checkBoxValue);
void enableShareRatio(int checkBoxValue);
void enableDeleteRatio(int checkBoxValue);
void enableFilter(int checkBoxValue);
void enableRSS(int checkBoxValue);
void enableDHTPortSettings(int checkBoxValue);
void enableQueueingSystem(int checkBoxValue);
void enableProxyAuthHTTP(bool checked);
void enableMaxConnecsLimit(bool checked);
void enableMaxConnecsLimitPerTorrent(bool checked);
void enableMaxUploadsLimitPerTorrent(bool checked);
void enableShareRatio(bool checked);
void enableDeleteRatio(bool checked);
void enableFilter(bool checked);
void enableRSS(bool checked);
void enableDHTPortSettings(bool checked);
void enableQueueingSystem(bool checked);
void setStyle(int style);
void on_buttonBox_accepted();
void closeEvent(QCloseEvent *e);
@ -168,7 +162,7 @@ class options_imp : public QDialog, private Ui::Dialog { @@ -168,7 +162,7 @@ class options_imp : public QDialog, private Ui::Dialog {
void enableApplyButton();
void enableSystrayOptions();
void disableSystrayOptions();
void setSystrayOptionsState(int checkBoxValue);
void setSystrayOptionsState(bool checked);
void enableWebUi(bool checkBoxValue);
void changePage(QListWidgetItem*, QListWidgetItem*);
void adaptToScreenSize();
@ -179,7 +173,7 @@ class options_imp : public QDialog, private Ui::Dialog { @@ -179,7 +173,7 @@ class options_imp : public QDialog, private Ui::Dialog {
void useStyle();
signals:
void status_changed(bool) const;
void status_changed() const;
void exitWithCancel();
};

406
src/preferences.h

@ -0,0 +1,406 @@ @@ -0,0 +1,406 @@
/*
* Bittorrent Client using Qt4 and libtorrent.
* Copyright (C) 2006 Christophe Dumez
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* In addition, as a special exception, the copyright holders give permission to
* link this program with the OpenSSL project's "OpenSSL" library (or with
* modified versions of it that use the same license as the "OpenSSL" library),
* and distribute the linked executables. You must obey the GNU General Public
* License in all respects for all of the code used other than "OpenSSL". If you
* modify file(s), you may extend this exception to your version of the file(s),
* but you are not obligated to do so. If you do not wish to do so, delete this
* exception statement from your version.
*
* Contact : chris@qbittorrent.org
*/
#ifndef PREFERENCES_H
#define PREFERENCES_H
#include <QSettings>
#include <QPair>
class Preferences {
public:
// General options
static QString getLocale() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value(QString::fromUtf8("Preferences/General/Locale"), "en_GB").toString();
}
static int getStyle() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value(QString::fromUtf8("Preferences/General/Style"), 0).toInt();
}
static bool confirmOnExit() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value(QString::fromUtf8("Preferences/General/ExitConfirm"), true).toBool();
}
static bool speedInTitleBar() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value(QString::fromUtf8("Preferences/General/SpeedInTitleBar"), false).toBool();
}
static unsigned int getRefreshInterval() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value(QString::fromUtf8("Preferences/General/RefreshInterval"), 1500).toUInt();
}
static bool systrayIntegration() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value(QString::fromUtf8("Preferences/General/SystrayEnabled"), true).toBool();
}
static bool isToolbarDisplayed() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value(QString::fromUtf8("Preferences/General/ToolbarDisplayed"), true).toBool();
}
static bool minimizeToTray() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value(QString::fromUtf8("Preferences/General/MinimizeToTray"), false).toBool();
}
static bool closeToTray() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value(QString::fromUtf8("Preferences/General/CloseToTray"), false).toBool();
}
static bool startMinimized() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value(QString::fromUtf8("Preferences/General/StartMinimized"), false).toBool();
}
static bool isSlashScreenDisabled() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value(QString::fromUtf8("Preferences/General/NoSplashScreen"), false).toBool();
}
static bool OSDEnabled() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value(QString::fromUtf8("Preferences/General/NotificationBaloons"), true).toBool();
}
// Downloads
static QString getSavePath() {
QSettings settings("qBittorrent", "qBittorrent");
#ifdef Q_WS_WIN
QString home = QDir::rootPath();
#else
QString home = QDir::homePath();
#endif
if(home[home.length()-1] != QDir::separator()){
home += QDir::separator();
}
return settings.value(QString::fromUtf8("Preferences/Downloads/SavePath"), home+"qBT_dir").toString();
}
static bool isTempPathEnabled() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value(QString::fromUtf8("Preferences/Downloads/TempPathEnabled"), false).toBool();
}
static QString getTempPath() {
QSettings settings("qBittorrent", "qBittorrent");
#ifdef Q_WS_WIN
QString home = QDir::rootPath();
#else
QString home = QDir::homePath();
#endif
return settings.value(QString::fromUtf8("Preferences/Downloads/TempPath"), home+"qBT_dir"+QDir::separator()+"temp").toString();
}
static bool preAllocateAllFiles() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value(QString::fromUtf8("Preferences/Downloads/PreAllocation"), false).toBool();
}
static bool useAdditionDialog() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value(QString::fromUtf8("Preferences/Downloads/AdditionDialog"), true).toBool();
}
static bool addTorrentsInPause() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value(QString::fromUtf8("Preferences/Downloads/StartInPause"), false).toBool();
}
static bool isDirScanEnabled() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value(QString::fromUtf8("Preferences/Downloads/ScanDir"), QString()).toString().isEmpty();
}
static QString getScanDir() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value(QString::fromUtf8("Preferences/Downloads/ScanDir"), QString()).toString();
}
static int getActionOnDblClOnTorrentDl() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value(QString::fromUtf8("Preferences/Downloads/DblClOnTorDl"), 0).toInt();
}
static int getActionOnDblClOnTorrentFn() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value(QString::fromUtf8("Preferences/Downloads/DblClOnTorFn"), 1).toInt();
}
// Connection options
static int getSessionPort() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value(QString::fromUtf8("Preferences/Connection/PortRangeMin"), 6881).toInt();
}
static bool isUPnPEnabled() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value(QString::fromUtf8("Preferences/Connection/UPnP"), true).toBool();
}
static bool isNATPMPEnabled() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value(QString::fromUtf8("Preferences/Connection/NAT-PMP"), true).toBool();
}
static int getGlobalDownloadLimit() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value(QString::fromUtf8("Preferences/Connection/GlobalDLLimit"), -1).toInt();
}
static int getGlobalUploadLimit() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value(QString::fromUtf8("Preferences/Connection/GlobalUPLimit"), -1).toInt();
}
// Proxy options
static bool isHTTPProxyEnabled() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value(QString::fromUtf8("Preferences/Connection/HTTPProxyType"), 0).toInt() > 0;
}
static bool isHTTPProxyAuthEnabled() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value(QString::fromUtf8("Preferences/Connection/HTTPProxy/Authentication"), false).toBool();
}
static QString getHTTPProxyIp() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value(QString::fromUtf8("Preferences/Connection/HTTPProxy/IP"), "0.0.0.0").toString();
}
static unsigned short getHTTPProxyPort() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value(QString::fromUtf8("Preferences/Connection/HTTPProxy/Port"), 8080).toInt();
}
static QString getHTTPProxyUsername() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value(QString::fromUtf8("Preferences/Connection/HTTPProxy/Username"), QString()).toString();
}
static QString getHTTPProxyPassword() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value(QString::fromUtf8("Preferences/Connection/HTTPProxy/Password"), QString()).toString();
}
static int getHTTPProxyType() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value(QString::fromUtf8("Preferences/Connection/HTTPProxyType"), 0).toInt();
}
static bool isProxyEnabled() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value(QString::fromUtf8("Preferences/Connection/ProxyType"), 0).toInt() > 0;
}
static bool isProxyAuthEnabled() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value(QString::fromUtf8("Preferences/Connection/Proxy/Authentication"), false).toBool();
}
static QString getProxyIp() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value(QString::fromUtf8("Preferences/Connection/Proxy/IP"), "0.0.0.0").toString();
}
static unsigned short getProxyPort() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value(QString::fromUtf8("Preferences/Connection/Proxy/Port"), 8080).toInt();
}
static QString getProxyUsername() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value(QString::fromUtf8("Preferences/Connection/Proxy/Username"), QString()).toString();
}
static QString getProxyPassword() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value(QString::fromUtf8("Preferences/Connection/Proxy/Password"), QString()).toString();
}
static int getProxyType() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value(QString::fromUtf8("Preferences/Connection/ProxyType"), 0).toInt();
}
static bool useProxyForTrackers() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value(QString::fromUtf8("Preferences/Connection/Proxy/AffectTrackers"), true).toBool();
}
static bool useProxyForPeers() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value(QString::fromUtf8("Preferences/Connection/Proxy/AffectPeers"), true).toBool();
}
static bool useProxyForWebseeds() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value(QString::fromUtf8("Preferences/Connection/Proxy/AffectWebSeeds"), true).toBool();
}
static bool useProxyForDHT() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value(QString::fromUtf8("Preferences/Connection/Proxy/AffectDHT"), true).toBool();
}
// Bittorrent options
static int getMaxConnecs() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value(QString::fromUtf8("Preferences/Bittorrent/MaxConnecs"), 500).toInt();
}
static int getMaxConnecsPerTorrent() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value(QString::fromUtf8("Preferences/Bittorrent/MaxConnecsPerTorrent"), 100).toInt();
}
static int getMaxUploadsPerTorrent() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value(QString::fromUtf8("Preferences/Bittorrent/MaxUploadsPerTorrent"), 4).toInt();
}
static bool isDHTEnabled() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value(QString::fromUtf8("Preferences/Bittorrent/DHT"), true).toBool();
}
static bool isDHTPortSameAsBT() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value(QString::fromUtf8("Preferences/Bittorrent/sameDHTPortAsBT"), true).toBool();
}
static int getDHTPort() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value(QString::fromUtf8("Preferences/Bittorrent/DHTPort"), 6882).toInt();
}
static bool isLSDEnabled() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value(QString::fromUtf8("Preferences/Bittorrent/LSD"), true).toBool();
}
static bool isUtorrentSpoofingEnabled() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value(QString::fromUtf8("Preferences/Bittorrent/utorrentSpoof"), false).toBool();
}
static int getEncryptionSetting() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value(QString::fromUtf8("Preferences/Bittorrent/Encryption"), 0).toInt();
}
static float getDesiredRatio() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value(QString::fromUtf8("Preferences/Bittorrent/DesiredRatio"), -1).toDouble();
}
static float getDeleteRatio() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value(QString::fromUtf8("Preferences/Bittorrent/MaxRatio"), -1).toDouble();
}
// IP Filter
static bool isFilteringEnabled() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value(QString::fromUtf8("Preferences/IPFilter/Enabled"), false).toBool();
}
static QString getFilter() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value(QString::fromUtf8("Preferences/IPFilter/File"), QString()).toString();
}
// RSS
static bool isRSSEnabled() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value(QString::fromUtf8("Preferences/RSS/RSSEnabled"), false).toBool();
}
static int getRSSRefreshInterval() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value(QString::fromUtf8("Preferences/RSS/RSSRefresh"), 5).toInt();
}
static int getRSSMaxArticlesPerFeed() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value(QString::fromUtf8("Preferences/RSS/RSSMaxArticlesPerFeed"), 50).toInt();
}
// Queueing system
static bool isQueueingSystemEnabled() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value("Preferences/Queueing/QueueingEnabled", false).toBool();
}
static int getMaxActiveDownloads() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value(QString::fromUtf8("Preferences/Queueing/MaxActiveDownloads"), 3).toInt();
}
static int getMaxActiveUploads() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value(QString::fromUtf8("Preferences/Queueing/MaxActiveUploads"), 3).toInt();
}
static int getMaxActiveTorrents() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value(QString::fromUtf8("Preferences/Queueing/MaxActiveTorrents"), 5).toInt();
}
static bool isWebUiEnabled() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value("Preferences/WebUI/Enabled", false).toBool();
}
static quint16 getWebUiPort() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value("Preferences/WebUI/Port", 8080).toInt();
}
static QString getWebUiUsername() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value("Preferences/WebUI/Username", "user").toString();
}
static QString getWebUiPassword() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value("Preferences/WebUI/Password", "").toString();
}
};
#endif // PREFERENCES_H

3
src/src.pro

@ -188,7 +188,8 @@ HEADERS += GUI.h \ @@ -188,7 +188,8 @@ HEADERS += GUI.h \
filesystemwatcher.h \
peerlistwidget.h \
peerlistdelegate.h \
reverseresolution.h
reverseresolution.h \
preferences.h
FORMS += MainWindow.ui \
options.ui \
about.ui \

Loading…
Cancel
Save