diff --git a/src/gui/optionsdialog.cpp b/src/gui/optionsdialog.cpp index c87957a43..b5c8bb2cc 100644 --- a/src/gui/optionsdialog.cpp +++ b/src/gui/optionsdialog.cpp @@ -763,8 +763,8 @@ void OptionsDialog::saveOptions() #if defined(Q_OS_WIN) pref->setAutoRunConsoleEnabled(m_ui->autoRunConsole->isChecked()); #endif - pref->setActionOnDblClOnTorrentDl(getActionOnDblClOnTorrentDl()); - pref->setActionOnDblClOnTorrentFn(getActionOnDblClOnTorrentFn()); + pref->setActionOnDblClOnTorrentDl(m_ui->actionTorrentDlOnDblClBox->currentData().toInt()); + pref->setActionOnDblClOnTorrentFn(m_ui->actionTorrentFnOnDblClBox->currentData().toInt()); TorrentFileGuard::setAutoDeleteMode(!m_ui->deleteTorrentBox->isChecked() ? TorrentFileGuard::Never : !m_ui->deleteCancelledTorrentBox->isChecked() ? TorrentFileGuard::IfAdded : TorrentFileGuard::Always); @@ -1057,14 +1057,26 @@ void OptionsDialog::loadOptions() #else m_ui->autoRunConsole->hide(); #endif - intValue = pref->getActionOnDblClOnTorrentDl(); - if (intValue >= m_ui->actionTorrentDlOnDblClBox->count()) - intValue = 0; - m_ui->actionTorrentDlOnDblClBox->setCurrentIndex(intValue); - intValue = pref->getActionOnDblClOnTorrentFn(); - if (intValue >= m_ui->actionTorrentFnOnDblClBox->count()) - intValue = 1; - m_ui->actionTorrentFnOnDblClBox->setCurrentIndex(intValue); + + m_ui->actionTorrentDlOnDblClBox->setItemData(0, TOGGLE_PAUSE); + m_ui->actionTorrentDlOnDblClBox->setItemData(1, OPEN_DEST); + m_ui->actionTorrentDlOnDblClBox->setItemData(2, PREVIEW_FILE); + m_ui->actionTorrentDlOnDblClBox->setItemData(3, SHOW_OPTIONS); + m_ui->actionTorrentDlOnDblClBox->setItemData(4, NO_ACTION); + int actionDownloading = pref->getActionOnDblClOnTorrentDl(); + if ((actionDownloading < 0) || (actionDownloading >= m_ui->actionTorrentDlOnDblClBox->count())) + actionDownloading = TOGGLE_PAUSE; + m_ui->actionTorrentDlOnDblClBox->setCurrentIndex(m_ui->actionTorrentDlOnDblClBox->findData(actionDownloading)); + + m_ui->actionTorrentFnOnDblClBox->setItemData(0, TOGGLE_PAUSE); + m_ui->actionTorrentFnOnDblClBox->setItemData(1, OPEN_DEST); + m_ui->actionTorrentFnOnDblClBox->setItemData(2, PREVIEW_FILE); + m_ui->actionTorrentFnOnDblClBox->setItemData(3, SHOW_OPTIONS); + m_ui->actionTorrentFnOnDblClBox->setItemData(4, NO_ACTION); + int actionSeeding = pref->getActionOnDblClOnTorrentFn(); + if ((actionSeeding < 0) || (actionSeeding >= m_ui->actionTorrentFnOnDblClBox->count())) + actionSeeding = OPEN_DEST; + m_ui->actionTorrentFnOnDblClBox->setCurrentIndex(m_ui->actionTorrentFnOnDblClBox->findData(actionSeeding)); // End Downloads preferences // Connection preferences @@ -1643,22 +1655,6 @@ QString OptionsDialog::getFinishedTorrentExportDir() const return {}; } -// Return action on double-click on a downloading torrent set in options -int OptionsDialog::getActionOnDblClOnTorrentDl() const -{ - if (m_ui->actionTorrentDlOnDblClBox->currentIndex() < 1) - return 0; - return m_ui->actionTorrentDlOnDblClBox->currentIndex(); -} - -// Return action on double-click on a finished torrent set in options -int OptionsDialog::getActionOnDblClOnTorrentFn() const -{ - if (m_ui->actionTorrentFnOnDblClBox->currentIndex() < 1) - return 0; - return m_ui->actionTorrentFnOnDblClBox->currentIndex(); -} - void OptionsDialog::on_addWatchedFolderButton_clicked() { Preferences *const pref = Preferences::instance(); diff --git a/src/gui/optionsdialog.h b/src/gui/optionsdialog.h index 00eb8cdef..1a14ba8ae 100644 --- a/src/gui/optionsdialog.h +++ b/src/gui/optionsdialog.h @@ -40,10 +40,11 @@ class AdvancedSettings; // actions on double-click on torrents enum DoubleClickAction { - TOGGLE_PAUSE, - OPEN_DEST, - PREVIEW_FILE, - NO_ACTION + TOGGLE_PAUSE = 0, + OPEN_DEST = 1, + PREVIEW_FILE = 2, + NO_ACTION = 3, + SHOW_OPTIONS = 4 }; namespace Net @@ -138,8 +139,6 @@ private: QString getTorrentExportDir() const; QString getFinishedTorrentExportDir() const; QString askForExportDir(const QString ¤tExportPath); - int getActionOnDblClOnTorrentDl() const; - int getActionOnDblClOnTorrentFn() const; // Connection options int getPort() const; bool isUPnPEnabled() const; diff --git a/src/gui/optionsdialog.ui b/src/gui/optionsdialog.ui index 1ead64f3f..c7dd4b510 100644 --- a/src/gui/optionsdialog.ui +++ b/src/gui/optionsdialog.ui @@ -313,6 +313,11 @@ Preview file, otherwise open destination folder + + + Show torrent options + + No action @@ -344,6 +349,11 @@ Preview file, otherwise open destination folder + + + Show torrent options + + No action diff --git a/src/gui/transferlistwidget.cpp b/src/gui/transferlistwidget.cpp index e467ba00d..834a5b8f0 100644 --- a/src/gui/transferlistwidget.cpp +++ b/src/gui/transferlistwidget.cpp @@ -303,6 +303,9 @@ void TransferListWidget::torrentDoubleClicked() case OPEN_DEST: openDestinationFolder(torrent); break; + case SHOW_OPTIONS: + setTorrentOptions(); + break; } }