source: branches/FACT++_lidctrl_usb/gui/fact.cc@ 19085

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