From 414c109d650a1014e7b84dfb66a00df420d67c97 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Wed, 20 Jan 2016 16:43:34 +0100 Subject: Remodel section handling: Use constants --- src/vsession.h | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'src/vsession.h') diff --git a/src/vsession.h b/src/vsession.h index 34c7457..49bde75 100644 --- a/src/vsession.h +++ b/src/vsession.h @@ -25,6 +25,14 @@ class VSession : public Session { bool isValid() const; int priority() const; + bool isTemplate() const { + return getAttribute("is_template").toInt() != 0; + } + + bool isForLocation() const { + return getAttribute("for_location").toInt() != 0; + } + QString shortDescription() const { return getAttribute("short_description"); } @@ -39,11 +47,14 @@ class VSession : public Session { return getAttribute("os"); } - QString section() const { - QString attr = getAttribute("section"); - if (!attr.isEmpty()) - return attr; - return QObject::tr("Priority: ").append(QString::number(priority())); + SectionType section() const { + if (g_forLocationHandling != LOCATION_IGNORE && isForLocation()) { + return SECTION_FOR_LOCATION; + } + if (g_templateHandling == TEMPLATES_BUMP && isTemplate()) { + return SECTION_TEMPLATES; + } + return SECTION_GENERIC; } QString getAttribute(const QString& nodeName, -- cgit v1.2.3-55-g7522