Added command line arguments for specifying options when adding torrents

Arguments include adding torrents as paused/started, skiping hash check, setting category, downloading in sequential order, downloading first and last pieces first, and skipping the 'add new torrent' dialog. Added TriStateBoolOption class for specifying options that don't have a default value when unused (e.g. add-paused). Also improved command line usage text to include more information, have better organization, and not exceed 80 columns in width. Also also added firstLastPiecePriority field to BitTorrent::AddTorrentData, and modified TorrentHandle so that if first/last piece priority should be on, it will be toggled on after the torrent's metadata has loaded.
This commit is contained in:
Brian Kendall
2016-07-14 22:15:10 -04:00
parent 172991e068
commit eba41978b0
12 changed files with 375 additions and 90 deletions

View File

@@ -38,6 +38,7 @@
#include "base/bittorrent/infohash.h"
#include "base/bittorrent/torrentinfo.h"
#include "base/bittorrent/addtorrentparams.h"
namespace BitTorrent
{
@@ -65,7 +66,8 @@ public:
static bool isTopLevel();
static void setTopLevel(bool value);
static void show(QString source, QWidget *parent = 0);
static void show(QString source, const BitTorrent::AddTorrentParams &inParams, QWidget *parent);
static void show(QString source, QWidget *parent);
private slots:
void showAdvancedSettings(bool show);
@@ -87,7 +89,7 @@ private slots:
void reject() override;
private:
explicit AddNewTorrentDialog(QWidget *parent = 0);
explicit AddNewTorrentDialog(const BitTorrent::AddTorrentParams &inParams, QWidget *parent);
bool loadTorrent(const QString &torrentPath);
bool loadMagnet(const BitTorrent::MagnetUri &magnetUri);
void populateSavePathComboBox();
@@ -98,6 +100,7 @@ private:
void setMetadataProgressIndicator(bool visibleIndicator, const QString &labelText = QString());
void setupTreeview();
void setCommentText(const QString &str) const;
void setSavePath(const QString &newPath);
void showEvent(QShowEvent *event) override;
@@ -112,6 +115,7 @@ private:
QByteArray m_headerState;
int m_oldIndex;
QScopedPointer<TorrentFileGuard> m_torrentGuard;
BitTorrent::AddTorrentParams m_torrentParams;
};
#endif // ADDNEWTORRENTDIALOG_H