| 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 <PullRequest.h> |
| 27 | |
| 28 | #include <QDialog> |
| 29 | |
| 30 | namespace Ui |
| 31 | { |
| 32 | class MergePullRequestDlg; |
| 33 | } |
| 34 | |
| 35 | class GitBase; |
| 36 | |
| 37 | namespace GitServer |
| 38 | { |
| 39 | class IRestApi; |
| 40 | struct PullRequest; |
| 41 | } |
| 42 | |
| 43 | /** |
| 44 | * @brief The MergePullRequestDlg class creates the layout for the UI so the user can merge pull requests directly from |
| 45 | * GitQlient. |
| 46 | */ |
| 47 | class MergePullRequestDlg : public QDialog |
| 48 | { |
| 49 | Q_OBJECT |
| 50 | |
| 51 | signals: |
| 52 | /*! |
| 53 | \brief Signal triggered when some action in the context menu things the main UI needs an update. |
| 54 | */ |
| 55 | void signalRepositoryUpdated(); |
| 56 | |
| 57 | public: |
| 58 | /** |
| 59 | * @brief MergePullRequestDlg Detail constructor. |
| 60 | * @param git The git object to perform Git operations. |
| 61 | * @param pr The pull request to be merged. |
| 62 | * @param sha The sha of the current commit to check that is the current sha in the server. |
| 63 | * @param parent The parent widget. |
| 64 | */ |
| 65 | explicit MergePullRequestDlg(const QSharedPointer<GitBase> git, const GitServer::PullRequest &pr, const QString &sha, |
| 66 | QWidget *parent = nullptr); |
| 67 | /** |
| 68 | * Destructor |
| 69 | */ |
| 70 | ~MergePullRequestDlg(); |
| 71 | |
| 72 | private: |
| 73 | Ui::MergePullRequestDlg *ui; |
| 74 | QSharedPointer<GitBase> mGit; |
| 75 | GitServer::PullRequest mPr; |
| 76 | QString mSha; |
| 77 | GitServer::IRestApi *mApi; |
| 78 | |
| 79 | /** |
| 80 | * @brief accept Checks the data introduced by the user and triggers the connection against the server. |
| 81 | */ |
| 82 | void accept() override; |
| 83 | /** |
| 84 | * @brief onPRMerged When the pull request has been merged, this method creates a message box that informs the user |
| 85 | * about it. |
| 86 | */ |
| 87 | void onPRMerged(); |
| 88 | /** |
| 89 | * @brief onGitServerError Notifies the user that an error happened in the API connection or data exchange. |
| 90 | */ |
| 91 | void onGitServerError(const QString &error); |
| 92 | }; |
| 93 | |