mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-02-06 11:54:18 +00:00
- Oups, sorry I forgot pause_all() & start_all() functions in last commit :)
- Updated version to v0.9.0beta4
This commit is contained in:
parent
bd3bde919d
commit
aa6f6161c3
43
src/GUI.cpp
43
src/GUI.cpp
@ -152,6 +152,8 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent){
|
|||||||
connect(actionPause, SIGNAL(triggered()), this, SLOT(pauseSelection()));
|
connect(actionPause, SIGNAL(triggered()), this, SLOT(pauseSelection()));
|
||||||
connect(actionTorrent_Properties, SIGNAL(triggered()), this, SLOT(propertiesSelection()));
|
connect(actionTorrent_Properties, SIGNAL(triggered()), this, SLOT(propertiesSelection()));
|
||||||
connect(actionStart, SIGNAL(triggered()), this, SLOT(startSelection()));
|
connect(actionStart, SIGNAL(triggered()), this, SLOT(startSelection()));
|
||||||
|
connect(actionPause_All, SIGNAL(triggered()), this, SLOT(pauseAll()));
|
||||||
|
connect(actionStart_All, SIGNAL(triggered()), this, SLOT(resumeAll()));
|
||||||
connect(actionAbout, SIGNAL(triggered()), this, SLOT(showAbout()));
|
connect(actionAbout, SIGNAL(triggered()), this, SLOT(showAbout()));
|
||||||
connect(actionCreate_torrent, SIGNAL(triggered()), this, SLOT(showCreateWindow()));
|
connect(actionCreate_torrent, SIGNAL(triggered()), this, SLOT(showCreateWindow()));
|
||||||
connect(actionClearLog, SIGNAL(triggered()), this, SLOT(clearLog()));
|
connect(actionClearLog, SIGNAL(triggered()), this, SLOT(clearLog()));
|
||||||
@ -1204,6 +1206,29 @@ void GUI::configureSession(){
|
|||||||
qDebug("Session configured");
|
qDebug("Session configured");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Pause All Downloads in DL list
|
||||||
|
void GUI::pauseAll(){
|
||||||
|
QString fileHash;
|
||||||
|
// Pause all torrents
|
||||||
|
BTSession.pauseAllTorrents();
|
||||||
|
// update download list
|
||||||
|
for(int i=0; i<DLListModel->rowCount(); ++i){
|
||||||
|
fileHash = DLListModel->data(DLListModel->index(i, HASH)).toString();
|
||||||
|
// Create .paused file
|
||||||
|
QFile paused_file(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+fileHash+".paused");
|
||||||
|
paused_file.open(QIODevice::WriteOnly | QIODevice::Text);
|
||||||
|
paused_file.close();
|
||||||
|
// Update DL list items
|
||||||
|
DLListModel->setData(DLListModel->index(i, DLSPEED), QVariant((double)0.));
|
||||||
|
DLListModel->setData(DLListModel->index(i, UPSPEED), QVariant((double)0.));
|
||||||
|
DLListModel->setData(DLListModel->index(i, STATUS), QVariant(tr("Paused")));
|
||||||
|
DLListModel->setData(DLListModel->index(i, ETA), QVariant((qlonglong)-1));
|
||||||
|
DLListModel->setData(DLListModel->index(i, NAME), QVariant(QIcon(":/Icons/skin/paused.png")), Qt::DecorationRole);
|
||||||
|
setRowColor(i, "red");
|
||||||
|
setInfoBar(tr("All downloads paused."));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// pause selected items in the list
|
// pause selected items in the list
|
||||||
void GUI::pauseSelection(){
|
void GUI::pauseSelection(){
|
||||||
QModelIndexList selectedIndexes = downloadList->selectionModel()->selectedIndexes();
|
QModelIndexList selectedIndexes = downloadList->selectionModel()->selectedIndexes();
|
||||||
@ -1229,6 +1254,24 @@ void GUI::pauseSelection(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Resume All Downloads in DL list
|
||||||
|
void GUI::resumeAll(){
|
||||||
|
QString fileHash;
|
||||||
|
// Pause all torrents
|
||||||
|
BTSession.resumeAllTorrents();
|
||||||
|
// update download list
|
||||||
|
for(int i=0; i<DLListModel->rowCount(); ++i){
|
||||||
|
fileHash = DLListModel->data(DLListModel->index(i, HASH)).toString();
|
||||||
|
// Remove .paused file
|
||||||
|
QFile::remove(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+fileHash+".paused");
|
||||||
|
// Update DL list items
|
||||||
|
DLListModel->setData(DLListModel->index(i, STATUS), QVariant(tr("Connecting...")));
|
||||||
|
DLListModel->setData(DLListModel->index(i, NAME), QVariant(QIcon(":/Icons/skin/connecting.png")), Qt::DecorationRole);
|
||||||
|
setRowColor(i, "grey");
|
||||||
|
setInfoBar(tr("All downloads resumed."));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// start selected items in the list
|
// start selected items in the list
|
||||||
void GUI::startSelection(){
|
void GUI::startSelection(){
|
||||||
QModelIndexList selectedIndexes = downloadList->selectionModel()->selectedIndexes();
|
QModelIndexList selectedIndexes = downloadList->selectionModel()->selectedIndexes();
|
||||||
|
@ -139,7 +139,9 @@ class GUI : public QMainWindow, private Ui::MainWindow{
|
|||||||
void showProperties(const QModelIndex &index);
|
void showProperties(const QModelIndex &index);
|
||||||
void propertiesSelection();
|
void propertiesSelection();
|
||||||
void pauseSelection();
|
void pauseSelection();
|
||||||
|
void pauseAll();
|
||||||
void startSelection();
|
void startSelection();
|
||||||
|
void resumeAll();
|
||||||
void askForTorrents();
|
void askForTorrents();
|
||||||
void deletePermanently();
|
void deletePermanently();
|
||||||
void deleteSelection();
|
void deleteSelection();
|
||||||
|
@ -23,10 +23,7 @@
|
|||||||
#define ABOUT_H
|
#define ABOUT_H
|
||||||
|
|
||||||
#include "ui_about.h"
|
#include "ui_about.h"
|
||||||
#define VERSION "v0.9.0beta3"
|
#define VERSION "v0.9.0beta4"
|
||||||
#define VERSION_MAJOR 0
|
|
||||||
#define VERSION_MINOR 9
|
|
||||||
#define VERSION_BUGFIX 0
|
|
||||||
|
|
||||||
class about : public QDialog, private Ui::AboutDlg{
|
class about : public QDialog, private Ui::AboutDlg{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -497,6 +497,28 @@ void bittorrent::setGlobalRatio(float ratio){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Pause all torrents in session
|
||||||
|
void bittorrent::pauseAllTorrents(){
|
||||||
|
std::vector<torrent_handle> handles = s->get_torrents();
|
||||||
|
for(unsigned int i=0; i<handles.size(); ++i){
|
||||||
|
torrent_handle h = handles[i];
|
||||||
|
if(h.is_valid() && !h.is_paused()){
|
||||||
|
h.pause();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Resume all torrents in session
|
||||||
|
void bittorrent::resumeAllTorrents(){
|
||||||
|
std::vector<torrent_handle> handles = s->get_torrents();
|
||||||
|
for(unsigned int i=0; i<handles.size(); ++i){
|
||||||
|
torrent_handle h = handles[i];
|
||||||
|
if(h.is_valid() && h.is_paused()){
|
||||||
|
h.resume();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Add uT PeX extension to bittorrent session
|
// Add uT PeX extension to bittorrent session
|
||||||
void bittorrent::enablePeerExchange(){
|
void bittorrent::enablePeerExchange(){
|
||||||
s->add_extension(&create_ut_pex_plugin);
|
s->add_extension(&create_ut_pex_plugin);
|
||||||
|
@ -43,7 +43,7 @@
|
|||||||
|
|
||||||
#include "deleteThread.h"
|
#include "deleteThread.h"
|
||||||
|
|
||||||
#define VERSION "v0.9.0beta3"
|
#define VERSION "v0.9.0beta4"
|
||||||
#define VERSION_MAJOR 0
|
#define VERSION_MAJOR 0
|
||||||
#define VERSION_MINOR 9
|
#define VERSION_MINOR 9
|
||||||
#define VERSION_BUGFIX 0
|
#define VERSION_BUGFIX 0
|
||||||
@ -91,6 +91,8 @@ class bittorrent : public QObject{
|
|||||||
void downloadFromURLList(const QStringList& url_list);
|
void downloadFromURLList(const QStringList& url_list);
|
||||||
void deleteTorrent(const QString& hash, bool permanent = false);
|
void deleteTorrent(const QString& hash, bool permanent = false);
|
||||||
void pauseTorrent(const QString& hash);
|
void pauseTorrent(const QString& hash);
|
||||||
|
void pauseAllTorrents();
|
||||||
|
void resumeAllTorrents();
|
||||||
void resumeTorrent(const QString& hash);
|
void resumeTorrent(const QString& hash);
|
||||||
void enableDHT();
|
void enableDHT();
|
||||||
void disableDHT();
|
void disableDHT();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user