当前位置: 首页>>代码示例>>C++>>正文


C++ CSysProgressDlg::IsValid方法代码示例

本文整理汇总了C++中CSysProgressDlg::IsValid方法的典型用法代码示例。如果您正苦于以下问题:C++ CSysProgressDlg::IsValid方法的具体用法?C++ CSysProgressDlg::IsValid怎么用?C++ CSysProgressDlg::IsValid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CSysProgressDlg的用法示例。


在下文中一共展示了CSysProgressDlg::IsValid方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CherryPickFrom

int CGitLogList::CherryPickFrom(CString from, CString to)
{
    CLogDataVector logs(&m_LogCache);
    if(logs.ParserFromLog(NULL,-1,0,&from,&to))
        return -1;

    if(logs.size() == 0)
        return 0;

    CSysProgressDlg progress;
    if (progress.IsValid())
    {
        progress.SetTitle(_T("Cherry Pick"));
        progress.SetAnimation(IDR_MOVEANI);
        progress.SetTime(true);
        progress.ShowModeless(this);
    }

    CBlockCacheForPath cacheBlock(g_Git.m_CurrentDir);

    for(int i=logs.size()-1;i>=0;i--)
    {
        if (progress.IsValid())
        {
            progress.FormatPathLine(1, _T("Pick up %s"), logs.GetGitRevAt(i).m_CommitHash.ToString());
            progress.FormatPathLine(2, _T("%s"), logs.GetGitRevAt(i).GetSubject());
            progress.SetProgress(logs.size()-i, logs.size());
        }
        if ((progress.IsValid())&&(progress.HasUserCancelled()))
        {
            //CMessageBox::Show(hwndExplorer, IDS_SVN_USERCANCELLED, IDS_APPNAME, MB_ICONINFORMATION);
            throw std::exception(CUnicodeUtils::GetUTF8(CString(_T("User canceled\r\n\r\n"))));
            return -1;
        }
        CString cmd,out;
        cmd.Format(_T("git.exe cherry-pick %s"),logs.GetGitRevAt(i).m_CommitHash.ToString());
        out.Empty();
        if(g_Git.Run(cmd,&out,CP_UTF8))
        {
            throw std::exception(CUnicodeUtils::GetUTF8(CString(_T("Cherry Pick Failure\r\n\r\n"))+out));
            return -1;
        }
    }

    return 0;
}
开发者ID:murank,项目名称:TortoiseGitMod,代码行数:46,代码来源:GitLogListAction.cpp

示例2: Execute


//.........这里部分代码省略.........
            CRenameDlg renDlg;
            renDlg.m_windowtitle.LoadString(IDS_PROC_COPYRENAME);
            renDlg.m_name = pathList[0].GetFileOrDirectoryName();
            if (renDlg.DoModal() != IDOK)
            {
                return FALSE;
            }
            sNewName = renDlg.m_name;
        } while(sNewName.IsEmpty() || PathFileExists(sDroppath+_T("\\")+sNewName));
    }
    CSysProgressDlg progress;
    progress.SetTitle(IDS_PROC_COPYING);
    progress.SetAnimation(IDR_MOVEANI);
    progress.SetTime(true);
    progress.ShowModeless(CWnd::FromHandle(hwndExplorer));
    for(int nPath = 0; nPath < pathList.GetCount(); nPath++)
    {
        const CTGitPath& sourcePath = orgPathList[nPath];

        CTGitPath fullDropPath(sDroppath);

        if (sNewName.IsEmpty())
            fullDropPath.AppendPathString(sourcePath.GetFileOrDirectoryName());
        else
            fullDropPath.AppendPathString(sNewName);

        // Check for a drop-on-to-ourselves
        if (sourcePath.IsEquivalentTo(fullDropPath))
        {
            // Offer a rename
            progress.Stop();
            CRenameDlg dlg;
            dlg.m_windowtitle.Format(IDS_PROC_NEWNAMECOPY, (LPCTSTR)sourcePath.GetUIFileOrDirectoryName());
            if (dlg.DoModal() != IDOK)
            {
                return FALSE;
            }
            // rebuild the progress dialog
            progress.EnsureValid();
            progress.SetTitle(IDS_PROC_COPYING);
            progress.SetAnimation(IDR_MOVEANI);
            progress.SetTime(true);
            progress.SetProgress(count, pathList.GetCount());
            progress.ShowModeless(CWnd::FromHandle(hwndExplorer));
            // Rebuild the destination path, with the new name
            fullDropPath.SetFromUnknown(sDroppath);
            fullDropPath.AppendPathString(dlg.m_name);
        }

        if( CopyFile( sourcePath.GetWinPath(), fullDropPath.GetWinPath(), true))
        {
            CString ProjectTopDir;
            if(fullDropPath.HasAdminDir(&ProjectTopDir))
            {
                g_Git.SetCurrentDir(ProjectTopDir);
                SetCurrentDirectory(ProjectTopDir);
                CString cmd;
                cmd = _T("git.exe add \"");

                CString path;
                path=fullDropPath.GetGitPathString().Mid(ProjectTopDir.GetLength());
                if(path.GetLength()>0)
                    if(path[0]==_T('\\') || path[0]==_T('/'))
                        path=path.Mid(1);
                cmd += path;
                cmd +=_T('\"');

                CString output;
                if (g_Git.Run(cmd, &output, CP_UTF8))
                {
                    CMessageBox::Show(NULL, output, _T("TortoiseGit"), MB_OK|MB_ICONERROR);
                } else
                    CShellUpdater::Instance().AddPathForUpdate(fullDropPath);
            }

        } else
        {
            CString str;
            str+=_T("Copy file fail:");
            str+=sourcePath.GetWinPath();

            CMessageBox::Show(NULL, str, _T("TortoiseGit"), MB_OK|MB_ICONERROR);
        }

        count++;
        if (progress.IsValid())
        {
            progress.FormatPathLine(1, IDS_PROC_COPYINGPROG, sourcePath.GetWinPath());
            progress.FormatPathLine(2, IDS_PROC_CPYMVPROG2, fullDropPath.GetWinPath());
            progress.SetProgress(count, pathList.GetCount());
        }
        if ((progress.IsValid())&&(progress.HasUserCancelled()))
        {
            CMessageBox::Show(hwndExplorer, IDS_SVN_USERCANCELLED, IDS_APPNAME, MB_ICONINFORMATION);
            return false;
        }
    }

    return true;
}
开发者ID:yangrongwei,项目名称:TortoiseGit,代码行数:101,代码来源:DropCopyCommand.cpp

示例3: Execute

bool PasteMoveCommand::Execute()
{
    CString sDroppath = parser.GetVal(_T("droptarget"));
    CTGitPath dropPath(sDroppath);
    if (dropPath.IsAdminDir())
        return FALSE;

    if(!dropPath.HasAdminDir(&g_Git.m_CurrentDir))
        return FALSE;

    GitStatus status;
    unsigned long count = 0;
    orgPathList.RemoveAdminPaths();
    CString sNewName;
    CSysProgressDlg progress;
    progress.SetTitle(IDS_PROC_MOVING);
    progress.SetAnimation(IDR_MOVEANI);
    progress.SetTime(true);
    progress.ShowModeless(CWnd::FromHandle(hwndExplorer));
    for (int nPath = 0; nPath < orgPathList.GetCount(); ++nPath)
    {
        CTGitPath destPath;
        if (sNewName.IsEmpty())
            destPath = CTGitPath(sDroppath+_T("\\")+orgPathList[nPath].GetFileOrDirectoryName());
        else
            destPath = CTGitPath(sDroppath+_T("\\")+sNewName);
        if (destPath.Exists())
        {
            CString name = orgPathList[nPath].GetFileOrDirectoryName();
            if (!sNewName.IsEmpty())
                name = sNewName;
            progress.Stop();
            CRenameDlg dlg;
            dlg.m_name = name;
            dlg.m_windowtitle.Format(IDS_PROC_NEWNAMEMOVE, (LPCTSTR)name);
            if (dlg.DoModal() != IDOK)
            {
                return FALSE;
            }
            destPath.SetFromWin(sDroppath+_T("\\")+dlg.m_name);
        }
        CString top;
        top.Empty();
        orgPathList[nPath].HasAdminDir(&top);
        git_wc_status_kind s = status.GetAllStatus(orgPathList[nPath]);
        if ((s == git_wc_status_none)||(s == git_wc_status_unversioned)||(s == git_wc_status_ignored)||top != g_Git.m_CurrentDir)
        {
            // source file is unversioned: move the file to the target, then add it
            MoveFile(orgPathList[nPath].GetWinPath(), destPath.GetWinPath());
            CString cmd,output;
            cmd.Format(_T("git.exe add -- \"%s\""),destPath.GetWinPath());
            if (g_Git.Run(cmd, &output, CP_UTF8))
            //if (!Git.Add(CTGitorgPathList(destPath), &props, Git_depth_infinity, true, false, true))
            {
                TRACE(_T("%s\n"), output);
                CMessageBox::Show(hwndExplorer, output, _T("TortoiseGit"), MB_ICONERROR);
                return FALSE;		//get out of here
            }
            CShellUpdater::Instance().AddPathForUpdate(destPath);
        }
        else
        {
            CString cmd,output;
            cmd.Format(_T("git.exe mv \"%s\" \"%s\""),orgPathList[nPath].GetGitPathString(),destPath.GetGitPathString());
            if (g_Git.Run(cmd, &output, CP_UTF8))
            //if (!Git.Move(CTGitorgPathList(orgPathList[nPath]), destPath, FALSE))
            {
#if 0
                if (Git.Err && (Git.Err->apr_err == Git_ERR_UNVERSIONED_RESOURCE ||
                    Git.Err->apr_err == Git_ERR_CLIENT_MODIFIED))
                {
                    // file/folder seems to have local modifications. Ask the user if
                    // a force is requested.
                    CString temp = Git.GetLastErrorMessage();
                    CString sQuestion(MAKEINTRESOURCE(IDS_PROC_FORCEMOVE));
                    temp += _T("\n") + sQuestion;
                    if (CMessageBox::Show(hwndExplorer, temp, _T("TortoiseGit"), MB_YESNO)==IDYES)
                    {
                        if (!Git.Move(CTGitPathList(pathList[nPath]), destPath, TRUE))
                        {
                            CMessageBox::Show(hwndExplorer, Git.GetLastErrorMessage(), _T("TortoiseGit"), MB_ICONERROR);
                            return FALSE;		//get out of here
                        }
                        CShellUpdater::Instance().AddPathForUpdate(destPath);
                    }
                }
                else
#endif
                {
                    TRACE(_T("%s\n"), (LPCTSTR)output);
                    CMessageBox::Show(hwndExplorer, output, _T("TortoiseGit"), MB_ICONERROR);
                    return FALSE;		//get out of here
                }
            }
            else
                CShellUpdater::Instance().AddPathForUpdate(destPath);
        }
        ++count;
        if (progress.IsValid())
        {
//.........这里部分代码省略.........
开发者ID:hope2k,项目名称:TortoiseGit,代码行数:101,代码来源:PasteMoveCommand.cpp


注:本文中的CSysProgressDlg::IsValid方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。