-
Notifications
You must be signed in to change notification settings - Fork 0
/
jenkinsviewfetcher.h
59 lines (45 loc) · 1.04 KB
/
jenkinsviewfetcher.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
#ifndef JENKINSVIEWFETCHER_H
#define JENKINSVIEWFETCHER_H
#include <QObject>
#include <QtNetwork/QNetworkAccessManager>
#include <QTimer>
#include <memory>
#include "restrequestbuilder.h"
namespace JenkinsCI
{
namespace Internal
{
struct ViewInfo
{
QUrl url;
QString name;
};
inline uint qHash(const ViewInfo &key, uint seed)
{
return qHash(key.url, seed) ^ qHash(key.name, seed);
}
inline bool operator==(const ViewInfo &first, const ViewInfo &second)
{
return first.name == second.name && first.url == second.url;
}
class JenkinsViewFetcher : public QObject
{
Q_OBJECT
public:
explicit JenkinsViewFetcher(const std::shared_ptr< RestRequestBuilder > builder);
void fetchViews();
signals:
void viewsFetched(QSet< ViewInfo > views);
public:
void startBackgroundFetching();
void stopBackgroundFetching();
private:
void readReply(QNetworkReply *reply);
private:
std::shared_ptr< RestRequestBuilder > _builder;
QNetworkAccessManager *_manager;
QTimer *_timer;
};
}
}
#endif // JENKINSVIEWFETCHER_H