view 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
line wrap: on
line source
#ifndef CONVERTER_H
#define CONVERTER_H
/* Copyright (C) 2016 by ETH Zürich
 * Software engineering by Intevation GmbH
 *
 * This file is Free Software under the GNU GPL (v>=2)
 * and comes with ABSOLUTELY NO WARRANTY!
 * See LICENSE.txt for details.
 */

#include <QThread>
#include <QString>
#include <QStringList>
#include <QTextStream>
#include <QFile>
#include <QList>

#include "xlsxformat.h"

/** @file Declaration of the Converter class.
 */

/** @brief Base class of Convert operations.
 *
 * Set up an instance of this using the ctor and according setters and
 * start it.
 */
class Converter : public QThread
{
    Q_OBJECT

public:
    /** Construct a new Converter object.
     *
     * If input is empty stdin is used. If output
     * is empty stdout is used.
     *
     * @param input input filename.
     * @param outputs the files to create.
     */
    Converter(const QString &input, const QStringList &outputs,
              const QString &title = QString());

    /** Check for errors
     *
     * @returns Empty stringlist on success. Translated errors otherwise.*/
    const QStringList & errors() {return mErrors;}

protected:
    void convertToXSLX(QTextStream &instream, QList<QFile*> outputs);
    void run();

    QString mInput;
    QStringList mOutputs;
    QStringList mErrors;
    QString mTitle;

    QXlsx::Format mTitleFmt,
                  mQuestionFmt,
                  mAnswerChoiceFmt,
                  mAnswerTextFmt,
                  mFreeTextFmt,
                  mChoiceTextFmt,
                  mChoiceVotesFmt;
    QString mTitleStyle,
            mQuestionStyle,
            mAnswerChoiceStyle,
            mAnswerTextStyle,
            mFreeTextStyle,
            mChoiceTextStyle,
            mChoiceVotesStyle,
            mEmptyRow;
};

#endif // CONVERTER_H
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)