From 6bab30a17885127962ac895fa443d22d86d7a085 Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Thu, 28 Apr 2016 19:02:05 +0800 Subject: [PATCH] Revamp Torrent creator --- src/gui/torrentcreatordlg.cpp | 402 ++++++++++++++---------- src/gui/torrentcreatordlg.h | 72 +++-- src/gui/torrentcreatordlg.ui | 561 +++++++++++++++++----------------- 3 files changed, 569 insertions(+), 466 deletions(-) diff --git a/src/gui/torrentcreatordlg.cpp b/src/gui/torrentcreatordlg.cpp index 668ee401a..4c0bf18f4 100644 --- a/src/gui/torrentcreatordlg.cpp +++ b/src/gui/torrentcreatordlg.cpp @@ -28,254 +28,350 @@ * Contact : chris@qbittorrent.org */ +#include "torrentcreatordlg.h" + +#include #include #include #include +#include +#include -#include "torrentcreatordlg.h" -#include "base/utils/fs.h" -#include "base/utils/misc.h" -#include "base/preferences.h" -#include "guiiconprovider.h" #include "base/bittorrent/session.h" #include "base/bittorrent/torrentinfo.h" #include "base/bittorrent/torrentcreatorthread.h" +#include "base/settingsstorage.h" +#include "base/utils/fs.h" +#include "guiiconprovider.h" -const uint NB_PIECES_MIN = 1200; -const uint NB_PIECES_MAX = 2200; +#include "ui_torrentcreatordlg.h" -TorrentCreatorDlg::TorrentCreatorDlg(QWidget *parent) - : QDialog(parent) - , m_creatorThread(0) +namespace { - setupUi(this); - // Icons - addFile_button->setIcon(GuiIconProvider::instance()->getIcon("document-new")); - addFolder_button->setIcon(GuiIconProvider::instance()->getIcon("folder-new")); - createButton->setIcon(GuiIconProvider::instance()->getIcon("document-save")); - cancelButton->setIcon(GuiIconProvider::instance()->getIcon("dialog-cancel")); +#define SETTINGS_KEY(name) "TorrentCreator/" name + const QString KEY_DIALOG_SIZE = SETTINGS_KEY("Dimension"); + const QString KEY_PIECE_SIZE = SETTINGS_KEY("PieceSize"); + const QString KEY_PRIVATE_TORRENT = SETTINGS_KEY("PrivateTorrent"); + const QString KEY_START_SEEDING = SETTINGS_KEY("StartSeeding"); + const QString KEY_SETTING_IGNORE_RATIO = SETTINGS_KEY("IgnoreRatio"); + + const QString KEY_LAST_ADD_PATH = SETTINGS_KEY("LastAddPath"); + const QString KEY_TRACKER_LIST = SETTINGS_KEY("TrackerList"); + const QString KEY_WEB_SEED_LIST = SETTINGS_KEY("WebSeedList"); + const QString KEY_COMMENTS = SETTINGS_KEY("Comments"); + const QString KEY_LAST_SAVE_PATH = SETTINGS_KEY("LastSavePath"); + + SettingsStorage *settings() { return SettingsStorage::instance(); } +} + +TorrentCreatorDlg::TorrentCreatorDlg(QWidget *parent, const QString &defaultPath) + : QDialog(parent) + , m_ui(new Ui::TorrentCreatorDlg) + , m_creatorThread(nullptr) + , m_defaultPath(Utils::Fs::toNativePath(defaultPath)) +{ + m_ui->setupUi(this); setAttribute(Qt::WA_DeleteOnClose); setModal(true); + showProgressBar(false); - loadTrackerList(); - // Piece sizes - m_pieceSizes << 16 << 32 << 64 << 128 << 256 << 512 << 1024 << 2048 << 4096 << 8192 << 16384; + m_ui->buttonBox->button(QDialogButtonBox::Ok)->setText(tr("Create Torrent")); + + connect(m_ui->addFile_button, SIGNAL(clicked(bool)), SLOT(onAddFileButtonClicked())); + connect(m_ui->addFolder_button, SIGNAL(clicked(bool)), SLOT(onAddFolderButtonClicked())); + connect(m_ui->buttonBox, SIGNAL(accepted()), SLOT(onCreateButtonClicked())); + loadSettings(); show(); } TorrentCreatorDlg::~TorrentCreatorDlg() { - if (m_creatorThread) + saveSettings(); + + // End torrent creation thread + if (m_creatorThread) { + if (m_creatorThread->isRunning()) { + m_creatorThread->abortCreation(); + m_creatorThread->terminate(); + // Wait for termination + m_creatorThread->wait(); + } delete m_creatorThread; + } + + delete m_ui; } -void TorrentCreatorDlg::on_addFolder_button_clicked() +void TorrentCreatorDlg::onAddFolderButtonClicked() { - Preferences* const pref = Preferences::instance(); - QString lastPath = pref->getCreateTorLastAddPath(); - QString dir = QFileDialog::getExistingDirectory(this, tr("Select a folder to add to the torrent"), lastPath, QFileDialog::ShowDirsOnly); - if (!dir.isEmpty()) { - pref->setCreateTorLastAddPath(dir); - textInputPath->setText(Utils::Fs::toNativePath(dir)); - // Update piece size - if (checkAutoPieceSize->isChecked()) - updateOptimalPieceSize(); - } + QString oldPath = m_ui->textInputPath->text(); + QString path = QFileDialog::getExistingDirectory(this, tr("Select folder"), oldPath); + if (!path.isEmpty()) + m_ui->textInputPath->setText(Utils::Fs::toNativePath(path)); } -void TorrentCreatorDlg::on_addFile_button_clicked() +void TorrentCreatorDlg::onAddFileButtonClicked() { - Preferences* const pref = Preferences::instance(); - QString lastPath = pref->getCreateTorLastAddPath(); - QString file = QFileDialog::getOpenFileName(this, tr("Select a file to add to the torrent"), lastPath); - if (!file.isEmpty()) { - pref->setCreateTorLastAddPath(Utils::Fs::branchPath(file)); - textInputPath->setText(Utils::Fs::toNativePath(file)); - // Update piece size - if (checkAutoPieceSize->isChecked()) - updateOptimalPieceSize(); - } + QString oldPath = m_ui->textInputPath->text(); + QString path = QFileDialog::getOpenFileName(this, tr("Select file"), oldPath); + if (!path.isEmpty()) + m_ui->textInputPath->setText(Utils::Fs::toNativePath(path)); } int TorrentCreatorDlg::getPieceSize() const { - return m_pieceSizes.at(comboPieceSize->currentIndex()) * 1024; + const int pieceSizes[] = {0, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384}; // base unit in KiB + return pieceSizes[m_ui->comboPieceSize->currentIndex()] * 1024; +} + +void TorrentCreatorDlg::dropEvent(QDropEvent *event) +{ + event->acceptProposedAction(); + + if (event->mimeData()->hasUrls()) { + // only take the first one + QUrl firstItem = event->mimeData()->urls().first(); + QString path = (firstItem.scheme().compare("file", Qt::CaseInsensitive) == 0) + ? firstItem.toLocalFile() : firstItem.toString(); + m_ui->textInputPath->setText(Utils::Fs::toNativePath(path)); + } +} + +void TorrentCreatorDlg::dragEnterEvent(QDragEnterEvent *event) +{ + if (event->mimeData()->hasFormat("text/plain") || event->mimeData()->hasFormat("text/uri-list")) + event->acceptProposedAction(); } // Main function that create a .torrent file -void TorrentCreatorDlg::on_createButton_clicked() +void TorrentCreatorDlg::onCreateButtonClicked() { - QString input = Utils::Fs::fromNativePath(textInputPath->text()).trimmed(); - if (input.endsWith("/")) - input.chop(1); - if (input.isEmpty()) { - QMessageBox::critical(0, tr("No input path set"), tr("Please type an input path first")); + QString input = Utils::Fs::fromNativePath(m_ui->textInputPath->text()).trimmed(); + + // test if readable + QFileInfo fi(input); + if (!fi.isReadable()) { + QMessageBox::critical(this, tr("Torrent creator failed"), tr("Reason: Path to file/folder is not readable.")); return; } - QStringList trackers = trackers_list->toPlainText().split("\n"); - if (!trackers_list->toPlainText().trimmed().isEmpty()) - saveTrackerList(); + input = fi.canonicalFilePath(); - Preferences* const pref = Preferences::instance(); - QString lastPath = pref->getCreateTorLastSavePath(); - - QString destination = QFileDialog::getSaveFileName(this, tr("Select destination torrent file"), lastPath, tr("Torrent Files (*.torrent)")); + // get save path + QString lastPath = getLastSavePath(); + QString destination = QFileDialog::getSaveFileName(this, tr("Select where to save the new torrent"), lastPath, tr("Torrent Files (*.torrent)")); if (destination.isEmpty()) return; + if (!destination.endsWith(".torrent", Qt::CaseInsensitive)) + destination += ".torrent"; + setLastSavePath(Utils::Fs::branchPath(destination)); - pref->setCreateTorLastSavePath(Utils::Fs::branchPath(destination)); - if (!destination.toUpper().endsWith(".TORRENT")) - destination += QString::fromUtf8(".torrent"); - - // Disable dialog + // Disable dialog & set busy cursor setInteractionEnabled(false); showProgressBar(true); - // Set busy cursor setCursor(QCursor(Qt::WaitCursor)); - // Actually create the torrent - QStringList urlSeeds = URLSeeds_list->toPlainText().split("\n"); - QString comment = txt_comment->toPlainText(); + + QStringList trackers = m_ui->trackers_list->toPlainText().split("\n"); + QStringList urlSeeds = m_ui->URLSeeds_list->toPlainText().split("\n"); + QString comment = m_ui->txt_comment->toPlainText(); + // Create the creator thread m_creatorThread = new BitTorrent::TorrentCreatorThread(this); connect(m_creatorThread, SIGNAL(creationSuccess(QString, QString)), this, SLOT(handleCreationSuccess(QString, QString))); connect(m_creatorThread, SIGNAL(creationFailure(QString)), this, SLOT(handleCreationFailure(QString))); connect(m_creatorThread, SIGNAL(updateProgress(int)), this, SLOT(updateProgressBar(int))); - m_creatorThread->create(input, destination, trackers, urlSeeds, comment, check_private->isChecked(), getPieceSize()); + m_creatorThread->create(input, destination, trackers, urlSeeds, comment, m_ui->check_private->isChecked(), getPieceSize()); } -void TorrentCreatorDlg::handleCreationFailure(QString msg) +void TorrentCreatorDlg::handleCreationFailure(const QString &msg) { // Remove busy cursor setCursor(QCursor(Qt::ArrowCursor)); - QMessageBox::information(0, tr("Torrent creation"), tr("Torrent creation was unsuccessful, reason: %1").arg(msg)); + QMessageBox::information(this, tr("Torrent creator failed"), tr("Reason: %1").arg(msg)); setInteractionEnabled(true); showProgressBar(false); } -void TorrentCreatorDlg::handleCreationSuccess(QString path, QString branch_path) +void TorrentCreatorDlg::handleCreationSuccess(const QString &path, const QString &branchPath) { // Remove busy cursor setCursor(QCursor(Qt::ArrowCursor)); - if (checkStartSeeding->isChecked()) { + if (m_ui->checkStartSeeding->isChecked()) { // Create save path temp data BitTorrent::TorrentInfo t = BitTorrent::TorrentInfo::loadFromFile(Utils::Fs::toNativePath(path)); if (!t.isValid()) { - QMessageBox::critical(0, tr("Torrent creation"), tr("Created torrent file is invalid. It won't be added to download list.")); + QMessageBox::critical(this, tr("Torrent creator failed"), tr("Reason: Created torrent is invalid. It won't be added to download list.")); return; } BitTorrent::AddTorrentParams params; - params.savePath = branch_path; + params.savePath = branchPath; params.skipChecking = true; - params.ignoreShareLimits = checkIgnoreShareLimits->isChecked(); + params.ignoreShareLimits = m_ui->checkIgnoreShareLimits->isChecked(); BitTorrent::Session::instance()->addTorrent(t, params); } - QMessageBox::information(0, tr("Torrent creation"), tr("Torrent was created successfully: %1", "%1 is the path of the torrent").arg(Utils::Fs::toNativePath(path))); - close(); -} + QMessageBox::information(this, tr("Torrent creator"), QString("%1\n%2").arg(tr("Create torrent success:")).arg(Utils::Fs::toNativePath(path))); -void TorrentCreatorDlg::on_cancelButton_clicked() -{ - // End torrent creation thread - if (m_creatorThread && m_creatorThread->isRunning()) { - m_creatorThread->abortCreation(); - m_creatorThread->terminate(); - // Wait for termination - m_creatorThread->wait(); - } - // Close the dialog close(); } void TorrentCreatorDlg::updateProgressBar(int progress) { - progressBar->setValue(progress); + m_ui->progressBar->setValue(progress); } void TorrentCreatorDlg::setInteractionEnabled(bool enabled) { - textInputPath->setEnabled(enabled); - addFile_button->setEnabled(enabled); - addFolder_button->setEnabled(enabled); - trackers_list->setEnabled(enabled); - URLSeeds_list->setEnabled(enabled); - txt_comment->setEnabled(enabled); - comboPieceSize->setEnabled(enabled); - checkAutoPieceSize->setEnabled(enabled); - check_private->setEnabled(enabled); - checkStartSeeding->setEnabled(enabled); - createButton->setEnabled(enabled); - checkIgnoreShareLimits->setEnabled(enabled && checkStartSeeding->isChecked()); + m_ui->textInputPath->setEnabled(enabled); + m_ui->addFile_button->setEnabled(enabled); + m_ui->addFolder_button->setEnabled(enabled); + m_ui->trackers_list->setEnabled(enabled); + m_ui->URLSeeds_list->setEnabled(enabled); + m_ui->txt_comment->setEnabled(enabled); + m_ui->comboPieceSize->setEnabled(enabled); + m_ui->check_private->setEnabled(enabled); + m_ui->checkStartSeeding->setEnabled(enabled); + m_ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(enabled); + m_ui->checkIgnoreShareLimits->setEnabled(enabled && m_ui->checkStartSeeding->isChecked()); } void TorrentCreatorDlg::showProgressBar(bool show) { - progressLbl->setVisible(show); - progressBar->setVisible(show); -} - -void TorrentCreatorDlg::on_checkAutoPieceSize_clicked(bool checked) -{ - comboPieceSize->setEnabled(!checked); - if (checked) - updateOptimalPieceSize(); -} - -void TorrentCreatorDlg::updateOptimalPieceSize() -{ - qint64 torrentSize = Utils::Fs::computePathSize(textInputPath->text()); - qDebug("Torrent size is %lld", torrentSize); - if (torrentSize < 0) - return; - int i = 0; - qulonglong nb_pieces = 0; - do { - nb_pieces = (double)torrentSize/(m_pieceSizes.at(i) * 1024.); - qDebug("nb_pieces=%lld with piece_size=%s", nb_pieces, qPrintable(comboPieceSize->itemText(i))); - if (nb_pieces <= NB_PIECES_MIN) { - if (i > 1) - --i; - break; - } - else if (nb_pieces < NB_PIECES_MAX) { - qDebug("Good, nb_pieces=%lld < %d", nb_pieces + 1, NB_PIECES_MAX); - break; - } - ++i; - } while (i < (m_pieceSizes.size() - 1)); - comboPieceSize->setCurrentIndex(i); -} - -void TorrentCreatorDlg::saveTrackerList() -{ - Preferences::instance()->setCreateTorTrackers(trackers_list->toPlainText()); -} - -void TorrentCreatorDlg::loadTrackerList() -{ - trackers_list->setPlainText(Preferences::instance()->getCreateTorTrackers()); + m_ui->progressLbl->setVisible(show); + m_ui->progressBar->setVisible(show); } void TorrentCreatorDlg::saveSettings() { - Preferences* const pref = Preferences::instance(); - pref->setCreateTorGeometry(saveGeometry()); - pref->setCreateTorIgnoreRatio(checkIgnoreShareLimits->isChecked()); + setLastAddPath(m_ui->textInputPath->text().trimmed()); + + setSettingPieceSize(m_ui->comboPieceSize->currentIndex()); + setSettingPrivateTorrent(m_ui->check_private->isChecked()); + setSettingStartSeeding(m_ui->checkStartSeeding->isChecked()); + setSettingIgnoreRatio(m_ui->checkIgnoreShareLimits->isChecked()); + + setTrackerList(m_ui->trackers_list->toPlainText()); + setWebSeedList(m_ui->URLSeeds_list->toPlainText()); + setComments(m_ui->txt_comment->toPlainText()); + + setDialogSize(size()); } void TorrentCreatorDlg::loadSettings() { - const Preferences* const pref = Preferences::instance(); - restoreGeometry(pref->getCreateTorGeometry()); - checkIgnoreShareLimits->setChecked(pref->getCreateTorIgnoreRatio()); + m_ui->textInputPath->setText(!m_defaultPath.isEmpty() ? m_defaultPath : getLastAddPath()); + + m_ui->comboPieceSize->setCurrentIndex(getSettingPieceSize()); + m_ui->check_private->setChecked(getSettingPrivateTorrent()); + m_ui->checkStartSeeding->setChecked(getSettingStartSeeding()); + m_ui->checkIgnoreShareLimits->setChecked(getSettingIgnoreRatio()); + m_ui->checkIgnoreShareLimits->setEnabled(m_ui->checkStartSeeding->isChecked()); + + m_ui->trackers_list->setPlainText(getTrackerList()); + m_ui->URLSeeds_list->setPlainText(getWebSeedList()); + m_ui->txt_comment->setPlainText(getComments()); + + resize(getDialogSize()); } -void TorrentCreatorDlg::closeEvent(QCloseEvent *event) +QSize TorrentCreatorDlg::getDialogSize() const { - qDebug() << Q_FUNC_INFO; - saveSettings(); - QDialog::closeEvent(event); + return settings()->loadValue(KEY_DIALOG_SIZE, size()).toSize(); +} + +void TorrentCreatorDlg::setDialogSize(const QSize &size) +{ + settings()->storeValue(KEY_DIALOG_SIZE, size); +} + +int TorrentCreatorDlg::getSettingPieceSize() const +{ + return settings()->loadValue(KEY_PIECE_SIZE).toInt(); +} + +void TorrentCreatorDlg::setSettingPieceSize(const int size) +{ + settings()->storeValue(KEY_PIECE_SIZE, size); +} + +bool TorrentCreatorDlg::getSettingPrivateTorrent() const +{ + return settings()->loadValue(KEY_PRIVATE_TORRENT).toBool(); +} + +void TorrentCreatorDlg::setSettingPrivateTorrent(const bool b) +{ + settings()->storeValue(KEY_PRIVATE_TORRENT, b); +} + +bool TorrentCreatorDlg::getSettingStartSeeding() const +{ + return settings()->loadValue(KEY_START_SEEDING).toBool(); +} + +void TorrentCreatorDlg::setSettingStartSeeding(const bool b) +{ + settings()->storeValue(KEY_START_SEEDING, b); +} + +bool TorrentCreatorDlg::getSettingIgnoreRatio() const +{ + return settings()->loadValue(KEY_SETTING_IGNORE_RATIO).toBool(); +} + +void TorrentCreatorDlg::setSettingIgnoreRatio(const bool ignore) +{ + settings()->storeValue(KEY_SETTING_IGNORE_RATIO, ignore); +} + +QString TorrentCreatorDlg::getLastAddPath() const +{ + return settings()->loadValue(KEY_LAST_ADD_PATH, QDir::homePath()).toString(); +} + +void TorrentCreatorDlg::setLastAddPath(const QString &path) +{ + settings()->storeValue(KEY_LAST_ADD_PATH, path); +} + +QString TorrentCreatorDlg::getTrackerList() const +{ + return settings()->loadValue(KEY_TRACKER_LIST).toString(); +} + +void TorrentCreatorDlg::setTrackerList(const QString &list) +{ + settings()->storeValue(KEY_TRACKER_LIST, list); +} + +QString TorrentCreatorDlg::getWebSeedList() const +{ + return settings()->loadValue(KEY_WEB_SEED_LIST).toString(); +} + +void TorrentCreatorDlg::setWebSeedList(const QString &list) +{ + settings()->storeValue(KEY_WEB_SEED_LIST, list); +} + +QString TorrentCreatorDlg::getComments() const +{ + return settings()->loadValue(KEY_COMMENTS).toString(); +} + +void TorrentCreatorDlg::setComments(const QString &str) +{ + settings()->storeValue(KEY_COMMENTS, str); +} + +QString TorrentCreatorDlg::getLastSavePath() const +{ + return settings()->loadValue(KEY_LAST_SAVE_PATH, QDir::homePath()).toString(); +} + +void TorrentCreatorDlg::setLastSavePath(const QString &path) +{ + settings()->storeValue(KEY_LAST_SAVE_PATH, path); } diff --git a/src/gui/torrentcreatordlg.h b/src/gui/torrentcreatordlg.h index d681a90d9..2c9697868 100644 --- a/src/gui/torrentcreatordlg.h +++ b/src/gui/torrentcreatordlg.h @@ -28,52 +28,72 @@ * Contact : chris@qbittorrent.org */ -#ifndef CREATE_TORRENT_IMP_H -#define CREATE_TORRENT_IMP_H +#ifndef TORRENTCREATORDLG_H +#define TORRENTCREATORDLG_H -#include "ui_torrentcreatordlg.h" +#include + +namespace Ui +{ + class TorrentCreatorDlg; +} namespace BitTorrent { class TorrentCreatorThread; } -class TorrentCreatorDlg : public QDialog, private Ui::createTorrentDialog +class TorrentCreatorDlg: public QDialog { Q_OBJECT public: - TorrentCreatorDlg(QWidget *parent = 0); + TorrentCreatorDlg(QWidget *parent = 0, const QString &defaultPath = QString()); ~TorrentCreatorDlg(); - int getPieceSize() const; -public slots: +private slots: void updateProgressBar(int progress); - void on_cancelButton_clicked(); - -protected slots: - void on_createButton_clicked(); - void on_addFile_button_clicked(); - void on_addFolder_button_clicked(); - void handleCreationFailure(QString msg); - void handleCreationSuccess(QString path, QString branch_path); - void setInteractionEnabled(bool enabled); - void showProgressBar(bool show); - void on_checkAutoPieceSize_clicked(bool checked); - void updateOptimalPieceSize(); - void saveTrackerList(); - void loadTrackerList(); - -protected: - void closeEvent(QCloseEvent *event); + void onCreateButtonClicked(); + void onAddFileButtonClicked(); + void onAddFolderButtonClicked(); + void handleCreationFailure(const QString &msg); + void handleCreationSuccess(const QString &path, const QString &branchPath); private: + void dropEvent(QDropEvent *event) override; + void dragEnterEvent(QDragEnterEvent *event) override; + void saveSettings(); void loadSettings(); + int getPieceSize() const; + void showProgressBar(bool show); + void setInteractionEnabled(bool enabled); -private: + // settings storage + QSize getDialogSize() const; + void setDialogSize(const QSize &size); + int getSettingPieceSize() const; + void setSettingPieceSize(const int size); + bool getSettingPrivateTorrent() const; + void setSettingPrivateTorrent(const bool b); + bool getSettingStartSeeding() const; + void setSettingStartSeeding(const bool b); + bool getSettingIgnoreRatio() const; + void setSettingIgnoreRatio(const bool ignore); + QString getLastAddPath() const; + void setLastAddPath(const QString &path); + QString getTrackerList() const; + void setTrackerList(const QString &list); + QString getWebSeedList() const; + void setWebSeedList(const QString &list); + QString getComments() const; + void setComments(const QString &str); + QString getLastSavePath() const; + void setLastSavePath(const QString &path); + + Ui::TorrentCreatorDlg *m_ui; BitTorrent::TorrentCreatorThread *m_creatorThread; - QList m_pieceSizes; + QString m_defaultPath; }; #endif diff --git a/src/gui/torrentcreatordlg.ui b/src/gui/torrentcreatordlg.ui index 524fc2db8..c3aec7bad 100644 --- a/src/gui/torrentcreatordlg.ui +++ b/src/gui/torrentcreatordlg.ui @@ -1,7 +1,7 @@ - createTorrentDialog - + TorrentCreatorDlg + 0 @@ -10,322 +10,293 @@ 658 + + true + - Torrent Creation Tool + Torrent Creator - - - - 0 - 27 - - - - - 16777215 - 27 - - - - - 75 - true - - - - Torrent file creation - - - Qt::AlignCenter + + + Select file/folder to share + + + + + + + Path: + + + + + + + false + + + + + + + + + + + false + + + + 0 + 0 + + + + [Drag and drop area] + + + Qt::AlignCenter + + + + + + + Select file + + + + + + + Select folder + + + + + + - - - File or folder to add to the torrent: + + + Settings + + + + + + + Piece size: + + + + + + + 0 + + + + Auto + + + + + 16 KiB + + + + + 32 KiB + + + + + 64 KiB + + + + + 128 KiB + + + + + 256 KiB + + + + + 512 KiB + + + + + 1 MiB + + + + + 2 MiB + + + + + 4 MiB + + + + + 8 MiB + + + + + 16 MiB + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Private torrent (Won't distribute on DHT network) + + + + + + + Start seeding immediately + + + true + + + + + + + Ignore share ratio limits for this torrent + + + + - + + + Fields + + + + + + You can separate tracker tiers / groups with an empty line. + + + false + + + + + + + Web seed URLs: + + + + + + + false + + + + + + + false + + + + + + + Tracker URLs: + + + + + + + Comments: + + + + + - + - + - Add file + Progress: - - - Add folder - - + - - - - - Tracker URLs: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Web seeds urls: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Comment: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - false - - - - - - - - 0 - 0 - - - - You can separate tracker tiers / groups with an empty line. - - - false - - - - - - - false - - - - - - - - - - - Piece size: - - - - - - - false - - - false - - - 4 - - - - 16 KiB - - - - - 32 KiB - - - - - 64 KiB - - - - - 128 KiB - - - - - 256 KiB - - - - - 512 KiB - - - - - 1 MiB - - - - - 2 MiB - - - - - 4 MiB - - - - - 8 MiB - - - - - 16 MiB - - - - - - - - Auto - - - true - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - Private (won't be distributed on DHT network if enabled) + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - Start seeding after creation - - + true - - - - Ignore share ratio limits for this torrent - - - - - - - Progress: - - - - - - - 0 - - - - - - - - - Qt::Horizontal - - - - 131 - 31 - - - - - - - - Create and save... - - - - - - - Cancel - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - + + textInputPath + addFile_button + addFolder_button + comboPieceSize + check_private + checkStartSeeding + checkIgnoreShareLimits + trackers_list + URLSeeds_list + txt_comment + @@ -344,5 +315,21 @@ + + buttonBox + rejected() + TorrentCreatorDlg + reject() + + + 295 + 635 + + + 295 + 328 + + +