|
|
@ -112,42 +112,37 @@ QString TorrentContentModelItem::displayData(const int column) const |
|
|
|
case COL_NAME: |
|
|
|
case COL_NAME: |
|
|
|
return m_name; |
|
|
|
return m_name; |
|
|
|
case COL_PRIO: |
|
|
|
case COL_PRIO: |
|
|
|
{ |
|
|
|
switch (m_priority) |
|
|
|
switch (m_priority) |
|
|
|
{ |
|
|
|
{ |
|
|
|
case BitTorrent::DownloadPriority::Mixed: |
|
|
|
case BitTorrent::DownloadPriority::Mixed: |
|
|
|
return tr("Mixed", "Mixed (priorities"); |
|
|
|
return tr("Mixed", "Mixed (priorities"); |
|
|
|
case BitTorrent::DownloadPriority::Ignored: |
|
|
|
case BitTorrent::DownloadPriority::Ignored: |
|
|
|
return tr("Not downloaded"); |
|
|
|
return tr("Not downloaded"); |
|
|
|
case BitTorrent::DownloadPriority::High: |
|
|
|
case BitTorrent::DownloadPriority::High: |
|
|
|
return tr("High", "High (priority)"); |
|
|
|
return tr("High", "High (priority)"); |
|
|
|
case BitTorrent::DownloadPriority::Maximum: |
|
|
|
case BitTorrent::DownloadPriority::Maximum: |
|
|
|
return tr("Maximum", "Maximum (priority)"); |
|
|
|
return tr("Maximum", "Maximum (priority)"); |
|
|
|
default: |
|
|
|
default: |
|
|
|
return tr("Normal", "Normal (priority)"); |
|
|
|
return tr("Normal", "Normal (priority)"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
case COL_PROGRESS: |
|
|
|
case COL_PROGRESS: |
|
|
|
{ |
|
|
|
return (m_progress >= 1) |
|
|
|
const qreal progress = m_progress * 100; |
|
|
|
? QString::fromLatin1("100%") |
|
|
|
return (static_cast<int>(progress) == 100) |
|
|
|
: (Utils::String::fromDouble((m_progress * 100), 1) + QLatin1Char('%')); |
|
|
|
? QString::fromLatin1("100%") |
|
|
|
|
|
|
|
: (Utils::String::fromDouble(progress, 1) + QLatin1Char('%')); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
case COL_SIZE: |
|
|
|
case COL_SIZE: |
|
|
|
return Utils::Misc::friendlyUnit(m_size); |
|
|
|
return Utils::Misc::friendlyUnit(m_size); |
|
|
|
case COL_REMAINING: |
|
|
|
case COL_REMAINING: |
|
|
|
return Utils::Misc::friendlyUnit(remaining()); |
|
|
|
return Utils::Misc::friendlyUnit(remaining()); |
|
|
|
case COL_AVAILABILITY: |
|
|
|
case COL_AVAILABILITY: |
|
|
|
{ |
|
|
|
{ |
|
|
|
const int avail = availability(); |
|
|
|
const qreal avail = availability(); |
|
|
|
if (avail < 0) |
|
|
|
if (avail < 0) |
|
|
|
return tr("N/A"); |
|
|
|
return tr("N/A"); |
|
|
|
|
|
|
|
|
|
|
|
const QString value = (avail >= 1.0) |
|
|
|
const QString value = (avail >= 1) |
|
|
|
? QString::fromLatin1("100") |
|
|
|
? QString::fromLatin1("100") |
|
|
|
: Utils::String::fromDouble((avail * 100), 1); |
|
|
|
: Utils::String::fromDouble((avail * 100), 1); |
|
|
|
return QString {value + C_THIN_SPACE + QLatin1Char('%')}; |
|
|
|
return {value + C_THIN_SPACE + QLatin1Char('%')}; |
|
|
|
} |
|
|
|
} |
|
|
|
default: |
|
|
|
default: |
|
|
|
Q_ASSERT(false); |
|
|
|
Q_ASSERT(false); |
|
|
|