pulled latest translations from Transifex
[TortoiseGit.git] / src / TortoiseProc / LogDlgHelper.h
blobcad3604fb1f53d6b8ceb9ae3f68dbcff003a86eb
1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2003-2007 - TortoiseSVN
4 // Copyright (C) 2008-2011 - TortoiseGit
6 // This program is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public License
8 // as published by the Free Software Foundation; either version 2
9 // of the License, or (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software Foundation,
18 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 #pragma once
21 #include "Git.h"
22 #include "GitRev.h"
23 #include "GitStatus.h"
24 #include "ILogReceiver.h"
25 #include "lanes.h"
26 #include <set>
27 #include "GitHash.h"
28 #include "GitLogCache.h"
29 class CLogDlg;
31 /**
32 * \ingroup TortoiseProc
33 * Instances of CStoreSelection save the selection of the CLogDlg. When the instance
34 * is deleted the destructor restores the selection.
36 typedef std::map<CGitHash, int> MAP_HASH_REV;
38 class CStoreSelection
40 public:
41 CStoreSelection(CLogDlg* dlg);
42 ~CStoreSelection();
43 protected:
44 CLogDlg* m_logdlg;
45 std::set<LONG> m_SetSelectedRevisions;
49 /**
50 * \ingroup TortoiseProc
51 * Helper class for the log dialog, handles all the log entries, including
52 * sorting.
54 class CLogDataVector : public std::vector<CGitHash>
56 public:
57 CLogCache *m_pLogCache;
58 /// De-allocates log items.
59 CLogDataVector(CLogCache *pLogCache)
61 m_pLogCache=pLogCache;
62 m_FirstFreeLane=0;
64 CLogDataVector()
66 m_pLogCache=NULL;
67 m_FirstFreeLane=0;
69 void SetLogCache(CLogCache *pLogCache)
71 m_pLogCache = pLogCache;
73 GitRev & GetGitRevAt(int i)
75 ASSERT(i<size());
76 return m_pLogCache->m_HashMap[(*this)[i]];
78 void ClearAll();
79 int ParserFromLog(CTGitPath *path =NULL,int count = -1,int infomask=CGit::LOG_INFO_STAT|CGit::LOG_INFO_FILESTATE|CGit::LOG_INFO_SHOW_MERGEDFILE,
80 CString *from=NULL,CString *to=NULL);
82 int FetchShortLog(CTGitPath *path , CString &hash,int count=-1 ,int mask=CGit::LOG_INFO_ONLY_HASH, int showWC=0 );
83 int ParserShortLog(CTGitPath *path ,CString &hash,int count=-1 ,int mask=CGit::LOG_INFO_ONLY_HASH );
85 int ParserFromRefLog(CString ref);
87 int FetchFullInfo(int i);
88 // void AddFullInfo(
90 Lanes m_Lns;
91 int m_FirstFreeLane;
92 MAP_HASH_REV m_HashMap;
93 void updateLanes(GitRev& c, Lanes& lns, CGitHash &sha) ;
94 void setLane(CGitHash& sha) ;
96 BYTE_VECTOR m_RawlogData;
97 std::vector<int> m_RawLogStart;
99 #if 0
100 /// Ascending date sorting.
101 struct AscDateSort
103 bool operator()(GitRev& pStart, GitRev& pEnd)
105 return pStart->tmDate < pEnd->tmDate;
108 /// Descending date sorting.
109 struct DescDateSort
111 bool operator()(GitRev& pStart, GitRev& pEnd)
113 return pStart->tmDate > pEnd->tmDate;
116 /// Ascending revision sorting.
117 struct AscRevSort
119 bool operator()(GitRev& pStart, GitRev& pEnd)
121 return pStart->Rev < pEnd->Rev;
124 /// Descending revision sorting.
125 struct DescRevSort
127 bool operator()(GitRev& pStart, GitRev& pEnd)
129 return pStart->Rev > pEnd->Rev;
132 /// Ascending author sorting.
133 struct AscAuthorSort
135 bool operator()(GitRev& pStart, GitRev& pEnd)
137 int ret = pStart->sAuthor.CompareNoCase(pEnd->sAuthor);
138 if (ret == 0)
139 return pStart->Rev < pEnd->Rev;
140 return ret<0;
143 /// Descending author sorting.
144 struct DescAuthorSort
146 bool operator()(GitRev& pStart, GitRev& pEnd)
148 int ret = pStart->sAuthor.CompareNoCase(pEnd->sAuthor);
149 if (ret == 0)
150 return pStart->Rev > pEnd->Rev;
151 return ret>0;
154 /// Ascending bugID sorting.
155 struct AscBugIDSort
157 bool operator()(GitRev& pStart, GitRev& pEnd)
159 int ret = pStart->sBugIDs.CompareNoCase(pEnd->sBugIDs);
160 if (ret == 0)
161 return pStart->Rev < pEnd->Rev;
162 return ret<0;
165 /// Descending bugID sorting.
166 struct DescBugIDSort
168 bool operator()(GitRev& pStart, GitRev& pEnd)
170 int ret = pStart->sBugIDs.CompareNoCase(pEnd->sBugIDs);
171 if (ret == 0)
172 return pStart->Rev > pEnd->Rev;
173 return ret>0;
176 /// Ascending message sorting.
177 struct AscMessageSort
179 bool operator()(GitRev& pStart, GitRev& pEnd)
181 return pStart->sShortMessage.CompareNoCase(pEnd->sShortMessage)<0;
184 /// Descending message sorting.
185 struct DescMessageSort
187 bool operator()(GitRev& pStart, GitRev& pEnd)
189 return pStart->sShortMessage.CompareNoCase(pEnd->sShortMessage)>0;
192 /// Ascending action sorting
193 struct AscActionSort
195 bool operator() (GitRev& pStart, GitRev& pEnd)
197 if (pStart->actions == pEnd->actions)
198 return pStart->Rev < pEnd->Rev;
199 return pStart->actions < pEnd->actions;
202 /// Descending action sorting
203 struct DescActionSort
205 bool operator() (GitRev& pStart, GitRev& pEnd)
207 if (pStart->actions == pEnd->actions)
208 return pStart->Rev > pEnd->Rev;
209 return pStart->actions > pEnd->actions;
212 #endif