source: trunk/FACT++/gui/fact.cc@ 12349

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