57 lines
2.0 KiB
C++
57 lines
2.0 KiB
C++
#include "./aurpackage.h"
|
|
|
|
#include "../network/userrepository.h"
|
|
|
|
#include <QJsonObject>
|
|
|
|
using namespace ChronoUtilities;
|
|
|
|
namespace RepoIndex {
|
|
|
|
/*!
|
|
* \brief The AurPackage class holds information about AUR packages. It allows to convert the information
|
|
* to JSON objects used by the network classes and the web interface.
|
|
*/
|
|
|
|
/*!
|
|
* \brief Creates a new instance from the specified "AurJson value".
|
|
*/
|
|
AurPackage::AurPackage(const QJsonValue &aurJsonValue, UserRepository *repository) :
|
|
Package(QString(), repository)
|
|
{
|
|
m_origin = PackageOrigin::Aur;
|
|
QJsonObject obj = aurJsonValue.toObject();
|
|
m_name = obj.value(QStringLiteral("Name")).toString();
|
|
m_hasGeneralInfo = true;
|
|
m_id = obj.value(QStringLiteral("ID")).toInt(-1);
|
|
m_categoryId = obj.value(QStringLiteral("CategoryID")).toInt(-1);
|
|
m_version = obj.value(QStringLiteral("Version")).toString();
|
|
m_description = obj.value(QStringLiteral("Description")).toString();
|
|
m_upstreamUrl = obj.value(QStringLiteral("URL")).toString();
|
|
m_votes = obj.value(QStringLiteral("NumVotes")).toInt(0);
|
|
m_outOfDate = DateTime::fromTimeStamp(obj.value(QStringLiteral("OutOfDate")).toInt());
|
|
m_maintainer = obj.value(QStringLiteral("Maintainer")).toString();
|
|
m_firstSubmitted = DateTime::fromTimeStamp(obj.value(QStringLiteral("FirstSubmitted")).toInt());
|
|
m_lastModified = DateTime::fromTimeStamp(obj.value(QStringLiteral("LastModified")).toInt());
|
|
m_licenses << obj.value(QStringLiteral("License")).toString();
|
|
m_tarUrl = obj.value(QStringLiteral("URLPath")).toString();
|
|
}
|
|
|
|
/*!
|
|
* \brief Creates a new instance where only the name is known.
|
|
*/
|
|
AurPackage::AurPackage(const QString &name, UserRepository *repository) :
|
|
Package(name, repository)
|
|
{}
|
|
|
|
/*!
|
|
* \brief Creates a new, empty instance.
|
|
* \remarks The only purpose of this c'tor is to use it with restoreFromCacheStream().
|
|
*/
|
|
AurPackage::AurPackage(UserRepository *repository) :
|
|
Package(QString(), repository)
|
|
{}
|
|
|
|
} // namespace PackageManagement
|
|
|