blob: d33468a487375fd935529339f4c5b7ab2494b493 (
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
#include <fltk/run.h>
#include <iostream>
#include <stdlib.h>
#include "inc/SWindow.h"
#include "inc/DataEntry.h"
#include "inc/functions.h"
using namespace std;
using namespace fltk;
/**
* MAIN
*
*/
int main(int argc, char** argv)
{
if (argc > 1 )
{
if (strcmp(argv[1],"-h") | strcmp(argv[1], "--help") )
{
/* print help */
printf("SessionChooser \n");
printf("\t{-p |--path=}[path to xml files]\n");
printf("\t{-g |--group=}[group name]\n");
printf("\t{-h |--help}[ as first parameter - prints help ]\n");
exit(0);
}
}
char* xmlpath = NULL;
char* slxgroup = NULL;
for (int i=0; i<argc; i++)
{
/* Get path parameter - path to XML files */
if (strstr(argv[i],"-p") != NULL)
{
i++;
xmlpath = argv[i];
}
if (strstr(argv[i],"--path=") != NULL)
{
char* temp = strpbrk("=", argv[i] );
xmlpath = (temp ++);
}
/* Get group parameter - SLXGroup */
if (strstr(argv[i],"-g") != NULL)
{
i++;
slxgroup = argv[i];
}
if (strstr(argv[i],"--group=") != NULL)
{
char* temp = strpbrk("=", argv[i] );
slxgroup =( temp ++ );
}
}
if (xmlpath == NULL)
{
xmlpath = "xmltest";
}
if (slxgroup == NULL)
{
slxgroup = "default";
}
/* read xml files */
DataEntry** sessions = NULL;
if (xmlpath != NULL)
{
sessions = readXmlDir(xmlpath);
}
else
{
fprintf(stderr,"Please give a path to xml directory for session images!");
exit(1);
}
SWindow& win = *SWindow::getInstance();
if (sessions != NULL)
{
win.set_entries(sessions);
}
win.show(argc,argv);
return run();
}
|