mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-12 18:11:35 -06:00
4.20
This commit is contained in:
committed by
Kornel Lesiński
parent
8c1b5c7b7e
commit
3c510ba80b
@@ -1,12 +1,12 @@
|
||||
// ProgressDialog.h
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __PROGRESSDIALOG_H
|
||||
#define __PROGRESSDIALOG_H
|
||||
|
||||
#include "resource.h"
|
||||
|
||||
#include "Common/Types.h"
|
||||
|
||||
#include "Windows/Control/Dialog.h"
|
||||
#include "Windows/Control/ProgressBar.h"
|
||||
#include "Windows/Synchronization.h"
|
||||
@@ -16,8 +16,10 @@ class CProgressSynch
|
||||
NWindows::NSynchronization::CCriticalSection _criticalSection;
|
||||
bool _stopped;
|
||||
bool _paused;
|
||||
UINT64 _total;
|
||||
UINT64 _completed;
|
||||
UInt64 _total;
|
||||
UInt64 _completed;
|
||||
UString TitleFileName;
|
||||
UString CurrentFileName;
|
||||
public:
|
||||
CProgressSynch(): _stopped(false), _paused(false), _total(1), _completed(0) {}
|
||||
|
||||
@@ -41,31 +43,52 @@ public:
|
||||
NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection);
|
||||
_paused = value;
|
||||
}
|
||||
void SetProgress(UINT64 total, UINT64 completed)
|
||||
void SetProgress(UInt64 total, UInt64 completed)
|
||||
{
|
||||
NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection);
|
||||
_total = total;
|
||||
_completed = completed;
|
||||
}
|
||||
void SetPos(UINT64 completed)
|
||||
void SetPos(UInt64 completed)
|
||||
{
|
||||
NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection);
|
||||
_completed = completed;
|
||||
}
|
||||
void GetProgress(UINT64 &total, UINT64 &completed)
|
||||
HRESULT SetPosAndCheckPaused(UInt64 completed);
|
||||
void GetProgress(UInt64 &total, UInt64 &completed)
|
||||
{
|
||||
NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection);
|
||||
total = _total;
|
||||
completed = _completed;
|
||||
}
|
||||
void SetTitleFileName(const UString &fileName)
|
||||
{
|
||||
NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection);
|
||||
TitleFileName = fileName;
|
||||
}
|
||||
void GetTitleFileName(UString &fileName)
|
||||
{
|
||||
NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection);
|
||||
fileName = TitleFileName;
|
||||
}
|
||||
void SetCurrentFileName(const UString &fileName)
|
||||
{
|
||||
NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection);
|
||||
CurrentFileName = fileName;
|
||||
}
|
||||
void GetCurrentFileName(UString &fileName)
|
||||
{
|
||||
NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection);
|
||||
fileName = CurrentFileName;
|
||||
}
|
||||
};
|
||||
|
||||
class CU64ToI32Converter
|
||||
{
|
||||
UINT64 _numShiftBits;
|
||||
UInt64 _numShiftBits;
|
||||
public:
|
||||
void Init(UINT64 _range);
|
||||
int Count(UINT64 aValue);
|
||||
void Init(UInt64 _range);
|
||||
int Count(UInt64 aValue);
|
||||
};
|
||||
|
||||
// class CProgressDialog: public NWindows::NControl::CModelessDialog
|
||||
@@ -79,6 +102,8 @@ enum ESpeedMode
|
||||
|
||||
class CProgressDialog: public NWindows::NControl::CModalDialog
|
||||
{
|
||||
UString _prevFileName;
|
||||
UString _prevTitleName;
|
||||
private:
|
||||
UString backgroundString;
|
||||
UString backgroundedString;
|
||||
@@ -93,23 +118,23 @@ private:
|
||||
|
||||
UString _title;
|
||||
CU64ToI32Converter _converter;
|
||||
UINT64 _previousPos;
|
||||
UINT64 _range;
|
||||
UInt64 _previousPos;
|
||||
UInt64 _range;
|
||||
NWindows::NControl::CProgressBar m_ProgressBar;
|
||||
|
||||
UINT32 _prevPercentValue;
|
||||
UINT32 _pevTime;
|
||||
UINT32 _elapsedTime;
|
||||
UINT32 _prevElapsedSec;
|
||||
UINT64 _prevRemainingSec;
|
||||
UInt32 _prevPercentValue;
|
||||
UInt32 _prevTime;
|
||||
UInt32 _elapsedTime;
|
||||
UInt32 _prevElapsedSec;
|
||||
UInt64 _prevRemainingSec;
|
||||
ESpeedMode _prevMode;
|
||||
UINT64 _prevSpeed;
|
||||
UInt64 _prevSpeed;
|
||||
|
||||
bool _foreground;
|
||||
|
||||
bool OnTimer(WPARAM timerID, LPARAM callback);
|
||||
void SetRange(UINT64 range);
|
||||
void SetPos(UINT64 pos);
|
||||
void SetRange(UInt64 range);
|
||||
void SetPos(UInt64 pos);
|
||||
virtual bool OnInit();
|
||||
virtual void OnCancel();
|
||||
NWindows::NSynchronization::CManualResetEvent _dialogCreatedEvent;
|
||||
@@ -122,6 +147,8 @@ private:
|
||||
void OnPauseButton();
|
||||
void OnPriorityButton();
|
||||
bool OnButtonClicked(int buttonID, HWND buttonHWND);
|
||||
|
||||
void SetTitleText();
|
||||
public:
|
||||
CProgressSynch ProgressSynch;
|
||||
|
||||
@@ -134,7 +161,7 @@ public:
|
||||
|
||||
CProgressDialog(): _timer(0)
|
||||
#ifndef _SFX
|
||||
,MainWindow(0)
|
||||
,MainWindow(0)
|
||||
#endif
|
||||
{}
|
||||
|
||||
@@ -151,10 +178,7 @@ public:
|
||||
|
||||
virtual bool OnMessage(UINT message, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
void MyClose()
|
||||
{
|
||||
PostMessage(kCloseMessage);
|
||||
};
|
||||
void MyClose() { PostMessage(kCloseMessage); };
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user