annotate src/constants.h @ 50:36ee5dd46fd3

Add GUI New Mainwindow that allows to set output formats and input files through a GUI.
author Andre Heinecke <andre.heinecke@intevation.de>
date Tue, 19 Jul 2016 12:19:45 +0200
parents aa47b8e4f807
children a43d8cf2fa95
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 */
8b4c49c92451 Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
58 #define QUESTION_PATTERN "([^\"]+)^(Answer.*$)", QRegularExpression::MultilineOption
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. */
38
5354cbda7188 Fix HTML Layout. Support multiple formats at once. More handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 26
diff changeset
66 #define CHOICE_PATTERN "\"(.*)\",(?<num>\\d+)?,(?<percent>\\d+\\.?\\d+)?"
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. */
5354cbda7188 Fix HTML Layout. Support multiple formats at once. More handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 26
diff changeset
70 #define CHOICE_UNFILLED_PATTERN "\"([^\"]*)\","
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. */
8b4c49c92451 Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
74 #define FREETXT_PATTERN "\"([^\"]*)\"", QRegularExpression::MultilineOption
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
36ee5dd46fd3 Add GUI
Andre Heinecke <andre.heinecke@intevation.de>
parents: 44
diff changeset
94 /**
36ee5dd46fd3 Add GUI
Andre Heinecke <andre.heinecke@intevation.de>
parents: 44
diff changeset
95 * @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
96 * the file from the resource. */
36ee5dd46fd3 Add GUI
Andre Heinecke <andre.heinecke@intevation.de>
parents: 44
diff changeset
97 #define ICON_NAME ":/64_icon-pdf.png"
36ee5dd46fd3 Add GUI
Andre Heinecke <andre.heinecke@intevation.de>
parents: 44
diff changeset
98
36ee5dd46fd3 Add GUI
Andre Heinecke <andre.heinecke@intevation.de>
parents: 44
diff changeset
99
36ee5dd46fd3 Add GUI
Andre Heinecke <andre.heinecke@intevation.de>
parents: 44
diff changeset
100 #define DEFAULT_DIR QStandardPaths::DownloadLocation
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 MAX_FILENAME_COUNT 10000
36ee5dd46fd3 Add GUI
Andre Heinecke <andre.heinecke@intevation.de>
parents: 44
diff changeset
103
3
8b4c49c92451 Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
104 #endif // CONSTANTS_H
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)