Isis 3.0 Programmer Reference
Back | Home
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 
37  SaveProjectAsWorkOrder::SaveProjectAsWorkOrder(Project *project) :
38  WorkOrder(project) {
39  QAction::setText(tr("Save Project &As"));
41  }
42 
43 
44  SaveProjectAsWorkOrder::SaveProjectAsWorkOrder(const SaveProjectAsWorkOrder &other) :
45  WorkOrder(other) {
46  }
47 
48 
49  SaveProjectAsWorkOrder::~SaveProjectAsWorkOrder() {
50 
51  }
52 
53 
54  SaveProjectAsWorkOrder *SaveProjectAsWorkOrder::clone() const {
55  return new SaveProjectAsWorkOrder(*this);
56  }
57 
58 
60  bool success = WorkOrder::execute();
61 
62  if (success) {
63  QString newDestination =
64  QFileDialog::getSaveFileName(NULL, QString("Project Location"), QString("."));
65 
66  if (!newDestination.isEmpty()) {
67  QUndoCommand::setText(tr("Save project to [%1]") .arg(newDestination));
68  QString realPath = QFileInfo(newDestination + "/").absolutePath();
69  project()->save(realPath);
70 // project()->relocateProjectRoot(realPath);
71  }
72  else {
73  success = false;
74  }
75  }
76 
77  return success;
78  }
79 }
Project * project() const
Returns the Project this WorkOrder is attached to.
Definition: WorkOrder.cpp:1116
bool execute()
The (child) implementation of this method should prompt the user/gather state by any means necessary...
virtual bool execute()
The (child) implementation of this method should prompt the user/gather state by any means necessary...
Definition: WorkOrder.cpp:1078
void setCreatesCleanState(bool createsCleanState)
Declare that this work order is saving the project.
Definition: WorkOrder.cpp:1520

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 ISIS Support Center
File Modified: 07/12/2023 23:28:39