source: src/UIElements/Views/Qt4/QtStatusBar.hpp@ 5a289c

ForceAnnealing_with_BondGraph_continued_betteresults
Last change on this file since 5a289c was 7516f6, checked in by Frederik Heber <frederik.heber@…>, 8 years ago

FIX: several Qt...Lists required mutex to control refill triggered by observable update.

  • Property mode set to 100644
File size: 2.1 KB
RevLine 
[b47bfc]1/*
[4cf323d]2 * QtStatusBar.hpp
[b47bfc]3 *
4 * Created on: Feb 17, 2010
5 * Author: crueger
6 */
7
8#ifndef QTSTATUSBAR_HPP_
9#define QTSTATUSBAR_HPP_
10
[56f73b]11// include config.h
12#ifdef HAVE_CONFIG_H
13#include <config.h>
14#endif
15
16
[b47bfc]17#include <map>
18#include <utility>
19#include <string>
20#include <QtGui/QStatusBar>
21
[7516f6]22#include <boost/thread/recursive_mutex.hpp>
23
[02ce36]24#include "CodePatterns/Observer/Observer.hpp"
[b47bfc]25
[378f2d5]26class QBoxLayout;
[b47bfc]27class QLabel;
28class QProgressBar;
[378f2d5]29class QTimer;
[b47bfc]30
[ce7fdc]31namespace MoleCuilder {
[378f2d5]32 class ActionStatusList;
[ce7fdc]33 class Process;
34}
35
[4cf323d]36class QtStatusBar : public QStatusBar, public Observer
[b47bfc]37{
38 Q_OBJECT
39
40 struct progressIndicator{
[426c84]41 progressIndicator(const std::string &name);
[b47bfc]42 ~progressIndicator();
43 QLabel *label;
44 QProgressBar *bar;
45 QBoxLayout *layout;
46 QWidget *container;
47 };
48public:
[4cf323d]49 QtStatusBar(QWidget *parent=0);
50 virtual ~QtStatusBar();
[b47bfc]51
52 void update(Observable *subject);
53 void subjectKilled(Observable *subject);
[378f2d5]54 void recieveNotification(Observable *_publisher, Notification *_notification);
[7516f6]55 virtual void paintEvent(QPaintEvent * event);
[b47bfc]56
[426c84]57private slots:
58 void updateProgressBar(
59 const std::string name,
60 const unsigned int maxsteps,
61 const unsigned int currentstep,
62 const bool StopStatus);
[378f2d5]63 void updateStatusMessage();
[426c84]64
65signals:
66 void redrawProgressBar(
67 const std::string name,
68 const unsigned int maxsteps,
69 const unsigned int currentstep,
70 const bool StopStatus);
71
[b47bfc]72private:
73 void redrawStatus();
74
[378f2d5]75 void startTimer();
76 void stopTimer();
77
[b47bfc]78 int atomCount;
79 int moleculeCount;
80
81 QLabel *statusLabel;
82 QWidget *parent;
[426c84]83 typedef std::map<std::string,progressIndicator*> progressBars_t;
84 progressBars_t progressBars;
85 std::string activeProcess;
[378f2d5]86 //!> reference to the StatusList we are signed on
87 MoleCuilder::ActionStatusList& StatusList;
88 //!> indicates whether we are currently signed on
89 bool StatusList_signedOn;
90 //!> QTimer instance that causes regular updates of status messages
91 QTimer *timer;
92 //!> time interval in milliseconds
93 const int timer_interval;
[7516f6]94
95 mutable boost::recursive_mutex refill_mutex;
[b47bfc]96};
97
98#endif /* QTSTATUSBAR_HPP_ */
Note: See TracBrowser for help on using the repository browser.