Browse Source

- Start minimized option in program preferences


			
			
				adaptive-webui-19844
			
			
		
Arnaud Demaiziere 17 years ago
parent
commit
a329a59719
  1. 9
      TODO
  2. 17
      src/FinishedTorrents.cpp
  3. 3
      src/FinishedTorrents.h
  4. 62
      src/GUI.cpp
  5. 1
      src/GUI.h
  6. 9
      src/downloadingTorrents.cpp
  7. 4
      src/downloadingTorrents.h
  8. 142
      src/options.ui
  9. 29
      src/options_imp.cpp
  10. 16
      src/options_imp.h

9
TODO

@ -25,7 +25,7 @@ @@ -25,7 +25,7 @@
(http://techbase.kde.org/Development/Tutorials/D-Bus/Accessing_Interfaces)
- When favicon can't be downloaded, try to parse the webpage for:
<link rel="icon" href="http://example.com/favicon.ico" type="image/vnd.microsoft.icon">
* Be carefull, the link can be relative
* Be careful, the link can be relative
// in v1.2.0
- Allow user to organize the downloads into categories/folders?
@ -46,12 +46,7 @@ @@ -46,12 +46,7 @@
- Display in torrent addition dialog:
* free disk space on selected drive
* free disk space after torrent download (and/or torrent size)
- Start minimized option in program preferences
- In finished list, replace "Seeds/Leechs" column by "Leechers" because Seeds are always 0.
- Use ShareMonkey Web service (http://www.sharemonkey.com/)
- Allow to change action on double-click
-> in download list
-> in seeding list
- Use ShareMonkey Web service (http://www.sharemonkey.com/)
// in v1.0.0 - FEATURE FREEZE
- Fix all (or almost all) opened bugs in bug tracker

17
src/FinishedTorrents.cpp

@ -42,7 +42,7 @@ FinishedTorrents::FinishedTorrents(QObject *parent, bittorrent *BTSession) : par @@ -42,7 +42,7 @@ FinishedTorrents::FinishedTorrents(QObject *parent, bittorrent *BTSession) : par
finishedListModel->setHeaderData(F_SIZE, Qt::Horizontal, tr("Size", "i.e: file size"));
finishedListModel->setHeaderData(F_PROGRESS, Qt::Horizontal, tr("Progress", "i.e: % downloaded"));
finishedListModel->setHeaderData(F_UPSPEED, Qt::Horizontal, tr("UP Speed", "i.e: Upload speed"));
finishedListModel->setHeaderData(F_SEEDSLEECH, Qt::Horizontal, tr("Seeds/Leechs", "i.e: full/partial sources"));
finishedListModel->setHeaderData(F_SEEDSLEECH, Qt::Horizontal, tr("Leechers", "i.e: full/partial sources"));
finishedListModel->setHeaderData(F_RATIO, Qt::Horizontal, tr("Ratio"));
finishedList->setModel(finishedListModel);
// Hide ETA & hash column
@ -81,7 +81,7 @@ FinishedTorrents::~FinishedTorrents(){ @@ -81,7 +81,7 @@ FinishedTorrents::~FinishedTorrents(){
void FinishedTorrents::notifyTorrentDoubleClicked(const QModelIndex& index) {
unsigned int row = index.row();
QString hash = getHashFromRow(row);
emit torrentDoubleClicked(hash);
emit torrentDoubleClicked(hash, true);
}
void FinishedTorrents::addTorrent(QString hash){
@ -97,7 +97,7 @@ void FinishedTorrents::addTorrent(QString hash){ @@ -97,7 +97,7 @@ void FinishedTorrents::addTorrent(QString hash){
finishedListModel->setData(finishedListModel->index(row, F_NAME), QVariant(h.name()));
finishedListModel->setData(finishedListModel->index(row, F_SIZE), QVariant((qlonglong)h.actual_size()));
finishedListModel->setData(finishedListModel->index(row, F_UPSPEED), QVariant((double)0.));
finishedListModel->setData(finishedListModel->index(row, F_SEEDSLEECH), QVariant("0/0"));
finishedListModel->setData(finishedListModel->index(row, F_SEEDSLEECH), QVariant("0"));
finishedListModel->setData(finishedListModel->index(row, F_RATIO), QVariant(QString::fromUtf8(misc::toString(BTSession->getRealRatio(hash)).c_str())));
finishedListModel->setData(finishedListModel->index(row, F_HASH), QVariant(hash));
finishedListModel->setData(finishedListModel->index(row, F_PROGRESS), QVariant((double)1.));
@ -231,7 +231,7 @@ void FinishedTorrents::updateFinishedList(){ @@ -231,7 +231,7 @@ void FinishedTorrents::updateFinishedList(){
setRowColor(row, QString::fromUtf8("orange"));
finishedListModel->setData(finishedListModel->index(row, F_NAME), QVariant(QIcon(QString::fromUtf8(":/Icons/skin/seeding.png"))), Qt::DecorationRole);
finishedListModel->setData(finishedListModel->index(row, F_UPSPEED), QVariant((double)h.upload_payload_rate()));
finishedListModel->setData(finishedListModel->index(row, F_SEEDSLEECH), QVariant(misc::toQString(h.num_seeds(), true)+"/"+misc::toQString(h.num_peers() - h.num_seeds(), true)));
finishedListModel->setData(finishedListModel->index(row, F_SEEDSLEECH), misc::toQString(h.num_peers() - h.num_seeds(), true));
finishedListModel->setData(finishedListModel->index(row, F_RATIO), QVariant(misc::toQString(BTSession->getRealRatio(hash))));
finishedListModel->setData(finishedListModel->index(row, F_PROGRESS), QVariant((double)1.));
}
@ -253,7 +253,7 @@ void FinishedTorrents::pauseTorrent(QString hash) { @@ -253,7 +253,7 @@ void FinishedTorrents::pauseTorrent(QString hash) {
Q_ASSERT(row != -1);
finishedListModel->setData(finishedListModel->index(row, F_UPSPEED), QVariant((double)0.0));
finishedListModel->setData(finishedListModel->index(row, F_NAME), QIcon(QString::fromUtf8(":/Icons/skin/paused.png")), Qt::DecorationRole);
finishedListModel->setData(finishedListModel->index(row, F_SEEDSLEECH), QVariant(QString::fromUtf8("0/0")));
finishedListModel->setData(finishedListModel->index(row, F_SEEDSLEECH), QVariant(QString::fromUtf8("0")));
setRowColor(row, QString::fromUtf8("red"));
}
@ -291,6 +291,13 @@ void FinishedTorrents::showProperties(const QModelIndex &index){ @@ -291,6 +291,13 @@ void FinishedTorrents::showProperties(const QModelIndex &index){
prop->show();
}
void FinishedTorrents::showPropertiesFromHash(QString hash){
QTorrentHandle h = BTSession->getTorrentHandle(hash);
properties *prop = new properties(this, BTSession, h);
connect(prop, SIGNAL(filteredFilesChanged(QString)), this, SLOT(updateFileSize(QString)));
prop->show();
}
void FinishedTorrents::updateFileSize(QString hash){
int row = getRowFromHash(hash);
QTorrentHandle h = BTSession->getTorrentHandle(hash);

3
src/FinishedTorrents.h

@ -70,10 +70,11 @@ class FinishedTorrents : public QWidget, public Ui::seeding { @@ -70,10 +70,11 @@ class FinishedTorrents : public QWidget, public Ui::seeding {
void resumeTorrent(QString hash);
void propertiesSelection();
void deleteTorrent(QString hash);
void showPropertiesFromHash(QString hash);
signals:
void torrentMovedFromFinishedList(QString);
void torrentDoubleClicked(QString hash);
void torrentDoubleClicked(QString hash, bool finished);
void finishedTorrentsNumberChanged(unsigned int);
};

62
src/GUI.cpp

@ -120,12 +120,13 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), dis @@ -120,12 +120,13 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), dis
tabs->setTabIcon(0, QIcon(QString::fromUtf8(":/Icons/skin/downloading.png")));
vboxLayout->addWidget(tabs);
connect(downloadingTorrentTab, SIGNAL(unfinishedTorrentsNumberChanged(unsigned int)), this, SLOT(updateUnfinishedTorrentNumber(unsigned int)));
connect(downloadingTorrentTab, SIGNAL(torrentDoubleClicked(QString)), this, SLOT(togglePausedState(QString)));
connect(downloadingTorrentTab, SIGNAL(torrentDoubleClicked(QString, bool)), this, SLOT(torrentDoubleClicked(QString, bool)));
// Finished torrents tab
finishedTorrentTab = new FinishedTorrents(this, BTSession);
tabs->addTab(finishedTorrentTab, tr("Finished") + QString::fromUtf8(" (0)"));
tabs->setTabIcon(1, QIcon(QString::fromUtf8(":/Icons/skin/seeding.png")));
connect(finishedTorrentTab, SIGNAL(torrentDoubleClicked(QString)), this, SLOT(togglePausedState(QString)));
connect(finishedTorrentTab, SIGNAL(torrentDoubleClicked(QString, bool)), this, SLOT(torrentDoubleClicked(QString, bool)));
connect(finishedTorrentTab, SIGNAL(finishedTorrentsNumberChanged(unsigned int)), this, SLOT(updateFinishedTorrentNumber(unsigned int)));
// Smooth torrent switching between tabs Downloading <--> Finished
connect(downloadingTorrentTab, SIGNAL(torrentFinished(QString)), finishedTorrentTab, SLOT(addTorrent(QString)));
@ -163,7 +164,9 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), dis @@ -163,7 +164,9 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), dis
connect(previewProcess, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(cleanTempPreviewFile(int, QProcess::ExitStatus)));
// Accept drag 'n drops
setAcceptDrops(true);
show();
if(!settings.value(QString::fromUtf8("Preferences/General/StartMinimized"), true).toBool()) {
show();
}
createKeyboardShortcuts();
qDebug("GUI Built");
}
@ -961,6 +964,59 @@ void GUI::updateFinishedTorrentNumber(unsigned int nb) { @@ -961,6 +964,59 @@ void GUI::updateFinishedTorrentNumber(unsigned int nb) {
tabs->setTabText(1, tr("Finished") +QString::fromUtf8(" (")+misc::toQString(nb)+QString::fromUtf8(")"));
}
// Allow to change action on double-click
void GUI::torrentDoubleClicked(QString hash, bool finished) {
int action;
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
QTorrentHandle h = BTSession->getTorrentHandle(hash);
QString fileName;
int ret;
settings.beginGroup("Preferences");
settings.beginGroup("Downloads");
if(finished) {
action = settings.value(QString::fromUtf8("DblClOnTorFN"), 1).toInt();
} else {
action = settings.value(QString::fromUtf8("DblClOnTorDl"), 1).toInt();
}
settings.endGroup();
settings.endGroup();
switch(action) {
case TOGGLE_PAUSE :
this->togglePausedState(hash);
break;
case DELETE_IT :
ret = QMessageBox::question(
this,
tr("Are you sure? -- qBittorrent"),
tr("Are you sure you want to delete the selected item(s) from download list and from hard drive?"),
tr("&Yes"), tr("&No"),
QString(), 0, 1);
if(ret)
return;
fileName = h.name();
// Remove the torrent
BTSession->deleteTorrent(hash, true);
// Delete item from list
if(finished) {
finishedTorrentTab->deleteTorrent(hash);
} else {
downloadingTorrentTab->deleteTorrent(hash);
}
// Update info bar
downloadingTorrentTab->setInfoBar(tr("'%1' was removed permanently.", "'xxx.avi' was removed permanently.").arg(fileName));
break;
case SHOW_PROPERTIES :
if(finished) {
finishedTorrentTab->showPropertiesFromHash(hash);
} else {
downloadingTorrentTab->showPropertiesFromHash(hash);
}
break;
}
}
// Toggle paused state of selected torrent
void GUI::togglePausedState(QString hash) {
if(tabs->currentIndex() > 1) return;

1
src/GUI.h

@ -96,6 +96,7 @@ class GUI : public QMainWindow, private Ui::MainWindow{ @@ -96,6 +96,7 @@ class GUI : public QMainWindow, private Ui::MainWindow{
void readParamsOnSocket();
void acceptConnection();
void togglePausedState(QString hash);
void torrentDoubleClicked(QString hash, bool finished);
void on_actionPreview_file_triggered();
void previewFile(QString filePath);
void cleanTempPreviewFile(int, QProcess::ExitStatus) const;

9
src/downloadingTorrents.cpp

@ -110,7 +110,7 @@ DownloadingTorrents::~DownloadingTorrents() { @@ -110,7 +110,7 @@ DownloadingTorrents::~DownloadingTorrents() {
void DownloadingTorrents::notifyTorrentDoubleClicked(const QModelIndex& index) {
unsigned int row = index.row();
QString hash = getHashFromRow(row);
emit torrentDoubleClicked(hash);
emit torrentDoubleClicked(hash, false);
}
void DownloadingTorrents::addLogPeerBlocked(QString ip) {
@ -162,6 +162,13 @@ void DownloadingTorrents::showProperties(const QModelIndex &index) { @@ -162,6 +162,13 @@ void DownloadingTorrents::showProperties(const QModelIndex &index) {
prop->show();
}
void DownloadingTorrents::showPropertiesFromHash(QString hash) {
QTorrentHandle h = BTSession->getTorrentHandle(hash);
properties *prop = new properties(this, BTSession, h);
connect(prop, SIGNAL(filteredFilesChanged(QString)), this, SLOT(updateFileSizeAndProgress(QString)));
prop->show();
}
void DownloadingTorrents::resumeTorrent(QString hash){
int row = getRowFromHash(hash);
Q_ASSERT(row != -1);

4
src/downloadingTorrents.h

@ -54,7 +54,7 @@ class DownloadingTorrents : public QWidget, public Ui::downloading{ @@ -54,7 +54,7 @@ class DownloadingTorrents : public QWidget, public Ui::downloading{
signals:
void unfinishedTorrentsNumberChanged(unsigned int);
void torrentDoubleClicked(QString hash);
void torrentDoubleClicked(QString hash, bool finished);
void torrentFinished(QString hash);
protected slots:
@ -91,7 +91,7 @@ class DownloadingTorrents : public QWidget, public Ui::downloading{ @@ -91,7 +91,7 @@ class DownloadingTorrents : public QWidget, public Ui::downloading{
void propertiesSelection();
void sortProgressColumnDelayed();
void updateFileSizeAndProgress(QString hash);
void showPropertiesFromHash(QString hash);
};
#endif

142
src/options.ui

@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
<x>0</x>
<y>0</y>
<width>663</width>
<height>560</height>
<height>586</height>
</rect>
</property>
<property name="minimumSize" >
@ -293,6 +293,13 @@ @@ -293,6 +293,13 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkStartMinimized" >
<property name="text" >
<string>Start minimized</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkSystrayBalloons" >
<property name="text" >
@ -376,6 +383,12 @@ @@ -376,6 +383,12 @@
<layout class="QVBoxLayout" >
<item>
<widget class="QGroupBox" name="fileSystemBox" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title" >
<string>File system</string>
</property>
@ -451,6 +464,12 @@ @@ -451,6 +464,12 @@
</item>
<item>
<widget class="QGroupBox" name="torrentAdditionBox" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title" >
<string>When adding a torrent</string>
</property>
@ -477,6 +496,12 @@ @@ -477,6 +496,12 @@
</item>
<item>
<widget class="QGroupBox" name="dirScanBox" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title" >
<string comment="qBittorrent will watch a directory and automatically download torrents present in it" >Folder watching</string>
</property>
@ -547,17 +572,114 @@ @@ -547,17 +572,114 @@
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
<widget class="QGroupBox" name="ActDblClickBox" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="sizeHint" >
<size>
<width>557</width>
<height>21</height>
</size>
<property name="title" >
<string comment="qBittorrent will watch a directory and automatically download torrents present in it" >Action on double click in transfer lists</string>
</property>
</spacer>
<layout class="QVBoxLayout" >
<item>
<layout class="QHBoxLayout" >
<item>
<widget class="QLabel" name="lblDlList_2" >
<property name="text" >
<string>In download list:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="actionTorrentDlOnDblClBox" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="currentIndex" >
<number>0</number>
</property>
<item>
<property name="text" >
<string>Pause/Start torrent</string>
</property>
</item>
<item>
<property name="text" >
<string>Delete torrent</string>
</property>
</item>
<item>
<property name="text" >
<string>Show torrent's properties</string>
</property>
</item>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" >
<item>
<widget class="QLabel" name="lblUploadList" >
<property name="text" >
<string>In seeding list:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="actionTorrentFnOnDblClBox" >
<item>
<property name="text" >
<string>Pause/Start torrent</string>
</property>
</item>
<item>
<property name="text" >
<string>Delete torrent</string>
</property>
</item>
<item>
<property name="text" >
<string>Show torrent's properties</string>
</property>
</item>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</widget>

29
src/options_imp.cpp

@ -127,6 +127,8 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){ @@ -127,6 +127,8 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
connect(checkNoSystray, SIGNAL(stateChanged(int)), this, SLOT(setSystrayOptionsState(int)));
// Downloads tab
connect(checkScanDir, SIGNAL(stateChanged(int)), this, SLOT(enableDirScan(int)));
connect(actionTorrentDlOnDblClBox, SIGNAL(currentIndexChanged(int)), this, SLOT(enableApplyButton()));
connect(actionTorrentFnOnDblClBox, SIGNAL(currentIndexChanged(int)), this, SLOT(enableApplyButton()));
// Connection tab
connect(checkUploadLimit, SIGNAL(stateChanged(int)), this, SLOT(enableUploadLimit(int)));
connect(checkDownloadLimit, SIGNAL(stateChanged(int)), this, SLOT(enableDownloadLimit(int)));
@ -151,6 +153,7 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){ @@ -151,6 +153,7 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
connect(checkNoSystray, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
connect(checkCloseToSystray, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
connect(checkMinimizeToSysTray, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
connect(checkStartMinimized, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
connect(checkSystrayBalloons, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
connect(textMediaPlayer, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton()));
// Downloads tab
@ -261,6 +264,7 @@ void options_imp::saveOptions(){ @@ -261,6 +264,7 @@ void options_imp::saveOptions(){
settings.setValue(QString::fromUtf8("SystrayEnabled"), systrayIntegration());
settings.setValue(QString::fromUtf8("CloseToTray"), closeToTray());
settings.setValue(QString::fromUtf8("MinimizeToTray"), minimizeToTray());
settings.setValue(QString::fromUtf8("StartMinimized"), startMinimized());
settings.setValue(QString::fromUtf8("NotificationBaloons"), OSDEnabled());
settings.setValue(QString::fromUtf8("MediaPlayer"), getPreviewProgram());
// End General preferences
@ -272,6 +276,8 @@ void options_imp::saveOptions(){ @@ -272,6 +276,8 @@ void options_imp::saveOptions(){
settings.setValue(QString::fromUtf8("AdditionDialog"), useAdditionDialog());
settings.setValue(QString::fromUtf8("StartInPause"), addTorrentsInPause());
settings.setValue(QString::fromUtf8("ScanDir"), getScanDir());
settings.setValue(QString::fromUtf8("DblClOnTorDl"), getActionOnDblClOnTorrentDl());
settings.setValue(QString::fromUtf8("DblClOnTorFn"), getActionOnDblClOnTorrentFn());
// End Downloads preferences
settings.endGroup();
// Connection preferences
@ -404,6 +410,7 @@ void options_imp::loadOptions(){ @@ -404,6 +410,7 @@ void options_imp::loadOptions(){
enableSystrayOptions();
checkCloseToSystray->setChecked(settings.value(QString::fromUtf8("CloseToTray"), false).toBool());
checkMinimizeToSysTray->setChecked(settings.value(QString::fromUtf8("MinimizeToTray"), false).toBool());
checkStartMinimized->setChecked(settings.value(QString::fromUtf8("StartMinimized"), false).toBool());
checkSystrayBalloons->setChecked(settings.value(QString::fromUtf8("NotificationBaloons"), true).toBool());
}
textMediaPlayer->setText(settings.value(QString::fromUtf8("MediaPlayer"), QString()).toString());
@ -430,6 +437,9 @@ void options_imp::loadOptions(){ @@ -430,6 +437,9 @@ void options_imp::loadOptions(){
textScanDir->setText(strValue);
enableDirScan(2);
}
actionTorrentDlOnDblClBox->setCurrentIndex(settings.value(QString::fromUtf8("DblClOnTorDl"), 0).toInt());
actionTorrentFnOnDblClBox->setCurrentIndex(settings.value(QString::fromUtf8("DblClOnTorFn"), 0).toInt());
intValue = settings.value(QString::fromUtf8("DblClOnTorFn"), 1).toInt();
// End Downloads preferences
settings.endGroup();
// Connection preferences
@ -649,6 +659,11 @@ bool options_imp::OSDEnabled() const { @@ -649,6 +659,11 @@ bool options_imp::OSDEnabled() const {
return checkSystrayBalloons->isChecked();
}
bool options_imp::startMinimized() const {
if(checkStartMinimized->isChecked()) return true;
return checkStartMinimized->isChecked();
}
bool options_imp::systrayIntegration() const{
if (!QSystemTrayIcon::isSystemTrayAvailable()) return false;
return (!checkNoSystray->isChecked());
@ -980,6 +995,20 @@ QString options_imp::getScanDir() const { @@ -980,6 +995,20 @@ QString options_imp::getScanDir() const {
}
}
// Return action on double-click on a downloading torrent set in options
int options_imp::getActionOnDblClOnTorrentDl() const {
if(actionTorrentDlOnDblClBox->currentIndex()<1)
return 1;
return actionTorrentDlOnDblClBox->currentIndex();
}
// Return action on double-click on a finished torrent set in options
int options_imp::getActionOnDblClOnTorrentFn() const {
if(actionTorrentFnOnDblClBox->currentIndex()<1)
return 1;
return actionTorrentFnOnDblClBox->currentIndex();
}
// Display dialog to choose scan dir
void options_imp::on_browseScanDirButton_clicked() {
QString dir = QFileDialog::getExistingDirectory(this, tr("Choose scan directory"), QDir::homePath());

16
src/options_imp.h

@ -25,16 +25,27 @@ @@ -25,16 +25,27 @@
#include "ui_options.h"
#include <libtorrent/ip_filter.hpp>
/*#include <QDialog>
#include <qdialog.h>
#include "ui_options.h"
#include "ui_dialog.h"
#include <libtorrent/ip_filter.hpp>*/
#define HTTP 1
#define SOCKS5 2
#define HTTP_PW 3
#define SOCKS5_PW 4
// actions on double-click on torrents
#define TOGGLE_PAUSE 0
#define DELETE_IT 1
#define SHOW_PROPERTIES 2
using namespace libtorrent;
class QCloseEvent;
class options_imp : public QDialog, private Ui::Dialog{
class options_imp : public QDialog, private Ui::Dialog {
Q_OBJECT
private:
@ -60,6 +71,7 @@ class options_imp : public QDialog, private Ui::Dialog{ @@ -60,6 +71,7 @@ class options_imp : public QDialog, private Ui::Dialog{
bool systrayIntegration() const;
bool minimizeToTray() const;
bool closeToTray() const;
bool startMinimized() const;
bool OSDEnabled() const;
QString getPreviewProgram() const;
// Downloads
@ -69,6 +81,8 @@ class options_imp : public QDialog, private Ui::Dialog{ @@ -69,6 +81,8 @@ class options_imp : public QDialog, private Ui::Dialog{
bool addTorrentsInPause() const;
bool isDirScanEnabled() const;
QString getScanDir() const;
int getActionOnDblClOnTorrentDl() const;
int getActionOnDblClOnTorrentFn() const;
// Connection options
std::pair<unsigned short, unsigned short> getPorts() const;
bool isUPnPEnabled() const;

Loading…
Cancel
Save