Isis 3 Programmer Reference
ControlHealthMonitorWorkOrder.cpp
1
7/* SPDX-License-Identifier: CC0-1.0 */
8
9#include "ControlHealthMonitorWorkOrder.h"
10
11#include <QMessageBox>
12#include <QtDebug>
13
14#include "Control.h"
15#include "Directory.h"
16#include "IException.h"
17#include "Project.h"
18#include "ProjectItem.h"
19#include "ProjectItemModel.h"
20
21namespace Isis {
22
28 WorkOrder(project) {
29
30 // This workorder is not undoable
31 m_isUndoable = false;
32
33 QAction::setText(tr("View Control Net Health Monitor") );
34 QUndoCommand::setText(tr("View Control Net Health Monitor"));
35 }
36
37
45
46
52
53
61
62
71 return !!controls;
72 }
73
80
81 bool success = WorkOrder::setupExecution();
82 if (success) {
83 if (!isExecutable(controlList())) {
84
85 QMessageBox::critical(NULL, tr("Unable to load Control Net Health Monitor."),
86 tr("You must first set an active control in order to view the health monitor."));
87 success = false;
88 }
89 // So far, so good, set the command text
90 else {
91 QUndoCommand::setText(tr("Set Active Control Network to [%1]").arg(
92 controlList()->at(0)->displayProperties()->displayName()));
93 }
94 }
95
96 return success;
97 }
98
99
108 try {
109 project()->directory()->addControlHealthMonitorView();
110 }
111 catch (IException &e) {
112 m_status = WorkOrderFinished;
113 QMessageBox::critical(NULL, tr("Error"), tr(e.what()));
114 }
115 }
116}
This is a child of class WorkOrder which is used for anything that performs an action in a Project.
virtual ControlHealthMonitorWorkOrder * clone() const
Returns a copy of this ControlHealthMonitorWorkOrder instance.
virtual bool isExecutable(ControlList *controls)
Determines if we can execute the health monitor.
ControlHealthMonitorWorkOrder(Project *project)
Creates a WorkOrder that will display the Control Net Health Monitor interface.
void execute()
Set the active control net for the project.
bool setupExecution()
Make sure an active ImageList has been chosen.
Maintains a list of Controls so that control nets can easily be copied from one Project to another,...
Definition ControlList.h:44
Isis exception class.
Definition IException.h:91
The main project for ipce.
Definition Project.h:289
Directory * directory() const
Returns the directory associated with this Project.
Definition Project.cpp:1228
Provide Undo/redo abilities, serialization, and history for an operation.
Definition WorkOrder.h:311
@ WorkOrderFinished
This is used for work orders that will not undo or redo (See createsCleanState())
Definition WorkOrder.h:331
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.
QPointer< ControlList > controlList()
Returns the Control List for this WorkOrder (a list of control networks).
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