mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-19 21:03:30 -07:00
- Skip file checking in "start seeding immediately after torrent creation" feature (libtorrent v0.15 only)
This commit is contained in:
parent
d9817795ed
commit
fe91599eb4
1 changed files with 42 additions and 38 deletions
|
@ -57,9 +57,9 @@ using namespace boost::filesystem;
|
||||||
// name starts with a .
|
// name starts with a .
|
||||||
bool file_filter(boost::filesystem::path const& filename)
|
bool file_filter(boost::filesystem::path const& filename)
|
||||||
{
|
{
|
||||||
if (filename.leaf()[0] == '.') return false;
|
if (filename.leaf()[0] == '.') return false;
|
||||||
std::cerr << filename << std::endl;
|
std::cerr << filename << std::endl;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
createtorrent::createtorrent(QWidget *parent): QDialog(parent){
|
createtorrent::createtorrent(QWidget *parent): QDialog(parent){
|
||||||
|
@ -99,30 +99,30 @@ void createtorrent::on_removeTracker_button_clicked() {
|
||||||
|
|
||||||
int createtorrent::getPieceSize() const {
|
int createtorrent::getPieceSize() const {
|
||||||
switch(comboPieceSize->currentIndex()) {
|
switch(comboPieceSize->currentIndex()) {
|
||||||
case 0:
|
case 0:
|
||||||
return 32*1024;
|
return 32*1024;
|
||||||
case 1:
|
case 1:
|
||||||
return 64*1024;
|
return 64*1024;
|
||||||
case 2:
|
case 2:
|
||||||
return 128*1024;
|
return 128*1024;
|
||||||
case 3:
|
case 3:
|
||||||
return 256*1024;
|
return 256*1024;
|
||||||
case 4:
|
case 4:
|
||||||
return 512*1024;
|
return 512*1024;
|
||||||
case 5:
|
case 5:
|
||||||
return 1024*1024;
|
return 1024*1024;
|
||||||
case 6:
|
case 6:
|
||||||
return 2048*1024;
|
return 2048*1024;
|
||||||
default:
|
default:
|
||||||
return 256*1024;
|
return 256*1024;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void createtorrent::on_addTracker_button_clicked() {
|
void createtorrent::on_addTracker_button_clicked() {
|
||||||
bool ok;
|
bool ok;
|
||||||
QString URL = QInputDialog::getText(this, tr("Please type an announce URL"),
|
QString URL = QInputDialog::getText(this, tr("Please type an announce URL"),
|
||||||
tr("Announce URL:", "Tracker URL"), QLineEdit::Normal,
|
tr("Announce URL:", "Tracker URL"), QLineEdit::Normal,
|
||||||
"http://", &ok);
|
"http://", &ok);
|
||||||
if(ok){
|
if(ok){
|
||||||
if(trackers_list->findItems(URL, Qt::MatchFixedString).size() == 0)
|
if(trackers_list->findItems(URL, Qt::MatchFixedString).size() == 0)
|
||||||
trackers_list->addItem(URL);
|
trackers_list->addItem(URL);
|
||||||
|
@ -140,8 +140,8 @@ void createtorrent::on_removeURLSeed_button_clicked(){
|
||||||
void createtorrent::on_addURLSeed_button_clicked(){
|
void createtorrent::on_addURLSeed_button_clicked(){
|
||||||
bool ok;
|
bool ok;
|
||||||
QString URL = QInputDialog::getText(this, tr("Please type a web seed url"),
|
QString URL = QInputDialog::getText(this, tr("Please type a web seed url"),
|
||||||
tr("Web seed URL:"), QLineEdit::Normal,
|
tr("Web seed URL:"), QLineEdit::Normal,
|
||||||
"http://", &ok);
|
"http://", &ok);
|
||||||
if(ok){
|
if(ok){
|
||||||
if(URLSeeds_list->findItems(URL, Qt::MatchFixedString).size() == 0)
|
if(URLSeeds_list->findItems(URL, Qt::MatchFixedString).size() == 0)
|
||||||
URLSeeds_list->addItem(URL);
|
URLSeeds_list->addItem(URL);
|
||||||
|
@ -188,21 +188,25 @@ void createtorrent::handleCreationFailure(QString msg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void createtorrent::handleCreationSuccess(QString path, const char* branch_path) {
|
void createtorrent::handleCreationSuccess(QString path, const char* branch_path) {
|
||||||
if(checkStartSeeding->isChecked()) {
|
if(checkStartSeeding->isChecked()) {
|
||||||
// Create save path temp data
|
// Create save path temp data
|
||||||
boost::intrusive_ptr<torrent_info> t;
|
boost::intrusive_ptr<torrent_info> t;
|
||||||
try {
|
try {
|
||||||
t = new torrent_info(path.toLocal8Bit().data());
|
t = new torrent_info(path.toLocal8Bit().data());
|
||||||
} catch(std::exception&) {
|
} catch(std::exception&) {
|
||||||
QMessageBox::critical(0, tr("Torrent creation"), tr("Created torrent file is invalid. It won't be added to download list."));
|
QMessageBox::critical(0, tr("Torrent creation"), tr("Created torrent file is invalid. It won't be added to download list."));
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
QString hash = misc::toQString(t->info_hash());
|
|
||||||
TorrentTempData::setSavePath(hash, QString(branch_path));
|
|
||||||
emit torrent_to_seed(path);
|
|
||||||
}
|
}
|
||||||
QMessageBox::information(0, tr("Torrent creation"), tr("Torrent was created successfully:")+" "+path);
|
QString hash = misc::toQString(t->info_hash());
|
||||||
close();
|
TorrentTempData::setSavePath(hash, QString(branch_path));
|
||||||
|
#ifdef LIBTORRENT_0_15
|
||||||
|
// Enable seeding mode (do not recheck the files)
|
||||||
|
TorrentTempData::setSeedingMode(hash, true);
|
||||||
|
#endif
|
||||||
|
emit torrent_to_seed(path);
|
||||||
|
}
|
||||||
|
QMessageBox::information(0, tr("Torrent creation"), tr("Torrent was created successfully:")+" "+path);
|
||||||
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void createtorrent::updateProgressBar(int progress) {
|
void createtorrent::updateProgressBar(int progress) {
|
||||||
|
@ -226,7 +230,7 @@ void torrentCreatorThread::create(QString _input_path, QString _save_path, QStri
|
||||||
}
|
}
|
||||||
|
|
||||||
void sendProgressUpdateSignal(int i, int num, torrentCreatorThread *parent){
|
void sendProgressUpdateSignal(int i, int num, torrentCreatorThread *parent){
|
||||||
parent->sendProgressSignal((int)(i*100./(float)num));
|
parent->sendProgressSignal((int)(i*100./(float)num));
|
||||||
}
|
}
|
||||||
|
|
||||||
void torrentCreatorThread::sendProgressSignal(int progress) {
|
void torrentCreatorThread::sendProgressSignal(int progress) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue