source: src/UIElements/Views/Qt4/QtStatusBar.hpp@ 9a1e099

Action_Thermostats Adding_MD_integration_tests Adding_StructOpt_integration_tests AutomationFragmentation_failures Candidate_v1.6.1 ChemicalSpaceEvaluator Enhanced_StructuralOptimization Enhanced_StructuralOptimization_continued Exclude_Hydrogens_annealWithBondGraph Fix_Verbose_Codepatterns ForceAnnealing_with_BondGraph ForceAnnealing_with_BondGraph_continued ForceAnnealing_with_BondGraph_continued_betteresults ForceAnnealing_with_BondGraph_contraction-expansion Gui_displays_atomic_force_velocity JobMarket_RobustOnKillsSegFaults JobMarket_StableWorkerPool PythonUI_with_named_parameters Recreated_GuiChecks StoppableMakroAction TremoloParser_IncreasedPrecision
Last change on this file since 9a1e099 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
Line 
1/*
2 * QtStatusBar.hpp
3 *
4 * Created on: Feb 17, 2010
5 * Author: crueger
6 */
7
8#ifndef QTSTATUSBAR_HPP_
9#define QTSTATUSBAR_HPP_
10
11// include config.h
12#ifdef HAVE_CONFIG_H
13#include <config.h>
14#endif
15
16
17#include <map>
18#include <utility>
19#include <string>
20#include <QtGui/QStatusBar>
21
22#include <boost/thread/recursive_mutex.hpp>
23
24#include "CodePatterns/Observer/Observer.hpp"
25
26class QBoxLayout;
27class QLabel;
28class QProgressBar;
29class QTimer;
30
31namespace MoleCuilder {
32 class ActionStatusList;
33 class Process;
34}
35
36class QtStatusBar : public QStatusBar, public Observer
37{
38 Q_OBJECT
39
40 struct progressIndicator{
41 progressIndicator(const std::string &name);
42 ~progressIndicator();
43 QLabel *label;
44 QProgressBar *bar;
45 QBoxLayout *layout;
46 QWidget *container;
47 };
48public:
49 QtStatusBar(QWidget *parent=0);
50 virtual ~QtStatusBar();
51
52 void update(Observable *subject);
53 void subjectKilled(Observable *subject);
54 void recieveNotification(Observable *_publisher, Notification *_notification);
55 virtual void paintEvent(QPaintEvent * event);
56
57private slots:
58 void updateProgressBar(
59 const std::string name,
60 const unsigned int maxsteps,
61 const unsigned int currentstep,
62 const bool StopStatus);
63 void updateStatusMessage();
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
72private:
73 void redrawStatus();
74
75 void startTimer();
76 void stopTimer();
77
78 int atomCount;
79 int moleculeCount;
80
81 QLabel *statusLabel;
82 QWidget *parent;
83 typedef std::map<std::string,progressIndicator*> progressBars_t;
84 progressBars_t progressBars;
85 std::string activeProcess;
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;
94
95 mutable boost::recursive_mutex refill_mutex;
96};
97
98#endif /* QTSTATUSBAR_HPP_ */
Note: See TracBrowser for help on using the repository browser.