diff --git a/Changelog b/Changelog index 639754bfc..4e161982f 100644 --- a/Changelog +++ b/Changelog @@ -1,5 +1,6 @@ * Unreleased - Christophe Dumez - v2.1.0 - FEATURE: Torrents can be labeled/categorized + - FEATURE: Disk cache size can be set from preferences * Thu Dec 10 2009 - Christophe Dumez - v2.0.0 - FEATURE: Added program option to disable splash screen diff --git a/src/bittorrent.cpp b/src/bittorrent.cpp index e4d93b715..4b20c5144 100644 --- a/src/bittorrent.cpp +++ b/src/bittorrent.cpp @@ -321,6 +321,8 @@ void Bittorrent::configureSession() { #endif // To keep same behavior as in qBittorrent v1.2.0 sessionSettings.rate_limit_ip_overhead = false; + sessionSettings.cache_size = Preferences::diskCacheSize()*64; + addConsoleMessage(tr("Using a disk cache size of %1 MiB").arg(Preferences::diskCacheSize())); // Queueing System if(Preferences::isQueueingSystemEnabled()) { sessionSettings.active_downloads = Preferences::getMaxActiveDownloads(); diff --git a/src/options_imp.cpp b/src/options_imp.cpp index 52100d2c0..939689d76 100644 --- a/src/options_imp.cpp +++ b/src/options_imp.cpp @@ -191,6 +191,7 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){ // Downloads tab connect(textSavePath, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton())); connect(checkPreallocateAll, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); + connect(spinCache, SIGNAL(valueChanged(QString)), 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())); @@ -368,6 +369,7 @@ void options_imp::saveOptions(){ settings.setValue(QString::fromUtf8("TempPathEnabled"), isTempPathEnabled()); settings.setValue(QString::fromUtf8("TempPath"), getTempPath()); settings.setValue(QString::fromUtf8("PreAllocation"), preAllocateAllFiles()); + settings.setValue(QString::fromUtf8("DiskCache"), spinCache->value()); settings.setValue(QString::fromUtf8("AdditionDialog"), useAdditionDialog()); settings.setValue(QString::fromUtf8("StartInPause"), addTorrentsInPause()); settings.setValue(QString::fromUtf8("ScanDir"), getScanDir()); @@ -577,6 +579,7 @@ void options_imp::loadOptions(){ } textTempPath->setText(Preferences::getTempPath()); checkPreallocateAll->setChecked(Preferences::preAllocateAllFiles()); + spinCache->setValue(Preferences::diskCacheSize()); checkAdditionDialog->setChecked(Preferences::useAdditionDialog()); checkStartPaused->setChecked(Preferences::addTorrentsInPause()); strValue = Preferences::getScanDir(); diff --git a/src/preferences.h b/src/preferences.h index 3e7f09130..596006769 100644 --- a/src/preferences.h +++ b/src/preferences.h @@ -138,6 +138,11 @@ public: return settings.value(QString::fromUtf8("Preferences/Downloads/PreAllocation"), false).toBool(); } + static int diskCacheSize() { + QSettings settings("qBittorrent", "qBittorrent"); + return settings.value(QString::fromUtf8("Preferences/Downloads/DiskCache"), 16).toInt(); + } + static bool useAdditionDialog() { QSettings settings("qBittorrent", "qBittorrent"); return settings.value(QString::fromUtf8("Preferences/Downloads/AdditionDialog"), true).toBool(); diff --git a/src/ui/options.ui b/src/ui/options.ui index 9989304b2..8efdadcb8 100644 --- a/src/ui/options.ui +++ b/src/ui/options.ui @@ -21,11 +21,11 @@ - + - + 0 0 @@ -36,6 +36,12 @@ 0 + + + 121 + 16777215 + + QFrame::StyledPanel @@ -98,7 +104,7 @@ AlignHCenter|AlignVCenter|AlignCenter - + :/Icons/oxygen/preferences-desktop.png:/Icons/oxygen/preferences-desktop.png @@ -113,7 +119,7 @@ AlignHCenter|AlignVCenter|AlignCenter - + :/Icons/oxygen/download.png:/Icons/oxygen/download.png @@ -128,7 +134,7 @@ AlignHCenter|AlignVCenter|AlignCenter - + :/Icons/oxygen/connection.png:/Icons/oxygen/connection.png @@ -143,7 +149,7 @@ AlignHCenter|AlignVCenter|AlignCenter - + :/Icons/oxygen/bt_settings.png:/Icons/oxygen/bt_settings.png @@ -155,7 +161,7 @@ Proxy - + :/Icons/oxygen/proxy.png:/Icons/oxygen/proxy.png @@ -167,7 +173,7 @@ AlignHCenter|AlignVCenter|AlignCenter - + :/Icons/oxygen/filter.png:/Icons/oxygen/filter.png @@ -182,7 +188,7 @@ AlignHCenter|AlignVCenter|AlignCenter - + :/Icons/oxygen/webui.png:/Icons/oxygen/webui.png @@ -197,7 +203,7 @@ AlignHCenter|AlignVCenter|AlignCenter - + :/Icons/rss32.png:/Icons/rss32.png @@ -215,6 +221,12 @@ + + + 0 + 0 + + true @@ -224,7 +236,7 @@ 0 0 620 - 488 + 490 @@ -626,8 +638,8 @@ 0 0 - 620 - 149 + 642 + 457 @@ -691,7 +703,7 @@ - + :/Icons/oxygen/browse.png:/Icons/oxygen/browse.png @@ -740,7 +752,7 @@ - + :/Icons/oxygen/browse.png:/Icons/oxygen/browse.png @@ -754,250 +766,37 @@ - - - - - - - - - - - - 0 - 0 - - - - Folder watching - - - - - - Automatically download torrents present in this folder: - - - - - - - 6 - - - 0 - - - - - false - - - - - - - false - - - - 22 - 22 - - - - - 25 - 27 - - - - - :/Icons/oxygen/browse.png:/Icons/oxygen/browse.png - - - - - - - - - - - - - - Torrent queueing - - - - - - Enable queueing system - - - - - - - - - false - - - Maximum active downloads: - - - - - - - false - - - -1 - - - 999 - - - 3 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - false - - - Maximum active uploads: - - - - - - false - - - -1 - - - 999 - - - 3 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - false - - - Maximum active torrents: - - - - - - - false - - - -1 - - - 999 - - - 5 - - - - - - - Qt::Horizontal - - - - 381 - 20 - - - - - - - - - - - - - - - - 0 - 0 - - - - When adding a torrent - - - - + - + - Display torrent content and some options + Disk cache: - - true + + + + + + 1 + + + 9999 + + + 16 + + + + + + + MiB (advanced) - + Qt::Horizontal @@ -1011,27 +810,65 @@ + + + + + + + + 0 + 0 + + + + Folder watching + + + + + + Automatically download torrents present in this folder: + + + - + + + 6 + + + 0 + - - - Do not start download automatically + + + false - - - Qt::Horizontal + + + false - + - 40 - 20 + 22 + 22 - + + + 25 + 27 + + + + + :/Icons/oxygen/browse.png:/Icons/oxygen/browse.png + + @@ -1039,34 +876,240 @@ - - - Qt::Vertical - - - - 20 - 40 - - - + + + + + Torrent queueing + + + + + + Enable queueing system + + + + + + + + + false + + + Maximum active downloads: + + + + + + + false + + + -1 + + + 999 + + + 3 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + false + + + Maximum active uploads: + + + + + + + false + + + -1 + + + 999 + + + 3 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + false + + + Maximum active torrents: + + + + + + + false + + + -1 + + + 999 + + + 5 + + + + + + + Qt::Horizontal + + + + 381 + 20 + + + + + + + + + + + + + + + + 0 + 0 + + + + When adding a torrent + + + + + + + + Display torrent content and some options + + + true + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + Do not start download automatically + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + - - - - - - - Qt::Vertical - - - - 20 - 40 - - - + + @@ -1082,7 +1125,7 @@ 0 0 - 602 + 451 513 @@ -1503,8 +1546,8 @@ 0 0 - 620 - 488 + 468 + 347 @@ -1804,8 +1847,8 @@ 0 0 - 620 - 488 + 363 + 424 @@ -2360,7 +2403,7 @@ - + :/Icons/oxygen/browse.png:/Icons/oxygen/browse.png @@ -2612,7 +2655,7 @@ - :/Icons/rss32.png + :/Icons/rss32.png true @@ -2733,7 +2776,7 @@ - + @@ -2748,27 +2791,17 @@ - - - 6 + + + Qt::Horizontal - - 0 + + QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - Qt::Horizontal - - - QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - false - - - - + + false + + @@ -2811,7 +2844,7 @@ textWebUiPassword - +