source: projectionDesigner/trunk/projdesigner/include/GUIControler.h @ 162

Last change on this file since 162 was 4, checked in by Torben Dannhauer, 15 years ago
File size: 5.3 KB
Line 
1#ifndef _GUICONTROLER_H_
2#define _GUICONTROLER_H_
3
4#include <QList>
5#include <QtXml>
6#include <QKeyEvent>
7
8namespace projection
9{
10class ProjectionModel;
11class Channel;
12class QDesignViewWindow;
13class QDesignViewWidget;
14class QClientWindow;
15class QProjectorWindow;
16class QSceneViewerWindow;
17class QPreferenceDialog;
18class QCalibrationDialog;
19
20/**
21 * GUI control class.
22 */
23class GUIControler
24{
25public:
26
27    /**
28     * Constructor.
29     *
30     * @param pModel Projection model.
31     */
32    GUIControler(ProjectionModel* pModel);
33
34    /**
35     * Destructor.
36     */
37    virtual ~GUIControler();
38
39    /**
40     * Initialize GUIs.
41     *
42     * @param bServer True if this program is a server, false if it is a client.
43     */
44    void init(bool bServer);
45
46    /**
47     * Load projection settings from a file.
48     *
49     * @param fileName File name to load.
50     * @return True if successfully loaded.
51     */
52    bool loadFile(const QString& fileName);
53
54    /**
55     * Save the current projection settings to a file.
56     *
57     * @param fileName File name to save.
58     * @return True if successfully saved.
59     */
60    bool saveFile(const QString& fileName);
61
62    /**
63     * Retrieve main window.
64     *
65     * @return DesignViewWindow in server, ClientWindow in Client.
66     */
67    QWidget* getMainWindow();
68
69    /**
70     * Retrieve QGLWidget for sharing OpenGL context.
71     *
72     * @return QGLWidget for sharing OpenGL context.
73     */
74    QGLWidget* getGLWidget();
75
76    /**
77     * Retrieve DesignView widget.
78     *
79     * @return DesignView widget.
80     */
81    QDesignViewWidget* getDesignView();
82
83    /**
84     * Select a channel.
85     *
86     * @param pChannel Channel object to select.
87     */
88    void selectChannel(Channel* pChannel);
89
90    /**
91     * Remove the specified channel.
92     *
93     * @param pChannel Channel object to remove.
94     */
95    void removeChannel(Channel* pChannel);
96
97    /**
98     * Process key event for channel.
99     *
100     * @param pChannel Channel to process key event.
101     * @param pEvent Key event.
102     */
103    void processChannelKeyEvent(Channel* pChannel, QKeyEvent* pEvent);
104
105    /**
106     * Update the channel list in GUI.
107     */
108    void updateChannelsGUI();
109
110    /**
111     * Update the name of channels in GUI.
112     */
113    void updateChannelNamesGUI();
114
115    /**
116     * Update the channel in GUI.
117     */
118    void updateChannelGUI();
119
120    /**
121     * Update GUI.
122     */
123    void updateGUI();
124
125    /**
126     * Redraw SceneViewer.
127     */
128    void updateSceneViewer();
129
130    /**
131     * Put the camera at the center of the scene.
132     */
133    void sceneCenterView();
134
135    /**
136     * Set camera to view all the scene.
137     */
138    void sceneViewAll();
139
140    /**
141     * Redraw DesignViewWindow and ProjectorWindows.
142     */
143    void updateViews();
144
145    /**
146     * Set scene size for SceneViewer.
147     *
148     * @param radius Radius of the scene.
149     */
150    void setSceneSize(float radius);
151
152    /**
153     * Create (if not exist) and show a ProjectorWindow for the specified channel.
154     *
155     * @param pChannel Channel object for the ProjectorWindow.
156     */
157    void showProjectorWindow(Channel* pChannel);
158
159    /**
160     * Create (if not exist) and show a SceneViewerWindow.
161     */
162    void showSceneViewerWindow();
163
164    /**
165     * Create (if not exist) and show a PreferenceDialog.
166     */
167    void showPreferenceDialog();
168
169    /**
170     * Create (if not exist) and show a CalibrationWindow for the specified channel.
171     *
172     * @param pChannel Channel object for the CalibrationWindow.
173     */
174    void showCalibrationDialog(Channel* pChannel);
175
176    /**
177     * Show an instant message in status bar of the DesignViewWindow.
178     *
179     * @param message Message to show.
180     * @param timeout Time out interval to disappear in micro seconds.
181     */
182    void showStatusBarMessage(const QString& message, int timeout=0);
183
184    /**
185     * Append log to Client Window.
186     *
187     * @param log Log text.
188     */
189    void appendClientLog(const QString& log);
190
191    /**
192     * Close all windows to quit the application.
193     */
194    void closeAllWindows();
195
196    /**
197     * Restore settings of the DesignView and the SceneViewer.
198     *
199     * @param Parent XML element of the DesignView and the SceneViewer settings.
200     */
201    bool initFromDOMElement(const QDomElement& element);
202
203    /**
204     * Store the current DesignView and SceneViewer as XML data.
205     *
206     * @param name XML node name of the data.
207     * @param doc XML document to store the data.
208     * @return Current DesignView and SceneViewersettings as XML data.
209     */
210    QDomElement domElement(const QString& name, QDomDocument& doc);
211
212protected:
213
214    QDesignViewWindow* m_pDesignViewWindow;         //!< DesignViewWindow.
215    QClientWindow* m_pClientWindow;                 //!< ClientWindow.
216    QList<QProjectorWindow*> m_pProjectorWindows;   //!< ProjectorWindows.
217    QSceneViewerWindow* m_pSceneViewerWindow;       //!< SceneViewerWindow.
218    QPreferenceDialog* m_pPreferenceDialog;         //!< PreferenceDialog.
219
220    QDomElement m_sceneViewerSettings;              //!< SceneViewer settings.
221
222    ProjectionModel* m_pModel;                      //!< Projection Model.
223};
224
225}; // projection
226
227#endif // _GUICONTROLER_H_
Note: See TracBrowser for help on using the repository browser.