diff options
author | Igor Pavlov <ipavlov@users.sourceforge.net> | 2009-06-02 04:00:00 +0400 |
---|---|---|
committer | Kornel LesiĆski <kornel@geekhood.net> | 2016-05-28 02:15:59 +0300 |
commit | 829409452d85cd6dd9dfc9151f109d6e13a2bb1c (patch) | |
tree | e0acaea47044d167f35fa197584dee1bde41c329 /CPP/7zip/UI/FileManager/ProgressDialog2.h | |
parent | 8874e4fbc9faabdcff719b9b2ac8ebad4f282bbe (diff) |
9.04 beta
Diffstat (limited to 'CPP/7zip/UI/FileManager/ProgressDialog2.h')
-rwxr-xr-x | CPP/7zip/UI/FileManager/ProgressDialog2.h | 89 |
1 files changed, 52 insertions, 37 deletions
diff --git a/CPP/7zip/UI/FileManager/ProgressDialog2.h b/CPP/7zip/UI/FileManager/ProgressDialog2.h index e838ae25..3ab9f4c0 100755 --- a/CPP/7zip/UI/FileManager/ProgressDialog2.h +++ b/CPP/7zip/UI/FileManager/ProgressDialog2.h @@ -1,9 +1,7 @@ // ProgressDialog2.h -#ifndef __PROGRESSDIALOG2_H -#define __PROGRESSDIALOG2_H - -#include "ProgressDialog2Res.h" +#ifndef __PROGRESS_DIALOG2_H +#define __PROGRESS_DIALOG2_H #include "Common/Types.h" @@ -11,59 +9,69 @@ #include "Windows/Control/ProgressBar.h" #include "Windows/Synchronization.h" +#include "ProgressDialog2Res.h" + class CProgressSynch { - NWindows::NSynchronization::CCriticalSection _criticalSection; + NWindows::NSynchronization::CCriticalSection _cs; bool _stopped; bool _paused; - UInt64 _total; - UInt64 _completed; + bool _bytesProgressMode; + + UInt64 _totalBytes; + UInt64 _curBytes; + UInt64 _totalFiles; + UInt64 _curFiles; UInt64 _inSize; UInt64 _outSize; - UInt64 _totalFiles; - UInt64 _completedFiles; + UString TitleFileName; UString CurrentFileName; + public: CProgressSynch(): _stopped(false), _paused(false), - _total((UInt64)(Int64)-1), - _completed(0), - _totalFiles((UInt64)(Int64)-1), - _completedFiles(0), + _totalBytes((UInt64)(Int64)-1), _curBytes(0), + _totalFiles((UInt64)(Int64)-1), _curFiles(0), _inSize((UInt64)(Int64)-1), - _outSize((UInt64)(Int64)-1) + _outSize((UInt64)(Int64)-1), + _bytesProgressMode(true) {} bool GetStopped() { - NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection); + NWindows::NSynchronization::CCriticalSectionLock lock(_cs); return _stopped; } void SetStopped(bool value) { - NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection); + NWindows::NSynchronization::CCriticalSectionLock lock(_cs); _stopped = value; } bool GetPaused() { - NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection); + NWindows::NSynchronization::CCriticalSectionLock lock(_cs); return _paused; } void SetPaused(bool value) { - NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection); + NWindows::NSynchronization::CCriticalSectionLock lock(_cs); _paused = value; } + void SetBytesProgressMode(bool bytesProgressMode) + { + NWindows::NSynchronization::CCriticalSectionLock lock(_cs); + _bytesProgressMode = bytesProgressMode; + } void SetProgress(UInt64 total, UInt64 completed) { - NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection); - _total = total; - _completed = completed; + NWindows::NSynchronization::CCriticalSectionLock lock(_cs); + _totalBytes = total; + _curBytes = completed; } void SetRatioInfo(const UInt64 *inSize, const UInt64 *outSize) { - NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection); + NWindows::NSynchronization::CCriticalSectionLock lock(_cs); if (inSize) _inSize = *inSize; if (outSize) @@ -71,51 +79,58 @@ public: } void SetPos(UInt64 completed) { - NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection); - _completed = completed; + NWindows::NSynchronization::CCriticalSectionLock lock(_cs); + _curBytes = completed; + } + void SetNumBytesTotal(UInt64 value) + { + NWindows::NSynchronization::CCriticalSectionLock lock(_cs); + _totalBytes = value; } void SetNumFilesTotal(UInt64 value) { - NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection); + NWindows::NSynchronization::CCriticalSectionLock lock(_cs); _totalFiles = value; } void SetNumFilesCur(UInt64 value) { - NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection); - _completedFiles = value; + NWindows::NSynchronization::CCriticalSectionLock lock(_cs); + _curFiles = value; } HRESULT ProcessStopAndPause(); HRESULT SetPosAndCheckPaused(UInt64 completed); void GetProgress(UInt64 &total, UInt64 &completed, - UInt64 &totalFiles, UInt64 &completedFiles, - UInt64 &inSize, UInt64 &outSize) + UInt64 &totalFiles, UInt64 &curFiles, + UInt64 &inSize, UInt64 &outSize, + bool &bytesProgressMode) { - NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection); - total = _total; - completed = _completed; + NWindows::NSynchronization::CCriticalSectionLock lock(_cs); + total = _totalBytes; + completed = _curBytes; totalFiles = _totalFiles; - completedFiles = _completedFiles; + curFiles = _curFiles; inSize = _inSize; outSize = _outSize; + bytesProgressMode = _bytesProgressMode; } void SetTitleFileName(const UString &fileName) { - NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection); + NWindows::NSynchronization::CCriticalSectionLock lock(_cs); TitleFileName = fileName; } void GetTitleFileName(UString &fileName) { - NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection); + NWindows::NSynchronization::CCriticalSectionLock lock(_cs); fileName = TitleFileName; } void SetCurrentFileName(const UString &fileName) { - NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection); + NWindows::NSynchronization::CCriticalSectionLock lock(_cs); CurrentFileName = fileName; } void GetCurrentFileName(UString &fileName) { - NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection); + NWindows::NSynchronization::CCriticalSectionLock lock(_cs); fileName = CurrentFileName; } }; |