summaryrefslogtreecommitdiffstats
path: root/src/main.cpp
diff options
context:
space:
mode:
authorJan Darmochwal2010-10-02 18:50:09 +0200
committerJan Darmochwal2010-10-02 18:50:09 +0200
commit6117049617df720fb744a90773a3580b3450b005 (patch)
treec3b605ab7a7c2e9fd9d14572e8c0e69432d6ac76 /src/main.cpp
parentfixed bad copy & paste in CMakeLists.txt (diff)
downloadvmchooser-6117049617df720fb744a90773a3580b3450b005.tar.gz
vmchooser-6117049617df720fb744a90773a3580b3450b005.tar.xz
vmchooser-6117049617df720fb744a90773a3580b3450b005.zip
Qt port is almost complete (at least it compiles)
Major change: * struct DataEntry has become class Session with sub-classes XSession and VSession * functions from addInfo.cpp, addPrinters.cpp, addScanners.cpp, readLinSess.cpp, readXmlDir.cpp, runImage.cpp have been moved to XSession and VSession Several minor changes: * new files globals.h and globals.cpp for global variables (replaces constants.h and paths.h) * replaced (all) libxml2, (much) std:: and (most) boost:: stuff by Qt stuff Things left to do: * remove tons of debug printfs * show error messages on errors * tidy up anyoption stuff in main() * highlight session run previously * readGroupXml stuff * tree view (with "X Sessions" and "Virtual Sessions" sections) instead of list view for session selection
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp54
1 files changed, 18 insertions, 36 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 452bb89..1fa71be 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -3,14 +3,11 @@
#include <iostream>
#include <stdlib.h>
-#include "DataEntry.h"
-#include "functions.h"
+#include "save_restore_session.h"
+#include "xsession.h"
+#include "vsession.h"
#include "anyoption.h"
-#include "paths.h"
-
-#include <libxml/parser.h>
-#include <libxml/tree.h>
-#include <libxml/xpath.h>
+#include "globals.h"
#include <boost/filesystem.hpp>
@@ -18,10 +15,9 @@ namespace bfs=boost::filesystem;
using namespace std;
-// defined in readXmlDir.h
-extern DataEntry* get_entry(xmlDoc * doc);
-
int main(int argc, char *argv[]) {
+ QApplication a(argc, argv);
+
string version = "0.0.13";
AnyOption* opt = new AnyOption();
char* xmlpath = NULL;
@@ -124,6 +120,7 @@ int main(int argc, char *argv[]) {
lsesspath = opt->getValue("lpath");
}
if (lsesspath == NULL) {
+ // TODO: absolute paths as constants
lsesspath = (char *) "/usr/share/xsessions/";
}
@@ -144,7 +141,7 @@ int main(int argc, char *argv[]) {
}
else {
i = size.find_first_of("x");
- if( i == string::npos) {
+ if (i == string::npos) {
cerr << "Please write <width>x<height> as argument for -s|--size." << endl;
return 1;
}
@@ -154,6 +151,7 @@ int main(int argc, char *argv[]) {
// additional xml argument -> start image directly
+#if 0
if(opt->getArgc() > 0) {
string single_arg = opt->getArgv(0);
if(bfs::is_directory(single_arg)) {
@@ -176,38 +174,22 @@ int main(int argc, char *argv[]) {
return 1;
}
}
+#endif
delete opt;
/* read xml files */
- std::vector<DataEntry> sessions;
- std::vector<DataEntry> lsessions;
-printf("dummy\n");
- sessions = readXmlDir(xmlpath);
-printf("dummy2\n");
- lsessions = readLinSess(lsesspath);
-printf("dummy3\n");
+ QList<Session*> xsessions(XSession::readSessions(lsesspath));
+ QList<Session*> vsessions(VSession::readXmlDir(xmlpath));
-printf ("%d sessions\n", sessions.size());
-printf ("%d lsessions\n", lsessions.size());
+ printf ("%d VSessions\n", vsessions.size());
+ printf ("%d XSessions\n", xsessions.size());
- bool lin_entries=false;
- bool vm_entries=false;
-
- if(lsessions.size()) {
- //win.set_lin_entries(lsessions);
- lin_entries = true;
- }
- if (sessions.size()) {
- //win.set_entries(sessions);
- vm_entries = true;
- }
-
- sessions.insert(sessions.begin(), lsessions.begin(), lsessions.end());
-
- QApplication a(argc, argv);
Dialog w;
- w.addItems(sessions);
+ w.resize(width, height);
+
+ w.addItems(xsessions, "X Sessions");
+ w.addItems(vsessions, "Virtual Sessions");
w.show();
return a.exec();
}