Isis 3 Programmer Reference
SetActiveImageListWorkOrder.cpp
Go to the documentation of this file.
1 
22 
23 #include <QMessageBox>
24 #include <QtDebug>
25 
26 #include "Directory.h"
27 #include "IException.h"
28 #include "ImageList.h"
29 #include "Project.h"
30 
31 namespace Isis {
32 
38  WorkOrder(project) {
39  // This work order is not undoable
40  m_isUndoable = false;
41 
42  QAction::setText(tr("Set Active Image List") );
43  QUndoCommand::setText(tr("Set Active Image List"));
44  }
45 
46 
52  WorkOrder(other) {
53  }
54 
55 
60  }
61 
62 
68  return new SetActiveImageListWorkOrder(*this);
69  }
70 
71 
79  if (imageList->name() == "") {
80  return false;
81  }
82  if (project()->activeImageList()) {
83  if (project()->activeImageList()->name() == imageList->name()) {
84  return false;
85  }
86  }
87  return true;
88  }
89 
90 
101  return WorkOrder::setupExecution();
102  }
103 
104 
111  try {
112  project()->setActiveImageList(imageList()->name());
113  }
114  catch (IException &e) {
115  m_status = WorkOrderFinished;
116  QMessageBox::critical(NULL, tr("Error"), tr(e.what()));
117  }
118  }
119 }
const char * what() const
Returns a string representation of this exception in its current state.
Definition: IException.cpp:391
QString name() const
Get the human-readable name of this image list.
Definition: ImageList.cpp:724
virtual SetActiveImageListWorkOrder * clone() const
Returns a copy of this SetActiveImageListWorkOrder instance.
Internalizes a list of images and allows for operations on the entire list.
Definition: ImageList.h:55
The main project for ipce.
Definition: Project.h:289
virtual bool setupExecution()
Simply calls the parent WorkOrder::setupExecution().
virtual bool setupExecution()
This sets up the state for the work order.
Definition: WorkOrder.cpp:1275
Provide Undo/redo abilities, serialization, and history for an operation.
Definition: WorkOrder.h:322
ImageList * activeImageList()
Returns the active ImageList.
Definition: Project.cpp:2003
virtual bool isExecutable(ImageList *imageList)
Determines if we can set this imageList as active.
bool m_isUndoable
Set the workorder to be undoable/redoable This is defaulted to true - his will allow the workorder to...
Definition: WorkOrder.h:534
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
void setActiveImageList(QString displayName)
Set the Active ImageList from the displayName which is saved in project.xml.
Definition: Project.cpp:1955
SetActiveImageListWorkOrder(Project *project)
Creates a not undable WorkOrder that will set the active ImageList in the project.
Isis exception class.
Definition: IException.h:107
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
This is used for work orders that will not undo or redo (See createsCleanState()) ...
Definition: WorkOrder.h:342
Project * project() const
Returns the Project this WorkOrder is attached to.
Definition: WorkOrder.cpp:1314
virtual void execute()
Executes this work order.
This is a child of class WorkOrder which is used for anything that performs an action in a Project...
ImageList * imageList()
Returns a pointer to the ImageList for this WorkOrder.
Definition: WorkOrder.cpp:645