Loading [MathJax]/jax/output/NativeMML/config.js
Isis 3 Programmer Reference
SaveProjectAsWorkOrder.cpp
Go to the documentation of this file.
1 
23 #include "SaveProjectAsWorkOrder.h"
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 
35 namespace 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 
60  WorkOrder(other) {
61  }
62 
63 
70 
71  }
72 
73 
80  return new SaveProjectAsWorkOrder(*this);
81  }
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 }
Isis::WorkOrder::setupExecution
virtual bool setupExecution()
This sets up the state for the work order.
Definition: WorkOrder.cpp:1261
Isis::WorkOrder
Provide Undo/redo abilities, serialization, and history for an operation.
Definition: WorkOrder.h:311
Project.h
Isis::SaveProjectAsWorkOrder::~SaveProjectAsWorkOrder
~SaveProjectAsWorkOrder()
Destructor.
Definition: SaveProjectAsWorkOrder.cpp:69
SaveProjectAsWorkOrder.h
Isis::Project::open
void open(QString)
Open the project at the given path.
Definition: Project.cpp:1345
Isis::WorkOrder::setInternalData
void setInternalData(QStringList data)
Sets the internal data for this WorkOrder.
Definition: WorkOrder.cpp:1318
Isis::SaveProjectAsWorkOrder::SaveProjectAsWorkOrder
SaveProjectAsWorkOrder(Project *project)
Creates a work order to save the project to a new location.
Definition: SaveProjectAsWorkOrder.cpp:43
Isis::SaveProjectAsWorkOrder::execute
virtual void execute()
Executes the work order.
Definition: SaveProjectAsWorkOrder.cpp:120
QStringList
Isis::Project
The main project for ipce.
Definition: Project.h:289
Isis::WorkOrder::m_isUndoable
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
Isis::SaveProjectAsWorkOrder::setupExecution
virtual bool setupExecution()
Sets up this work order prior to execution.
Definition: SaveProjectAsWorkOrder.cpp:94
Isis::WorkOrder::project
Project * project() const
Returns the Project this WorkOrder is attached to.
Definition: WorkOrder.cpp:1300
Isis::Project::save
bool save()
Generic save method to save the state of the project.
Definition: Project.cpp:2324
Isis::SaveProjectAsWorkOrder::clone
virtual SaveProjectAsWorkOrder * clone() const
Creates a clone of this work order.
Definition: SaveProjectAsWorkOrder.cpp:79
Isis::WorkOrder::internalData
QStringList internalData() const
Gets the internal data for this WorkOrder.
Definition: WorkOrder.cpp:1377
Isis::WorkOrder::setCreatesCleanState
void setCreatesCleanState(bool createsCleanState)
Declare that this work order is saving the project.
Definition: WorkOrder.cpp:1663
Isis::SaveProjectAsWorkOrder
Saves a project to disk (File->Save Project As...)
Definition: SaveProjectAsWorkOrder.h:54
Isis::Project::setClean
void setClean(bool value)
Function to change the clean state of the project.
Definition: Project.cpp:1595
Isis
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16

U.S. Department of the Interior | U.S. Geological Survey
ISIS | Privacy & Disclaimers | Astrogeology Research Program
To contact us, please post comments and questions on the USGS Astrogeology Discussion Board
To report a bug, or suggest a feature go to: ISIS Github
File Modified: 07/13/2023 15:17:14