#ifndef VMCHOOSER_XSESSION_H_ #define VMCHOOSER_XSESSION_H_ #include #include #include #include #include #include #include "session.h" class XSession : public Session { public: void init(const QString& name, const QString& exec, const QString& tryExec, const QString& comment, const QString& icon); bool init(const QString& filename); bool isActive() const; bool isLocked() const; SectionType section() const { return SECTION_XSESSION; } QString shortDescription() const { return this->name_; } QString description() const { return this->comment_; } QString execCommand() const { return this->exec_; } int priority() const { return this->priority_; } QIcon icon() const; bool prepareRun() const; void run() const; int type() const; bool operator<(const Session& other) const; static QList readSessions(const QString& path); bool containsKeywords(const QList& keywords) const; protected: QString checkCanRunInternal() const; private: QString name_; QString exec_; QString tryExec_; QString comment_; QString icon_; int priority_; static void loadXSessionsConfig(); static inline int find(QChar c, int start, const QString& line) { do { int next = line.indexOf(c, start); if (next == -1) return -1; if (line.at(next - 1) != '\\') return next; start = next + 1; } while (true); } }; #endif /*VMCHOOSER_XSESSION_H_*/