| 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 | |
| 31 | class QLabel; |
| 32 | class GitServerCache; |
| 33 | class QButtonGroup; |
| 34 | class ; |
| 35 | class PrCommitsList; |
| 36 | class QStackedLayout; |
| 37 | class GitBase; |
| 38 | class PrChangesList; |
| 39 | class QToolButton; |
| 40 | class QPushButton; |
| 41 | |
| 42 | namespace GitServer |
| 43 | { |
| 44 | struct Issue; |
| 45 | struct PullRequest; |
| 46 | } |
| 47 | |
| 48 | class IssueDetailedView : public QFrame |
| 49 | { |
| 50 | Q_OBJECT |
| 51 | signals: |
| 52 | void openDiff(const QString &sha); |
| 53 | |
| 54 | public: |
| 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 | |
| 66 | protected: |
| 67 | bool eventFilter(QObject *obj, QEvent *event); |
| 68 | |
| 69 | private: |
| 70 | enum class Buttons |
| 71 | { |
| 72 | , |
| 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 * = nullptr; |
| 86 | PrChangesList *mPrChangesList = nullptr; |
| 87 | PrCommitsList *mPrCommitsList = nullptr; |
| 88 | QToolButton *mReviewBtn = nullptr; |
| 89 | QPushButton * = 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 | |