mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-11-25 10:46:15 +03:00
** BIG COMMIT **
- Fixed a bug in options (scan dir widget were not initialized well, still disabled when they shouldn't) - Fixed a bug in scan dir (doesn't display torrent addition dialog several times for the same torrent if we don't close the dialog before next scan refresh - Splitted GUI from Bittorrent, lot of code rewritten and optimized. Code changed so much that we will spend the next few days squashing eventual new bugs ;) - We don't use the hash table to store the torrent handles anymore because libtorrent is already doing it for us (save memory)
This commit is contained in:
parent
dc89c5d381
commit
bd3bde919d
10 changed files with 511 additions and 844 deletions
|
@ -10,15 +10,17 @@
|
|||
- FEATURE: Number of complete/incomplete sources are now displayed in download list for each torrent
|
||||
- FEATURE: Implemented close to systray
|
||||
- FEATURE: Added Autocompletion to search engine
|
||||
- BUGFIX: Two torrents can now have the same name although they are different
|
||||
- FEATURE: Splitted BT & GUI parts (huge code rewriting & optimization)
|
||||
- BUGFIX: Two torrents can now have the same name although they are different (use their hash)
|
||||
- BUGFIX: Fixed download from url that would fail sometimes
|
||||
- BUGFIX: Save directory was reset to default when filtering files in torrent
|
||||
- BUGFIX: Force a refresh of download list when the window is shown (avoid delay)
|
||||
- BUGFIX: Fixed deletion from hard drive (failed for non-empty folders)
|
||||
- BUGFIX: qBittorrent now identifies its version correctly on the network
|
||||
- BUGFIX: Preventing GUI from freezing when deleting a download permanently
|
||||
- BUGFIX: Fix directory scanning (stop trying to download the same files several times)
|
||||
- COSMETIC: Replaced OSD messages by systray messages
|
||||
- BUGFIX: Fixed directory scanning (stop trying to download the same files several times)
|
||||
- BUGFIX: Fixed bad loading of scan dir in option (widgets still disabled)
|
||||
- COSMETIC: Replaced OSD messages by Qt4.2 systray messages
|
||||
|
||||
* Tue Nov 28 2006 - Christophe Dumez <chris@qbittorrent.org> - v0.8.0
|
||||
- FEATURE: Added a torrent addition dialog
|
||||
|
|
6
TODO
6
TODO
|
@ -40,6 +40,10 @@
|
|||
- Allow to edit the trackers for a torrent
|
||||
|
||||
// In v0.9.0
|
||||
- Splitting torrent part from GUI (& remove handles hashtable to save up some memory)
|
||||
- Splitting torrent part from GUI (bug squashing + cleanup)
|
||||
- Create options object only when necessary to save up some memory
|
||||
- Wait for libtorrent v0.12 official release
|
||||
- report this to libtorrent:
|
||||
"qbittorrent: kademlia/rpc_manager.cpp:327: void libtorrent::dht::rpc_manager::invoke(int, asio::ip::basic_endpoint<asio::ip::udp>, boost::shared_ptr<libtorrent::dht::observer>): l'assertion « false » a échoué."
|
||||
Info: current TOP output:
|
||||
25461 chris 15 0 106m 23m 14m S 0.7 2.4 0:01.60 qbittorrent
|
||||
|
|
914
src/GUI.cpp
914
src/GUI.cpp
File diff suppressed because it is too large
Load diff
33
src/GUI.h
33
src/GUI.h
|
@ -43,7 +43,6 @@
|
|||
#include "about_imp.h"
|
||||
#include "previewSelect.h"
|
||||
#include "trackerLogin.h"
|
||||
#include "deleteThread.h"
|
||||
#include "bittorrent.h"
|
||||
|
||||
|
||||
|
@ -65,18 +64,11 @@ class GUI : public QMainWindow, private Ui::MainWindow{
|
|||
|
||||
private:
|
||||
// Bittorrent
|
||||
session *s;
|
||||
std::pair<unsigned short, unsigned short> listenPorts;
|
||||
QHash<QString, torrent_handle> handles;
|
||||
bittorrent BTSession;
|
||||
QTimer *checkConnect;
|
||||
QTimer *timerScan;
|
||||
QHash<QString, QStringList> trackerErrors;
|
||||
trackerLogin *tracker_login;
|
||||
QList<QPair<torrent_handle,std::string> > unauthenticated_trackers;
|
||||
downloadThread *downloader;
|
||||
downloadFromURL *downloadFromURLDialog;
|
||||
bool DHTEnabled;
|
||||
QList<deleteThread*> deleters;
|
||||
// GUI related
|
||||
options_imp *options;
|
||||
createtorrent *createWindow;
|
||||
|
@ -88,7 +80,6 @@ class GUI : public QMainWindow, private Ui::MainWindow{
|
|||
DLListDelegate *DLDelegate;
|
||||
QStandardItemModel *SearchListModel;
|
||||
SearchListDelegate *SearchDelegate;
|
||||
QStringList supported_preview_extensions;
|
||||
unsigned int nbTorrents;
|
||||
QLabel *connecStatusLblIcon;
|
||||
// Preview
|
||||
|
@ -147,25 +138,17 @@ class GUI : public QMainWindow, private Ui::MainWindow{
|
|||
// Torrent actions
|
||||
void showProperties(const QModelIndex &index);
|
||||
void propertiesSelection();
|
||||
void addTorrent(const QString& path, bool fromScanDir = false, const QString& from_url = QString());
|
||||
void pauseSelection();
|
||||
void startSelection();
|
||||
void askForTorrents();
|
||||
void deletePermanently();
|
||||
void deleteSelection();
|
||||
void resumeUnfinished();
|
||||
void saveFastResumeData() const;
|
||||
void checkConnectionStatus();
|
||||
void scanDirectory();
|
||||
void setGlobalRatio(float ratio);
|
||||
void configureSession();
|
||||
void processParams(const QStringList& params);
|
||||
void addUnauthenticatedTracker(QPair<torrent_handle,std::string> tracker);
|
||||
void processDownloadedFile(QString url, QString file_path, int return_code, QString errorBuffer);
|
||||
void downloadFromURLList(const QStringList& url_list);
|
||||
bool loadFilteredFiles(torrent_handle &h);
|
||||
bool hasFilteredFiles(const QString& fileName);
|
||||
void reloadTorrent(const torrent_handle &h, bool compact_mode = true);
|
||||
void processScannedFiles(const QStringList& params);
|
||||
void processDownloadedFiles(const QString& path, const QString& url);
|
||||
// Search slots
|
||||
void on_search_button_clicked();
|
||||
void on_stop_search_button_clicked();
|
||||
|
@ -185,11 +168,18 @@ class GUI : public QMainWindow, private Ui::MainWindow{
|
|||
void showOptions() const;
|
||||
void OptionsSaved(const QString& info);
|
||||
// HTTP slots
|
||||
void downloadFromUrl(const QString& url);
|
||||
void askForTorrentUrl();
|
||||
|
||||
public slots:
|
||||
void setLocale(QString locale);
|
||||
void torrentAdded(const QString& path, torrent_handle& h, bool fastResume);
|
||||
void torrentDuplicate(const QString& path);
|
||||
void torrentCorrupted(const QString& path);
|
||||
void finishedTorrent(torrent_handle& h);
|
||||
void fullDiskError(torrent_handle& h);
|
||||
void portListeningFailure();
|
||||
void trackerError(const QString& hash, const QString& time, const QString& msg);
|
||||
void trackerAuthenticationRequired(torrent_handle& h);
|
||||
|
||||
protected:
|
||||
void closeEvent(QCloseEvent *);
|
||||
|
@ -204,7 +194,6 @@ class GUI : public QMainWindow, private Ui::MainWindow{
|
|||
float getNovaVersion(const QString& novaPath) const;
|
||||
QByteArray getNovaChangelog(const QString& novaPath) const;
|
||||
void updateNova() const;
|
||||
bool isFilePreviewPossible(const torrent_handle& h) const;
|
||||
QString getSavePath(QString fileName);
|
||||
QPoint screenCenter();
|
||||
};
|
||||
|
|
|
@ -20,12 +20,15 @@
|
|||
*/
|
||||
#include "bittorrent.h"
|
||||
#include "misc.h"
|
||||
#include "downloadThread.h"
|
||||
|
||||
#include <QDir>
|
||||
#include <QTime>
|
||||
|
||||
// Main constructor
|
||||
bittorrent::bittorrent(){
|
||||
// Supported preview extensions
|
||||
// XXX: might be incomplete
|
||||
supported_preview_extensions << "AVI" << "DIVX" << "MPG" << "MPEG" << "MP3" << "OGG" << "WMV" << "WMA" << "RMV" << "RMVB" << "ASF" << "MOV" << "WAV" << "MP2" << "SWF" << "AC3";
|
||||
// Creating bittorrent session
|
||||
s = new session(fingerprint("qB", VERSION_MAJOR, VERSION_MINOR, VERSION_BUGFIX, 0));
|
||||
|
@ -38,12 +41,21 @@ bittorrent::bittorrent(){
|
|||
timerAlerts = new QTimer(this);
|
||||
connect(timerAlerts, SIGNAL(timeout()), this, SLOT(readAlerts()));
|
||||
timerAlerts->start(3000);
|
||||
// To download from urls
|
||||
downloader = new downloadThread(this);
|
||||
connect(downloader, SIGNAL(downloadFinished(const QString&, const QString&, int, const QString&)), this, SLOT(processDownloadedFile(const QString&, const QString&, int, const QString&)));
|
||||
}
|
||||
|
||||
void bittorrent::resumeUnfinishedTorrents(){
|
||||
// Resume unfinished torrents
|
||||
resumeUnfinished();
|
||||
}
|
||||
|
||||
// Main destructor
|
||||
bittorrent::~bittorrent(){
|
||||
disableDirectoryScanning();
|
||||
delete timerAlerts;
|
||||
delete downloader;
|
||||
delete s;
|
||||
}
|
||||
|
||||
|
@ -52,6 +64,16 @@ torrent_handle bittorrent::getTorrentHandle(const QString& hash) const{
|
|||
return s->find_torrent(misc::fromString<sha1_hash>((hash.toStdString())));
|
||||
}
|
||||
|
||||
// Return true if the torrent corresponding to the
|
||||
// hash is paused
|
||||
bool bittorrent::isPaused(const QString& hash) const{
|
||||
torrent_handle h = s->find_torrent(misc::fromString<sha1_hash>((hash.toStdString())));
|
||||
if(!h.is_valid()){
|
||||
return true;
|
||||
}
|
||||
return h.is_paused();
|
||||
}
|
||||
|
||||
// Delete a torrent from the session, given its hash
|
||||
// permanent = true means that the torrent will be removed from the hard-drive too
|
||||
void bittorrent::deleteTorrent(const QString& hash, bool permanent){
|
||||
|
@ -91,6 +113,10 @@ void bittorrent::pauseTorrent(const QString& hash){
|
|||
torrent_handle h = s->find_torrent(misc::fromString<sha1_hash>((hash.toStdString())));
|
||||
if(h.is_valid() && !h.is_paused()){
|
||||
h.pause();
|
||||
// Create .paused file
|
||||
QFile paused_file(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+hash+".paused");
|
||||
paused_file.open(QIODevice::WriteOnly | QIODevice::Text);
|
||||
paused_file.close();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -99,6 +125,8 @@ void bittorrent::resumeTorrent(const QString& hash){
|
|||
torrent_handle h = s->find_torrent(misc::fromString<sha1_hash>((hash.toStdString())));
|
||||
if(h.is_valid() && h.is_paused()){
|
||||
h.resume();
|
||||
// Delete .paused file
|
||||
QFile::remove(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+hash+".paused");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -253,6 +281,11 @@ void bittorrent::addTorrent(const QString& path, bool fromScanDir, const QString
|
|||
}
|
||||
}
|
||||
|
||||
// Set the maximum number of opened connections
|
||||
void bittorrent::setMaxConnections(int maxConnec){
|
||||
s->set_max_connections(maxConnec);
|
||||
}
|
||||
|
||||
// Check in .pieces file if the user filtered files
|
||||
// in this torrent.
|
||||
bool bittorrent::hasFilteredFiles(const QString& fileHash) const{
|
||||
|
@ -404,14 +437,16 @@ void bittorrent::scanDirectory(){
|
|||
foreach(file, files){
|
||||
QString fullPath = dir.path()+QDir::separator()+file;
|
||||
if(fullPath.endsWith(".torrent")){
|
||||
to_add << fullPath;
|
||||
QFile::rename(fullPath, fullPath+QString(".old"));
|
||||
to_add << fullPath+QString(".old");
|
||||
}
|
||||
}
|
||||
foreach(file, to_add){
|
||||
// TODO: Support torrent addition dialog
|
||||
addTorrent(file, true);
|
||||
emit scanDirFoundTorrents(to_add);
|
||||
}
|
||||
}
|
||||
|
||||
void bittorrent::setDefaultSavePath(const QString& savepath){
|
||||
defaultSavePath = savepath;
|
||||
}
|
||||
|
||||
// Enable directory scanning
|
||||
|
@ -501,7 +536,7 @@ void bittorrent::readAlerts(){
|
|||
emit finishedTorrent(p->handle);
|
||||
}
|
||||
else if (file_error_alert* p = dynamic_cast<file_error_alert*>(a.get())){
|
||||
emit fullDiskError(QString(p->handle.get_torrent_info().name().c_str()));
|
||||
emit fullDiskError(p->handle);
|
||||
}
|
||||
else if (dynamic_cast<listen_failed_alert*>(a.get())){
|
||||
// Level: fatal
|
||||
|
@ -520,6 +555,71 @@ void bittorrent::readAlerts(){
|
|||
}
|
||||
}
|
||||
|
||||
void bittorrent::reloadTorrent(const torrent_handle &h, bool compact_mode){
|
||||
QDir torrentBackup(misc::qBittorrentPath() + "BT_backup");
|
||||
fs::path saveDir = h.save_path();
|
||||
QString fileName = QString(h.name().c_str());
|
||||
QString fileHash = QString(misc::toString(h.info_hash()).c_str());
|
||||
qDebug("Reloading torrent: %s", (const char*)fileName.toUtf8());
|
||||
torrent_handle new_h;
|
||||
entry resumeData;
|
||||
torrent_info t = h.get_torrent_info();
|
||||
// Checking if torrentBackup Dir exists
|
||||
// create it if it is not
|
||||
if(! torrentBackup.exists()){
|
||||
torrentBackup.mkpath(torrentBackup.path());
|
||||
}
|
||||
// Write fast resume data
|
||||
// Pause download (needed before fast resume writing)
|
||||
h.pause();
|
||||
// Extracting resume data
|
||||
if (h.has_metadata()){
|
||||
// get fast resume data
|
||||
resumeData = h.write_resume_data();
|
||||
}
|
||||
// Remove torrent
|
||||
s->remove_torrent(h);
|
||||
// Add torrent again to session
|
||||
unsigned short timeout = 0;
|
||||
while(h.is_valid() && timeout < 6){
|
||||
SleeperThread::msleep(1000);
|
||||
++timeout;
|
||||
}
|
||||
if(h.is_valid()){
|
||||
std::cerr << "Error: Couldn't reload the torrent\n";
|
||||
return;
|
||||
}
|
||||
new_h = s->add_torrent(t, saveDir, resumeData, compact_mode);
|
||||
if(compact_mode){
|
||||
qDebug("Using compact allocation mode");
|
||||
}else{
|
||||
qDebug("Using full allocation mode");
|
||||
}
|
||||
|
||||
// new_h.set_max_connections(60);
|
||||
new_h.set_max_uploads(-1);
|
||||
// Load filtered Files
|
||||
loadFilteredFiles(new_h);
|
||||
|
||||
// Pause torrent if it was paused last time
|
||||
if(QFile::exists(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+fileHash+".paused")){
|
||||
new_h.pause();
|
||||
}
|
||||
// Incremental download
|
||||
if(QFile::exists(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+fileHash+".incremental")){
|
||||
qDebug("Incremental download enabled for %s", (const char*)fileName.toUtf8());
|
||||
new_h.set_sequenced_download_threshold(15);
|
||||
}
|
||||
}
|
||||
|
||||
int bittorrent::getListenPort() const{
|
||||
return s->listen_port();
|
||||
}
|
||||
|
||||
session_status bittorrent::getSessionStatus() const{
|
||||
return s->status();
|
||||
}
|
||||
|
||||
QString bittorrent::getSavePath(const QString& hash){
|
||||
QFile savepath_file(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+hash+".savepath");
|
||||
QByteArray line;
|
||||
|
@ -530,8 +630,8 @@ QString bittorrent::getSavePath(const QString& hash){
|
|||
qDebug("Save path: %s", line.data());
|
||||
savePath = QString::fromUtf8(line.data());
|
||||
}else{
|
||||
//TODO: always create .savepath file
|
||||
// savePath = options->getSavePath();
|
||||
// use default save path
|
||||
savePath = defaultSavePath;
|
||||
}
|
||||
// Checking if savePath Dir exists
|
||||
// create it if it is not
|
||||
|
@ -539,9 +639,106 @@ QString bittorrent::getSavePath(const QString& hash){
|
|||
if(!saveDir.exists()){
|
||||
if(!saveDir.mkpath(saveDir.path())){
|
||||
std::cerr << "Couldn't create the save directory: " << (const char*)saveDir.path().toUtf8() << "\n";
|
||||
// TODO: handle this better
|
||||
// XXX: handle this better
|
||||
return QDir::homePath();
|
||||
}
|
||||
}
|
||||
return savePath;
|
||||
}
|
||||
|
||||
// Take an url string to a torrent file,
|
||||
// download the torrent file to a tmp location, then
|
||||
// add it to download list
|
||||
void bittorrent::downloadFromUrl(const QString& url){
|
||||
// Launch downloader thread
|
||||
downloader->downloadUrl(url);
|
||||
}
|
||||
|
||||
// Add to bittorrent session the downloaded torrent file
|
||||
void bittorrent::processDownloadedFile(const QString& url, const QString& file_path, int return_code, const QString& errorBuffer){
|
||||
if(return_code){
|
||||
// Download failed
|
||||
emit downloadFromUrlFailure(url, errorBuffer);
|
||||
QFile::remove(file_path);
|
||||
return;
|
||||
}
|
||||
// Add file to torrent download list
|
||||
emit newDownloadedTorrent(file_path, url);
|
||||
}
|
||||
|
||||
void bittorrent::downloadFromURLList(const QStringList& url_list){
|
||||
QString url;
|
||||
foreach(url, url_list){
|
||||
downloadFromUrl(url);
|
||||
}
|
||||
}
|
||||
|
||||
// Return current download rate for the BT
|
||||
// session. Payload means that it only take into
|
||||
// account "useful" part of the rate
|
||||
float bittorrent::getPayloadDownloadRate() const{
|
||||
session_status sessionStatus = s->status();
|
||||
return sessionStatus.payload_download_rate;
|
||||
}
|
||||
|
||||
// Return current upload rate for the BT
|
||||
// session. Payload means that it only take into
|
||||
// account "useful" part of the rate
|
||||
float bittorrent::getPayloadUploadRate() const{
|
||||
session_status sessionStatus = s->status();
|
||||
return sessionStatus.payload_upload_rate;
|
||||
}
|
||||
|
||||
// Return a vector with all torrent handles in it
|
||||
std::vector<torrent_handle> bittorrent::getTorrentHandles() const{
|
||||
return s->get_torrents();
|
||||
}
|
||||
|
||||
// Return a vector with all finished torrent handles in it
|
||||
QList<torrent_handle> bittorrent::getFinishedTorrentHandles() const{
|
||||
QList<torrent_handle> finished;
|
||||
std::vector<torrent_handle> handles;
|
||||
for(unsigned int i=0; i<handles.size(); ++i){
|
||||
torrent_handle h = handles[i];
|
||||
if(h.is_seed()){
|
||||
finished << h;
|
||||
}
|
||||
}
|
||||
return finished;
|
||||
}
|
||||
|
||||
// Save DHT entry to hard drive
|
||||
void bittorrent::saveDHTEntry(){
|
||||
// Save DHT entry
|
||||
if(DHTEnabled){
|
||||
try{
|
||||
entry dht_state = s->dht_state();
|
||||
boost::filesystem::ofstream out((const char*)(misc::qBittorrentPath()+QString("dht_state")).toUtf8(), std::ios_base::binary);
|
||||
out.unsetf(std::ios_base::skipws);
|
||||
bencode(std::ostream_iterator<char>(out), dht_state);
|
||||
}catch (std::exception& e){
|
||||
std::cerr << e.what() << "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Will fast resume unfinished torrents in
|
||||
// backup directory
|
||||
void bittorrent::resumeUnfinished(){
|
||||
qDebug("Resuming unfinished torrents");
|
||||
QDir torrentBackup(misc::qBittorrentPath() + "BT_backup");
|
||||
QStringList fileNames, filePaths;
|
||||
// Scan torrentBackup directory
|
||||
fileNames = torrentBackup.entryList();
|
||||
QString fileName;
|
||||
foreach(fileName, fileNames){
|
||||
if(fileName.endsWith(".torrent")){
|
||||
filePaths.append(torrentBackup.path()+QDir::separator()+fileName);
|
||||
}
|
||||
}
|
||||
// Resume downloads
|
||||
foreach(fileName, filePaths){
|
||||
addTorrent(fileName);
|
||||
}
|
||||
qDebug("Unfinished torrents resumed");
|
||||
}
|
||||
|
|
|
@ -51,6 +51,8 @@
|
|||
using namespace libtorrent;
|
||||
namespace fs = boost::filesystem;
|
||||
|
||||
class downloadThread;
|
||||
|
||||
class bittorrent : public QObject{
|
||||
Q_OBJECT
|
||||
|
||||
|
@ -60,59 +62,77 @@ class bittorrent : public QObject{
|
|||
QString scan_dir;
|
||||
QTimer *timerScan;
|
||||
QTimer *timerAlerts;
|
||||
QWidget *parent;
|
||||
downloadThread *downloader;
|
||||
QStringList supported_preview_extensions;
|
||||
|
||||
// Constructor / Destructor
|
||||
bittorrent();
|
||||
~bittorrent();
|
||||
QString defaultSavePath;
|
||||
|
||||
protected:
|
||||
QString getSavePath(const QString& hash);
|
||||
|
||||
public:
|
||||
// Constructor / Destructor
|
||||
bittorrent();
|
||||
~bittorrent();
|
||||
torrent_handle getTorrentHandle(const QString& hash) const;
|
||||
std::vector<torrent_handle> getTorrentHandles() const;
|
||||
bool isPaused(const QString& hash) const;
|
||||
bool hasFilteredFiles(const QString& fileHash) const;
|
||||
bool isFilePreviewPossible(const QString& fileHash) const;
|
||||
bool isDHTEnabled() const;
|
||||
float getPayloadDownloadRate() const;
|
||||
float getPayloadUploadRate() const;
|
||||
QList<torrent_handle> getFinishedTorrentHandles() const;
|
||||
session_status getSessionStatus() const;
|
||||
int getListenPort() const;
|
||||
|
||||
public slots:
|
||||
void addTorrent(const QString& path, bool fromScanDir = false, const QString& from_url = QString());
|
||||
void downloadFromUrl(const QString& url);
|
||||
void downloadFromURLList(const QStringList& url_list);
|
||||
void deleteTorrent(const QString& hash, bool permanent = false);
|
||||
void pauseTorrent(const QString& hash);
|
||||
void resumeTorrent(const QString& hash);
|
||||
void enableDHT();
|
||||
void disableDHT();
|
||||
void saveDHTEntry();
|
||||
void saveFastResumeData();
|
||||
void enableDirectoryScanning(const QString& scan_dir);
|
||||
void disableDirectoryScanning();
|
||||
void enablePeerExchange();
|
||||
void enableIPFilter(ip_filter filter);
|
||||
void disableIPFilter();
|
||||
void reloadTorrent(const torrent_handle &h, bool compact_mode = true);
|
||||
void resumeUnfinishedTorrents();
|
||||
// Session configuration - Setters
|
||||
void setListeningPortsRange(std::pair<unsigned short, unsigned short> ports);
|
||||
void setMaxConnections(int maxConnec);
|
||||
void setDownloadRateLimit(int rate);
|
||||
void setUploadRateLimit(int rate);
|
||||
void setGlobalRatio(float ratio);
|
||||
void setDHTPort(int dht_port);
|
||||
void setSessionSettings(session_settings sessionSettings);
|
||||
void setDefaultSavePath(const QString& savepath);
|
||||
|
||||
protected slots:
|
||||
void cleanDeleter(deleteThread* deleter);
|
||||
void loadFilteredFiles(torrent_handle& h);
|
||||
void scanDirectory();
|
||||
void readAlerts();
|
||||
void processDownloadedFile(const QString&, const QString&, int, const QString&);
|
||||
void resumeUnfinished();
|
||||
|
||||
signals:
|
||||
void invalidTorrent(const QString& path);
|
||||
void duplicateTorrent(const QString& path);
|
||||
void addedTorrent(const QString& path, torrent_handle& h, bool fastResume);
|
||||
void resumedTorrent(const QString& path);
|
||||
void finishedTorrent(torrent_handle& h);
|
||||
void fullDiskError(const QString& fileName);
|
||||
void fullDiskError(torrent_handle& h);
|
||||
void trackerError(const QString& hash, const QString& time, const QString& msg);
|
||||
void portListeningFailure();
|
||||
void trackerAuthenticationRequired(torrent_handle& h);
|
||||
void downloadFromUrlFailure(const QString& url, const QString& error);
|
||||
void scanDirFoundTorrents(const QStringList& pathList);
|
||||
void newDownloadedTorrent(const QString& path, const QString& url);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -42,7 +42,7 @@ class downloadThread : public QThread {
|
|||
QWaitCondition condition;
|
||||
|
||||
signals:
|
||||
void downloadFinished(QString url, QString file_path, int return_code, QString errorBuffer);
|
||||
void downloadFinished(const QString& url, const QString& file_path, int return_code, const QString& errorBuffer);
|
||||
|
||||
public:
|
||||
downloadThread(QObject* parent) : QThread(parent){}
|
||||
|
@ -144,6 +144,7 @@ class downloadThread : public QThread {
|
|||
qDebug("In Download thread RUN, mutex unlocked (no urls) -> stopping");
|
||||
break;
|
||||
}
|
||||
SleeperThread::msleep(500);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -317,10 +317,14 @@ void options_imp::loadOptions(){
|
|||
strValue = settings.value("ScanDir", QString()).toString();
|
||||
if(!strValue.isEmpty()){
|
||||
enableScan_checkBox->setChecked(true);
|
||||
lbl_scanDir->setEnabled(true);
|
||||
scanDir->setEnabled(true);
|
||||
browse_button_scan->setEnabled(true);
|
||||
scanDir->setText(strValue);
|
||||
}else{
|
||||
enableScan_checkBox->setChecked(false);
|
||||
lbl_scanDir->setEnabled(false);
|
||||
browse_button_scan->setEnabled(false);
|
||||
scanDir->setEnabled(false);
|
||||
}
|
||||
// End Main options
|
||||
|
|
|
@ -100,6 +100,7 @@ properties::properties(QWidget *parent, torrent_handle h, QStringList trackerErr
|
|||
}
|
||||
|
||||
properties::~properties(){
|
||||
qDebug("Properties destroyed");
|
||||
delete updateProgressTimer;
|
||||
delete PropDelegate;
|
||||
delete PropListModel;
|
||||
|
|
|
@ -86,7 +86,14 @@ class torrentAdditionDialog : public QDialog, private Ui_addTorrentDialog{
|
|||
// Setting file name
|
||||
fileName = QString(t.name().c_str());
|
||||
fileHash = QString(misc::toString(t.info_hash()).c_str());
|
||||
fileNameLbl->setText("<center><b>"+fileName+"</b></center>");
|
||||
// Use left() to remove .old extension
|
||||
QString newFileName;
|
||||
if(fileName.endsWith(".old")){
|
||||
newFileName = fileName.left(fileName.size()-4);
|
||||
}else{
|
||||
newFileName = fileName;
|
||||
}
|
||||
fileNameLbl->setText("<center><b>"+newFileName+"</b></center>");
|
||||
// List files in torrent
|
||||
for(int i=0; i<t.num_files(); ++i){
|
||||
QStringList line;
|
||||
|
|
Loading…
Reference in a new issue