OSDN Git Service

Show User and Email info at setting dialog
[tortoisegit/TortoiseGitJp.git] / src / TortoiseProc / Settings / SettingGitConfig.cpp
1 // SettingGitConfig.cpp : implementation file\r
2 //\r
3 \r
4 #include "stdafx.h"\r
5 #include "TortoiseProc.h"\r
6 #include "SettingGitConfig.h"\r
7 #include "Git.h"\r
8 #include "Settings.h"\r
9 #include "GitAdminDir.h"\r
10 // CSettingGitConfig dialog\r
11 \r
12 IMPLEMENT_DYNAMIC(CSettingGitConfig, ISettingsPropPage)\r
13 \r
14 CSettingGitConfig::CSettingGitConfig()\r
15         : ISettingsPropPage(CSettingGitConfig::IDD)\r
16     , m_UserName(_T(""))\r
17     , m_UserEmail(_T(""))\r
18     , m_bGlobal(FALSE)\r
19 {\r
20 \r
21 }\r
22 \r
23 CSettingGitConfig::~CSettingGitConfig()\r
24 {\r
25 }\r
26 \r
27 void CSettingGitConfig::DoDataExchange(CDataExchange* pDX)\r
28 {\r
29     CPropertyPage::DoDataExchange(pDX);\r
30     DDX_Text(pDX, IDC_GIT_USERNAME, m_UserName);\r
31     DDX_Text(pDX, IDC_GIT_USEREMAIL, m_UserEmail);\r
32     DDX_Check(pDX, IDC_CHECK_GLOBAL, m_bGlobal);\r
33 }\r
34 \r
35 \r
36 BEGIN_MESSAGE_MAP(CSettingGitConfig, CPropertyPage)\r
37 END_MESSAGE_MAP()\r
38 \r
39 BOOL CSettingGitConfig::OnInitDialog()\r
40 {\r
41         ISettingsPropPage::OnInitDialog();\r
42 \r
43         m_UserName=g_Git.GetUserName();\r
44         m_UserEmail=g_Git.GetUserEmail();\r
45         \r
46         CString str=((CSettings*)GetParent())->m_CmdPath.GetWinPath();\r
47         CString proj;\r
48         if(     g_GitAdminDir.HasAdminDir(str,&proj) )\r
49         {\r
50                 this->SetWindowText(CString(_T("Config - "))+proj);\r
51                 this->GetDlgItem(IDC_CHECK_GLOBAL)->EnableWindow(TRUE);\r
52         }\r
53         else\r
54         {\r
55                 m_bGlobal = TRUE;\r
56                 this->GetDlgItem(IDC_CHECK_GLOBAL)->EnableWindow(FALSE);\r
57         }\r
58         \r
59         this->UpdateData(FALSE);\r
60         return TRUE;\r
61 }\r
62 // CSettingGitConfig message handlers\r