Browse Source

- Fix completed torrent counting

- Make sure the status bar is displayed before showing the GUI
adaptive-webui-19844
Christophe Dumez 15 years ago
parent
commit
cedc87a703
  1. 4
      src/GUI.cpp
  2. 113
      src/TransferListWidget.cpp
  3. 4
      src/statusbar.h

4
src/GUI.cpp

@ -196,14 +196,14 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), dis @@ -196,14 +196,14 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), dis
// Accept drag 'n drops
setAcceptDrops(true);
createKeyboardShortcuts();
// Create status bar
status_bar = new StatusBar(QMainWindow::statusBar(), BTSession);
show();
// Load Window state and sizes
readSettings();
properties->readSettings();
// Create status bar
status_bar = new StatusBar(QMainWindow::statusBar(), BTSession);
if(Preferences::startMinimized()) {
setWindowState(Qt::WindowMinimized);

113
src/TransferListWidget.cpp

@ -239,69 +239,66 @@ int TransferListWidget::updateTorrent(int row) { @@ -239,69 +239,66 @@ int TransferListWidget::updateTorrent(int row) {
return s;
}
try {
if(!h.is_seed()) {
// Queueing code
if(BTSession->isQueueingEnabled()) {
listModel->setData(listModel->index(row, PRIORITY), QVariant((int)h.queue_position()));
if(h.is_queued()) {
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, PROGRESS), QVariant((double)h.progress()));
}else {
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);
// Queueing code
if(!h.is_seed() && BTSession->isQueueingEnabled()) {
listModel->setData(listModel->index(row, PRIORITY), QVariant((int)h.queue_position()));
if(h.is_queued()) {
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, PROGRESS), QVariant((double)h.progress()));
}else {
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));
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:
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, UPSPEED), QVariant((double)h.upload_payload_rate()));
listModel->setData(listModel->index(row, STATUS), STATE_SEEDING);
s = STATE_SEEDING;
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
listModel->setData(listModel->index(row, PROGRESS), QVariant((double)h.progress()));
listModel->setData(listModel->index(row, DLSPEED), QVariant((double)h.download_payload_rate()));

4
src/statusbar.h

@ -88,7 +88,7 @@ public: @@ -88,7 +88,7 @@ public:
statusSep3->setFixedSize(3, 18);
statusSep3->setFrameStyle(QFrame::VLine);
statusSep3->setFrameShadow(QFrame::Raised);
layout->addWidget(DHTLbl, 0, 0, Qt::AlignRight);
layout->addWidget(DHTLbl, 0, 0, Qt::AlignLeft);
//layout->setColumnStretch(0, 10);
layout->addWidget(statusSep1, 0, 1, Qt::AlignRight);
//layout->setColumnStretch(1, 1);
@ -96,7 +96,7 @@ public: @@ -96,7 +96,7 @@ public:
//layout->setColumnStretch(2, 1);
layout->addWidget(statusSep2, 0, 3, Qt::AlignLeft);
//layout->setColumnStretch(3, 1);
layout->addWidget(dlSpeedLbl, 0, 4);
layout->addWidget(dlSpeedLbl, 0, 4, Qt::AlignLeft);
//layout->setColumnStretch(4, 10);
layout->addWidget(statusSep3, 0, 5, Qt::AlignLeft);
//layout->setColumnStretch(5, 10);

Loading…
Cancel
Save