| 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 <QMenu> |
| 27 | |
| 28 | class GitBase; |
| 29 | class GitCache; |
| 30 | |
| 31 | /*! |
| 32 | \brief The BranchContextMenuConfig contains the necessary information to initialize the BranchContextMenu. It includes |
| 33 | information about the current branch, the selected branch in the view and the git object to perform the Git actions. |
| 34 | |
| 35 | */ |
| 36 | struct |
| 37 | { |
| 38 | QString ; |
| 39 | QString ; |
| 40 | bool ; |
| 41 | QSharedPointer<GitCache> ; |
| 42 | QSharedPointer<GitBase> ; |
| 43 | }; |
| 44 | |
| 45 | /*! |
| 46 | \brief The BranchContextMenuConfig creates the context menu for the BranchTreeWidget. In this context menu all the |
| 47 | possible actions regarding branches and it's workload are performed. This includes pushing pending commits to remote |
| 48 | branches. |
| 49 | |
| 50 | */ |
| 51 | class : public QMenu |
| 52 | { |
| 53 | Q_OBJECT |
| 54 | |
| 55 | signals: |
| 56 | void (); |
| 57 | void (); |
| 58 | |
| 59 | /*! |
| 60 | \brief Signal triggered when a branch has been checked out. |
| 61 | |
| 62 | */ |
| 63 | void (); |
| 64 | /*! |
| 65 | \brief Signal triggered when the user wants to perform a merge. This action takes a \p fromBranch to merge it into |
| 66 | our \ref currentBranch. In case of conflict, it will be handle elsewhere. |
| 67 | |
| 68 | \param currentBranch The current working branch. |
| 69 | \param fromBranch The branch to be merge into the current branch. |
| 70 | */ |
| 71 | void (const QString ¤tBranch, const QString &fromBranch); |
| 72 | /*! |
| 73 | * \brief signalPullConflict Signal triggered when trying to pull and a conflict happens. |
| 74 | */ |
| 75 | void (); |
| 76 | |
| 77 | /** |
| 78 | * @brief signalFetchPerformed Signal triggered when a deep fetch is performed. |
| 79 | */ |
| 80 | void (); |
| 81 | /** |
| 82 | * @brief signalRefreshPRsCache Signal that refreshes PRs cache. |
| 83 | */ |
| 84 | void (); |
| 85 | |
| 86 | /** |
| 87 | * @brief Signal triggered when a merge with squash behavior has been requested. Since it involves a lot of changes |
| 88 | * at UI level this action is not performed here. |
| 89 | * |
| 90 | * @param origin The branch to merge from. |
| 91 | * @param destination The branch to merge into. |
| 92 | */ |
| 93 | void (const QString &origin, const QString &destination); |
| 94 | |
| 95 | public: |
| 96 | /*! |
| 97 | \brief Default constructor. |
| 98 | |
| 99 | \param config The data to configure the context menu. |
| 100 | \param parent The parent widget if needed. |
| 101 | */ |
| 102 | explicit (BranchContextMenuConfig config, QWidget *parent = nullptr); |
| 103 | |
| 104 | private: |
| 105 | BranchContextMenuConfig ; |
| 106 | |
| 107 | /*! |
| 108 | \brief Pulls the current branch. |
| 109 | |
| 110 | */ |
| 111 | void (); |
| 112 | /*! |
| 113 | \brief Fetches all the changes from the remote repo. This includes gathering all tags as well, pruning and forcing |
| 114 | the pruning. |
| 115 | |
| 116 | */ |
| 117 | void (); |
| 118 | /*! |
| 119 | \brief Pushes all the local changes to the remote repo. |
| 120 | |
| 121 | */ |
| 122 | void (); |
| 123 | /*! |
| 124 | \brief Pushes force all the local changes into the remote repo. |
| 125 | |
| 126 | */ |
| 127 | void (); |
| 128 | /*! |
| 129 | \brief Creates a branch locally. |
| 130 | |
| 131 | */ |
| 132 | void (); |
| 133 | /*! |
| 134 | \brief Creates a new local branch and checks it out. |
| 135 | |
| 136 | */ |
| 137 | void (); |
| 138 | /*! |
| 139 | \brief Tries to merge the selected branch in the BranchTreeWidget into the current branch. |
| 140 | |
| 141 | */ |
| 142 | void (); |
| 143 | |
| 144 | void (); |
| 145 | /*! |
| 146 | \brief Renames the selected branch. |
| 147 | |
| 148 | */ |
| 149 | void (); |
| 150 | /*! |
| 151 | \brief Deletes the selected branch. It will fail if the branch to remove is the current one. |
| 152 | |
| 153 | */ |
| 154 | void (); |
| 155 | }; |
| 156 | |