Loading isis/src/qisis/objs/CnetEditorView/CnetEditorView.cpp +79 −30 Original line number Diff line number Diff line Loading @@ -47,8 +47,13 @@ #include "FileName.h" #include "Project.h" #include "ToolPad.h" #include "ToolList.h" #include "XmlStackedHandlerReader.h" #include "HelpTool.h" #include "TrackTool.h" namespace Isis { /** Loading Loading @@ -83,38 +88,10 @@ namespace Isis { filterViews->addTab( m_cnetEditorWidget->connectionFilterWidget(), tr("Filter Connections") ); resultLayout->addWidget(filterViews, 1, 1, 1, 1); m_permToolBar = new QToolBar("Standard Tools", 0); m_permToolBar->setObjectName("permToolBar"); m_permToolBar->setIconSize(QSize(22, 22)); //toolBarLayout->addWidget(m_permToolBar); m_activeToolBar = new QToolBar("Active Tool", 0); m_activeToolBar->setObjectName("activeToolBar"); m_activeToolBar->setIconSize(QSize(22, 22)); //toolBarLayout->addWidget(m_activeToolBar); m_toolPad = new ToolPad("Tool Pad", 0); m_toolPad->setObjectName("toolPad"); //toolBarLayout->addWidget(m_toolPad); // m_cnetEditorWidget->addToPermanent(m_permToolBar); // m_cnetEditorWidget->addTo(m_activeToolBar); // m_cnetEditorWidget->addTo(m_toolPad); m_activeToolBarAction = new QWidgetAction(this); m_activeToolBarAction->setDefaultWidget(m_activeToolBar); setAcceptDrops(true); QSizePolicy policy = sizePolicy(); policy.setHorizontalPolicy(QSizePolicy::Expanding); policy.setVerticalPolicy(QSizePolicy::Expanding); setSizePolicy(policy); createMenus(); createToolBars(); } /** * Destructor */ Loading @@ -130,6 +107,78 @@ namespace Isis { m_toolPad = 0; } /** * Uses the actions created by CnetEditorWidget, tries to find the menus to put * the actions under, and creates the menus if said menus do not exist. Currently, * the menus added are Table and Help. */ void CnetEditorView::createMenus() { QMap< QAction *, QList< QString > > actionMap = m_cnetEditorWidget->menuActions(); QMapIterator< QAction *, QList< QString > > actionMapIterator(actionMap); QMap<QString, QMenu *> topLevelMenus; while ( actionMapIterator.hasNext() ) { actionMapIterator.next(); QAction *actionToAdd = actionMapIterator.key(); QList< QString > location = actionMapIterator.value(); QMenu *menuToPutActionInto = NULL; if ( location.count() ) { QString topLevelMenuTitle = location.takeFirst(); if (!topLevelMenus[topLevelMenuTitle]) { topLevelMenus[topLevelMenuTitle] = menuBar()->addMenu(topLevelMenuTitle); } menuToPutActionInto = topLevelMenus[topLevelMenuTitle]; } foreach (QString menuName, location) { bool foundSubMenu = false; foreach ( QAction *possibleSubMenu, menuToPutActionInto->actions() ) { if (!foundSubMenu && possibleSubMenu->menu() && possibleSubMenu->menu()->title() == menuName) { foundSubMenu = true; menuToPutActionInto = possibleSubMenu->menu(); } } if (!foundSubMenu) { menuToPutActionInto = menuToPutActionInto->addMenu(menuName); } } menuToPutActionInto->addAction(actionToAdd); } } /** * Uses and adds the actions created by CnetEditorWidget to the view's toolbars * Right now, all actions created in CnetEditorWidget are added to the toolpad. * This was copied from CnetEditorWindow */ void CnetEditorView::createToolBars() { // m_permToolBar = addToolBar("Standard Tools"); // m_permToolBar->setObjectName("permToolBar"); // m_permToolBar->setIconSize(QSize(22, 22)); m_toolPad = new ToolPad("Tool Pad", 0); m_toolPad->setObjectName("toolPad"); addToolBar(m_toolPad); QMap< QString, QList< QAction * > > toolActionMap; toolActionMap = m_cnetEditorWidget->toolBarActions(); QMapIterator< QString, QList< QAction * > > toolActionIter(toolActionMap); while (toolActionIter.hasNext()) { toolActionIter.next(); QString objName = toolActionIter.key(); QList< QAction * > actionList = toolActionIter.value(); foreach (QAction *action, actionList) { m_toolPad->addAction(action); } } } /** * Returns the cnetEditorWidget. Loading isis/src/qisis/objs/CnetEditorView/CnetEditorView.h +12 −5 Original line number Diff line number Diff line Loading @@ -51,11 +51,13 @@ namespace Isis { * @author 2018-04-04 Tracie Sucharski * * @internal * @history 2018-06-1 Kaitlyn Lee - Because AbstractProjectItemView now inherits * from QMainWindow, I added a dummy central widget * and set its layout to the grid layout. We used to set * the whole CnetEditorView widget's layout, now we only * @history 2018-06-01 Kaitlyn Lee - Because AbstractProjectItemView now inherits from QMainWindow, * I added a dummy central widget and set its layout to the grid layout. * We used to set the whole CnetEditorView widget's layout, now we only * set the central widget's layout. * @history 2018-06-05 Kaitlyn Lee - Added createMenus() and createToolBars(). The body of createMenus() * was moved from the constructor. createToolBars() was copied and edited * from CnetEditorWindow. */ class CnetEditorView : public AbstractProjectItemView { Loading @@ -79,6 +81,9 @@ class CnetEditorView : public AbstractProjectItemView { void load(XmlStackedHandlerReader *xmlReader); void save(QXmlStreamWriter &stream, Project *project, FileName newProjectRoot) const; private: void createToolBars(); void createMenus(); private: /** Loading Loading @@ -111,7 +116,9 @@ class CnetEditorView : public AbstractProjectItemView { QToolBar *m_activeToolBar; //!< The active tool bar ToolPad *m_toolPad; //!< The tool pad QList<QAction *> m_permToolBarActions; //!< The permanent tool bar actions QWidgetAction *m_activeToolBarAction; //!< Stores the active tool bar QList<QAction *> m_toolPadActions; //!< The tool pad actions }; } Loading Loading
isis/src/qisis/objs/CnetEditorView/CnetEditorView.cpp +79 −30 Original line number Diff line number Diff line Loading @@ -47,8 +47,13 @@ #include "FileName.h" #include "Project.h" #include "ToolPad.h" #include "ToolList.h" #include "XmlStackedHandlerReader.h" #include "HelpTool.h" #include "TrackTool.h" namespace Isis { /** Loading Loading @@ -83,38 +88,10 @@ namespace Isis { filterViews->addTab( m_cnetEditorWidget->connectionFilterWidget(), tr("Filter Connections") ); resultLayout->addWidget(filterViews, 1, 1, 1, 1); m_permToolBar = new QToolBar("Standard Tools", 0); m_permToolBar->setObjectName("permToolBar"); m_permToolBar->setIconSize(QSize(22, 22)); //toolBarLayout->addWidget(m_permToolBar); m_activeToolBar = new QToolBar("Active Tool", 0); m_activeToolBar->setObjectName("activeToolBar"); m_activeToolBar->setIconSize(QSize(22, 22)); //toolBarLayout->addWidget(m_activeToolBar); m_toolPad = new ToolPad("Tool Pad", 0); m_toolPad->setObjectName("toolPad"); //toolBarLayout->addWidget(m_toolPad); // m_cnetEditorWidget->addToPermanent(m_permToolBar); // m_cnetEditorWidget->addTo(m_activeToolBar); // m_cnetEditorWidget->addTo(m_toolPad); m_activeToolBarAction = new QWidgetAction(this); m_activeToolBarAction->setDefaultWidget(m_activeToolBar); setAcceptDrops(true); QSizePolicy policy = sizePolicy(); policy.setHorizontalPolicy(QSizePolicy::Expanding); policy.setVerticalPolicy(QSizePolicy::Expanding); setSizePolicy(policy); createMenus(); createToolBars(); } /** * Destructor */ Loading @@ -130,6 +107,78 @@ namespace Isis { m_toolPad = 0; } /** * Uses the actions created by CnetEditorWidget, tries to find the menus to put * the actions under, and creates the menus if said menus do not exist. Currently, * the menus added are Table and Help. */ void CnetEditorView::createMenus() { QMap< QAction *, QList< QString > > actionMap = m_cnetEditorWidget->menuActions(); QMapIterator< QAction *, QList< QString > > actionMapIterator(actionMap); QMap<QString, QMenu *> topLevelMenus; while ( actionMapIterator.hasNext() ) { actionMapIterator.next(); QAction *actionToAdd = actionMapIterator.key(); QList< QString > location = actionMapIterator.value(); QMenu *menuToPutActionInto = NULL; if ( location.count() ) { QString topLevelMenuTitle = location.takeFirst(); if (!topLevelMenus[topLevelMenuTitle]) { topLevelMenus[topLevelMenuTitle] = menuBar()->addMenu(topLevelMenuTitle); } menuToPutActionInto = topLevelMenus[topLevelMenuTitle]; } foreach (QString menuName, location) { bool foundSubMenu = false; foreach ( QAction *possibleSubMenu, menuToPutActionInto->actions() ) { if (!foundSubMenu && possibleSubMenu->menu() && possibleSubMenu->menu()->title() == menuName) { foundSubMenu = true; menuToPutActionInto = possibleSubMenu->menu(); } } if (!foundSubMenu) { menuToPutActionInto = menuToPutActionInto->addMenu(menuName); } } menuToPutActionInto->addAction(actionToAdd); } } /** * Uses and adds the actions created by CnetEditorWidget to the view's toolbars * Right now, all actions created in CnetEditorWidget are added to the toolpad. * This was copied from CnetEditorWindow */ void CnetEditorView::createToolBars() { // m_permToolBar = addToolBar("Standard Tools"); // m_permToolBar->setObjectName("permToolBar"); // m_permToolBar->setIconSize(QSize(22, 22)); m_toolPad = new ToolPad("Tool Pad", 0); m_toolPad->setObjectName("toolPad"); addToolBar(m_toolPad); QMap< QString, QList< QAction * > > toolActionMap; toolActionMap = m_cnetEditorWidget->toolBarActions(); QMapIterator< QString, QList< QAction * > > toolActionIter(toolActionMap); while (toolActionIter.hasNext()) { toolActionIter.next(); QString objName = toolActionIter.key(); QList< QAction * > actionList = toolActionIter.value(); foreach (QAction *action, actionList) { m_toolPad->addAction(action); } } } /** * Returns the cnetEditorWidget. Loading
isis/src/qisis/objs/CnetEditorView/CnetEditorView.h +12 −5 Original line number Diff line number Diff line Loading @@ -51,11 +51,13 @@ namespace Isis { * @author 2018-04-04 Tracie Sucharski * * @internal * @history 2018-06-1 Kaitlyn Lee - Because AbstractProjectItemView now inherits * from QMainWindow, I added a dummy central widget * and set its layout to the grid layout. We used to set * the whole CnetEditorView widget's layout, now we only * @history 2018-06-01 Kaitlyn Lee - Because AbstractProjectItemView now inherits from QMainWindow, * I added a dummy central widget and set its layout to the grid layout. * We used to set the whole CnetEditorView widget's layout, now we only * set the central widget's layout. * @history 2018-06-05 Kaitlyn Lee - Added createMenus() and createToolBars(). The body of createMenus() * was moved from the constructor. createToolBars() was copied and edited * from CnetEditorWindow. */ class CnetEditorView : public AbstractProjectItemView { Loading @@ -79,6 +81,9 @@ class CnetEditorView : public AbstractProjectItemView { void load(XmlStackedHandlerReader *xmlReader); void save(QXmlStreamWriter &stream, Project *project, FileName newProjectRoot) const; private: void createToolBars(); void createMenus(); private: /** Loading Loading @@ -111,7 +116,9 @@ class CnetEditorView : public AbstractProjectItemView { QToolBar *m_activeToolBar; //!< The active tool bar ToolPad *m_toolPad; //!< The tool pad QList<QAction *> m_permToolBarActions; //!< The permanent tool bar actions QWidgetAction *m_activeToolBarAction; //!< Stores the active tool bar QList<QAction *> m_toolPadActions; //!< The tool pad actions }; } Loading