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 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
|
/*
Copyright (c) 2006-2009, Tom Thielicke IT Solutions
SPDX-License-Identifier: GPL-2.0-only
*/
/****************************************************************
**
** Definition of the TrainingSql class
** File name: trainingsql.h
**
****************************************************************/
#ifndef TRAININGSQL_H
#define TRAININGSQL_H
#include <QList>
#include <QString>
#include <QVariant>
//! The TrainingSql class provides lesson handling over database.
/*!
The TickerBoard class is an database interface for handling lessons
while training. It can update the user tables and handles the lesson text by
creating or updating it.
@author Tom Thielicke, s712715
@version 0.0.6
@date 27.06.2006
*/
class TrainingSql {
public:
//! Constructor, sets the synchron value of the database.
TrainingSql(QString replace = "", QString regexp = "", QString layout = "");
//! Constructor, sets the database to synchron.
~TrainingSql();
int getLessonUnit(int lesson, int type);
//! Increments the counter of the given char and column.
/*!
@param unicodechar The char which value is incremented
@param columnname The column name which value is incremented
@return bool Operation successful true/false
*/
bool updateUsertable(QChar unicodechar, QString columnname);
//! Creates the first text of the given lesson number.
/*!
@param lesson Lesson number
@param type Lesson type (0=Training, 1=Open, 2=Own)
@param intelligence Use intelligence bool
@param useEszett Use Eszett bool
@return QString The lesson text
@see lessonsDoneList
*/
QString createLesson(int lesson, int type, int unit, bool intelligence,
bool useEszett, bool useUmlaut);
//! Creates a new text of the given lesson number.
/*!
@param lesson Lesson number
@param type Lesson type (0=Training, 1=Open, 2=Own)
@param intelligence Use intelligence bool
@param useEszett Use Eszett bool
@return QString The lesson text
@see lessonsDoneList
*/
QString updateLesson(int lesson, int type, bool intelligence,
bool useEszett, bool useUmlaut);
//! Saves lesson results of the user.
/*!
@param lesson Lesson number
@param timelen Time length of lesson
@param tokenlen Token length of lesson
@param charnum Character number of lesson
@param errornum Type error number of lesson
@param timestamp Time stmp of lesson
@return QVariant The row id that was insert
*/
QVariant saveLesson(int lesson, int timelen, int tokenlen, int charnum,
int errornum, QDateTime timestamp, int type, QString name);
//! Replaces varios chars in the text.
QString replaceRoutine(
QString content, bool useEszett, bool useUmlaut, int lesson, int type);
QString getKeyboardLayoutReplaceRoutine(QString layout);
QString getKeyboardLayoutRegexpRoutine(QString layout);
private:
//! Sets the synchron value of the database.
/*!
@param synchron Synchron true or false
*/
void setSynchron(bool synchron);
//! Queue of text that was updated.
QList<int> lessonsDoneList;
int queryCounter;
QString replaceSetting;
QString regexpSetting;
};
#endif // TRAININGSQL_H
|