ProgressBarQt.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /**
  2. * @file ProgressBarQt.h
  3. * @brief Show a Progress-Bar with time estimation
  4. * @author Michael Koch
  5. * @date 25/03/2010
  6. */
  7. #ifndef ProgressBarQtINCLUDE
  8. #define ProgressBarQtINCLUDE
  9. #include <qprogressdialog.h>
  10. #include <qwidget.h>
  11. #include <qlayout.h>
  12. #include "core/image/ImageT.h"
  13. namespace OBJREC {
  14. /** @brief show a Progress-Bar with time estimation */
  15. class ProgressBarQt
  16. {
  17. protected:
  18. QGridLayout* layout;
  19. QWidget* dialogwindow;
  20. QProgressDialog* progressdialog;
  21. NICE::Image display;
  22. bool display_on;
  23. bool working;
  24. double start_time;
  25. double avg_time_step;
  26. double elapsed_time;
  27. double estimated_time;
  28. int step;
  29. int bar_width;
  30. int bar_height;
  31. int bar_top;
  32. int bar_borderx;
  33. int text_top;
  34. int text_height;
  35. std::string name;
  36. bool useGraphics;
  37. void timediff2str(char *text, double time);
  38. void displayTimeStat(int posy, char *text, double time);
  39. double getCurrentTime();
  40. bool graphicIsAvailable();
  41. public:
  42. /** constructor
  43. @param name name of the operation
  44. */
  45. ProgressBarQt ( const std::string & name, bool useGraphics = true );
  46. /** simple destructor */
  47. virtual ~ProgressBarQt();
  48. /** reset the progress bar and the corresponding
  49. name of the operation */
  50. void reset ( const std::string & name );
  51. /** show the progress bar */
  52. void show();
  53. /** hide the progress bar */
  54. void hide();
  55. void stop();
  56. /** update the progress bar
  57. @param count number of total steps of this operation
  58. */
  59. void update ( int count );
  60. };
  61. } // namespace
  62. #endif