1#pragma once
2
3#include <JenkinsJobInfo.h>
4#include <IFetcher.h>
5
6#include <QFrame>
7
8class CheckBox;
9class QVBoxLayout;
10class QHBoxLayout;
11class QButtonGroup;
12class QRadioButton;
13class QPinnableTabWidget;
14class QNetworkAccessManager;
15class QPlainTextEdit;
16class QPushButton;
17class ButtonLink;
18
19namespace Jenkins
20{
21
22class JenkinsJobPanel : public QFrame
23{
24 Q_OBJECT
25
26signals:
27 void gotoPullRequest(int prNumber);
28 void gotoBranch(const QString &branchName);
29
30public:
31 explicit JenkinsJobPanel(const IFetcher::Config &config, QWidget *parent = nullptr);
32
33 void loadJobInfo(const JenkinsJobInfo &job);
34
35private:
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