From 61d26b6e76a405ed4d5321188484b2fdd2cc2174 Mon Sep 17 00:00:00 2001 From: Sven Strickroth Date: Sat, 9 Mar 2013 19:27:47 +0100 Subject: [PATCH] CGitProgressList: Export report and notify methods Signed-off-by: Sven Strickroth --- src/TortoiseProc/GitProgressList.cpp | 2 +- src/TortoiseProc/GitProgressList.h | 4 ++++ src/TortoiseProc/MassiveGitTask.cpp | 8 +++----- src/TortoiseProc/MassiveGitTask.h | 7 ++----- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/TortoiseProc/GitProgressList.cpp b/src/TortoiseProc/GitProgressList.cpp index c235c2b66..6d5e1437e 100644 --- a/src/TortoiseProc/GitProgressList.cpp +++ b/src/TortoiseProc/GitProgressList.cpp @@ -1812,7 +1812,7 @@ bool CGitProgressList::CmdAdd(CString& sWindowTitle, bool& localoperation) else { CMassiveGitTask mgt(L"add -f"); - mgt.ExecuteWithNotify(&m_targetPathList, m_bCancelled, git_wc_notify_add, this, &CGitProgressList::Notify); + mgt.ExecuteWithNotify(&m_targetPathList, m_bCancelled, git_wc_notify_add, this); } CShellUpdater::Instance().AddPathsForUpdate(m_targetPathList); diff --git a/src/TortoiseProc/GitProgressList.h b/src/TortoiseProc/GitProgressList.h index 6c20b347d..5276aee1d 100644 --- a/src/TortoiseProc/GitProgressList.h +++ b/src/TortoiseProc/GitProgressList.h @@ -209,6 +209,7 @@ private: protected: DECLARE_MESSAGE_MAP() +public: //Need update in the future implement the virtual methods from Git base class virtual BOOL Notify(const CTGitPath& path, git_wc_notify_action_t action, @@ -223,6 +224,7 @@ protected: git_merge_range_t * range, git_error_t * err, apr_pool_t * pool*/ ); +protected: virtual BOOL Notify(const git_wc_notify_action_t action, const git_transfer_progress *stat); virtual BOOL Notify(const git_wc_notify_action_t action, CString str, const git_oid *a, const git_oid *b); @@ -282,6 +284,7 @@ private: static UINT ProgressThreadEntry(LPVOID pVoid); UINT ProgressThread(); +public: void ReportGitError(); void ReportUserCanceled(); void ReportError(const CString& sError); @@ -289,6 +292,7 @@ private: void ReportNotification(const CString& sNotification); void ReportCmd(const CString& sCmd); void ReportString(CString sMessage, const CString& sMsgKind, COLORREF color = ::GetSysColor(COLOR_WINDOWTEXT)); +private: void AddItemToList(); CString BuildInfoString(); CString GetPathFromColumnText(const CString& sColumnText); diff --git a/src/TortoiseProc/MassiveGitTask.cpp b/src/TortoiseProc/MassiveGitTask.cpp index ac8d5342a..616fa4ab3 100644 --- a/src/TortoiseProc/MassiveGitTask.cpp +++ b/src/TortoiseProc/MassiveGitTask.cpp @@ -27,7 +27,6 @@ CMassiveGitTask::CMassiveGitTask(CString gitParameters, BOOL isPath) : m_bUnused(true) , m_bIsPath(isPath) , m_NotifyCallbackInstance(NULL) - , m_NotifyCallbackMethod(NULL) , m_NotifyCallbackAction(git_wc_notify_add) { m_sParams = gitParameters; @@ -55,14 +54,13 @@ void CMassiveGitTask::AddFile(CTGitPath filename) m_itemList.push_back(filename.GetGitPathString()); } -bool CMassiveGitTask::ExecuteWithNotify(CTGitPathList *pathList, volatile BOOL &cancel, git_wc_notify_action_t action, CGitProgressList * instance, NOTIFY_CALLBACK notifyMethod) +bool CMassiveGitTask::ExecuteWithNotify(CTGitPathList *pathList, volatile BOOL &cancel, git_wc_notify_action_t action, CGitProgressList * instance) { assert(m_bUnused); m_bUnused = false; m_pathList = *pathList; m_NotifyCallbackInstance = instance; - m_NotifyCallbackMethod = notifyMethod; m_NotifyCallbackAction = action; return ExecuteCommands(cancel); } @@ -97,9 +95,9 @@ bool CMassiveGitTask::ExecuteCommands(volatile BOOL &cancel) } if (m_bIsPath) - if (m_NotifyCallbackInstance && m_NotifyCallbackMethod) + if (m_NotifyCallbackInstance) for (int j = firstCombine; j <= i; ++j) - (*m_NotifyCallbackInstance.*m_NotifyCallbackMethod)(m_pathList[j], m_NotifyCallbackAction, 0, NULL); + m_NotifyCallbackInstance->Notify(m_pathList[j], m_NotifyCallbackAction); maxLength = 0; firstCombine = i+1; diff --git a/src/TortoiseProc/MassiveGitTask.h b/src/TortoiseProc/MassiveGitTask.h index b3e4945b8..a2bf9c7e7 100644 --- a/src/TortoiseProc/MassiveGitTask.h +++ b/src/TortoiseProc/MassiveGitTask.h @@ -1,6 +1,6 @@ // TortoiseGit - a Windows shell extension for easy version control -// Copyright (C) 2011-2012 - Sven Strickroth +// Copyright (C) 2011-2013 - Sven Strickroth // Copyright (C) 2013 - TortoiseGit // This program is free software; you can redistribute it and/or @@ -24,8 +24,6 @@ #define MAX_COMMANDLINE_LENGTH 30000 -typedef BOOL (CGitProgressList::*NOTIFY_CALLBACK)(const CTGitPath& path, git_wc_notify_action_t action, int status, CString *strErr); - class CMassiveGitTask { public: @@ -34,7 +32,7 @@ public: void AddFile(CString filename); void AddFile(CTGitPath filename); - bool ExecuteWithNotify(CTGitPathList *pathList, volatile BOOL &cancel, git_wc_notify_action_t action, CGitProgressList * instance, NOTIFY_CALLBACK m_NotifyCallbackMethod); + bool ExecuteWithNotify(CTGitPathList *pathList, volatile BOOL &cancel, git_wc_notify_action_t action, CGitProgressList * instance); bool Execute(BOOL &cancel); private: @@ -47,6 +45,5 @@ private: CTGitPathList m_pathList; STRING_VECTOR m_itemList; CGitProgressList * m_NotifyCallbackInstance; - NOTIFY_CALLBACK m_NotifyCallbackMethod; git_wc_notify_action_t m_NotifyCallbackAction; }; -- 2.11.4.GIT