X-Git-Url: https://git.sven.stormbind.net/?a=blobdiff_plain;f=src%2Fjira-agent.h;fp=src%2Fjira-agent.h;h=30ec65e3b1e9bcecc712f0491582f1ee89c63665;hb=d483bd8e6523c23c6f1d8908a2e0611c2bc9ff4f;hp=0000000000000000000000000000000000000000;hpb=7dfa3fe589d1722d49681f42cdb0bf1e6efb5223;p=sven%2Fvym.git diff --git a/src/jira-agent.h b/src/jira-agent.h new file mode 100644 index 0000000..30ec65e --- /dev/null +++ b/src/jira-agent.h @@ -0,0 +1,78 @@ +#ifndef JIRAAGENT_H +#define JIRAAGENT_H + +#include +#include +#include +#include + +class BranchItem; +class VymModel; + +class JiraAgent : public QObject { + Q_OBJECT + + public: + enum JobType {Undefined, GetTicketInfo}; + + static bool available(); + + JiraAgent(); + ~JiraAgent(); + + void init(); + void setJobType(JobType jt); + bool setBranch(BranchItem *bi); + bool setTicket(const QString &id); + QString serverName(); + QString url(); + + void startJob(); + + private: + void continueJob(); + void finishJob(); + void unknownStepWarning(); + + signals: + void jiraTicketReady(QJsonObject); + + private: + void startGetTicketRequest(); + + private slots: + void ticketReceived(QNetworkReply *reply); + void timeout(); +#ifndef QT_NO_SSL + void sslErrors(QNetworkReply *, const QList &errors); +#endif + + private: + // Job related + QTimer *killTimer; + JobType jobType; + int jobStep; + bool abortJob; // Flag to abort during initialization of job + + // Network handling + QNetworkAccessManager *networkManager; + QJsonObject jsobj; + + // Settings: Credentials to access JIRA + bool authUsingPATInt; + QString personalAccessTokenInt; + QString userNameInt; + QString passwordInt; + + // Settings: Where to find JIRA and which ticket + QString baseUrlInt; + QString serverNameInt; + QString apiUrl; + QString ticketUrl; + QString ticketID; + + // Backreferences to take action in calling model + int branchID; + int modelID; +}; +#endif