42 lines
1.6 KiB
C++
42 lines
1.6 KiB
C++
#include "aurpackage.h"
|
|
|
|
#include "network/userrepository.h"
|
|
|
|
#include <QJsonObject>
|
|
|
|
using namespace ChronoUtilities;
|
|
|
|
namespace PackageManagement {
|
|
|
|
/*!
|
|
* \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 *source) :
|
|
Package(QString(), source)
|
|
{
|
|
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();
|
|
}
|
|
|
|
} // namespace PackageManagement
|
|
|