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 GitCache; |
29 | class GitBase; |
30 | class GitTags; |
31 | class GitServerCache; |
32 | |
33 | /*! |
34 | \brief This class configures the context menu that will be shown when the user right-click over a commit in the |
35 | repository view. |
36 | |
37 | \class CommitHistoryContextMenu CommitHistoryContextMenu.h "CommitHistoryContextMenu.h" |
38 | */ |
39 | class : public QMenu |
40 | { |
41 | Q_OBJECT |
42 | |
43 | signals: |
44 | void (); |
45 | void (); |
46 | void (); |
47 | |
48 | /*! |
49 | \brief Signal triggered when the user wants to open the diff of a commit compared to its parent. |
50 | |
51 | \param sha The SHA to diff. |
52 | */ |
53 | void (const QString &sha); |
54 | /*! |
55 | \brief Signal triggered when the user wants to diff the shas in the list. This signal is only emitted if the user |
56 | selected two SHAs. |
57 | |
58 | \param sha The shas to diff between. |
59 | */ |
60 | void (const QStringList &sha); |
61 | /*! |
62 | \brief Signal triggered when the user wants to amend a commit. |
63 | |
64 | \param sha The SHA of the commit to amend. |
65 | */ |
66 | void (const QString &sha); |
67 | /*! |
68 | \brief Signal triggered when a merge has been requested. Since it involves a lot of changes at UI level this action |
69 | is not performed here. |
70 | |
71 | \param origin The branch to merge from. |
72 | \param destination The branch to merge into. |
73 | */ |
74 | void (const QString &origin, const QString &destination); |
75 | |
76 | /** |
77 | * @brief Signal triggered when a merge with squash behavior has been requested. Since it involves a lot of changes |
78 | * at UI level this action is not performed here. |
79 | * |
80 | * @param origin The branch to merge from. |
81 | * @param destination The branch to merge into. |
82 | */ |
83 | void (const QString &origin, const QString &destination); |
84 | |
85 | /*! |
86 | * \brief signalConflict Signal triggered when trying to cherry-pick and a conflict happens. |
87 | */ |
88 | void (const QStringList &pendingShas = QStringList()); |
89 | /*! |
90 | * \brief signalPullConflict Signal triggered when trying to pull and a conflict happens. |
91 | */ |
92 | void (); |
93 | /** |
94 | * @brief signalRefreshPRsCache Signal that refreshes PRs cache. |
95 | */ |
96 | void (); |
97 | /** |
98 | * @brief showPrDetailedView Signal that makes the view change to the Pull Request detailed view |
99 | * @param pr The pull request number to show. |
100 | */ |
101 | void (int pr); |
102 | |
103 | public: |
104 | /*! |
105 | \brief Default constructor. |
106 | |
107 | \param cache The cache for the current repository. |
108 | \param git The git object to execute Git commands. |
109 | \param shas The list of SHAs selected. |
110 | \param parent The parent widget if needed. |
111 | */ |
112 | explicit (const QSharedPointer<GitCache> &cache, const QSharedPointer<GitBase> &git, |
113 | const QSharedPointer<GitServerCache> &gitServerCache, const QStringList &shas, |
114 | QWidget *parent = nullptr); |
115 | |
116 | private: |
117 | QSharedPointer<GitCache> ; |
118 | QSharedPointer<GitBase> ; |
119 | QSharedPointer<GitServerCache> ; |
120 | QSharedPointer<GitTags> ; |
121 | QStringList ; |
122 | |
123 | /*! |
124 | \brief This method creates all the actions that will appear when only one SHA is selected. |
125 | */ |
126 | void (); |
127 | /*! |
128 | \brief This method creates all the actions that will appear when more than one SHA is selected. |
129 | */ |
130 | void (); |
131 | /*! |
132 | \brief Pushes the changes to a stash. |
133 | */ |
134 | void (); |
135 | /*! |
136 | \brief Pops the changes stored in a stash. |
137 | */ |
138 | void (); |
139 | /*! |
140 | \brief Creates a branch at the selected commit. |
141 | */ |
142 | void (); |
143 | /*! |
144 | \brief Creates a tag at the selected commit. |
145 | */ |
146 | void (); |
147 | /*! |
148 | \brief Export the selected commit/s as patches. If multiple commits are selected they are enumerated sequentially. |
149 | */ |
150 | void (); |
151 | /*! |
152 | \brief Checks out to the selected branch. |
153 | */ |
154 | void (); |
155 | /** |
156 | * @brief createCheckoutBranch Creates and checks out a branch. |
157 | */ |
158 | void (); |
159 | /*! |
160 | \brief Checks out to the selected commit. |
161 | */ |
162 | void (); |
163 | /*! |
164 | \brief Cherry-picks the selected commit into the current branch. |
165 | */ |
166 | void (); |
167 | /*! |
168 | \brief Applies a patch loaded by the user but doesn't commit it. |
169 | */ |
170 | void (); |
171 | /*! |
172 | \brief Applies the changes from a patch in the form of a commit. |
173 | */ |
174 | void (); |
175 | /*! |
176 | \brief Pushes the local commits into remote. |
177 | */ |
178 | void (); |
179 | /*! |
180 | \brief Pulls the changes from remote. |
181 | */ |
182 | void (); |
183 | /*! |
184 | \brief Fetches the changes from remote. |
185 | */ |
186 | void (); |
187 | /*! |
188 | \brief Resets the current branch reference into the selected commit keeping all changes. |
189 | */ |
190 | void (); |
191 | /*! |
192 | \brief Resets the current branch reference into the selected commit. |
193 | */ |
194 | void (); |
195 | /*! |
196 | \brief Resets the current branch reference into the selected commit overriding all changes. |
197 | */ |
198 | void (); |
199 | /*! |
200 | \brief Merges the \p branchFrom into the current branch. |
201 | |
202 | \param branchFrom The branch that will be merge into the current one. |
203 | */ |
204 | void (); |
205 | |
206 | /** |
207 | * @brief mergeSquash Merges the @p branchFrom into the current branch squashing all the commits. |
208 | * @param branchFrom The branch that will be merge into the current one. |
209 | */ |
210 | void (); |
211 | /*! |
212 | \brief Method that adds all the branch related actions. |
213 | |
214 | \param sha The SHA of the current commit. |
215 | */ |
216 | void (const QString &sha); |
217 | |
218 | void (); |
219 | }; |
220 | |