mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-11 15:56:17 -07: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
5 changed files with 71 additions and 5 deletions
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(actionTorrent_Properties, SIGNAL(triggered()), this, SLOT(propertiesSelection()));
|
||||
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(actionCreate_torrent, SIGNAL(triggered()), this, SLOT(showCreateWindow()));
|
||||
connect(actionClearLog, SIGNAL(triggered()), this, SLOT(clearLog()));
|
||||
|
@ -1204,6 +1206,29 @@ void GUI::configureSession(){
|
|||
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
|
||||
void GUI::pauseSelection(){
|
||||
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
|
||||
void GUI::startSelection(){
|
||||
QModelIndexList selectedIndexes = downloadList->selectionModel()->selectedIndexes();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue