comparison src/converter.h @ 38:5354cbda7188

Fix HTML Layout. Support multiple formats at once. More handling. This commit is a bad mix of multiple changes. It addresses: - HTML Width is now relative and should fix some pdf creation problems. - Format is now taken from the extension of the file names provided. - Multiple file names are accepted at once. - Parser now handles missing values in Multiple choice answers - Parser now handles unfilled multiple choice values
author Andre Heinecke <andre.heinecke@intevation.de>
date Fri, 15 Apr 2016 15:19:04 +0200
parents e5c5ebfa4205
children
comparison
equal deleted inserted replaced
37:b574990e90a5 38:5354cbda7188
11 #include <QThread> 11 #include <QThread>
12 #include <QString> 12 #include <QString>
13 #include <QStringList> 13 #include <QStringList>
14 #include <QTextStream> 14 #include <QTextStream>
15 #include <QFile> 15 #include <QFile>
16 #include <QList>
16 17
17 #include "xlsxformat.h" 18 #include "xlsxformat.h"
18 19
19 /** @file Declaration of the Converter class. 20 /** @file Declaration of the Converter class.
20 */ 21 */
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 /*! HTML */
32 Format_HTML,
33 };
34 22
35 /** @brief Base class of Convert operations. 23 /** @brief Base class of Convert operations.
36 * 24 *
37 * Set up an instance of this using the ctor and according setters and 25 * Set up an instance of this using the ctor and according setters and
38 * start it. 26 * start it.
46 * 34 *
47 * If input is empty stdin is used. If output 35 * If input is empty stdin is used. If output
48 * is empty stdout is used. 36 * is empty stdout is used.
49 * 37 *
50 * @param input input filename. 38 * @param input input filename.
51 * @param output output filename. 39 * @param outputs the files to create.
52 * @param format the format of this.
53 */ 40 */
54 Converter(const QString &input, const QString &output, 41 Converter(const QString &input, const QStringList &outputs,
55 ConvertFormat fmt = Format_XLSX,
56 const QString &title = QString()); 42 const QString &title = QString());
57 43
58 /** Check for errors 44 /** Check for errors
59 * 45 *
60 * @returns Empty stringlist on success. Translated errors otherwise.*/ 46 * @returns Empty stringlist on success. Translated errors otherwise.*/
61 const QStringList & errors() {return mErrors;} 47 const QStringList & errors() {return mErrors;}
62 48
63 protected: 49 protected:
64 void convertToXSLX(QTextStream &instream, QFile &output); 50 void convertToXSLX(QTextStream &instream, QList<QFile*> outputs);
65 void run(); 51 void run();
66 52
67 QString mInput, mOutput; 53 QString mInput;
68 ConvertFormat mFmt; 54 QStringList mOutputs;
69 QStringList mErrors; 55 QStringList mErrors;
70 QString mTitle; 56 QString mTitle;
71 57
72 QXlsx::Format mTitleFmt, 58 QXlsx::Format mTitleFmt,
73 mQuestionFmt, 59 mQuestionFmt,
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)