Mercurial > clickerconvert
annotate src/constants.h @ 78:f230ed9022e0
Rework questions to new logic for multilne questions
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Wed, 05 Oct 2016 14:24:53 +0200 |
parents | 9412d60c8ac1 |
children |
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 */ |
78
f230ed9022e0
Rework questions to new logic for multilne questions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
77
diff
changeset
|
58 #define QUESTION_PATTERN "(Answer.*)" |
3
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
59 |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
60 /** |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
61 * @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
|
62 #define CHOICE_IDENTIFIER "Answer,Votes,Percent" |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
63 |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
64 /** |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
65 * @brief The pattern used to match a multiple choice answer. */ |
77
9412d60c8ac1
Handle multiline choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
76
diff
changeset
|
66 #define CHOICE_PATTERN "\"([^\"]*?)\",(?<num>\\d+)?,(?<percent>\\d{0,3}\\.{0,1}\\d*)?", QRegularExpression::MultilineOption |
38
5354cbda7188
Fix HTML Layout. Support multiple formats at once. More handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
26
diff
changeset
|
67 |
5354cbda7188
Fix HTML Layout. Support multiple formats at once. More handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
26
diff
changeset
|
68 /** |
5354cbda7188
Fix HTML Layout. Support multiple formats at once. More handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
26
diff
changeset
|
69 * @brief The pattern used to match an unfilled choice answer. */ |
77
9412d60c8ac1
Handle multiline choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
76
diff
changeset
|
70 #define CHOICE_UNFILLED_PATTERN "\"([^\"]*?)\"[,]{0,1}", QRegularExpression::MultilineOption |
3
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
71 |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
72 /** |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
73 * @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
|
74 #define FREETXT_PATTERN "\"([^\"]*)\"?", QRegularExpression::MultilineOption |
3
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
75 |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
76 #define TITLE_ROW_HEIGHT 30 |
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 CHOICE_ROW_HEIGHT 30 |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
79 |
6
a10425e7ef98
Add free text handling
Andre Heinecke <andre.heinecke@intevation.de>
parents:
5
diff
changeset
|
80 #define TEXT_ROW_HEIGHT 20 |
a10425e7ef98
Add free text handling
Andre Heinecke <andre.heinecke@intevation.de>
parents:
5
diff
changeset
|
81 |
3
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
82 #define TEXT_IDENTIFIER "Answer" |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
83 |
20
df7936065450
Add default title
Andre Heinecke <andre.heinecke@intevation.de>
parents:
6
diff
changeset
|
84 #define DEFAULT_TITLE QStringLiteral("Clicker-Fragen und Antworten") |
df7936065450
Add default title
Andre Heinecke <andre.heinecke@intevation.de>
parents:
6
diff
changeset
|
85 |
26
5acd601356ba
Make HTML work for QTextDocument
Andre Heinecke <andre.heinecke@intevation.de>
parents:
23
diff
changeset
|
86 #define BAR_COLOR "#ff9933" |
5acd601356ba
Make HTML work for QTextDocument
Andre Heinecke <andre.heinecke@intevation.de>
parents:
23
diff
changeset
|
87 |
38
5354cbda7188
Fix HTML Layout. Support multiple formats at once. More handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
26
diff
changeset
|
88 #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
|
89 |
5354cbda7188
Fix HTML Layout. Support multiple formats at once. More handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
26
diff
changeset
|
90 #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
|
91 #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
|
92 #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
|
93 |
50 | 94 /** |
95 * @brief name of the default icon. Only used on Linux to load | |
96 * the file from the resource. */ | |
97 #define ICON_NAME ":/64_icon-pdf.png" | |
98 | |
99 | |
100 #define DEFAULT_DIR QStandardPaths::DownloadLocation | |
101 | |
102 #define MAX_FILENAME_COUNT 10000 | |
103 | |
53
a43d8cf2fa95
Various fixes and improvements. Fix windows packaging.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
50
diff
changeset
|
104 #define PRETTY_NAME "EduExportConverter" |
a43d8cf2fa95
Various fixes and improvements. Fix windows packaging.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
50
diff
changeset
|
105 |
76
1e6e7699f0b8
Add replacements.ini to configure text replacements
Andre Heinecke <andre.heinecke@intevation.de>
parents:
72
diff
changeset
|
106 #define CONFIG_FILE_NAME "replacements.ini" |
1e6e7699f0b8
Add replacements.ini to configure text replacements
Andre Heinecke <andre.heinecke@intevation.de>
parents:
72
diff
changeset
|
107 |
66
fe55e1e5bbf2
Auto update translations
Andre Heinecke <andre.heinecke@intevation.de>
parents:
65
diff
changeset
|
108 |
3
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
109 #endif // CONSTANTS_H |