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;
	}
	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);
		}
	}