Browse Source

- Removed pause/start in finished list (useless)

adaptive-webui-19844
Christophe Dumez 18 years ago
parent
commit
4727cd57ed
  1. 2
      TODO
  2. 55
      src/GUI.cpp

2
TODO

@ -31,7 +31,7 @@
// in v0.10 (partial) - WIP // in v0.10 (partial) - WIP
- Download from RSS feeds (WIP by gtsoul, clean & finish rss.h, add a tab in mainWindow, debug) - Download from RSS feeds (WIP by gtsoul, clean & finish rss.h, add a tab in mainWindow, debug)
- Move finished torrent to another tab and keep on seeding them even after restart (better for sharing) - Move finished torrent to another tab and keep on seeding them even after restart (finish & debug)
- Improve torrent creation dialog (look & features) : - Improve torrent creation dialog (look & features) :
- Add Private combobox (allow to share on DHT or not) - Add Private combobox (allow to share on DHT or not)
- Use a QListWidget to allow multiple input paths - Use a QListWidget to allow multiple input paths

55
src/GUI.cpp

@ -1140,46 +1140,25 @@ void GUI::pauseAll(){
// pause selected items in the list // pause selected items in the list
void GUI::pauseSelection(){ void GUI::pauseSelection(){
if(tabs->currentIndex() > 1) return; QModelIndexList selectedIndexes = downloadList->selectionModel()->selectedIndexes();
QModelIndexList selectedIndexes;
bool inDownloadList = true;
if(tabs->currentIndex() == 0) {
selectedIndexes = downloadList->selectionModel()->selectedIndexes();
} else {
selectedIndexes = finishedTorrentTab->getFinishedList()->selectionModel()->selectedIndexes();
inDownloadList = false;
}
QModelIndex index; QModelIndex index;
foreach(index, selectedIndexes){ foreach(index, selectedIndexes){
if(index.column() == NAME){ if(index.column() == NAME){
// Get the file hash // Get the file name
QString fileHash; QString fileHash = DLListModel->data(DLListModel->index(index.row(), HASH)).toString();
if(inDownloadList)
fileHash = DLListModel->data(DLListModel->index(index.row(), HASH)).toString();
else
fileHash = finishedTorrentTab->getFinishedListModel()->data(finishedTorrentTab->getFinishedListModel()->index(index.row(), HASH)).toString();
if(!BTSession.isPaused(fileHash)){ if(!BTSession.isPaused(fileHash)){
// Pause the torrent // Pause the torrent
BTSession.pauseTorrent(fileHash); BTSession.pauseTorrent(fileHash);
// Update DL status // Update DL status
int row = index.row(); int row = index.row();
if(inDownloadList) {
DLListModel->setData(DLListModel->index(row, DLSPEED), QVariant((double)0.0)); DLListModel->setData(DLListModel->index(row, DLSPEED), QVariant((double)0.0));
DLListModel->setData(DLListModel->index(row, UPSPEED), QVariant((double)0.0)); DLListModel->setData(DLListModel->index(row, UPSPEED), QVariant((double)0.0));
DLListModel->setData(DLListModel->index(row, STATUS), QVariant(tr("Paused"))); DLListModel->setData(DLListModel->index(row, STATUS), QVariant(tr("Paused")));
DLListModel->setData(DLListModel->index(row, ETA), QVariant((qlonglong)-1)); DLListModel->setData(DLListModel->index(row, ETA), QVariant((qlonglong)-1));
setInfoBar(tr("'%1' paused.", "xxx.avi paused.").arg(QString(BTSession.getTorrentHandle(fileHash).name().c_str())));
DLListModel->setData(DLListModel->index(row, NAME), QIcon(":/Icons/skin/paused.png"), Qt::DecorationRole); DLListModel->setData(DLListModel->index(row, NAME), QIcon(":/Icons/skin/paused.png"), Qt::DecorationRole);
DLListModel->setData(DLListModel->index(row, SEEDSLEECH), QVariant("0/0")); DLListModel->setData(DLListModel->index(row, SEEDSLEECH), QVariant("0/0"));
setRowColor(row, "red"); setRowColor(row, "red");
} else {
finishedTorrentTab->getFinishedListModel()->setData(finishedTorrentTab->getFinishedListModel()->index(row, DLSPEED), QVariant((double)0.0));
finishedTorrentTab->getFinishedListModel()->setData(finishedTorrentTab->getFinishedListModel()->index(row, UPSPEED), QVariant((double)0.0));
finishedTorrentTab->getFinishedListModel()->setData(finishedTorrentTab->getFinishedListModel()->index(row, STATUS), QVariant(tr("Paused")));
finishedTorrentTab->getFinishedListModel()->setData(finishedTorrentTab->getFinishedListModel()->index(row, ETA), QVariant((qlonglong)-1));
finishedTorrentTab->getFinishedListModel()->setData(finishedTorrentTab->getFinishedListModel()->index(row, NAME), QIcon(":/Icons/skin/paused.png"), Qt::DecorationRole);
finishedTorrentTab->getFinishedListModel()->setData(finishedTorrentTab->getFinishedListModel()->index(row, SEEDSLEECH), QVariant("0/0"));
}
setInfoBar(tr("'%1' paused.", "xxx.avi paused.").arg(QString(BTSession.getTorrentHandle(fileHash).name().c_str())));
} }
} }
} }
@ -1205,24 +1184,12 @@ void GUI::resumeAll(){
// start selected items in the list // start selected items in the list
void GUI::startSelection(){ void GUI::startSelection(){
if(tabs->currentIndex() > 1) return; QModelIndexList selectedIndexes = downloadList->selectionModel()->selectedIndexes();
QModelIndexList selectedIndexes;
bool inDownloadList = true;
if(tabs->currentIndex() == 0) {
selectedIndexes = downloadList->selectionModel()->selectedIndexes();
} else {
selectedIndexes = finishedTorrentTab->getFinishedList()->selectionModel()->selectedIndexes();
inDownloadList = false;
}
QModelIndex index; QModelIndex index;
foreach(index, selectedIndexes){ foreach(index, selectedIndexes){
if(index.column() == NAME){ if(index.column() == NAME){
// Get the file hash // Get the file name
QString fileHash; QString fileHash = DLListModel->data(DLListModel->index(index.row(), HASH)).toString();
if(inDownloadList)
fileHash = DLListModel->data(DLListModel->index(index.row(), HASH)).toString();
else
fileHash = finishedTorrentTab->getFinishedListModel()->data(finishedTorrentTab->getFinishedListModel()->index(index.row(), HASH)).toString();
if(BTSession.isPaused(fileHash)){ if(BTSession.isPaused(fileHash)){
// Resume the torrent // Resume the torrent
BTSession.resumeTorrent(fileHash); BTSession.resumeTorrent(fileHash);
@ -1230,16 +1197,10 @@ void GUI::startSelection(){
QFile::remove(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+fileHash+".paused"); QFile::remove(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+fileHash+".paused");
// Update DL status // Update DL status
int row = index.row(); int row = index.row();
if(inDownloadList) {
DLListModel->setData(DLListModel->index(row, STATUS), QVariant(tr("Connecting..."))); DLListModel->setData(DLListModel->index(row, STATUS), QVariant(tr("Connecting...")));
setInfoBar(tr("'%1' resumed.", "e.g: xxx.avi resumed.").arg(QString(BTSession.getTorrentHandle(fileHash).name().c_str())));
DLListModel->setData(DLListModel->index(row, NAME), QVariant(QIcon(":/Icons/skin/connecting.png")), Qt::DecorationRole); DLListModel->setData(DLListModel->index(row, NAME), QVariant(QIcon(":/Icons/skin/connecting.png")), Qt::DecorationRole);
setRowColor(row, "grey"); setRowColor(row, "grey");
} else {
finishedTorrentTab->getFinishedListModel()->setData(finishedTorrentTab->getFinishedListModel()->index(row, STATUS), QVariant(tr("Finished", "i.e: Torrent has finished downloading")));
finishedTorrentTab->getFinishedListModel()->setData(finishedTorrentTab->getFinishedListModel()->index(row, NAME), QVariant(QIcon(":/Icons/skin/seeding.png")), Qt::DecorationRole);
finishedTorrentTab->setRowColor(row, "orange");
}
setInfoBar(tr("'%1' resumed.", "e.g: xxx.avi resumed.").arg(QString(BTSession.getTorrentHandle(fileHash).name().c_str())));
} }
} }
} }

Loading…
Cancel
Save