Browse Source

FEATURE: Added error state for torrents (error is displayed in a tooltip)

adaptive-webui-19844
Christophe Dumez 15 years ago
parent
commit
781d33b869
  1. 1
      Changelog
  2. 2
      src/bittorrent.cpp
  3. 12
      src/eventmanager.cpp
  4. 7
      src/qtorrenthandle.cpp
  5. 1
      src/qtorrenthandle.h
  6. 2
      src/src.pro
  7. 15
      src/transferlistwidget.cpp

1
Changelog

@ -7,6 +7,7 @@ @@ -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

2
src/bittorrent.cpp

@ -2034,7 +2034,7 @@ void Bittorrent::addConsoleMessage(QString msg, QString) { @@ -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);
}
}

12
src/eventmanager.cpp

@ -364,10 +364,14 @@ void EventManager::modifiedTorrent(QTorrentHandle h) @@ -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())

7
src/qtorrenthandle.cpp

@ -460,7 +460,12 @@ QString QTorrentHandle::root_path() const { @@ -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 {

1
src/qtorrenthandle.h

@ -131,6 +131,7 @@ class QTorrentHandle { @@ -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;
//

2
src/src.pro

@ -11,7 +11,7 @@ CONFIG += qt \ @@ -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

15
src/transferlistwidget.cpp

@ -249,10 +249,20 @@ void TransferListWidget::pauseTorrent(int row, bool refresh_list) { @@ -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));
@ -282,6 +292,7 @@ void TransferListWidget::resumeTorrent(int row, bool refresh_list) { @@ -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();

Loading…
Cancel
Save