-
Notifications
You must be signed in to change notification settings - Fork 0
/
buildhistoryfetcher.h
53 lines (42 loc) · 1.4 KB
/
buildhistoryfetcher.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
#ifndef BUILDHISTORYFETCHER_H
#define BUILDHISTORYFETCHER_H
#include <QObject>
#include <QDateTime>
#include <QtNetwork/QNetworkAccessManager>
#include <memory>
#include "restrequestbuilder.h"
#include "buildinfo.h"
namespace JenkinsCI
{
namespace Internal
{
class BuildInfo;
/*!
* \brief The BuildHistoryFetcher class fetch information about builds using its URLs. It depends on
* \c RestRequestBuilder and automatically convert given URLs to REST API URLs. It works
* asynchronously and emit \c buildInfoFetched(const BuildInfo) signal when new BuildInfo data was
* parsed. \c fetchBuildHistory(QStringList) always cancels exeting fetch process and starts new one
*/
class BuildHistoryFetcher : public QObject
{
Q_OBJECT
public:
explicit BuildHistoryFetcher(std::shared_ptr< RestRequestBuilder > restRequestBuilder,
QObject *parent = 0);
std::shared_ptr< RestRequestBuilder > restRequestBuilder() const;
signals:
void buildInfoFetched(const BuildInfo &buildInfo);
void nextBuildInfoFetchRequested();
public slots:
void fetchBuildHistory(QStringList urls);
private slots:
void readBuildInfoReply(QNetworkReply *reply);
void processFirstPendingUrl();
private:
QStringList _urlsToFetch;
std::unique_ptr< QNetworkAccessManager > _manager;
std::shared_ptr< RestRequestBuilder > _restRequestBuilder;
};
}
}
#endif // BUILDHISTORYFETCHER_H