1#pragma once
2
3#include <JenkinsViewInfo.h>
4#include <JenkinsJobInfo.h>
5#include <IFetcher.h>
6
7#include <QFrame>
8
9class QVBoxLayout;
10class QTreeWidgetItem;
11class QListWidget;
12class QLabel;
13class QHBoxLayout;
14class QTreeWidget;
15
16namespace Jenkins
17{
18class JenkinsJobPanel;
19class JobFetcher;
20
21class JobContainer : public QFrame
22{
23 Q_OBJECT
24
25signals:
26 void signalJobAreViews(const QVector<JenkinsViewInfo> &views);
27 void gotoPullRequest(int prNumber);
28 void gotoBranch(const QString &branchName);
29
30public:
31 explicit JobContainer(const IFetcher::Config &config, const JenkinsViewInfo &viewInfo, QWidget *parent = nullptr);
32
33 void reload();
34
35private:
36 IFetcher::Config mConfig;
37 JenkinsViewInfo mView;
38 JobFetcher *mJobFetcher = nullptr;
39 QHBoxLayout *mMainLayout = nullptr;
40 QVBoxLayout *mJobListLayout = nullptr;
41 JenkinsJobPanel *mJobPanel = nullptr;
42 QVector<JenkinsJobInfo> mJobsList;
43 QTreeWidget *mJobsTree = nullptr;
44 QMap<QString, QListWidget *> mListsMap;
45
46 void addJobs(const QMultiMap<QString, JenkinsJobInfo> &jobs);
47 void requestUpdatedJobInfo(const JenkinsJobInfo &jobInfo);
48 void onJobInfoReceived(JenkinsJobInfo oldInfo, const JenkinsJobInfo &newInfo);
49 void showJobInfo(QTreeWidgetItem *item, int column);
50 QIcon getIconForJob(JenkinsJobInfo job) const;
51 void createHeader(const QString &name, QListWidget *listWidget);
52 void onHeaderClicked(QListWidget *listWidget, QLabel *mTagArrow);
53};
54}
55