34 lines
787 B
C++
34 lines
787 B
C++
#include "Service.h"
|
|
#include "../Configurator.h"
|
|
|
|
#include <QEventLoop>
|
|
#include <QNetworkRequest>
|
|
#include <iostream>
|
|
|
|
Service::Service(QJsonObject const &o) {
|
|
title = o["Title"].toString();
|
|
url = o["Url"].toString();
|
|
documentationUrl = o["DocumentationUrl"].toString();
|
|
image = o["Image"].toString();
|
|
description = o["Description"].toString();
|
|
specialNote = o["SpecialNote"].toString();
|
|
LDAP = o["LDAP"].toBool();
|
|
}
|
|
|
|
QPixmap const &Service::pixmap() {
|
|
if(_image.isNull())
|
|
_image.loadFromData(app->download(app->baseUrl() + image));
|
|
|
|
return _image;
|
|
}
|
|
|
|
Services::Services(QJsonArray const &a):QList<Service>() {
|
|
for(auto i : a) {
|
|
if(!i.isObject()) {
|
|
std::cerr << "Non-object in JSON array, ignoring" << std::endl;
|
|
continue;
|
|
}
|
|
append(Service{i.toObject()});
|
|
}
|
|
}
|