mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-02-02 01:44:26 +00:00
- FEATURE: Allow to customize folder scan interval
This commit is contained in:
parent
d26bebfbe2
commit
fc931d8c88
@ -11,6 +11,7 @@
|
|||||||
- FEATURE: Improved eMule DAT ip filter parser
|
- FEATURE: Improved eMule DAT ip filter parser
|
||||||
- FEATURE: Added support for PeerGuardian p2p filters (text)
|
- FEATURE: Added support for PeerGuardian p2p filters (text)
|
||||||
- FEATURE: Added support for PeerGuardian p2b filters (binary)
|
- FEATURE: Added support for PeerGuardian p2b filters (binary)
|
||||||
|
- FEATURE: Allow to customize folder scan interval
|
||||||
- BUGFIX: Do not display seeds number in seeding list (always 0)
|
- BUGFIX: Do not display seeds number in seeding list (always 0)
|
||||||
- BUGFIX: Threadified IP filter file parser to avoid GUI freeze
|
- BUGFIX: Threadified IP filter file parser to avoid GUI freeze
|
||||||
- COSMETIC: Do not display progress bar in seeding list (always 100%)
|
- COSMETIC: Do not display progress bar in seeding list (always 100%)
|
||||||
|
@ -849,6 +849,8 @@ void GUI::configureSession(bool deleteOptions) {
|
|||||||
if(options->getScanDir().isNull()) {
|
if(options->getScanDir().isNull()) {
|
||||||
BTSession->disableDirectoryScanning();
|
BTSession->disableDirectoryScanning();
|
||||||
}else{
|
}else{
|
||||||
|
//Interval first
|
||||||
|
BTSession->setTimerScanInterval(options->getFolderScanInterval());
|
||||||
BTSession->enableDirectoryScanning(options->getScanDir());
|
BTSession->enableDirectoryScanning(options->getScanDir());
|
||||||
}
|
}
|
||||||
// Connection
|
// Connection
|
||||||
|
@ -42,7 +42,7 @@
|
|||||||
#define MAX_TRACKER_ERRORS 2
|
#define MAX_TRACKER_ERRORS 2
|
||||||
|
|
||||||
// Main constructor
|
// Main constructor
|
||||||
bittorrent::bittorrent() : timerScan(0), DHTEnabled(false), preAllocateAll(false), addInPause(false), maxConnecsPerTorrent(500), maxUploadsPerTorrent(4), max_ratio(-1), UPnPEnabled(false), NATPMPEnabled(false), LSDEnabled(false) {
|
bittorrent::bittorrent() : timerScan(0), DHTEnabled(false), preAllocateAll(false), addInPause(false), maxConnecsPerTorrent(500), maxUploadsPerTorrent(4), max_ratio(-1), UPnPEnabled(false), NATPMPEnabled(false), LSDEnabled(false), folderScanInterval(5) {
|
||||||
// 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
|
||||||
@ -977,13 +977,22 @@ void bittorrent::setDefaultSavePath(QString savepath) {
|
|||||||
defaultSavePath = savepath;
|
defaultSavePath = savepath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void bittorrent::setTimerScanInterval(int secs) {
|
||||||
|
if(folderScanInterval != secs) {
|
||||||
|
folderScanInterval = secs;
|
||||||
|
if(!scan_dir.isNull()) {
|
||||||
|
timerScan->start(folderScanInterval*1000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Enable directory scanning
|
// Enable directory scanning
|
||||||
void bittorrent::enableDirectoryScanning(QString _scan_dir) {
|
void bittorrent::enableDirectoryScanning(QString _scan_dir) {
|
||||||
if(!_scan_dir.isEmpty()) {
|
if(!_scan_dir.isEmpty()) {
|
||||||
scan_dir = _scan_dir;
|
scan_dir = _scan_dir;
|
||||||
timerScan = new QTimer(this);
|
timerScan = new QTimer(this);
|
||||||
connect(timerScan, SIGNAL(timeout()), this, SLOT(scanDirectory()));
|
connect(timerScan, SIGNAL(timeout()), this, SLOT(scanDirectory()));
|
||||||
timerScan->start(5000);
|
timerScan->start(folderScanInterval*1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,6 +69,7 @@ class bittorrent : public QObject{
|
|||||||
bool LSDEnabled;
|
bool LSDEnabled;
|
||||||
FilterParserThread *filterParser;
|
FilterParserThread *filterParser;
|
||||||
QString filterPath;
|
QString filterPath;
|
||||||
|
int folderScanInterval; // in seconds
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QString getSavePath(QString hash);
|
QString getSavePath(QString hash);
|
||||||
@ -145,6 +146,7 @@ class bittorrent : public QObject{
|
|||||||
void enableLSD(bool b);
|
void enableLSD(bool b);
|
||||||
bool enableDHT(bool b);
|
bool enableDHT(bool b);
|
||||||
void reloadTorrent(const QTorrentHandle &h, bool full_alloc);
|
void reloadTorrent(const QTorrentHandle &h, bool full_alloc);
|
||||||
|
void setTimerScanInterval(int secs);
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
void scanDirectory();
|
void scanDirectory();
|
||||||
|
125
src/options.ui
125
src/options.ui
@ -54,7 +54,7 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QTabWidget" name="tabOptions" >
|
<widget class="QTabWidget" name="tabOption" >
|
||||||
<property name="tabPosition" >
|
<property name="tabPosition" >
|
||||||
<enum>QTabWidget::North</enum>
|
<enum>QTabWidget::North</enum>
|
||||||
</property>
|
</property>
|
||||||
@ -344,7 +344,7 @@
|
|||||||
<iconset resource="icons.qrc" >
|
<iconset resource="icons.qrc" >
|
||||||
<normaloff>:/Icons/download.png</normaloff>:/Icons/download.png</iconset>
|
<normaloff>:/Icons/download.png</normaloff>:/Icons/download.png</iconset>
|
||||||
</attribute>
|
</attribute>
|
||||||
<layout class="QVBoxLayout" >
|
<layout class="QVBoxLayout" name="verticalLayout_4" >
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="fileSystemBox" >
|
<widget class="QGroupBox" name="fileSystemBox" >
|
||||||
<property name="sizePolicy" >
|
<property name="sizePolicy" >
|
||||||
@ -419,23 +419,40 @@
|
|||||||
<property name="title" >
|
<property name="title" >
|
||||||
<string>When adding a torrent</string>
|
<string>When adding a torrent</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" >
|
<layout class="QVBoxLayout" name="verticalLayout_3" >
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="checkAdditionDialog" >
|
<layout class="QHBoxLayout" name="horizontalLayout_3" >
|
||||||
<property name="text" >
|
<item>
|
||||||
<string>Display torrent content and some options</string>
|
<widget class="QCheckBox" name="checkAdditionDialog" >
|
||||||
</property>
|
<property name="text" >
|
||||||
<property name="checked" >
|
<string>Display torrent content and some options</string>
|
||||||
<bool>true</bool>
|
</property>
|
||||||
</property>
|
<property name="checked" >
|
||||||
</widget>
|
<bool>true</bool>
|
||||||
</item>
|
</property>
|
||||||
<item>
|
</widget>
|
||||||
<widget class="QCheckBox" name="checkStartPaused" >
|
</item>
|
||||||
<property name="text" >
|
<item>
|
||||||
<string comment="The torrent will be added to download list in pause state" >Do not start download automatically</string>
|
<spacer name="horizontalSpacer" >
|
||||||
</property>
|
<property name="orientation" >
|
||||||
</widget>
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0" >
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="checkStartPaused" >
|
||||||
|
<property name="text" >
|
||||||
|
<string comment="The torrent will be added to download list in pause state" >Do not start download automatically</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
@ -451,7 +468,7 @@
|
|||||||
<property name="title" >
|
<property name="title" >
|
||||||
<string comment="qBittorrent will watch a directory and automatically download torrents present in it" >Folder watching</string>
|
<string comment="qBittorrent will watch a directory and automatically download torrents present in it" >Folder watching</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" >
|
<layout class="QVBoxLayout" name="verticalLayout_2" >
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="checkScanDir" >
|
<widget class="QCheckBox" name="checkScanDir" >
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
@ -468,31 +485,52 @@
|
|||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" >
|
<widget class="QLineEdit" name="textScanDir" >
|
||||||
<property name="spacing" >
|
<property name="enabled" >
|
||||||
<number>6</number>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="margin" >
|
</widget>
|
||||||
<number>0</number>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="browseScanDirButton" >
|
||||||
|
<property name="enabled" >
|
||||||
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<property name="text" >
|
||||||
<widget class="QLineEdit" name="textScanDir" >
|
<string>...</string>
|
||||||
<property name="enabled" >
|
</property>
|
||||||
<bool>false</bool>
|
</widget>
|
||||||
</property>
|
</item>
|
||||||
</widget>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QToolButton" name="browseScanDirButton" >
|
<layout class="QHBoxLayout" name="horizontalLayout_2" >
|
||||||
<property name="enabled" >
|
<item>
|
||||||
<bool>false</bool>
|
<widget class="QLabel" name="FolderScanLbl" >
|
||||||
</property>
|
<property name="text" >
|
||||||
<property name="text" >
|
<string>Folder scan interval:</string>
|
||||||
<string>...</string>
|
</property>
|
||||||
</property>
|
</widget>
|
||||||
</widget>
|
</item>
|
||||||
</item>
|
<item>
|
||||||
</layout>
|
<widget class="QSpinBox" name="FolderScanSpin" >
|
||||||
|
<property name="minimum" >
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum" >
|
||||||
|
<number>9999</number>
|
||||||
|
</property>
|
||||||
|
<property name="value" >
|
||||||
|
<number>5</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="FolderScanLbl2" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>seconds</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
@ -1913,7 +1951,7 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<tabstops>
|
<tabstops>
|
||||||
<tabstop>tabOptions</tabstop>
|
<tabstop>tabOption</tabstop>
|
||||||
<tabstop>comboI18n</tabstop>
|
<tabstop>comboI18n</tabstop>
|
||||||
<tabstop>comboStyle</tabstop>
|
<tabstop>comboStyle</tabstop>
|
||||||
<tabstop>checkConfirmExit</tabstop>
|
<tabstop>checkConfirmExit</tabstop>
|
||||||
@ -1930,7 +1968,6 @@
|
|||||||
<tabstop>checkAdditionDialog</tabstop>
|
<tabstop>checkAdditionDialog</tabstop>
|
||||||
<tabstop>checkStartPaused</tabstop>
|
<tabstop>checkStartPaused</tabstop>
|
||||||
<tabstop>checkScanDir</tabstop>
|
<tabstop>checkScanDir</tabstop>
|
||||||
<tabstop>textScanDir</tabstop>
|
|
||||||
<tabstop>browseScanDirButton</tabstop>
|
<tabstop>browseScanDirButton</tabstop>
|
||||||
<tabstop>actionTorrentDlOnDblClBox</tabstop>
|
<tabstop>actionTorrentDlOnDblClBox</tabstop>
|
||||||
<tabstop>actionTorrentFnOnDblClBox</tabstop>
|
<tabstop>actionTorrentFnOnDblClBox</tabstop>
|
||||||
|
@ -164,6 +164,7 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
|
|||||||
connect(checkStartPaused, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
|
connect(checkStartPaused, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
|
||||||
connect(checkScanDir, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
|
connect(checkScanDir, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
|
||||||
connect(textScanDir, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton()));
|
connect(textScanDir, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton()));
|
||||||
|
connect(FolderScanSpin, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
|
||||||
// Connection tab
|
// Connection tab
|
||||||
connect(spinPortMin, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton()));
|
connect(spinPortMin, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton()));
|
||||||
connect(spinPortMax, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton()));
|
connect(spinPortMax, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton()));
|
||||||
@ -279,6 +280,7 @@ void options_imp::saveOptions(){
|
|||||||
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());
|
||||||
|
settings.setValue(QString::fromUtf8("ScanDirInterval"), getFolderScanInterval());
|
||||||
settings.setValue(QString::fromUtf8("DblClOnTorDl"), getActionOnDblClOnTorrentDl());
|
settings.setValue(QString::fromUtf8("DblClOnTorDl"), getActionOnDblClOnTorrentDl());
|
||||||
settings.setValue(QString::fromUtf8("DblClOnTorFn"), getActionOnDblClOnTorrentFn());
|
settings.setValue(QString::fromUtf8("DblClOnTorFn"), getActionOnDblClOnTorrentFn());
|
||||||
// End Downloads preferences
|
// End Downloads preferences
|
||||||
@ -448,6 +450,7 @@ void options_imp::loadOptions(){
|
|||||||
// enable
|
// enable
|
||||||
checkScanDir->setChecked(true);
|
checkScanDir->setChecked(true);
|
||||||
textScanDir->setText(strValue);
|
textScanDir->setText(strValue);
|
||||||
|
FolderScanSpin->setValue(settings.value(QString::fromUtf8("ScanDirInterval"), 5).toInt());
|
||||||
enableDirScan(2);
|
enableDirScan(2);
|
||||||
}
|
}
|
||||||
actionTorrentDlOnDblClBox->setCurrentIndex(settings.value(QString::fromUtf8("DblClOnTorDl"), 0).toInt());
|
actionTorrentDlOnDblClBox->setCurrentIndex(settings.value(QString::fromUtf8("DblClOnTorDl"), 0).toInt());
|
||||||
@ -931,10 +934,16 @@ void options_imp::enableDirScan(int checkBoxValue){
|
|||||||
//enable
|
//enable
|
||||||
textScanDir->setEnabled(true);
|
textScanDir->setEnabled(true);
|
||||||
browseScanDirButton->setEnabled(true);
|
browseScanDirButton->setEnabled(true);
|
||||||
|
FolderScanSpin->setEnabled(true);
|
||||||
|
FolderScanLbl->setEnabled(true);
|
||||||
|
FolderScanLbl2->setEnabled(true);
|
||||||
}else{
|
}else{
|
||||||
//disable
|
//disable
|
||||||
textScanDir->setEnabled(false);
|
textScanDir->setEnabled(false);
|
||||||
browseScanDirButton->setEnabled(false);
|
browseScanDirButton->setEnabled(false);
|
||||||
|
FolderScanSpin->setEnabled(false);
|
||||||
|
FolderScanLbl->setEnabled(false);
|
||||||
|
FolderScanLbl2->setEnabled(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -969,6 +978,10 @@ unsigned short options_imp::getProxyPort() const{
|
|||||||
return spinProxyPort->value();
|
return spinProxyPort->value();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int options_imp::getFolderScanInterval() const {
|
||||||
|
return FolderScanSpin->value();
|
||||||
|
}
|
||||||
|
|
||||||
QString options_imp::getProxyUsername() const{
|
QString options_imp::getProxyUsername() const{
|
||||||
QString username = textProxyUsername->text();
|
QString username = textProxyUsername->text();
|
||||||
username = username.trimmed();
|
username = username.trimmed();
|
||||||
|
@ -73,6 +73,7 @@ class options_imp : public QDialog, private Ui::Dialog {
|
|||||||
bool addTorrentsInPause() const;
|
bool addTorrentsInPause() const;
|
||||||
bool isDirScanEnabled() const;
|
bool isDirScanEnabled() const;
|
||||||
QString getScanDir() const;
|
QString getScanDir() const;
|
||||||
|
int getFolderScanInterval() const;
|
||||||
int getActionOnDblClOnTorrentDl() const;
|
int getActionOnDblClOnTorrentDl() const;
|
||||||
int getActionOnDblClOnTorrentFn() const;
|
int getActionOnDblClOnTorrentFn() const;
|
||||||
// Connection options
|
// Connection options
|
||||||
|
Loading…
x
Reference in New Issue
Block a user