1 | /**
|
---|
2 | *
|
---|
3 | * Distributed under the UTC Heudiascy Pacpus License, Version 1.0.
|
---|
4 | * Copyright (c) UTC Heudiasyc 2010 - 2013. All rights reserved.
|
---|
5 | *
|
---|
6 | * See the LICENSE file for more information or a copy at:
|
---|
7 | * http://www.hds.utc.fr/~kurdejma/LICENSE_1_0.txt
|
---|
8 | *
|
---|
9 | */
|
---|
10 |
|
---|
11 | #ifndef PACPUSMAINWINDOW_H
|
---|
12 | #define PACPUSMAINWINDOW_H
|
---|
13 |
|
---|
14 | #include <qcheckbox.h>
|
---|
15 | #include <qdialog.h>
|
---|
16 | #include <qtimer.h>
|
---|
17 |
|
---|
18 | #include <Pacpus/kernel/ComponentManager.h>
|
---|
19 | #include <Pacpus/kernel/XmlConfigFile.h>
|
---|
20 | #include "ui_pacpusmainwindow.h"
|
---|
21 |
|
---|
22 | class QGroupBox;
|
---|
23 | class QVBoxLayout;
|
---|
24 |
|
---|
25 | namespace pacpus {
|
---|
26 |
|
---|
27 | /// Overloaded class of the QCheckBox in order to get the text
|
---|
28 | /// of the button when it is clicked.
|
---|
29 | class ComponentCheckBox
|
---|
30 | : public QCheckBox
|
---|
31 | {
|
---|
32 | Q_OBJECT
|
---|
33 |
|
---|
34 | public:
|
---|
35 | /// @todo Documentation
|
---|
36 | ComponentCheckBox(const QString & text, QWidget * parent, const char * /*name*/ = 0 )
|
---|
37 | : QCheckBox(text, parent)
|
---|
38 | {
|
---|
39 | connect(this, SIGNAL(toggled(bool)),
|
---|
40 | SLOT(change(bool)));
|
---|
41 | }
|
---|
42 |
|
---|
43 | /// @todo Documentation
|
---|
44 | ~ComponentCheckBox()
|
---|
45 | {
|
---|
46 | }
|
---|
47 |
|
---|
48 | public Q_SLOTS:
|
---|
49 | /// @todo Documentation
|
---|
50 | void change(bool state)
|
---|
51 | {
|
---|
52 | if (state) {
|
---|
53 | Q_EMIT activate(text());
|
---|
54 | } else {
|
---|
55 | Q_EMIT deactivate(text());
|
---|
56 | }
|
---|
57 | }
|
---|
58 |
|
---|
59 | Q_SIGNALS:
|
---|
60 | /// @todo Documentation
|
---|
61 | void activate(QString);
|
---|
62 | /// @todo Documentation
|
---|
63 | void deactivate(QString);
|
---|
64 | };
|
---|
65 |
|
---|
66 | ////////////////////////////////////////////////////////////////////////////////
|
---|
67 | /// @todo Documentation
|
---|
68 | class PacpusMainWindow
|
---|
69 | : public QDialog
|
---|
70 | , public Ui::PacpusMainWindow
|
---|
71 | {
|
---|
72 | Q_OBJECT
|
---|
73 |
|
---|
74 | public:
|
---|
75 | /// Constructor
|
---|
76 | PacpusMainWindow(QWidget * parent = 0);
|
---|
77 | /// Destructor
|
---|
78 | ~PacpusMainWindow();
|
---|
79 |
|
---|
80 | public Q_SLOTS:
|
---|
81 | /// slot
|
---|
82 | /// Starts all the components and checks all the checkbox
|
---|
83 | void startAcquisition();
|
---|
84 | /// slot
|
---|
85 | /// called when a checkbox is checked
|
---|
86 | /// start the corresponding component
|
---|
87 | /// start the monitoring loop if not running
|
---|
88 | void startComponent(QString component);
|
---|
89 |
|
---|
90 | /// slot
|
---|
91 | /// Stops all the components and unchecks all the checkbox
|
---|
92 | void stopAcquisition();
|
---|
93 | /// slot
|
---|
94 | /// called when a checkbox is unchecked
|
---|
95 | /// stop the corresponding component
|
---|
96 | /// eventually stop the monitoring loop if any other component is active
|
---|
97 | void stopComponent(QString component);
|
---|
98 |
|
---|
99 | /// @todo Documentation
|
---|
100 | void monitoring();
|
---|
101 |
|
---|
102 | private:
|
---|
103 | ComponentManager * componentManager_;
|
---|
104 |
|
---|
105 | QVBoxLayout * layoutBox_;
|
---|
106 | QGroupBox * componentContainer_;
|
---|
107 | QButtonGroup * componentGroup_;
|
---|
108 |
|
---|
109 | QTimer monitoringTimer_;
|
---|
110 |
|
---|
111 | bool continue_;
|
---|
112 | unsigned short nbActiveComponent_;
|
---|
113 | };
|
---|
114 |
|
---|
115 | } // namespace pacpus
|
---|
116 |
|
---|
117 | #endif // PACPUSMAINWINDOW_H
|
---|