1#pragma once
2
3/****************************************************************************************
4 ** GitQlient is an application to manage and operate one or several Git repositories. With
5 ** GitQlient you will be able to add commits, branches and manage all the options Git provides.
6 ** Copyright (C) 2021 Francesc Martinez
7 **
8 ** LinkedIn: www.linkedin.com/in/cescmm/
9 ** Web: www.francescmm.com
10 **
11 ** This program is free software; you can redistribute it and/or
12 ** modify it under the terms of the GNU Lesser General Public
13 ** License as published by the Free Software Foundation; either
14 ** version 2 of the License, or (at your option) any later version.
15 **
16 ** This program is distributed in the hope that it will be useful,
17 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 ** Lesser General Public License for more details.
20 **
21 ** You should have received a copy of the GNU Lesser General Public
22 ** License along with this library; if not, write to the Free Software
23 ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24 ***************************************************************************************/
25
26#include <QFrame>
27#include <QMap>
28
29#include <Issue.h>
30
31class QLabel;
32class GitServerCache;
33class QButtonGroup;
34class PrCommentsList;
35class PrCommitsList;
36class QStackedLayout;
37class GitBase;
38class PrChangesList;
39class QToolButton;
40class QPushButton;
41
42namespace GitServer
43{
44struct Issue;
45struct PullRequest;
46}
47
48class IssueDetailedView : public QFrame
49{
50 Q_OBJECT
51signals:
52 void openDiff(const QString &sha);
53
54public:
55 enum class Config
56 {
57 Issues,
58 PullRequests
59 };
60 explicit IssueDetailedView(const QSharedPointer<GitBase> &git, const QSharedPointer<GitServerCache> &gitServerCache,
61 QWidget *parent = nullptr);
62 ~IssueDetailedView();
63
64 void loadData(Config config, int issueNum, bool force = false);
65
66protected:
67 bool eventFilter(QObject *obj, QEvent *event);
68
69private:
70 enum class Buttons
71 {
72 Comments,
73 Changes,
74 Commits
75 };
76
77 GitServer::Issue mIssue;
78 QSharedPointer<GitBase> mGit;
79 QSharedPointer<GitServerCache> mGitServerCache;
80 Config mConfig;
81 int mIssueNumber = -1;
82 QButtonGroup *mBtnGroup = nullptr;
83 QLabel *mTitleLabel = nullptr;
84 QStackedLayout *mStackedLayout = nullptr;
85 PrCommentsList *mPrCommentsList = nullptr;
86 PrChangesList *mPrChangesList = nullptr;
87 PrCommitsList *mPrCommitsList = nullptr;
88 QToolButton *mReviewBtn = nullptr;
89 QPushButton *mAddComment = nullptr;
90 QPushButton *mCloseIssue = nullptr;
91
92 void onViewChange(int viewId);
93 void closeIssue();
94 void openAddReviewDlg(QAction *sender);
95 void addReview(const QString &body, const QString &mode);
96 void addCodeReview(int line, const QString &path, const QString &body);
97};
98