diff options
Diffstat (limited to 'launcher/news/NewsEntry.cpp')
-rw-r--r-- | launcher/news/NewsEntry.cpp | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/launcher/news/NewsEntry.cpp b/launcher/news/NewsEntry.cpp index cfe07e86..ea25f2e5 100644 --- a/launcher/news/NewsEntry.cpp +++ b/launcher/news/NewsEntry.cpp @@ -18,16 +18,14 @@ #include <QDomNodeList> #include <QVariant> -NewsEntry::NewsEntry(QObject* parent) : - QObject(parent) +NewsEntry::NewsEntry(QObject* parent) : QObject(parent) { this->title = tr("Untitled"); this->content = tr("No content."); this->link = ""; } -NewsEntry::NewsEntry(const QString& title, const QString& content, const QString& link, QObject* parent) : - QObject(parent) +NewsEntry::NewsEntry(const QString& title, const QString& content, const QString& link, QObject* parent) : QObject(parent) { this->title = title; this->content = content; @@ -37,21 +35,18 @@ NewsEntry::NewsEntry(const QString& title, const QString& content, const QString /*! * Gets the text content of the given child element as a QVariant. */ -inline QString childValue(const QDomElement& element, const QString& childName, QString defaultVal="") +inline QString childValue(const QDomElement& element, const QString& childName, QString defaultVal = "") { QDomNodeList nodes = element.elementsByTagName(childName); - if (nodes.count() > 0) - { - QDomElement element = nodes.at(0).toElement(); - return element.text(); - } - else - { + if (nodes.count() > 0) { + QDomElement elem = nodes.at(0).toElement(); + return elem.text(); + } else { return defaultVal; } } -bool NewsEntry::fromXmlElement(const QDomElement& element, NewsEntry* entry, QString* errorMsg) +bool NewsEntry::fromXmlElement(const QDomElement& element, NewsEntry* entry, [[maybe_unused]] QString* errorMsg) { QString title = childValue(element, "title", tr("Untitled")); QString content = childValue(element, "content", tr("No content.")); @@ -62,4 +57,3 @@ bool NewsEntry::fromXmlElement(const QDomElement& element, NewsEntry* entry, QSt entry->link = link; return true; } - |