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

Last change on this file since 11691 was 11611, checked in by tbretz, 13 years ago
Fixed AddEnv - should be 'host' not 'dns'
File size: 1.7 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 conf.AddEnv("dns", "DIM_DNS_NODE");
42 conf.AddEnv("host", "DIM_HOST_NODE");
43
44 conf.AddOptions(config);
45}
46
47int main(int argc, const char* argv[])
48{
49 Configuration conf(argv[0]);
50 conf.SetPrintUsage(PrintUsage);
51 SetupConfiguration(conf);
52
53 if (!conf.DoParse(argc, argv, PrintHelp))
54 return -1;
55
56 Dim::Setup(conf.Get<string>("dns"), conf.Get<string>("host"));
57
58 QApplication app(argc, const_cast<char**>(argv));
59
60 FactGui gui;
61 gui.show();
62
63 const int rc = app.exec();
64
65 cout << "The end." << endl;
66
67 return rc;
68}
Note: See TracBrowser for help on using the repository browser.