-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathextractor.h
76 lines (63 loc) · 1.61 KB
/
extractor.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
#ifndef FPSUBMIT_EXTRACTOR_H_
#define FPSUBMIT_EXTRACTOR_H_
#include <QObject>
#include <QDir>
#include <QMutex>
#include <QNetworkAccessManager>
#include <QTime>
#include <QTemporaryFile>
class AnalyzeResult;
class AnalyzeFileTask;
class QNetworkReply;
class Extractor : public QObject
{
Q_OBJECT
public:
Extractor(const QStringList &directories, QTemporaryFile *m_profile);
~Extractor();
bool isCancelled();
bool isRunning();
bool isFinished();
bool hasErrors();
int submittedExtractions() const { return m_submittedFiles; }
int numErrors() const { return m_numErrors; }
int numNoMbid() const { return m_numNoMbid; }
signals:
void statusChanged(const QString &message);
void currentPathChanged(const QString &path);
void fileListLoadingStarted();
void extractionStarted(int fileCount);
void networkError(const QString &message);
void progress(int i);
void finished();
void noFilesError();
public slots:
void start();
void cancel();
private slots:
void onFileListLoaded(const QStringList &files);
void onFileAnalyzed(AnalyzeResult *);
void onRequestFinished(QNetworkReply *reply);
private:
void extractNextFile();
bool maybeSubmit();
QTemporaryFile *m_profile;
QString m_apiKey;
QStringList m_files;
QStringList m_directories;
QNetworkAccessManager *m_networkAccessManager;
QList<AnalyzeResult *> m_submitQueue;
QStringList m_submitting;
QStringList m_submitted;
QNetworkReply *m_reply;
QList<AnalyzeFileTask *> m_activeProcesses;
QTime m_time;
int m_extractedFiles;
int m_submittedFiles;
int m_activeFiles;
bool m_cancelled;
bool m_finished;
int m_numErrors;
int m_numNoMbid;
};
#endif