OpenWalnut  1.5.0dev
WQtDataModuleInput.h
1 //---------------------------------------------------------------------------
2 //
3 // Project: OpenWalnut ( http://www.openwalnut.org )
4 //
5 // Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
6 // For more information see http://www.openwalnut.org/copying
7 //
8 // This file is part of OpenWalnut.
9 //
10 // OpenWalnut is free software: you can redistribute it and/or modify
11 // it under the terms of the GNU Lesser General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // OpenWalnut is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public License
21 // along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
22 //
23 //---------------------------------------------------------------------------
24 
25 #ifndef WQTDATAMODULEINPUT_H
26 #define WQTDATAMODULEINPUT_H
27 
28 #include <boost/signals2/signal.hpp>
29 
30 #include <QWidget>
31 #include <QHBoxLayout>
32 #include <QToolButton>
33 
34 #include "WScaleLabel.h"
35 
36 #include "core/kernel/WDataModuleInput.h"
37 #include "core/kernel/WDataModule.h"
38 
39 /**
40  * Widget that handles WDataModuleInputs of WDtaModules. Right now it only handles WDataModuleInputFile.
41  * See #32 for details on how this will be changed.
42  */
43 class WQtDataModuleInput: public QWidget
44 {
45  Q_OBJECT
46 public:
47  /**
48  * Constructor.
49  *
50  * \param module the data module to handle
51  * \param parent the parent widget
52  */
53  WQtDataModuleInput( WDataModule::SPtr module, QWidget* parent = NULL );
54 
55  /**
56  * Destructor.
57  */
58  virtual ~WQtDataModuleInput();
59 
60 public slots:
61  /**
62  * Called when the user presses the change button
63  */
64  void onChange();
65 
66  /**
67  * Triggered for reload
68  */
69  void onReload();
70 
71  /**
72  * Clear the source
73  */
74  void onClear();
75 
76 protected:
77 private:
78  /**
79  * The input to manage
80  */
82 
83  /**
84  * Container for all
85  */
86  QWidget* m_container;
87 
88  /**
89  * This is the main widget containing the reload button, label and the change button it is nested in the container
90  */
91  QWidget* m_mainWidget;
92 
93  /**
94  * Layout
95  */
96  QHBoxLayout* m_mainLayout;
97 
98  /**
99  * Layout
100  */
101  QVBoxLayout* m_layout;
102 
103  /**
104  * The button to open the input dialog.
105  */
106  QToolButton* m_changeButton;
107 
108  /**
109  * The reload button
110  */
111  QToolButton* m_reloadButton;
112 
113  /**
114  * The clear button
115  */
116  QToolButton* m_clearButton;
117 
118  /**
119  * The label
120  */
122 
123  /**
124  * Stay informed about changes in the input
125  */
126  boost::signals2::connection m_inputChangeConnection;
127 
128  /**
129  * Called by the input change condition.
130  */
131  void onInputChange();
132 
133  /**
134  * Called by input change condition in GUI thread.
135  */
136  void onInputChangeGUI();
137 };
138 
139 #endif // WQTDATAMODULEINPUT_H
std::shared_ptr< WDataModule > SPtr
Convenience typedef for a std::shared_ptr< WDataModule >.
Definition: WDataModule.h:52
Widget that handles WDataModuleInputs of WDtaModules.
WQtDataModuleInput(WDataModule::SPtr module, QWidget *parent=NULL)
Constructor.
void onChange()
Called when the user presses the change button.
virtual ~WQtDataModuleInput()
Destructor.
QVBoxLayout * m_layout
Layout.
WScaleLabel * m_label
The label.
boost::signals2::connection m_inputChangeConnection
Stay informed about changes in the input.
void onInputChangeGUI()
Called by input change condition in GUI thread.
QToolButton * m_reloadButton
The reload button.
void onReload()
Triggered for reload.
QWidget * m_mainWidget
This is the main widget containing the reload button, label and the change button it is nested in the...
void onClear()
Clear the source.
QToolButton * m_changeButton
The button to open the input dialog.
QHBoxLayout * m_mainLayout
Layout.
WDataModule::SPtr m_module
The input to manage.
QWidget * m_container
Container for all.
void onInputChange()
Called by the input change condition.
QToolButton * m_clearButton
The clear button.
Special Label that can shrink and expand in a layout.
Definition: WScaleLabel.h:37