Isis 3 Programmer Reference
TemplateEditViewWorkOrder.cpp
Go to the documentation of this file.
1 
24 
25 #include <QFileDialog>
26 #include <QInputDialog>
27 #include <QtDebug>
28 
29 #include "Directory.h"
30 #include "IException.h"
31 #include "Project.h"
32 #include "ProjectItem.h"
33 #include "Template.h"
34 #include "TemplateEditorWidget.h"
35 
36 namespace Isis {
37 
47  WorkOrder(project) {
48  QAction::setText(tr("Edit template...") );
49  QUndoCommand::setText(tr("Edit Template"));
50 
51  // This work order is not undoable
52  m_isUndoable = false;
53  m_isSavedToHistory = false;
54  }
55 
56 
62  WorkOrder(other) {
63  }
64 
65 
70  }
71 
72 
78  return new TemplateEditViewWorkOrder(*this);
79  }
80 
81 
93  if (!projectitem)
94  return false;
95 
96  if (projectitem->isTemplate()) {
97 
98  Template *currentTemplate = projectitem->getTemplate();
99  // if we already have a view for this target, don't redisplay
101  for (int i = 0; i < existingViews.size(); i++) {
102  if (existingViews.at(i)->objectName() == currentTemplate->fileName() )
103  return false;
104  }
105  return true;
106  }
107 
108  return false;
109  }
110 
111 
120  bool success = WorkOrder::setupExecution();
121 
122  if (success) {
123  // This class relies on the parent class, WorkOrder to set m_template with its setData method.
124  // We can retrieve this template for ourselves using getTemplate(), a method of WorkOrder's.
125  QString templateFileName = getTemplate()->fileName();
127  internalData.append(templateFileName);
129  }
130  return success;
131  }
132 
133 
140 
141  TemplateEditorWidget *templateEditorWidget =
143 
144  if (!templateEditorWidget) {
145  QString msg = "error displaying target info";
147  }
148  }
149 
150 
157  // depend on types of ourselves.
158  return dynamic_cast<TemplateEditViewWorkOrder *>(other);
159  }
160 }
virtual bool setupExecution()
Attempt to retrieve the Target info.
The main project for ipce.
Definition: Project.h:289
QList< TemplateEditorWidget * > templateEditorViews()
Accessor for the list of TemplateEditorWidgets currently available.
Definition: Directory.cpp:1409
virtual bool setupExecution()
This sets up the state for the work order.
Definition: WorkOrder.cpp:1275
QString fileName() const
Get the file name that this Template represents.
Definition: Template.cpp:50
Widget for displaying information about a target.
This error is for when a programmer made an API call that was illegal.
Definition: IException.h:162
Template * getTemplate() const
Returns the Template stored in the data of the item.
Directory * directory() const
Returns the directory associated with this Project.
Definition: Project.cpp:1229
Provide Undo/redo abilities, serialization, and history for an operation.
Definition: WorkOrder.h:322
TemplateEditViewWorkOrder(Project *project)
Creates a WorkOrder that will retrieve Target info.
#define _FILEINFO_
Macro for the filename and line number.
Definition: IException.h:40
This work order allows the user to view and edit a template.
Template * getTemplate()
WorkOrder::getTemplate.
Definition: WorkOrder.cpp:750
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
virtual TemplateEditViewWorkOrder * clone() const
Returns a copy of this TemplateEditViewWorkOrder instance.
bool dependsOn(WorkOrder *other) const
Determines whether another WorkOrder depends upon TemplateEditViewWorkOrder.
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
Represents an item of a ProjectItemModel in Qt&#39;s model-view framework.
Definition: ProjectItem.h:146
Isis exception class.
Definition: IException.h:107
virtual void execute()
Executes this work order.
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
Project * project() const
Returns the Project this WorkOrder is attached to.
Definition: WorkOrder.cpp:1314
virtual bool isExecutable(ProjectItem *projectitem)
Determines if we can get target info.
bool m_isSavedToHistory
Set the work order to be shown in the HistoryTreeWidget.
Definition: WorkOrder.h:548
QStringList internalData() const
Gets the internal data for this WorkOrder.
Definition: WorkOrder.cpp:1391
void setInternalData(QStringList data)
Sets the internal data for this WorkOrder.
Definition: WorkOrder.cpp:1332
TemplateEditorWidget * addTemplateEditorView(Template *currentTemplate)
Add template editor view widget to the window.
Definition: Directory.cpp:980