/* * QtStatusBar.hpp * * Created on: Feb 17, 2010 * Author: crueger */ #ifndef QTSTATUSBAR_HPP_ #define QTSTATUSBAR_HPP_ // include config.h #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include #include "CodePatterns/Observer/Observer.hpp" class QBoxLayout; class QLabel; class QProgressBar; class QTimer; namespace MoleCuilder { class ActionStatusList; class Process; } class QtStatusBar : public QStatusBar, public Observer { Q_OBJECT struct progressIndicator{ progressIndicator(const std::string &name); ~progressIndicator(); QLabel *label; QProgressBar *bar; QBoxLayout *layout; QWidget *container; }; public: QtStatusBar(QWidget *parent=0); virtual ~QtStatusBar(); void update(Observable *subject); void subjectKilled(Observable *subject); void recieveNotification(Observable *_publisher, Notification *_notification); private slots: void updateProgressBar( const std::string name, const unsigned int maxsteps, const unsigned int currentstep, const bool StopStatus); void updateStatusMessage(); signals: void redrawProgressBar( const std::string name, const unsigned int maxsteps, const unsigned int currentstep, const bool StopStatus); private: void redrawStatus(); void startTimer(); void stopTimer(); int atomCount; int moleculeCount; QLabel *statusLabel; QWidget *parent; typedef std::map progressBars_t; progressBars_t progressBars; std::string activeProcess; //!> reference to the StatusList we are signed on MoleCuilder::ActionStatusList& StatusList; //!> indicates whether we are currently signed on bool StatusList_signedOn; //!> QTimer instance that causes regular updates of status messages QTimer *timer; //!> time interval in milliseconds const int timer_interval; }; #endif /* QTSTATUSBAR_HPP_ */