Isis 3.0 Programmer Reference
Home
OpenProjectWorkOrder.cpp
Go to the documentation of this file.
1 
23 #include "OpenProjectWorkOrder.h"
24 
25 #include <QCoreApplication>
26 #include <QDebug>
27 #include <QFileDialog>
28 #include <QMessageBox>
29 #include <QtConcurrentMap>
30 
31 #include "Cube.h"
32 #include "CubeAttribute.h"
33 #include "ProgressBar.h"
34 #include "Project.h"
35 
36 namespace Isis {
37 
44  WorkOrder(project) {
45  //qDebug()<<"OpenProjectWorkOrder::OpenProjectWorkOrder";
46  QAction::setText(tr("&Open Project"));
47 
49 
50  QStringList args = QCoreApplication::arguments();
51 
52  if (args.count() == 2) {
53 // connect(this, SIGNAL(openProjectFromCommandLine(QString)),
54 // project, SLOT(open(QString)), Qt::QueuedConnection);
55 // emit openProjectFromCommandLine(args.last());
56 // project->open(args.last());
57  }
58  }
59 
60 
67  WorkOrder(other) {
68  }
69 
70 
75 
76  }
77 
78 
85  return new OpenProjectWorkOrder(*this);
86  }
87 
88 
95  //qDebug()<<"OpenProjectWorkOrder::execute()";
96  bool success = WorkOrder::execute();
97 
98  // We dislike the progress bar
99  delete progressBar();
100 
101  // If more than this work order is in the history, don't allow this operation
102  if (success && project()->workOrderHistory().count()) {
103  QMessageBox::critical(NULL, tr("Unable To Open a Project"),
104  tr("If you have modified your current project, you cannot open a new "
105  "project because this is not yet implemented"));
106  success = false;
107  }
108  else if (success) {
109  QString projectName = QFileDialog::getExistingDirectory(qobject_cast<QWidget *>(parent()),
110  tr("Open Project"));
111 
112  if (!projectName.isEmpty()) {
113  project()->open(projectName);
114  }
115  else {
116  success = false;
117  }
118  }
119 
120  return success;
121  }
122 }
The main project for cnetsuite.
Definition: Project.h:105
void open(QString)
Open the project at the given path.
Definition: Project.cpp:838
Project * project() const
Returns the Project this WorkOrder is attached to.
Definition: WorkOrder.cpp:1116
virtual OpenProjectWorkOrder * clone() const
Clones the current OpenProjectWorkOrder.
bool execute()
Executes the OpenProjectWorkOrder.
Parent class for anything that performs an action in Project.
Definition: WorkOrder.h:104
OpenProjectWorkOrder(Project *project)
Constructs an OpenProjectWorkOrder.
This opens a project that&#39;s saved on disk.
virtual bool execute()
The (child) implementation of this method should prompt the user/gather state by any means necessary...
Definition: WorkOrder.cpp:1078
ProgressBar * progressBar()
Returns the ProgressBar.
Definition: WorkOrder.cpp:832
void setCreatesCleanState(bool createsCleanState)
Declare that this work order is saving the project.
Definition: WorkOrder.cpp:1520