1 | #include "FactGui.h"
|
---|
2 |
|
---|
3 | #include <TSystem.h>
|
---|
4 |
|
---|
5 | #include "src/FACT.h"
|
---|
6 | #include "src/Dim.h"
|
---|
7 | #include "src/Configuration.h"
|
---|
8 |
|
---|
9 | /*
|
---|
10 | Extract usage clause(s) [if any] for SYNOPSIS.
|
---|
11 | Translators: "Usage" and "or" here are patterns (regular expressions) which
|
---|
12 | are used to match the usage synopsis in program output. An example from cp
|
---|
13 | (GNU coreutils) which contains both strings:
|
---|
14 | Usage: cp [OPTION]... [-T] SOURCE DEST
|
---|
15 | or: cp [OPTION]... SOURCE... DIRECTORY
|
---|
16 | or: cp [OPTION]... -t DIRECTORY SOURCE...
|
---|
17 | */
|
---|
18 | void PrintUsage()
|
---|
19 | {
|
---|
20 | cout << "\n"
|
---|
21 | "The FACT++ Graphical User Interfact (GUI).\n"
|
---|
22 | "\n"
|
---|
23 | "Usage: fact [-c type] [OPTIONS]\n"
|
---|
24 | " or: fact [OPTIONS]\n";
|
---|
25 | cout << endl;
|
---|
26 |
|
---|
27 | }
|
---|
28 |
|
---|
29 | void PrintHelp()
|
---|
30 | {
|
---|
31 | /* Additional help text which is printed after the configuration
|
---|
32 | options goes here */
|
---|
33 | }
|
---|
34 |
|
---|
35 | void SetupConfiguration(Configuration &conf)
|
---|
36 | {
|
---|
37 | po::options_description config("Program options");
|
---|
38 | config.add_options()
|
---|
39 | ("dns", var<string>("localhost"), "Dim nameserver (overwites DIM_DNS_NODE environment variable)")
|
---|
40 | ("host", var<string>(""), "Address with which the Dim nameserver can connect to this host (overwites DIM_HOST_NODE environment variable)")
|
---|
41 | ("pixel-map-file", var<string>("FACTmap111030.txt"), "Pixel mapping file. Used here to get the default reference voltage.")
|
---|
42 | ("CommentDB", var<string>(""), "")
|
---|
43 | ;
|
---|
44 |
|
---|
45 | po::options_description runtype("Run type configuration");
|
---|
46 | runtype.add_options()
|
---|
47 | ("run-type", vars<string>(), "Names of available run-types")
|
---|
48 | ("run-time", vars<string>(), "Possible run-times for runs")
|
---|
49 | ("run-count", vars<uint32_t>(), "Number of events for a run")
|
---|
50 | ;
|
---|
51 |
|
---|
52 | conf.AddEnv("dns", "DIM_DNS_NODE");
|
---|
53 | conf.AddEnv("host", "DIM_HOST_NODE");
|
---|
54 |
|
---|
55 | conf.AddOptions(config);
|
---|
56 | conf.AddOptions(runtype);
|
---|
57 | }
|
---|
58 |
|
---|
59 | int main(int argc, const char* argv[])
|
---|
60 | {
|
---|
61 | Configuration conf(argv[0]);
|
---|
62 | conf.SetPrintUsage(PrintUsage);
|
---|
63 | SetupConfiguration(conf);
|
---|
64 |
|
---|
65 | if (!conf.DoParse(argc, argv, PrintHelp))
|
---|
66 | return -1;
|
---|
67 |
|
---|
68 | Dim::Setup(conf.Get<string>("dns"), conf.Get<string>("host"));
|
---|
69 |
|
---|
70 | cout << "LD_LIBRARY_PATH=" << gSystem->GetDynamicPath() << endl;
|
---|
71 |
|
---|
72 | cout << "--- Starting QApplication ---" << endl;
|
---|
73 | QApplication app(argc, const_cast<char**>(argv));
|
---|
74 |
|
---|
75 | cout << "--- Instaniating GUI ---" << endl;
|
---|
76 |
|
---|
77 | FactGui gui(conf);
|
---|
78 |
|
---|
79 | cout << "--- Show GUI ---" << endl;
|
---|
80 | gui.show();
|
---|
81 |
|
---|
82 | cout << "--- Main loop ---" << endl;
|
---|
83 |
|
---|
84 | const int rc = app.exec();
|
---|
85 |
|
---|
86 | cout << "The end." << endl;
|
---|
87 |
|
---|
88 | return rc;
|
---|
89 | }
|
---|