Some miscellaneous methods.
More...
#include <systemfactory.h>
Some miscellaneous methods.
Definition at line 72 of file systemfactory.h.
QPair< UpdateInfo, QNetworkReply::NetworkError > SystemFactory::checkForUpdates |
( |
| ) |
|
|
static |
Tries to synchronously download list with new updates.
- Returns
- Returns information about new updates + network download status.
Definition at line 54 of file systemfactory.cpp.
55 QPair<UpdateInfo, QNetworkReply::NetworkError> result;
56 QByteArray releases_xml;
62 if (result.second == QNetworkReply::NoError) {
static UpdateInfo parseUpdatesFile(const QByteArray &updates_file)
Performs parsing of downloaded file with list of updates.
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.
UpdateInfo SystemFactory::parseUpdatesFile |
( |
const QByteArray & |
updates_file | ) |
|
|
static |
Performs parsing of downloaded file with list of updates.
- Parameters
-
updates_file | File to parse. |
- Returns
- Returns parsed update information.
Definition at line 69 of file systemfactory.cpp.
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();
Information about available update.
Information about update metadata.
The documentation for this class was generated from the following files: