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 @@
* Unreleased - Christophe Dumez <chris@qbittorrent.org> - v2.1.0 * Unreleased - Christophe Dumez <chris@qbittorrent.org> - v2.1.0
- FEATURE: Torrents can be labeled/categorized - 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 * Thu Dec 10 2009 - Christophe Dumez <chris@qbittorrent.org> - v2.0.0
- FEATURE: Added program option to disable splash screen - FEATURE: Added program option to disable splash screen

2
src/bittorrent.cpp

@ -321,6 +321,8 @@ void Bittorrent::configureSession() {
#endif #endif
// To keep same behavior as in qBittorrent v1.2.0 // To keep same behavior as in qBittorrent v1.2.0
sessionSettings.rate_limit_ip_overhead = false; 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 // Queueing System
if(Preferences::isQueueingSystemEnabled()) { if(Preferences::isQueueingSystemEnabled()) {
sessionSettings.active_downloads = Preferences::getMaxActiveDownloads(); sessionSettings.active_downloads = Preferences::getMaxActiveDownloads();

3
src/options_imp.cpp

@ -191,6 +191,7 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
// Downloads tab // Downloads tab
connect(textSavePath, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton())); connect(textSavePath, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton()));
connect(checkPreallocateAll, SIGNAL(toggled(bool)), 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(checkAdditionDialog, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(checkStartPaused, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); connect(checkStartPaused, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(checkScanDir, 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("TempPathEnabled"), isTempPathEnabled());
settings.setValue(QString::fromUtf8("TempPath"), getTempPath()); settings.setValue(QString::fromUtf8("TempPath"), getTempPath());
settings.setValue(QString::fromUtf8("PreAllocation"), preAllocateAllFiles()); settings.setValue(QString::fromUtf8("PreAllocation"), preAllocateAllFiles());
settings.setValue(QString::fromUtf8("DiskCache"), spinCache->value());
settings.setValue(QString::fromUtf8("AdditionDialog"), useAdditionDialog()); settings.setValue(QString::fromUtf8("AdditionDialog"), useAdditionDialog());
settings.setValue(QString::fromUtf8("StartInPause"), addTorrentsInPause()); settings.setValue(QString::fromUtf8("StartInPause"), addTorrentsInPause());
settings.setValue(QString::fromUtf8("ScanDir"), getScanDir()); settings.setValue(QString::fromUtf8("ScanDir"), getScanDir());
@ -577,6 +579,7 @@ void options_imp::loadOptions(){
} }
textTempPath->setText(Preferences::getTempPath()); textTempPath->setText(Preferences::getTempPath());
checkPreallocateAll->setChecked(Preferences::preAllocateAllFiles()); checkPreallocateAll->setChecked(Preferences::preAllocateAllFiles());
spinCache->setValue(Preferences::diskCacheSize());
checkAdditionDialog->setChecked(Preferences::useAdditionDialog()); checkAdditionDialog->setChecked(Preferences::useAdditionDialog());
checkStartPaused->setChecked(Preferences::addTorrentsInPause()); checkStartPaused->setChecked(Preferences::addTorrentsInPause());
strValue = Preferences::getScanDir(); strValue = Preferences::getScanDir();

5
src/preferences.h

@ -138,6 +138,11 @@ public:
return settings.value(QString::fromUtf8("Preferences/Downloads/PreAllocation"), false).toBool(); 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() { static bool useAdditionDialog() {
QSettings settings("qBittorrent", "qBittorrent"); QSettings settings("qBittorrent", "qBittorrent");
return settings.value(QString::fromUtf8("Preferences/Downloads/AdditionDialog"), true).toBool(); return settings.value(QString::fromUtf8("Preferences/Downloads/AdditionDialog"), true).toBool();

131
src/ui/options.ui

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

Loading…
Cancel
Save