GeoDesk
0.1.3
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Typedefs
Pages
src
main.cpp
Go to the documentation of this file.
1
/**
2
* \file main.cpp
3
* \brief Tool to get geographical data from digitalised maps.
4
* \author Le Bars, Yoann
5
* \version 1.0
6
* \date 2013/06/19
7
* \date 2013/07/01
8
* \date 2014/02/05
9
* \date 2014/02/06
10
*/
11
12
/**
13
* \mainpage
14
* GeoDesk is a tool to get geographical data from digitalised maps.
15
*
16
* Command :
17
*
18
* geodesk [Options]
19
*
20
* Supported options:
21
*
22
* -h [ --help ] Display help message.
23
* -v [ --version ] Display program version.
24
*
25
* Wiki (user's guide and coding guidance):
26
* <https://github.com/ylebars/GeoDesk/wiki>
27
*
28
* View on GitHub: <https://github.com/ylebars/GeoDesk>
29
*
30
* Tarball: <https://github.com/ylebars/GeoDesk/tarball/master>
31
*
32
* Zip archive: <https://github.com/ylebars/GeoDesk/zipball/master>
33
*/
34
35
#include <config.hpp>
36
37
#include <cstddef>
38
#include <boost/test/included/prg_exec_monitor.hpp>
39
#include <boost/program_options.hpp>
40
#include <iostream>
41
#include <QApplication>
42
#include <QTranslator>
43
#include <QLocale>
44
#include <QLibraryInfo>
45
#include <QString>
46
47
#include "
mainboard.hpp
"
48
49
/**
50
* \brief Main function of the program.
51
* \param argc Count of arguments transmitted to the program.
52
* \param argv Values of arguments transmitted to the program.
53
* \return Qt return value.
54
*/
55
int
cpp_main
(
int
argc,
char
** argv) {
56
namespace
po = boost::program_options;
57
58
/* Initialisation of Qt. */
59
const
QApplication app (argc, argv);
60
61
/* System locale. */
62
const
QString locale = QLocale::system().name().section(
'_'
, 0, 0);
63
QTranslator translator;
64
translator.load(QString(
"qt_"
) + locale,
65
QLibraryInfo::location(QLibraryInfo::TranslationsPath));
66
app.installTranslator(&translator);
67
68
/* -- Reading the command line. -- */
69
70
/* Declaring supported options. */
71
po::options_description desc(
"Supported options"
);
72
desc.add_options()
73
(
"help,h"
,
"Display this help message."
)
74
(
"version,v"
,
"Display program version."
);
75
/* Command line. */
76
po::options_description cmd;
77
cmd.add(desc);
78
79
/* Options map. */
80
po::variables_map vm;
81
po::store(po::command_line_parser(argc, argv).
82
options(cmd).run(), vm);
83
po::notify(vm);
84
85
/* Indicates whether or not the program should be stopped. */
86
bool
stop =
false
;
87
88
/* Check if help message should be displayed. */
89
if
(vm.count(
"help"
)) {
90
std::cout <<
"GeoDesk is a tool to get geographical data from "
91
<<
"digitalised maps.\n\n"
92
<<
"Command : \n\n"
93
<<
'\t'
<< argv[0] <<
" [Options]\n\n"
94
<< desc <<
'\n'
;
95
stop =
true
;
96
}
97
98
/* Check if program version should be displayed. */
99
if
(vm.count(
"version"
)) {
100
std::cout << argv[0] <<
" version "
101
<< Configuration::versionMajor
102
<<
'.'
<< Configuration::versionMinor <<
'.'
103
<< Configuration::patchVersion <<
'\n'
;
104
stop =
true
;
105
}
106
107
if
(stop)
return
0;
108
109
/* -- Launch main window. -- */
110
111
/* Main board of the program. */
112
GUI::MainBoard
mainBoard;
113
mainBoard.show();
114
115
return
app.exec();
116
}
mainboard.hpp
Definitions to create program main board.
cpp_main
int cpp_main(int argc, char **argv)
Main function of the program.
Definition:
main.cpp:55
GUI::MainBoard
Class for program main window.
Definition:
mainboard.hpp:97
Generated on Thu Mar 6 2014 18:19:24 for GeoDesk by
1.8.6