Commit b294ca4a authored by Makayla Shepherd's avatar Makayla Shepherd
Browse files

Updated CubeDnViewWorkOrder according to the WorkOrder redesign.

parent 58c81bab
Loading
Loading
Loading
Loading
+37 −22
Original line number Diff line number Diff line
@@ -95,15 +95,29 @@ namespace Isis {
  }
  
  /**
   * If WorkOrder::execute() returns true, then this method returns true.
   * @description This method returns false because this WorkOrder is not undoable.
   * 
   * @return @b bool True if WorkOrder::execute() returns true.
   * @see WorkOrder::isUndoable()
   * 
   * @return bool Returns false because this WorkOrder is not undoable.
   */
  bool CubeDnViewWorkOrder::setupExecution() {
    bool success = WorkOrder::setupExecution();

  bool CubeDnViewWorkOrder::isUndoable() const {
    return false;
  }

  
  /**
   * @description This method asks the user what view they want to see their cube list in. The user 
   * can select an existing vew or they can create a new view. The user's choice is then saved using 
   * setInternalData(). This method was renamed from execute() to setupExecution() according to the 
   * WorkOrder redesign.
   * 
   * @see WorkOrder::setupExecution()
   * 
   * @return @b bool True if WorkOrder::setupExecution() returns true.
   */
  bool CubeDnViewWorkOrder::setupExecution() {
    bool success = WorkOrder::setupExecution();

    if (success) {
      QStringList viewOptions;
@@ -146,29 +160,16 @@ namespace Isis {
      setInternalData(internalData);
    }



    return success;
  }

  /**
   * This method returns true if other depends on a CubeDnViewWorkOrder
   * 
   * @param order the WorkOrder we want to check for dependancies
   * 
   * @return @b bool True if WorkOrder depends on a CubeDnViewWorkOrder
   * 
   */
  bool CubeDnViewWorkOrder::dependsOn(WorkOrder *other) const {
    // depend on types of ourselves.
    return dynamic_cast<CubeDnViewWorkOrder *>(other);
  }

  /**
   * This method adds a new CubeDnView to the project's directory and then adds currentItem() to
   * that. 
   * @desciption This method adds a new CubeDnView to the project's directory and then adds 
   * currentItem() to that. This method was renamed from syncRedo() to execute() according to 
   * WorkOrder's redesign. 
   */
  void CubeDnViewWorkOrder::syncRedo() {
  void CubeDnViewWorkOrder::execute() {
    QList<ProjectItem *> selectedItems = project()->directory()->model()->selectedItems();

    int viewToUse = internalData().first().toInt();
@@ -183,5 +184,19 @@ namespace Isis {
   
    view->addItems(selectedItems);
  }
  
  
    /**
   * This method returns true if other depends on a CubeDnViewWorkOrder
   * 
   * @param order the WorkOrder we want to check for dependancies
   * 
   * @return @b bool True if WorkOrder depends on a CubeDnViewWorkOrder
   * 
   */
  bool CubeDnViewWorkOrder::dependsOn(WorkOrder *other) const {
    // depend on types of ourselves.
    return dynamic_cast<CubeDnViewWorkOrder *>(other);
  }
}
+6 −1
Original line number Diff line number Diff line
@@ -43,6 +43,9 @@ namespace Isis {
   *                          adding images to an existing view.
   *   @history 2016-11-02 Makayla Shepherd - Changed the display text from View Raw Cubes to 
   *                          Display Images. Fixes #4494. 
   *   @history 2017-04-06 Makayla Shepherd - Added isUndoable, and renamed execute() to 
   *                          setupExecution(), and syncRedo() to execute() according to the 
   *                          WorkOrder redesign.
   */
  class CubeDnViewWorkOrder : public WorkOrder {
      Q_OBJECT
@@ -56,11 +59,13 @@ namespace Isis {
      virtual bool isExecutable(ImageList *images);
      virtual bool isExecutable(ShapeList *shapes);
      
      bool isUndoable() const;

      bool setupExecution();
      void execute();

    protected:
      bool dependsOn(WorkOrder *other) const;
      void syncRedo();

    private:
      CubeDnViewWorkOrder &operator=(const CubeDnViewWorkOrder &rhs);