mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-10 23:07:59 +00:00
- Fixed some signals/slots (safer)
- Forgot to remove temp file when the file was downloaded from an url (rare occasions)
This commit is contained in:
parent
8c05caba3a
commit
325a588526
1
TODO
1
TODO
@ -44,6 +44,7 @@
|
||||
* beta3
|
||||
- Windows port (Chris - Peerkoel)
|
||||
- Translations update
|
||||
- Allow to abort a searchby launching another one
|
||||
* beta2
|
||||
- Improve RSS code + cleanup (chris)
|
||||
- Wait for some bug fixes in libtorrent :
|
||||
|
@ -115,7 +115,7 @@ void FinishedTorrents::addFinishedSHA(QString hash){
|
||||
}
|
||||
|
||||
// Set the color of a row in data model
|
||||
void FinishedTorrents::setRowColor(int row, const QString& color){
|
||||
void FinishedTorrents::setRowColor(int row, QString color){
|
||||
for(int i=0; i<finishedListModel->columnCount(); ++i){
|
||||
finishedListModel->setData(finishedListModel->index(row, i), QVariant(QColor(color)), Qt::TextColorRole);
|
||||
}
|
||||
@ -271,7 +271,7 @@ QStringList FinishedTorrents::getFinishedSHAs(){
|
||||
return finishedSHAs;
|
||||
}
|
||||
|
||||
int FinishedTorrents::getRowFromHash(const QString& hash) const{
|
||||
int FinishedTorrents::getRowFromHash(QString hash) const{
|
||||
unsigned int nbRows = finishedListModel->rowCount();
|
||||
for(unsigned int i=0; i<nbRows; ++i){
|
||||
if(finishedListModel->data(finishedListModel->index(i, HASH)) == hash){
|
||||
|
@ -45,7 +45,7 @@ class FinishedTorrents : public QWidget, public Ui::seeding{
|
||||
QTreeView* getFinishedList();
|
||||
QStandardItemModel* getFinishedListModel();
|
||||
bool loadColWidthFinishedList();
|
||||
int getRowFromHash(const QString& hash) const;
|
||||
int getRowFromHash(QString hash) const;
|
||||
|
||||
public slots:
|
||||
void addFinishedSHA(QString sha);
|
||||
@ -54,7 +54,7 @@ class FinishedTorrents : public QWidget, public Ui::seeding{
|
||||
void showProperties(const QModelIndex &index);
|
||||
void propertiesSelection();
|
||||
void displayFinishedListMenu(const QPoint&);
|
||||
void setRowColor(int row, const QString& color);
|
||||
void setRowColor(int row, QString color);
|
||||
void saveColWidthFinishedList() const;
|
||||
void sortFinishedList(int index);
|
||||
void sortFinishedListFloat(int index, Qt::SortOrder sortOrder);
|
||||
|
70
src/GUI.cpp
70
src/GUI.cpp
@ -140,23 +140,23 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent){
|
||||
// Hide hash column
|
||||
downloadList->hideColumn(HASH);
|
||||
|
||||
connect(BTSession, SIGNAL(addedTorrent(const QString&, torrent_handle&, bool)), this, SLOT(torrentAdded(const QString&, torrent_handle&, bool)));
|
||||
connect(BTSession, SIGNAL(duplicateTorrent(const QString&)), this, SLOT(torrentDuplicate(const QString&)));
|
||||
connect(BTSession, SIGNAL(invalidTorrent(const QString&)), this, SLOT(torrentCorrupted(const QString&)));
|
||||
connect(BTSession, SIGNAL(addedTorrent(QString, torrent_handle&, bool)), this, SLOT(torrentAdded(QString, torrent_handle&, bool)));
|
||||
connect(BTSession, SIGNAL(duplicateTorrent(QString)), this, SLOT(torrentDuplicate(QString)));
|
||||
connect(BTSession, SIGNAL(invalidTorrent(QString)), this, SLOT(torrentCorrupted(QString)));
|
||||
connect(BTSession, SIGNAL(finishedTorrent(torrent_handle&)), this, SLOT(finishedTorrent(torrent_handle&)));
|
||||
connect(BTSession, SIGNAL(fullDiskError(torrent_handle&)), this, SLOT(fullDiskError(torrent_handle&)));
|
||||
connect(BTSession, SIGNAL(portListeningFailure()), this, SLOT(portListeningFailure()));
|
||||
connect(BTSession, SIGNAL(trackerError(const QString&, const QString&, const QString&)), this, SLOT(trackerError(const QString&, const QString&, const QString&)));
|
||||
connect(BTSession, SIGNAL(trackerError(QString, QString, QString)), this, SLOT(trackerError(QString, QString, QString)));
|
||||
connect(BTSession,SIGNAL(allTorrentsFinishedChecking()), this, SLOT(sortProgressColumnDelayed()));
|
||||
connect(BTSession, SIGNAL(trackerAuthenticationRequired(torrent_handle&)), this, SLOT(trackerAuthenticationRequired(torrent_handle&)));
|
||||
connect(BTSession, SIGNAL(peerBlocked(const QString&)), this, SLOT(addLogPeerBlocked(const QString)));
|
||||
connect(BTSession, SIGNAL(peerBlocked(QString)), this, SLOT(addLogPeerBlocked(const QString)));
|
||||
connect(BTSession, SIGNAL(scanDirFoundTorrents(const QStringList&)), this, SLOT(processScannedFiles(const QStringList&)));
|
||||
connect(BTSession, SIGNAL(newDownloadedTorrent(const QString&, const QString&)), this, SLOT(processDownloadedFiles(const QString&, const QString&)));
|
||||
connect(BTSession, SIGNAL(downloadFromUrlFailure(const QString&, const QString&)), this, SLOT(handleDownloadFromUrlFailure(const QString&, const QString&)));
|
||||
connect(BTSession, SIGNAL(aboutToDownloadFromUrl(const QString&)), this, SLOT(displayDownloadingUrlInfos(const QString&)));
|
||||
connect(BTSession, SIGNAL(newDownloadedTorrent(QString, QString)), this, SLOT(processDownloadedFiles(QString, QString)));
|
||||
connect(BTSession, SIGNAL(downloadFromUrlFailure(QString, QString)), this, SLOT(handleDownloadFromUrlFailure(QString, QString)));
|
||||
connect(BTSession, SIGNAL(aboutToDownloadFromUrl(QString)), this, SLOT(displayDownloadingUrlInfos(QString)));
|
||||
// creating options
|
||||
options = new options_imp(this);
|
||||
connect(options, SIGNAL(status_changed(const QString&, bool)), this, SLOT(OptionsSaved(const QString&, bool)));
|
||||
connect(options, SIGNAL(status_changed(QString, bool)), this, SLOT(OptionsSaved(QString, bool)));
|
||||
// Configure BT session according to options
|
||||
configureSession(true);
|
||||
force_exit = false;
|
||||
@ -298,7 +298,7 @@ void GUI::readSettings() {
|
||||
settings.endGroup();
|
||||
}
|
||||
|
||||
void GUI::addLogPeerBlocked(const QString& ip){
|
||||
void GUI::addLogPeerBlocked(QString ip){
|
||||
static unsigned short nbLines = 0;
|
||||
++nbLines;
|
||||
if(nbLines > 200){
|
||||
@ -309,7 +309,7 @@ void GUI::addLogPeerBlocked(const QString& ip){
|
||||
}
|
||||
|
||||
// Update Info Bar information
|
||||
void GUI::setInfoBar(const QString& info, const QString& color){
|
||||
void GUI::setInfoBar(QString info, QString color){
|
||||
qDebug("setInfoBar called");
|
||||
static unsigned short nbLines = 0;
|
||||
++nbLines;
|
||||
@ -395,7 +395,7 @@ void GUI::on_actionSet_upload_limit_triggered(){
|
||||
new BandwidthAllocationDialog(this, true, BTSession, hashes);
|
||||
}
|
||||
|
||||
void GUI::handleDownloadFromUrlFailure(const QString& url, const QString& reason){
|
||||
void GUI::handleDownloadFromUrlFailure(QString url, QString reason){
|
||||
// Display a message box
|
||||
QMessageBox::critical(0, tr("Url download error"), tr("Couldn't download file at url: %1, reason: %2.").arg(url).arg(reason));
|
||||
}
|
||||
@ -491,7 +491,7 @@ void GUI::displayGUIMenu(const QPoint& pos){
|
||||
myGUIMenu.exec(mapToGlobal(pos));
|
||||
}
|
||||
|
||||
void GUI::previewFile(const QString& filePath){
|
||||
void GUI::previewFile(QString filePath){
|
||||
// Check if there is already one preview running
|
||||
if(previewProcess->state() == QProcess::NotRunning){
|
||||
// First copy temporarily
|
||||
@ -927,8 +927,8 @@ void GUI::dropEvent(QDropEvent *event){
|
||||
foreach(file, files){
|
||||
if(useTorrentAdditionDialog){
|
||||
torrentAdditionDialog *dialog = new torrentAdditionDialog(this);
|
||||
connect(dialog, SIGNAL(torrentAddition(const QString&, bool, bool, const QString&)), BTSession, SLOT(addTorrent(const QString&, bool, bool, const QString&)));
|
||||
connect(dialog, SIGNAL(setInfoBarGUI(const QString&, const QString&)), this, SLOT(setInfoBar(const QString&, const QString&)));
|
||||
connect(dialog, SIGNAL(torrentAddition(QString, bool, bool, QString)), BTSession, SLOT(addTorrent(QString, bool, bool, QString)));
|
||||
connect(dialog, SIGNAL(setInfoBarGUI(QString, QString)), this, SLOT(setInfoBar(QString, QString)));
|
||||
dialog->showLoad(file.trimmed().replace("file://", ""));
|
||||
}else{
|
||||
BTSession->addTorrent(file.trimmed().replace("file://", ""));
|
||||
@ -966,8 +966,8 @@ void GUI::on_actionOpen_triggered(){
|
||||
for(unsigned int i=0; i<listSize; ++i){
|
||||
if(useTorrentAdditionDialog){
|
||||
torrentAdditionDialog *dialog = new torrentAdditionDialog(this);
|
||||
connect(dialog, SIGNAL(torrentAddition(const QString&, bool, bool, const QString&)), BTSession, SLOT(addTorrent(const QString&, bool, bool, const QString&)));
|
||||
connect(dialog, SIGNAL(setInfoBarGUI(const QString&, const QString&)), this, SLOT(setInfoBar(const QString&, const QString&)));
|
||||
connect(dialog, SIGNAL(torrentAddition(QString, bool, bool, QString)), BTSession, SLOT(addTorrent(QString, bool, bool, QString)));
|
||||
connect(dialog, SIGNAL(setInfoBarGUI(QString, QString)), this, SLOT(setInfoBar(QString, QString)));
|
||||
dialog->showLoad(pathsList.at(i));
|
||||
}else{
|
||||
BTSession->addTorrent(pathsList.at(i));
|
||||
@ -1124,7 +1124,7 @@ void GUI::on_actionDelete_triggered(){
|
||||
}
|
||||
|
||||
// Called when a torrent is added
|
||||
void GUI::torrentAdded(const QString& path, torrent_handle& h, bool fastResume){
|
||||
void GUI::torrentAdded(QString path, torrent_handle& h, bool fastResume){
|
||||
QString hash = QString(misc::toString(h.info_hash()).c_str());
|
||||
if(QFile::exists(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+hash+".finished")){
|
||||
finishedTorrentTab->addFinishedSHA(hash);
|
||||
@ -1159,11 +1159,11 @@ void GUI::torrentAdded(const QString& path, torrent_handle& h, bool fastResume){
|
||||
}
|
||||
|
||||
// Called when trying to add a duplicate torrent
|
||||
void GUI::torrentDuplicate(const QString& path){
|
||||
void GUI::torrentDuplicate(QString path){
|
||||
setInfoBar(tr("'%1' is already in download list.", "e.g: 'xxx.avi' is already in download list.").arg(path));
|
||||
}
|
||||
|
||||
void GUI::torrentCorrupted(const QString& path){
|
||||
void GUI::torrentCorrupted(QString path){
|
||||
setInfoBar(tr("Unable to decode torrent file: '%1'", "e.g: Unable to decode torrent file: '/home/y/xxx.torrent'").arg(path), "red");
|
||||
setInfoBar(tr("This file is either corrupted or this isn't a torrent."),"red");
|
||||
}
|
||||
@ -1183,8 +1183,8 @@ void GUI::processParams(const QStringList& params){
|
||||
}else{
|
||||
if(useTorrentAdditionDialog){
|
||||
torrentAdditionDialog *dialog = new torrentAdditionDialog(this);
|
||||
connect(dialog, SIGNAL(torrentAddition(const QString&, bool, bool, const QString&)), BTSession, SLOT(addTorrent(const QString&, bool, bool, const QString&)));
|
||||
connect(dialog, SIGNAL(setInfoBarGUI(const QString&, const QString&)), this, SLOT(setInfoBar(const QString&, const QString&)));
|
||||
connect(dialog, SIGNAL(torrentAddition(QString, bool, bool, QString)), BTSession, SLOT(addTorrent(QString, bool, bool, QString)));
|
||||
connect(dialog, SIGNAL(setInfoBarGUI(QString, QString)), this, SLOT(setInfoBar(QString, QString)));
|
||||
dialog->showLoad(param);
|
||||
}else{
|
||||
BTSession->addTorrent(param);
|
||||
@ -1200,8 +1200,8 @@ void GUI::processScannedFiles(const QStringList& params){
|
||||
foreach(param, params){
|
||||
if(useTorrentAdditionDialog){
|
||||
torrentAdditionDialog *dialog = new torrentAdditionDialog(this);
|
||||
connect(dialog, SIGNAL(torrentAddition(const QString&, bool, bool, const QString&)), BTSession, SLOT(addTorrent(const QString&, bool, bool, const QString&)));
|
||||
connect(dialog, SIGNAL(setInfoBarGUI(const QString&, const QString&)), this, SLOT(setInfoBar(const QString&, const QString&)));
|
||||
connect(dialog, SIGNAL(torrentAddition(QString, bool, bool, QString)), BTSession, SLOT(addTorrent(QString, bool, bool, QString)));
|
||||
connect(dialog, SIGNAL(setInfoBarGUI(QString, QString)), this, SLOT(setInfoBar(QString, QString)));
|
||||
dialog->showLoad(param, true);
|
||||
}else{
|
||||
BTSession->addTorrent(param, true);
|
||||
@ -1209,13 +1209,13 @@ void GUI::processScannedFiles(const QStringList& params){
|
||||
}
|
||||
}
|
||||
|
||||
void GUI::processDownloadedFiles(const QString& path, const QString& url){
|
||||
void GUI::processDownloadedFiles(QString path, QString url){
|
||||
QSettings settings("qBittorrent", "qBittorrent");
|
||||
bool useTorrentAdditionDialog = settings.value("Options/Misc/TorrentAdditionDialog/Enabled", true).toBool();
|
||||
if(useTorrentAdditionDialog){
|
||||
torrentAdditionDialog *dialog = new torrentAdditionDialog(this);
|
||||
connect(dialog, SIGNAL(torrentAddition(const QString&, bool, bool, const QString&)), BTSession, SLOT(addTorrent(const QString&, bool, bool, const QString&)));
|
||||
connect(dialog, SIGNAL(setInfoBarGUI(const QString&, const QString&)), this, SLOT(setInfoBar(const QString&, const QString&)));
|
||||
connect(dialog, SIGNAL(torrentAddition(QString, bool, bool, QString)), BTSession, SLOT(addTorrent(QString, bool, bool, QString)));
|
||||
connect(dialog, SIGNAL(setInfoBarGUI(QString, QString)), this, SLOT(setInfoBar(QString, QString)));
|
||||
dialog->showLoad(path, false, url);
|
||||
}else{
|
||||
BTSession->addTorrent(path, false, false, url);
|
||||
@ -1230,11 +1230,11 @@ void GUI::showProperties(const QModelIndex &index){
|
||||
QStringList errors = trackerErrors.value(fileHash, QStringList(tr("None", "i.e: No error message")));
|
||||
properties *prop = new properties(this, BTSession, h, errors);
|
||||
connect(prop, SIGNAL(mustHaveFullAllocationMode(torrent_handle)), BTSession, SLOT(reloadTorrent(torrent_handle)));
|
||||
connect(prop, SIGNAL(filteredFilesChanged(const QString&)), this, SLOT(updateFileSize(const QString&)));
|
||||
connect(prop, SIGNAL(filteredFilesChanged(QString)), this, SLOT(updateFileSize(QString)));
|
||||
prop->show();
|
||||
}
|
||||
|
||||
void GUI::updateFileSize(const QString& hash){
|
||||
void GUI::updateFileSize(QString hash){
|
||||
int row = getRowFromHash(hash);
|
||||
DLListModel->setData(DLListModel->index(row, SIZE), QVariant((qlonglong)BTSession->torrentEffectiveSize(hash)));
|
||||
}
|
||||
@ -1527,7 +1527,7 @@ void GUI::portListeningFailure(){
|
||||
}
|
||||
|
||||
// Called when we receive an error from tracker
|
||||
void GUI::trackerError(const QString& hash, const QString& time, const QString& msg){
|
||||
void GUI::trackerError(QString hash, QString time, QString msg){
|
||||
// Check trackerErrors list size and clear it if it is too big
|
||||
if(trackerErrors.size() > 50){
|
||||
trackerErrors.clear();
|
||||
@ -1594,7 +1594,7 @@ void GUI::checkConnectionStatus(){
|
||||
*****************************************************/
|
||||
|
||||
// Set the color of a row in data model
|
||||
void GUI::setRowColor(int row, const QString& color){
|
||||
void GUI::setRowColor(int row, QString color){
|
||||
unsigned int nbColumns = DLListModel->columnCount();
|
||||
for(unsigned int i=0; i<nbColumns; ++i){
|
||||
DLListModel->setData(DLListModel->index(row, i), QVariant(QColor(color)), Qt::TextColorRole);
|
||||
@ -1603,7 +1603,7 @@ void GUI::setRowColor(int row, const QString& color){
|
||||
|
||||
// return the row of in data model
|
||||
// corresponding to the given the filehash
|
||||
int GUI::getRowFromHash(const QString& hash) const{
|
||||
int GUI::getRowFromHash(QString hash) const{
|
||||
unsigned int nbRows = DLListModel->rowCount();
|
||||
for(unsigned int i=0; i<nbRows; ++i){
|
||||
if(DLListModel->data(DLListModel->index(i, HASH)) == hash){
|
||||
@ -1617,7 +1617,7 @@ void GUI::downloadFromURLList(const QStringList& urls){
|
||||
BTSession->downloadFromURLList(urls);
|
||||
}
|
||||
|
||||
void GUI::displayDownloadingUrlInfos(const QString& url){
|
||||
void GUI::displayDownloadingUrlInfos(QString url){
|
||||
setInfoBar(tr("Downloading '%1', please wait...", "e.g: Downloading 'xxx.torrent', please wait...").arg(url), "black");
|
||||
}
|
||||
|
||||
@ -1652,12 +1652,12 @@ void GUI::createTrayIcon(){
|
||||
// Display Program Options
|
||||
void GUI::on_actionOptions_triggered(){
|
||||
options = new options_imp(this);
|
||||
connect(options, SIGNAL(status_changed(const QString&, bool)), this, SLOT(OptionsSaved(const QString&, bool)));
|
||||
connect(options, SIGNAL(status_changed(QString, bool)), this, SLOT(OptionsSaved(QString, bool)));
|
||||
options->show();
|
||||
}
|
||||
|
||||
// Is executed each time options are saved
|
||||
void GUI::OptionsSaved(const QString& info, bool deleteOptions){
|
||||
void GUI::OptionsSaved(QString info, bool deleteOptions){
|
||||
bool newSystrayIntegration = options->useSystrayIntegration();
|
||||
if(newSystrayIntegration && !systrayIntegration){
|
||||
// create the trayicon
|
||||
|
28
src/GUI.h
28
src/GUI.h
@ -120,7 +120,7 @@ class GUI : public QMainWindow, private Ui::MainWindow{
|
||||
void dragEnterEvent(QDragEnterEvent *event);
|
||||
void toggleVisibility(QSystemTrayIcon::ActivationReason e);
|
||||
void on_actionAbout_triggered();
|
||||
void setInfoBar(const QString& info, const QString& color="black");
|
||||
void setInfoBar(QString info, QString color="black");
|
||||
void updateDlList(bool force=false);
|
||||
void on_actionCreate_torrent_triggered();
|
||||
void on_actionClearLog_triggered();
|
||||
@ -139,21 +139,21 @@ class GUI : public QMainWindow, private Ui::MainWindow{
|
||||
void displayInfoBarMenu(const QPoint& pos);
|
||||
void displayGUIMenu(const QPoint& pos);
|
||||
void on_actionPreview_file_triggered();
|
||||
void previewFile(const QString& filePath);
|
||||
void previewFile(QString filePath);
|
||||
void cleanTempPreviewFile(int, QProcess::ExitStatus);
|
||||
void balloonClicked();
|
||||
void writeSettings();
|
||||
void readSettings();
|
||||
void on_actionExit_triggered();
|
||||
void createTrayIcon();
|
||||
void addLogPeerBlocked(const QString&);
|
||||
void addLogPeerBlocked(QString);
|
||||
// Keyboard shortcuts
|
||||
void createKeyboardShortcuts();
|
||||
void displayDownTab();
|
||||
void displayUpTab();
|
||||
void displaySearchTab();
|
||||
void displayRSSTab();
|
||||
void handleDownloadFromUrlFailure(const QString&, const QString&);
|
||||
void handleDownloadFromUrlFailure(QString, QString);
|
||||
// Torrent actions
|
||||
void showProperties(const QModelIndex &index);
|
||||
void on_actionTorrent_Properties_triggered();
|
||||
@ -175,29 +175,29 @@ class GUI : public QMainWindow, private Ui::MainWindow{
|
||||
void processParams(const QStringList& params);
|
||||
void addUnauthenticatedTracker(QPair<torrent_handle,std::string> tracker);
|
||||
void processScannedFiles(const QStringList& params);
|
||||
void processDownloadedFiles(const QString& path, const QString& url);
|
||||
void processDownloadedFiles(QString path, QString url);
|
||||
void downloadFromURLList(const QStringList& urls);
|
||||
void displayDownloadingUrlInfos(const QString& url);
|
||||
void displayDownloadingUrlInfos(QString url);
|
||||
// Utils slots
|
||||
void setRowColor(int row, const QString& color);
|
||||
void setRowColor(int row, QString color);
|
||||
// Options slots
|
||||
void on_actionOptions_triggered();
|
||||
void OptionsSaved(const QString& info, bool deleteOptions);
|
||||
void OptionsSaved(QString info, bool deleteOptions);
|
||||
// HTTP slots
|
||||
void on_actionDownload_from_URL_triggered();
|
||||
|
||||
|
||||
public slots:
|
||||
void torrentAdded(const QString& path, torrent_handle& h, bool fastResume);
|
||||
void torrentDuplicate(const QString& path);
|
||||
void torrentCorrupted(const QString& path);
|
||||
void torrentAdded(QString path, torrent_handle& h, bool fastResume);
|
||||
void torrentDuplicate(QString path);
|
||||
void torrentCorrupted(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 trackerError(QString hash, QString time, QString msg);
|
||||
void trackerAuthenticationRequired(torrent_handle& h);
|
||||
void setTabText(int index, QString text);
|
||||
void updateFileSize(const QString& hash);
|
||||
void updateFileSize(QString hash);
|
||||
void sortProgressColumnDelayed();
|
||||
|
||||
protected:
|
||||
@ -209,7 +209,7 @@ class GUI : public QMainWindow, private Ui::MainWindow{
|
||||
GUI(QWidget *parent=0, QStringList torrentCmdLine=QStringList());
|
||||
~GUI();
|
||||
// Methods
|
||||
int getRowFromHash(const QString& hash) const;
|
||||
int getRowFromHash(QString hash) const;
|
||||
QPoint screenCenter();
|
||||
};
|
||||
|
||||
|
@ -50,8 +50,8 @@ bittorrent::bittorrent(){
|
||||
ETARefresher.start(6000);
|
||||
// To download from urls
|
||||
downloader = new downloadThread(this);
|
||||
connect(downloader, SIGNAL(downloadFinished(const QString&, const QString&)), this, SLOT(processDownloadedFile(const QString&, const QString&)));
|
||||
connect(downloader, SIGNAL(downloadFailure(const QString&, const QString&)), this, SLOT(HandleDownloadFailure(const QString&, const QString&)));
|
||||
connect(downloader, SIGNAL(downloadFinished(QString, QString)), this, SLOT(processDownloadedFile(QString, QString)));
|
||||
connect(downloader, SIGNAL(downloadFailure(QString, QString)), this, SLOT(HandleDownloadFailure(QString, QString)));
|
||||
}
|
||||
|
||||
// Main destructor
|
||||
@ -79,7 +79,7 @@ void bittorrent::setUploadLimit(QString hash, int val){
|
||||
saveTorrentSpeedLimits(hash);
|
||||
}
|
||||
|
||||
void bittorrent::HandleDownloadFailure(const QString& url, const QString& reason){
|
||||
void bittorrent::HandleDownloadFailure(QString url, QString reason){
|
||||
emit downloadFromUrlFailure(url, reason);
|
||||
}
|
||||
|
||||
@ -114,13 +114,13 @@ long bittorrent::getETA(QString hash) const{
|
||||
}
|
||||
|
||||
// Return the torrent handle, given its hash
|
||||
torrent_handle bittorrent::getTorrentHandle(const QString& hash) const{
|
||||
torrent_handle bittorrent::getTorrentHandle(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{
|
||||
bool bittorrent::isPaused(QString hash) const{
|
||||
torrent_handle h = s->find_torrent(misc::fromString<sha1_hash>((hash.toStdString())));
|
||||
if(!h.is_valid()){
|
||||
qDebug("/!\\ Error: Invalid handle");
|
||||
@ -131,7 +131,7 @@ bool bittorrent::isPaused(const QString& hash) const{
|
||||
|
||||
// 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){
|
||||
void bittorrent::deleteTorrent(QString hash, bool permanent){
|
||||
torrent_handle h = s->find_torrent(misc::fromString<sha1_hash>((hash.toStdString())));
|
||||
if(!h.is_valid()){
|
||||
qDebug("/!\\ Error: Invalid handle");
|
||||
@ -176,7 +176,7 @@ void bittorrent::cleanDeleter(deleteThread* deleter){
|
||||
}
|
||||
|
||||
// Pause a running torrent
|
||||
void bittorrent::pauseTorrent(const QString& hash){
|
||||
void bittorrent::pauseTorrent(QString hash){
|
||||
torrent_handle h = s->find_torrent(misc::fromString<sha1_hash>((hash.toStdString())));
|
||||
if(h.is_valid() && !h.is_paused()){
|
||||
h.pause();
|
||||
@ -193,7 +193,7 @@ void bittorrent::pauseTorrent(const QString& hash){
|
||||
}
|
||||
|
||||
// Resume a torrent in paused state
|
||||
void bittorrent::resumeTorrent(const QString& hash){
|
||||
void bittorrent::resumeTorrent(QString hash){
|
||||
torrent_handle h = s->find_torrent(misc::fromString<sha1_hash>((hash.toStdString())));
|
||||
if(h.is_valid() && h.is_paused()){
|
||||
h.resume();
|
||||
@ -203,7 +203,7 @@ void bittorrent::resumeTorrent(const QString& hash){
|
||||
}
|
||||
|
||||
// Add a torrent to the bittorrent session
|
||||
void bittorrent::addTorrent(const QString& path, bool fromScanDir, bool onStartup, const QString& from_url){
|
||||
void bittorrent::addTorrent(QString path, bool fromScanDir, bool onStartup, QString from_url){
|
||||
torrent_handle h;
|
||||
entry resume_data;
|
||||
bool fastResume=false;
|
||||
@ -240,6 +240,8 @@ void bittorrent::addTorrent(const QString& path, bool fromScanDir, bool onStartu
|
||||
// Update info Bar
|
||||
if(!fromScanDir){
|
||||
if(!from_url.isNull()){
|
||||
// If download from url, remove temp file
|
||||
QFile::remove(file);
|
||||
emit duplicateTorrent(from_url);
|
||||
}else{
|
||||
emit duplicateTorrent(file);
|
||||
@ -288,6 +290,8 @@ void bittorrent::addTorrent(const QString& path, bool fromScanDir, bool onStartu
|
||||
if(!h.is_valid()){
|
||||
// No need to keep on, it failed.
|
||||
qDebug("/!\\ Error: Invalid handle");
|
||||
// If download from url, remove temp file
|
||||
if(!from_url.isNull()) QFile::remove(file);
|
||||
return;
|
||||
}
|
||||
// Is this really useful and appropriate ?
|
||||
@ -326,11 +330,8 @@ void bittorrent::addTorrent(const QString& path, bool fromScanDir, bool onStartu
|
||||
qDebug("Incremental download enabled for %s", t.name().c_str());
|
||||
h.set_sequenced_download_threshold(15);
|
||||
}
|
||||
// If download from url
|
||||
if(!from_url.isNull()){
|
||||
// remove temporary file
|
||||
QFile::remove(file);
|
||||
}
|
||||
// If download from url, remove temp file
|
||||
if(!from_url.isNull()) QFile::remove(file);
|
||||
// Delete from scan dir to avoid trying to download it again
|
||||
if(fromScanDir){
|
||||
QFile::remove(file);
|
||||
@ -383,7 +384,7 @@ void bittorrent::setMaxConnections(int maxConnec){
|
||||
|
||||
// Check in .priorities file if the user filtered files
|
||||
// in this torrent.
|
||||
bool bittorrent::hasFilteredFiles(const QString& fileHash) const{
|
||||
bool bittorrent::hasFilteredFiles(QString fileHash) const{
|
||||
QFile pieces_file(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+fileHash+".priorities");
|
||||
// Read saved file
|
||||
if(!pieces_file.open(QIODevice::ReadOnly | QIODevice::Text)){
|
||||
@ -638,7 +639,7 @@ void bittorrent::saveFastResumeData(){
|
||||
qDebug("Fast resume data saved");
|
||||
}
|
||||
|
||||
bool bittorrent::isFilePreviewPossible(const QString& hash) const{
|
||||
bool bittorrent::isFilePreviewPossible(QString hash) const{
|
||||
// See if there are supported files in the torrent
|
||||
torrent_handle h = s->find_torrent(misc::fromString<sha1_hash>((hash.toStdString())));
|
||||
if(!h.is_valid()){
|
||||
@ -675,12 +676,12 @@ void bittorrent::scanDirectory(){
|
||||
}
|
||||
}
|
||||
|
||||
void bittorrent::setDefaultSavePath(const QString& savepath){
|
||||
void bittorrent::setDefaultSavePath(QString savepath){
|
||||
defaultSavePath = savepath;
|
||||
}
|
||||
|
||||
// Enable directory scanning
|
||||
void bittorrent::enableDirectoryScanning(const QString& _scan_dir){
|
||||
void bittorrent::enableDirectoryScanning(QString _scan_dir){
|
||||
if(!_scan_dir.isEmpty()){
|
||||
scan_dir = _scan_dir;
|
||||
timerScan = new QTimer(this);
|
||||
@ -736,7 +737,7 @@ void bittorrent::setGlobalRatio(float ratio){
|
||||
}
|
||||
}
|
||||
|
||||
bool bittorrent::loadTrackerFile(const QString& hash){
|
||||
bool bittorrent::loadTrackerFile(QString hash){
|
||||
QDir torrentBackup(misc::qBittorrentPath() + "BT_backup");
|
||||
QFile tracker_file(torrentBackup.path()+QDir::separator()+ hash + ".trackers");
|
||||
if(!tracker_file.exists()) return false;
|
||||
@ -760,7 +761,7 @@ bool bittorrent::loadTrackerFile(const QString& hash){
|
||||
}
|
||||
}
|
||||
|
||||
void bittorrent::saveTrackerFile(const QString& hash){
|
||||
void bittorrent::saveTrackerFile(QString hash){
|
||||
QDir torrentBackup(misc::qBittorrentPath() + "BT_backup");
|
||||
QFile tracker_file(torrentBackup.path()+QDir::separator()+ hash + ".trackers");
|
||||
if(tracker_file.exists()){
|
||||
@ -976,13 +977,13 @@ session_status bittorrent::getSessionStatus() const{
|
||||
return s->status();
|
||||
}
|
||||
|
||||
bool bittorrent::inFullAllocationMode(const QString& hash) const{
|
||||
bool bittorrent::inFullAllocationMode(QString hash) const{
|
||||
if(fullAllocationModeList.indexOf(hash) != -1)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
QString bittorrent::getSavePath(const QString& hash){
|
||||
QString bittorrent::getSavePath(QString hash){
|
||||
QFile savepath_file(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+hash+".savepath");
|
||||
QByteArray line;
|
||||
QString savePath;
|
||||
@ -1011,14 +1012,14 @@ QString bittorrent::getSavePath(const QString& hash){
|
||||
// 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){
|
||||
void bittorrent::downloadFromUrl(QString url){
|
||||
emit aboutToDownloadFromUrl(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){
|
||||
void bittorrent::processDownloadedFile(QString url, QString file_path){
|
||||
// Add file to torrent download list
|
||||
emit newDownloadedTorrent(file_path, url);
|
||||
}
|
||||
|
@ -66,17 +66,17 @@ class bittorrent : public QObject{
|
||||
QList<QString> fullAllocationModeList;
|
||||
|
||||
protected:
|
||||
QString getSavePath(const QString& hash);
|
||||
QString getSavePath(QString hash);
|
||||
|
||||
public:
|
||||
// Constructor / Destructor
|
||||
bittorrent();
|
||||
~bittorrent();
|
||||
torrent_handle getTorrentHandle(const QString& hash) const;
|
||||
torrent_handle getTorrentHandle(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 isPaused(QString hash) const;
|
||||
bool hasFilteredFiles(QString fileHash) const;
|
||||
bool isFilePreviewPossible(QString fileHash) const;
|
||||
bool isDHTEnabled() const;
|
||||
float getPayloadDownloadRate() const;
|
||||
float getPayloadUploadRate() const;
|
||||
@ -87,24 +87,24 @@ class bittorrent : public QObject{
|
||||
QStringList getUncheckedTorrentsList() const;
|
||||
long getETA(QString hash) const;
|
||||
size_type torrentEffectiveSize(QString hash) const;
|
||||
bool inFullAllocationMode(const QString& hash) const;
|
||||
bool inFullAllocationMode(QString hash) const;
|
||||
float getRealRatio(QString hash) const;
|
||||
session* getSession() const;
|
||||
|
||||
public slots:
|
||||
void addTorrent(const QString& path, bool fromScanDir = false, bool onStartup = false, const QString& from_url = QString());
|
||||
void downloadFromUrl(const QString& url);
|
||||
void addTorrent(QString path, bool fromScanDir = false, bool onStartup = false, QString from_url = QString());
|
||||
void downloadFromUrl(QString url);
|
||||
void downloadFromURLList(const QStringList& url_list);
|
||||
void deleteTorrent(const QString& hash, bool permanent = false);
|
||||
void pauseTorrent(const QString& hash);
|
||||
void deleteTorrent(QString hash, bool permanent = false);
|
||||
void pauseTorrent(QString hash);
|
||||
bool pauseAllTorrents();
|
||||
bool resumeAllTorrents();
|
||||
void resumeTorrent(const QString& hash);
|
||||
void resumeTorrent(QString hash);
|
||||
void enableDHT();
|
||||
void disableDHT();
|
||||
void saveDHTEntry();
|
||||
void saveFastResumeData();
|
||||
void enableDirectoryScanning(const QString& scan_dir);
|
||||
void enableDirectoryScanning(QString scan_dir);
|
||||
void disableDirectoryScanning();
|
||||
void enablePeerExchange();
|
||||
void enableIPFilter(ip_filter filter);
|
||||
@ -117,7 +117,7 @@ class bittorrent : public QObject{
|
||||
void loadTorrentSpeedLimits(QString hash);
|
||||
void saveDownloadUploadForTorrent(QString hash);
|
||||
void loadDownloadUploadForTorrent(QString hash);
|
||||
void HandleDownloadFailure(const QString& url, const QString& reason);
|
||||
void HandleDownloadFailure(QString url, QString reason);
|
||||
// Session configuration - Setters
|
||||
void setListeningPortsRange(std::pair<unsigned short, unsigned short> ports);
|
||||
void setMaxConnections(int maxConnec);
|
||||
@ -127,7 +127,7 @@ class bittorrent : public QObject{
|
||||
void setDHTPort(int dht_port);
|
||||
void setProxySettings(proxy_settings proxySettings, bool trackers=true, bool peers=true, bool web_seeds=true, bool dht=true);
|
||||
void setSessionSettings(session_settings sessionSettings);
|
||||
void setDefaultSavePath(const QString& savepath);
|
||||
void setDefaultSavePath(QString savepath);
|
||||
void applyEncryptionSettings(pe_settings se);
|
||||
void loadFilesPriorities(torrent_handle& h);
|
||||
void setDownloadLimit(QString hash, int val);
|
||||
@ -137,27 +137,27 @@ class bittorrent : public QObject{
|
||||
void cleanDeleter(deleteThread* deleter);
|
||||
void scanDirectory();
|
||||
void readAlerts();
|
||||
void processDownloadedFile(const QString&, const QString&);
|
||||
void processDownloadedFile(QString, QString);
|
||||
void resumeUnfinished();
|
||||
bool loadTrackerFile(const QString& hash);
|
||||
void saveTrackerFile(const QString& hash);
|
||||
bool loadTrackerFile(QString hash);
|
||||
void saveTrackerFile(QString hash);
|
||||
|
||||
signals:
|
||||
void invalidTorrent(const QString& path);
|
||||
void duplicateTorrent(const QString& path);
|
||||
void addedTorrent(const QString& path, torrent_handle& h, bool fastResume);
|
||||
void invalidTorrent(QString path);
|
||||
void duplicateTorrent(QString path);
|
||||
void addedTorrent(QString path, torrent_handle& h, bool fastResume);
|
||||
void finishedTorrent(torrent_handle& h);
|
||||
void fullDiskError(torrent_handle& h);
|
||||
void trackerError(const QString& hash, const QString& time, const QString& msg);
|
||||
void trackerError(QString hash, QString time, QString msg);
|
||||
void portListeningFailure();
|
||||
void trackerAuthenticationRequired(torrent_handle& h);
|
||||
void scanDirFoundTorrents(const QStringList& pathList);
|
||||
void newDownloadedTorrent(const QString& path, const QString& url);
|
||||
void aboutToDownloadFromUrl(const QString& url);
|
||||
void newDownloadedTorrent(QString path, QString url);
|
||||
void aboutToDownloadFromUrl(QString url);
|
||||
void updateFileSize(QString hash);
|
||||
void allTorrentsFinishedChecking();
|
||||
void peerBlocked(const QString&);
|
||||
void downloadFromUrlFailure(const QString& url, const QString& reason);
|
||||
void peerBlocked(QString);
|
||||
void downloadFromUrlFailure(QString url, QString reason);
|
||||
|
||||
};
|
||||
|
||||
|
@ -48,8 +48,8 @@ class downloadThread : public QThread {
|
||||
URLStream url_stream;
|
||||
|
||||
signals:
|
||||
void downloadFinished(const QString& url, const QString& file_path);
|
||||
void downloadFailure(const QString& url, const QString& reason);
|
||||
void downloadFinished(QString url, QString file_path);
|
||||
void downloadFailure(QString url, QString reason);
|
||||
|
||||
public:
|
||||
downloadThread(QObject* parent) : QThread(parent){
|
||||
@ -66,7 +66,7 @@ class downloadThread : public QThread {
|
||||
wait();
|
||||
}
|
||||
|
||||
void downloadUrl(const QString& url){
|
||||
void downloadUrl(QString url){
|
||||
QMutexLocker locker(&mutex);
|
||||
url_list << url;
|
||||
if(!isRunning()){
|
||||
|
@ -128,7 +128,7 @@ class misc : public QObject{
|
||||
return true;
|
||||
}
|
||||
|
||||
static QString findFileInDir(const QString& dir_path, const QString& fileName){
|
||||
static QString findFileInDir(QString dir_path, QString fileName){
|
||||
QDir dir(dir_path);
|
||||
if(dir.exists(fileName)){
|
||||
return dir.filePath(fileName);
|
||||
|
@ -971,7 +971,7 @@ void options_imp::on_browse_button_clicked(){
|
||||
// the rest of the line is ignored
|
||||
//
|
||||
// Lines may be commented using '#' or '//'
|
||||
void options_imp::processFilterFile(const QString& filePath){
|
||||
void options_imp::processFilterFile(QString filePath){
|
||||
qDebug("Processing filter files");
|
||||
filtersList->clear();
|
||||
QString manualFilters= misc::qBittorrentPath() + "ipfilter.dat";
|
||||
|
@ -110,7 +110,7 @@ class options_imp : public QDialog, private Ui::Dialog{
|
||||
void enableProxyAuth(int checkBoxValue);
|
||||
void enableDirScan(int checkBoxValue);
|
||||
void on_browse_button_clicked();
|
||||
void processFilterFile(const QString& filePath=QString());
|
||||
void processFilterFile(QString filePath=QString());
|
||||
void enableApplyButton();
|
||||
void checkPortsLogic();
|
||||
void enableSavePath(int checkBoxValue);
|
||||
@ -122,7 +122,7 @@ class options_imp : public QDialog, private Ui::Dialog{
|
||||
void useStyle();
|
||||
|
||||
signals:
|
||||
void status_changed(const QString&, bool) const;
|
||||
void status_changed(QString, bool) const;
|
||||
void exitWithCancel();
|
||||
};
|
||||
|
||||
|
@ -47,7 +47,7 @@ class previewSelect: public QDialog, private Ui::preview {
|
||||
torrent_handle h;
|
||||
|
||||
signals:
|
||||
void readyToPreviewFile(const QString&) const;
|
||||
void readyToPreviewFile(QString) const;
|
||||
|
||||
protected slots:
|
||||
void on_previewButton_clicked(){
|
||||
@ -126,7 +126,7 @@ class previewSelect: public QDialog, private Ui::preview {
|
||||
QMessageBox::critical(0, tr("Preview impossible"), tr("Sorry, we can't preview this file"));
|
||||
close();
|
||||
}
|
||||
connect(this, SIGNAL(readyToPreviewFile(const QString&)), parent, SLOT(previewFile(const QString&)));
|
||||
connect(this, SIGNAL(readyToPreviewFile(QString)), parent, SLOT(previewFile(QString)));
|
||||
if(previewListModel->rowCount() == 1){
|
||||
// Only one file : no choice
|
||||
on_previewButton_clicked();
|
||||
|
@ -64,8 +64,8 @@ class properties : public QDialog, private Ui::properties{
|
||||
void maximumSelection();
|
||||
|
||||
signals:
|
||||
void filteredFilesChanged(const QString& fileHash);
|
||||
void fileSizeChanged(const QString& fileHash);
|
||||
void filteredFilesChanged(QString fileHash);
|
||||
void fileSizeChanged(QString fileHash);
|
||||
void mustHaveFullAllocationMode(torrent_handle h);
|
||||
|
||||
public:
|
||||
|
33
src/rss.h
33
src/rss.h
@ -133,11 +133,11 @@ class RssStream : public QObject{
|
||||
bool downloadFailure;
|
||||
|
||||
signals:
|
||||
void refreshFinished(const QString& msg, const unsigned short& type);
|
||||
void refreshFinished(QString msg, const unsigned short& type);
|
||||
|
||||
public slots :
|
||||
// read and store the downloaded rss' informations
|
||||
void processDownloadedFile(const QString&, const QString& file_path) {
|
||||
void processDownloadedFile(QString, QString file_path) {
|
||||
// delete the former file
|
||||
if(QFile::exists(filePath)) {
|
||||
QFile::remove(filePath);
|
||||
@ -149,7 +149,7 @@ class RssStream : public QObject{
|
||||
}
|
||||
|
||||
// display the icon in the rss window
|
||||
void displayIcon(const QString&, const QString& file_path) {
|
||||
void displayIcon(QString, QString file_path) {
|
||||
iconPath = file_path;
|
||||
qDebug("Icon tmp path is %s", (const char*) file_path.toUtf8());
|
||||
openIcon();
|
||||
@ -157,14 +157,14 @@ class RssStream : public QObject{
|
||||
}
|
||||
|
||||
public:
|
||||
RssStream(const QString& _url) {
|
||||
RssStream(QString _url) {
|
||||
url = _url;
|
||||
alias = url;
|
||||
read = true;
|
||||
downloaderRss = new downloadThread(this);
|
||||
downloaderIcon = new downloadThread(this);
|
||||
connect(downloaderRss, SIGNAL(downloadFinished(const QString&, const QString&)), this, SLOT(processDownloadedFile(const QString&, const QString&)));
|
||||
connect(downloaderRss, SIGNAL(downloadFailure(const QString&, const QString&)), this, SLOT(handleDownloadFailure(const QString&, const QString&)));
|
||||
connect(downloaderRss, SIGNAL(downloadFinished(QString, QString)), this, SLOT(processDownloadedFile(QString, QString)));
|
||||
connect(downloaderRss, SIGNAL(downloadFailure(QString, QString)), this, SLOT(handleDownloadFailure(QString, QString)));
|
||||
downloaderRss->downloadUrl(url);
|
||||
// XXX: remove it when gif can be displayed
|
||||
iconPath = ":/Icons/rss.png";
|
||||
@ -204,7 +204,7 @@ class RssStream : public QObject{
|
||||
}
|
||||
|
||||
//prefer the RssManager::setAlias, do not save the changed ones
|
||||
void setAlias(const QString& _alias){
|
||||
void setAlias(QString _alias){
|
||||
alias = _alias;
|
||||
}
|
||||
|
||||
@ -273,7 +273,7 @@ class RssStream : public QObject{
|
||||
void getIcon() {
|
||||
QUrl siteUrl(url);
|
||||
QString iconUrl = "http://"+siteUrl.host()+"/favicon.ico";
|
||||
connect(downloaderIcon, SIGNAL(downloadFinished(const QString&, const QString&)), this, SLOT(displayIcon(const QString&, const QString&)));
|
||||
connect(downloaderIcon, SIGNAL(downloadFinished(QString, QString)), this, SLOT(displayIcon(QString, QString)));
|
||||
downloaderIcon->downloadUrl(iconUrl);
|
||||
}
|
||||
|
||||
@ -384,12 +384,11 @@ class RssStream : public QObject{
|
||||
else
|
||||
iconPath = ":/Icons/rss.png";
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
protected slots:
|
||||
void handleDownloadFailure(const QString&, const QString&){
|
||||
void handleDownloadFailure(QString, QString){
|
||||
// Change the stream icon to a red cross
|
||||
iconPath = ":/Icons/unavailable.png";
|
||||
downloadFailure = true;
|
||||
@ -409,7 +408,7 @@ class RssManager : public QObject{
|
||||
void streamNeedRefresh(const unsigned short&, const unsigned short&);
|
||||
|
||||
public slots :
|
||||
void streamNeedRefresh(const QString& _url, const unsigned short& type) {
|
||||
void streamNeedRefresh(QString _url, const unsigned short& type) {
|
||||
emit(streamNeedRefresh(hasStream(_url), type));
|
||||
}
|
||||
|
||||
@ -444,7 +443,7 @@ class RssManager : public QObject{
|
||||
RssStream *stream = new RssStream(streamListUrl.at(i));
|
||||
stream->setAlias(streamListAlias.at(i));
|
||||
streamList.append(stream);
|
||||
connect(stream, SIGNAL(refreshFinished(const QString&, const unsigned short&)), this, SLOT(streamNeedRefresh(const QString&, const unsigned short&)));
|
||||
connect(stream, SIGNAL(refreshFinished(QString, const unsigned short&)), this, SLOT(streamNeedRefresh(QString, const unsigned short&)));
|
||||
}
|
||||
}
|
||||
|
||||
@ -468,7 +467,7 @@ class RssManager : public QObject{
|
||||
if(hasStream(stream) < 0){
|
||||
streamList.append(stream);
|
||||
streamListUrl.append(stream->getUrl());
|
||||
connect(stream, SIGNAL(refreshFinished(const QString&, const unsigned short&)), this, SLOT(streamNeedRefresh(const QString&, const unsigned short&)));
|
||||
connect(stream, SIGNAL(refreshFinished(QString, const unsigned short&)), this, SLOT(streamNeedRefresh(QString, const unsigned short&)));
|
||||
}else{
|
||||
qDebug("Not adding the Rss stream because it is already in the list");
|
||||
}
|
||||
@ -480,7 +479,7 @@ class RssManager : public QObject{
|
||||
RssStream* stream = new RssStream(url);
|
||||
streamList.append(stream);
|
||||
streamListUrl.append(url);
|
||||
connect(stream, SIGNAL(refreshFinished(const QString&, const unsigned short&)), this, SLOT(streamNeedRefresh(const QString&, const unsigned short&)));
|
||||
connect(stream, SIGNAL(refreshFinished(QString, const unsigned short&)), this, SLOT(streamNeedRefresh(QString, const unsigned short&)));
|
||||
}else {
|
||||
qDebug("Not adding the Rss stream because it is already in the list");
|
||||
}
|
||||
@ -512,7 +511,7 @@ class RssManager : public QObject{
|
||||
unsigned int streamListUrlSize = streamListUrl.size();
|
||||
for(unsigned int i=0; i<streamListUrlSize; ++i){
|
||||
getStream(i)->refresh();
|
||||
connect(getStream(i), SIGNAL(refreshFinished(const QString&, const unsigned short&)), this, SLOT(streamNeedRefresh(const QString&, const unsigned short&)));
|
||||
connect(getStream(i), SIGNAL(refreshFinished(QString, const unsigned short&)), this, SLOT(streamNeedRefresh(QString, const unsigned short&)));
|
||||
}
|
||||
}
|
||||
|
||||
@ -520,7 +519,7 @@ class RssManager : public QObject{
|
||||
if(index>=0 && index<getNbStream()) {
|
||||
if(getStream(index)->getLastRefreshElapsed()>REFRESH_FREQ_MAX) {
|
||||
getStream(index)->refresh();
|
||||
connect(getStream(index), SIGNAL(refreshFinished(const QString&, const unsigned short&)), this, SLOT(streamNeedRefresh(const QString&, const unsigned short&)));
|
||||
connect(getStream(index), SIGNAL(refreshFinished(QString, const unsigned short&)), this, SLOT(streamNeedRefresh(QString, const unsigned short&)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -530,7 +529,7 @@ class RssManager : public QObject{
|
||||
return hasStream(stream->getUrl());
|
||||
}
|
||||
|
||||
short hasStream(const QString& url) const{
|
||||
short hasStream(QString url) const{
|
||||
return streamListUrl.indexOf(url);
|
||||
}
|
||||
|
||||
|
@ -47,8 +47,8 @@ SearchEngine::SearchEngine(bittorrent *BTSession, QSystemTrayIcon *myTrayIcon, b
|
||||
this->BTSession = BTSession;
|
||||
this->myTrayIcon = myTrayIcon;
|
||||
downloader = new downloadThread(this);
|
||||
connect(downloader, SIGNAL(downloadFinished(const QString&, const QString&)), this, SLOT(novaUpdateDownloaded(const QString&, const QString&)));
|
||||
connect(downloader, SIGNAL(downloadFailure(const QString&, const QString&)), this, SLOT(handleNovaDownloadFailure(const QString&, const QString&)));
|
||||
connect(downloader, SIGNAL(downloadFinished(QString, QString)), this, SLOT(novaUpdateDownloaded(QString, QString)));
|
||||
connect(downloader, SIGNAL(downloadFailure(QString, QString)), this, SLOT(handleNovaDownloadFailure(QString, QString)));
|
||||
// Set Search results list model
|
||||
SearchListModel = new QStandardItemModel(0,5);
|
||||
SearchListModel->setHeaderData(SEARCH_NAME, Qt::Horizontal, tr("Name", "i.e: file name"));
|
||||
@ -117,7 +117,7 @@ SearchEngine::~SearchEngine(){
|
||||
}
|
||||
|
||||
// Set the color of a row in data model
|
||||
void SearchEngine::setRowColor(int row, const QString& color){
|
||||
void SearchEngine::setRowColor(int row, QString color){
|
||||
for(int i=0; i<SearchListModel->columnCount(); ++i){
|
||||
SearchListModel->setData(SearchListModel->index(row, i), QVariant(QColor(color)), Qt::TextColorRole);
|
||||
}
|
||||
@ -361,7 +361,7 @@ void SearchEngine::readSearchOutput(){
|
||||
}
|
||||
|
||||
// Returns version of nova.py search engine
|
||||
float SearchEngine::getNovaVersion(const QString& novaPath) const{
|
||||
float SearchEngine::getNovaVersion(QString novaPath) const{
|
||||
QFile dest_nova(novaPath);
|
||||
if(!dest_nova.exists()){
|
||||
return 0.0;
|
||||
@ -384,7 +384,7 @@ float SearchEngine::getNovaVersion(const QString& novaPath) const{
|
||||
}
|
||||
|
||||
// Returns changelog of nova.py search engine
|
||||
QByteArray SearchEngine::getNovaChangelog(const QString& novaPath) const{
|
||||
QByteArray SearchEngine::getNovaChangelog(QString novaPath) const{
|
||||
QFile dest_nova(novaPath);
|
||||
if(!dest_nova.exists()){
|
||||
return QByteArray("None");
|
||||
@ -432,7 +432,7 @@ void SearchEngine::updateNova() const{
|
||||
}
|
||||
}
|
||||
|
||||
void SearchEngine::novaUpdateDownloaded(const QString& url, const QString& filePath){
|
||||
void SearchEngine::novaUpdateDownloaded(QString url, QString filePath){
|
||||
float version_on_server = getNovaVersion(filePath);
|
||||
qDebug("Version on qbittorrent.org: %.2f", version_on_server);
|
||||
if(version_on_server > getNovaVersion(misc::qBittorrentPath()+"nova.py")){
|
||||
@ -467,7 +467,7 @@ void SearchEngine::novaUpdateDownloaded(const QString& url, const QString& fileP
|
||||
QFile::remove(filePath);
|
||||
}
|
||||
|
||||
void SearchEngine::handleNovaDownloadFailure(const QString& url, const QString& reason){
|
||||
void SearchEngine::handleNovaDownloadFailure(QString url, QString reason){
|
||||
if(url == "http://www.dchris.eu/nova/nova.zip"){
|
||||
qDebug("*Warning: Search plugin update download from primary server failed, trying secondary server...");
|
||||
downloader->downloadUrl("http://hydr0g3n.free.fr/nova/nova.py");
|
||||
@ -515,7 +515,7 @@ void SearchEngine::searchFinished(int exitcode,QProcess::ExitStatus){
|
||||
// SLOT to append one line to search results list
|
||||
// Line is in the following form :
|
||||
// file url | file name | file size | nb seeds | nb leechers | Search engine url
|
||||
void SearchEngine::appendSearchResult(const QString& line){
|
||||
void SearchEngine::appendSearchResult(QString line){
|
||||
QStringList parts = line.split("|");
|
||||
if(parts.size() != 6){
|
||||
return;
|
||||
|
@ -56,8 +56,8 @@ class SearchEngine : public QWidget, public Ui::search_engine{
|
||||
public:
|
||||
SearchEngine(bittorrent *BTSession, QSystemTrayIcon *myTrayIcon, bool systrayIntegration);
|
||||
~SearchEngine();
|
||||
float getNovaVersion(const QString& novaPath) const;
|
||||
QByteArray getNovaChangelog(const QString& novaPath) const;
|
||||
float getNovaVersion(QString novaPath) const;
|
||||
QByteArray getNovaChangelog(QString novaPath) const;
|
||||
bool loadColWidthSearchList();
|
||||
|
||||
public slots:
|
||||
@ -67,10 +67,10 @@ class SearchEngine : public QWidget, public Ui::search_engine{
|
||||
void on_clear_button_clicked();
|
||||
void on_download_button_clicked();
|
||||
void on_update_nova_button_clicked();
|
||||
void appendSearchResult(const QString& line);
|
||||
void appendSearchResult(QString line);
|
||||
void searchFinished(int exitcode,QProcess::ExitStatus);
|
||||
void readSearchOutput();
|
||||
void setRowColor(int row, const QString& color);
|
||||
void setRowColor(int row, QString color);
|
||||
void searchStarted();
|
||||
void downloadSelectedItem(const QModelIndex& index);
|
||||
void startSearchHistory();
|
||||
@ -82,8 +82,8 @@ class SearchEngine : public QWidget, public Ui::search_engine{
|
||||
void sortSearchList(int index);
|
||||
void sortSearchListInt(int index, Qt::SortOrder sortOrder);
|
||||
void sortSearchListString(int index, Qt::SortOrder sortOrder);
|
||||
void novaUpdateDownloaded(const QString& url, const QString& path);
|
||||
void handleNovaDownloadFailure(const QString& url, const QString& reason);
|
||||
void novaUpdateDownloaded(QString url, QString path);
|
||||
void handleNovaDownloadFailure(QString url, QString reason);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -44,8 +44,8 @@ class torrentAdditionDialog : public QDialog, private Ui_addTorrentDialog{
|
||||
Q_OBJECT
|
||||
|
||||
signals:
|
||||
void setInfoBarGUI(const QString& info, const QString& color);
|
||||
void torrentAddition(const QString& filePath, bool fromScanDir, bool onStartup, const QString& from_url);
|
||||
void setInfoBarGUI(QString info, QString color);
|
||||
void torrentAddition(QString filePath, bool fromScanDir, bool onStartup, QString from_url);
|
||||
|
||||
private:
|
||||
QString fileName;
|
||||
|
Loading…
Reference in New Issue
Block a user