mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-22 12:34:19 +00:00
- Fix completed torrent counting
- Make sure the status bar is displayed before showing the GUI
This commit is contained in:
parent
54f2e66464
commit
cedc87a703
@ -196,14 +196,14 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), dis
|
|||||||
// Accept drag 'n drops
|
// Accept drag 'n drops
|
||||||
setAcceptDrops(true);
|
setAcceptDrops(true);
|
||||||
createKeyboardShortcuts();
|
createKeyboardShortcuts();
|
||||||
|
// Create status bar
|
||||||
|
status_bar = new StatusBar(QMainWindow::statusBar(), BTSession);
|
||||||
|
|
||||||
show();
|
show();
|
||||||
|
|
||||||
// Load Window state and sizes
|
// Load Window state and sizes
|
||||||
readSettings();
|
readSettings();
|
||||||
properties->readSettings();
|
properties->readSettings();
|
||||||
// Create status bar
|
|
||||||
status_bar = new StatusBar(QMainWindow::statusBar(), BTSession);
|
|
||||||
|
|
||||||
if(Preferences::startMinimized()) {
|
if(Preferences::startMinimized()) {
|
||||||
setWindowState(Qt::WindowMinimized);
|
setWindowState(Qt::WindowMinimized);
|
||||||
|
@ -239,69 +239,66 @@ int TransferListWidget::updateTorrent(int row) {
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
if(!h.is_seed()) {
|
// Queueing code
|
||||||
// Queueing code
|
if(!h.is_seed() && BTSession->isQueueingEnabled()) {
|
||||||
if(BTSession->isQueueingEnabled()) {
|
listModel->setData(listModel->index(row, PRIORITY), QVariant((int)h.queue_position()));
|
||||||
listModel->setData(listModel->index(row, PRIORITY), QVariant((int)h.queue_position()));
|
if(h.is_queued()) {
|
||||||
if(h.is_queued()) {
|
if(h.state() == torrent_status::checking_files || h.state() == torrent_status::queued_for_checking) {
|
||||||
if(h.state() == torrent_status::checking_files || h.state() == torrent_status::queued_for_checking) {
|
listModel->setData(listModel->index(row, NAME), QVariant(QIcon(QString::fromUtf8(":/Icons/oxygen/run-build.png"))), Qt::DecorationRole);
|
||||||
listModel->setData(listModel->index(row, NAME), QVariant(QIcon(QString::fromUtf8(":/Icons/oxygen/run-build.png"))), Qt::DecorationRole);
|
listModel->setData(listModel->index(row, PROGRESS), QVariant((double)h.progress()));
|
||||||
listModel->setData(listModel->index(row, PROGRESS), QVariant((double)h.progress()));
|
}else {
|
||||||
}else {
|
listModel->setData(listModel->index(row, NAME), QVariant(QIcon(QString::fromUtf8(":/Icons/oxygen/mail-queue.png"))), Qt::DecorationRole);
|
||||||
listModel->setData(listModel->index(row, NAME), QVariant(QIcon(QString::fromUtf8(":/Icons/oxygen/mail-queue.png"))), Qt::DecorationRole);
|
|
||||||
listModel->setData(listModel->index(row, ETA), QVariant((qlonglong)-1));
|
|
||||||
}
|
|
||||||
s = STATE_QUEUED;
|
|
||||||
listModel->setData(listModel->index(row, STATUS), STATE_QUEUED);
|
|
||||||
// Reset speeds and seeds/leech
|
|
||||||
listModel->setData(listModel->index(row, DLSPEED), QVariant((double)0.));
|
|
||||||
listModel->setData(listModel->index(row, UPSPEED), QVariant((double)0.));
|
|
||||||
listModel->setData(listModel->index(row, SEEDS), QVariant(0.0));
|
|
||||||
listModel->setData(listModel->index(row, PEERS), QVariant(0.0));
|
|
||||||
//setRowColor(row, QString::fromUtf8("grey"));
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(h.is_paused()) return STATE_PAUSED;
|
|
||||||
|
|
||||||
// Parse download state
|
|
||||||
switch(h.state()) {
|
|
||||||
case torrent_status::allocating:
|
|
||||||
case torrent_status::checking_files:
|
|
||||||
case torrent_status::queued_for_checking:
|
|
||||||
case torrent_status::checking_resume_data:
|
|
||||||
listModel->setData(listModel->index(row, NAME), QVariant(QIcon(QString::fromUtf8(":/Icons/oxygen/run-build.png"))), Qt::DecorationRole);
|
|
||||||
listModel->setData(listModel->index(row, STATUS), STATE_CHECKING);
|
|
||||||
s = STATE_CHECKING;
|
|
||||||
listModel->setData(listModel->index(row, ETA), QVariant((qlonglong)-1));
|
|
||||||
//setRowColor(row, QString::fromUtf8("grey"));
|
|
||||||
break;
|
|
||||||
case torrent_status::downloading:
|
|
||||||
case torrent_status::downloading_metadata:
|
|
||||||
if(h.download_payload_rate() > 0) {
|
|
||||||
listModel->setData(listModel->index(row, NAME), QVariant(QIcon(QString::fromUtf8(":/Icons/skin/downloading.png"))), Qt::DecorationRole);
|
|
||||||
listModel->setData(listModel->index(row, ETA), QVariant((qlonglong)BTSession->getETA(hash)));
|
|
||||||
listModel->setData(listModel->index(row, STATUS), STATE_DOWNLOADING);
|
|
||||||
s = STATE_DOWNLOADING;
|
|
||||||
//setRowColor(row, QString::fromUtf8("green"));
|
|
||||||
}else{
|
|
||||||
listModel->setData(listModel->index(row, NAME), QVariant(QIcon(QString::fromUtf8(":/Icons/skin/stalled.png"))), Qt::DecorationRole);
|
|
||||||
listModel->setData(listModel->index(row, ETA), QVariant((qlonglong)-1));
|
listModel->setData(listModel->index(row, ETA), QVariant((qlonglong)-1));
|
||||||
listModel->setData(listModel->index(row, STATUS), STATE_STALLED);
|
|
||||||
s = STATE_STALLED;
|
|
||||||
//setRowColor(row, QApplication::palette().color(QPalette::WindowText));
|
|
||||||
}
|
}
|
||||||
listModel->setData(listModel->index(row, UPSPEED), QVariant((double)h.upload_payload_rate()));
|
s = STATE_QUEUED;
|
||||||
break;
|
listModel->setData(listModel->index(row, STATUS), STATE_QUEUED);
|
||||||
case torrent_status::finished:
|
// Reset speeds and seeds/leech
|
||||||
case torrent_status::seeding:
|
listModel->setData(listModel->index(row, DLSPEED), QVariant((double)0.));
|
||||||
listModel->setData(listModel->index(row, ETA), QVariant((qlonglong)-1));
|
listModel->setData(listModel->index(row, UPSPEED), QVariant((double)0.));
|
||||||
listModel->setData(listModel->index(row, UPSPEED), QVariant((double)h.upload_payload_rate()));
|
listModel->setData(listModel->index(row, SEEDS), QVariant(0.0));
|
||||||
listModel->setData(listModel->index(row, STATUS), STATE_SEEDING);
|
listModel->setData(listModel->index(row, PEERS), QVariant(0.0));
|
||||||
s = STATE_SEEDING;
|
//setRowColor(row, QString::fromUtf8("grey"));
|
||||||
|
return s;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(h.is_paused()) return STATE_PAUSED;
|
||||||
|
|
||||||
|
// Parse download state
|
||||||
|
switch(h.state()) {
|
||||||
|
case torrent_status::allocating:
|
||||||
|
case torrent_status::checking_files:
|
||||||
|
case torrent_status::queued_for_checking:
|
||||||
|
case torrent_status::checking_resume_data:
|
||||||
|
listModel->setData(listModel->index(row, NAME), QVariant(QIcon(QString::fromUtf8(":/Icons/oxygen/run-build.png"))), Qt::DecorationRole);
|
||||||
|
listModel->setData(listModel->index(row, STATUS), STATE_CHECKING);
|
||||||
|
s = STATE_CHECKING;
|
||||||
|
listModel->setData(listModel->index(row, ETA), QVariant((qlonglong)-1));
|
||||||
|
//setRowColor(row, QString::fromUtf8("grey"));
|
||||||
|
break;
|
||||||
|
case torrent_status::downloading:
|
||||||
|
case torrent_status::downloading_metadata:
|
||||||
|
if(h.download_payload_rate() > 0) {
|
||||||
|
listModel->setData(listModel->index(row, NAME), QVariant(QIcon(QString::fromUtf8(":/Icons/skin/downloading.png"))), Qt::DecorationRole);
|
||||||
|
listModel->setData(listModel->index(row, ETA), QVariant((qlonglong)BTSession->getETA(hash)));
|
||||||
|
listModel->setData(listModel->index(row, STATUS), STATE_DOWNLOADING);
|
||||||
|
s = STATE_DOWNLOADING;
|
||||||
|
//setRowColor(row, QString::fromUtf8("green"));
|
||||||
|
}else{
|
||||||
|
listModel->setData(listModel->index(row, NAME), QVariant(QIcon(QString::fromUtf8(":/Icons/skin/stalled.png"))), Qt::DecorationRole);
|
||||||
|
listModel->setData(listModel->index(row, ETA), QVariant((qlonglong)-1));
|
||||||
|
listModel->setData(listModel->index(row, STATUS), STATE_STALLED);
|
||||||
|
s = STATE_STALLED;
|
||||||
|
//setRowColor(row, QApplication::palette().color(QPalette::WindowText));
|
||||||
|
}
|
||||||
|
listModel->setData(listModel->index(row, UPSPEED), QVariant((double)h.upload_payload_rate()));
|
||||||
|
break;
|
||||||
|
case torrent_status::finished:
|
||||||
|
case torrent_status::seeding:
|
||||||
|
listModel->setData(listModel->index(row, ETA), QVariant((qlonglong)-1));
|
||||||
|
listModel->setData(listModel->index(row, UPSPEED), QVariant((double)h.upload_payload_rate()));
|
||||||
|
listModel->setData(listModel->index(row, STATUS), STATE_SEEDING);
|
||||||
|
s = STATE_SEEDING;
|
||||||
|
}
|
||||||
// Common to both downloads and uploads
|
// Common to both downloads and uploads
|
||||||
listModel->setData(listModel->index(row, PROGRESS), QVariant((double)h.progress()));
|
listModel->setData(listModel->index(row, PROGRESS), QVariant((double)h.progress()));
|
||||||
listModel->setData(listModel->index(row, DLSPEED), QVariant((double)h.download_payload_rate()));
|
listModel->setData(listModel->index(row, DLSPEED), QVariant((double)h.download_payload_rate()));
|
||||||
|
@ -88,7 +88,7 @@ public:
|
|||||||
statusSep3->setFixedSize(3, 18);
|
statusSep3->setFixedSize(3, 18);
|
||||||
statusSep3->setFrameStyle(QFrame::VLine);
|
statusSep3->setFrameStyle(QFrame::VLine);
|
||||||
statusSep3->setFrameShadow(QFrame::Raised);
|
statusSep3->setFrameShadow(QFrame::Raised);
|
||||||
layout->addWidget(DHTLbl, 0, 0, Qt::AlignRight);
|
layout->addWidget(DHTLbl, 0, 0, Qt::AlignLeft);
|
||||||
//layout->setColumnStretch(0, 10);
|
//layout->setColumnStretch(0, 10);
|
||||||
layout->addWidget(statusSep1, 0, 1, Qt::AlignRight);
|
layout->addWidget(statusSep1, 0, 1, Qt::AlignRight);
|
||||||
//layout->setColumnStretch(1, 1);
|
//layout->setColumnStretch(1, 1);
|
||||||
@ -96,7 +96,7 @@ public:
|
|||||||
//layout->setColumnStretch(2, 1);
|
//layout->setColumnStretch(2, 1);
|
||||||
layout->addWidget(statusSep2, 0, 3, Qt::AlignLeft);
|
layout->addWidget(statusSep2, 0, 3, Qt::AlignLeft);
|
||||||
//layout->setColumnStretch(3, 1);
|
//layout->setColumnStretch(3, 1);
|
||||||
layout->addWidget(dlSpeedLbl, 0, 4);
|
layout->addWidget(dlSpeedLbl, 0, 4, Qt::AlignLeft);
|
||||||
//layout->setColumnStretch(4, 10);
|
//layout->setColumnStretch(4, 10);
|
||||||
layout->addWidget(statusSep3, 0, 5, Qt::AlignLeft);
|
layout->addWidget(statusSep3, 0, 5, Qt::AlignLeft);
|
||||||
//layout->setColumnStretch(5, 10);
|
//layout->setColumnStretch(5, 10);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user