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

Last change on this file since 13212 was 12658, checked in by tbretz, 13 years ago
Implemented access to the CommentDB for commenting runs.
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 ("CommentDB", var<string>(""), "")
41 ;
42
43 po::options_description runtype("Run type configuration");
44 runtype.add_options()
45 ("run-type", vars<string>(), "Names of available run-types")
46 ("run-time", vars<string>(), "Possible run-times for runs")
47 ("run-count", vars<uint32_t>(), "Number of events for a run")
48 ;
49
50 conf.AddEnv("dns", "DIM_DNS_NODE");
51 conf.AddEnv("host", "DIM_HOST_NODE");
52
53 conf.AddOptions(config);
54 conf.AddOptions(runtype);
55}
56
57int main(int argc, const char* argv[])
58{
59 Configuration conf(argv[0]);
60 conf.SetPrintUsage(PrintUsage);
61 SetupConfiguration(conf);
62
63 if (!conf.DoParse(argc, argv, PrintHelp))
64 return -1;
65
66 Dim::Setup(conf.Get<string>("dns"), conf.Get<string>("host"));
67
68 QApplication app(argc, const_cast<char**>(argv));
69
70 FactGui gui(conf);
71 gui.show();
72
73 const int rc = app.exec();
74
75 cout << "The end." << endl;
76
77 return rc;
78}
Note: See TracBrowser for help on using the repository browser.