31 #include "miscellaneous/systemfactory.h"
33 #include "definitions/definitions.h"
34 #include "network-web/networkfactory.h"
35 #include "application.h"
43 #include <QDomDocument>
44 #include <QDomElement>
48 SystemFactory::SystemFactory() {
51 SystemFactory::~SystemFactory() {
55 QPair<UpdateInfo, QNetworkReply::NetworkError> result;
56 QByteArray releases_xml;
62 if (result.second == QNetworkReply::NoError) {
71 QDomDocument document; document.setContent(updates_file,
false);
72 QDomNodeList releases = document.elementsByTagName(
"release");
74 if (releases.size() == 1) {
75 QDomElement rel_elem = releases.at(0).toElement();
76 QString type = rel_elem.attributes().namedItem(
"type").toAttr().value();
78 update.m_availableVersion = rel_elem.attributes().namedItem(
"version").toAttr().value();
79 update.m_changes = rel_elem.namedItem(
"changes").toElement().text();
81 QDomNodeList urls = rel_elem.elementsByTagName(
"url");
83 for (
int j = 0; j < urls.size(); j++) {
85 QDomElement url_elem = urls.at(j).toElement();
87 url.m_fileUrl = url_elem.text();
88 url.m_os = url_elem.attributes().namedItem(
"os").toAttr().value();
89 url.m_platform = url_elem.attributes().namedItem(
"platform").toAttr().value();
91 update.m_urls.insert(url.m_os,
95 if (type ==
"maintenance") {
96 update.m_type = UpdateInfo::Maintenance;
99 update.m_type = UpdateInfo::Evolution;
103 update.m_availableVersion = QString();
static UpdateInfo parseUpdatesFile(const QByteArray &updates_file)
Performs parsing of downloaded file with list of updates.
static QPair< UpdateInfo, QNetworkReply::NetworkError > checkForUpdates()
Tries to synchronously download list with new updates.
Information about available update.
static QNetworkReply::NetworkError downloadFile(const QString &url, int timeout, QByteArray &output, bool protected_contents=false, const QString &username=QString(), const QString &password=QString())
Performs SYNCHRONOUS download of file with given URL and given timeout.
Information about update metadata.