diff options
author | Simon Rettberg | 2016-01-20 16:43:34 +0100 |
---|---|---|
committer | Simon Rettberg | 2016-01-20 16:43:34 +0100 |
commit | 414c109d650a1014e7b84dfb66a00df420d67c97 (patch) | |
tree | ede0c5404aa408cd2bbb626312ed46383c7b13b6 /src/vsession.h | |
parent | Re-introduce tree structure: Allow server-defined sections (diff) | |
download | vmchooser2-414c109d650a1014e7b84dfb66a00df420d67c97.tar.gz vmchooser2-414c109d650a1014e7b84dfb66a00df420d67c97.tar.xz vmchooser2-414c109d650a1014e7b84dfb66a00df420d67c97.zip |
Remodel section handling: Use constants
Diffstat (limited to 'src/vsession.h')
-rw-r--r-- | src/vsession.h | 21 |
1 files changed, 16 insertions, 5 deletions
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, |