--- a/src/mainWindow.h Wed Jun 04 02:08:18 2014 +0300 +++ b/src/mainWindow.h Thu Jun 05 23:18:13 2014 +0300 @@ -68,9 +68,9 @@ static LDQuickColor getSeparator(); }; -//! -//! Object list class for MainWindow -//! +// +// Object list class for MainWindow +// class ObjectList : public QListWidget { Q_OBJECT @@ -79,242 +79,233 @@ void contextMenuEvent (QContextMenuEvent* ev); }; -//! -//! \brief The main window class. -//! -//! The MainWindow is LDForge's main GUI. It hosts the renderer, the object list, -//! the message log, etc. Contains \c slot_action(), which is what all actions -//! connect to. -//! +// +// LDForge's main GUI class. +// class MainWindow : public QMainWindow { - Q_OBJECT - - public: - //! Constructs the main window - explicit MainWindow (QWidget* parent = null, Qt::WindowFlags flags = 0); +Q_OBJECT - //! Rebuilds the object list, located to the right of the GUI. - void buildObjList(); +public: + explicit MainWindow (QWidget* parent = null, Qt::WindowFlags flags = 0); - //! Updates the window title. - void updateTitle(); + // Rebuilds the object list. + void buildObjList(); - //! Builds the object list and tells the GL renderer to init a full - //! refresh. - void doFullRefresh(); + // Updates the window title. + void updateTitle(); - //! Builds the object list and tells the GL renderer to do a soft update. - void refresh(); + // Builds the object list and tells the GL renderer to init a full + // refresh. + void doFullRefresh(); - //! \returns the suggested position to place a new object at. - int getInsertionPoint(); + // Builds the object list and tells the GL renderer to do a soft update. + void refresh(); - //! Updates the quick color toolbar - void updateColorToolbar(); + // Returns the suggested position to place a new object at. + int getInsertionPoint(); - //! Rebuilds the recent files submenu - void updateRecentFilesMenu(); + // Updates the quick color toolbar + void updateColorToolbar(); - //! Sets the selection based on what's selected in the object list. - void updateSelection(); + // Rebuilds the recent files submenu + void updateRecentFilesMenu(); - //! Updates the grids, selects the selected grid and deselects others. - void updateGridToolBar(); + // Sets the selection based on what's selected in the object list. + void updateSelection(); - //! Updates the edit modes, current one is selected and others are deselected. - void updateEditModeActions(); + // Updates the grids, selects the selected grid and deselects others. + void updateGridToolBar(); - //! Rebuilds the document tab list. - void updateDocumentList(); + // Updates the edit modes, current one is selected and others are deselected. + void updateEditModeActions(); - //! Updates the document tab for \c doc. If no such tab exists, the - //! document list is rebuilt instead. - void updateDocumentListItem (LDDocumentPtr doc); + // Rebuilds the document tab list. + void updateDocumentList(); - //! \returns the uniform selected color (i.e. 4 if everything selected is - //! red), -1 if there is no such consensus. - int getSelectedColor(); + // Updates the document tab for \c doc. If no such tab exists, the + // document list is rebuilt instead. + void updateDocumentListItem (LDDocumentPtr doc); - //! Automatically scrolls the object list so that it points to the first - //! selected object. - void scrollToSelection(); + // Returns the uniform selected color (i.e. 4 if everything selected is + // red), -1 if there is no such consensus. + int getSelectedColor(); - //! Spawns the context menu at the given position. - void spawnContextMenu (const QPoint pos); + // Automatically scrolls the object list so that it points to the first + // selected object. + void scrollToSelection(); - //! Deletes all selected objects. - //! \returns the count of deleted objects. - int deleteSelection(); + // Spawns the context menu at the given position. + void spawnContextMenu (const QPoint pos); - //! Deletes all objects by the given color number. - void deleteByColor (int colnum); + // Deletes all selected objects, returns the count of deleted objects. + int deleteSelection(); + + // Deletes all objects by the given color number. + void deleteByColor (int colnum); - //! Tries to save the given document. - //! \param doc the document to save - //! \param saveAs if true, always ask for a file path - //! \returns whether the save was successful - bool save (LDDocumentPtr doc, bool saveAs); + // Tries to save the given document. + bool save (LDDocumentPtr doc, bool saveAs); - //! Updates various actions, undo/redo are set enabled/disabled where - //! appropriate, togglable actions are updated based on configuration, - //! etc. - void updateActions(); + // Updates various actions, undo/redo are set enabled/disabled where + // appropriate, togglable actions are updated based on configuration, + // etc. + void updateActions(); - //! \returns a pointer to the renderer - inline GLRenderer* R() - { - return m_renderer; - } + // Returns a pointer to the renderer + inline GLRenderer* R() + { + return m_renderer; + } - //! Sets the quick color list to the given list of colors. - inline void setQuickColors (const QList<LDQuickColor>& colors) - { - m_quickColors = colors; - updateColorToolbar(); - } + // Sets the quick color list to the given list of colors. + inline void setQuickColors (const QList<LDQuickColor>& colors) + { + m_quickColors = colors; + updateColorToolbar(); + } - //! Adds a message to the renderer's message manager. - void addMessage (QString msg); + // Adds a message to the renderer's message manager. + void addMessage (QString msg); - //! Updates the object list. Right now this just rebuilds it. - void refreshObjectList(); + // Updates the object list. Right now this just rebuilds it. + void refreshObjectList(); - //! Updates all actions to ensure they have the correct shortcut as - //! defined in the configuration entries. - void updateActionShortcuts(); + // Updates all actions to ensure they have the correct shortcut as + // defined in the configuration entries. + void updateActionShortcuts(); - //! Gets the shortcut configuration for the given \c action - KeySequenceConfigEntry* shortcutForAction (QAction* action); + // Gets the shortcut configuration for the given \c action + KeySequenceConfigEntry* shortcutForAction (QAction* action); - void endAction(); + void endAction(); - inline QTreeWidget* getPrimitivesTree() const - { - return ui->primitives; - } + inline QTreeWidget* getPrimitivesTree() const + { + return ui->primitives; + } - public slots: - void updatePrimitives(); - void changeCurrentFile(); - void slot_action(); - void slot_actionNew(); - void slot_actionNewFile(); - void slot_actionOpen(); - void slot_actionDownloadFrom(); - void slot_actionSave(); - void slot_actionSaveAs(); - void slot_actionSaveAll(); - void slot_actionClose(); - void slot_actionCloseAll(); - void slot_actionInsertFrom(); - void slot_actionExportTo(); - void slot_actionSettings(); - void slot_actionSetLDrawPath(); - void slot_actionScanPrimitives(); - void slot_actionExit(); - void slot_actionResetView(); - void slot_actionAxes(); - void slot_actionWireframe(); - void slot_actionBFCView(); - void slot_actionSetOverlay(); - void slot_actionClearOverlay(); - void slot_actionScreenshot(); - void slot_actionInsertRaw(); - void slot_actionNewSubfile(); - void slot_actionNewLine(); - void slot_actionNewTriangle(); - void slot_actionNewQuad(); - void slot_actionNewCLine(); - void slot_actionNewComment(); - void slot_actionNewBFC(); - void slot_actionNewVertex(); - void slot_actionUndo(); - void slot_actionRedo(); - void slot_actionCut(); - void slot_actionCopy(); - void slot_actionPaste(); - void slot_actionDelete(); - void slot_actionSelectAll(); - void slot_actionSelectByColor(); - void slot_actionSelectByType(); - void slot_actionModeDraw(); - void slot_actionModeSelect(); - void slot_actionModeCircle(); - void slot_actionSetDrawDepth(); - void slot_actionSetColor(); - void slot_actionAutocolor(); - void slot_actionUncolor(); - void slot_actionInline(); - void slot_actionInlineDeep(); - void slot_actionInvert(); - void slot_actionMakePrimitive(); - void slot_actionSplitQuads(); - void slot_actionEditRaw(); - void slot_actionBorders(); - void slot_actionCornerVerts(); - void slot_actionRoundCoordinates(); - void slot_actionVisibilityHide(); - void slot_actionVisibilityReveal(); - void slot_actionVisibilityToggle(); - void slot_actionReplaceCoords(); - void slot_actionFlip(); - void slot_actionDemote(); - void slot_actionYtruder(); - void slot_actionRectifier(); - void slot_actionIntersector(); - void slot_actionIsecalc(); - void slot_actionCoverer(); - void slot_actionEdger2(); - void slot_actionHelp(); - void slot_actionAbout(); - void slot_actionAboutQt(); - void slot_actionGridCoarse(); - void slot_actionGridMedium(); - void slot_actionGridFine(); - void slot_actionEdit(); - void slot_actionMoveUp(); - void slot_actionMoveDown(); - void slot_actionMoveXNeg(); - void slot_actionMoveXPos(); - void slot_actionMoveYNeg(); - void slot_actionMoveYPos(); - void slot_actionMoveZNeg(); - void slot_actionMoveZPos(); - void slot_actionRotateXNeg(); - void slot_actionRotateXPos(); - void slot_actionRotateYNeg(); - void slot_actionRotateYPos(); - void slot_actionRotateZNeg(); - void slot_actionRotateZPos(); - void slot_actionRotationPoint(); - void slot_actionAddHistoryLine(); - void slot_actionJumpTo(); - void slot_actionSubfileSelection(); - void slot_actionDrawAngles(); - void slot_actionRandomColors(); - void slot_actionOpenSubfiles(); +public slots: + void updatePrimitives(); + void changeCurrentFile(); + void slot_action(); + void slot_actionNew(); + void slot_actionNewFile(); + void slot_actionOpen(); + void slot_actionDownloadFrom(); + void slot_actionSave(); + void slot_actionSaveAs(); + void slot_actionSaveAll(); + void slot_actionClose(); + void slot_actionCloseAll(); + void slot_actionInsertFrom(); + void slot_actionExportTo(); + void slot_actionSettings(); + void slot_actionSetLDrawPath(); + void slot_actionScanPrimitives(); + void slot_actionExit(); + void slot_actionResetView(); + void slot_actionAxes(); + void slot_actionWireframe(); + void slot_actionBFCView(); + void slot_actionSetOverlay(); + void slot_actionClearOverlay(); + void slot_actionScreenshot(); + void slot_actionInsertRaw(); + void slot_actionNewSubfile(); + void slot_actionNewLine(); + void slot_actionNewTriangle(); + void slot_actionNewQuad(); + void slot_actionNewCLine(); + void slot_actionNewComment(); + void slot_actionNewBFC(); + void slot_actionNewVertex(); + void slot_actionUndo(); + void slot_actionRedo(); + void slot_actionCut(); + void slot_actionCopy(); + void slot_actionPaste(); + void slot_actionDelete(); + void slot_actionSelectAll(); + void slot_actionSelectByColor(); + void slot_actionSelectByType(); + void slot_actionModeDraw(); + void slot_actionModeSelect(); + void slot_actionModeCircle(); + void slot_actionSetDrawDepth(); + void slot_actionSetColor(); + void slot_actionAutocolor(); + void slot_actionUncolor(); + void slot_actionInline(); + void slot_actionInlineDeep(); + void slot_actionInvert(); + void slot_actionMakePrimitive(); + void slot_actionSplitQuads(); + void slot_actionEditRaw(); + void slot_actionBorders(); + void slot_actionCornerVerts(); + void slot_actionRoundCoordinates(); + void slot_actionVisibilityHide(); + void slot_actionVisibilityReveal(); + void slot_actionVisibilityToggle(); + void slot_actionReplaceCoords(); + void slot_actionFlip(); + void slot_actionDemote(); + void slot_actionYtruder(); + void slot_actionRectifier(); + void slot_actionIntersector(); + void slot_actionIsecalc(); + void slot_actionCoverer(); + void slot_actionEdger2(); + void slot_actionHelp(); + void slot_actionAbout(); + void slot_actionAboutQt(); + void slot_actionGridCoarse(); + void slot_actionGridMedium(); + void slot_actionGridFine(); + void slot_actionEdit(); + void slot_actionMoveUp(); + void slot_actionMoveDown(); + void slot_actionMoveXNeg(); + void slot_actionMoveXPos(); + void slot_actionMoveYNeg(); + void slot_actionMoveYPos(); + void slot_actionMoveZNeg(); + void slot_actionMoveZPos(); + void slot_actionRotateXNeg(); + void slot_actionRotateXPos(); + void slot_actionRotateYNeg(); + void slot_actionRotateYPos(); + void slot_actionRotateZNeg(); + void slot_actionRotateZPos(); + void slot_actionRotationPoint(); + void slot_actionAddHistoryLine(); + void slot_actionJumpTo(); + void slot_actionSubfileSelection(); + void slot_actionDrawAngles(); + void slot_actionRandomColors(); + void slot_actionOpenSubfiles(); - protected: - void closeEvent (QCloseEvent* ev); +protected: + void closeEvent (QCloseEvent* ev); - private: - GLRenderer* m_renderer; - LDObjectList m_sel; - QList<LDQuickColor> m_quickColors; - QList<QToolButton*> m_colorButtons; - QList<QAction*> m_recentFiles; - MessageManager* m_msglog; - Ui_LDForgeUI* ui; - QTabBar* m_tabs; - bool m_updatingTabs; +private: + GLRenderer* m_renderer; + LDObjectList m_sel; + QList<LDQuickColor> m_quickColors; + QList<QToolButton*> m_colorButtons; + QList<QAction*> m_recentFiles; + MessageManager* m_msglog; + Ui_LDForgeUI* ui; + QTabBar* m_tabs; + bool m_updatingTabs; - private slots: - void slot_selectionChanged(); - void slot_recentFile(); - void slot_quickColor(); - void slot_lastSecondCleanup(); - void slot_editObject (QListWidgetItem* listitem); +private slots: + void slot_selectionChanged(); + void slot_recentFile(); + void slot_quickColor(); + void slot_lastSecondCleanup(); + void slot_editObject (QListWidgetItem* listitem); }; //! Pointer to the instance of MainWindow.