本文整理汇总了C++中QueueItemPtr::getPercentage方法的典型用法代码示例。如果您正苦于以下问题:C++ QueueItemPtr::getPercentage方法的具体用法?C++ QueueItemPtr::getPercentage怎么用?C++ QueueItemPtr::getPercentage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QueueItemPtr
的用法示例。
在下文中一共展示了QueueItemPtr::getPercentage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: compareFiles
int QueueFileUtils::compareFiles(const QueueItemPtr& a, const QueueItemPtr& b, int aPropertyName) noexcept {
switch (aPropertyName) {
case PROP_NAME: {
return Util::pathSort(a->getTarget(), b->getTarget());
}
case PROP_TYPE: {
return Util::stricmp(Util::getFileExt(a->getTarget()), Util::getFileExt(b->getTarget()));
}
case PROP_PRIORITY: {
COMPARE_FINISHED(a, b);
return compare(static_cast<int>(a->getPriority()), static_cast<int>(b->getPriority()));
}
case PROP_STATUS: {
COMPARE_FINISHED(a, b);
return compare(
a->getPercentage(QueueManager::getInstance()->getDownloadedBytes(a)),
b->getPercentage(QueueManager::getInstance()->getDownloadedBytes(b))
);
}
case PROP_SOURCES: {
COMPARE_FINISHED(a, b);
auto countsA = QueueManager::getInstance()->getSourceCount(a);
auto countsB = QueueManager::getInstance()->getSourceCount(b);
return QueueItemBase::SourceCount::compare(countsA, countsB);
}
default:
dcassert(0);
}
return 0;
}
示例2: formatDisplayStatus
std::string QueueFileUtils::formatDisplayStatus(const QueueItemPtr& aItem) noexcept {
if (aItem->isSet(QueueItem::FLAG_FINISHED)) {
return STRING(FINISHED);
}
auto percentage = aItem->getPercentage(QueueManager::getInstance()->getDownloadedBytes(aItem));
if (aItem->isPausedPrio()) {
return STRING_F(PAUSED_PCT, percentage);
} else if (QueueManager::getInstance()->isWaiting(aItem)) {
return STRING_F(WAITING_PCT, percentage);
} else {
return STRING_F(RUNNING_PCT, percentage);
}
}