annotate src/constants.h @ 56:5410f9f279ea

Redefine question pattern to be more robust We now assume that a question begins after two empty lines.
author Andre Heinecke <andre.heinecke@intevation.de>
date Tue, 09 Aug 2016 09:59:16 +0200
parents aaaf8cdbc85c
children defd29b9f25a
rev   line source
3
8b4c49c92451 Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
1 #ifndef CONSTANTS_H
8b4c49c92451 Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
2 #define CONSTANTS_H
8b4c49c92451 Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
3 /* Copyright (C) 2016 by ETH Zürich
8b4c49c92451 Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
4 * Software engineering by Intevation GmbH
8b4c49c92451 Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
5 *
8b4c49c92451 Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
6 * This file is Free Software under the GNU GPL (v>=2)
8b4c49c92451 Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
7 * and comes with ABSOLUTELY NO WARRANTY!
8b4c49c92451 Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
8 * See LICENSE.txt for details.
8b4c49c92451 Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
9 */
8b4c49c92451 Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
10
8b4c49c92451 Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
11 /** @file constants.h
8b4c49c92451 Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
12 * @brief Common definitions for this project.
8b4c49c92451 Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
13 *
8b4c49c92451 Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
14 * @details This file can be included to pull in common
8b4c49c92451 Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
15 * definitions in the application. */
8b4c49c92451 Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
16
8b4c49c92451 Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
17 /**
8b4c49c92451 Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
18 * @brief The version of the software package.
8b4c49c92451 Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
19 *
8b4c49c92451 Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
20 * Usually defined as Build parameter.
8b4c49c92451 Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
21 */
8b4c49c92451 Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
22 #ifndef VERSION
8b4c49c92451 Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
23 #define VERSION "0.0.1"
8b4c49c92451 Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
24 #endif
8b4c49c92451 Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
25
8b4c49c92451 Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
26 /**
8b4c49c92451 Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
27 * @brief The user visible application name.
8b4c49c92451 Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
28 *
8b4c49c92451 Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
29 * Usually defined as Build parameter.
8b4c49c92451 Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
30 **/
8b4c49c92451 Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
31 #ifndef APPNAME
8b4c49c92451 Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
32 #define APPNAME "unknown"
8b4c49c92451 Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
33 #endif
8b4c49c92451 Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
34
8b4c49c92451 Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
35 /**
8b4c49c92451 Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
36 * @brief Short command line description. */
44
aa47b8e4f807 Rename to EduExportConvert
Andre Heinecke <andre.heinecke@intevation.de>
parents: 38
diff changeset
37 #define DESCRIPTION "Convert output of EduApp questionaires to different formats"
3
8b4c49c92451 Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
38
8b4c49c92451 Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
39 /**
8b4c49c92451 Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
40 * @brief Short copyright notice to show users. */
8b4c49c92451 Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
41 #define COPYRIGHT "Copyright (C) 2016 ETH Zürich \n\n" \
8b4c49c92451 Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
42 "This file is Free Software under the GNU GPL (v>=2)\n" \
8b4c49c92451 Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
43 "and comes with ABSOLUTELY NO WARRANTY!\n"
8b4c49c92451 Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
44
8b4c49c92451 Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
45 /**
8b4c49c92451 Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
46 * @brief The number of columns the document uses. */
8b4c49c92451 Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
47 #define COLUMN_CNT 3
8b4c49c92451 Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
48 /**
8b4c49c92451 Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
49 * @brief The width of the columns in characters. */
26
5acd601356ba Make HTML work for QTextDocument
Andre Heinecke <andre.heinecke@intevation.de>
parents: 23
diff changeset
50 #define COLUMN_WIDTHS { 40, 18, 26 }
3
8b4c49c92451 Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
51
8b4c49c92451 Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
52 /**
8b4c49c92451 Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
53 * @brief Regular expression to define a question.
8b4c49c92451 Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
54 *
8b4c49c92451 Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
55 * A new question is the first unquoted string after the position
8b4c49c92451 Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
56 * that is followed after a newline by the word "Answer"
8b4c49c92451 Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
57 */
56
5410f9f279ea Redefine question pattern to be more robust
Andre Heinecke <andre.heinecke@intevation.de>
parents: 55
diff changeset
58 #define QUESTION_PATTERN "\n\n(.*)\n+(Answer.*$)", QRegularExpression::MultilineOption
5410f9f279ea Redefine question pattern to be more robust
Andre Heinecke <andre.heinecke@intevation.de>
parents: 55
diff changeset
59
5410f9f279ea Redefine question pattern to be more robust
Andre Heinecke <andre.heinecke@intevation.de>
parents: 55
diff changeset
60 #define FIRST_QUESTION_PATTERN "(.*)\n+(Answer.*$)", QRegularExpression::MultilineOption
3
8b4c49c92451 Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
61
8b4c49c92451 Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
62 /**
8b4c49c92451 Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
63 * @brief Identifiying line that shows a question is a choice question. */
8b4c49c92451 Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
64 #define CHOICE_IDENTIFIER "Answer,Votes,Percent"
8b4c49c92451 Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
65
8b4c49c92451 Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
66 /**
8b4c49c92451 Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
67 * @brief The pattern used to match a multiple choice answer. */
55
aaaf8cdbc85c Make percent string formatting more flexible
Andre Heinecke <andre.heinecke@intevation.de>
parents: 53
diff changeset
68 #define CHOICE_PATTERN "\"(.*)\",(?<num>\\d+)?,(?<percent>\\d{0,3}\\.{0,1}\\d*)?"
38
5354cbda7188 Fix HTML Layout. Support multiple formats at once. More handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 26
diff changeset
69
5354cbda7188 Fix HTML Layout. Support multiple formats at once. More handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 26
diff changeset
70 /**
5354cbda7188 Fix HTML Layout. Support multiple formats at once. More handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 26
diff changeset
71 * @brief The pattern used to match an unfilled choice answer. */
5354cbda7188 Fix HTML Layout. Support multiple formats at once. More handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 26
diff changeset
72 #define CHOICE_UNFILLED_PATTERN "\"([^\"]*)\","
3
8b4c49c92451 Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
73
8b4c49c92451 Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
74 /**
8b4c49c92451 Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
75 * @brief The pattern used to match a free text answer. */
56
5410f9f279ea Redefine question pattern to be more robust
Andre Heinecke <andre.heinecke@intevation.de>
parents: 55
diff changeset
76 #define FREETXT_PATTERN "\"([^\"]*)\"?", QRegularExpression::MultilineOption
3
8b4c49c92451 Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
77
8b4c49c92451 Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
78 #define TITLE_ROW_HEIGHT 30
8b4c49c92451 Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
79
8b4c49c92451 Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
80 #define CHOICE_ROW_HEIGHT 30
8b4c49c92451 Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
81
6
a10425e7ef98 Add free text handling
Andre Heinecke <andre.heinecke@intevation.de>
parents: 5
diff changeset
82 #define TEXT_ROW_HEIGHT 20
a10425e7ef98 Add free text handling
Andre Heinecke <andre.heinecke@intevation.de>
parents: 5
diff changeset
83
3
8b4c49c92451 Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
84 #define TEXT_IDENTIFIER "Answer"
8b4c49c92451 Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
85
20
df7936065450 Add default title
Andre Heinecke <andre.heinecke@intevation.de>
parents: 6
diff changeset
86 #define DEFAULT_TITLE QStringLiteral("Clicker-Fragen und Antworten")
df7936065450 Add default title
Andre Heinecke <andre.heinecke@intevation.de>
parents: 6
diff changeset
87
26
5acd601356ba Make HTML work for QTextDocument
Andre Heinecke <andre.heinecke@intevation.de>
parents: 23
diff changeset
88 #define BAR_COLOR "#ff9933"
5acd601356ba Make HTML work for QTextDocument
Andre Heinecke <andre.heinecke@intevation.de>
parents: 23
diff changeset
89
38
5354cbda7188 Fix HTML Layout. Support multiple formats at once. More handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 26
diff changeset
90 #define IMAGE_WIDTH 200
5354cbda7188 Fix HTML Layout. Support multiple formats at once. More handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 26
diff changeset
91
5354cbda7188 Fix HTML Layout. Support multiple formats at once. More handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 26
diff changeset
92 #define HTML_COL1_PERCENT 35
5354cbda7188 Fix HTML Layout. Support multiple formats at once. More handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 26
diff changeset
93 #define HTML_COL2_PERCENT 30
5354cbda7188 Fix HTML Layout. Support multiple formats at once. More handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 26
diff changeset
94 #define HTML_COL3_PERCENT 35
5354cbda7188 Fix HTML Layout. Support multiple formats at once. More handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 26
diff changeset
95
50
36ee5dd46fd3 Add GUI
Andre Heinecke <andre.heinecke@intevation.de>
parents: 44
diff changeset
96 /**
36ee5dd46fd3 Add GUI
Andre Heinecke <andre.heinecke@intevation.de>
parents: 44
diff changeset
97 * @brief name of the default icon. Only used on Linux to load
36ee5dd46fd3 Add GUI
Andre Heinecke <andre.heinecke@intevation.de>
parents: 44
diff changeset
98 * the file from the resource. */
36ee5dd46fd3 Add GUI
Andre Heinecke <andre.heinecke@intevation.de>
parents: 44
diff changeset
99 #define ICON_NAME ":/64_icon-pdf.png"
36ee5dd46fd3 Add GUI
Andre Heinecke <andre.heinecke@intevation.de>
parents: 44
diff changeset
100
36ee5dd46fd3 Add GUI
Andre Heinecke <andre.heinecke@intevation.de>
parents: 44
diff changeset
101
36ee5dd46fd3 Add GUI
Andre Heinecke <andre.heinecke@intevation.de>
parents: 44
diff changeset
102 #define DEFAULT_DIR QStandardPaths::DownloadLocation
36ee5dd46fd3 Add GUI
Andre Heinecke <andre.heinecke@intevation.de>
parents: 44
diff changeset
103
36ee5dd46fd3 Add GUI
Andre Heinecke <andre.heinecke@intevation.de>
parents: 44
diff changeset
104 #define MAX_FILENAME_COUNT 10000
36ee5dd46fd3 Add GUI
Andre Heinecke <andre.heinecke@intevation.de>
parents: 44
diff changeset
105
53
a43d8cf2fa95 Various fixes and improvements. Fix windows packaging.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 50
diff changeset
106 #define PRETTY_NAME "EduExportConverter"
a43d8cf2fa95 Various fixes and improvements. Fix windows packaging.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 50
diff changeset
107
3
8b4c49c92451 Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
108 #endif // CONSTANTS_H
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)