comparison src/converter.h @ 3:8b4c49c92451

Add initial implementation that handles choices
author Andre Heinecke <andre.heinecke@intevation.de>
date Tue, 22 Mar 2016 10:39:19 +0100
parents
children a10425e7ef98
comparison
equal deleted inserted replaced
2:4926d626fe15 3:8b4c49c92451
1 #ifndef CONVERTER_H
2 #define CONVERTER_H
3 /* Copyright (C) 2016 by ETH Zürich
4 * Software engineering by Intevation GmbH
5 *
6 * This file is Free Software under the GNU GPL (v>=2)
7 * and comes with ABSOLUTELY NO WARRANTY!
8 * See LICENSE.txt for details.
9 */
10
11 #include <QThread>
12 #include <QString>
13 #include <QStringList>
14 #include <QTextStream>
15 #include <QFile>
16
17 #include "xlsxformat.h"
18
19 /** @file Declaration of the Converter class.
20 */
21
22 /**
23 * @enum ConvertFormat
24 * @brief Possible output format values.
25 */
26 enum ConvertFormat {
27 /*! XLSX (default). */
28 Format_XLSX,
29 /*! PDF */
30 Format_PDF
31 };
32
33 /** @brief Base class of Convert operations.
34 *
35 * Set up an instance of this using the ctor and according setters and
36 * start it.
37 */
38 class Converter : public QThread
39 {
40 Q_OBJECT
41
42 public:
43 /** Construct a new Converter object.
44 *
45 * If input is empty stdin is used. If output
46 * is empty stdout is used.
47 *
48 * @param input input filename.
49 * @param output output filename.
50 * @param format the format of this.
51 */
52 Converter(const QString &input, const QString &output,
53 ConvertFormat fmt = Format_XLSX,
54 const QString &title = QString());
55
56 /** Check for errors
57 *
58 * @returns Empty stringlist on success. Translated errors otherwise.*/
59 const QStringList & errors() {return mErrors;}
60
61 protected:
62 void convertToXSLX(QTextStream &instream, QFile &output);
63 void run();
64
65 QString mInput, mOutput;
66 ConvertFormat mFmt;
67 QStringList mErrors;
68 QString mTitle;
69
70 QXlsx::Format mTitleFmt,
71 mQuestionFmt,
72 mAnswerChoiceFmt,
73 mAnswerTextFmt,
74 mFreeTextFmt,
75 mChoiceTextFmt,
76 mChoiceBarFmt,
77 mChoiceBarInactiveFmt,
78 mChoiceVotesFmt;
79 };
80
81 #endif // CONVERTER_H
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)