mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-11-26 19:26:59 +03:00
- Improved a lot switching between tabs
This commit is contained in:
parent
79253c76f1
commit
6802e22f7e
4 changed files with 23 additions and 10 deletions
1
TODO
1
TODO
|
@ -46,4 +46,3 @@
|
|||
- Improve ratio display / calculation / saving / per torrent...
|
||||
- Sorting in Download Status column should be smarter than just an alphabetical sort
|
||||
- Windows port : http://www.peerweb.nl/qbittorrent/experimentalbuild/testing.zip
|
||||
- MUST Improve torrent switching between download & finished list (and vice-versa) (USE SIGNALs/SLOTS)
|
|
@ -243,22 +243,21 @@ void FinishedTorrents::updateFinishedList(){
|
|||
continue;
|
||||
}
|
||||
if(h.is_paused()){
|
||||
h.resume();
|
||||
continue;
|
||||
h.resume(); // No paused torrents in finished list
|
||||
}
|
||||
torrent_status torrentStatus = h.status();
|
||||
if(torrentStatus.state == torrent_status::downloading) {
|
||||
if(torrentStatus.state == torrent_status::downloading || (torrentStatus.state != torrent_status::checking_files && torrentStatus.state != torrent_status::queued_for_checking && torrentStatus.progress != 1.)) {
|
||||
// What are you doing here, go back to download tab!
|
||||
qDebug("Info: a torrent was moved from finished to download tab");
|
||||
deleteFromFinishedList(hash);
|
||||
emit torrentMovedFromFinishedList(h);
|
||||
continue;
|
||||
}
|
||||
QList<QStandardItem *> items = finishedListModel->findItems(hash, Qt::MatchExactly, HASH );
|
||||
if(items.size() != 1){
|
||||
qDebug("Problem: Can't find torrent in finished list");
|
||||
int row = getRowFromHash(hash);
|
||||
if(row == -1){
|
||||
std::cerr << "ERROR: Can't find torrent in finished list\n";
|
||||
continue;
|
||||
}
|
||||
int row = items.at(0)->row();
|
||||
finishedListModel->setData(finishedListModel->index(row, UPSPEED), QVariant((double)torrentStatus.upload_payload_rate));
|
||||
finishedListModel->setData(finishedListModel->index(row, SEEDSLEECH), QVariant(QString(misc::toString(torrentStatus.num_seeds, true).c_str())+"/"+QString(misc::toString(torrentStatus.num_peers - torrentStatus.num_seeds, true).c_str())));
|
||||
}
|
||||
|
@ -268,6 +267,16 @@ QStringList FinishedTorrents::getFinishedSHAs(){
|
|||
return finishedSHAs;
|
||||
}
|
||||
|
||||
int FinishedTorrents::getRowFromHash(const QString& hash) const{
|
||||
unsigned int nbRows = finishedListModel->rowCount();
|
||||
for(unsigned int i=0; i<nbRows; ++i){
|
||||
if(finishedListModel->data(finishedListModel->index(i, HASH)) == hash){
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Will move it to download tab
|
||||
void FinishedTorrents::deleteFromFinishedList(QString hash){
|
||||
finishedSHAs.removeAll(hash);
|
||||
|
|
|
@ -45,6 +45,7 @@ class FinishedTorrents : public QWidget, public Ui::seeding{
|
|||
QTreeView* getFinishedList();
|
||||
QStandardItemModel* getFinishedListModel();
|
||||
bool loadColWidthFinishedList();
|
||||
int getRowFromHash(const QString& hash) const;
|
||||
|
||||
public slots:
|
||||
void addFinishedSHA(QString sha);
|
||||
|
@ -62,6 +63,9 @@ class FinishedTorrents : public QWidget, public Ui::seeding{
|
|||
protected slots:
|
||||
void on_actionSet_upload_limit_triggered();
|
||||
|
||||
signals:
|
||||
void torrentMovedFromFinishedList(torrent_handle);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -69,6 +69,7 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent){
|
|||
finishedTorrentTab = new FinishedTorrents(this, &BTSession);
|
||||
tabs->addTab(finishedTorrentTab, tr("Finished"));
|
||||
tabs->setTabIcon(1, QIcon(QString::fromUtf8(":/Icons/skin/seeding.png")));
|
||||
connect(finishedTorrentTab, SIGNAL(torrentMovedFromFinishedList(torrent_handle)), this, SLOT(restoreInDownloadList(torrent_handle)));
|
||||
// Search engine tab
|
||||
searchEngine = new SearchEngine(&BTSession, myTrayIcon, systrayIntegration);
|
||||
tabs->addTab(searchEngine, tr("Search"));
|
||||
|
@ -490,7 +491,7 @@ void GUI::updateDlList(bool force){
|
|||
if(finishedSHAs.indexOf(fileHash) != -1) continue;
|
||||
int row = getRowFromHash(fileHash);
|
||||
if(row == -1){
|
||||
qDebug("Could not find filename in download list, adding it...");
|
||||
qDebug("Info: Could not find filename in download list, adding it...");
|
||||
restoreInDownloadList(h);
|
||||
row = getRowFromHash(fileHash);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue