| 1 | #pragma once |
|---|---|
| 2 | |
| 3 | #include <JenkinsJobInfo.h> |
| 4 | #include <IFetcher.h> |
| 5 | |
| 6 | #include <QFrame> |
| 7 | |
| 8 | class CheckBox; |
| 9 | class QVBoxLayout; |
| 10 | class QHBoxLayout; |
| 11 | class QButtonGroup; |
| 12 | class QRadioButton; |
| 13 | class QPinnableTabWidget; |
| 14 | class QNetworkAccessManager; |
| 15 | class QPlainTextEdit; |
| 16 | class QPushButton; |
| 17 | class ButtonLink; |
| 18 | |
| 19 | namespace Jenkins |
| 20 | { |
| 21 | |
| 22 | class JenkinsJobPanel : public QFrame |
| 23 | { |
| 24 | Q_OBJECT |
| 25 | |
| 26 | signals: |
| 27 | void gotoPullRequest(int prNumber); |
| 28 | void gotoBranch(const QString &branchName); |
| 29 | |
| 30 | public: |
| 31 | explicit JenkinsJobPanel(const IFetcher::Config &config, QWidget *parent = nullptr); |
| 32 | |
| 33 | void loadJobInfo(const JenkinsJobInfo &job); |
| 34 | |
| 35 | private: |
| 36 | IFetcher::Config mConfig; |
| 37 | ButtonLink *mName = nullptr; |
| 38 | ButtonLink *mUrl = nullptr; |
| 39 | QPushButton *mBuild = nullptr; |
| 40 | QFrame *mScrollFrame = nullptr; |
| 41 | QVBoxLayout *mBuildListLayout = nullptr; |
| 42 | QHBoxLayout *mLastBuildLayout = nullptr; |
| 43 | QFrame *mLastBuildFrame = nullptr; |
| 44 | QPinnableTabWidget *mTabWidget = nullptr; |
| 45 | JenkinsJobInfo mRequestedJob; |
| 46 | int mTmpBuildsCounter = 0; |
| 47 | QVector<QWidget *> mTempWidgets; |
| 48 | QVector<QString> mDownloadedFiles; |
| 49 | QNetworkAccessManager *mManager = nullptr; |
| 50 | QMap<int, int> mTabBuildMap; |
| 51 | QMap<QString, QPair<JobConfigFieldType, QVariant>> mBuildValues; |
| 52 | |
| 53 | void appendJobsData(const QString &jobName, const JenkinsJobBuildInfo &build); |
| 54 | void fillBuildLayout(const Jenkins::JenkinsJobBuildInfo &build, QHBoxLayout *layout); |
| 55 | void requestFile(const Jenkins::JenkinsJobBuildInfo &build); |
| 56 | void storeFile(int buildNumber); |
| 57 | void createBuildConfigPanel(); |
| 58 | void triggerBuild(); |
| 59 | void showArtifacts(const Jenkins::JenkinsJobBuildInfo &build); |
| 60 | void downloadArtifact(const JenkinsJobBuildInfo::Artifact &artifact, int number); |
| 61 | void storeArtifact(const QString &fileName, int buildNumber); |
| 62 | void reloadJobInfo(); |
| 63 | }; |
| 64 | } |
| 65 |