Commit 79adb2fe authored by Kaitlyn Lee's avatar Kaitlyn Lee
Browse files

enableControlNetTool completely handles the control networl now.

parent 21e1e8c5
Loading
Loading
Loading
Loading
+11 −24
Original line number Diff line number Diff line
@@ -115,22 +115,12 @@ namespace Isis {
    connect(m_workspace, SIGNAL( cubeViewportAdded(MdiCubeViewport *) ),
            this, SLOT( onCubeViewportAdded(MdiCubeViewport *) ) );


    // !!!!!!!   TODO  LOOK AT THIS       !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    // These connections should be at higher level, directory or project???? ::addCubeDnView().
    Project *activeProject = directory->project();
    // These connect signals listen to the active project, and if a control network
    // or list of control networks is added, then the enableControlNetTool() function is called.
    connect(activeProject, SIGNAL(controlListAdded(ControlList *)), this, SLOT(enableControlNetTool()));
    connect(activeProject, SIGNAL(controlAdded(Control *)), this, SLOT(enableControlNetTool()));

    QSizePolicy policy = sizePolicy();
    policy.setHorizontalPolicy(QSizePolicy::Expanding);
    policy.setVerticalPolicy(QSizePolicy::Expanding);
    setSizePolicy(policy);
  }


  void CubeDnView::createActions(Directory *directory) {


@@ -207,7 +197,6 @@ namespace Isis {
    m_separatorAction = new QAction(this);
    m_separatorAction->setSeparator(true);

    m_fileMenu = menuBar()->addMenu("&File");
    m_viewMenu = menuBar()->addMenu("&View");
    m_optionsMenu = menuBar()->addMenu("&Options");
    m_windowMenu = menuBar()->addMenu("&Window");
@@ -225,10 +214,7 @@ namespace Isis {
        if (!tool->menuName().isEmpty()) {
          QString menuName = tool->menuName();

          if (menuName == "&File") {
            tool->addTo(m_fileMenu);
          }
          else if (menuName == "&View") {
          if (menuName == "&View") {
            tool->addTo(m_viewMenu);
          }
          else if (menuName == "&Options") {
@@ -252,21 +238,22 @@ namespace Isis {


  /**
   * @description enableControlNetTool:  This is a slot function which
   * is called when the active project emits a signal to the CubeDnView
   * object after a control network (or a list of control networks)
   * has been added.  It enables the control network editor tool if it
   * has been disabled.
   * This is a slot function which is called when directory emits a siganl to
   * CubeDnView when an active control network is set. It enables the control
   * network editor tool in the toolpad.
   */
  void CubeDnView::enableControlNetTool() {
  void CubeDnView::enableControlNetTool(bool value) {

    foreach (QAction * action, m_toolPadActions) {
    foreach (QAction * action, m_toolPad->actions()) {
      if (action->objectName() == "ControlNetTool") {
        action->setDisabled(false);
        action->setEnabled(value);
        if (value) {
          ControlNetTool *cnetTool = static_cast<ControlNetTool *>(action->parent());
          cnetTool->loadNetwork();
        }
      }
    }
  }


  /**
   * Destructor
+6 −6
Original line number Diff line number Diff line
@@ -86,9 +86,12 @@ namespace Isis {
   *                           Workspace of this view is the centralWidget. This needs further work
   *                           to cleanup and fit in with the new docked view interface.git
   *   @history 2018-06-13 Kaitlyn Lee - Since views now inherit from QMainWindow, each individual
   *                           view has its own toolbar, so having getters that return toolbar actions
   *                           are unnecessary. Removed methods that returned menu and toolbar actions.
   *                           view has its own toolbar, so having getters that return toolbar
   *                           actions to fill the toolbar of the IpceMainWindow are unnecessary.
   *                           Removed methods that returned menu and toolbar actions.
   *                           toolPadActions() is still needed because it is used in Directory.
   *                           Removed connections that connected the project and CubeDnView and called
   *                           enableControlNetTool() because Directory now does this.
   */
  class CubeDnView : public AbstractProjectItemView {

@@ -118,7 +121,7 @@ namespace Isis {

    public slots:
      void addItem(ProjectItem *item);
      void enableControlNetTool();
      void enableControlNetTool(bool value);

    private slots:
      void createActions(Directory *directory);
@@ -161,7 +164,6 @@ namespace Isis {
      QMap<Cube *, ProjectItem *> m_cubeItemMap; //!< Maps cubes to their items
      Workspace *m_workspace; //!< The workspace

      QMenu *m_fileMenu; //!< File menu for storing actions
      QMenu *m_viewMenu; //!< View menu for storing actions
      QMenu *m_optionsMenu; //!< Options menu for storing actions
      QMenu *m_windowMenu; //!< Window menu for storing actions
@@ -172,8 +174,6 @@ namespace Isis {
      QToolBar *m_permToolBar; //!< A tool bar for storing actions
      QToolBar *m_activeToolBar; //!< A tool bar for storing actions
      ToolPad *m_toolPad; //!< A tool bar for storing actions

      QList<QAction *> m_toolPadActions; //!< The tool pad actions
  };
}

+21 −21
Original line number Diff line number Diff line
@@ -719,19 +719,19 @@ namespace Isis {
    connect(this, SIGNAL(cnetModified()), result, SIGNAL(redrawMeasures()));

    // Note:  This assumes the Control Net tool is the 1st in the toolpad.
    QList<QAction *> toolbar = result->toolPadActions();
    QAction* cnetAction = toolbar[0];
    ControlNetTool *cnetTool = static_cast<ControlNetTool *>(cnetAction->parent());
    // QList<QAction *> toolbar = result->toolPadActions();
    // QAction* cnetAction = toolbar[0];
    // ControlNetTool *cnetTool = static_cast<ControlNetTool *>(cnetAction->parent());

    connect (project(), SIGNAL(activeControlSet(bool)),
             cnetAction, SLOT(setEnabled(bool)));
    connect (project(), SIGNAL(activeControlSet(bool)),
             cnetTool, SLOT(loadNetwork()));
             result, SLOT(enableControlNetTool(bool)));
    // connect (project(), SIGNAL(activeControlSet(bool)),
    //          cnetTool, SLOT(loadNetwork()));

    //  If an active control has not been set, make the control net tool inactive
    if (!project()->activeControl()) {
      cnetAction->setEnabled(false);
    }
    // if (!project()->activeControl()) {
    //   cnetAction->setEnabled(false);
    // }

    return result;
  }
+3 −0
Original line number Diff line number Diff line
@@ -238,6 +238,9 @@ namespace Isis {
   *   @history 2018-05-14 Tracie Sucharski - Serialize Footprint2DView rather than
   *                           MosaicSceneWidget. This will allow all parts of Footprint2DView to be
   *                           saved/restored including the ImageFileListWidget. Fixes #5422.
   *   @history 2018-06-13 Kaitlyn Lee - The signal activeControlSet() in addCubeDnView() now connects
   *                           to enableControlNetTool() in CubeDnView, instead of enabling the tool 
   *                           directly.
   */
  class Directory : public QObject {
    Q_OBJECT