23#include "ExportControlNetWorkOrder.h"
27#include <QInputDialog>
30#include "ControlList.h"
31#include "ControlNet.h"
33#include "IException.h"
50 QAction::setText(tr(
"&Export Control Network..."));
51 QUndoCommand::setText(tr(
"Export Control Network..."));
103 return (controls->count() == 1);
133 QList<ControlList *> controls = proj->controls();
134 if (controls.count() > 0) {
141 QMap<Control *, QString> cnetChoices;
143 foreach (
Control *control, *list) {
144 cnetChoices[control] = tr(
"%1/%2").arg(list->
name())
152 QString choice = QInputDialog::getItem(NULL, tr(
"Select Control"),
153 tr(
"Please choose a control to export."), cnetNames, 0,
false, &success);
155 control = cnetChoices.key(choice);
161 QString destination =
162 QFileDialog::getSaveFileName(NULL, QString(
"Export Control Network"),
165 if (destination.isEmpty()) {
200 QString currentLocation = control->
fileName();
201 if (!QFile::copy(currentLocation, destination) ) {
This represents an ISIS control net in a project-based GUI interface.
QString id() const
Access the unique ID associated with this Control.
ControlDisplayProperties * displayProperties()
Access a pointer to the display properties for the control network.
QString fileName() const
Access the name of the control network file associated with this Control.
Maintains a list of Controls so that control nets can easily be copied from one Project to another,...
QString name() const
Get the human-readable name of this control list.
QString displayName() const
Returns the display name.
Write a project control network to a user-specified location.
virtual ExportControlNetWorkOrder * clone() const
Clones this work order.
virtual bool setupExecution()
Prepares for exporting a control net by soliciting information from the user.
virtual void execute()
Executes the work order.
bool isExecutable(ControlList *controls)
Determines if we can export a control net.
ExportControlNetWorkOrder(Project *project)
Creates a work order for exporting a control network from the project.
virtual void postExecution()
Display any warnings that occurred during the asynchronous computations.
QString m_warning
Stores any errors that may have occurred during export.
~ExportControlNetWorkOrder()
Destructor.
File name manipulation and expansion.
QString name() const
Returns the name of the file excluding the path and the attributes in the file name.
The main project for ipce.
Control * control(QString id)
Accessor for if the project is clearing or not.
Provide Undo/redo abilities, serialization, and history for an operation.
virtual void setData(Context)
Sets the context data for this WorkOrder.
bool m_isSynchronous
This is defaulted to true.
bool m_isUndoable
Set the workorder to be undoable/redoable This is defaulted to true - his will allow the workorder to...
virtual bool setupExecution()
This sets up the state for the work order.
QStringList internalData() const
Gets the internal data for this WorkOrder.
QPointer< ControlList > controlList()
Returns the Control List for this WorkOrder (a list of control networks).
void setInternalData(QStringList data)
Sets the internal data for this WorkOrder.
Project * project() const
Returns the Project this WorkOrder is attached to.
This is free and unencumbered software released into the public domain.