#ifndef _GUICONTROLER_H_ #define _GUICONTROLER_H_ #include #include #include namespace projection { class ProjectionModel; class Channel; class QDesignViewWindow; class QDesignViewWidget; class QClientWindow; class QProjectorWindow; class QSceneViewerWindow; class QPreferenceDialog; class QCalibrationDialog; /** * GUI control class. */ class GUIControler { public: /** * Constructor. * * @param pModel Projection model. */ GUIControler(ProjectionModel* pModel); /** * Destructor. */ virtual ~GUIControler(); /** * Initialize GUIs. * * @param bServer True if this program is a server, false if it is a client. */ void init(bool bServer); /** * Load projection settings from a file. * * @param fileName File name to load. * @return True if successfully loaded. */ bool loadFile(const QString& fileName); /** * Save the current projection settings to a file. * * @param fileName File name to save. * @return True if successfully saved. */ bool saveFile(const QString& fileName); /** * Retrieve main window. * * @return DesignViewWindow in server, ClientWindow in Client. */ QWidget* getMainWindow(); /** * Retrieve QGLWidget for sharing OpenGL context. * * @return QGLWidget for sharing OpenGL context. */ QGLWidget* getGLWidget(); /** * Retrieve DesignView widget. * * @return DesignView widget. */ QDesignViewWidget* getDesignView(); /** * Select a channel. * * @param pChannel Channel object to select. */ void selectChannel(Channel* pChannel); /** * Remove the specified channel. * * @param pChannel Channel object to remove. */ void removeChannel(Channel* pChannel); /** * Process key event for channel. * * @param pChannel Channel to process key event. * @param pEvent Key event. */ void processChannelKeyEvent(Channel* pChannel, QKeyEvent* pEvent); /** * Update the channel list in GUI. */ void updateChannelsGUI(); /** * Update the name of channels in GUI. */ void updateChannelNamesGUI(); /** * Update the channel in GUI. */ void updateChannelGUI(); /** * Update GUI. */ void updateGUI(); /** * Redraw SceneViewer. */ void updateSceneViewer(); /** * Put the camera at the center of the scene. */ void sceneCenterView(); /** * Set camera to view all the scene. */ void sceneViewAll(); /** * Redraw DesignViewWindow and ProjectorWindows. */ void updateViews(); /** * Set scene size for SceneViewer. * * @param radius Radius of the scene. */ void setSceneSize(float radius); /** * Create (if not exist) and show a ProjectorWindow for the specified channel. * * @param pChannel Channel object for the ProjectorWindow. */ void showProjectorWindow(Channel* pChannel); /** * Create (if not exist) and show a SceneViewerWindow. */ void showSceneViewerWindow(); /** * Create (if not exist) and show a PreferenceDialog. */ void showPreferenceDialog(); /** * Create (if not exist) and show a CalibrationWindow for the specified channel. * * @param pChannel Channel object for the CalibrationWindow. */ void showCalibrationDialog(Channel* pChannel); /** * Show an instant message in status bar of the DesignViewWindow. * * @param message Message to show. * @param timeout Time out interval to disappear in micro seconds. */ void showStatusBarMessage(const QString& message, int timeout=0); /** * Append log to Client Window. * * @param log Log text. */ void appendClientLog(const QString& log); /** * Close all windows to quit the application. */ void closeAllWindows(); /** * Restore settings of the DesignView and the SceneViewer. * * @param Parent XML element of the DesignView and the SceneViewer settings. */ bool initFromDOMElement(const QDomElement& element); /** * Store the current DesignView and SceneViewer as XML data. * * @param name XML node name of the data. * @param doc XML document to store the data. * @return Current DesignView and SceneViewersettings as XML data. */ QDomElement domElement(const QString& name, QDomDocument& doc); protected: QDesignViewWindow* m_pDesignViewWindow; //!< DesignViewWindow. QClientWindow* m_pClientWindow; //!< ClientWindow. QList m_pProjectorWindows; //!< ProjectorWindows. QSceneViewerWindow* m_pSceneViewerWindow; //!< SceneViewerWindow. QPreferenceDialog* m_pPreferenceDialog; //!< PreferenceDialog. QDomElement m_sceneViewerSettings; //!< SceneViewer settings. ProjectionModel* m_pModel; //!< Projection Model. }; }; // projection #endif // _GUICONTROLER_H_