Commit 180a5c52 authored by Ian Humphrey's avatar Ian Humphrey
Browse files

Modified menu actions for export cnet, export images, and bundle adjust to be...

Modified menu actions for export cnet, export images, and bundle adjust to be default disabled. Fixes #4749.

git-svn-id: http://subversion.wr.usgs.gov/repos/prog/isis3/branches/ipce_FY17-Sprint1@7580 41f8697f-d340-4b68-9986-7bafba869bb8
parent caa93f3e
Loading
Loading
Loading
Loading
+13 −8
Original line number Diff line number Diff line
@@ -528,6 +528,11 @@ namespace Isis {
    m_projectMenu = menuBar()->addMenu(tr("&Project"));
    m_projectMenu->setObjectName("projectMenu");

    // Allow tool tips to be displayed for the project menu's actions (e.g. "Bundle Adjustment")
    // This is a work around for Qt's what this text not working on disabled actions
    // (even though the Qt documentation says it should work on disabled QAction's).
    m_projectMenu->setToolTipsVisible(true);

    m_editMenu = menuBar()->addMenu(tr("&Edit"));
    m_editMenu->setObjectName("editMenu");

+3 −0
Original line number Diff line number Diff line
@@ -82,6 +82,9 @@ namespace Isis {
   *   @history 2016-12-09 Tracie Sucharski - One of the previous 2 changes caused a problem with
   *                           view toolbars not to be restored.  Added setActiveSubWindow and
   *                           show to the ::addView method.  Fixes #4546.
   *   @history 2017-04-17 Ian Humphrey - Updated createMenus() to set tool tips (hover text)
   *                           visible so the JigsawWorkOrder tool tip can be displayed to user
   *                           (which indicates why it is disabled by default). Fixes #4749.
   */
  class CNetSuiteMainWindow : public QMainWindow {
      Q_OBJECT
+62 −36
Original line number Diff line number Diff line
@@ -161,7 +161,6 @@ namespace Isis {
    }

    initializeActions();

  }


@@ -264,6 +263,10 @@ namespace Isis {
  /**
   * @brief Initializes the actions that the Directory can provide to a main window.
   *
   * Any work orders that need to be disabled by default can be done so here.
   * You need to grab the clone pointer, setEnabled(false), then set up the proper connections
   * between the project signals (representing changes to state) and WorkOrder::enableWorkOrder.
   *
   * @todo 2017-02-14 Tracie Sucharski - As far as I can tell the created menus are never used.
   * Instead of creating menus to use the addAction method, can't we simply create actions and
   * add them to the member variables which save the list of actions for each menu?
@@ -324,22 +327,45 @@ namespace Isis {
    importMenu->addAction(m_importShapesWorkOrder->clone() );

    QMenu *exportMenu = fileMenu->addMenu("&Export");
    exportMenu->addAction(m_exportControlNetWorkOrder->clone() );
    exportMenu->addAction(m_exportImagesWorkOrder->clone() );

    fileMenu->addSeparator();
    // Temporarily grab the export control network clone so we can listen for the
    // signals that tell us when we can export a cnet. We cannot export a cnet unless at least
    // one has been imported to the project.
    WorkOrder *clone = m_exportControlNetWorkOrder->clone();
    clone->setEnabled(false);
    connect(m_project, &Project::controlListAdded,
            clone, &WorkOrder::enableWorkOrder);
    // TODO this is not setup yet
    // connect(m_project, &Project::allControlsRemoved,
    //         clone, &WorkOrder::disableWorkOrder);
    exportMenu->addAction(clone);

    // Similarly for export images, disable the work order until we have images in the project.
    clone = m_exportImagesWorkOrder->clone();
    clone->setEnabled(false);
    connect(m_project, &Project::imagesAdded,
            clone, &WorkOrder::enableWorkOrder);
    exportMenu->addAction(clone);

    fileMenu->addSeparator();
    fileMenu->addAction(m_closeProjectWorkOrder->clone() );

    m_fileMenuActions.append( fileMenu->actions() );

    m_projectMenuActions.append(m_renameProjectWorkOrder->clone());

    // For JigsawWorkOrder, disable the work order utnil we have both an active control and image
    // list. Setup a tool tip so user can see why the work order is disabled by default.
    // NOTE: Trying to set a what's this on the clone doesn't seem to work for disabled actions,
    // even though Qt's documentation says it should work on disabled actions.
    clone = m_runJigsawWorkOrder->clone();
    clone->setEnabled(false);

//  QMenu *projectMenu = new QMenu();
//  projectMenu->addAction(m_renameProjectWorkOrder->clone());
//  projectMenu->addAction(m_runJigsawWorkOrder->clone() );
    // 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,
            clone, &WorkOrder::enableWorkOrder);

    m_projectMenuActions.append(m_renameProjectWorkOrder->clone());
    m_projectMenuActions.append(m_runJigsawWorkOrder->clone() );
    m_projectMenuActions.append(clone);

//  m_projectMenuActions.append( projectMenu->actions() );

+12 −6
Original line number Diff line number Diff line
@@ -118,6 +118,11 @@ namespace Isis {
   *   @history 2017-04-17 Tracie Sucharski - Added connection between model's projectNameEdited,
   *                           initiated by double-clicking the project name on the ProjectTreeView
   *                           and Directory's slot, initiateRenameProjectWorkOrder.  Fixes #2295.
   *   @history 2017-04-17 Ian Humphrey - Modified how ExportControlNet, ExportImages, and
   *                           Jigsaw WorkOrder's are added to the main window menu. These are
   *                           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.
   */
  class Directory : public QObject {
    Q_OBJECT
@@ -347,6 +352,7 @@ namespace Isis {
      QList<QAction *> m_permToolBarActions; //!< List of perm ToolBar actions
      QList<QAction *> m_activeToolBarActions; //!< List of active ToolBar actions
      QList<QAction *> m_toolPadActions; //!< List of ToolPad actions

  };
}

+8 −0
Original line number Diff line number Diff line
@@ -57,8 +57,12 @@ namespace Isis {
    m_isUndoable = false;
    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.";
    QAction::setToolTip(hoverText);
  }


  /**
   * @brief Copy constructor.
   *
@@ -69,12 +73,14 @@ namespace Isis {
    m_bundleSettings = other.m_bundleSettings;
  }


  /**
   * Destructor
   */
  JigsawWorkOrder::~JigsawWorkOrder() {
  }


  /**
   * This method clones the JigsawViewWorkOrder
   *
@@ -84,6 +90,7 @@ namespace Isis {
    return new JigsawWorkOrder(*this);
  }


  /**
   * This check is used by Directory::supportedActions(DataType data).
   *
@@ -94,6 +101,7 @@ namespace Isis {
    return (project()->controls().size() > 0 && project()->images().size() > 0);
  }


  /**
   * If WorkOrder:setupExecution() returns true, this creates a setup dialog.
   *
Loading