-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhtmlgenerator.h
More file actions
46 lines (41 loc) · 1.01 KB
/
htmlgenerator.h
File metadata and controls
46 lines (41 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#ifndef HTMLGENERATOR_H
#define HTMLGENERATOR_H
#include <QString>
#include <QSettings>
#include <QStringList>
#include <QVector>
#include <QFile>
#include <QTextStream>
#include <QTextCodec>
#include <iostream>
struct QuestionItem
{
QString questionText;
QStringList answers;
QStringList images;
int difficultLevel;
int correctAnswer;
QString getCorrectAnswer()
{
if (answers.length() > log2(correctAnswer))
return answers.at(int(log2(correctAnswer)));
return QString("Correct number from file: ") + QString::number(correctAnswer);
}
};
class HtmlGenerator
{
public:
HtmlGenerator(QString configFile);
/**
* @brief return vector of questions from decoded file
* @return
*/
QVector<QuestionItem> getQuestions() const;
bool saveToHtml(QString pathToFile);
private:
QSettings encodedFile;
QVector<QuestionItem> questionVector;
void loadQuestions();
QuestionItem loadQuestion(int questionNumber);
};
#endif // HTMLGENERATOR_H