2024-08-29 11:21:00 +00:00
|
|
|
#include "Service.h"
|
2024-09-03 13:40:08 +00:00
|
|
|
#include "../Configurator.h"
|
|
|
|
|
|
|
|
#include <QEventLoop>
|
|
|
|
#include <QNetworkRequest>
|
2024-08-29 11:21:00 +00:00
|
|
|
#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();
|
|
|
|
}
|
|
|
|
|
2024-09-03 16:59:36 +00:00
|
|
|
QPixmap const &Service::pixmap() const {
|
2024-09-03 13:40:08 +00:00
|
|
|
if(_image.isNull())
|
|
|
|
_image.loadFromData(app->download(app->baseUrl() + image));
|
|
|
|
|
|
|
|
return _image;
|
|
|
|
}
|
|
|
|
|
2024-08-29 11:21:00 +00:00
|
|
|
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()});
|
|
|
|
}
|
|
|
|
}
|