mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-23 08:48:07 -06:00
Compare commits
18 Commits
release-1.
...
release-1.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
603b14dd4c | ||
|
|
faa33b0d7e | ||
|
|
8fdf3d520c | ||
|
|
b238a4ed69 | ||
|
|
ba53bdc708 | ||
|
|
f2a65e07b5 | ||
|
|
62afd4f98b | ||
|
|
6c11fd5a0d | ||
|
|
cc39504a61 | ||
|
|
1baec5378f | ||
|
|
b60b4fafff | ||
|
|
3325dd0550 | ||
|
|
29dc0fede0 | ||
|
|
19f6b8491e | ||
|
|
01b1e78dcd | ||
|
|
bd546e3d18 | ||
|
|
6ca93dfbae | ||
|
|
f175ce5249 |
16
TODO
16
TODO
@@ -53,11 +53,11 @@
|
||||
TODO:
|
||||
- Check search engine cpu usage
|
||||
|
||||
rc9->rc10 changelog:
|
||||
- FEATURE: Greatly improved ETA calculation algorithm (use GASA)
|
||||
- BUGFIX: Fixed proxy host max length in preferences
|
||||
- BUGFIX: Added a 3 minutes search engine timeout
|
||||
- BUGFIX: Limit search engine plugins to 10 result pages
|
||||
- BUGFIX: Fixed nbResults != 0 when clearing results while a search is running
|
||||
- BUGFIX: Fixed possible problem when closing to systray and cancelling app exit
|
||||
- COSMETIC: Use more skin colors instead of hard coded ones
|
||||
rc10->rc11? changelog:
|
||||
- BUGFIX: Bypass exit confirmation on system shutdown
|
||||
- BUGFIX: Download from urls are now able to follow redirections
|
||||
- BUGFIX: Clean up for failed torrents downloaded from urls
|
||||
- BUGFIX: Fixed downloads from URLs on Windows
|
||||
- BUGFIX: Fixed search engine on Windows
|
||||
- BUGFIX: Fixed torrent creation from a directory
|
||||
- BUGFIX: Fixed save path when seeding automatically after torrent creation
|
||||
|
||||
25
src/GUI.cpp
25
src/GUI.cpp
@@ -392,10 +392,10 @@ void GUI::on_actionExit_triggered() {
|
||||
}
|
||||
|
||||
void GUI::previewFile(QString filePath) {
|
||||
QDesktopServices::openUrl(filePath);
|
||||
QDesktopServices::openUrl(QString("file://")+filePath);
|
||||
}
|
||||
|
||||
unsigned int GUI::getCurrentTabIndex() const{
|
||||
int GUI::getCurrentTabIndex() const{
|
||||
if(isMinimized() || isHidden())
|
||||
return -1;
|
||||
return tabs->currentIndex();
|
||||
@@ -449,7 +449,7 @@ void GUI::on_actionAbout_triggered() {
|
||||
|
||||
// Called when we close the program
|
||||
void GUI::closeEvent(QCloseEvent *e) {
|
||||
qDebug("Mainwindow received closeEvent");
|
||||
|
||||
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
||||
bool goToSystrayOnExit = settings.value(QString::fromUtf8("Preferences/General/CloseToTray"), false).toBool();
|
||||
if(!force_exit && systrayIntegration && goToSystrayOnExit && !this->isHidden()) {
|
||||
@@ -461,14 +461,16 @@ void GUI::closeEvent(QCloseEvent *e) {
|
||||
show();
|
||||
if(!isMaximized())
|
||||
showNormal();
|
||||
if(QMessageBox::question(this,
|
||||
tr("Are you sure you want to quit?")+QString::fromUtf8(" -- ")+tr("qBittorrent"),
|
||||
tr("The download list is not empty.\nAre you sure you want to quit qBittorrent?"),
|
||||
tr("&Yes"), tr("&No"),
|
||||
QString(), 0, 1)) {
|
||||
e->ignore();
|
||||
force_exit = false;
|
||||
return;
|
||||
if(e->spontaneous() == true || force_exit == true) {
|
||||
if(QMessageBox::question(this,
|
||||
tr("Are you sure you want to quit?")+QString::fromUtf8(" -- ")+tr("qBittorrent"),
|
||||
tr("The download list is not empty.\nAre you sure you want to quit qBittorrent?"),
|
||||
tr("&Yes"), tr("&No"),
|
||||
QString(), 0, 1)) {
|
||||
e->ignore();
|
||||
force_exit = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
hide();
|
||||
@@ -486,6 +488,7 @@ void GUI::closeEvent(QCloseEvent *e) {
|
||||
qApp->exit();
|
||||
}
|
||||
|
||||
|
||||
// Display window to create a torrent
|
||||
void GUI::on_actionCreate_torrent_triggered() {
|
||||
createtorrent *ct = new createtorrent(this);
|
||||
|
||||
@@ -155,7 +155,7 @@ class GUI : public QMainWindow, private Ui::MainWindow{
|
||||
GUI(QWidget *parent=0, QStringList torrentCmdLine=QStringList());
|
||||
~GUI();
|
||||
// Methods
|
||||
unsigned int getCurrentTabIndex() const;
|
||||
int getCurrentTabIndex() const;
|
||||
QPoint screenCenter() const;
|
||||
};
|
||||
|
||||
|
||||
@@ -519,6 +519,7 @@ void bittorrent::addTorrent(QString path, bool fromScanDir, QString from_url, bo
|
||||
// Display warning to tell user we can't decode the torrent file
|
||||
if(!from_url.isNull()) {
|
||||
emit invalidTorrent(from_url);
|
||||
QFile::remove(file);
|
||||
}else{
|
||||
emit invalidTorrent(file);
|
||||
}
|
||||
@@ -533,6 +534,8 @@ void bittorrent::addTorrent(QString path, bool fromScanDir, QString from_url, bo
|
||||
// Display warning to tell user we can't decode the torrent file
|
||||
if(!from_url.isNull()) {
|
||||
emit invalidTorrent(from_url);
|
||||
qDebug("File path is: %s", file.toUtf8().data());
|
||||
QFile::remove(file);
|
||||
}else{
|
||||
emit invalidTorrent(file);
|
||||
}
|
||||
@@ -753,7 +756,7 @@ void bittorrent::loadFilesPriorities(QTorrentHandle &h) {
|
||||
if( priority < 0 || priority > 7) {
|
||||
priority = 1;
|
||||
}
|
||||
//qDebug("Setting piece piority to %d", priority);
|
||||
qDebug("Setting piece piority to %d", priority);
|
||||
v.push_back(priority);
|
||||
}
|
||||
h.prioritize_files(v);
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
#include <libtorrent/file_pool.hpp>
|
||||
|
||||
#include "createtorrent_imp.h"
|
||||
#include "misc.h"
|
||||
|
||||
using namespace libtorrent;
|
||||
using namespace boost::filesystem;
|
||||
@@ -120,11 +121,13 @@ void createtorrent::on_addURLSeed_button_clicked(){
|
||||
// Subfunction to add files to a torrent_info structure
|
||||
// Written by Arvid Norberg (libtorrent Author)
|
||||
void add_files(torrent_info& t, path const& p, path const& l){
|
||||
qDebug("p: %s, l: %s, l.leaf(): %s", p.string().c_str(), l.string().c_str(), l.leaf().c_str());
|
||||
path f(p / l);
|
||||
if (is_directory(f)){
|
||||
for (directory_iterator i(f), end; i != end; ++i)
|
||||
add_files(t, p, l / i->leaf());
|
||||
}else{
|
||||
qDebug("Adding %s", l.string().c_str());
|
||||
t.add_file(l, file_size(f));
|
||||
}
|
||||
}
|
||||
@@ -141,6 +144,8 @@ QStringList createtorrent::allItems(QListWidget *list){
|
||||
// Main function that create a .torrent file
|
||||
void createtorrent::on_createButton_clicked(){
|
||||
QString input = textInputPath->text().trimmed();
|
||||
if (input.endsWith(QDir::separator()))
|
||||
input.chop(1);
|
||||
if(input.isEmpty()){
|
||||
QMessageBox::critical(0, tr("No input path set"), tr("Please type an input path first"));
|
||||
return;
|
||||
@@ -161,9 +166,8 @@ void createtorrent::on_createButton_clicked(){
|
||||
try {
|
||||
boost::intrusive_ptr<torrent_info> t(new torrent_info);
|
||||
ofstream out(complete(path((const char*)destination.toUtf8())), std::ios_base::binary);
|
||||
path full_path;
|
||||
// Adding files to the torrent
|
||||
full_path = complete(path(input.toUtf8().data()));
|
||||
path full_path = complete(path(input.toUtf8().data()));
|
||||
add_files(*t, full_path.branch_path(), full_path.leaf());
|
||||
// Set piece size
|
||||
int piece_size = getPieceSize();
|
||||
@@ -200,8 +204,14 @@ void createtorrent::on_createButton_clicked(){
|
||||
entry e = t->create_torrent();
|
||||
libtorrent::bencode(std::ostream_iterator<char>(out), e);
|
||||
out.flush();
|
||||
if(checkStartSeeding->isChecked())
|
||||
if(checkStartSeeding->isChecked()) {
|
||||
// Create save path file
|
||||
QFile savepath_file(misc::qBittorrentPath()+QString::fromUtf8("BT_backup")+QDir::separator()+misc::toQString(t->info_hash())+QString::fromUtf8(".savepath"));
|
||||
savepath_file.open(QIODevice::WriteOnly | QIODevice::Text);
|
||||
savepath_file.write(full_path.branch_path().string().c_str());
|
||||
savepath_file.close();
|
||||
emit torrent_to_seed(destination);
|
||||
}
|
||||
}
|
||||
catch (std::exception& e){
|
||||
std::cerr << e.what() << "\n";
|
||||
|
||||
@@ -73,7 +73,7 @@ void subDownloadThread::run(){
|
||||
filePath = tmpfile->fileName();
|
||||
}
|
||||
delete tmpfile;
|
||||
FILE *f = fopen(filePath.toUtf8().data(), "w");
|
||||
FILE *f = fopen(filePath.toUtf8().data(), "wb");
|
||||
if(!f) {
|
||||
std::cerr << "couldn't open destination file" << "\n";
|
||||
return;
|
||||
@@ -112,6 +112,14 @@ void subDownloadThread::run(){
|
||||
// We have to define CURLOPT_WRITEFUNCTION or it will crash on windows
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, fwrite);
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEDATA, f);
|
||||
// Verbose
|
||||
// curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
|
||||
// No progress info (we don't use it)
|
||||
curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 1);
|
||||
// Redirections
|
||||
curl_easy_setopt(curl, CURLOPT_AUTOREFERER, 1);
|
||||
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1);
|
||||
curl_easy_setopt(curl, CURLOPT_MAXREDIRS, -1);
|
||||
qDebug("Downloading %s", url.toUtf8().data());
|
||||
res = curl_easy_perform(curl);
|
||||
/* always cleanup */
|
||||
|
||||
@@ -250,11 +250,13 @@ void engineSelectDlg::setRowColor(int row, QString color){
|
||||
bool engineSelectDlg::checkInstalled(QString plugin_name) const {
|
||||
QProcess nova;
|
||||
QStringList params;
|
||||
params << misc::qBittorrentPath()+"search_engine"+QDir::separator()+"nova2.py";
|
||||
params << "--supported_engines";
|
||||
nova.start(misc::qBittorrentPath()+"search_engine"+QDir::separator()+"nova2.py", params, QIODevice::ReadOnly);
|
||||
nova.start("python", params, QIODevice::ReadOnly);
|
||||
nova.waitForStarted();
|
||||
nova.waitForFinished();
|
||||
QByteArray result = nova.readAll();
|
||||
result = result.replace("\r", "");
|
||||
result = result.replace("\n", "");
|
||||
QList<QByteArray> plugins_list = result.split(',');
|
||||
return plugins_list.contains(plugin_name.toUtf8());
|
||||
@@ -280,11 +282,13 @@ void engineSelectDlg::loadSupportedSearchEngines(bool first) {
|
||||
QStringList params;
|
||||
// Ask nova core for the supported search engines
|
||||
QProcess nova;
|
||||
params << misc::qBittorrentPath()+"search_engine"+QDir::separator()+"nova2.py";
|
||||
params << "--supported_engines";
|
||||
nova.start(misc::qBittorrentPath()+"search_engine"+QDir::separator()+"nova2.py", params, QIODevice::ReadOnly);
|
||||
nova.start("python", params, QIODevice::ReadOnly);
|
||||
nova.waitForStarted();
|
||||
nova.waitForFinished();
|
||||
QByteArray result = nova.readAll();
|
||||
result = result.replace("\r", "");
|
||||
result = result.replace("\n", "");
|
||||
qDebug("read: %s", result.data());
|
||||
QByteArray e;
|
||||
@@ -295,11 +299,13 @@ void engineSelectDlg::loadSupportedSearchEngines(bool first) {
|
||||
installed_engines[en] = old_engines.value(en, true);
|
||||
}
|
||||
params.clear();
|
||||
params << misc::qBittorrentPath()+"search_engine"+QDir::separator()+"nova2.py";
|
||||
params << "--supported_engines_infos";
|
||||
nova.start(misc::qBittorrentPath()+"search_engine"+QDir::separator()+"nova2.py", params, QIODevice::ReadOnly);
|
||||
nova.start("python", params, QIODevice::ReadOnly);
|
||||
nova.waitForStarted();
|
||||
nova.waitForFinished();
|
||||
result = nova.readAll();
|
||||
result = result.replace("\r", "");
|
||||
result = result.replace("\n", "");
|
||||
qDebug("read: %s", result.data());
|
||||
unsigned int i = 0;
|
||||
|
||||
@@ -277,7 +277,7 @@ void SearchEngine::on_search_button_clicked(){
|
||||
QStringList params;
|
||||
QStringList engineNames;
|
||||
search_stopped = false;
|
||||
|
||||
params << misc::qBittorrentPath()+"search_engine"+QDir::separator()+"nova2.py";
|
||||
params << enabled_engines.join(",");
|
||||
params << pattern.split(" ");
|
||||
// Update SearchEngine widgets
|
||||
@@ -286,7 +286,7 @@ void SearchEngine::on_search_button_clicked(){
|
||||
search_result_line_truncated.clear();
|
||||
results_lbl->setText(tr("Results")+" <i>(0)</i>:");
|
||||
// Launch search
|
||||
searchProcess->start(misc::qBittorrentPath()+"search_engine"+QDir::separator()+"nova2.py", params, QIODevice::ReadOnly);
|
||||
searchProcess->start("python", params, QIODevice::ReadOnly);
|
||||
searchTimeout->start(180000); // 3min
|
||||
}
|
||||
|
||||
@@ -318,6 +318,7 @@ void SearchEngine::downloadSelectedItem(const QModelIndex& index){
|
||||
// line to search results calling appendSearchResult().
|
||||
void SearchEngine::readSearchOutput(){
|
||||
QByteArray output = searchProcess->readAllStandardOutput();
|
||||
output.replace("\r", "");
|
||||
QList<QByteArray> lines_list = output.split('\n');
|
||||
QByteArray line;
|
||||
if(!search_result_line_truncated.isEmpty()){
|
||||
@@ -370,7 +371,7 @@ void SearchEngine::updateNova() {
|
||||
QStringList files = shipped_subDir.entryList();
|
||||
QString file;
|
||||
foreach(file, files){
|
||||
QString shipped_file = shipped_subDir.path()+QDir::separator()+file;
|
||||
QString shipped_file = shipped_subDir.path()+"/"+file;
|
||||
// Copy python classes
|
||||
if(file.endsWith(".py")) {
|
||||
if(misc::getPluginVersion(shipped_file) > misc::getPluginVersion(destDir+file) ) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#VERSION: 1.11
|
||||
#VERSION: 1.12
|
||||
#AUTHORS: Fabien Devaux (fab@gnux.info)
|
||||
from novaprinter import prettyPrinter
|
||||
import urllib
|
||||
@@ -14,7 +14,7 @@ class btjunkie(object):
|
||||
res = 0
|
||||
dat = urllib.urlopen(self.url+'/search?q=%s&o=52&p=%d'%(what,i)).read().decode('utf8', 'replace')
|
||||
# I know it's not very readable, but the SGML parser feels in pain
|
||||
section_re = re.compile('(?s)href="/torrent.*?<tr>')
|
||||
section_re = re.compile('(?s)href="http://dl.btjunkie.org/torrent/.*?<tr>')
|
||||
torrent_re = re.compile('(?s)href="(?P<link>.*?[^"]+).*?'
|
||||
'class="BlckUnd">(?P<name>.*?)</a>.*?'
|
||||
'>(?P<size>\d+MB)</font>.*?'
|
||||
@@ -27,7 +27,7 @@ class btjunkie(object):
|
||||
torrent_infos = m.groupdict()
|
||||
torrent_infos['name'] = re.sub('</?font.*?>', '', torrent_infos['name'])
|
||||
torrent_infos['engine_url'] = self.url
|
||||
torrent_infos['link'] = self.url+torrent_infos['link']
|
||||
#torrent_infos['link'] = self.url+torrent_infos['link']
|
||||
prettyPrinter(torrent_infos)
|
||||
res = res + 1
|
||||
if res == 0:
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#VERSION: 1.01
|
||||
#VERSION: 1.02
|
||||
#AUTHORS: Gekko Dam Beer (gekko04@users.sourceforge.net)
|
||||
from novaprinter import prettyPrinter
|
||||
import sgmllib
|
||||
@@ -22,9 +22,7 @@ class torrentreactor(object):
|
||||
if params['href'].startswith('http://dl.torrentreactor.net/download.php'):
|
||||
self.current_item = {}
|
||||
self.td_counter = 0
|
||||
equal = params['href'].find("=")
|
||||
amp = params['href'].find("&", equal+1)
|
||||
self.id = str(int(params['href'][equal+1:amp]))
|
||||
self.current_item['link'] = params['href'].strip()
|
||||
|
||||
def handle_data(self, data):
|
||||
if self.td_counter == 0:
|
||||
@@ -47,11 +45,10 @@ class torrentreactor(object):
|
||||
def start_td(self,attr):
|
||||
if isinstance(self.td_counter,int):
|
||||
self.td_counter += 1
|
||||
if self.td_counter > 7:
|
||||
if self.td_counter > 3:
|
||||
self.td_counter = None
|
||||
# add item to results
|
||||
if self.current_item:
|
||||
self.current_item['link']='http://download.torrentreactor.net/download.php?id=%s&name=%s'%(self.id, urllib.quote(self.current_item['name']))
|
||||
self.current_item['engine_url'] = self.url
|
||||
if not self.current_item['seeds'].isdigit():
|
||||
self.current_item['seeds'] = 0
|
||||
@@ -71,6 +68,7 @@ class torrentreactor(object):
|
||||
results = []
|
||||
parser = self.SimpleSGMLParser(results, self.url)
|
||||
dat = urllib.urlopen(self.url+'/search.php?search=&words=%s&cid=&sid=&type=2&orderby=a.seeds&asc=0&skip=%s'%(what,(i*35))).read().decode('utf-8', 'replace')
|
||||
#print "loading page: "+self.url+'/search.php?search=&words=%s&cid=&sid=&type=2&orderby=a.seeds&asc=0&skip=%s'%(what,(i*35))
|
||||
parser.feed(dat)
|
||||
parser.close()
|
||||
if len(results) <= 0:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
isohunt: 1.01
|
||||
torrentreactor: 1.01
|
||||
btjunkie: 1.11
|
||||
torrentreactor: 1.02
|
||||
btjunkie: 1.12
|
||||
mininova: 1.12
|
||||
piratebay: 1.01
|
||||
|
||||
@@ -11,7 +11,7 @@ TARGET = qbittorrent
|
||||
CONFIG += qt thread x11 network
|
||||
|
||||
# Update this VERSION for each release
|
||||
DEFINES += VERSION=\\\"v1.0.0rc9\\\"
|
||||
DEFINES += VERSION=\\\"v1.0.0rc11\\\"
|
||||
DEFINES += VERSION_MAJOR=1
|
||||
DEFINES += VERSION_MINOR=0
|
||||
DEFINES += VERSION_BUGFIX=0
|
||||
|
||||
@@ -125,6 +125,7 @@ class torrentAdditionDialog : public QDialog, private Ui_addTorrentDialog{
|
||||
// Display warning to tell user we can't decode the torrent file
|
||||
if(!from_url.isNull()){
|
||||
emit setInfoBarGUI(tr("Unable to decode torrent file:")+QString::fromUtf8(" '")+from_url+QString::fromUtf8("'"), QString::fromUtf8("red"));
|
||||
QFile::remove(filePath);
|
||||
}else{
|
||||
emit setInfoBarGUI(tr("Unable to decode torrent file:")+QString::fromUtf8(" '")+filePath+QString::fromUtf8("'"), QString::fromUtf8("red"));
|
||||
}
|
||||
@@ -142,9 +143,11 @@ class torrentAdditionDialog : public QDialog, private Ui_addTorrentDialog{
|
||||
// Display warning to tell user we can't decode the torrent file
|
||||
if(!from_url.isNull()){
|
||||
emit setInfoBarGUI(tr("Unable to decode torrent file:")+QString::fromUtf8(" '")+from_url+QString::fromUtf8("'"), QString::fromUtf8("red"));
|
||||
QFile::remove(filePath);
|
||||
}else{
|
||||
emit setInfoBarGUI(tr("Unable to decode torrent file:")+QString::fromUtf8(" '")+filePath+QString::fromUtf8("'"), QString::fromUtf8("red"));
|
||||
}
|
||||
qDebug("path is %s", filePath.toUtf8().data());
|
||||
emit setInfoBarGUI(tr("This file is either corrupted or this isn't a torrent."), QString::fromUtf8("red"));
|
||||
if(fromScanDir){
|
||||
// Remove .corrupt file in case it already exists
|
||||
|
||||
Reference in New Issue
Block a user