void CPropertiesWnd::UpdateProperties(GitRev *rev) { if(rev) { m_CommitHash->SetValue(rev->m_CommitHash.ToString()); m_AuthorName->SetValue(rev->GetAuthorName()); m_AuthorDate->SetValue(rev->GetAuthorDate().Format(_T("%Y-%m-%d %H:%M"))); m_AuthorEmail->SetValue(rev->GetAuthorEmail()); m_CommitterName->SetValue(rev->GetAuthorName()); m_CommitterEmail->SetValue(rev->GetCommitterEmail()); m_CommitterDate->SetValue(rev->GetCommitterDate().Format(_T("%Y-%m-%d %H:%M"))); m_Subject->SetValue(rev->GetSubject()); m_Body->SetValue(rev->GetBody().Trim()); RemoveParent(); m_ParentGroup; CLogDataVector *pLogEntry = &((CMainFrame*)AfxGetApp()->GetMainWnd())->m_wndOutput.m_LogList.m_logEntries; for (unsigned int i = 0; i < rev->m_ParentHash.size(); ++i) { CString str; CString parentsubject; GitRev *p =NULL; if( pLogEntry->m_pLogCache->m_HashMap.find(rev->m_ParentHash[i]) == pLogEntry->m_pLogCache->m_HashMap.end()) { p=NULL; } else { p= &pLogEntry->m_pLogCache->m_HashMap[rev->m_ParentHash[i]] ; } if(p) parentsubject=p->GetSubject(); str.Format(_T("%d - %s \n %s"),i,rev->m_ParentHash[i].ToString(),parentsubject); CMFCPropertyGridProperty*pProtery=new CMFCPropertyGridProperty( rev->m_ParentHash[i].ToString().Left(8), parentsubject, str ); pProtery->AllowEdit(FALSE); m_ParentGroup->AddSubItem(pProtery); } m_ParentGroup->Expand(); for (int i = 0; i < m_BaseInfoGroup->GetSubItemsCount(); ++i) m_BaseInfoGroup->GetSubItem(i)->SetDescription(m_BaseInfoGroup->GetSubItem(i)->GetValue()); } else { m_CommitHash->SetValue(_T("")); m_AuthorName->SetValue(_T("")); m_AuthorDate->SetValue(_T("")); m_AuthorEmail->SetValue(_T("")); m_CommitterName->SetValue(_T("")); m_CommitterEmail->SetValue(_T("")); m_CommitterDate->SetValue(_T("")); m_Subject->SetValue(_T("")); m_Body->SetValue(_T("")); RemoveParent(); for (int i = 0; i < m_BaseInfoGroup->GetSubItemsCount(); ++i) m_BaseInfoGroup->GetSubItem(i)->SetDescription(_T("")); } this->Invalidate(); m_wndPropList.Invalidate(); }
void CPropertiesWnd::UpdateProperties(GitRevLoglist* pRev) { if (pRev) { if (pRev->m_ParentHash.empty()) { if (pRev->GetParentFromHash(pRev->m_CommitHash)) MessageBox(pRev->GetLastErr(), _T("TortoiseGit"), MB_ICONERROR); } CString hash = pRev->m_CommitHash.ToString(); m_CommitHash->SetValue(hash); m_AuthorName->SetValue(pRev->GetAuthorName()); CString authorDate = pRev->GetAuthorDate().Format(_T("%Y-%m-%d %H:%M")); m_AuthorDate->SetValue(authorDate); m_AuthorEmail->SetValue(pRev->GetAuthorEmail()); m_CommitterName->SetValue(pRev->GetAuthorName()); m_CommitterEmail->SetValue(pRev->GetCommitterEmail()); CString committerDate = pRev->GetCommitterDate().Format(_T("%Y-%m-%d %H:%M")); m_CommitterDate->SetValue(committerDate); m_Subject->SetValue(pRev->GetSubject()); m_Body->SetValue(pRev->GetBody().Trim()); RemoveParent(); CLogDataVector *pLogEntry = &((CMainFrame*)AfxGetApp()->GetMainWnd())->m_wndOutput.m_LogList.m_logEntries; CGitHashMap & hashMap = pLogEntry->m_pLogCache->m_HashMap; for (size_t i = 0; i < pRev->m_ParentHash.size(); ++i) { CString str; CString parentsubject; auto it = hashMap.find(pRev->m_ParentHash[i]); if (it != hashMap.end()) parentsubject = it->second.GetSubject(); str.Format(_T("%u - %s\n%s"), i, (LPCTSTR)pRev->m_ParentHash[i].ToString(), (LPCTSTR)parentsubject); CMFCPropertyGridProperty *pProperty = new CMFCPropertyGridProperty(pRev->m_ParentHash[i].ToString().Left(8), parentsubject, str); pProperty->AllowEdit(FALSE); m_ParentGroup->AddSubItem(pProperty); } m_ParentGroup->Expand(); for (int i = 0; i < m_BaseInfoGroup->GetSubItemsCount(); ++i) m_BaseInfoGroup->GetSubItem(i)->SetDescription(m_BaseInfoGroup->GetSubItem(i)->GetValue()); } else { m_CommitHash->SetValue(_T("")); m_AuthorName->SetValue(_T("")); m_AuthorDate->SetValue(_T("")); m_AuthorEmail->SetValue(_T("")); m_CommitterName->SetValue(_T("")); m_CommitterEmail->SetValue(_T("")); m_CommitterDate->SetValue(_T("")); m_Subject->SetValue(_T("")); m_Body->SetValue(_T("")); RemoveParent(); for (int i = 0; i < m_BaseInfoGroup->GetSubItemsCount(); ++i) m_BaseInfoGroup->GetSubItem(i)->SetDescription(_T("")); } m_wndPropList.AdjustLayout(); }
void CPropertiesWnd::UpdateProperties(GitRev *rev) { if(rev) { m_CommitHash->SetValue(rev->m_CommitHash); m_AuthorName->SetValue(rev->m_AuthorName); m_AuthorDate->SetValue(rev->m_AuthorDate.Format(_T("%Y-%m-%d %H:%M"))); m_AuthorEmail->SetValue(rev->m_AuthorEmail); m_CommitterName->SetValue(rev->m_CommitterName); m_CommitterEmail->SetValue(rev->m_CommitterEmail); m_CommitterDate->SetValue(rev->m_CommitterDate.Format(_T("%Y-%m-%d %H:%M"))); m_Subject->SetValue(rev->m_Subject); m_Body->SetValue(rev->m_Body); RemoveParent(); m_ParentGroup; CLogDataVector *pLogEntry = &((CMainFrame*)AfxGetApp()->GetMainWnd())->m_wndOutput.m_LogList.m_logEntries; for(unsigned int i=0;i<rev->m_ParentHash.size();i++) { CString str; CString parentsubject; int index; if( pLogEntry->m_HashMap.find(rev->m_ParentHash[i]) == pLogEntry->m_HashMap.end() ) { index = -1; } else { index=pLogEntry->m_HashMap[rev->m_ParentHash[i]]; } if(index>=0) parentsubject=pLogEntry->at(index).m_Subject; str.Format(_T("%d - %s \n %s"),i,rev->m_ParentHash[i],parentsubject); CMFCPropertyGridProperty*p=new CMFCPropertyGridProperty( rev->m_ParentHash[i].Left(8), parentsubject, str ); m_ParentGroup->AddSubItem(p); m_ParentGroup->Expand(); } for(int i=0;i<m_BaseInfoGroup->GetSubItemsCount();i++) m_BaseInfoGroup->GetSubItem(i)->SetDescription(m_BaseInfoGroup->GetSubItem(i)->GetValue()); }else { m_CommitHash->SetValue(_T("")); m_AuthorName->SetValue(_T("")); m_AuthorDate->SetValue(_T("")); m_AuthorEmail->SetValue(_T("")); m_CommitterName->SetValue(_T("")); m_CommitterEmail->SetValue(_T("")); m_CommitterDate->SetValue(_T("")); m_Subject->SetValue(_T("")); m_Body->SetValue(_T("")); RemoveParent(); //m_ParentGroup; //m_ParentHash->SetValue(_T("")); //m_ParentSubject->SetValue(_T("")); for(int i=0;i<m_BaseInfoGroup->GetSubItemsCount();i++) m_BaseInfoGroup->GetSubItem(i)->SetDescription(_T("")); } this->Invalidate(); m_wndPropList.Invalidate(); }