Browse Source

- Totally redesigned program preferences

- Added some options, the following are already implemented:
  * Start/Stop LSD/NAT-PMP/UPnP
	* Force preallocation of all files
	* Force new torrents status to pause
- Other new features are going to be implemented soon
adaptive-webui-19844
Christophe Dumez 17 years ago
parent
commit
cd70843ee9
  1. 4
      Changelog
  2. 6
      TODO
  3. 2
      src/FinishedTorrents.cpp
  4. 96
      src/GUI.cpp
  5. 4
      src/allocationDlg.h
  6. 68
      src/bittorrent.cpp
  7. 10
      src/bittorrent.h
  8. 2
      src/downloadingTorrents.cpp
  9. 36
      src/engineSelectDlg.cpp
  10. 1764
      src/lang/qbittorrent_ko.ts
  11. 52
      src/main.cpp
  12. 1894
      src/options.ui
  13. 1590
      src/optionsNG.ui
  14. 1099
      src/options_imp.cpp
  15. 109
      src/options_imp.h
  16. 4
      src/searchEngine.cpp
  17. 4
      src/torrentAddition.h

4
Changelog

@ -33,6 +33,8 @@
- FEATURE: Allow to drag 'n drop urls on the main window - FEATURE: Allow to drag 'n drop urls on the main window
- FEATURE: Improved search engine (multipage support in all plugins) - FEATURE: Improved search engine (multipage support in all plugins)
- FEATURE: Added BTJunkie search engine plugin - FEATURE: Added BTJunkie search engine plugin
- FEATURE: Added an option to force full disk allocation for all torrents
- FEATURE: Added an option to add torrents in paused state
- I18N: Added Hungarian translation - I18N: Added Hungarian translation
- I18N: Added Brazilian translation - I18N: Added Brazilian translation
- BUGFIX: Progress of paused torrents is now correct on restart - BUGFIX: Progress of paused torrents is now correct on restart
@ -57,7 +59,7 @@
- BUGFIX: ETA was wrong for torrents with filtered files - BUGFIX: ETA was wrong for torrents with filtered files
- BUGFIX: Fixed drag'n drop on non-KDE systems - BUGFIX: Fixed drag'n drop on non-KDE systems
- COSMETIC: Redesigned torrent properties a little - COSMETIC: Redesigned torrent properties a little
- COSMETIC: Redesigned options a little - COSMETIC: Totally redesigned program preferences
- COSMETIC: Display more logs messages concerning features - COSMETIC: Display more logs messages concerning features
- COSMETIC: Improved lists renderers - COSMETIC: Improved lists renderers
- COSMETIC: Use a different icon for torrents being checked and for connecting ones - COSMETIC: Use a different icon for torrents being checked and for connecting ones

6
TODO

@ -84,7 +84,7 @@ LANGUAGES UPDATED:
- Spanish *BETA5* - Spanish *BETA5*
- German *BETA6* - German *BETA6*
- Russian *BETA6* - Russian *BETA6*
- Korean *BETA5* - Korean *BETA6*
- Greek *BETA6* - Greek *BETA6*
- Dutch *BETA5* - Dutch *BETA5*
- Romanian *BETA5* - Romanian *BETA5*
@ -97,6 +97,9 @@ beta6->beta7 changelog:
- FEATURE: Added zip support in search plugins manager (can put .py & .png inside) - FEATURE: Added zip support in search plugins manager (can put .py & .png inside)
- FEATURE: Redesigned torrent creation dialog - FEATURE: Redesigned torrent creation dialog
- FEATURE: Allow to set piece size when creating a torrent - FEATURE: Allow to set piece size when creating a torrent
- FEATURE: Added an option to force full disk allocation for all torrents
- FEATURE: Added an option to add torrents in paused state
- FEATURE: Allow to disable UPnP/NAT-PMP/LSD
- BUGFIX: In torrent content, it is now easier to filter all torrents using right click menu - BUGFIX: In torrent content, it is now easier to filter all torrents using right click menu
- BUGFIX: Updated man page / README / INSTALL - BUGFIX: Updated man page / README / INSTALL
- BUGFIX: Paused torrents could be displayed as connected for a sec after checking - BUGFIX: Paused torrents could be displayed as connected for a sec after checking
@ -112,3 +115,4 @@ beta6->beta7 changelog:
- BUGFIX: Dropped Qt4.2 support, becomes too difficult to maintain - BUGFIX: Dropped Qt4.2 support, becomes too difficult to maintain
- BUGFIX: Fixed deprecation warning with latest libtorrent svn - BUGFIX: Fixed deprecation warning with latest libtorrent svn
- COSMETIC: Improved some icons - COSMETIC: Improved some icons
- COSMETIC: Totally redesigned program preferences

2
src/FinishedTorrents.cpp

@ -314,7 +314,7 @@ void FinishedTorrents::displayFinishedListMenu(const QPoint& pos){
// Enable/disable pause/start action given the DL state // Enable/disable pause/start action given the DL state
QModelIndexList selectedIndexes = finishedList->selectionModel()->selectedIndexes(); QModelIndexList selectedIndexes = finishedList->selectionModel()->selectedIndexes();
QSettings settings("qBittorrent", "qBittorrent"); QSettings settings("qBittorrent", "qBittorrent");
QString previewProgram = settings.value("Options/Misc/PreviewProgram", QString()).toString(); QString previewProgram = settings.value("Preferences/general/MediaPlayer", QString()).toString();
bool has_pause = false, has_start = false, has_preview = false; bool has_pause = false, has_start = false, has_preview = false;
foreach(index, selectedIndexes) { foreach(index, selectedIndexes) {
if(index.column() == F_NAME) { if(index.column() == F_NAME) {

96
src/GUI.cpp

@ -60,7 +60,7 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), for
setupUi(this); setupUi(this);
setWindowTitle(tr("qBittorrent %1", "e.g: qBittorrent v0.x").arg(QString::fromUtf8(VERSION))); setWindowTitle(tr("qBittorrent %1", "e.g: qBittorrent v0.x").arg(QString::fromUtf8(VERSION)));
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent")); QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
systrayIntegration = settings.value(QString::fromUtf8("Options/Misc/Behaviour/SystrayIntegration"), true).toBool(); systrayIntegration = settings.value(QString::fromUtf8("Preferences/General/SystrayEnabled"), true).toBool();
// Create tray icon // Create tray icon
if (QSystemTrayIcon::isSystemTrayAvailable()) { if (QSystemTrayIcon::isSystemTrayAvailable()) {
if(systrayIntegration) { if(systrayIntegration) {
@ -243,7 +243,7 @@ void GUI::finishedTorrent(QTorrentHandle& h) const {
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent")); QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
bool show_msg = true; bool show_msg = true;
QString fileName = h.name(); QString fileName = h.name();
int useOSD = settings.value(QString::fromUtf8("Options/OSDEnabled"), 1).toInt(); bool useNotificationBalloons = settings.value(QString::fromUtf8("Preferences/General/NotificationBaloons"), true).toBool();
// Add it to finished tab // Add it to finished tab
QString hash = h.hash(); QString hash = h.hash();
if(QFile::exists(misc::qBittorrentPath()+QString::fromUtf8("BT_backup")+QDir::separator()+hash+QString::fromUtf8(".finished"))) { if(QFile::exists(misc::qBittorrentPath()+QString::fromUtf8("BT_backup")+QDir::separator()+hash+QString::fromUtf8(".finished"))) {
@ -254,7 +254,7 @@ void GUI::finishedTorrent(QTorrentHandle& h) const {
downloadingTorrentTab->setInfoBar(tr("%1 has finished downloading.", "e.g: xxx.avi has finished downloading.").arg(fileName)); downloadingTorrentTab->setInfoBar(tr("%1 has finished downloading.", "e.g: xxx.avi has finished downloading.").arg(fileName));
downloadingTorrentTab->deleteTorrent(hash); downloadingTorrentTab->deleteTorrent(hash);
finishedTorrentTab->addTorrent(hash); finishedTorrentTab->addTorrent(hash);
if(show_msg && systrayIntegration && (useOSD == 1 || (useOSD == 2 && (isMinimized() || isHidden())))) { if(show_msg && systrayIntegration && useNotificationBalloons) {
myTrayIcon->showMessage(tr("Download finished"), tr("%1 has finished downloading.", "e.g: xxx.avi has finished downloading.").arg(fileName), QSystemTrayIcon::Information, TIME_TRAY_BALLOON); myTrayIcon->showMessage(tr("Download finished"), tr("%1 has finished downloading.", "e.g: xxx.avi has finished downloading.").arg(fileName), QSystemTrayIcon::Information, TIME_TRAY_BALLOON);
} }
} }
@ -262,8 +262,8 @@ void GUI::finishedTorrent(QTorrentHandle& h) const {
// Notification when disk is full // Notification when disk is full
void GUI::fullDiskError(QTorrentHandle& h) const { void GUI::fullDiskError(QTorrentHandle& h) const {
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent")); QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
int useOSD = settings.value(QString::fromUtf8("Options/OSDEnabled"), 1).toInt(); bool useNotificationBalloons = settings.value(QString::fromUtf8("Preferences/General/NotificationBaloons"), true).toBool();
if(systrayIntegration && (useOSD == 1 || (useOSD == 2 && (isMinimized() || isHidden())))) { if(systrayIntegration && useNotificationBalloons) {
myTrayIcon->showMessage(tr("I/O Error", "i.e: Input/Output Error"), tr("An error occured when trying to read or write %1. The disk is probably full, download has been paused", "e.g: An error occured when trying to read or write xxx.avi. The disk is probably full, download has been paused").arg(h.name()), QSystemTrayIcon::Critical, TIME_TRAY_BALLOON); myTrayIcon->showMessage(tr("I/O Error", "i.e: Input/Output Error"), tr("An error occured when trying to read or write %1. The disk is probably full, download has been paused", "e.g: An error occured when trying to read or write xxx.avi. The disk is probably full, download has been paused").arg(h.name()), QSystemTrayIcon::Critical, TIME_TRAY_BALLOON);
} }
// Download will be paused by libtorrent. Updating GUI information accordingly // Download will be paused by libtorrent. Updating GUI information accordingly
@ -412,7 +412,7 @@ void GUI::previewFile(QString filePath) {
QStringList params; QStringList params;
params << tmpPath; params << tmpPath;
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent")); QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
QString previewProgram = settings.value(QString::fromUtf8("Options/Misc/PreviewProgram"), QString()).toString(); QString previewProgram = settings.value(QString::fromUtf8("Preferences/General/MediaPlayer"), QString()).toString();
previewProcess->start(previewProgram, params, QIODevice::ReadOnly); previewProcess->start(previewProgram, params, QIODevice::ReadOnly);
}else{ }else{
QMessageBox::critical(0, tr("Preview process already running"), tr("There is already another preview process running.\nPlease close the other one first.")); QMessageBox::critical(0, tr("Preview process already running"), tr("There is already another preview process running.\nPlease close the other one first."));
@ -475,13 +475,13 @@ void GUI::on_actionAbout_triggered() {
void GUI::closeEvent(QCloseEvent *e) { void GUI::closeEvent(QCloseEvent *e) {
qDebug("Mainwindow received closeEvent"); qDebug("Mainwindow received closeEvent");
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent")); QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
bool goToSystrayOnExit = settings.value(QString::fromUtf8("Options/Misc/Behaviour/GoToSystrayOnExit"), false).toBool(); bool goToSystrayOnExit = settings.value(QString::fromUtf8("Preferences/General/CloseToTray"), false).toBool();
if(!force_exit && systrayIntegration && goToSystrayOnExit && !this->isHidden()) { if(!force_exit && systrayIntegration && goToSystrayOnExit && !this->isHidden()) {
hide(); hide();
e->ignore(); e->ignore();
return; return;
} }
if(settings.value(QString::fromUtf8("Options/Misc/Behaviour/ConfirmOnExit"), true).toBool() && downloadingTorrentTab->getNbTorrentsInList()) { if(settings.value(QString::fromUtf8("Preferences/General/ExitConfirm"), true).toBool() && downloadingTorrentTab->getNbTorrentsInList()) {
show(); show();
if(!isMaximized()) if(!isMaximized())
showNormal(); showNormal();
@ -518,7 +518,7 @@ void GUI::on_actionCreate_torrent_triggered() {
// Called when we minimize the program // Called when we minimize the program
void GUI::hideEvent(QHideEvent *e) { void GUI::hideEvent(QHideEvent *e) {
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent")); QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
if(systrayIntegration && settings.value(QString::fromUtf8("Options/Misc/Behaviour/GoToSystray"), true).toBool() && !e->spontaneous()) { if(systrayIntegration && settings.value(QString::fromUtf8("Preferences/General/MinimizeToTray"), false).toBool() && !e->spontaneous()) {
// Hide window // Hide window
hide(); hide();
} }
@ -545,9 +545,9 @@ void GUI::dropEvent(QDropEvent *event) {
// Add file to download list // Add file to download list
QString file; QString file;
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent")); QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
bool useTorrentAdditionDialog = settings.value(QString::fromUtf8("Options/Misc/TorrentAdditionDialog/Enabled"), true).toBool(); bool useTorrentAdditionDialog = settings.value(QString::fromUtf8("Preferences/Downloads/AdditionDialog"), true).toBool();
foreach(file, files) { foreach(file, files) {
file = file.trimmed().replace(QString::fromUtf8("file://"), QString::fromUtf8("")); file = file.trimmed().replace(QString::fromUtf8("file://"), QString::fromUtf8(""), Qt::CaseInsensitive);
qDebug("Dropped file %s on download list", file.toUtf8().data()); qDebug("Dropped file %s on download list", file.toUtf8().data());
if(file.startsWith(QString::fromUtf8("http://"), Qt::CaseInsensitive) || file.startsWith(QString::fromUtf8("ftp://"), Qt::CaseInsensitive) || file.startsWith(QString::fromUtf8("https://"), Qt::CaseInsensitive)) { if(file.startsWith(QString::fromUtf8("http://"), Qt::CaseInsensitive) || file.startsWith(QString::fromUtf8("ftp://"), Qt::CaseInsensitive) || file.startsWith(QString::fromUtf8("https://"), Qt::CaseInsensitive)) {
BTSession->downloadFromUrl(file); BTSession->downloadFromUrl(file);
@ -584,16 +584,14 @@ void GUI::dragEnterEvent(QDragEnterEvent *event) {
// Display a dialog to allow user to add // Display a dialog to allow user to add
// torrents to download list // torrents to download list
void GUI::on_actionOpen_triggered() { void GUI::on_actionOpen_triggered() {
QStringList pathsList;
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent")); QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
// Open File Open Dialog // Open File Open Dialog
// Note: it is possible to select more than one file // Note: it is possible to select more than one file
pathsList = QFileDialog::getOpenFileNames(0, QStringList pathsList = QFileDialog::getOpenFileNames(0,
tr("Open Torrent Files"), settings.value(QString::fromUtf8("MainWindowLastDir"), QDir::homePath()).toString(), tr("Open Torrent Files"), settings.value(QString::fromUtf8("MainWindowLastDir"), QDir::homePath()).toString(),
tr("Torrent Files")+QString::fromUtf8(" (*.torrent)")); tr("Torrent Files")+QString::fromUtf8(" (*.torrent)"));
if(!pathsList.empty()) { if(!pathsList.empty()) {
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent")); bool useTorrentAdditionDialog = settings.value(QString::fromUtf8("Preferences/Downloads/AdditionDialog"), true).toBool();
bool useTorrentAdditionDialog = settings.value(QString::fromUtf8("Options/Misc/TorrentAdditionDialog/Enabled"), true).toBool();
unsigned int listSize = pathsList.size(); unsigned int listSize = pathsList.size();
for(unsigned int i=0; i<listSize; ++i) { for(unsigned int i=0; i<listSize; ++i) {
if(useTorrentAdditionDialog) { if(useTorrentAdditionDialog) {
@ -725,7 +723,7 @@ void GUI::on_actionDelete_triggered() {
void GUI::processParams(const QStringList& params) { void GUI::processParams(const QStringList& params) {
QString param; QString param;
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent")); QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
bool useTorrentAdditionDialog = settings.value(QString::fromUtf8("Options/Misc/TorrentAdditionDialog/Enabled"), true).toBool(); bool useTorrentAdditionDialog = settings.value(QString::fromUtf8("Preferences/Downloads/AdditionDialog"), true).toBool();
foreach(param, params) { foreach(param, params) {
param = param.trimmed(); param = param.trimmed();
if(param.startsWith(QString::fromUtf8("http://"), Qt::CaseInsensitive) || param.startsWith(QString::fromUtf8("ftp://"), Qt::CaseInsensitive) || param.startsWith(QString::fromUtf8("https://"), Qt::CaseInsensitive)) { if(param.startsWith(QString::fromUtf8("http://"), Qt::CaseInsensitive) || param.startsWith(QString::fromUtf8("ftp://"), Qt::CaseInsensitive) || param.startsWith(QString::fromUtf8("https://"), Qt::CaseInsensitive)) {
@ -750,7 +748,7 @@ void GUI::addTorrent(QString path) {
void GUI::processScannedFiles(const QStringList& params) { void GUI::processScannedFiles(const QStringList& params) {
QString param; QString param;
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent")); QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
bool useTorrentAdditionDialog = settings.value(QString::fromUtf8("Options/Misc/TorrentAdditionDialog/Enabled"), true).toBool(); bool useTorrentAdditionDialog = settings.value(QString::fromUtf8("Preferences/Downloads/AdditionDialog"), true).toBool();
foreach(param, params) { foreach(param, params) {
if(useTorrentAdditionDialog) { if(useTorrentAdditionDialog) {
torrentAdditionDialog *dialog = new torrentAdditionDialog(this); torrentAdditionDialog *dialog = new torrentAdditionDialog(this);
@ -765,7 +763,7 @@ void GUI::processScannedFiles(const QStringList& params) {
void GUI::processDownloadedFiles(QString path, QString url) { void GUI::processDownloadedFiles(QString path, QString url) {
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent")); QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
bool useTorrentAdditionDialog = settings.value(QString::fromUtf8("Options/Misc/TorrentAdditionDialog/Enabled"), true).toBool(); bool useTorrentAdditionDialog = settings.value(QString::fromUtf8("Preferences/Downloads/AdditionDialog"), true).toBool();
if(useTorrentAdditionDialog) { if(useTorrentAdditionDialog) {
torrentAdditionDialog *dialog = new torrentAdditionDialog(this); torrentAdditionDialog *dialog = new torrentAdditionDialog(this);
connect(dialog, SIGNAL(torrentAddition(QString, bool, QString)), BTSession, SLOT(addTorrent(QString, bool, QString))); connect(dialog, SIGNAL(torrentAddition(QString, bool, QString)), BTSession, SLOT(addTorrent(QString, bool, QString)));
@ -784,17 +782,53 @@ void GUI::configureSession(bool deleteOptions) {
proxy_settings proxySettings; proxy_settings proxySettings;
session_settings sessionSettings; session_settings sessionSettings;
pe_settings encryptionSettings; pe_settings encryptionSettings;
// Configure session regarding options // Downloads
BTSession->setDefaultSavePath(options->getSavePath()); BTSession->preAllocateAllFiles(options->preAllocateAllFiles());
BTSession->startTorrentsInPause(options->addTorrentsInPause());
// Connection
old_listenPort = BTSession->getListenPort(); old_listenPort = BTSession->getListenPort();
BTSession->setListeningPortsRange(options->getPorts()); BTSession->setListeningPortsRange(options->getPorts());
new_listenPort = BTSession->getListenPort(); new_listenPort = BTSession->getListenPort();
if(new_listenPort != old_listenPort) { if(new_listenPort != old_listenPort) {
downloadingTorrentTab->setInfoBar(tr("qBittorrent is bind to port: %1", "e.g: qBittorrent is bind to port: 1666").arg( misc::toQString(new_listenPort))); downloadingTorrentTab->setInfoBar(tr("qBittorrent is bind to port: %1", "e.g: qBittorrent is bind to port: 1666").arg( misc::toQString(new_listenPort)));
} }
if(options->isUPnPEnabled()) {
BTSession->enableUPnP(true);
downloadingTorrentTab->setInfoBar(tr("UPnP support [ON]"), QString::fromUtf8("blue"));
} else {
BTSession->enableUPnP(false);
downloadingTorrentTab->setInfoBar(tr("UPnP support [OFF]"), QString::fromUtf8("blue"));
}
if(options->isNATPMPEnabled()) {
BTSession->enableNATPMP(true);
downloadingTorrentTab->setInfoBar(tr("NAT-PMP support [ON]"), QString::fromUtf8("blue"));
} else {
BTSession->enableNATPMP(false);
downloadingTorrentTab->setInfoBar(tr("NAT-PMP support [OFF]"), QString::fromUtf8("blue"));
}
// Bittorrent
if(options->isLSDEnabled()) {
BTSession->enableLSD(true);
downloadingTorrentTab->setInfoBar(tr("Local Peer Discovery [ON]"), QString::fromUtf8("blue"));
} else {
BTSession->enableLSD(false);
downloadingTorrentTab->setInfoBar(tr("Local Peer Discovery support [OFF]"), QString::fromUtf8("blue"));
}
if(options->isDHTEnabled()) {
BTSession->enableDHT(true);
downloadingTorrentTab->setInfoBar(tr("DHT support [ON], port: %1").arg(new_listenPort), QString::fromUtf8("blue"));
// Set DHT Port
BTSession->setDHTPort(new_listenPort);
}else{
BTSession->enableDHT(false);
downloadingTorrentTab->setInfoBar(tr("DHT support [OFF]"), QString::fromUtf8("blue"));
}
// IP Filter
// Configure session regarding options
BTSession->setDefaultSavePath(options->getSavePath());
// Apply max connec limit (-1 if disabled) // Apply max connec limit (-1 if disabled)
BTSession->setMaxConnections(options->getMaxConnec()); BTSession->setMaxConnections(options->getMaxConnecs());
limits = options->getLimits(); limits = options->getGlobalBandwidthLimits();
switch(limits.first) { switch(limits.first) {
case -1: // Download limit disabled case -1: // Download limit disabled
case 0: case 0:
@ -812,19 +846,7 @@ void GUI::configureSession(bool deleteOptions) {
BTSession->setUploadRateLimit(limits.second*1024); BTSession->setUploadRateLimit(limits.second*1024);
} }
// Apply ratio (0 if disabled) // Apply ratio (0 if disabled)
BTSession->setGlobalRatio(options->getRatio()); BTSession->setGlobalRatio(options->getDesiredRatio());
// DHT (Trackerless)
if(options->isDHTEnabled()) {
downloadingTorrentTab->setInfoBar(tr("DHT support [ON], port: %1").arg(options->getDHTPort()), QString::fromUtf8("blue"));
BTSession->enableDHT();
// Set DHT Port
BTSession->setDHTPort(options->getDHTPort());
}else{
downloadingTorrentTab->setInfoBar(tr("DHT support [OFF]"), QString::fromUtf8("blue"));
BTSession->disableDHT();
}
// UPnP can't be disabled
downloadingTorrentTab->setInfoBar(tr("UPnP support [ON]"), QString::fromUtf8("blue"));
// Encryption settings // Encryption settings
int encryptionState = options->getEncryptionSetting(); int encryptionState = options->getEncryptionSetting();
// The most secure, rc4 only so that all streams and encrypted // The most secure, rc4 only so that all streams and encrypted
@ -848,7 +870,7 @@ void GUI::configureSession(bool deleteOptions) {
} }
BTSession->applyEncryptionSettings(encryptionSettings); BTSession->applyEncryptionSettings(encryptionSettings);
// PeX // PeX
if(!options->isPeXDisabled()) { if(options->isPeXEnabled()) {
qDebug("Enabling Peer eXchange (PeX)"); qDebug("Enabling Peer eXchange (PeX)");
downloadingTorrentTab->setInfoBar(tr("PeX support [ON]"), QString::fromUtf8("blue")); downloadingTorrentTab->setInfoBar(tr("PeX support [ON]"), QString::fromUtf8("blue"));
BTSession->enablePeerExchange(); BTSession->enablePeerExchange();
@ -1189,7 +1211,7 @@ void GUI::on_actionOptions_triggered() {
// Is executed each time options are saved // Is executed each time options are saved
void GUI::OptionsSaved(QString info, bool deleteOptions) { void GUI::OptionsSaved(QString info, bool deleteOptions) {
bool newSystrayIntegration = options->useSystrayIntegration(); bool newSystrayIntegration = options->systrayIntegration();
if(newSystrayIntegration && !systrayIntegration) { if(newSystrayIntegration && !systrayIntegration) {
// create the trayicon // create the trayicon
createTrayIcon(); createTrayIcon();

4
src/allocationDlg.h

@ -157,13 +157,13 @@ class BandwidthAllocationDialog : public QDialog, private Ui_bandwidth_dlg {
s->set_upload_rate_limit(-1); s->set_upload_rate_limit(-1);
else else
s->set_upload_rate_limit(val*1024); s->set_upload_rate_limit(val*1024);
settings.setValue(QString::fromUtf8("Options/Main/UPLimit"), val); settings.setValue(QString::fromUtf8("Preferences/Connection/GlobalUPLimit"), val);
}else{ }else{
if(!val) if(!val)
s->set_download_rate_limit(-1); s->set_download_rate_limit(-1);
else else
s->set_download_rate_limit(val*1024); s->set_download_rate_limit(val*1024);
settings.setValue(QString::fromUtf8("Options/Main/DLLimit"), val); settings.setValue(QString::fromUtf8("Preferences/Connection/GlobalDLLimit"), val);
} }
} }
close(); close();

68
src/bittorrent.cpp

@ -44,17 +44,13 @@
#define MAX_TRACKER_ERRORS 2 #define MAX_TRACKER_ERRORS 2
// Main constructor // Main constructor
bittorrent::bittorrent() : timerScan(0), DHTEnabled(false){ bittorrent::bittorrent() : timerScan(0), DHTEnabled(false), preAllocateAll(false), addInPause(false){
// To avoid some exceptions // To avoid some exceptions
fs::path::default_name_check(fs::no_check); fs::path::default_name_check(fs::no_check);
// Creating bittorrent session // Creating bittorrent session
s = new session(fingerprint("qB", VERSION_MAJOR, VERSION_MINOR, VERSION_BUGFIX, 0)); s = new session(fingerprint("qB", VERSION_MAJOR, VERSION_MINOR, VERSION_BUGFIX, 0));
// Set severity level of libtorrent session // Set severity level of libtorrent session
s->set_severity_level(alert::info); s->set_severity_level(alert::info);
// Enable LSD/UPnP/NAT-PMP
s->start_lsd();
s->start_natpmp();
s->start_upnp();
// Enabling metadata plugin // Enabling metadata plugin
s->add_extension(&create_metadata_plugin); s->add_extension(&create_metadata_plugin);
timerAlerts = new QTimer(); timerAlerts = new QTimer();
@ -85,6 +81,25 @@ bittorrent::~bittorrent() {
delete s; delete s;
} }
void bittorrent::preAllocateAllFiles(bool b) {
preAllocateAll = b;
if(b) {
// Reload All Torrents
std::vector<torrent_handle> handles = s->get_torrents();
unsigned int nbHandles = handles.size();
for(unsigned int i=0; i<nbHandles; ++i) {
QTorrentHandle h = handles[i];
if(!h.is_valid()) {
qDebug("/!\\ Error: Invalid handle");
continue;
}
QString hash = h.hash();
if(has_filtered_files(hash)) continue;
reloadTorrent(h);
}
}
}
void bittorrent::setDownloadLimit(QString hash, long val) { void bittorrent::setDownloadLimit(QString hash, long val) {
QTorrentHandle h = getTorrentHandle(hash); QTorrentHandle h = getTorrentHandle(hash);
if(h.is_valid()) if(h.is_valid())
@ -104,6 +119,10 @@ void bittorrent::handleDownloadFailure(QString url, QString reason) {
emit downloadFromUrlFailure(url, reason); emit downloadFromUrlFailure(url, reason);
} }
void bittorrent::startTorrentsInPause(bool b) {
addInPause = b;
}
void bittorrent::updateETAs() { void bittorrent::updateETAs() {
QString hash; QString hash;
foreach(hash, unfinishedTorrents) { foreach(hash, unfinishedTorrents) {
@ -346,7 +365,7 @@ void bittorrent::addTorrent(QString path, bool fromScanDir, QString from_url) {
} }
} }
// Processing torrents // Processing torrents
file = path.trimmed().replace("file://", ""); file = path.trimmed().replace("file://", "", Qt::CaseInsensitive);
if(file.isEmpty()) { if(file.isEmpty()) {
return; return;
} }
@ -409,7 +428,7 @@ void bittorrent::addTorrent(QString path, bool fromScanDir, QString from_url) {
} }
QString savePath = getSavePath(hash); QString savePath = getSavePath(hash);
// Adding files to bittorrent session // Adding files to bittorrent session
if(has_filtered_files(hash)) { if(has_filtered_files(hash) || preAllocateAll) {
h = s->add_torrent(t, fs::path(savePath.toUtf8().data()), resume_data, false, true); h = s->add_torrent(t, fs::path(savePath.toUtf8().data()), resume_data, false, true);
qDebug(" -> Full allocation mode"); qDebug(" -> Full allocation mode");
}else{ }else{
@ -450,7 +469,7 @@ void bittorrent::addTorrent(QString path, bool fromScanDir, QString from_url) {
QFile::copy(file, newFile); QFile::copy(file, newFile);
} }
// Pause torrent if it was paused last time // Pause torrent if it was paused last time
if(QFile::exists(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+hash+".paused")) { if(addInPause || QFile::exists(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+hash+".paused")) {
torrentsToPauseAfterChecking << hash; torrentsToPauseAfterChecking << hash;
qDebug("Adding a torrent to the torrentsToPauseAfterChecking list"); qDebug("Adding a torrent to the torrentsToPauseAfterChecking list");
} }
@ -543,8 +562,33 @@ bool bittorrent::isDHTEnabled() const{
return DHTEnabled; return DHTEnabled;
} }
void bittorrent::enableUPnP(bool b) {
if(b) {
s->start_upnp();
} else {
s->stop_upnp();
}
}
void bittorrent::enableNATPMP(bool b) {
if(b) {
s->start_natpmp();
} else {
s->stop_natpmp();
}
}
void bittorrent::enableLSD(bool b) {
if(b) {
s->start_lsd();
} else {
s->stop_lsd();
}
}
// Enable DHT // Enable DHT
void bittorrent::enableDHT() { void bittorrent::enableDHT(bool b) {
if(b) {
if(!DHTEnabled) { if(!DHTEnabled) {
boost::filesystem::ifstream dht_state_file((misc::qBittorrentPath()+QString::fromUtf8("dht_state")).toUtf8().data(), std::ios_base::binary); boost::filesystem::ifstream dht_state_file((misc::qBittorrentPath()+QString::fromUtf8("dht_state")).toUtf8().data(), std::ios_base::binary);
dht_state_file.unsetf(std::ios_base::skipws); dht_state_file.unsetf(std::ios_base::skipws);
@ -559,15 +603,13 @@ void bittorrent::enableDHT() {
DHTEnabled = true; DHTEnabled = true;
qDebug("DHT enabled"); qDebug("DHT enabled");
} }
} } else {
// Disable DHT
void bittorrent::disableDHT() {
if(DHTEnabled) { if(DHTEnabled) {
DHTEnabled = false; DHTEnabled = false;
s->stop_dht(); s->stop_dht();
qDebug("DHT disabled"); qDebug("DHT disabled");
} }
}
} }
void bittorrent::saveTorrentSpeedLimits(QString hash) { void bittorrent::saveTorrentSpeedLimits(QString hash) {

10
src/bittorrent.h

@ -57,6 +57,8 @@ class bittorrent : public QObject{
QStringList waitingForPause; QStringList waitingForPause;
QStringList finishedTorrents; QStringList finishedTorrents;
QStringList unfinishedTorrents; QStringList unfinishedTorrents;
bool preAllocateAll;
bool addInPause;
protected: protected:
QString getSavePath(QString hash); QString getSavePath(QString hash);
@ -90,9 +92,8 @@ class bittorrent : public QObject{
void deleteTorrent(QString hash, bool permanent = false); void deleteTorrent(QString hash, bool permanent = false);
bool pauseTorrent(QString hash); bool pauseTorrent(QString hash);
bool resumeTorrent(QString hash); bool resumeTorrent(QString hash);
void enableDHT();
void disableDHT();
void saveDHTEntry(); void saveDHTEntry();
void preAllocateAllFiles(bool b);
void saveFastResumeAndRatioData(); void saveFastResumeAndRatioData();
void enableDirectoryScanning(QString scan_dir); void enableDirectoryScanning(QString scan_dir);
void disableDirectoryScanning(); void disableDirectoryScanning();
@ -117,6 +118,7 @@ class bittorrent : public QObject{
void setDHTPort(int dht_port); void setDHTPort(int dht_port);
void setProxySettings(proxy_settings proxySettings, bool trackers=true, bool peers=true, bool web_seeds=true, bool dht=true); void setProxySettings(proxy_settings proxySettings, bool trackers=true, bool peers=true, bool web_seeds=true, bool dht=true);
void setSessionSettings(session_settings sessionSettings); void setSessionSettings(session_settings sessionSettings);
void startTorrentsInPause(bool b);
void setDefaultSavePath(QString savepath); void setDefaultSavePath(QString savepath);
void applyEncryptionSettings(pe_settings se); void applyEncryptionSettings(pe_settings se);
void loadFilesPriorities(QTorrentHandle& h); void loadFilesPriorities(QTorrentHandle& h);
@ -124,6 +126,10 @@ class bittorrent : public QObject{
void setUploadLimit(QString hash, long val); void setUploadLimit(QString hash, long val);
void setUnfinishedTorrent(QString hash); void setUnfinishedTorrent(QString hash);
void setFinishedTorrent(QString hash); void setFinishedTorrent(QString hash);
void enableUPnP(bool b);
void enableNATPMP(bool b);
void enableLSD(bool b);
void enableDHT(bool b);
protected slots: protected slots:
void scanDirectory(); void scanDirectory();

2
src/downloadingTorrents.cpp

@ -246,7 +246,7 @@ void DownloadingTorrents::displayDLListMenu(const QPoint& pos) {
// Enable/disable pause/start action given the DL state // Enable/disable pause/start action given the DL state
QModelIndexList selectedIndexes = downloadList->selectionModel()->selectedIndexes(); QModelIndexList selectedIndexes = downloadList->selectionModel()->selectedIndexes();
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent")); QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
QString previewProgram = settings.value(QString::fromUtf8("Options/Misc/PreviewProgram"), QString()).toString(); QString previewProgram = settings.value(QString::fromUtf8("Preferences/general/MediaPlayer"), QString()).toString();
bool has_pause = false, has_start = false, has_preview = false; bool has_pause = false, has_start = false, has_preview = false;
foreach(index, selectedIndexes) { foreach(index, selectedIndexes) {
if(index.column() == NAME) { if(index.column() == NAME) {

36
src/engineSelectDlg.cpp

@ -79,17 +79,17 @@ void engineSelectDlg::dropEvent(QDropEvent *event) {
foreach(file, files) { foreach(file, files) {
qDebug("dropped %s", file.toUtf8().data()); qDebug("dropped %s", file.toUtf8().data());
file = file.replace("file://", ""); file = file.replace("file://", "");
if(file.startsWith("http://") || file.startsWith("https://") || file.startsWith("ftp://")) { if(file.startsWith("http://", Qt::CaseInsensitive) || file.startsWith("https://", Qt::CaseInsensitive) || file.startsWith("ftp://", Qt::CaseInsensitive)) {
downloader->downloadUrl(file); downloader->downloadUrl(file);
continue; continue;
} }
if(file.endsWith(".py")) { if(file.endsWith(".py", Qt::CaseInsensitive)) {
QString plugin_name = file.split(QDir::separator()).last(); QString plugin_name = file.split(QDir::separator()).last();
plugin_name.replace(".py", ""); plugin_name.replace(".py", "");
installPlugin(file, plugin_name); installPlugin(file, plugin_name);
} }
#ifdef HAVE_ZZIP #ifdef HAVE_ZZIP
if(file.endsWith(".zip")) { if(file.endsWith(".zip", Qt::CaseInsensitive)) {
installZipPlugin(file); installZipPlugin(file);
} }
#endif #endif
@ -332,7 +332,7 @@ QList<QTreeWidgetItem*> engineSelectDlg::findItemsWithUrl(QString url){
QList<QTreeWidgetItem*> res; QList<QTreeWidgetItem*> res;
for(int i=0; i<pluginsTree->topLevelItemCount(); ++i) { for(int i=0; i<pluginsTree->topLevelItemCount(); ++i) {
QTreeWidgetItem *item = pluginsTree->topLevelItem(i); QTreeWidgetItem *item = pluginsTree->topLevelItem(i);
if(url.startsWith(item->text(ENGINE_URL))) if(url.startsWith(item->text(ENGINE_URL), Qt::CaseInsensitive))
res << item; res << item;
} }
return res; return res;
@ -367,10 +367,10 @@ void engineSelectDlg::installZipPlugin(QString path) {
while(zzip_dir_read(dir, &dirent)) { while(zzip_dir_read(dir, &dirent)) {
/* show info for first file */ /* show info for first file */
QString name(dirent.d_name); QString name(dirent.d_name);
if(name.endsWith(".py")) { if(name.endsWith(".py", Qt::CaseInsensitive)) {
plugins << name; plugins << name;
} else { } else {
if(name.endsWith(".png")) { if(name.endsWith(".png", Qt::CaseInsensitive)) {
favicons << name; favicons << name;
} }
} }
@ -520,14 +520,14 @@ void engineSelectDlg::on_installButton_clicked() {
#endif #endif
QString path; QString path;
foreach(path, pathsList) { foreach(path, pathsList) {
if(path.endsWith(".py")) { if(path.endsWith(".py", Qt::CaseInsensitive)) {
QString plugin_name = path.split(QDir::separator()).last(); QString plugin_name = path.split(QDir::separator()).last();
plugin_name.replace(".py", ""); plugin_name.replace(".py", "", Qt::CaseInsensitive);
installPlugin(path, plugin_name); installPlugin(path, plugin_name);
} }
#ifdef HAVE_ZZIP #ifdef HAVE_ZZIP
else { else {
if(path.endsWith(".zip")) { if(path.endsWith(".zip", Qt::CaseInsensitive)) {
installZipPlugin(path); installZipPlugin(path);
} }
} }
@ -582,7 +582,7 @@ bool engineSelectDlg::parseVersionsFile(QString versions_file, QString updateSer
void engineSelectDlg::processDownloadedFile(QString url, QString filePath) { void engineSelectDlg::processDownloadedFile(QString url, QString filePath) {
qDebug("engineSelectDlg received %s", url.toUtf8().data()); qDebug("engineSelectDlg received %s", url.toUtf8().data());
if(url.endsWith("favicon.ico")){ if(url.endsWith("favicon.ico", Qt::CaseInsensitive)){
// Icon downloaded // Icon downloaded
QImage fileIcon; QImage fileIcon;
#ifdef HAVE_MAGICK #ifdef HAVE_MAGICK
@ -628,7 +628,7 @@ void engineSelectDlg::processDownloadedFile(QString url, QString filePath) {
QFile::remove(filePath); QFile::remove(filePath);
return; return;
} }
if(url.endsWith(".pyqBT") || url.endsWith(".py")) { if(url.endsWith(".pyqBT", Qt::CaseInsensitive) || url.endsWith(".py", Qt::CaseInsensitive)) {
QString plugin_name = url.split('/').last(); QString plugin_name = url.split('/').last();
plugin_name.replace(".py", ""); plugin_name.replace(".py", "");
plugin_name.replace(".pyqBT", ""); plugin_name.replace(".pyqBT", "");
@ -637,7 +637,7 @@ void engineSelectDlg::processDownloadedFile(QString url, QString filePath) {
return; return;
} }
#ifdef HAVE_ZZIP #ifdef HAVE_ZZIP
if(url.endsWith(".zip")) { if(url.endsWith(".zip", Qt::CaseInsensitive)) {
installZipPlugin(filePath); installZipPlugin(filePath);
QFile::remove(filePath); QFile::remove(filePath);
return; return;
@ -646,7 +646,7 @@ void engineSelectDlg::processDownloadedFile(QString url, QString filePath) {
} }
void engineSelectDlg::handleDownloadFailure(QString url, QString reason) { void engineSelectDlg::handleDownloadFailure(QString url, QString reason) {
if(url.endsWith("favicon.ico")){ if(url.endsWith("favicon.ico", Qt::CaseInsensitive)){
qDebug("Could not download favicon: %s, reason: %s", url.toUtf8().data(), reason.toUtf8().data()); qDebug("Could not download favicon: %s, reason: %s", url.toUtf8().data(), reason.toUtf8().data());
return; return;
} }
@ -660,17 +660,17 @@ void engineSelectDlg::handleDownloadFailure(QString url, QString reason) {
QMessageBox::warning(this, tr("Search plugin update")+" -- "+tr("qBittorrent"), tr("Sorry, update server is temporarily unavailable.")); QMessageBox::warning(this, tr("Search plugin update")+" -- "+tr("qBittorrent"), tr("Sorry, update server is temporarily unavailable."));
return; return;
} }
if(url.endsWith(".pyqBT") || url.endsWith(".py")) { if(url.endsWith(".pyqBT", Qt::CaseInsensitive) || url.endsWith(".py", Qt::CaseInsensitive)) {
// a plugin update download has been failed // a plugin update download has been failed
QString plugin_name = url.split('/').last(); QString plugin_name = url.split('/').last();
plugin_name.replace(".pyqBT", ""); plugin_name.replace(".pyqBT", "", Qt::CaseInsensitive);
plugin_name.replace(".py", ""); plugin_name.replace(".py", "", Qt::CaseInsensitive);
QMessageBox::warning(this, tr("Search plugin update")+" -- "+tr("qBittorrent"), tr("Sorry, %1 search plugin install failed.", "%1 is the name of the search engine").arg(plugin_name.toUtf8().data())); QMessageBox::warning(this, tr("Search plugin update")+" -- "+tr("qBittorrent"), tr("Sorry, %1 search plugin install failed.", "%1 is the name of the search engine").arg(plugin_name.toUtf8().data()));
} }
#ifdef HAVE_ZZIP #ifdef HAVE_ZZIP
if(url.endsWith(".zip")) { if(url.endsWith(".zip", Qt::CaseInsensitive)) {
QString plugin_name = url.split('/').last(); QString plugin_name = url.split('/').last();
plugin_name.replace(".zip", ""); plugin_name.replace(".zip", "", Qt::CaseInsensitive);
QMessageBox::warning(this, tr("Search plugin update")+" -- "+tr("qBittorrent"), tr("Sorry, %1 search plugin install failed.", "%1 is the name of the search engine").arg(plugin_name.toUtf8().data())); QMessageBox::warning(this, tr("Search plugin update")+" -- "+tr("qBittorrent"), tr("Sorry, %1 search plugin install failed.", "%1 is the name of the search engine").arg(plugin_name.toUtf8().data()));
} }
#endif #endif

1764
src/lang/qbittorrent_ko.ts

File diff suppressed because it is too large Load Diff

52
src/main.cpp

@ -44,33 +44,33 @@
#include "GUI.h" #include "GUI.h"
#include "misc.h" #include "misc.h"
void useStyle(QApplication *app, QString style){ void useStyle(QApplication *app, int style){
std::cout << "* Style: Using " << style.toStdString() << " style\n"; switch(style) {
if(style == QString::fromUtf8("Cleanlooks")){ case 0:
app->setStyle(new QPlastiqueStyle());
break;
case 1:
app->setStyle(new QCleanlooksStyle()); app->setStyle(new QCleanlooksStyle());
return; break;
} case 2:
if(style == QString::fromUtf8("Motif")){
app->setStyle(new QMotifStyle()); app->setStyle(new QMotifStyle());
return; break;
} case 3:
if(style == QString::fromUtf8("CDE")){
app->setStyle(new QCDEStyle()); app->setStyle(new QCDEStyle());
return; break;
}
#ifdef Q_WS_MAC #ifdef Q_WS_MAC
if(style == QString::fromUtf8("MacOS")){ case 4:
app->setStyle(new QMacStyle()); app->setStyle(new QMacStyle());
return; break;
}
#endif #endif
#ifdef Q_WS_WIN #ifdef Q_WS_WIN
if(style == QString::fromUtf8("WinXP")){ case 4:
app->setStyle(new QWindowsXPStyle()); app->setStyle(new QWindowsXPStyle());
return; break;
}
#endif #endif
default:
app->setStyle(new QPlastiqueStyle()); app->setStyle(new QPlastiqueStyle());
}
} }
// Main // Main
@ -123,27 +123,15 @@ int main(int argc, char *argv[]){
} }
QApplication app(argc, argv); QApplication app(argc, argv);
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent")); QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
QString style; useStyle(&app, settings.value("Preferences/General/Style", 4).toInt());
#ifdef Q_WS_WIN
style = settings.value(QString::fromUtf8("Options/Style"), QString::fromUtf8("WinXP")).toString();
#endif
#ifdef Q_WS_MAC
style = settings.value(QString::fromUtf8("Options/Style"), QString::fromUtf8("MacOS")).toString();
#endif
#ifndef Q_WS_WIN
#ifndef Q_WS_MAC
style = settings.value(QString::fromUtf8("Options/Style"), QString::fromUtf8("Plastique")).toString();
#endif
#endif
useStyle(&app, style);
QSplashScreen *splash = new QSplashScreen(QPixmap(QString::fromUtf8(":/Icons/splash.png"))); QSplashScreen *splash = new QSplashScreen(QPixmap(QString::fromUtf8(":/Icons/splash.png")));
splash->show(); splash->show();
// Open options file to read locale // Open options file to read locale
locale = settings.value(QString::fromUtf8("Options/Language/Locale"), QString()).toString(); locale = settings.value(QString::fromUtf8("Preferences/General/Locale"), QString()).toString();
QTranslator translator; QTranslator translator;
if(locale.isEmpty()){ if(locale.isEmpty()){
locale = QLocale::system().name(); locale = QLocale::system().name();
settings.setValue(QString::fromUtf8("Options/Language/Locale"), locale); settings.setValue(QString::fromUtf8("Preferences/General/Locale"), locale);
} }
if(translator.load(QString::fromUtf8(":/lang/qbittorrent_") + locale)){ if(translator.load(QString::fromUtf8(":/lang/qbittorrent_") + locale)){
qDebug("%s locale recognized, using translation.", (const char*)locale.toUtf8()); qDebug("%s locale recognized, using translation.", (const char*)locale.toUtf8());

1894
src/options.ui

File diff suppressed because it is too large Load Diff

1590
src/optionsNG.ui

File diff suppressed because it is too large Load Diff

1099
src/options_imp.cpp

File diff suppressed because it is too large Load Diff

109
src/options_imp.h

@ -25,10 +25,10 @@
#include "ui_options.h" #include "ui_options.h"
#include <libtorrent/ip_filter.hpp> #include <libtorrent/ip_filter.hpp>
#define HTTP 0 #define HTTP 1
#define SOCKS5 1 #define SOCKS5 2
#define HTTP_PW 2 #define HTTP_PW 3
#define SOCKS5_PW 3 #define SOCKS5_PW 4
using namespace libtorrent; using namespace libtorrent;
@ -51,71 +51,82 @@ class options_imp : public QDialog, private Ui::Dialog{
// Methods // Methods
void saveOptions(); void saveOptions();
void loadOptions(); void loadOptions();
// Main options // General options
std::pair<unsigned short, unsigned short> getPorts() const; QString getLocale() const;
QPair<int,int> getLimits() const; int getStyle() const;
float getRatio() const; bool confirmOnExit() const;
int getMaxConnec() const; bool speedInTitleBar() const;
bool systrayIntegration() const;
bool minimizeToTray() const;
bool closeToTray() const;
bool OSDEnabled() const;
QString getPreviewProgram() const;
// Downloads
QString getSavePath() const;
bool preAllocateAllFiles() const;
bool useAdditionDialog() const;
bool addTorrentsInPause() const;
bool isDirScanEnabled() const;
QString getScanDir() const; QString getScanDir() const;
bool isDHTEnabled() const; // Connection options
int getDHTPort() const; std::pair<unsigned short, unsigned short> getPorts() const;
int getEncryptionSetting() const; bool isUPnPEnabled() const;
bool isPeXDisabled() const; bool isNATPMPEnabled() const;
// Filter Settings QPair<int,int> getGlobalBandwidthLimits() const;
bool isFilteringEnabled() const;
ip_filter getFilter() const;
// Proxy settings
bool isProxyEnabled() const; bool isProxyEnabled() const;
bool isProxyAuthEnabled() const; bool isProxyAuthEnabled() const;
QString getProxyIp() const; QString getProxyIp() const;
unsigned short getProxyPort() const; unsigned short getProxyPort() const;
QString getProxyUsername() const; QString getProxyUsername() const;
QString getProxyPassword() const; QString getProxyPassword() const;
unsigned short getProxyType() const; int getProxyType() const;
bool useProxyForTrackers() const; bool useProxyForTrackers() const;
bool useProxyForPeers() const; bool useProxyForPeers() const;
bool useProxyForWebseeds() const; bool useProxyForWebseeds() const;
bool useProxyForDHT() const; bool useProxyForDHT() const;
// Language Settings // Bittorrent options
QString getLocale() const; int getMaxConnecs() const;
// Misc Settings int getMaxConnecsPerTorrent() const;
bool useAdditionDialog() const; int getMaxUploadsPerTorrent() const;
QString getSavePath() const; bool isDHTEnabled() const;
bool getGoToSysTrayOnMinimizingWindow() const; bool isPeXEnabled() const;
bool getGoToSysTrayOnExitingWindow() const; bool isLSDEnabled() const;
bool getConfirmOnExit() const; int getEncryptionSetting() const;
QString getPreviewProgram() const; float getDesiredRatio() const;
bool getUseOSDAlways() const; float getDeleteRatio() const;
bool getUseOSDWhenHiddenOnly() const; // IP Filter
QString getStyle() const; bool isFilteringEnabled() const;
bool useSystrayIntegration() const; ip_filter getFilter() const;
protected slots: protected slots:
void enableUploadLimit(int checkBoxValue);
void enableDownloadLimit(int checkBoxValue);
void enableDirScan(int checkBoxValue);
void enableProxy(int comboIndex);
void enableProxyAuth(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 setStyle(int style);
void on_buttonBox_accepted(); void on_buttonBox_accepted();
void closeEvent(QCloseEvent *e); void closeEvent(QCloseEvent *e);
void on_buttonBox_rejected(); void on_buttonBox_rejected();
void applySettings(QAbstractButton* button); void applySettings(QAbstractButton* button);
void on_addFilterRange_clicked(); void on_addFilterRangeButton_clicked();
void on_delFilterRange_clicked(); void on_delFilterRangeButton_clicked();
void on_browse_button_scan_clicked(); void on_browseScanDirButton_clicked();
void on_browsePreview_clicked(); void on_browsePreviewButton_clicked();
void on_filterBrowse_clicked(); void on_browseFilterButton_clicked();
void disableDownload(int checkBoxValue); void on_browseSaveDirButton_clicked();
void disableDHTGroup(int checkBoxValue);
void disableMaxConnecLimit(int);
void enableFilter(int checkBoxValue);
void disableUpload(int checkBoxValue);
void disableShareRatio(int checkBoxValue);
void enableProxy(int checkBoxValue);
void enableProxyAuth(int checkBoxValue);
void enableDirScan(int checkBoxValue);
void on_browse_button_clicked();
void processFilterFile(QString filePath=QString()); void processFilterFile(QString filePath=QString());
void enableApplyButton(); void enableApplyButton();
void checkPortsLogic(); void checkPortsLogic();
void enableSavePath(int checkBoxValue); void enableSystrayOptions();
void setStyle(QString style); void disableSystrayOptions();
void systrayDisabled(int val); void setSystrayOptionsState(int checkBoxValue);
public slots: public slots:
void setLocale(QString locale); void setLocale(QString locale);

4
src/searchEngine.cpp

@ -389,8 +389,8 @@ void SearchEngine::updateNova() {
// Error | Stopped by user | Finished normally // Error | Stopped by user | Finished normally
void SearchEngine::searchFinished(int exitcode,QProcess::ExitStatus){ void SearchEngine::searchFinished(int exitcode,QProcess::ExitStatus){
QSettings settings("qBittorrent", "qBittorrent"); QSettings settings("qBittorrent", "qBittorrent");
int useOSD = settings.value("Options/OSDEnabled", 1).toInt(); bool useNotificationBalloons = settings.value("Preferences/General/NotificationBaloons", true).toBool();
if(systrayIntegration && (useOSD == 1 || (useOSD == 2 && (isMinimized() || isHidden())))) { if(systrayIntegration && useNotificationBalloons) {
myTrayIcon->showMessage(tr("Search Engine"), tr("Search has finished"), QSystemTrayIcon::Information, TIME_TRAY_BALLOON); myTrayIcon->showMessage(tr("Search Engine"), tr("Search has finished"), QSystemTrayIcon::Information, TIME_TRAY_BALLOON);
} }
if(exitcode){ if(exitcode){

4
src/torrentAddition.h

@ -83,6 +83,10 @@ class torrentAdditionDialog : public QDialog, private Ui_addTorrentDialog{
} }
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent")); QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
savePathTxt->setText(settings.value(QString::fromUtf8("LastDirTorrentAdd"), home+QString::fromUtf8("qBT_dir")).toString()); savePathTxt->setText(settings.value(QString::fromUtf8("LastDirTorrentAdd"), home+QString::fromUtf8("qBT_dir")).toString());
if(settings.value("Preferences/Downloads/StartInPause", false).toBool()) {
addInPause->setChecked(true);
addInPause->setEnabled(false);
}
} }
void showLoad(QString filePath, bool fromScanDir=false, QString from_url=QString::null){ void showLoad(QString filePath, bool fromScanDir=false, QString from_url=QString::null){

Loading…
Cancel
Save