1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-01-11 07:18:08 +00:00

Add "Show torrent options" double-click action

PR #15853.
Closes #15837.
This commit is contained in:
Vladimir Golovnev 2021-12-19 09:01:20 +03:00 committed by GitHub
parent aedd997604
commit 2fb0c86f1e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 40 additions and 32 deletions

View File

@ -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();

View File

@ -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 &currentExportPath);
int getActionOnDblClOnTorrentDl() const;
int getActionOnDblClOnTorrentFn() const;
// Connection options
int getPort() const;
bool isUPnPEnabled() const;

View File

@ -313,6 +313,11 @@
<string>Preview file, otherwise open destination folder</string>
</property>
</item>
<item>
<property name="text">
<string>Show torrent options</string>
</property>
</item>
<item>
<property name="text">
<string>No action</string>
@ -344,6 +349,11 @@
<string>Preview file, otherwise open destination folder</string>
</property>
</item>
<item>
<property name="text">
<string>Show torrent options</string>
</property>
</item>
<item>
<property name="text">
<string>No action</string>

View File

@ -303,6 +303,9 @@ void TransferListWidget::torrentDoubleClicked()
case OPEN_DEST:
openDestinationFolder(torrent);
break;
case SHOW_OPTIONS:
setTorrentOptions();
break;
}
}