WaitProgress.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #pragma once
  9. ////////////////////////////////////////////////////////////////////////////
  10. // Description: CWaitProgress class adds information about lengthy process
  11. // Usage:
  12. //
  13. // CWaitProgress wait;
  14. // wait.SetText("Long");
  15. // wait.SetProgress(35); // 35 percent.
  16. //
  17. ////////////////////////////////////////////////////////////////////////////
  18. #ifndef CRYINCLUDE_EDITOR_WAITPROGRESS_H
  19. #define CRYINCLUDE_EDITOR_WAITPROGRESS_H
  20. class QProgressBar;
  21. #include <QString>
  22. class CWaitProgress
  23. {
  24. public:
  25. CWaitProgress(const QString& lpszText, bool bStart = true);
  26. ~CWaitProgress();
  27. void Start();
  28. void Stop();
  29. //! @return true to continue, false to abort lengthy operation.
  30. bool Step(int nPercentage = -1);
  31. void SetText(const QString& lpszText);
  32. protected:
  33. void CreateProgressControl();
  34. QString m_strText;
  35. bool m_bStarted;
  36. bool m_bIgnore;
  37. int m_percent;
  38. QProgressBar* m_progressBar;
  39. static bool m_bInProgressNow;
  40. };
  41. #endif // CRYINCLUDE_EDITOR_WAITPROGRESS_H