blob: 7b9135be2e5510e6e7385fa61361ed6859ec7711 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
#ifndef VMCHOOSER_XSESSION_H_
#define VMCHOOSER_XSESSION_H_
#include <QString>
#include <QList>
#include <QDomDocument>
#include <QDir>
#include <QProcess>
#include <QRegularExpression>
#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<Session*> readSessions(const QString& path);
bool containsKeywords(const QList<QString>& 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_*/
|