Progress.h 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. //----------------------------------------------------------------------------
  2. #ifndef ProgressH
  3. #define ProgressH
  4. //----------------------------------------------------------------------------
  5. #include "PathLabel.hpp"
  6. #include <System.Classes.hpp>
  7. #include <Vcl.ComCtrls.hpp>
  8. #include <Vcl.Controls.hpp>
  9. #include <Vcl.ExtCtrls.hpp>
  10. #include <Vcl.StdCtrls.hpp>
  11. //----------------------------------------------------------------------------
  12. #include <FileOperationProgress.h>
  13. #include <Vcl.Menus.hpp>
  14. #include "PngImageList.hpp"
  15. #include <Vcl.Imaging.pngimage.hpp>
  16. #include <Vcl.ImgList.hpp>
  17. //----------------------------------------------------------------------------
  18. #include <GUITools.h>
  19. #include "TB2Dock.hpp"
  20. #include "TB2Item.hpp"
  21. #include "TB2Toolbar.hpp"
  22. #include "TBX.hpp"
  23. #include "TB2ExtItems.hpp"
  24. #include "TBXExtItems.hpp"
  25. #include <Vcl.AppEvnts.hpp>
  26. #include <list>
  27. //----------------------------------------------------------------------------
  28. class TProgressForm : public TForm
  29. {
  30. __published:
  31. TPanel *MainPanel;
  32. TLabel *PathLabel;
  33. TPathLabel *FileLabel;
  34. TLabel *TargetLabel;
  35. TPathLabel *TargetPathLabel;
  36. TProgressBar *OperationProgress;
  37. TPanel *TransferPanel;
  38. TLabel *Label3;
  39. TLabel *TimeElapsedLabel;
  40. TLabel *StartTimeLabelLabel;
  41. TLabel *StartTimeLabel;
  42. TLabel *Label4;
  43. TLabel *BytesTransferredLabel;
  44. TLabel *Label12;
  45. TLabel *CPSLabel;
  46. TProgressBar *FileProgress;
  47. TTimer *UpdateTimer;
  48. TLabel *TimeLeftLabelLabel;
  49. TLabel *TimeLeftLabel;
  50. TPaintBox *AnimationPaintBox;
  51. TPngImageList *ImageList;
  52. TPanel *ToolbarPanel;
  53. TTBXDock *Dock;
  54. TTBXToolbar *Toolbar;
  55. TTBXItem *CancelItem;
  56. TTBXItem *MinimizeItem;
  57. TTBXItem *MoveToQueueItem;
  58. TTBXSubmenuItem *CycleOnceDoneItem;
  59. TTBXItem *IdleOnceDoneItem;
  60. TTBXItem *DisconnectOnceDoneItem;
  61. TTBXItem *SuspendOnceDoneItem;
  62. TTBXItem *ShutDownOnceDoneItem;
  63. TTBXComboBoxItem *SpeedComboBoxItem;
  64. TPanel *ComponentsPanel;
  65. TPngImageList *ImageList120;
  66. TPngImageList *ImageList144;
  67. TPngImageList *ImageList192;
  68. TApplicationEvents *ApplicationEvents;
  69. TTBXItem *SkipItem;
  70. void __fastcall UpdateTimerTimer(TObject *Sender);
  71. void __fastcall FormShow(TObject *Sender);
  72. void __fastcall FormHide(TObject *Sender);
  73. void __fastcall CancelItemClick(TObject *Sender);
  74. void __fastcall MinimizeItemClick(TObject *Sender);
  75. void __fastcall MoveToQueueItemClick(TObject *Sender);
  76. void __fastcall OnceDoneItemClick(TObject *Sender);
  77. void __fastcall CycleOnceDoneItemClick(TObject *Sender);
  78. void __fastcall SpeedComboBoxItemAcceptText(TObject *Sender, UnicodeString &NewText,
  79. bool &Accept);
  80. void __fastcall SpeedComboBoxItemItemClick(TObject *Sender);
  81. void __fastcall SpeedComboBoxItemAdjustImageIndex(TTBXComboBoxItem *Sender, const UnicodeString AText,
  82. int AIndex, int &ImageIndex);
  83. void __fastcall ApplicationModalBegin(TObject * Sender);
  84. void __fastcall SpeedComboBoxItemClick(TObject *Sender);
  85. void __fastcall SkipItemClick(TObject *Sender);
  86. private:
  87. TCancelStatus FCancel;
  88. bool FPendingSkip;
  89. bool FMoveToQueue;
  90. TFileOperationProgressType FData;
  91. bool FDataGot;
  92. bool FDataReceived;
  93. TFileOperation FLastOperation;
  94. TOperationSide FLastSide;
  95. bool FLastTotalSizeSet;
  96. bool FMinimizedByMe;
  97. int FUpdateCounter;
  98. bool FAsciiTransferChanged;
  99. bool FResumeStatusChanged;
  100. void * FShowAsModalStorage;
  101. bool FDeleteLocalToRecycleBin;
  102. bool FDeleteRemoteToRecycleBin;
  103. bool FReadOnly;
  104. unsigned long FCPSLimit;
  105. TDateTime FStarted;
  106. int FSinceLastUpdate;
  107. bool FModalBeginHooked;
  108. int FModalLevel;
  109. TFrameAnimation FFrameAnimation;
  110. typedef BiDiMap<TOnceDoneOperation, TTBCustomItem *> TOnceDoneItems;
  111. TOnceDoneItems FOnceDoneItems;
  112. bool FAllowSkip;
  113. TSynchronizeProgress * FSynchronizeProgress;
  114. void __fastcall SetOnceDoneOperation(TOnceDoneOperation value);
  115. TTBCustomItem * __fastcall CurrentOnceDoneItem();
  116. TOnceDoneOperation __fastcall GetOnceDoneOperation();
  117. void __fastcall SetOnceDoneItem(TTBCustomItem * Item);
  118. void __fastcall SetAllowMinimize(bool value);
  119. bool __fastcall GetAllowMinimize();
  120. void __fastcall SetReadOnly(bool value);
  121. void __fastcall GlobalMinimize(TObject * Sender);
  122. UnicodeString __fastcall ItemSpeed(const UnicodeString & Text, TTBXComboBoxItem * Item);
  123. void __fastcall CMDialogKey(TCMDialogKey & Message);
  124. protected:
  125. void __fastcall CancelOperation();
  126. void __fastcall UpdateControls();
  127. void __fastcall ResetOnceDoneOperation();
  128. bool __fastcall ReceiveData(bool Force, int ModalLevelOffset);
  129. void __fastcall Minimize(TObject * Sender);
  130. virtual void __fastcall Dispatch(void * Message);
  131. void __fastcall SetCancelLower(TCancelStatus ACancel);
  132. static bool __fastcall IsIndeterminateOperation(TFileOperation Operation);
  133. public:
  134. static UnicodeString __fastcall ProgressStr(
  135. const TSynchronizeProgress * SynchronizeProgress, const TFileOperationProgressType * ProgressData);
  136. virtual __fastcall TProgressForm(
  137. TComponent * AOwner, bool AllowMoveToQueue, bool AllowSkip, TSynchronizeProgress * SynchronizeProgress);
  138. virtual __fastcall ~TProgressForm();
  139. void __fastcall SetProgressData(TFileOperationProgressType & AData);
  140. void __fastcall ClearCancel();
  141. __property TCancelStatus Cancel = { read = FCancel };
  142. __property bool MoveToQueue = { read = FMoveToQueue };
  143. __property TOnceDoneOperation OnceDoneOperation = { read=GetOnceDoneOperation, write=SetOnceDoneOperation };
  144. __property bool AllowMinimize = { read=GetAllowMinimize, write=SetAllowMinimize };
  145. __property bool DeleteLocalToRecycleBin = { read=FDeleteLocalToRecycleBin, write=FDeleteLocalToRecycleBin };
  146. __property bool DeleteRemoteToRecycleBin = { read=FDeleteRemoteToRecycleBin, write=FDeleteRemoteToRecycleBin };
  147. __property bool ReadOnly = { read=FReadOnly, write=SetReadOnly };
  148. __property TSynchronizeProgress * SynchronizeProgress = { read = FSynchronizeProgress };
  149. };
  150. //----------------------------------------------------------------------------
  151. #endif