1#pragma once
2
3#include <QFrame>
4#include <JenkinsJobInfo.h>
5
6namespace Jenkins
7{
8
9class JobButton : public QFrame
10{
11 Q_OBJECT
12
13signals:
14 void clicked();
15
16public:
17 explicit JobButton(const JenkinsJobInfo &job, QWidget *parent = nullptr);
18
19 JenkinsJobInfo getJenkinsJob() const { return mJob; }
20
21protected:
22 /**
23 * @brief Detects the press event to prepare the click signal.
24 *
25 * @param e The event
26 */
27 void mousePressEvent(QMouseEvent *e) override;
28 /**
29 * @brief Detects the release event and if the press was detected before, it triggers the clicked signal.
30 *
31 * @param e The event
32 */
33 void mouseReleaseEvent(QMouseEvent *e) override;
34
35private:
36 bool mPressed = false;
37 JenkinsJobInfo mJob;
38};
39}
40