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