mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-22 04:24:23 +00:00
- Created "Advanced settings" tab in program preferences and moved "Disk cache" there
This commit is contained in:
parent
e24e7578f2
commit
8618f13b7a
BIN
src/Icons/oxygen/gear32.png
Normal file
BIN
src/Icons/oxygen/gear32.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.8 KiB |
64
src/advancedsettings.h
Normal file
64
src/advancedsettings.h
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
#ifndef ADVANCEDSETTINGS_H
|
||||||
|
#define ADVANCEDSETTINGS_H
|
||||||
|
|
||||||
|
#include <QTableWidget>
|
||||||
|
#include <QHeaderView>
|
||||||
|
#include <QSpinBox>
|
||||||
|
#include "preferences.h"
|
||||||
|
|
||||||
|
enum AdvSettingsCols {PROPERTY, VALUE};
|
||||||
|
enum AdvSettingsRows {DISK_CACHE};
|
||||||
|
#define ROW_COUNT 1
|
||||||
|
enum AdvValueTYPE {UINT=1001};
|
||||||
|
|
||||||
|
class AdvancedSettings: public QTableWidget {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
private:
|
||||||
|
QSpinBox *spin_cache;
|
||||||
|
|
||||||
|
public:
|
||||||
|
AdvancedSettings(QWidget *parent=0): QTableWidget(parent) {
|
||||||
|
// Set visual appearance
|
||||||
|
setColumnCount(2);
|
||||||
|
QStringList header;
|
||||||
|
header << tr("Property") << tr("Value");
|
||||||
|
setHorizontalHeaderLabels(header);
|
||||||
|
setColumnWidth(0, width()/2);
|
||||||
|
horizontalHeader()->setStretchLastSection(true);
|
||||||
|
setRowCount(ROW_COUNT);
|
||||||
|
// Load settings
|
||||||
|
loadAdvancedSettings();
|
||||||
|
}
|
||||||
|
|
||||||
|
~AdvancedSettings() {
|
||||||
|
delete spin_cache;
|
||||||
|
}
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void saveAdvancedSettings() {
|
||||||
|
// Disk cache
|
||||||
|
Preferences::setDiskCacheSize(spin_cache->value());
|
||||||
|
}
|
||||||
|
|
||||||
|
protected slots:
|
||||||
|
void loadAdvancedSettings() {
|
||||||
|
// Disk write cache
|
||||||
|
setItem(DISK_CACHE, PROPERTY, new QTableWidgetItem(tr("Disk write cache size (MiB)"), UINT));
|
||||||
|
spin_cache = new QSpinBox();
|
||||||
|
connect(spin_cache, SIGNAL(valueChanged(int)), this, SLOT(emitSettingsChanged()));
|
||||||
|
spin_cache->setMinimum(1);
|
||||||
|
spin_cache->setMaximum(200);
|
||||||
|
spin_cache->setValue(Preferences::diskCacheSize());
|
||||||
|
setCellWidget(DISK_CACHE, VALUE, spin_cache);
|
||||||
|
}
|
||||||
|
|
||||||
|
void emitSettingsChanged() {
|
||||||
|
emit settingsChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void settingsChanged();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // ADVANCEDSETTINGS_H
|
@ -149,6 +149,7 @@
|
|||||||
<file>Icons/oxygen/encrypted.png</file>
|
<file>Icons/oxygen/encrypted.png</file>
|
||||||
<file>Icons/oxygen/edit_clear.png</file>
|
<file>Icons/oxygen/edit_clear.png</file>
|
||||||
<file>Icons/oxygen/download.png</file>
|
<file>Icons/oxygen/download.png</file>
|
||||||
|
<file>Icons/oxygen/gear32.png</file>
|
||||||
<file>Icons/oxygen/gear.png</file>
|
<file>Icons/oxygen/gear.png</file>
|
||||||
<file>Icons/oxygen/remove.png</file>
|
<file>Icons/oxygen/remove.png</file>
|
||||||
<file>Icons/oxygen/dialog-warning.png</file>
|
<file>Icons/oxygen/dialog-warning.png</file>
|
||||||
|
@ -55,6 +55,7 @@
|
|||||||
#include "options_imp.h"
|
#include "options_imp.h"
|
||||||
#include "preferences.h"
|
#include "preferences.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
|
#include "advancedsettings.h"
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
options_imp::options_imp(QWidget *parent):QDialog(parent){
|
options_imp::options_imp(QWidget *parent):QDialog(parent){
|
||||||
@ -199,7 +200,6 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
|
|||||||
connect(checkAppendLabel, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
connect(checkAppendLabel, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
||||||
connect(checkAppendqB, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
connect(checkAppendqB, SIGNAL(toggled(bool)), 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()));
|
||||||
@ -283,6 +283,12 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
|
|||||||
#ifndef LIBTORRENT_0_15
|
#ifndef LIBTORRENT_0_15
|
||||||
checkAppendqB->setVisible(false);
|
checkAppendqB->setVisible(false);
|
||||||
#endif
|
#endif
|
||||||
|
// Load Advanced settings
|
||||||
|
QVBoxLayout *adv_layout = new QVBoxLayout();
|
||||||
|
advancedSettings = new AdvancedSettings();
|
||||||
|
adv_layout->addWidget(advancedSettings);
|
||||||
|
scrollArea_advanced->setLayout(adv_layout);
|
||||||
|
connect(advancedSettings, SIGNAL(settingsChanged()), this, SLOT(enableApplyButton()));
|
||||||
// Adapt size
|
// Adapt size
|
||||||
loadWindowState();
|
loadWindowState();
|
||||||
show();
|
show();
|
||||||
@ -291,6 +297,8 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
|
|||||||
// Main destructor
|
// Main destructor
|
||||||
options_imp::~options_imp(){
|
options_imp::~options_imp(){
|
||||||
qDebug("-> destructing Options");
|
qDebug("-> destructing Options");
|
||||||
|
delete scrollArea_advanced->layout();
|
||||||
|
delete advancedSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
void options_imp::changePage(QListWidgetItem *current, QListWidgetItem *previous) {
|
void options_imp::changePage(QListWidgetItem *current, QListWidgetItem *previous) {
|
||||||
@ -393,7 +401,6 @@ void options_imp::saveOptions(){
|
|||||||
settings.setValue(QString::fromUtf8("UseIncompleteExtension"), checkAppendqB->isChecked());
|
settings.setValue(QString::fromUtf8("UseIncompleteExtension"), checkAppendqB->isChecked());
|
||||||
#endif
|
#endif
|
||||||
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());
|
||||||
@ -518,6 +525,9 @@ void options_imp::saveOptions(){
|
|||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
// End preferences
|
// End preferences
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
|
|
||||||
|
// Save advanced settings
|
||||||
|
advancedSettings->saveAdvancedSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool options_imp::isFilteringEnabled() const{
|
bool options_imp::isFilteringEnabled() const{
|
||||||
@ -617,7 +627,6 @@ void options_imp::loadOptions(){
|
|||||||
checkAppendqB->setChecked(Preferences::useIncompleteFilesExtension());
|
checkAppendqB->setChecked(Preferences::useIncompleteFilesExtension());
|
||||||
#endif
|
#endif
|
||||||
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();
|
||||||
|
@ -42,6 +42,7 @@ enum DoubleClickAction {TOGGLE_PAUSE, OPEN_DEST};
|
|||||||
using namespace libtorrent;
|
using namespace libtorrent;
|
||||||
|
|
||||||
class QCloseEvent;
|
class QCloseEvent;
|
||||||
|
class AdvancedSettings;
|
||||||
|
|
||||||
class options_imp : public QDialog, private Ui_Preferences {
|
class options_imp : public QDialog, private Ui_Preferences {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -50,6 +51,7 @@ private:
|
|||||||
QButtonGroup choiceLanguage;
|
QButtonGroup choiceLanguage;
|
||||||
QStringList locales;
|
QStringList locales;
|
||||||
QAbstractButton *applyButton;
|
QAbstractButton *applyButton;
|
||||||
|
AdvancedSettings *advancedSettings;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Contructor / Destructor
|
// Contructor / Destructor
|
||||||
|
@ -181,9 +181,14 @@ public:
|
|||||||
return settings.setValue(QString::fromUtf8("Preferences/Downloads/PreAllocation"), enabled);
|
return settings.setValue(QString::fromUtf8("Preferences/Downloads/PreAllocation"), enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int diskCacheSize() {
|
static uint diskCacheSize() {
|
||||||
QSettings settings("qBittorrent", "qBittorrent");
|
QSettings settings("qBittorrent", "qBittorrent");
|
||||||
return settings.value(QString::fromUtf8("Preferences/Downloads/DiskCache"), 16).toInt();
|
return settings.value(QString::fromUtf8("Preferences/Downloads/DiskCache"), 16).toUInt();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void setDiskCacheSize(uint size) {
|
||||||
|
QSettings settings("qBittorrent", "qBittorrent");
|
||||||
|
settings.setValue(QString::fromUtf8("Preferences/Downloads/DiskCache"), size);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool useAdditionDialog() {
|
static bool useAdditionDialog() {
|
||||||
|
@ -249,7 +249,8 @@ contains(DEFINES, DISABLE_GUI) {
|
|||||||
downloadfromurldlg.h \
|
downloadfromurldlg.h \
|
||||||
torrentadditiondlg.h \
|
torrentadditiondlg.h \
|
||||||
trackerlogin.h \
|
trackerlogin.h \
|
||||||
pieceavailabilitybar.h
|
pieceavailabilitybar.h \
|
||||||
|
advancedsettings.h
|
||||||
}
|
}
|
||||||
|
|
||||||
!contains(DEFINES, DISABLE_GUI) {
|
!contains(DEFINES, DISABLE_GUI) {
|
||||||
|
@ -219,6 +219,15 @@
|
|||||||
<set>ItemIsSelectable|ItemIsEnabled</set>
|
<set>ItemIsSelectable|ItemIsEnabled</set>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Advanced</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../icons.qrc">
|
||||||
|
<normaloff>:/Icons/oxygen/gear32.png</normaloff>:/Icons/oxygen/gear32.png</iconset>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
@ -629,7 +638,7 @@ QGroupBox {
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>644</width>
|
<width>644</width>
|
||||||
<height>583</height>
|
<height>548</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_17">
|
<layout class="QVBoxLayout" name="verticalLayout_17">
|
||||||
@ -868,50 +877,6 @@ QGroupBox {
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_9">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_7">
|
|
||||||
<property name="text">
|
|
||||||
<string>Disk cache:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<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>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -1436,8 +1401,8 @@ QGroupBox {
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>366</width>
|
<width>620</width>
|
||||||
<height>332</height>
|
<height>490</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_33">
|
<layout class="QVBoxLayout" name="verticalLayout_33">
|
||||||
@ -1841,8 +1806,8 @@ QGroupBox {
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>466</width>
|
<width>620</width>
|
||||||
<height>415</height>
|
<height>490</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_20">
|
<layout class="QVBoxLayout" name="verticalLayout_20">
|
||||||
@ -2258,8 +2223,8 @@ QGroupBox {
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>484</width>
|
<width>620</width>
|
||||||
<height>312</height>
|
<height>490</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_16">
|
<layout class="QVBoxLayout" name="verticalLayout_16">
|
||||||
@ -2692,8 +2657,8 @@ QGroupBox {
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>290</width>
|
<width>620</width>
|
||||||
<height>124</height>
|
<height>490</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_21">
|
<layout class="QVBoxLayout" name="verticalLayout_21">
|
||||||
@ -3119,6 +3084,49 @@ QGroupBox {
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
<widget class="QWidget" name="page_3">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_35">
|
||||||
|
<item>
|
||||||
|
<widget class="QScrollArea" name="scrollArea_advanced">
|
||||||
|
<property name="widgetResizable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="scrollAreaWidgetContents_10">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>620</width>
|
||||||
|
<height>490</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_36">
|
||||||
|
<item>
|
||||||
|
<widget class="QTableWidget" name="tableWidget">
|
||||||
|
<attribute name="horizontalHeaderStretchLastSection">
|
||||||
|
<bool>true</bool>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="horizontalHeaderStretchLastSection">
|
||||||
|
<bool>true</bool>
|
||||||
|
</attribute>
|
||||||
|
<column>
|
||||||
|
<property name="text">
|
||||||
|
<string>Parameter</string>
|
||||||
|
</property>
|
||||||
|
</column>
|
||||||
|
<column>
|
||||||
|
<property name="text">
|
||||||
|
<string>Value</string>
|
||||||
|
</property>
|
||||||
|
</column>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user