]> git.sven.stormbind.net Git - sven/vym.git/blob - src/jira-agent.h
New upstream version 2.9.22
[sven/vym.git] / src / jira-agent.h
1 #ifndef JIRAAGENT_H
2 #define JIRAAGENT_H
3
4 #include <QHash>
5 #include <QJsonObject>
6 #include <QNetworkAccessManager>
7 #include <QTimer>
8
9 class BranchItem;
10 class VymModel;
11
12 class JiraAgent : public QObject {
13     Q_OBJECT
14
15   public:
16     enum JobType {Undefined, GetTicketInfo};
17
18     static bool available();
19
20     JiraAgent();
21     ~JiraAgent();
22
23     void init();
24     void setJobType(JobType jt);
25     bool setBranch(BranchItem *bi);
26     bool setTicket(const QString &id);
27     QString serverName();
28     QString url();
29
30     void startJob();
31
32   private:
33     void continueJob();
34     void finishJob();
35     void unknownStepWarning();
36
37   signals:
38     void jiraTicketReady(QJsonObject);
39
40   private:
41     void startGetTicketRequest();
42
43   private slots:
44     void ticketReceived(QNetworkReply *reply);
45     void timeout();
46 #ifndef QT_NO_SSL
47     void sslErrors(QNetworkReply *, const QList<QSslError> &errors);
48 #endif
49
50   private:
51     // Job related 
52     QTimer *killTimer;
53     JobType jobType;
54     int jobStep;
55     bool abortJob;  // Flag to abort during initialization of job
56
57     // Network handling
58     QNetworkAccessManager *networkManager;
59     QJsonObject jsobj;
60
61     // Settings: Credentials to access JIRA
62     bool authUsingPATInt;
63     QString personalAccessTokenInt;
64     QString userNameInt;
65     QString passwordInt;
66
67     // Settings: Where to find JIRA and which ticket
68     QString baseUrlInt;
69     QString serverNameInt;
70     QString apiUrl;
71     QString ticketUrl;
72     QString ticketID;
73
74     // Backreferences to take action in calling model
75     int branchID;
76     int modelID;
77 };
78 #endif