Commit 3d84c0c4 authored by Ian Humphrey's avatar Ian Humphrey
Browse files

Updated how jigsaw work order on main menu is disabled and enabled. Fixes #4819.

parent 9ebd81f7
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -359,9 +359,15 @@ namespace Isis {
    // even though Qt's documentation says it should work on disabled actions.
    clone = m_runJigsawWorkOrder->clone();
    if (project()->controls().count() && project()->images().count()) {
      clone->setEnabled(true);
    }
    else {
      clone->setEnabled(false);
    }

    // Listen for when both images and control net have been added to the project.
    connect(m_project, &Project::controlsAndImagesAvailable,
            clone, &WorkOrder::enableWorkOrder);
    // Listen for when both an active control and active image list have been set.
    // When this happens, we can enable the JigsawWorkOrder.
//  connect(m_project, &Project::activeControlAndImageListSet,
+3 −0
Original line number Diff line number Diff line
@@ -123,6 +123,9 @@ namespace Isis {
   *                           disabled by default, and connections are setup to listen for when
   *                           cnets are added, when images are added, and when both an active
   *                           cnet and image list have been set. Fixes #4749.
   *   @history 2017-04-25 Ian Humphrey - Modified initializeActions() so that the jigsaw work
   *                           order is enabled whenever there are both images and cnets in the
   *                           project. Otherwise, it is disabled until then. Fixes #4819.
   */
  class Directory : public QObject {
    Q_OBJECT
+1 −1
Original line number Diff line number Diff line
@@ -58,7 +58,7 @@ namespace Isis {
    QAction::setText(tr("&Bundle Adjustment..."));
    QUndoCommand::setText("&Bundle Adjustment...");
    QString hoverText = "Runs a bundle adjustment. ";
    hoverText += "You must have both an active control and image list set.";
    hoverText += "You must import a control net and images before you can run a bundle adjustment.";
    QAction::setToolTip(hoverText);
  }

+1 −0
Original line number Diff line number Diff line
@@ -45,6 +45,7 @@ namespace Isis {
   *   @history 2017-04-17 Ian Humphrey - Added what's this and tool tip text to this work order
   *                           so the user knows that this work order is disabled until an
   *                           active cnet and image list have been set. Fixes #4749.
   *   @history 2017-04-25 Ian Humphrey - Modified tool tip text. Fixes #4819.
   */
  class JigsawWorkOrder : public WorkOrder {
      Q_OBJECT
+26 −0
Original line number Diff line number Diff line
@@ -184,6 +184,15 @@ namespace Isis {
    connect( this, SIGNAL(imagesAdded(ImageList *) ),
             this, SLOT(addCamerasFromImportedImagesToProject(ImageList *) ) );

    // Project will be listening for when both cnets and images have been added.
    // It will emit a signal, controlsAndImagesAvailable, when this occurs.
    // Directory sets up a listener on the JigsawWorkOrder clone to enable itself
    // when it hears this signal.
    connect(this, SIGNAL(imagesAdded(ImageList *)),
            this, SLOT(checkControlsAndImagesAvailable()));
    connect(this, SIGNAL(controlListAdded(ControlList *)),
            this, SLOT(checkControlsAndImagesAvailable()));

    m_images = new QList<ImageList *>;

    // Shape reader
@@ -1197,6 +1206,23 @@ namespace Isis {
  }


  /**
   * @brief Checks if at least one control and image have been added to the project.
   *
   * This can be used to check whenever there are control nets and images available
   * in the project. This is used for enabling the jigsaw work order on the Project menu when
   * a control net and image are available / loaded in the project.
   * 
   * @see Project::Project(Directory &directory, QObject *parent)
   * @see Directory::initializeActions()
   */
  void Project::checkControlsAndImagesAvailable() {
    if (controls().count() > 0 && images().count() > 0) {
      emit controlsAndImagesAvailable();
    }
  }


  /**
   * @brief Set the Active Control (control network)
   *
Loading