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

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