-
Notifications
You must be signed in to change notification settings - Fork 0
/
scanthread.h
61 lines (45 loc) · 1.03 KB
/
scanthread.h
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
#ifndef SCANTHREAD_H
#define SCANTHREAD_H
#include <QThread>
#include <QFile>
#include <QFileInfo>
#include <QDir>
#include <QTextStream>
#include <QVariantList>
#include <QtSql>
class ScanThread : public QThread
{
Q_OBJECT
public:
explicit ScanThread(QObject *parent = 0);
~ScanThread();
void setDB(QSqlDatabase *sqlDB);
void setPath(QString dir, int key);
void startScanning(void);
void stopScanning(void);
protected:
void run();
void scanDir(QDir &dir);
void parseFile(QFileInfo &fi);
void writeToDB(void);
signals:
void parsedFile(QString fn);
public slots:
private:
int vocabulary, sl1, sl2;
bool stop;
QSqlQuery query;
QSqlError le;
QSqlDatabase *db;
QSqlDriver *drv;
QRegExp rx, rx1;
QString str1, str2;
QString path;
QFile file;
QTextStream ts;
QVariantList text;
QVariantList words;
QVariantList questions;
QString startBlock, endBlock;
};
#endif // SCANTHREAD_H