-
Notifications
You must be signed in to change notification settings - Fork 0
/
controller.h
115 lines (96 loc) · 3.63 KB
/
controller.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
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
112
113
114
115
/********************************************************************************************************************************************************
* @file controller.h
*
* @Copyright (C) 2022 i-trace.org
*
* This file is part of iTrace Infrastructure http://www.i-trace.org/.
* iTrace Infrastructure is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
* iTrace Infrastructure is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
* You should have received a copy of the GNU General Public License along with iTrace Infrastructure. If not, see <https://www.gnu.org/licenses/>.
********************************************************************************************************************************************************/
#ifndef CONTROLLER_H
#define CONTROLLER_H
#include <iostream>
#include <ctime>
#include <sys/stat.h>
#include <qqml.h>
#include <QObject>
#include <QApplication>
#include <QString>
#include <QVector>
#include <QCryptographicHash>
#include <QUuid>
#include <QElapsedTimer>
#include <QDirIterator>
#include <QDomDocument>
#include <map>
#include <fstream>
#include <set>
#include "xmlhandler.h"
#include "database.h"
#include "gaze.h"
#include "fixation.h"
#include "basicalgorithm.h"
#include "idtalgorithm.h"
#include "ivtalgorithm.h"
#include "srcmlhandler.h"
#include "srcmlmapper.h"
#include "logger.h"
// Algorithm settings enums
enum basic {
window_size = 1,
radius,
peak
};
enum idt {
duration_window = 1,
dispersion
};
enum ivt {
velocity = 1,
duration
};
class Controller : public QObject {
public:
Q_OBJECT
QML_ELEMENT
public:
explicit Controller(QObject* parent = nullptr);
//XML Functions
Q_INVOKABLE void saveDatabaseFile(QString);
Q_INVOKABLE void loadDatabaseFile(QString);
Q_INVOKABLE void closeDatabase();
Q_INVOKABLE void importXMLFile(QString);
Q_INVOKABLE void importDatabaseFile(QString);
Q_INVOKABLE void batchAddXML(QString);
void importCoreXML(const QString&);
void importPluginXML(const QString&);
//Fixation Functions
Q_INVOKABLE void generateFixationData(QVector<QString>,QString);
//srcML Functions
Q_INVOKABLE void mapTokens(QString,QVector<QString>,bool);
QString findMatchingPath(QVector<QString>,QString);
//Highlight Functions
Q_INVOKABLE void highlightFixations(QString,QString);
void highlightTokens(QVector<QVector<QString>>, SRCMLHandler, QString, QString);
void generateHighlightedFile(QString,QString,QStringList,QVector<QVector<QString>>);
//Query Functions
Q_INVOKABLE QString generateQuery(QString,QString,QString,QString,QString,QString,QString,QString,QString,QString,QString,QString);
Q_INVOKABLE void loadQueryFile(QString,QString,QString);
Q_INVOKABLE void saveQueryFile(QString,QString);
Q_INVOKABLE void generateQueriedData(QString,QString,QString);
signals:
void taskAdded(const QString& task);
void outputToScreen(const QString& color,const QString& msg);
void warning(const QString& title, const QString& msg);
void databaseSet(const QString& path);
void databaseClosed();
void startProgressBar(int start,int stop);
void stopProgressBar();
void setProgressBarValue(int val);
void setProgressBarToIndeterminate();
private:
Database idb;
Logger* log = Logger::instance();
};
#endif // CONTROLLER_H