Esempio n. 1
0
	json QueueFileUtils::serializeFileProperty(const QueueItemPtr& aFile, int aPropertyName) noexcept {
		switch (aPropertyName) {
		case PROP_SOURCES:
		{
			auto c = QueueManager::getInstance()->getSourceCount(aFile);
			return Serializer::serializeSourceCount(c);
		}

		case PROP_STATUS:
		{
			return {
				{ "finished", aFile->isSet(QueueItem::FLAG_FINISHED) },
				{ "str", formatDisplayStatus(aFile) },
			};
		}
		case PROP_PRIORITY: {
			return Serializer::serializePriority(*aFile.get());
		}
		case PROP_TYPE:
		{
			return Serializer::serializeFileType(aFile->getTarget());
		}
		}

		dcassert(0);
		return nullptr;
	}