mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-02-11 06:14:16 +00:00
Merge pull request #5196 from Chocobo1/creator_pr
Revamp Torrent creator
This commit is contained in:
commit
1f9ccb44a3
@ -52,6 +52,7 @@ utils/string.h
|
|||||||
utils/version.h
|
utils/version.h
|
||||||
asyncfilestorage.h
|
asyncfilestorage.h
|
||||||
filesystemwatcher.h
|
filesystemwatcher.h
|
||||||
|
global.h
|
||||||
iconprovider.h
|
iconprovider.h
|
||||||
indexrange.h
|
indexrange.h
|
||||||
logger.h
|
logger.h
|
||||||
|
@ -63,7 +63,8 @@ HEADERS += \
|
|||||||
$$PWD/torrentfileguard.h \
|
$$PWD/torrentfileguard.h \
|
||||||
$$PWD/torrentfilter.h \
|
$$PWD/torrentfilter.h \
|
||||||
$$PWD/scanfoldersmodel.h \
|
$$PWD/scanfoldersmodel.h \
|
||||||
$$PWD/searchengine.h
|
$$PWD/searchengine.h \
|
||||||
|
$$PWD/global.h
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
$$PWD/asyncfilestorage.cpp \
|
$$PWD/asyncfilestorage.cpp \
|
||||||
|
@ -28,25 +28,21 @@
|
|||||||
* Contact : chris@qbittorrent.org
|
* Contact : chris@qbittorrent.org
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <libtorrent/entry.hpp>
|
#include "torrentcreatorthread.h"
|
||||||
#include <libtorrent/bencode.hpp>
|
|
||||||
#include <libtorrent/torrent_info.hpp>
|
#include <fstream>
|
||||||
#include <libtorrent/file.hpp>
|
|
||||||
#include <libtorrent/storage.hpp>
|
|
||||||
#include <libtorrent/hasher.hpp>
|
|
||||||
#include <libtorrent/file_pool.hpp>
|
|
||||||
#include <libtorrent/create_torrent.hpp>
|
|
||||||
#include <QFile>
|
|
||||||
#include <QDir>
|
|
||||||
|
|
||||||
#include <boost/bind.hpp>
|
#include <boost/bind.hpp>
|
||||||
#include <iostream>
|
#include <libtorrent/bencode.hpp>
|
||||||
#include <fstream>
|
#include <libtorrent/create_torrent.hpp>
|
||||||
|
#include <libtorrent/torrent_info.hpp>
|
||||||
|
#include <libtorrent/storage.hpp>
|
||||||
|
|
||||||
|
#include <QFile>
|
||||||
|
|
||||||
#include "base/utils/fs.h"
|
#include "base/utils/fs.h"
|
||||||
#include "base/utils/misc.h"
|
#include "base/utils/misc.h"
|
||||||
#include "base/utils/string.h"
|
#include "base/utils/string.h"
|
||||||
#include "torrentcreatorthread.h"
|
|
||||||
|
|
||||||
namespace libt = libtorrent;
|
namespace libt = libtorrent;
|
||||||
using namespace BitTorrent;
|
using namespace BitTorrent;
|
||||||
@ -62,14 +58,13 @@ TorrentCreatorThread::TorrentCreatorThread(QObject *parent)
|
|||||||
: QThread(parent)
|
: QThread(parent)
|
||||||
, m_private(false)
|
, m_private(false)
|
||||||
, m_pieceSize(0)
|
, m_pieceSize(0)
|
||||||
, m_abort(false)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
TorrentCreatorThread::~TorrentCreatorThread()
|
TorrentCreatorThread::~TorrentCreatorThread()
|
||||||
{
|
{
|
||||||
m_abort = true;
|
requestInterruption();
|
||||||
wait();
|
wait(1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TorrentCreatorThread::create(const QString &inputPath, const QString &savePath, const QStringList &trackers,
|
void TorrentCreatorThread::create(const QString &inputPath, const QString &savePath, const QStringList &trackers,
|
||||||
@ -84,7 +79,6 @@ void TorrentCreatorThread::create(const QString &inputPath, const QString &saveP
|
|||||||
m_comment = comment;
|
m_comment = comment;
|
||||||
m_private = isPrivate;
|
m_private = isPrivate;
|
||||||
m_pieceSize = pieceSize;
|
m_pieceSize = pieceSize;
|
||||||
m_abort = false;
|
|
||||||
|
|
||||||
start();
|
start();
|
||||||
}
|
}
|
||||||
@ -94,11 +88,6 @@ void TorrentCreatorThread::sendProgressSignal(int numHashes, int numPieces)
|
|||||||
emit updateProgress(static_cast<int>((numHashes * 100.) / numPieces));
|
emit updateProgress(static_cast<int>((numHashes * 100.) / numPieces));
|
||||||
}
|
}
|
||||||
|
|
||||||
void TorrentCreatorThread::abortCreation()
|
|
||||||
{
|
|
||||||
m_abort = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void TorrentCreatorThread::run()
|
void TorrentCreatorThread::run()
|
||||||
{
|
{
|
||||||
emit updateProgress(0);
|
emit updateProgress(0);
|
||||||
@ -108,7 +97,8 @@ void TorrentCreatorThread::run()
|
|||||||
libt::file_storage fs;
|
libt::file_storage fs;
|
||||||
// Adding files to the torrent
|
// Adding files to the torrent
|
||||||
libt::add_files(fs, Utils::Fs::toNativePath(m_inputPath).toStdString(), fileFilter);
|
libt::add_files(fs, Utils::Fs::toNativePath(m_inputPath).toStdString(), fileFilter);
|
||||||
if (m_abort) return;
|
|
||||||
|
if (isInterruptionRequested()) return;
|
||||||
|
|
||||||
libt::create_torrent t(fs, m_pieceSize);
|
libt::create_torrent t(fs, m_pieceSize);
|
||||||
|
|
||||||
@ -129,7 +119,8 @@ void TorrentCreatorThread::run()
|
|||||||
t.add_tracker(tracker.trimmed().toStdString(), tier);
|
t.add_tracker(tracker.trimmed().toStdString(), tier);
|
||||||
newline = false;
|
newline = false;
|
||||||
}
|
}
|
||||||
if (m_abort) return;
|
|
||||||
|
if (isInterruptionRequested()) return;
|
||||||
|
|
||||||
// calculate the hash for all pieces
|
// calculate the hash for all pieces
|
||||||
const QString parentPath = Utils::Fs::branchPath(m_inputPath) + "/";
|
const QString parentPath = Utils::Fs::branchPath(m_inputPath) + "/";
|
||||||
@ -140,7 +131,8 @@ void TorrentCreatorThread::run()
|
|||||||
t.set_comment(m_comment.toUtf8().constData());
|
t.set_comment(m_comment.toUtf8().constData());
|
||||||
// Is private ?
|
// Is private ?
|
||||||
t.set_priv(m_private);
|
t.set_priv(m_private);
|
||||||
if (m_abort) return;
|
|
||||||
|
if (isInterruptionRequested()) return;
|
||||||
|
|
||||||
// create the torrent and print it to out
|
// create the torrent and print it to out
|
||||||
qDebug("Saving to %s", qPrintable(m_savePath));
|
qDebug("Saving to %s", qPrintable(m_savePath));
|
||||||
@ -156,6 +148,8 @@ void TorrentCreatorThread::run()
|
|||||||
if (outfile.fail())
|
if (outfile.fail())
|
||||||
throw std::exception();
|
throw std::exception();
|
||||||
|
|
||||||
|
if (isInterruptionRequested()) return;
|
||||||
|
|
||||||
libt::bencode(std::ostream_iterator<char>(outfile), t.generate());
|
libt::bencode(std::ostream_iterator<char>(outfile), t.generate());
|
||||||
outfile.close();
|
outfile.close();
|
||||||
|
|
||||||
|
@ -31,8 +31,8 @@
|
|||||||
#ifndef BITTORRENT_TORRENTCREATORTHREAD_H
|
#ifndef BITTORRENT_TORRENTCREATORTHREAD_H
|
||||||
#define BITTORRENT_TORRENTCREATORTHREAD_H
|
#define BITTORRENT_TORRENTCREATORTHREAD_H
|
||||||
|
|
||||||
#include <QThread>
|
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
|
#include <QThread>
|
||||||
|
|
||||||
namespace BitTorrent
|
namespace BitTorrent
|
||||||
{
|
{
|
||||||
@ -46,7 +46,6 @@ namespace BitTorrent
|
|||||||
|
|
||||||
void create(const QString &inputPath, const QString &savePath, const QStringList &trackers,
|
void create(const QString &inputPath, const QString &savePath, const QStringList &trackers,
|
||||||
const QStringList &urlSeeds, const QString &comment, bool isPrivate, int pieceSize);
|
const QStringList &urlSeeds, const QString &comment, bool isPrivate, int pieceSize);
|
||||||
void abortCreation();
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void run();
|
void run();
|
||||||
@ -66,7 +65,6 @@ namespace BitTorrent
|
|||||||
QString m_comment;
|
QString m_comment;
|
||||||
bool m_private;
|
bool m_private;
|
||||||
int m_pieceSize;
|
int m_pieceSize;
|
||||||
bool m_abort;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
30
src/base/global.h
Normal file
30
src/base/global.h
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
/*
|
||||||
|
* Bittorrent Client using Qt and libtorrent.
|
||||||
|
* Copyright (C) 2016 Mike Tzou
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
*
|
||||||
|
* In addition, as a special exception, the copyright holders give permission to
|
||||||
|
* link this program with the OpenSSL project's "OpenSSL" library (or with
|
||||||
|
* modified versions of it that use the same license as the "OpenSSL" library),
|
||||||
|
* and distribute the linked executables. You must obey the GNU General Public
|
||||||
|
* License in all respects for all of the code used other than "OpenSSL". If you
|
||||||
|
* modify file(s), you may extend this exception to your version of the file(s),
|
||||||
|
* but you are not obligated to do so. If you do not wish to do so, delete this
|
||||||
|
* exception statement from your version.
|
||||||
|
*/
|
||||||
|
|
||||||
|
const char C_TORRENT_FILE_EXTENSION[] = ".torrent";
|
||||||
|
|
@ -1277,56 +1277,6 @@ void Preferences::setSearchEngDisabled(const QStringList &engines)
|
|||||||
setValue("SearchEngines/disabledEngines", engines);
|
setValue("SearchEngines/disabledEngines", engines);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Preferences::getCreateTorLastAddPath() const
|
|
||||||
{
|
|
||||||
return value("CreateTorrent/last_add_path", QDir::homePath()).toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Preferences::setCreateTorLastAddPath(const QString &path)
|
|
||||||
{
|
|
||||||
setValue("CreateTorrent/last_add_path", path);
|
|
||||||
}
|
|
||||||
|
|
||||||
QString Preferences::getCreateTorLastSavePath() const
|
|
||||||
{
|
|
||||||
return value("CreateTorrent/last_save_path", QDir::homePath()).toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Preferences::setCreateTorLastSavePath(const QString &path)
|
|
||||||
{
|
|
||||||
setValue("CreateTorrent/last_save_path", path);
|
|
||||||
}
|
|
||||||
|
|
||||||
QString Preferences::getCreateTorTrackers() const
|
|
||||||
{
|
|
||||||
return value("CreateTorrent/TrackerList").toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Preferences::setCreateTorTrackers(const QString &path)
|
|
||||||
{
|
|
||||||
setValue("CreateTorrent/TrackerList", path);
|
|
||||||
}
|
|
||||||
|
|
||||||
QByteArray Preferences::getCreateTorGeometry() const
|
|
||||||
{
|
|
||||||
return value("CreateTorrent/dimensions").toByteArray();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Preferences::setCreateTorGeometry(const QByteArray &geometry)
|
|
||||||
{
|
|
||||||
setValue("CreateTorrent/dimensions", geometry);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Preferences::getCreateTorIgnoreRatio() const
|
|
||||||
{
|
|
||||||
return value("CreateTorrent/IgnoreRatio").toBool();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Preferences::setCreateTorIgnoreRatio(const bool ignore)
|
|
||||||
{
|
|
||||||
setValue("CreateTorrent/IgnoreRatio", ignore);
|
|
||||||
}
|
|
||||||
|
|
||||||
QString Preferences::getTorImportLastContentDir() const
|
QString Preferences::getTorImportLastContentDir() const
|
||||||
{
|
{
|
||||||
return value("TorrentImport/LastContentDir", QDir::homePath()).toString();
|
return value("TorrentImport/LastContentDir", QDir::homePath()).toString();
|
||||||
|
@ -305,16 +305,6 @@ public:
|
|||||||
void setSearchTabHeaderState(const QByteArray &state);
|
void setSearchTabHeaderState(const QByteArray &state);
|
||||||
QStringList getSearchEngDisabled() const;
|
QStringList getSearchEngDisabled() const;
|
||||||
void setSearchEngDisabled(const QStringList &engines);
|
void setSearchEngDisabled(const QStringList &engines);
|
||||||
QString getCreateTorLastAddPath() const;
|
|
||||||
void setCreateTorLastAddPath(const QString &path);
|
|
||||||
QString getCreateTorLastSavePath() const;
|
|
||||||
void setCreateTorLastSavePath(const QString &path);
|
|
||||||
QString getCreateTorTrackers() const;
|
|
||||||
void setCreateTorTrackers(const QString &path);
|
|
||||||
QByteArray getCreateTorGeometry() const;
|
|
||||||
void setCreateTorGeometry(const QByteArray &geometry);
|
|
||||||
bool getCreateTorIgnoreRatio() const;
|
|
||||||
void setCreateTorIgnoreRatio(const bool ignore);
|
|
||||||
QString getTorImportLastContentDir() const;
|
QString getTorImportLastContentDir() const;
|
||||||
void setTorImportLastContentDir(const QString &path);
|
void setTorImportLastContentDir(const QString &path);
|
||||||
QByteArray getTorImportGeometry() const;
|
QByteArray getTorImportGeometry() const;
|
||||||
|
@ -180,14 +180,13 @@ qint64 Utils::Fs::computePathSize(const QString& path)
|
|||||||
QFileInfo fi(path);
|
QFileInfo fi(path);
|
||||||
if (!fi.exists()) return -1;
|
if (!fi.exists()) return -1;
|
||||||
if (fi.isFile()) return fi.size();
|
if (fi.isFile()) return fi.size();
|
||||||
|
|
||||||
// Compute folder size based on its content
|
// Compute folder size based on its content
|
||||||
qint64 size = 0;
|
qint64 size = 0;
|
||||||
foreach (const QFileInfo &subfi, QDir(path).entryInfoList(QDir::Dirs|QDir::Files)) {
|
QDirIterator iter(path, QDir::Files | QDir::Hidden | QDir::NoSymLinks, QDirIterator::Subdirectories);
|
||||||
if (subfi.fileName().startsWith(".")) continue;
|
while (iter.hasNext()) {
|
||||||
if (subfi.isDir())
|
iter.next();
|
||||||
size += computePathSize(subfi.absoluteFilePath());
|
size += iter.fileInfo().size();
|
||||||
else
|
|
||||||
size += subfi.size();
|
|
||||||
}
|
}
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
@ -201,19 +200,14 @@ bool Utils::Fs::sameFiles(const QString& path1, const QString& path2)
|
|||||||
if (!f1.exists() || !f2.exists()) return false;
|
if (!f1.exists() || !f2.exists()) return false;
|
||||||
if (f1.size() != f2.size()) return false;
|
if (f1.size() != f2.size()) return false;
|
||||||
if (!f1.open(QIODevice::ReadOnly)) return false;
|
if (!f1.open(QIODevice::ReadOnly)) return false;
|
||||||
if (!f2.open(QIODevice::ReadOnly)) {
|
if (!f2.open(QIODevice::ReadOnly)) return false;
|
||||||
f1.close();
|
|
||||||
return false;
|
const int readSize = 1024 * 1024; // 1 MiB
|
||||||
}
|
|
||||||
bool same = true;
|
|
||||||
while(!f1.atEnd() && !f2.atEnd()) {
|
while(!f1.atEnd() && !f2.atEnd()) {
|
||||||
if (f1.read(1024) != f2.read(1024)) {
|
if (f1.read(readSize) != f2.read(readSize))
|
||||||
same = false;
|
return false;
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
f1.close(); f2.close();
|
return true;
|
||||||
return same;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Utils::Fs::toValidFileSystemName(const QString &name, bool allowSeparators, const QString &pad)
|
QString Utils::Fs::toValidFileSystemName(const QString &name, bool allowSeparators, const QString &pad)
|
||||||
|
@ -64,6 +64,7 @@
|
|||||||
#include "base/bittorrent/session.h"
|
#include "base/bittorrent/session.h"
|
||||||
#include "base/bittorrent/sessionstatus.h"
|
#include "base/bittorrent/sessionstatus.h"
|
||||||
#include "base/bittorrent/torrenthandle.h"
|
#include "base/bittorrent/torrenthandle.h"
|
||||||
|
#include "base/global.h"
|
||||||
#include "base/rss/rss_folder.h"
|
#include "base/rss/rss_folder.h"
|
||||||
#include "base/rss/rss_session.h"
|
#include "base/rss/rss_session.h"
|
||||||
|
|
||||||
@ -1069,10 +1070,17 @@ void MainWindow::closeEvent(QCloseEvent *e)
|
|||||||
// Display window to create a torrent
|
// Display window to create a torrent
|
||||||
void MainWindow::on_actionCreateTorrent_triggered()
|
void MainWindow::on_actionCreateTorrent_triggered()
|
||||||
{
|
{
|
||||||
if (m_createTorrentDlg)
|
createTorrentTriggered();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::createTorrentTriggered(const QString &path)
|
||||||
|
{
|
||||||
|
if (m_createTorrentDlg) {
|
||||||
|
m_createTorrentDlg->updateInputPath(path);
|
||||||
m_createTorrentDlg->setFocus();
|
m_createTorrentDlg->setFocus();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
m_createTorrentDlg = new TorrentCreatorDlg(this);
|
m_createTorrentDlg = new TorrentCreatorDlg(this, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MainWindow::event(QEvent *e)
|
bool MainWindow::event(QEvent *e)
|
||||||
@ -1126,6 +1134,8 @@ bool MainWindow::event(QEvent *e)
|
|||||||
void MainWindow::dropEvent(QDropEvent *event)
|
void MainWindow::dropEvent(QDropEvent *event)
|
||||||
{
|
{
|
||||||
event->acceptProposedAction();
|
event->acceptProposedAction();
|
||||||
|
|
||||||
|
// remove scheme
|
||||||
QStringList files;
|
QStringList files;
|
||||||
if (event->mimeData()->hasUrls()) {
|
if (event->mimeData()->hasUrls()) {
|
||||||
const QList<QUrl> urls = event->mimeData()->urls();
|
const QList<QUrl> urls = event->mimeData()->urls();
|
||||||
@ -1142,15 +1152,34 @@ void MainWindow::dropEvent(QDropEvent *event)
|
|||||||
files = event->mimeData()->text().split('\n');
|
files = event->mimeData()->text().split('\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add file to download list
|
// differentiate ".torrent" files and others
|
||||||
|
QStringList torrentFiles, otherFiles;
|
||||||
|
foreach (const QString &file, files) {
|
||||||
|
if (file.endsWith(C_TORRENT_FILE_EXTENSION, Qt::CaseInsensitive))
|
||||||
|
torrentFiles << file;
|
||||||
|
else
|
||||||
|
otherFiles << file;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Download torrents
|
||||||
const bool useTorrentAdditionDialog = AddNewTorrentDialog::isEnabled();
|
const bool useTorrentAdditionDialog = AddNewTorrentDialog::isEnabled();
|
||||||
foreach (QString file, files) {
|
foreach (const QString &file, torrentFiles) {
|
||||||
qDebug("Dropped file %s on download list", qPrintable(file));
|
qDebug("Dropped file %s on download list", qPrintable(file));
|
||||||
if (useTorrentAdditionDialog)
|
if (useTorrentAdditionDialog)
|
||||||
AddNewTorrentDialog::show(file, this);
|
AddNewTorrentDialog::show(file, this);
|
||||||
else
|
else
|
||||||
BitTorrent::Session::instance()->addTorrent(file);
|
BitTorrent::Session::instance()->addTorrent(file);
|
||||||
}
|
}
|
||||||
|
if (!torrentFiles.isEmpty()) return;
|
||||||
|
|
||||||
|
// Create torrent
|
||||||
|
foreach (const QString &file, otherFiles) {
|
||||||
|
createTorrentTriggered(file);
|
||||||
|
|
||||||
|
// currently only hande the first entry
|
||||||
|
// this is a stub that can be expanded later to create many torrents at once
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Decode if we accept drag 'n drop or not
|
// Decode if we accept drag 'n drop or not
|
||||||
@ -1177,7 +1206,7 @@ void MainWindow::on_actionOpen_triggered()
|
|||||||
// Note: it is possible to select more than one file
|
// Note: it is possible to select more than one file
|
||||||
const QStringList pathsList =
|
const QStringList pathsList =
|
||||||
QFileDialog::getOpenFileNames(this, tr("Open Torrent Files"), pref->getMainLastDir(),
|
QFileDialog::getOpenFileNames(this, tr("Open Torrent Files"), pref->getMainLastDir(),
|
||||||
tr("Torrent Files") + " (*.torrent)");
|
tr("Torrent Files") + " (*" + C_TORRENT_FILE_EXTENSION + ')');
|
||||||
|
|
||||||
const bool useTorrentAdditionDialog = AddNewTorrentDialog::isEnabled();
|
const bool useTorrentAdditionDialog = AddNewTorrentDialog::isEnabled();
|
||||||
if (!pathsList.isEmpty()) {
|
if (!pathsList.isEmpty()) {
|
||||||
|
@ -202,6 +202,7 @@ private:
|
|||||||
bool event(QEvent *e) override;
|
bool event(QEvent *e) override;
|
||||||
void displayRSSTab(bool enable);
|
void displayRSSTab(bool enable);
|
||||||
void displaySearchTab(bool enable);
|
void displaySearchTab(bool enable);
|
||||||
|
void createTorrentTriggered(const QString &path = QString());
|
||||||
|
|
||||||
Ui::MainWindow *m_ui;
|
Ui::MainWindow *m_ui;
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Bittorrent Client using Qt4 and libtorrent.
|
* Bittorrent Client using Qt and libtorrent.
|
||||||
* Copyright (C) 2010 Christophe Dumez
|
* Copyright (C) 2017 Mike Tzou (Chocobo1)
|
||||||
|
* Copyright (C) 2010 Christophe Dumez <chris@qbittorrent.org>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
@ -24,258 +25,233 @@
|
|||||||
* modify file(s), you may extend this exception to your version of the file(s),
|
* modify file(s), you may extend this exception to your version of the file(s),
|
||||||
* but you are not obligated to do so. If you do not wish to do so, delete this
|
* but you are not obligated to do so. If you do not wish to do so, delete this
|
||||||
* exception statement from your version.
|
* exception statement from your version.
|
||||||
*
|
|
||||||
* Contact : chris@qbittorrent.org
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "torrentcreatordlg.h"
|
||||||
|
|
||||||
|
#include <QCloseEvent>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
#include <QMimeData>
|
||||||
|
#include <QUrl>
|
||||||
|
|
||||||
#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/session.h"
|
||||||
#include "base/bittorrent/torrentinfo.h"
|
|
||||||
#include "base/bittorrent/torrentcreatorthread.h"
|
#include "base/bittorrent/torrentcreatorthread.h"
|
||||||
|
#include "base/bittorrent/torrentinfo.h"
|
||||||
|
#include "base/global.h"
|
||||||
|
#include "base/utils/fs.h"
|
||||||
|
|
||||||
const uint NB_PIECES_MIN = 1200;
|
#include "ui_torrentcreatordlg.h"
|
||||||
const uint NB_PIECES_MAX = 2200;
|
|
||||||
|
|
||||||
TorrentCreatorDlg::TorrentCreatorDlg(QWidget *parent)
|
#define SETTINGS_KEY(name) "TorrentCreator/" name
|
||||||
|
|
||||||
|
TorrentCreatorDlg::TorrentCreatorDlg(QWidget *parent, const QString &defaultPath)
|
||||||
: QDialog(parent)
|
: QDialog(parent)
|
||||||
, m_creatorThread(0)
|
, m_ui(new Ui::TorrentCreatorDlg)
|
||||||
|
, m_creatorThread(new BitTorrent::TorrentCreatorThread(this))
|
||||||
|
, m_storeDialogSize(SETTINGS_KEY("Dimension"))
|
||||||
|
, m_storePieceSize(SETTINGS_KEY("PieceSize"))
|
||||||
|
, m_storePrivateTorrent(SETTINGS_KEY("PrivateTorrent"))
|
||||||
|
, m_storeStartSeeding(SETTINGS_KEY("StartSeeding"))
|
||||||
|
, m_storeIgnoreRatio(SETTINGS_KEY("IgnoreRatio"))
|
||||||
|
, m_storeLastAddPath(SETTINGS_KEY("LastAddPath"), QDir::homePath())
|
||||||
|
, m_storeTrackerList(SETTINGS_KEY("TrackerList"))
|
||||||
|
, m_storeWebSeedList(SETTINGS_KEY("WebSeedList"))
|
||||||
|
, m_storeComments(SETTINGS_KEY("Comments"))
|
||||||
|
, m_storeLastSavePath(SETTINGS_KEY("LastSavePath"), QDir::homePath())
|
||||||
{
|
{
|
||||||
setupUi(this);
|
m_ui->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"));
|
|
||||||
|
|
||||||
setAttribute(Qt::WA_DeleteOnClose);
|
setAttribute(Qt::WA_DeleteOnClose);
|
||||||
setModal(true);
|
setModal(false);
|
||||||
showProgressBar(false);
|
|
||||||
loadTrackerList();
|
m_ui->buttonBox->button(QDialogButtonBox::Ok)->setText(tr("Create Torrent"));
|
||||||
// Piece sizes
|
|
||||||
m_pieceSizes << 16 << 32 << 64 << 128 << 256 << 512 << 1024 << 2048 << 4096 << 8192 << 16384;
|
connect(m_ui->addFileButton, SIGNAL(clicked(bool)), SLOT(onAddFileButtonClicked()));
|
||||||
|
connect(m_ui->addFolderButton, SIGNAL(clicked(bool)), SLOT(onAddFolderButtonClicked()));
|
||||||
|
connect(m_ui->buttonBox, SIGNAL(accepted()), SLOT(onCreateButtonClicked()));
|
||||||
|
|
||||||
|
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)));
|
||||||
|
|
||||||
loadSettings();
|
loadSettings();
|
||||||
|
updateInputPath(defaultPath);
|
||||||
|
|
||||||
show();
|
show();
|
||||||
}
|
}
|
||||||
|
|
||||||
TorrentCreatorDlg::~TorrentCreatorDlg()
|
TorrentCreatorDlg::~TorrentCreatorDlg()
|
||||||
{
|
{
|
||||||
|
saveSettings();
|
||||||
|
|
||||||
if (m_creatorThread)
|
if (m_creatorThread)
|
||||||
delete m_creatorThread;
|
delete m_creatorThread;
|
||||||
|
|
||||||
|
delete m_ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TorrentCreatorDlg::on_addFolder_button_clicked()
|
void TorrentCreatorDlg::updateInputPath(const QString &path)
|
||||||
{
|
{
|
||||||
Preferences* const pref = Preferences::instance();
|
if (path.isEmpty()) return;
|
||||||
QString lastPath = pref->getCreateTorLastAddPath();
|
m_ui->textInputPath->setText(Utils::Fs::toNativePath(path));
|
||||||
QString dir = QFileDialog::getExistingDirectory(this, tr("Select a folder to add to the torrent"), lastPath, QFileDialog::ShowDirsOnly);
|
updateProgressBar(0);
|
||||||
if (!dir.isEmpty()) {
|
|
||||||
pref->setCreateTorLastAddPath(dir);
|
|
||||||
textInputPath->setText(Utils::Fs::toNativePath(dir));
|
|
||||||
// Update piece size
|
|
||||||
if (checkAutoPieceSize->isChecked())
|
|
||||||
updateOptimalPieceSize();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TorrentCreatorDlg::on_addFile_button_clicked()
|
void TorrentCreatorDlg::onAddFolderButtonClicked()
|
||||||
{
|
{
|
||||||
Preferences* const pref = Preferences::instance();
|
QString oldPath = m_ui->textInputPath->text();
|
||||||
QString lastPath = pref->getCreateTorLastAddPath();
|
QString path = QFileDialog::getExistingDirectory(this, tr("Select folder"), oldPath);
|
||||||
QString file = QFileDialog::getOpenFileName(this, tr("Select a file to add to the torrent"), lastPath);
|
updateInputPath(path);
|
||||||
if (!file.isEmpty()) {
|
}
|
||||||
pref->setCreateTorLastAddPath(Utils::Fs::branchPath(file));
|
|
||||||
textInputPath->setText(Utils::Fs::toNativePath(file));
|
void TorrentCreatorDlg::onAddFileButtonClicked()
|
||||||
// Update piece size
|
{
|
||||||
if (checkAutoPieceSize->isChecked())
|
QString oldPath = m_ui->textInputPath->text();
|
||||||
updateOptimalPieceSize();
|
QString path = QFileDialog::getOpenFileName(this, tr("Select file"), oldPath);
|
||||||
}
|
updateInputPath(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
int TorrentCreatorDlg::getPieceSize() const
|
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();
|
||||||
|
updateInputPath(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
|
// Main function that create a .torrent file
|
||||||
void TorrentCreatorDlg::on_createButton_clicked()
|
void TorrentCreatorDlg::onCreateButtonClicked()
|
||||||
{
|
{
|
||||||
QString input = Utils::Fs::fromNativePath(textInputPath->text()).trimmed();
|
QString input = Utils::Fs::fromNativePath(m_ui->textInputPath->text()).trimmed();
|
||||||
if (input.endsWith("/"))
|
|
||||||
input.chop(1);
|
// test if readable
|
||||||
if (input.isEmpty()) {
|
QFileInfo fi(input);
|
||||||
QMessageBox::critical(0, tr("No input path set"), tr("Please type an input path first"));
|
if (!fi.isReadable()) {
|
||||||
|
QMessageBox::critical(this, tr("Torrent creator failed"), tr("Reason: Path to file/folder is not readable."));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QStringList trackers = trackers_list->toPlainText().split("\n");
|
input = fi.canonicalFilePath();
|
||||||
if (!trackers_list->toPlainText().trimmed().isEmpty())
|
|
||||||
saveTrackerList();
|
|
||||||
|
|
||||||
Preferences* const pref = Preferences::instance();
|
// get save path
|
||||||
QString lastPath = pref->getCreateTorLastSavePath();
|
QString lastPath = m_storeLastSavePath;
|
||||||
|
QString destination = QFileDialog::getSaveFileName(this, tr("Select where to save the new torrent"), lastPath, tr("Torrent Files (*.torrent)"));
|
||||||
QString destination = QFileDialog::getSaveFileName(this, tr("Select destination torrent file"), lastPath, tr("Torrent Files (*.torrent)"));
|
|
||||||
if (destination.isEmpty())
|
if (destination.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
if (!destination.endsWith(C_TORRENT_FILE_EXTENSION, Qt::CaseInsensitive))
|
||||||
|
destination += C_TORRENT_FILE_EXTENSION;
|
||||||
|
m_storeLastSavePath = Utils::Fs::branchPath(destination);
|
||||||
|
|
||||||
pref->setCreateTorLastSavePath(Utils::Fs::branchPath(destination));
|
// Disable dialog & set busy cursor
|
||||||
if (!destination.toUpper().endsWith(".TORRENT"))
|
|
||||||
destination += QString::fromUtf8(".torrent");
|
|
||||||
|
|
||||||
// Disable dialog
|
|
||||||
setInteractionEnabled(false);
|
setInteractionEnabled(false);
|
||||||
showProgressBar(true);
|
|
||||||
// Set busy cursor
|
|
||||||
setCursor(QCursor(Qt::WaitCursor));
|
setCursor(QCursor(Qt::WaitCursor));
|
||||||
// Actually create the torrent
|
|
||||||
QStringList urlSeeds = URLSeeds_list->toPlainText().split("\n");
|
QStringList trackers = m_ui->trackersList->toPlainText().split("\n");
|
||||||
QString comment = txt_comment->toPlainText();
|
QStringList urlSeeds = m_ui->URLSeedsList->toPlainText().split("\n");
|
||||||
// Create the creator thread
|
QString comment = m_ui->txtComment->toPlainText();
|
||||||
m_creatorThread = new BitTorrent::TorrentCreatorThread(this);
|
|
||||||
connect(m_creatorThread, SIGNAL(creationSuccess(QString, QString)), this, SLOT(handleCreationSuccess(QString, QString)));
|
// run the creator thread
|
||||||
connect(m_creatorThread, SIGNAL(creationFailure(QString)), this, SLOT(handleCreationFailure(QString)));
|
m_creatorThread->create(input, destination, trackers, urlSeeds, comment, m_ui->checkPrivate->isChecked(), getPieceSize());
|
||||||
connect(m_creatorThread, SIGNAL(updateProgress(int)), this, SLOT(updateProgressBar(int)));
|
|
||||||
m_creatorThread->create(input, destination, trackers, urlSeeds, comment, check_private->isChecked(), getPieceSize());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TorrentCreatorDlg::handleCreationFailure(QString msg)
|
void TorrentCreatorDlg::handleCreationFailure(const QString &msg)
|
||||||
{
|
{
|
||||||
// Remove busy cursor
|
// Remove busy cursor
|
||||||
setCursor(QCursor(Qt::ArrowCursor));
|
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);
|
setInteractionEnabled(true);
|
||||||
showProgressBar(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TorrentCreatorDlg::handleCreationSuccess(QString path, QString branch_path)
|
void TorrentCreatorDlg::handleCreationSuccess(const QString &path, const QString &branchPath)
|
||||||
{
|
{
|
||||||
// Remove busy cursor
|
// Remove busy cursor
|
||||||
setCursor(QCursor(Qt::ArrowCursor));
|
setCursor(QCursor(Qt::ArrowCursor));
|
||||||
if (checkStartSeeding->isChecked()) {
|
if (m_ui->checkStartSeeding->isChecked()) {
|
||||||
// Create save path temp data
|
// Create save path temp data
|
||||||
BitTorrent::TorrentInfo t = BitTorrent::TorrentInfo::loadFromFile(Utils::Fs::toNativePath(path));
|
BitTorrent::TorrentInfo t = BitTorrent::TorrentInfo::loadFromFile(Utils::Fs::toNativePath(path));
|
||||||
if (!t.isValid()) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
BitTorrent::AddTorrentParams params;
|
BitTorrent::AddTorrentParams params;
|
||||||
params.savePath = branch_path;
|
params.savePath = branchPath;
|
||||||
params.skipChecking = true;
|
params.skipChecking = true;
|
||||||
params.ignoreShareLimits = checkIgnoreShareLimits->isChecked();
|
params.ignoreShareLimits = m_ui->checkIgnoreShareLimits->isChecked();
|
||||||
|
|
||||||
BitTorrent::Session::instance()->addTorrent(t, params);
|
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)));
|
QMessageBox::information(this, tr("Torrent creator"), QString("%1\n%2").arg(tr("Create torrent success:")).arg(Utils::Fs::toNativePath(path)));
|
||||||
close();
|
setInteractionEnabled(true);
|
||||||
}
|
|
||||||
|
|
||||||
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)
|
void TorrentCreatorDlg::updateProgressBar(int progress)
|
||||||
{
|
{
|
||||||
progressBar->setValue(progress);
|
m_ui->progressBar->setValue(progress);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TorrentCreatorDlg::setInteractionEnabled(bool enabled)
|
void TorrentCreatorDlg::setInteractionEnabled(bool enabled)
|
||||||
{
|
{
|
||||||
textInputPath->setEnabled(enabled);
|
m_ui->textInputPath->setEnabled(enabled);
|
||||||
addFile_button->setEnabled(enabled);
|
m_ui->addFileButton->setEnabled(enabled);
|
||||||
addFolder_button->setEnabled(enabled);
|
m_ui->addFolderButton->setEnabled(enabled);
|
||||||
trackers_list->setEnabled(enabled);
|
m_ui->trackersList->setEnabled(enabled);
|
||||||
URLSeeds_list->setEnabled(enabled);
|
m_ui->URLSeedsList->setEnabled(enabled);
|
||||||
txt_comment->setEnabled(enabled);
|
m_ui->txtComment->setEnabled(enabled);
|
||||||
comboPieceSize->setEnabled(enabled);
|
m_ui->comboPieceSize->setEnabled(enabled);
|
||||||
checkAutoPieceSize->setEnabled(enabled);
|
m_ui->checkPrivate->setEnabled(enabled);
|
||||||
check_private->setEnabled(enabled);
|
m_ui->checkStartSeeding->setEnabled(enabled);
|
||||||
checkStartSeeding->setEnabled(enabled);
|
m_ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(enabled);
|
||||||
createButton->setEnabled(enabled);
|
m_ui->checkIgnoreShareLimits->setEnabled(enabled && m_ui->checkStartSeeding->isChecked());
|
||||||
checkIgnoreShareLimits->setEnabled(enabled && 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());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TorrentCreatorDlg::saveSettings()
|
void TorrentCreatorDlg::saveSettings()
|
||||||
{
|
{
|
||||||
Preferences* const pref = Preferences::instance();
|
m_storeLastAddPath = m_ui->textInputPath->text().trimmed();
|
||||||
pref->setCreateTorGeometry(saveGeometry());
|
|
||||||
pref->setCreateTorIgnoreRatio(checkIgnoreShareLimits->isChecked());
|
m_storePieceSize = m_ui->comboPieceSize->currentIndex();
|
||||||
|
m_storePrivateTorrent = m_ui->checkPrivate->isChecked();
|
||||||
|
m_storeStartSeeding = m_ui->checkStartSeeding->isChecked();
|
||||||
|
m_storeIgnoreRatio = m_ui->checkIgnoreShareLimits->isChecked();
|
||||||
|
|
||||||
|
m_storeTrackerList = m_ui->trackersList->toPlainText();
|
||||||
|
m_storeWebSeedList = m_ui->URLSeedsList->toPlainText();
|
||||||
|
m_storeComments = m_ui->txtComment->toPlainText();
|
||||||
|
|
||||||
|
m_storeDialogSize = size();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TorrentCreatorDlg::loadSettings()
|
void TorrentCreatorDlg::loadSettings()
|
||||||
{
|
{
|
||||||
const Preferences* const pref = Preferences::instance();
|
m_ui->textInputPath->setText(m_storeLastAddPath);
|
||||||
restoreGeometry(pref->getCreateTorGeometry());
|
|
||||||
checkIgnoreShareLimits->setChecked(pref->getCreateTorIgnoreRatio());
|
|
||||||
}
|
|
||||||
|
|
||||||
void TorrentCreatorDlg::closeEvent(QCloseEvent *event)
|
m_ui->comboPieceSize->setCurrentIndex(m_storePieceSize);
|
||||||
{
|
m_ui->checkPrivate->setChecked(m_storePrivateTorrent);
|
||||||
qDebug() << Q_FUNC_INFO;
|
m_ui->checkStartSeeding->setChecked(m_storeStartSeeding);
|
||||||
saveSettings();
|
m_ui->checkIgnoreShareLimits->setChecked(m_storeIgnoreRatio);
|
||||||
QDialog::closeEvent(event);
|
m_ui->checkIgnoreShareLimits->setEnabled(m_ui->checkStartSeeding->isChecked());
|
||||||
|
|
||||||
|
m_ui->trackersList->setPlainText(m_storeTrackerList);
|
||||||
|
m_ui->URLSeedsList->setPlainText(m_storeWebSeedList);
|
||||||
|
m_ui->txtComment->setPlainText(m_storeComments);
|
||||||
|
|
||||||
|
if (m_storeDialogSize.value().isValid())
|
||||||
|
resize(m_storeDialogSize);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Bittorrent Client using Qt4 and libtorrent.
|
* Bittorrent Client using Qt and libtorrent.
|
||||||
* Copyright (C) 2010 Christophe Dumez
|
* Copyright (C) 2017 Mike Tzou (Chocobo1)
|
||||||
|
* Copyright (C) 2010 Christophe Dumez <chris@qbittorrent.org>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
@ -24,56 +25,65 @@
|
|||||||
* modify file(s), you may extend this exception to your version of the file(s),
|
* modify file(s), you may extend this exception to your version of the file(s),
|
||||||
* but you are not obligated to do so. If you do not wish to do so, delete this
|
* but you are not obligated to do so. If you do not wish to do so, delete this
|
||||||
* exception statement from your version.
|
* exception statement from your version.
|
||||||
*
|
|
||||||
* Contact : chris@qbittorrent.org
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef CREATE_TORRENT_IMP_H
|
#ifndef TORRENTCREATORDLG_H
|
||||||
#define CREATE_TORRENT_IMP_H
|
#define TORRENTCREATORDLG_H
|
||||||
|
|
||||||
#include "ui_torrentcreatordlg.h"
|
#include <QDialog>
|
||||||
|
|
||||||
|
#include "base/settingvalue.h"
|
||||||
|
|
||||||
|
namespace Ui
|
||||||
|
{
|
||||||
|
class TorrentCreatorDlg;
|
||||||
|
}
|
||||||
|
|
||||||
namespace BitTorrent
|
namespace BitTorrent
|
||||||
{
|
{
|
||||||
class TorrentCreatorThread;
|
class TorrentCreatorThread;
|
||||||
}
|
}
|
||||||
|
|
||||||
class TorrentCreatorDlg : public QDialog, private Ui::createTorrentDialog
|
class TorrentCreatorDlg: public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TorrentCreatorDlg(QWidget *parent = 0);
|
TorrentCreatorDlg(QWidget *parent = 0, const QString &defaultPath = QString());
|
||||||
~TorrentCreatorDlg();
|
~TorrentCreatorDlg();
|
||||||
int getPieceSize() const;
|
void updateInputPath(const QString &path);
|
||||||
|
|
||||||
public slots:
|
private slots:
|
||||||
void updateProgressBar(int progress);
|
void updateProgressBar(int progress);
|
||||||
void on_cancelButton_clicked();
|
void onCreateButtonClicked();
|
||||||
|
void onAddFileButtonClicked();
|
||||||
protected slots:
|
void onAddFolderButtonClicked();
|
||||||
void on_createButton_clicked();
|
void handleCreationFailure(const QString &msg);
|
||||||
void on_addFile_button_clicked();
|
void handleCreationSuccess(const QString &path, const QString &branchPath);
|
||||||
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);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void dropEvent(QDropEvent *event) override;
|
||||||
|
void dragEnterEvent(QDragEnterEvent *event) override;
|
||||||
|
|
||||||
void saveSettings();
|
void saveSettings();
|
||||||
void loadSettings();
|
void loadSettings();
|
||||||
|
int getPieceSize() const;
|
||||||
|
void setInteractionEnabled(bool enabled);
|
||||||
|
|
||||||
private:
|
Ui::TorrentCreatorDlg *m_ui;
|
||||||
BitTorrent::TorrentCreatorThread *m_creatorThread;
|
BitTorrent::TorrentCreatorThread *m_creatorThread;
|
||||||
QList<int> m_pieceSizes;
|
|
||||||
|
// settings
|
||||||
|
CachedSettingValue<QSize> m_storeDialogSize;
|
||||||
|
CachedSettingValue<int> m_storePieceSize;
|
||||||
|
CachedSettingValue<bool> m_storePrivateTorrent;
|
||||||
|
CachedSettingValue<bool> m_storeStartSeeding;
|
||||||
|
CachedSettingValue<bool> m_storeIgnoreRatio;
|
||||||
|
CachedSettingValue<QString> m_storeLastAddPath;
|
||||||
|
CachedSettingValue<QString> m_storeTrackerList;
|
||||||
|
CachedSettingValue<QString> m_storeWebSeedList;
|
||||||
|
CachedSettingValue<QString> m_storeComments;
|
||||||
|
CachedSettingValue<QString> m_storeLastSavePath;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>createTorrentDialog</class>
|
<class>TorrentCreatorDlg</class>
|
||||||
<widget class="QDialog" name="createTorrentDialog">
|
<widget class="QDialog" name="TorrentCreatorDlg">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
@ -10,322 +10,300 @@
|
|||||||
<height>658</height>
|
<height>658</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="acceptDrops">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Torrent Creation Tool</string>
|
<string>Torrent Creator</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="createTorrent_title">
|
<widget class="QGroupBox" name="groupBox">
|
||||||
<property name="minimumSize">
|
<property name="title">
|
||||||
<size>
|
<string>Select file/folder to share</string>
|
||||||
<width>0</width>
|
|
||||||
<height>27</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>16777215</width>
|
|
||||||
<height>27</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<weight>75</weight>
|
|
||||||
<bold>true</bold>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Torrent file creation</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignCenter</set>
|
|
||||||
</property>
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Path:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="textInputPath">
|
||||||
|
<property name="acceptDrops">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>[Drag and drop area]</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="addFileButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>Select file</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="addFolderButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>Select folder</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="lbl_input">
|
<widget class="QGroupBox" name="groupBox_2">
|
||||||
<property name="text">
|
<property name="title">
|
||||||
<string>File or folder to add to the torrent:</string>
|
<string>Settings</string>
|
||||||
</property>
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="pieceSizeLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="txtPieceSize">
|
||||||
|
<property name="text">
|
||||||
|
<string>Piece size:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="comboPieceSize">
|
||||||
|
<property name="currentIndex">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="minimumContentsLength">
|
||||||
|
<number>7</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Auto</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>16 KiB</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>32 KiB</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>64 KiB</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>128 KiB</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>256 KiB</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>512 KiB</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>1 MiB</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>2 MiB</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>4 MiB</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>8 MiB</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>16 MiB</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="spacer1">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="checkPrivate">
|
||||||
|
<property name="text">
|
||||||
|
<string>Private torrent (Won't distribute on DHT network)</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="checkStartSeeding">
|
||||||
|
<property name="text">
|
||||||
|
<string>Start seeding immediately</string>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="checkIgnoreShareLimits">
|
||||||
|
<property name="text">
|
||||||
|
<string>Ignore share ratio limits for this torrent</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLineEdit" name="textInputPath"/>
|
<widget class="QGroupBox" name="groupBox_3">
|
||||||
|
<property name="title">
|
||||||
|
<string>Fields</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QTextEdit" name="trackersList">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string comment="A tracker tier is a group of trackers, consisting of a main tracker and its mirrors.">You can separate tracker tiers / groups with an empty line.</string>
|
||||||
|
</property>
|
||||||
|
<property name="acceptRichText">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="urlSeeds_lbl">
|
||||||
|
<property name="text">
|
||||||
|
<string>Web seed URLs:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QTextEdit" name="URLSeedsList">
|
||||||
|
<property name="acceptRichText">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="QTextEdit" name="txtComment">
|
||||||
|
<property name="acceptRichText">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="lbl_announce_url">
|
||||||
|
<property name="text">
|
||||||
|
<string>Tracker URLs:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QLabel" name="lbl_comment">
|
||||||
|
<property name="text">
|
||||||
|
<string>Comments:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="addFile_button">
|
<widget class="QLabel" name="progressLbl">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Add file</string>
|
<string>Progress:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="addFolder_button">
|
<widget class="QProgressBar" name="progressBar">
|
||||||
<property name="text">
|
<property name="value">
|
||||||
<string>Add folder</string>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
<item row="0" column="0">
|
<property name="standardButtons">
|
||||||
<widget class="QLabel" name="lbl_announce_url">
|
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||||
<property name="text">
|
|
||||||
<string>Tracker URLs:</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QLabel" name="urlSeeds_lbl">
|
|
||||||
<property name="text">
|
|
||||||
<string>Web seeds urls:</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="0">
|
|
||||||
<widget class="QLabel" name="lbl_comment">
|
|
||||||
<property name="text">
|
|
||||||
<string>Comment:</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="1">
|
|
||||||
<widget class="QTextEdit" name="txt_comment">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="acceptRichText">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
|
||||||
<widget class="QTextEdit" name="trackers_list">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
|
||||||
<string comment="A tracker tier is a group of trackers, consisting of a main tracker and its mirrors.">You can separate tracker tiers / groups with an empty line.</string>
|
|
||||||
</property>
|
|
||||||
<property name="acceptRichText">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1">
|
|
||||||
<widget class="QTextEdit" name="URLSeeds_list">
|
|
||||||
<property name="acceptRichText">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="txtPieceSize">
|
|
||||||
<property name="text">
|
|
||||||
<string>Piece size:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QComboBox" name="comboPieceSize">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="editable">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="currentIndex">
|
|
||||||
<number>4</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>16 KiB</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>32 KiB</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>64 KiB</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>128 KiB</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>256 KiB</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>512 KiB</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>1 MiB</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>2 MiB</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>4 MiB</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>8 MiB</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>16 MiB</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="checkAutoPieceSize">
|
|
||||||
<property name="text">
|
|
||||||
<string>Auto</string>
|
|
||||||
</property>
|
|
||||||
<property name="checked">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer>
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="check_private">
|
|
||||||
<property name="text">
|
|
||||||
<string>Private (won't be distributed on DHT network if enabled)</string>
|
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
<property name="centerButtons">
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="checkStartSeeding">
|
|
||||||
<property name="text">
|
|
||||||
<string>Start seeding after creation</string>
|
|
||||||
</property>
|
|
||||||
<property name="checked">
|
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="checkIgnoreShareLimits">
|
|
||||||
<property name="text">
|
|
||||||
<string>Ignore share ratio limits for this torrent</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="progressLbl">
|
|
||||||
<property name="text">
|
|
||||||
<string>Progress:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QProgressBar" name="progressBar">
|
|
||||||
<property name="value">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout">
|
|
||||||
<item>
|
|
||||||
<spacer>
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>131</width>
|
|
||||||
<height>31</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="createButton">
|
|
||||||
<property name="text">
|
|
||||||
<string>Create and save...</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="cancelButton">
|
|
||||||
<property name="text">
|
|
||||||
<string>Cancel</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer>
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
<tabstops>
|
||||||
|
<tabstop>textInputPath</tabstop>
|
||||||
|
<tabstop>addFileButton</tabstop>
|
||||||
|
<tabstop>addFolderButton</tabstop>
|
||||||
|
<tabstop>comboPieceSize</tabstop>
|
||||||
|
<tabstop>checkPrivate</tabstop>
|
||||||
|
<tabstop>checkStartSeeding</tabstop>
|
||||||
|
<tabstop>checkIgnoreShareLimits</tabstop>
|
||||||
|
<tabstop>trackersList</tabstop>
|
||||||
|
<tabstop>URLSeedsList</tabstop>
|
||||||
|
<tabstop>txtComment</tabstop>
|
||||||
|
</tabstops>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections>
|
<connections>
|
||||||
<connection>
|
<connection>
|
||||||
@ -344,5 +322,21 @@
|
|||||||
</hint>
|
</hint>
|
||||||
</hints>
|
</hints>
|
||||||
</connection>
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonBox</sender>
|
||||||
|
<signal>rejected()</signal>
|
||||||
|
<receiver>TorrentCreatorDlg</receiver>
|
||||||
|
<slot>reject()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>295</x>
|
||||||
|
<y>635</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>295</x>
|
||||||
|
<y>328</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
</connections>
|
</connections>
|
||||||
</ui>
|
</ui>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user