#ifndef MAINWINDOW_HH #define MAINWINDOW_HH #include #include "DiagramView.hh" class QActionGroup; class Selectable; namespace Ui { class MainWindow; } /** * @todo docs **/ class MainWindow : public QMainWindow { Q_OBJECT public: MainWindow(QWidget *parent = 0); ~MainWindow(); protected: void changeEvent(QEvent *e); /** * Event handler for close events. Saves the window size and position into settings. * * @param event not used. **/ void closeEvent (QCloseEvent * event); private slots: /** * Shows the given @p message in the status bar. * * @param message the message to show. * @param timeout optional timeout in ms or 0 for a permanent message. **/ void showMessage (const QString & message, int timeout); /** * Callback for when the user has clicked something in the toolbar of available shapes. Sets a new mode for the diagram view * so that it knows what to do when it's clicked. * * @param action the triggered action **/ void actionSelected (QAction * action); /** * Callback for when the diagram view has a new @p mode. Sets the select action to be active if the @p mode is back to * standard mode (nothing active). * * @param mode the new mode. **/ void modeChanged (DiagramView::OperationMode mode); /** * Callback for when the user has clicked something in the diagram. Updates the edit panel to show the editor for the current @p selectable. * If there is no suitable editor part then the panel is made empty. * * @param selectable the clicked shape or 0 for no shape. **/ void diagramShapeSelected (Selectable * selectable); /** * Callback for the @e New action. Asks the user for confirmation and then recreates the diagram, deleteing the old. **/ void newDiagram (); /** * Callback for the @e Open action. Asks the user for the file to open and loads it if valid. **/ void openDiagram (); /** * Callback for the @e Save action. If no filename has been set then calls saveDiagramAs() so get a filename. **/ void saveDiagram (); /** * Callback for the @e Save @e As action. Calls saveDiagram() to do the real saving. **/ void saveDiagramAs (); /** * Callback for the @e Validate action. Opens a validation dialog. **/ void validate (); /** * Callback for the @e Generate action. Opens a code generation dialog. **/ void generate (); /** * Callback for the @e About action. Opens an about dialog. **/ void about (); /** * Callback for the @e Help action. Opens a browser for the homepage. **/ void help (); private: /** * Set up the action in the object toolbar. Sets some internal properties for the actions. **/ void setupActions (); Ui::MainWindow *ui; //! the name of the current diagram file QString m_filename; //! a group for the state action in the toolbar QActionGroup * m_action_group; }; #endif // MAINWINDOW_HH