summaryrefslogtreecommitdiffstats
path: root/src/vsession.h
diff options
context:
space:
mode:
authorNils Schwabe2014-03-03 15:14:20 +0100
committerNils Schwabe2014-03-03 15:14:20 +0100
commit030d91e628a2ecd5634376c9c4d903a1fa0fb423 (patch)
tree227029e3b48deb1d4d01ce497d9ec3b8d47f7a61 /src/vsession.h
parentInitial commit (diff)
downloadvmchooser2-030d91e628a2ecd5634376c9c4d903a1fa0fb423.tar.gz
vmchooser2-030d91e628a2ecd5634376c9c4d903a1fa0fb423.tar.xz
vmchooser2-030d91e628a2ecd5634376c9c4d903a1fa0fb423.zip
added files from vmchooser1
Diffstat (limited to 'src/vsession.h')
-rw-r--r--src/vsession.h72
1 files changed, 72 insertions, 0 deletions
diff --git a/src/vsession.h b/src/vsession.h
new file mode 100644
index 0000000..8bbcc7e
--- /dev/null
+++ b/src/vsession.h
@@ -0,0 +1,72 @@
+#ifndef VMCHOOSER_VSESSION_H_
+#define VMCHOOSER_VSESSION_H_
+
+#include <QString>
+#include <QList>
+#include <QDomDocument>
+#include <QDir>
+#include <QProcess>
+#include "session.h"
+
+enum ImgType {
+ VMWARE,
+ VBOX,
+ OTHER
+};
+
+class VSession : public Session {
+ public:
+ bool init(const QString& xml, const QString& baseDirPath);
+
+ ImgType imgtype() const;
+ bool isActive() const;
+ bool isLocked() const;
+ bool isValid() const;
+ int priority() const;
+
+ QString shortDescription() const {
+ return getAttribute("short_description");
+ }
+
+ QString description() const {
+ return getAttribute("description");
+ }
+
+ QString icon() const;
+
+ QString os() const {
+ return getAttribute("os");
+ }
+
+ QString getAttribute(const QString& nodeName,
+ const QString& attribute = "param") const;
+ QString getNodeText(const QString& nodeName) const;
+
+ void addNodeWithAttribute(const QString& nodeName,
+ const QString& value,
+ const QString& attribute = "param",
+ bool replace = true);
+ void addPrinters(const QString& script, const QString& type = "printer");
+ void addScanners(const QString& script);
+ void addUserAndHostname();
+ void mergePoolXml();
+
+ QString toXml() const;
+
+ bool run() const;
+
+ int type() const;
+
+ bool operator<(const Session& other) const;
+
+ static QList<Session*> readXmlDir(const QString& path);
+ static QList<Session*> readXmlFile(const QString& filepath);
+
+ private:
+ QDomDocument doc_;
+ QString baseDirPath_;
+
+ QProcess *_process;
+};
+
+#endif /*VMCHOOSER_VSESSION_H_*/