OSDN Git Service

SyncDlg show animate when press push button and hide input control.
[tortoisegit/TortoiseGitJp.git] / src / TortoiseProc / ProjectProperties.h
1 // TortoiseSVN - a Windows shell extension for easy version control\r
2 \r
3 // Copyright (C) 2003-2008 - TortoiseSVN\r
4 \r
5 // This program is free software; you can redistribute it and/or\r
6 // modify it under the terms of the GNU General Public License\r
7 // as published by the Free Software Foundation; either version 2\r
8 // of the License, or (at your option) any later version.\r
9 \r
10 // This program is distributed in the hope that it will be useful,\r
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of\r
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
13 // GNU General Public License for more details.\r
14 \r
15 // You should have received a copy of the GNU General Public License\r
16 // along with this program; if not, write to the Free Software Foundation,\r
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.\r
18 //\r
19 #pragma once\r
20 #include <iostream>\r
21 #include <string>\r
22 #include <set>\r
23 #include "TGitPath.h"\r
24 using namespace std;\r
25 \r
26 #define BUGTRAQPROPNAME_LABEL             _T("bugtraq.label")\r
27 #define BUGTRAQPROPNAME_MESSAGE           _T("bugtraq.message")\r
28 #define BUGTRAQPROPNAME_NUMBER            _T("bugtraq.number")\r
29 #define BUGTRAQPROPNAME_LOGREGEX                  _T("bugtraq.logregex")\r
30 #define BUGTRAQPROPNAME_URL               _T("bugtraq.url")\r
31 #define BUGTRAQPROPNAME_WARNIFNOISSUE     _T("bugtraq.warnifnoissue")\r
32 #define BUGTRAQPROPNAME_APPEND                _T("bugtraq.append")\r
33 \r
34 #define PROJECTPROPNAME_LOGTEMPLATE               _T("tsvn.logtemplate")\r
35 #define PROJECTPROPNAME_LOGWIDTHLINE      _T("tsvn.logwidthmarker")\r
36 #define PROJECTPROPNAME_LOGMINSIZE                _T("tsvn.logminsize")\r
37 #define PROJECTPROPNAME_LOCKMSGMINSIZE    _T("tsvn.lockmsgminsize")\r
38 #define PROJECTPROPNAME_LOGFILELISTLANG   _T("tsvn.logfilelistenglish")\r
39 #define PROJECTPROPNAME_LOGSUMMARY                _T("tsvn.logsummary")\r
40 #define PROJECTPROPNAME_PROJECTLANGUAGE   _T("tsvn.projectlanguage")\r
41 #define PROJECTPROPNAME_USERFILEPROPERTY  _T("tsvn.userfileproperties")\r
42 #define PROJECTPROPNAME_USERDIRPROPERTY   _T("tsvn.userdirproperties")\r
43 #define PROJECTPROPNAME_AUTOPROPS                 _T("tsvn.autoprops")\r
44 \r
45 #define PROJECTPROPNAME_WEBVIEWER_REV     _T("webviewer.revision")\r
46 #define PROJECTPROPNAME_WEBVIEWER_PATHREV _T("webviewer.pathrevision")\r
47 \r
48 class CTSVNPathList;\r
49 struct svn_config_t;\r
50 \r
51 /**\r
52  * \ingroup TortoiseProc\r
53  * Provides methods for retrieving information about bug/issue trackers\r
54  * associated with a Subversion repository/working copy and other project\r
55  * related properties.\r
56  */\r
57 class ProjectProperties\r
58 {\r
59 public:\r
60         ProjectProperties(void);\r
61         ~ProjectProperties(void);\r
62 \r
63         /**\r
64          * Reads the properties from a path. If the path is a file\r
65          * then the properties are read from the parent folder of that file.\r
66          * \param path path to a file or a folder\r
67          */\r
68         BOOL ReadProps(CTGitPath path);\r
69         static BOOL GetStringProps(CString &prop,TCHAR *key,bool bRemoveCR=true);\r
70         static BOOL GetBOOLProps(BOOL &b, TCHAR*key);\r
71         /**\r
72          * Reads the properties from all paths found in a path list.\r
73          * This method calls ReadProps() for each path .\r
74          * \param list of paths\r
75          */\r
76         BOOL ReadPropsPathList(const CTGitPathList& pathList);\r
77 \r
78         /**\r
79          * Searches for the BugID inside a log message. If one is found,\r
80          * the method returns TRUE. The rich edit control is used to set\r
81          * the CFE_LINK effect on the BugID's.\r
82          * \param msg the log message\r
83          * \param pWnd Pointer to a rich edit control\r
84          */\r
85         BOOL FindBugID(const CString& msg, CWnd * pWnd);\r
86 \r
87         CString FindBugID(const CString& msg);\r
88         std::set<CString> FindBugIDs(const CString& msg);\r
89         /**\r
90          * Searches for the BugID inside a log message. If one is found,\r
91          * that BugID is returned. If none is found, an empty string is returned.\r
92          * The \c msg is trimmed off the BugID.\r
93          */\r
94         CString GetBugIDFromLog(CString& msg);\r
95         \r
96         /**\r
97          * Checks if the bug ID is valid. If bugtraq:number is 'true', then the\r
98          * functions checks if the bug ID doesn't contain any non-number chars in it.\r
99          */\r
100         BOOL CheckBugID(const CString& sID);\r
101         \r
102         /**\r
103          * Checks if the log message \c sMessage contains a bug ID. This is done by\r
104          * using the bugtraq:checkre property.\r
105          */\r
106         BOOL HasBugID(const CString& sMessage);\r
107         \r
108         /**\r
109          * Returns the URL pointing to the Issue in the issue tracker. The URL is\r
110          * created from the bugtraq:url property and the BugID found in the log message.\r
111          * \param msg the BugID extracted from the log message\r
112          */\r
113         CString GetBugIDUrl(const CString& sBugID);\r
114 \r
115         /**\r
116          * Inserts the tGit:autoprops into the Subversion config section.\r
117          * Call this before an import or an add operation.\r
118          */\r
119         //void InsertAutoProps(git_config_t *cfg);\r
120 \r
121         /**\r
122          * Adds all the project properties to the specified entry\r
123          */\r
124         bool AddAutoProps(const CTGitPath& path);\r
125 \r
126         /**\r
127          * Returns the log message summary if the tGit:logsummaryregex property is\r
128          * set and there are actually some matches.\r
129          * Otherwise, an empty string is returned.\r
130          */\r
131         CString GetLogSummary(const CString& sMessage);\r
132 \r
133     /**\r
134      * Transform the log message using \ref GetLogSummary and post-process it\r
135      * to be suitable for 1-line controls.\r
136      */\r
137     CString MakeShortMessage(const CString& message);\r
138 \r
139         /**\r
140          * Returns the path from which the properties were read.\r
141          */\r
142         CTGitPath GetPropsPath() {return propsPath;}\r
143 public:\r
144         /** The label to show in the commit dialog where the issue number/bug id\r
145          * is entered. Example: "Bug-ID: " or "Issue-No.:". Default is "Bug-ID :" */\r
146         CString         sLabel;\r
147 \r
148         /** The message string to add below the log message the user entered.\r
149          * It must contain the string "%BUGID%" which gets replaced by the client \r
150          * with the issue number / bug id the user entered. */\r
151         CString         sMessage;\r
152 \r
153         /** If this is set, then the bug-id / issue number must be a number, no text */\r
154         BOOL            bNumber;\r
155 \r
156         /** replaces bNumer: a regular expression string to check the validity of\r
157           * the entered bug ID. */\r
158         CString         sCheckRe;\r
159         \r
160         /** used to extract the bug ID from the string matched by sCheckRe */\r
161         CString         sBugIDRe;\r
162         \r
163         /** The url pointing to the issue tracker. If the url contains the string\r
164          * "%BUGID% the client has to replace it with the issue number / bug id\r
165          * the user entered. */\r
166         CString         sUrl;\r
167         \r
168         /** If set to TRUE, show a warning dialog if the user forgot to enter\r
169          * an issue number in the commit dialog. */\r
170         BOOL            bWarnIfNoIssue;\r
171 \r
172         /** If set to FALSE, then the bug tracking entry is inserted at the top of the\r
173            log message instead of at the bottom. Default is TRUE */\r
174         BOOL            bAppend;\r
175 \r
176         /** the COM uuid of the bugtraq provider which implements the IBugTraqProvider\r
177            interface. */\r
178         CString         sProviderUuid;\r
179 \r
180         /** the parameters passed to the COM bugtraq provider which implements the\r
181             IBugTraqProvider interface */\r
182         CString         sProviderParams;\r
183 \r
184         /** The number of chars the width marker should be shown at. If the property\r
185          * is not set, then this value is 80 by default. */\r
186         int                     nLogWidthMarker;\r
187 \r
188         /** The template to use for log messages. */\r
189         CString         sLogTemplate;\r
190 \r
191         /** Minimum size a log message must have in chars */\r
192         int                     nMinLogSize;\r
193 \r
194         /** Minimum size a lock message must have in chars */\r
195         int                     nMinLockMsgSize;\r
196 \r
197         /** TRUE if the file list to be inserted in the commit dialog should be in\r
198          * English and not in the localized language. Default is TRUE */\r
199         BOOL            bFileListInEnglish;\r
200         \r
201         /** The language identifier this project uses for log messages. */\r
202         LONG            lProjectLanguage;\r
203 \r
204         /** holds user defined properties for files. */\r
205         CString         sFPPath;\r
206 \r
207         /** holds user defined properties for directories. */\r
208         CString         sDPPath;\r
209 \r
210         /** The url pointing to the web viewer. The string %REVISION% is replaced\r
211          *  with the revision number, "HEAD", or a date */\r
212         CString         sWebViewerRev;\r
213 \r
214         /** The url pointing to the web viewer. The string %REVISION% is replaced\r
215          *  with the revision number, "HEAD", or a date. The string %PATH% is replaced\r
216          *  with the path relative to the repository root, e.g. "/trunk/src/file" */\r
217         CString         sWebViewerPathRev;\r
218 \r
219         /**\r
220          * The regex string to extract a summary from a log message. The summary\r
221          * is the first matching regex group.\r
222          */\r
223         CString         sLogSummaryRe;\r
224 \r
225         /**\r
226          * A regex string to extract revisions from a log message.\r
227          */\r
228         CString         sLogRevRegex;\r
229 private:\r
230         CString         sAutoProps;\r
231         CTGitPath       propsPath;\r
232 #ifdef DEBUG\r
233         friend class PropTest;\r
234 #endif\r
235 };\r