mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-10 23:07:59 +00:00
- Improved a lot switching between tabs
This commit is contained in:
parent
79253c76f1
commit
6802e22f7e
1
TODO
1
TODO
@ -46,4 +46,3 @@
|
|||||||
- Improve ratio display / calculation / saving / per torrent...
|
- Improve ratio display / calculation / saving / per torrent...
|
||||||
- Sorting in Download Status column should be smarter than just an alphabetical sort
|
- Sorting in Download Status column should be smarter than just an alphabetical sort
|
||||||
- Windows port : http://www.peerweb.nl/qbittorrent/experimentalbuild/testing.zip
|
- 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;
|
continue;
|
||||||
}
|
}
|
||||||
if(h.is_paused()){
|
if(h.is_paused()){
|
||||||
h.resume();
|
h.resume(); // No paused torrents in finished list
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
torrent_status torrentStatus = h.status();
|
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!
|
// What are you doing here, go back to download tab!
|
||||||
qDebug("Info: a torrent was moved from finished to download tab");
|
qDebug("Info: a torrent was moved from finished to download tab");
|
||||||
deleteFromFinishedList(hash);
|
deleteFromFinishedList(hash);
|
||||||
|
emit torrentMovedFromFinishedList(h);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
QList<QStandardItem *> items = finishedListModel->findItems(hash, Qt::MatchExactly, HASH );
|
int row = getRowFromHash(hash);
|
||||||
if(items.size() != 1){
|
if(row == -1){
|
||||||
qDebug("Problem: Can't find torrent in finished list");
|
std::cerr << "ERROR: Can't find torrent in finished list\n";
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
int row = items.at(0)->row();
|
|
||||||
finishedListModel->setData(finishedListModel->index(row, UPSPEED), QVariant((double)torrentStatus.upload_payload_rate));
|
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())));
|
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;
|
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
|
// Will move it to download tab
|
||||||
void FinishedTorrents::deleteFromFinishedList(QString hash){
|
void FinishedTorrents::deleteFromFinishedList(QString hash){
|
||||||
finishedSHAs.removeAll(hash);
|
finishedSHAs.removeAll(hash);
|
||||||
|
@ -45,6 +45,7 @@ class FinishedTorrents : public QWidget, public Ui::seeding{
|
|||||||
QTreeView* getFinishedList();
|
QTreeView* getFinishedList();
|
||||||
QStandardItemModel* getFinishedListModel();
|
QStandardItemModel* getFinishedListModel();
|
||||||
bool loadColWidthFinishedList();
|
bool loadColWidthFinishedList();
|
||||||
|
int getRowFromHash(const QString& hash) const;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void addFinishedSHA(QString sha);
|
void addFinishedSHA(QString sha);
|
||||||
@ -62,6 +63,9 @@ class FinishedTorrents : public QWidget, public Ui::seeding{
|
|||||||
protected slots:
|
protected slots:
|
||||||
void on_actionSet_upload_limit_triggered();
|
void on_actionSet_upload_limit_triggered();
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void torrentMovedFromFinishedList(torrent_handle);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -69,6 +69,7 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent){
|
|||||||
finishedTorrentTab = new FinishedTorrents(this, &BTSession);
|
finishedTorrentTab = new FinishedTorrents(this, &BTSession);
|
||||||
tabs->addTab(finishedTorrentTab, tr("Finished"));
|
tabs->addTab(finishedTorrentTab, tr("Finished"));
|
||||||
tabs->setTabIcon(1, QIcon(QString::fromUtf8(":/Icons/skin/seeding.png")));
|
tabs->setTabIcon(1, QIcon(QString::fromUtf8(":/Icons/skin/seeding.png")));
|
||||||
|
connect(finishedTorrentTab, SIGNAL(torrentMovedFromFinishedList(torrent_handle)), this, SLOT(restoreInDownloadList(torrent_handle)));
|
||||||
// Search engine tab
|
// Search engine tab
|
||||||
searchEngine = new SearchEngine(&BTSession, myTrayIcon, systrayIntegration);
|
searchEngine = new SearchEngine(&BTSession, myTrayIcon, systrayIntegration);
|
||||||
tabs->addTab(searchEngine, tr("Search"));
|
tabs->addTab(searchEngine, tr("Search"));
|
||||||
@ -490,7 +491,7 @@ void GUI::updateDlList(bool force){
|
|||||||
if(finishedSHAs.indexOf(fileHash) != -1) continue;
|
if(finishedSHAs.indexOf(fileHash) != -1) continue;
|
||||||
int row = getRowFromHash(fileHash);
|
int row = getRowFromHash(fileHash);
|
||||||
if(row == -1){
|
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);
|
restoreInDownloadList(h);
|
||||||
row = getRowFromHash(fileHash);
|
row = getRowFromHash(fileHash);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user