Commit 86dee5f3 authored by Kaitlyn Lee's avatar Kaitlyn Lee
Browse files

On default, the control net tool is disabled if no control net is loaded.

parent 79adb2fe
Loading
Loading
Loading
Loading
+11 −11
Original line number Diff line number Diff line
@@ -775,19 +775,19 @@ namespace Isis {
    connect(this, SIGNAL(redrawMeasures()), result, SIGNAL(redrawMeasures()));

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

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

    //  Control Net tool will only be active if the project has an active Control.
    if (!project()->activeControl()) {
      cnetAction->setEnabled(false);
    }
             result, SLOT(enableControlNetTool(bool)));
    // connect (project(), SIGNAL(activeControlSet(bool)),
    //          cnetTool, SLOT(loadNetwork()));
    //
    // //  Control Net tool will only be active if the project has an active Control.
    // if (!project()->activeControl()) {
    //   cnetAction->setEnabled(false);
    // }

    return result;
  }
+39 −37
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@
#include <QWidgetAction>
#include <QXmlStreamWriter>

#include "ControlNetTool.h"
#include "ControlPoint.h"
#include "Cube.h"
#include "Directory.h"
@@ -50,6 +51,7 @@
#include "ImageFileListWidget.h"
#include "MosaicGraphicsView.h"
#include "MosaicSceneWidget.h"
#include "MosaicControlNetTool.h"
#include "Project.h"
#include "ProjectItem.h"
#include "ProjectItemModel.h"
@@ -136,6 +138,17 @@ namespace Isis {
    m_sceneWidget->addTo(m_activeToolBar);
    m_sceneWidget->addTo(m_toolPad);

    // MosaicSceneWidget's default is to have the Control Net Tool enabled.
    // In ipce, we want it to be disabled if an active control is not set.
    foreach (QAction * action, m_toolPad->actions()) {
      if (action->toolTip() == "Control Net (c)") {
        m_controlNetTool = action;
      }
    }
    if (!directory->project()->activeControl()) {
      m_controlNetTool->setEnabled(false);
    }

//  m_activeToolBarAction = new QWidgetAction(this);
//  m_activeToolBarAction->setDefaultWidget(m_activeToolBar);

@@ -313,37 +326,27 @@ namespace Isis {
    }
  }


  /**
   * Returns a list of actions for the permanent tool bar.
   *
   * @return @b QList<QAction*> The actions
   * 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.
   */
  QList<QAction *> Footprint2DView::permToolBarActions() {
    return m_permToolBar->actions();
  void Footprint2DView::enableControlNetTool(bool value) {
    m_controlNetTool->setEnabled(value);
    if (value) {
      MosaicControlNetTool *cnetTool = static_cast<MosaicControlNetTool *>(m_controlNetTool->parent());
      cnetTool->loadNetwork();
    }


  /**
   * Returns a list of actions for the active tool bar.
   *
   * @return @b QList<QAction*> The actions
   */
  QList<QAction *> Footprint2DView::activeToolBarActions() {
    QList<QAction *> actions;
    actions.append(m_activeToolBarAction);
    return actions;
  }


  /**
   * Returns a list of actions for the tool pad.
   *
   * @return @b QList<QAction*> The actions
   */
  QList<QAction *> Footprint2DView::toolPadActions() {
    return m_toolPad->actions();
  }
  // /**
  //  * Returns a list of actions for the tool pad.
  //  *
  //  * @return @b QList<QAction*> The actions
  //  */
  // QList<QAction *> Footprint2DView::toolPadActions() {
  //   return m_toolPad->actions();
  // }


  /**
@@ -432,4 +435,3 @@ namespace Isis {
    return result;
  }
}
+10 −6
Original line number Diff line number Diff line
@@ -88,9 +88,8 @@ namespace Isis {
      ~Footprint2DView();

      MosaicSceneWidget *mosaicSceneWidget();
      virtual QList<QAction *> permToolBarActions();
      virtual QList<QAction *> activeToolBarActions();
      virtual QList<QAction *> toolPadActions();

      //virtual QList<QAction *> toolPadActions();

      QSize sizeHint() const;

@@ -105,6 +104,9 @@ namespace Isis {
      void redrawMeasures();
      void controlPointAdded(QString newPointId);

    public slots:
      void enableControlNetTool(bool value);

    protected:
      bool eventFilter(QObject *watched, QEvent *event);

@@ -146,6 +148,8 @@ namespace Isis {
      QToolBar *m_activeToolBar; //!< The active tool bar
      ToolPad *m_toolPad; //!< The tool pad

      QAction *m_controlNetTool;

      QWidgetAction *m_activeToolBarAction; //!< Stores the active tool bar
  };
}
+3 −3
Original line number Diff line number Diff line
@@ -123,6 +123,8 @@ namespace Isis {
      void displayNewControlPoint(QString pointId);
      void displayChangedControlPoint(QString pointId);
      void displayUponControlPointDeletion();
      void loadNetwork();


    protected:
      QAction *getPrimaryAction();
@@ -136,7 +138,6 @@ namespace Isis {
      void displayControlNet();
      void displayConnectivity();
      void closeNetwork();
      void loadNetwork();
      void randomizeColors();

      void objectDestroyed(QObject *);
@@ -169,4 +170,3 @@ namespace Isis {
};

#endif