1 // ProgressBox.h 2 3 #ifndef ZIP7_INC_PROGRESS_BOX_H 4 #define ZIP7_INC_PROGRESS_BOX_H 5 6 #include "../../../Common/MyString.h" 7 #include "../../../Common/MyTypes.h" 8 9 struct CPercentPrinterState 10 { 11 UInt64 Completed; 12 UInt64 Total; 13 14 UInt64 Files; 15 UInt64 FilesTotal; 16 17 AString Command; 18 UString FileName; 19 20 void ClearCurState(); 21 IsEqualToCPercentPrinterState22 bool IsEqualTo(const CPercentPrinterState &s) const 23 { 24 return 25 Completed == s.Completed 26 && Total == s.Total 27 && Files == s.Files 28 && FilesTotal == s.FilesTotal 29 && Command == s.Command 30 && FileName == s.FileName; 31 } 32 CPercentPrinterStateCPercentPrinterState33 CPercentPrinterState(): 34 Completed(0), 35 Total((UInt64)(Int64)-1), 36 Files(0), 37 FilesTotal(0) 38 {} 39 }; 40 41 class CProgressBox: public CPercentPrinterState 42 { 43 UInt32 _tickStep; 44 DWORD _prevTick; 45 DWORD _prevElapsedSec; 46 47 bool _wasPrinted; 48 49 UString _tempU; 50 UString _name1U; 51 UString _name2U; 52 53 CPercentPrinterState _printedState; 54 55 AString _title; 56 57 AString _timeStr; 58 AString _files; 59 AString _sizesStr; 60 AString _name1; 61 AString _name2; 62 AString _perc; 63 64 void ReduceString(const UString &src, AString &dest); 65 66 public: 67 DWORD StartTick; 68 bool UseBytesForPercents; 69 unsigned MaxLen; 70 71 CProgressBox(UInt32 tickStep = 200): _tickStep(tickStep)72 _tickStep(tickStep), 73 _prevTick(0), 74 StartTick(0), 75 UseBytesForPercents(true), 76 MaxLen(60) 77 {} 78 79 void Init(const char *title); 80 void Print(); 81 }; 82 83 #endif 84