Browse Source

- Start minimized option in program preferences


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

7
TODO

@ -25,7 +25,7 @@
(http://techbase.kde.org/Development/Tutorials/D-Bus/Accessing_Interfaces) (http://techbase.kde.org/Development/Tutorials/D-Bus/Accessing_Interfaces)
- When favicon can't be downloaded, try to parse the webpage for: - 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"> <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 // in v1.2.0
- Allow user to organize the downloads into categories/folders? - Allow user to organize the downloads into categories/folders?
@ -46,12 +46,7 @@
- Display in torrent addition dialog: - Display in torrent addition dialog:
* free disk space on selected drive * free disk space on selected drive
* free disk space after torrent download (and/or torrent size) * 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/) - Use ShareMonkey Web service (http://www.sharemonkey.com/)
- Allow to change action on double-click
-> in download list
-> in seeding list
// in v1.0.0 - FEATURE FREEZE // in v1.0.0 - FEATURE FREEZE
- Fix all (or almost all) opened bugs in bug tracker - 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
finishedListModel->setHeaderData(F_SIZE, Qt::Horizontal, tr("Size", "i.e: file size")); 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_PROGRESS, Qt::Horizontal, tr("Progress", "i.e: % downloaded"));
finishedListModel->setHeaderData(F_UPSPEED, Qt::Horizontal, tr("UP Speed", "i.e: Upload speed")); 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")); finishedListModel->setHeaderData(F_RATIO, Qt::Horizontal, tr("Ratio"));
finishedList->setModel(finishedListModel); finishedList->setModel(finishedListModel);
// Hide ETA & hash column // Hide ETA & hash column
@ -81,7 +81,7 @@ FinishedTorrents::~FinishedTorrents(){
void FinishedTorrents::notifyTorrentDoubleClicked(const QModelIndex& index) { void FinishedTorrents::notifyTorrentDoubleClicked(const QModelIndex& index) {
unsigned int row = index.row(); unsigned int row = index.row();
QString hash = getHashFromRow(row); QString hash = getHashFromRow(row);
emit torrentDoubleClicked(hash); emit torrentDoubleClicked(hash, true);
} }
void FinishedTorrents::addTorrent(QString hash){ 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_NAME), QVariant(h.name()));
finishedListModel->setData(finishedListModel->index(row, F_SIZE), QVariant((qlonglong)h.actual_size())); 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_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_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_HASH), QVariant(hash));
finishedListModel->setData(finishedListModel->index(row, F_PROGRESS), QVariant((double)1.)); finishedListModel->setData(finishedListModel->index(row, F_PROGRESS), QVariant((double)1.));
@ -231,7 +231,7 @@ void FinishedTorrents::updateFinishedList(){
setRowColor(row, QString::fromUtf8("orange")); 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_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_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_RATIO), QVariant(misc::toQString(BTSession->getRealRatio(hash))));
finishedListModel->setData(finishedListModel->index(row, F_PROGRESS), QVariant((double)1.)); finishedListModel->setData(finishedListModel->index(row, F_PROGRESS), QVariant((double)1.));
} }
@ -253,7 +253,7 @@ void FinishedTorrents::pauseTorrent(QString hash) {
Q_ASSERT(row != -1); Q_ASSERT(row != -1);
finishedListModel->setData(finishedListModel->index(row, F_UPSPEED), QVariant((double)0.0)); 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_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")); setRowColor(row, QString::fromUtf8("red"));
} }
@ -291,6 +291,13 @@ void FinishedTorrents::showProperties(const QModelIndex &index){
prop->show(); 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){ void FinishedTorrents::updateFileSize(QString hash){
int row = getRowFromHash(hash); int row = getRowFromHash(hash);
QTorrentHandle h = BTSession->getTorrentHandle(hash); QTorrentHandle h = BTSession->getTorrentHandle(hash);

3
src/FinishedTorrents.h

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

60
src/GUI.cpp

@ -120,12 +120,13 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), dis
tabs->setTabIcon(0, QIcon(QString::fromUtf8(":/Icons/skin/downloading.png"))); tabs->setTabIcon(0, QIcon(QString::fromUtf8(":/Icons/skin/downloading.png")));
vboxLayout->addWidget(tabs); vboxLayout->addWidget(tabs);
connect(downloadingTorrentTab, SIGNAL(unfinishedTorrentsNumberChanged(unsigned int)), this, SLOT(updateUnfinishedTorrentNumber(unsigned int))); 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 // Finished torrents tab
finishedTorrentTab = new FinishedTorrents(this, BTSession); finishedTorrentTab = new FinishedTorrents(this, BTSession);
tabs->addTab(finishedTorrentTab, tr("Finished") + QString::fromUtf8(" (0)")); tabs->addTab(finishedTorrentTab, tr("Finished") + QString::fromUtf8(" (0)"));
tabs->setTabIcon(1, QIcon(QString::fromUtf8(":/Icons/skin/seeding.png"))); 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))); connect(finishedTorrentTab, SIGNAL(finishedTorrentsNumberChanged(unsigned int)), this, SLOT(updateFinishedTorrentNumber(unsigned int)));
// Smooth torrent switching between tabs Downloading <--> Finished // Smooth torrent switching between tabs Downloading <--> Finished
connect(downloadingTorrentTab, SIGNAL(torrentFinished(QString)), finishedTorrentTab, SLOT(addTorrent(QString))); connect(downloadingTorrentTab, SIGNAL(torrentFinished(QString)), finishedTorrentTab, SLOT(addTorrent(QString)));
@ -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))); connect(previewProcess, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(cleanTempPreviewFile(int, QProcess::ExitStatus)));
// Accept drag 'n drops // Accept drag 'n drops
setAcceptDrops(true); setAcceptDrops(true);
if(!settings.value(QString::fromUtf8("Preferences/General/StartMinimized"), true).toBool()) {
show(); show();
}
createKeyboardShortcuts(); createKeyboardShortcuts();
qDebug("GUI Built"); qDebug("GUI Built");
} }
@ -961,6 +964,59 @@ void GUI::updateFinishedTorrentNumber(unsigned int nb) {
tabs->setTabText(1, tr("Finished") +QString::fromUtf8(" (")+misc::toQString(nb)+QString::fromUtf8(")")); 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 // Toggle paused state of selected torrent
void GUI::togglePausedState(QString hash) { void GUI::togglePausedState(QString hash) {
if(tabs->currentIndex() > 1) return; if(tabs->currentIndex() > 1) return;

1
src/GUI.h

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

9
src/downloadingTorrents.cpp

@ -110,7 +110,7 @@ DownloadingTorrents::~DownloadingTorrents() {
void DownloadingTorrents::notifyTorrentDoubleClicked(const QModelIndex& index) { void DownloadingTorrents::notifyTorrentDoubleClicked(const QModelIndex& index) {
unsigned int row = index.row(); unsigned int row = index.row();
QString hash = getHashFromRow(row); QString hash = getHashFromRow(row);
emit torrentDoubleClicked(hash); emit torrentDoubleClicked(hash, false);
} }
void DownloadingTorrents::addLogPeerBlocked(QString ip) { void DownloadingTorrents::addLogPeerBlocked(QString ip) {
@ -162,6 +162,13 @@ void DownloadingTorrents::showProperties(const QModelIndex &index) {
prop->show(); 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){ void DownloadingTorrents::resumeTorrent(QString hash){
int row = getRowFromHash(hash); int row = getRowFromHash(hash);
Q_ASSERT(row != -1); Q_ASSERT(row != -1);

4
src/downloadingTorrents.h

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

130
src/options.ui

@ -6,7 +6,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>663</width> <width>663</width>
<height>560</height> <height>586</height>
</rect> </rect>
</property> </property>
<property name="minimumSize" > <property name="minimumSize" >
@ -293,6 +293,13 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QCheckBox" name="checkStartMinimized" >
<property name="text" >
<string>Start minimized</string>
</property>
</widget>
</item>
<item> <item>
<widget class="QCheckBox" name="checkSystrayBalloons" > <widget class="QCheckBox" name="checkSystrayBalloons" >
<property name="text" > <property name="text" >
@ -376,6 +383,12 @@
<layout class="QVBoxLayout" > <layout class="QVBoxLayout" >
<item> <item>
<widget class="QGroupBox" name="fileSystemBox" > <widget class="QGroupBox" name="fileSystemBox" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title" > <property name="title" >
<string>File system</string> <string>File system</string>
</property> </property>
@ -451,6 +464,12 @@
</item> </item>
<item> <item>
<widget class="QGroupBox" name="torrentAdditionBox" > <widget class="QGroupBox" name="torrentAdditionBox" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title" > <property name="title" >
<string>When adding a torrent</string> <string>When adding a torrent</string>
</property> </property>
@ -477,6 +496,12 @@
</item> </item>
<item> <item>
<widget class="QGroupBox" name="dirScanBox" > <widget class="QGroupBox" name="dirScanBox" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<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>
@ -546,20 +571,117 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item>
<widget class="QGroupBox" name="ActDblClickBox" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Expanding" 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" >Action on double click in transfer lists</string>
</property>
<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> <item>
<spacer> <spacer>
<property name="orientation" > <property name="orientation" >
<enum>Qt::Vertical</enum> <enum>Qt::Horizontal</enum>
</property> </property>
<property name="sizeHint" > <property name="sizeHint" >
<size> <size>
<width>557</width> <width>40</width>
<height>21</height> <height>20</height>
</size> </size>
</property> </property>
</spacer> </spacer>
</item> </item>
</layout> </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> </widget>
<widget class="QWidget" name="tab_3" > <widget class="QWidget" name="tab_3" >
<attribute name="title" > <attribute name="title" >

29
src/options_imp.cpp

@ -127,6 +127,8 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
connect(checkNoSystray, SIGNAL(stateChanged(int)), this, SLOT(setSystrayOptionsState(int))); connect(checkNoSystray, SIGNAL(stateChanged(int)), this, SLOT(setSystrayOptionsState(int)));
// Downloads tab // Downloads tab
connect(checkScanDir, SIGNAL(stateChanged(int)), this, SLOT(enableDirScan(int))); 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 // Connection tab
connect(checkUploadLimit, SIGNAL(stateChanged(int)), this, SLOT(enableUploadLimit(int))); connect(checkUploadLimit, SIGNAL(stateChanged(int)), this, SLOT(enableUploadLimit(int)));
connect(checkDownloadLimit, SIGNAL(stateChanged(int)), this, SLOT(enableDownloadLimit(int))); connect(checkDownloadLimit, SIGNAL(stateChanged(int)), this, SLOT(enableDownloadLimit(int)));
@ -151,6 +153,7 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
connect(checkNoSystray, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton())); connect(checkNoSystray, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
connect(checkCloseToSystray, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton())); connect(checkCloseToSystray, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
connect(checkMinimizeToSysTray, 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(checkSystrayBalloons, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
connect(textMediaPlayer, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton())); connect(textMediaPlayer, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton()));
// Downloads tab // Downloads tab
@ -261,6 +264,7 @@ void options_imp::saveOptions(){
settings.setValue(QString::fromUtf8("SystrayEnabled"), systrayIntegration()); settings.setValue(QString::fromUtf8("SystrayEnabled"), systrayIntegration());
settings.setValue(QString::fromUtf8("CloseToTray"), closeToTray()); settings.setValue(QString::fromUtf8("CloseToTray"), closeToTray());
settings.setValue(QString::fromUtf8("MinimizeToTray"), minimizeToTray()); settings.setValue(QString::fromUtf8("MinimizeToTray"), minimizeToTray());
settings.setValue(QString::fromUtf8("StartMinimized"), startMinimized());
settings.setValue(QString::fromUtf8("NotificationBaloons"), OSDEnabled()); settings.setValue(QString::fromUtf8("NotificationBaloons"), OSDEnabled());
settings.setValue(QString::fromUtf8("MediaPlayer"), getPreviewProgram()); settings.setValue(QString::fromUtf8("MediaPlayer"), getPreviewProgram());
// End General preferences // End General preferences
@ -272,6 +276,8 @@ 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("DblClOnTorDl"), getActionOnDblClOnTorrentDl());
settings.setValue(QString::fromUtf8("DblClOnTorFn"), getActionOnDblClOnTorrentFn());
// End Downloads preferences // End Downloads preferences
settings.endGroup(); settings.endGroup();
// Connection preferences // Connection preferences
@ -404,6 +410,7 @@ void options_imp::loadOptions(){
enableSystrayOptions(); enableSystrayOptions();
checkCloseToSystray->setChecked(settings.value(QString::fromUtf8("CloseToTray"), false).toBool()); checkCloseToSystray->setChecked(settings.value(QString::fromUtf8("CloseToTray"), false).toBool());
checkMinimizeToSysTray->setChecked(settings.value(QString::fromUtf8("MinimizeToTray"), 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()); checkSystrayBalloons->setChecked(settings.value(QString::fromUtf8("NotificationBaloons"), true).toBool());
} }
textMediaPlayer->setText(settings.value(QString::fromUtf8("MediaPlayer"), QString()).toString()); textMediaPlayer->setText(settings.value(QString::fromUtf8("MediaPlayer"), QString()).toString());
@ -430,6 +437,9 @@ void options_imp::loadOptions(){
textScanDir->setText(strValue); textScanDir->setText(strValue);
enableDirScan(2); 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 // End Downloads preferences
settings.endGroup(); settings.endGroup();
// Connection preferences // Connection preferences
@ -649,6 +659,11 @@ bool options_imp::OSDEnabled() const {
return checkSystrayBalloons->isChecked(); return checkSystrayBalloons->isChecked();
} }
bool options_imp::startMinimized() const {
if(checkStartMinimized->isChecked()) return true;
return checkStartMinimized->isChecked();
}
bool options_imp::systrayIntegration() const{ bool options_imp::systrayIntegration() const{
if (!QSystemTrayIcon::isSystemTrayAvailable()) return false; if (!QSystemTrayIcon::isSystemTrayAvailable()) return false;
return (!checkNoSystray->isChecked()); return (!checkNoSystray->isChecked());
@ -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 // Display dialog to choose scan dir
void options_imp::on_browseScanDirButton_clicked() { void options_imp::on_browseScanDirButton_clicked() {
QString dir = QFileDialog::getExistingDirectory(this, tr("Choose scan directory"), QDir::homePath()); QString dir = QFileDialog::getExistingDirectory(this, tr("Choose scan directory"), QDir::homePath());

14
src/options_imp.h

@ -25,11 +25,22 @@
#include "ui_options.h" #include "ui_options.h"
#include <libtorrent/ip_filter.hpp> #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 HTTP 1
#define SOCKS5 2 #define SOCKS5 2
#define HTTP_PW 3 #define HTTP_PW 3
#define SOCKS5_PW 4 #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; using namespace libtorrent;
class QCloseEvent; class QCloseEvent;
@ -60,6 +71,7 @@ class options_imp : public QDialog, private Ui::Dialog{
bool systrayIntegration() const; bool systrayIntegration() const;
bool minimizeToTray() const; bool minimizeToTray() const;
bool closeToTray() const; bool closeToTray() const;
bool startMinimized() const;
bool OSDEnabled() const; bool OSDEnabled() const;
QString getPreviewProgram() const; QString getPreviewProgram() const;
// Downloads // Downloads
@ -69,6 +81,8 @@ 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 getActionOnDblClOnTorrentDl() const;
int getActionOnDblClOnTorrentFn() const;
// Connection options // Connection options
std::pair<unsigned short, unsigned short> getPorts() const; std::pair<unsigned short, unsigned short> getPorts() const;
bool isUPnPEnabled() const; bool isUPnPEnabled() const;

Loading…
Cancel
Save