Isis 3 Programmer Reference
SaveProjectAsWorkOrder.cpp
Go to the documentation of this file.
1
24
25#include <QDebug>
26#include <QFileDialog>
27#include <QMessageBox>
28#include <QtConcurrentMap>
29
30#include "Cube.h"
31#include "CubeAttribute.h"
32#include "FileName.h"
33#include "Project.h"
34
35namespace Isis {
36
44 WorkOrder(project) {
45 // This work order is not undoable
46 m_isUndoable = false;
47 QAction::setText(tr("Save Project &As"));
49 }
50
51
62
63
72
73
82
83
95 bool success = WorkOrder::setupExecution();
96
97 if (success) {
98 QString newDestination =
99 QFileDialog::getSaveFileName(NULL, QString("Project Location"), QString("."));
100
101 if (!newDestination.isEmpty()) {
102 QUndoCommand::setText(tr("Save project to [%1]") .arg(newDestination));
103 QString realPath = QFileInfo(newDestination + "/").absolutePath();
104 setInternalData(QStringList(realPath));
105 }
106 else {
107 success = false;
108 }
109 }
110
111 return success;
112 }
113
114
121 QString destination = internalData().first();
122 if (!destination.isEmpty()) {
123 project()->save(destination);
124 project()->open(destination);
125 project()->setClean(true);
126 }
127 }
128}
The main project for ipce.
Definition Project.h:289
void open(QString)
Open the project at the given path.
Definition Project.cpp:1344
void setClean(bool value)
Function to change the clean state of the project.
Definition Project.cpp:1594
bool save()
Generic save method to save the state of the project.
Definition Project.cpp:2323
Saves a project to disk (File->Save Project As...)
virtual void execute()
Executes the work order.
virtual SaveProjectAsWorkOrder * clone() const
Creates a clone of this work order.
SaveProjectAsWorkOrder(Project *project)
Creates a work order to save the project to a new location.
virtual bool setupExecution()
Sets up this work order prior to execution.
Provide Undo/redo abilities, serialization, and history for an operation.
Definition WorkOrder.h:311
bool m_isUndoable
Set the workorder to be undoable/redoable This is defaulted to true - his will allow the workorder to...
Definition WorkOrder.h:523
virtual bool setupExecution()
This sets up the state for the work order.
QStringList internalData() const
Gets the internal data for this WorkOrder.
void setCreatesCleanState(bool createsCleanState)
Declare that this work order is saving the project.
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.
Definition Apollo.h:16