Skip to content

Commit

Permalink
FEATURE: Added error state for torrents (error is displayed in a tool…
Browse files Browse the repository at this point in the history
…tip)
  • Loading branch information
Christophe Dumez committed May 24, 2010
1 parent 8db8841 commit 781d33b
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 9 deletions.
1 change: 1 addition & 0 deletions Changelog
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- FEATURE: User can force tracker reannounce
- FEATURE: Added "No action" setting for double-click action
- FEATURE: Several torrents can be moved at once
- FEATURE: Added error state for torrents (error is displayed in a tooltip)
- COSMETIC: Display peers country name in tooltip
- COSMETIC: Display number of torrents in transfers tab label

Expand Down
2 changes: 1 addition & 1 deletion src/bittorrent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2034,7 +2034,7 @@ void Bittorrent::addConsoleMessage(QString msg, QString) {
addConsoleMessage(tr("Reason: %1").arg(misc::toQString(p->message())));
if(h.is_valid()) {
emit fullDiskError(h, misc::toQString(p->message()));
h.pause();
//h.pause();
emit pausedTorrent(h);
}
}
Expand Down
12 changes: 8 additions & 4 deletions src/eventmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -364,10 +364,14 @@ void EventManager::modifiedTorrent(QTorrentHandle h)
QVariantMap event;
event["eta"] = QVariant(QString::fromUtf8(""));
if(h.is_paused()) {
if(h.is_seed())
event["state"] = QVariant("pausedUP");
else
event["state"] = QVariant("pausedDL");
if(h.has_error()) {
event["state"] = QVariant("error");
} else {
if(h.is_seed())
event["state"] = QVariant("pausedUP");
else
event["state"] = QVariant("pausedDL");
}
} else {
if(BTSession->isQueueingEnabled() && h.is_queued()) {
if(h.is_seed())
Expand Down
7 changes: 6 additions & 1 deletion src/qtorrenthandle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,12 @@ QString QTorrentHandle::root_path() const {

bool QTorrentHandle::has_error() const {
Q_ASSERT(h.is_valid());
return h.status().error.empty();
return h.is_paused() && !h.status().error.empty();
}

QString QTorrentHandle::error() const {
Q_ASSERT(h.is_valid());
return misc::toQString(h.status().error);
}

void QTorrentHandle::downloading_pieces(bitfield &bf) const {
Expand Down
1 change: 1 addition & 0 deletions src/qtorrenthandle.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ class QTorrentHandle {
bool first_last_piece_first() const;
QString root_path() const;
bool has_error() const;
QString error() const;
void downloading_pieces(bitfield &bf) const;

//
Expand Down
2 changes: 1 addition & 1 deletion src/src.pro
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ CONFIG += qt \
thread

# Update this VERSION for each release
DEFINES += VERSION=\'\"v2.3.0\"\'
DEFINES += VERSION=\'\"v2.3.0beta1\"\'
DEFINES += VERSION_MAJOR=2
DEFINES += VERSION_MINOR=3
DEFINES += VERSION_BUGFIX=0
Expand Down
15 changes: 13 additions & 2 deletions src/transferlistwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,10 +249,20 @@ void TransferListWidget::pauseTorrent(int row, bool refresh_list) {
listModel->setData(listModel->index(row, TR_UPSPEED), QVariant((double)0.0));
if(h.is_seed()) {
listModel->setData(listModel->index(row, TR_STATUS), STATE_PAUSED_UP);
listModel->setData(listModel->index(row, TR_NAME), QIcon(QString::fromUtf8(":/Icons/skin/pausedUP.png")), Qt::DecorationRole);
if(h.has_error()) {
listModel->setData(listModel->index(row, TR_NAME), h.error(), Qt::ToolTipRole);
listModel->setData(listModel->index(row, TR_NAME), QIcon(QString::fromUtf8(":/Icons/skin/error.png")), Qt::DecorationRole);
} else {
listModel->setData(listModel->index(row, TR_NAME), QIcon(QString::fromUtf8(":/Icons/skin/pausedUP.png")), Qt::DecorationRole);
}
} else {
listModel->setData(listModel->index(row, TR_STATUS), STATE_PAUSED_DL);
listModel->setData(listModel->index(row, TR_NAME), QIcon(QString::fromUtf8(":/Icons/skin/pausedDL.png")), Qt::DecorationRole);
if(h.has_error()) {
listModel->setData(listModel->index(row, TR_NAME), h.error(), Qt::ToolTipRole);
listModel->setData(listModel->index(row, TR_NAME), QIcon(QString::fromUtf8(":/Icons/skin/error.png")), Qt::DecorationRole);
} else {
listModel->setData(listModel->index(row, TR_NAME), QIcon(QString::fromUtf8(":/Icons/skin/pausedDL.png")), Qt::DecorationRole);
}
listModel->setData(listModel->index(row, TR_ETA), QVariant((qlonglong)MAX_ETA));
}
listModel->setData(listModel->index(row, TR_SEEDS), QVariant(0.0));
Expand Down Expand Up @@ -282,6 +292,7 @@ void TransferListWidget::resumeTorrent(int row, bool refresh_list) {
listModel->setData(listModel->index(row, TR_NAME), QVariant(QIcon(":/Icons/skin/stalledDL.png")), Qt::DecorationRole);
listModel->setData(listModel->index(row, TR_STATUS), STATE_STALLED_DL);
}
listModel->setData(listModel->index(row, TR_NAME), "", Qt::ToolTipRole);
setRowColor(row, QApplication::palette().color(QPalette::WindowText));
if(refresh_list)
refreshList();
Expand Down

0 comments on commit 781d33b

Please sign in to comment.