forked from WinMerge/winmerge
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DirCompProgressBar.h
83 lines (73 loc) · 2.42 KB
/
DirCompProgressBar.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/**
* @file DirCompProgressBar.h
*
* @brief Declaration file for Directory compare statusdialog class
*/
#pragma once
#include "TrDialogs.h"
#include "CompareStats.h"
class ITaskBarList3;
/////////////////////////////////////////////////////////////////////////////
// DirCompProgressBar dialog
/**
* @brief Class for directory compare statusdialog.
*
* Implements non-modal dialog directory compares. We create this
* modeless dialog when we start the compare and destroy it after
* compare is ready. Dialog itself shows counts of total found items
* and items compared so far. And nice progressbar for user to have some
* idea how compare is going.
*
* Status updates are fired by periodic timer events. We have shared
* datastructure with compare code. Compare code updates status information
* to datastructure during compare. When timer event fires, dialog reads
* that datastructure and updates the GUI.
*
* @todo Now we update total count of items with same timer than we update
* compared items count. Maybe we should use different timer and bigger
* interval for total count updates?
*/
class DirCompProgressBar : public CTrDialogBar
{
// Construction
public:
DirCompProgressBar(); // standard constructor
~DirCompProgressBar();
BOOL Create(CWnd* pParentWnd);
void SetCompareStat(CompareStats * pCompareStats);
void StartUpdating();
void EndUpdating();
void SetPaused(bool paused);
int GetNumberOfCPUCoresToUse() const;
void SetNumberOfCPUCoresToUse(int num);
// Dialog Data
//{{AFX_DATA(DirCompProgressBar)
enum { IDD = IDD_DIRCOMP_PROGRESS };
//}}AFX_DATA
// Implementation
protected:
void ClearStat();
void SetProgressState(int comparedItems, int totalItems);
void SetNumberOfCPUCoresToUseMax(int max);
// Generated message map functions
//{{AFX_MSG(DirCompProgressBar)
afx_msg void OnTimer(UINT_PTR nIDEvent);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
private:
CompareStats *m_pCompareStats; /**< Pointer to comparestats */
CompareStats::CMP_STATE m_prevState; /**< Previous state for compare (to track changes) */
bool m_bCompareReady; /**< Compare ready, waiting for closing? */
std::list<int> m_prevComparedItems;
#ifdef __ITaskbarList3_INTERFACE_DEFINED__
ITaskbarList3 *m_pTaskbarList;
#endif
};
/**
* @brief Set pointer to compare stats.
* @param [in] pCompareStats Pointer to stats.
*/
inline void DirCompProgressBar::SetCompareStat(CompareStats * pCompareStats)
{
m_pCompareStats = pCompareStats;
}