mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-11-25 10:46:15 +03:00
This commit is contained in:
parent
ff8f37b262
commit
3baec1c327
3 changed files with 28 additions and 18 deletions
|
@ -140,10 +140,18 @@ void Application::torrentFinished(BitTorrent::TorrentHandle *const torrent)
|
|||
// AutoRun program
|
||||
if (pref->isAutoRunEnabled()) {
|
||||
QString program = pref->getAutoRunProgram();
|
||||
// Replace %f by torrent path
|
||||
program.replace("%f", torrent->savePathParsed());
|
||||
// Replace %n by torrent name
|
||||
program.replace("%n", torrent->name());
|
||||
int file_count = torrent->filesCount();
|
||||
|
||||
program.replace("%N", torrent->name());
|
||||
program.replace("%F", (file_count > 1) ? "" : torrent->fileName(0));
|
||||
program.replace("%L", torrent->label());
|
||||
program.replace("%D", torrent->rootPath());
|
||||
program.replace("%K", (file_count > 1) ? "multi" : "single");
|
||||
program.replace("%C", QString::number(torrent->filesCount()));
|
||||
program.replace("%Z", QString::number(torrent->totalSize()));
|
||||
program.replace("%T", torrent->currentTracker());
|
||||
program.replace("%I", torrent->hash());
|
||||
|
||||
QProcess::startDetached(program);
|
||||
}
|
||||
|
||||
|
|
|
@ -520,7 +520,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>487</width>
|
||||
<height>1005</height>
|
||||
<height>965</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
|
@ -990,7 +990,7 @@
|
|||
<item>
|
||||
<widget class="QGroupBox" name="autoRunBox">
|
||||
<property name="title">
|
||||
<string>Run an external program on torrent completion</string>
|
||||
<string>Run external program on torrent completion</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
|
@ -1003,18 +1003,7 @@
|
|||
<widget class="QLineEdit" name="autoRun_txt"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>The following parameters are supported:
|
||||
<ul>
|
||||
<li>%f: Torrent path</li>
|
||||
<li>%n: Torrent name</li>
|
||||
</ul></string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::RichText</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="autoRun_param"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
|
|
|
@ -180,6 +180,19 @@ options_imp::options_imp(QWidget *parent):
|
|||
connect(mailNotifPassword, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton()));
|
||||
connect(autoRunBox, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
||||
connect(autoRun_txt, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton()));
|
||||
|
||||
autoRun_param->setText(QString::fromUtf8("%1\n %2\n %3\n %4\n %5\n %6\n %7\n %8\n %9\n %10")
|
||||
.arg(tr("Supported parameters (case sensitive):"))
|
||||
.arg(tr("%N: Torrent name"))
|
||||
.arg(tr("%F: Downloaded file name (single-file torrent only)"))
|
||||
.arg(tr("%L: Label"))
|
||||
.arg(tr("%D: Save path"))
|
||||
.arg(tr("%K: \"single\"|\"multi\" file(s)"))
|
||||
.arg(tr("%C: Number of files"))
|
||||
.arg(tr("%Z: Torrent size (bytes)"))
|
||||
.arg(tr("%T: Current tracker"))
|
||||
.arg(tr("%I: Info hash")));
|
||||
|
||||
// Connection tab
|
||||
connect(spinPort, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton()));
|
||||
connect(checkRandomPort, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
||||
|
|
Loading…
Reference in a new issue