Browse Source

FEATURE: Disk cache size can be set from preferences

adaptive-webui-19844
Christophe Dumez 15 years ago
parent
commit
db5402385a
  1. 1
      Changelog
  2. 2
      src/bittorrent.cpp
  3. 3
      src/options_imp.cpp
  4. 5
      src/preferences.h
  5. 131
      src/ui/options.ui

1
Changelog

@ -1,5 +1,6 @@ @@ -1,5 +1,6 @@
* Unreleased - Christophe Dumez <chris@qbittorrent.org> - v2.1.0
- FEATURE: Torrents can be labeled/categorized
- FEATURE: Disk cache size can be set from preferences
* Thu Dec 10 2009 - Christophe Dumez <chris@qbittorrent.org> - v2.0.0
- FEATURE: Added program option to disable splash screen

2
src/bittorrent.cpp

@ -321,6 +321,8 @@ void Bittorrent::configureSession() { @@ -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();

3
src/options_imp.cpp

@ -191,6 +191,7 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){ @@ -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(){ @@ -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(){ @@ -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();

5
src/preferences.h

@ -138,6 +138,11 @@ public: @@ -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();

131
src/ui/options.ui

@ -21,11 +21,11 @@ @@ -21,11 +21,11 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QListWidget" name="tabSelection">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -36,6 +36,12 @@ @@ -36,6 +36,12 @@
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>121</width>
<height>16777215</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
@ -98,7 +104,7 @@ @@ -98,7 +104,7 @@
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
<property name="icon">
<iconset>
<iconset resource="../icons.qrc">
<normaloff>:/Icons/oxygen/preferences-desktop.png</normaloff>:/Icons/oxygen/preferences-desktop.png</iconset>
</property>
<property name="flags">
@ -113,7 +119,7 @@ @@ -113,7 +119,7 @@
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
<property name="icon">
<iconset>
<iconset resource="../icons.qrc">
<normaloff>:/Icons/oxygen/download.png</normaloff>:/Icons/oxygen/download.png</iconset>
</property>
<property name="flags">
@ -128,7 +134,7 @@ @@ -128,7 +134,7 @@
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
<property name="icon">
<iconset>
<iconset resource="../icons.qrc">
<normaloff>:/Icons/oxygen/connection.png</normaloff>:/Icons/oxygen/connection.png</iconset>
</property>
<property name="flags">
@ -143,7 +149,7 @@ @@ -143,7 +149,7 @@
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
<property name="icon">
<iconset>
<iconset resource="../icons.qrc">
<normaloff>:/Icons/oxygen/bt_settings.png</normaloff>:/Icons/oxygen/bt_settings.png</iconset>
</property>
<property name="flags">
@ -155,7 +161,7 @@ @@ -155,7 +161,7 @@
<string>Proxy</string>
</property>
<property name="icon">
<iconset>
<iconset resource="../icons.qrc">
<normaloff>:/Icons/oxygen/proxy.png</normaloff>:/Icons/oxygen/proxy.png</iconset>
</property>
</item>
@ -167,7 +173,7 @@ @@ -167,7 +173,7 @@
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
<property name="icon">
<iconset>
<iconset resource="../icons.qrc">
<normaloff>:/Icons/oxygen/filter.png</normaloff>:/Icons/oxygen/filter.png</iconset>
</property>
<property name="flags">
@ -182,7 +188,7 @@ @@ -182,7 +188,7 @@
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
<property name="icon">
<iconset>
<iconset resource="../icons.qrc">
<normaloff>:/Icons/oxygen/webui.png</normaloff>:/Icons/oxygen/webui.png</iconset>
</property>
<property name="flags">
@ -197,7 +203,7 @@ @@ -197,7 +203,7 @@
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
<property name="icon">
<iconset>
<iconset resource="../icons.qrc">
<normaloff>:/Icons/rss32.png</normaloff>:/Icons/rss32.png</iconset>
</property>
<property name="flags">
@ -215,6 +221,12 @@ @@ -215,6 +221,12 @@
<layout class="QVBoxLayout" name="verticalLayout_10">
<item>
<widget class="QScrollArea" name="scrollArea">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
@ -224,7 +236,7 @@ @@ -224,7 +236,7 @@
<x>0</x>
<y>0</y>
<width>620</width>
<height>488</height>
<height>490</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_16">
@ -626,8 +638,8 @@ @@ -626,8 +638,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>620</width>
<height>149</height>
<width>642</width>
<height>457</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_17">
@ -691,7 +703,7 @@ @@ -691,7 +703,7 @@
</size>
</property>
<property name="icon">
<iconset>
<iconset resource="../icons.qrc">
<normaloff>:/Icons/oxygen/browse.png</normaloff>:/Icons/oxygen/browse.png</iconset>
</property>
</widget>
@ -740,7 +752,7 @@ @@ -740,7 +752,7 @@
</size>
</property>
<property name="icon">
<iconset>
<iconset resource="../icons.qrc">
<normaloff>:/Icons/oxygen/browse.png</normaloff>:/Icons/oxygen/browse.png</iconset>
</property>
</widget>
@ -754,11 +766,51 @@ @@ -754,11 +766,51 @@
</property>
</widget>
</item>
</layout>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_9">
<item>
<widget class="QLabel" name="label_7">
<property name="text">
<string>Disk cache:</string>
</property>
</widget>
</item>
</layout>
<item>
<widget class="QSpinBox" name="spinCache">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>9999</number>
</property>
<property name="value">
<number>16</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_8">
<property name="text">
<string>MiB (advanced)</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
@ -813,7 +865,7 @@ @@ -813,7 +865,7 @@
</size>
</property>
<property name="icon">
<iconset>
<iconset resource="../icons.qrc">
<normaloff>:/Icons/oxygen/browse.png</normaloff>:/Icons/oxygen/browse.png</iconset>
</property>
</widget>
@ -1055,18 +1107,9 @@ @@ -1055,18 +1107,9 @@
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
@ -1082,7 +1125,7 @@ @@ -1082,7 +1125,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>602</width>
<width>451</width>
<height>513</height>
</rect>
</property>
@ -1503,8 +1546,8 @@ @@ -1503,8 +1546,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>620</width>
<height>488</height>
<width>468</width>
<height>347</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_19">
@ -1804,8 +1847,8 @@ @@ -1804,8 +1847,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>620</width>
<height>488</height>
<width>363</width>
<height>424</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_20">
@ -2360,7 +2403,7 @@ @@ -2360,7 +2403,7 @@
</size>
</property>
<property name="icon">
<iconset>
<iconset resource="../icons.qrc">
<normaloff>:/Icons/oxygen/browse.png</normaloff>:/Icons/oxygen/browse.png</iconset>
</property>
</widget>
@ -2612,7 +2655,7 @@ @@ -2612,7 +2655,7 @@
<string/>
</property>
<property name="pixmap">
<pixmap>:/Icons/rss32.png</pixmap>
<pixmap resource="../icons.qrc">:/Icons/rss32.png</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
@ -2733,7 +2776,7 @@ @@ -2733,7 +2776,7 @@
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
@ -2747,14 +2790,6 @@ @@ -2747,14 +2790,6 @@
</property>
</spacer>
</item>
<item>
<layout class="QHBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
@ -2771,8 +2806,6 @@ @@ -2771,8 +2806,6 @@
</layout>
</item>
</layout>
</item>
</layout>
</widget>
<tabstops>
<tabstop>tabOption</tabstop>
@ -2811,7 +2844,7 @@ @@ -2811,7 +2844,7 @@
<tabstop>textWebUiPassword</tabstop>
</tabstops>
<resources>
<include location="icons.qrc"/>
<include location="../icons.qrc"/>
</resources>
<connections/>
</ui>

Loading…
Cancel
Save