QString SeafileModel::friendlyBasename(const QString &path) const { QStringList pathList(path.split('/', QString::SkipEmptyParts)); if(pathList.isEmpty()){ // it is the root. return "<b>sea</b>file"; } if(pathList.length()==1){ // it is a repo. if(m_libraries.contains(pathList[0])){ return m_libraries[pathList[0]]->name; } else { return "[library name unknown]"; } } else { // it is a foder of a file: It has no special name. return basename(path); } }
void SVNTabBase::OpenFiles() { JPtrArray<JString> list(JPtrArrayT::kDeleteAll); GetSelectedFiles(&list); JPtrArray<JString> pathList(JPtrArrayT::kDeleteAll); const JSize count = list.GetElementCount(); for (JIndex i=count; i>=1; i--) { JString* s = list.NthElement(i); if (JDirectoryExists(*s)) { pathList.Append(s); list.RemoveElement(i); } } (JXGetWebBrowser())->ShowFileLocations(pathList); JXFSBindingManager::Exec(list); }
void ConfigPathListEdit::saveConfiguration() { if (!dataManager) return; dataManager->writeEntry(section, item, QVariant(pathList().join("&"))); }
void CCopyDlg::OnBnClickedBugtraqbutton() { m_tooltips.Pop(); // hide the tooltips CString sMsg = m_cLogMessage.GetText(); if (m_BugTraqProvider == NULL) return; ATL::CComBSTR parameters; parameters.Attach(m_bugtraq_association.GetParameters().AllocSysString()); ATL::CComBSTR commonRoot; commonRoot.Attach(m_path.GetWinPathString().AllocSysString()); CBstrSafeVector pathList(1); pathList.PutElement(0, m_path.GetSVNPathString()); ATL::CComBSTR originalMessage; originalMessage.Attach(sMsg.AllocSysString()); ATL::CComBSTR temp; m_revProps.clear(); // first try the IBugTraqProvider2 interface CComPtr<IBugTraqProvider2> pProvider2 = NULL; HRESULT hr = m_BugTraqProvider.QueryInterface(&pProvider2); if (SUCCEEDED(hr)) { ATL::CComBSTR repositoryRoot; repositoryRoot.Attach(m_wcURL.AllocSysString()); ATL::CComBSTR bugIDOut; GetDlgItemText(IDC_BUGID, m_sBugID); ATL::CComBSTR bugID; bugID.Attach(m_sBugID.AllocSysString()); CBstrSafeVector revPropNames; CBstrSafeVector revPropValues; if (FAILED(hr = pProvider2->GetCommitMessage2(GetSafeHwnd(), parameters, repositoryRoot, commonRoot, pathList, originalMessage, bugID, &bugIDOut, &revPropNames, &revPropValues, &temp))) { OnComError(hr); } else { if (bugIDOut) { m_sBugID = bugIDOut; SetDlgItemText(IDC_BUGID, m_sBugID); } m_cLogMessage.SetText((LPCTSTR)temp); BSTR HUGEP *pbRevNames; BSTR HUGEP *pbRevValues; HRESULT hr1 = SafeArrayAccessData(revPropNames, (void HUGEP**)&pbRevNames); if (SUCCEEDED(hr1)) { HRESULT hr2 = SafeArrayAccessData(revPropValues, (void HUGEP**)&pbRevValues); if (SUCCEEDED(hr2)) { if (revPropNames->rgsabound->cElements == revPropValues->rgsabound->cElements) { for (ULONG i = 0; i < revPropNames->rgsabound->cElements; i++) { m_revProps[pbRevNames[i]] = pbRevValues[i]; } } SafeArrayUnaccessData(revPropValues); } SafeArrayUnaccessData(revPropNames); } } } else { // if IBugTraqProvider2 failed, try IBugTraqProvider CComPtr<IBugTraqProvider> pProvider = NULL; hr = m_BugTraqProvider.QueryInterface(&pProvider); if (FAILED(hr)) { OnComError(hr); return; } if (FAILED(hr = pProvider->GetCommitMessage(GetSafeHwnd(), parameters, commonRoot, pathList, originalMessage, &temp))) { OnComError(hr); } else m_cLogMessage.SetText((LPCTSTR)temp); } m_sLogMessage = m_cLogMessage.GetText(); if (!m_ProjectProperties.sMessage.IsEmpty()) { CString sBugID = m_ProjectProperties.FindBugID(m_sLogMessage); if (!sBugID.IsEmpty()) { SetDlgItemText(IDC_BUGID, sBugID); } } m_cLogMessage.SetFocus(); }
void CCopyDlg::OnOK() { if (::IsWindow(m_pLogDlg->GetSafeHwnd())&&(m_pLogDlg->IsWindowVisible())) { m_pLogDlg->SendMessage(WM_CLOSE); return; } m_bCancelled = true; // check if the status thread has already finished if ((m_pThread)&&(m_bThreadRunning)) { WaitForSingleObject(m_pThread->m_hThread, 1000); if (m_bThreadRunning) { // we gave the thread a chance to quit. Since the thread didn't // listen to us we have to kill it. TerminateThread(m_pThread->m_hThread, (DWORD)-1); InterlockedExchange(&m_bThreadRunning, FALSE); } } CString id; GetDlgItemText(IDC_BUGID, id); CString sRevText; GetDlgItemText(IDC_COPYREVTEXT, sRevText); if (!m_ProjectProperties.CheckBugID(id)) { ShowEditBalloon(IDC_BUGID, IDS_COMMITDLG_ONLYNUMBERS, IDS_ERR_ERROR, TTI_ERROR); return; } m_sLogMessage = m_cLogMessage.GetText(); if ((m_ProjectProperties.bWarnIfNoIssue) && (id.IsEmpty() && !m_ProjectProperties.HasBugID(m_sLogMessage))) { CTaskDialog taskdlg(CString(MAKEINTRESOURCE(IDS_COMMITDLG_WARNNOISSUE_TASK1)), CString(MAKEINTRESOURCE(IDS_COMMITDLG_WARNNOISSUE_TASK2)), L"TortoiseSVN", 0, TDF_USE_COMMAND_LINKS | TDF_ALLOW_DIALOG_CANCELLATION | TDF_POSITION_RELATIVE_TO_WINDOW | TDF_SIZE_TO_CONTENT); taskdlg.AddCommandControl(1, CString(MAKEINTRESOURCE(IDS_COMMITDLG_WARNNOISSUE_TASK3))); taskdlg.AddCommandControl(2, CString(MAKEINTRESOURCE(IDS_COMMITDLG_WARNNOISSUE_TASK4))); taskdlg.SetCommonButtons(TDCBF_CANCEL_BUTTON); taskdlg.SetDefaultCommandControl(2); taskdlg.SetMainIcon(TD_WARNING_ICON); if (taskdlg.DoModal(m_hWnd) != 1) return; } UpdateData(TRUE); if (GetCheckedRadioButton(IDC_COPYHEAD, IDC_COPYREV) == IDC_COPYHEAD) m_CopyRev = SVNRev(SVNRev::REV_HEAD); else if (GetCheckedRadioButton(IDC_COPYHEAD, IDC_COPYREV) == IDC_COPYWC) m_CopyRev = SVNRev(SVNRev::REV_WC); else m_CopyRev = SVNRev(sRevText); if (!m_CopyRev.IsValid()) { ShowEditBalloon(IDC_COPYREVTEXT, IDS_ERR_INVALIDREV, IDS_ERR_ERROR, TTI_ERROR); return; } CString combourl = m_URLCombo.GetWindowString(); if (combourl.IsEmpty()) combourl = m_URLCombo.GetString(); if ((m_wcURL.CompareNoCase(combourl)==0)&&(m_CopyRev.IsHead())) { CString temp; temp.FormatMessage(IDS_ERR_COPYITSELF, (LPCTSTR)m_wcURL, (LPCTSTR)m_URLCombo.GetString()); ::MessageBox(this->m_hWnd, temp, L"TortoiseSVN", MB_ICONERROR); return; } m_URLCombo.SaveHistory(); m_URL = CPathUtils::CombineUrls(m_repoRoot, m_URLCombo.GetString()); if (!CTSVNPath(m_URL).IsValidOnWindows()) { CString sInfo; sInfo.Format(IDS_WARN_NOVALIDPATH_TASK1, (LPCTSTR)m_URL); CTaskDialog taskdlg(sInfo, CString(MAKEINTRESOURCE(IDS_WARN_NOVALIDPATH_TASK2)), L"TortoiseSVN", 0, TDF_ENABLE_HYPERLINKS | TDF_USE_COMMAND_LINKS | TDF_ALLOW_DIALOG_CANCELLATION | TDF_POSITION_RELATIVE_TO_WINDOW | TDF_SIZE_TO_CONTENT); taskdlg.AddCommandControl(1, CString(MAKEINTRESOURCE(IDS_WARN_NOVALIDPATH_TASK3))); taskdlg.AddCommandControl(2, CString(MAKEINTRESOURCE(IDS_WARN_NOVALIDPATH_TASK4))); taskdlg.SetCommonButtons(TDCBF_CANCEL_BUTTON); taskdlg.SetExpansionArea(CString(MAKEINTRESOURCE(IDS_WARN_NOVALIDPATH_TASK5))); taskdlg.SetDefaultCommandControl(2); taskdlg.SetMainIcon(TD_WARNING_ICON); if (taskdlg.DoModal(m_hWnd) != 1) return; } CStringUtils::WriteAsciiStringToClipboard(m_URL); // now let the bugtraq plugin check the commit message CComPtr<IBugTraqProvider2> pProvider2 = NULL; if (m_BugTraqProvider) { HRESULT hr = m_BugTraqProvider.QueryInterface(&pProvider2); if (SUCCEEDED(hr)) { ATL::CComBSTR temp; ATL::CComBSTR sourceURL; sourceURL.Attach(m_wcURL.AllocSysString()); ATL::CComBSTR parameters; parameters.Attach(m_bugtraq_association.GetParameters().AllocSysString()); ATL::CComBSTR targetURL; targetURL.Attach(m_URL.AllocSysString()); ATL::CComBSTR commitMessage; commitMessage.Attach(m_sLogMessage.AllocSysString()); CBstrSafeVector pathList(1); pathList.PutElement(0, m_path.GetSVNPathString()); hr = pProvider2->CheckCommit(GetSafeHwnd(), parameters, sourceURL, targetURL, pathList, commitMessage, &temp); if (FAILED(hr)) { OnComError(hr); } else { CString sError = temp == 0 ? L"" : temp; if (!sError.IsEmpty()) { CAppUtils::ReportFailedHook(m_hWnd, sError); return; } } } } CTSVNPathList checkedItems; checkedItems.AddPath(m_path); DWORD exitcode = 0; CString error; CHooks::Instance().SetProjectProperties(m_path, m_ProjectProperties); if (CHooks::Instance().CheckCommit(m_hWnd, checkedItems, m_sLogMessage, exitcode, error)) { if (exitcode) { CString sErrorMsg; sErrorMsg.Format(IDS_HOOK_ERRORMSG, (LPCWSTR)error); CTaskDialog taskdlg(sErrorMsg, CString(MAKEINTRESOURCE(IDS_HOOKFAILED_TASK2)), L"TortoiseSVN", 0, TDF_ENABLE_HYPERLINKS | TDF_USE_COMMAND_LINKS | TDF_ALLOW_DIALOG_CANCELLATION | TDF_POSITION_RELATIVE_TO_WINDOW | TDF_SIZE_TO_CONTENT); taskdlg.AddCommandControl(1, CString(MAKEINTRESOURCE(IDS_HOOKFAILED_TASK3))); taskdlg.AddCommandControl(2, CString(MAKEINTRESOURCE(IDS_HOOKFAILED_TASK4))); taskdlg.SetDefaultCommandControl(1); taskdlg.SetMainIcon(TD_ERROR_ICON); bool retry = (taskdlg.DoModal(GetSafeHwnd()) == 1); if (retry) return; } } if (!m_sLogMessage.IsEmpty()) { m_History.AddEntry(m_sLogMessage); m_History.Save(); } m_sBugID.Trim(); if (!m_sBugID.IsEmpty()) { m_sBugID.Replace(L", ", L","); m_sBugID.Replace(L" ,", L","); CString sBugID = m_ProjectProperties.sMessage; sBugID.Replace(L"%BUGID%", m_sBugID); if (m_ProjectProperties.bAppend) m_sLogMessage += L"\n" + sBugID + L"\n"; else m_sLogMessage = sBugID + L"\n" + m_sLogMessage; UpdateData(FALSE); } CResizableStandAloneDialog::OnOK(); }
JBoolean SyGApplication::OpenDirectory ( const JString& pathName, SyGTreeDir** dir, JIndex* row, const JBoolean deiconify, const JBoolean reportError, const JBoolean forceNew, const JBoolean clearSelection ) { if (dir != NULL) { *dir = NULL; } if (row != NULL) { *row = 0; } JString fixedName, trueName; if (!JExpandHomeDirShortcut(pathName, &fixedName) || !JConvertToAbsolutePath(fixedName, NULL, &trueName)) { if (reportError) { JString msg = "\""; msg += pathName; msg += "\" does not exist."; (JGetUserNotification())->ReportError(msg); } return kJFalse; } // if file, select it after opening the window JString selectName; if (JFileExists(trueName) || !JDirectoryExists(trueName)) // broken link { JStripTrailingDirSeparator(&trueName); JString path; JSplitPathAndName(trueName, &path, &selectName); trueName = path; } // can't check this until after making sure that trueName is directory if (!JFSFileTreeNode::CanHaveChildren(trueName)) { if (reportError) { JString msg = "Unable to read contents of \""; msg += pathName; msg += "\""; (JGetUserNotification())->ReportError(msg); } return kJFalse; } // resolve all .. in path JIndex i; JString p, p1; while (trueName.LocateSubstring("..", &i)) { p = trueName.GetSubstring(1, i+1); if (!JGetTrueName(p, &p1)) { if (reportError) { JString msg = "\""; msg += p; msg += "\" does not exist."; (JGetUserNotification())->ReportError(msg); } return kJFalse; } trueName.ReplaceSubstring(1, i+1, p1); } // check if window is already open JString ancestor = trueName, n; JPtrArray<JString> pathList(JPtrArrayT::kDeleteAll); while (!JIsRootDirectory(ancestor)) { const JIndex count = itsWindowList->GetElementCount(); for (JIndex i=1; i<=count; i++) { const JString name = (itsWindowList->NthElement(i))->GetDirectory(); if (JSameDirEntry(name, ancestor)) { SyGTreeDir* childDir = itsWindowList->NthElement(i); childDir->Activate(); if (dir != NULL) { *dir = childDir; } JPoint cell; (childDir->GetTable())->SelectName(pathList, selectName, &cell, clearSelection); if (row != NULL) { *row = cell.y; } return kJTrue; } } if (forceNew) { break; } JStripTrailingDirSeparator(&ancestor); JSplitPathAndName(ancestor, &p, &n); ancestor = p; pathList.Prepend(n); } // create new window fixedName = trueName; JGetTrueName(fixedName, &trueName); SyGTreeDir* childDir = new SyGTreeDir(trueName); assert( childDir != NULL ); childDir->Activate(); JPoint cell; (childDir->GetTable())->SelectName(selectName, NULL, &cell); if (row != NULL) { *row = cell.y; } if (deiconify) { childDir->GetWindow()->Deiconify(); } itsWindowList->Append(childDir); if (dir != NULL) { *dir = childDir; } return kJTrue; }
QString PathListEditor::pathListString() const { return pathList().join(separator()); }
vector<Path> MCRenderer::sampleMergePathList(const vector<Ray>& startRayList, bool isLightPath) const { Ray termRay; termRay.origin = vec3f(0, 0, 0); termRay.direction = vec3f(0, 0, 0); termRay.color = vec3f(0, 0, 0); termRay.directionSampleType = Ray::DEFINITE; termRay.directionProb = 1; termRay.insideObject = termRay.contactObject = termRay.intersectObject = NULL; vector<Path> pathList(startRayList.size()); vector<Ray> rays; vector<unsigned> pathIDs; vector<Ray> candidateRays = startRayList; vector<unsigned> candidatePathIDs(startRayList.size()); for(unsigned i=0; i<candidatePathIDs.size(); i++) { candidatePathIDs[i] = i; } for(int depth=0; depth<maxDepth && candidateRays.size()>0; depth++) { rays.clear(); pathIDs.clear(); for(int i=0; i<candidateRays.size(); i++) { pathList[candidatePathIDs[i]].push_back(candidateRays[i]); if (depth > 0 && candidateRays[i].contactObject && (candidateRays[i].contactObject->emissive() || candidateRays[i].directionSampleType == Ray::RANDOM)) { pathList[candidatePathIDs[i]].push_back(termRay); continue; } if(candidateRays[i].direction.length() > 0.5) { rays.push_back(candidateRays[i]); pathIDs.push_back(candidatePathIDs[i]); } } renderer->scene.fillIntersectObject(rays); candidateRays.clear(); candidateRays.resize(rays.size()); #pragma omp parallel for for(int i=0; i<rays.size(); i++) { if(rays[i].insideObject && !rays[i].insideObject->isVolumetric()) { candidateRays[i] = rays[i].insideObject->scatter(rays[i] , isLightPath , true); } else if(rays[i].intersectObject) { if (rays[i].intersectObject->isVolumetric() && rays[i].contactObject && rays[i].contactObject->isVolumetric()) { rays[i].origin += rays[i].direction * rays[i].intersectDist; rays[i].intersectDist = 0; } candidateRays[i] = rays[i].intersectObject->scatter(rays[i] , isLightPath , true); } else { candidateRays[i] = termRay; } candidateRays[i].current_tid = rays[i].intersect_tid; } candidatePathIDs = pathIDs; } for (int i=0; i<rays.size(); i++) { if(rays[i].direction.length() > 0.5) { pathList[pathIDs[i]].push_back(termRay); } } return pathList; }
QString PathListEditor::pathListString() const { return pathList().join(HostOsInfo::pathListSeparator()); }
void CInputLogDlg::OnOK() { UpdateData(); m_sLogMsg = m_cInput.GetText(); if (m_pProjectProperties) { CString id; GetDlgItemText(IDC_BUGID, id); id.Trim(_T("\n\r")); if (!m_bLock && !m_pProjectProperties->CheckBugID(id)) { ShowEditBalloon(IDC_BUGID, IDS_COMMITDLG_ONLYNUMBERS, TTI_ERROR); return; } if (!m_bLock && (m_pProjectProperties->bWarnIfNoIssue) && (id.IsEmpty() && !m_pProjectProperties->HasBugID(m_sLogMsg))) { if (CTaskDialog::IsSupported()) { CTaskDialog taskdlg(CString(MAKEINTRESOURCE(IDS_COMMITDLG_WARNNOISSUE_TASK1)), CString(MAKEINTRESOURCE(IDS_COMMITDLG_WARNNOISSUE_TASK2)), L"TortoiseSVN", 0, TDF_USE_COMMAND_LINKS|TDF_ALLOW_DIALOG_CANCELLATION|TDF_POSITION_RELATIVE_TO_WINDOW); taskdlg.AddCommandControl(1, CString(MAKEINTRESOURCE(IDS_COMMITDLG_WARNNOISSUE_TASK3))); taskdlg.AddCommandControl(2, CString(MAKEINTRESOURCE(IDS_COMMITDLG_WARNNOISSUE_TASK4))); taskdlg.SetCommonButtons(TDCBF_CANCEL_BUTTON); taskdlg.SetDefaultCommandControl(2); taskdlg.SetMainIcon(TD_WARNING_ICON); if (taskdlg.DoModal(m_hWnd) != 1) return; } else { if (TSVNMessageBox(this->m_hWnd, IDS_COMMITDLG_NOISSUEWARNING, IDS_APPNAME, MB_YESNO | MB_ICONWARNING)!=IDYES) return; } } m_sBugID.Trim(); CString sExistingBugID = m_pProjectProperties->FindBugID(m_sLogMsg); sExistingBugID.Trim(); if (!m_sBugID.IsEmpty() && m_sBugID.Compare(sExistingBugID)) { m_sBugID.Replace(_T(", "), _T(",")); m_sBugID.Replace(_T(" ,"), _T(",")); CString sBugID = m_pProjectProperties->sMessage; sBugID.Replace(_T("%BUGID%"), m_sBugID); if (m_pProjectProperties->bAppend) m_sLogMsg += _T("\n") + sBugID + _T("\n"); else m_sLogMsg = sBugID + _T("\n") + m_sLogMsg; } if (!m_bLock) { // now let the bugtraq plugin check the commit message CComPtr<IBugTraqProvider2> pProvider2 = NULL; if (m_BugTraqProvider) { HRESULT hr = m_BugTraqProvider.QueryInterface(&pProvider2); if (SUCCEEDED(hr)) { ATL::CComBSTR temp; CString common = m_rootpath.GetSVNPathString(); ATL::CComBSTR repositoryRoot; repositoryRoot.Attach(common.AllocSysString()); ATL::CComBSTR parameters; parameters.Attach(m_bugtraq_association.GetParameters().AllocSysString()); ATL::CComBSTR commonRoot(m_pathlist.GetCommonRoot().GetDirectory().GetWinPath()); ATL::CComBSTR commitMessage; commitMessage.Attach(m_sLogMsg.AllocSysString()); CBstrSafeVector pathList(m_pathlist.GetCount()); for (LONG index = 0; index < m_pathlist.GetCount(); ++index) pathList.PutElement(index, m_pathlist[index].GetSVNPathString()); hr = pProvider2->CheckCommit(GetSafeHwnd(), parameters, repositoryRoot, commonRoot, pathList, commitMessage, &temp); if (FAILED(hr)) { OnComError(hr); } else { CString sError = temp == 0 ? _T("") : temp; if (!sError.IsEmpty()) { CAppUtils::ReportFailedHook(m_hWnd, sError); return; } } } } } } CString reg; reg.Format(_T("Software\\TortoiseSVN\\History\\commit%s"), (LPCTSTR)m_sUUID); CRegHistory history; history.Load(reg, _T("logmsgs")); history.AddEntry(m_sLogMsg); history.Save(); CResizableStandAloneDialog::OnOK(); }