Isis 3 Programmer Reference
ControlHealthMonitorView.cpp
1
7/* SPDX-License-Identifier: CC0-1.0 */
8
9#include "ControlHealthMonitorView.h"
10
11#include <QAction>
12#include <QList>
13#include <QSize>
14#include <QSizePolicy>
15#include <QToolBar>
16#include <QVBoxLayout>
17#include <QWidgetAction>
18
19#include "ControlHealthMonitorWidget.h"
20#include "ControlPointEditView.h"
21#include "ControlPointEditWidget.h"
22#include "CnetEditorView.h"
23#include "CubeDnView.h"
24
25#include "ControlNet.h"
26#include "ControlPoint.h"
27#include "Directory.h"
28#include "ProjectItem.h"
29#include "ProjectItemModel.h"
30
31#include "ToolPad.h"
32
33
34namespace Isis {
35
41 m_directory = directory;
42 ControlNet *net = m_directory->project()->activeControl()->controlNet();
43
44 ControlNetVitals *vitals = new ControlNetVitals(net);
45 m_controlHealthMonitorWidget = new ControlHealthMonitorWidget(vitals, parent);
46
47 connect(m_controlHealthMonitorWidget, SIGNAL(openPointEditor(ControlPoint *)),
48 this, SLOT(openPointEditor(ControlPoint *)));
49
50 connect(m_controlHealthMonitorWidget, SIGNAL(openImageEditor(QList<QString>)),
51 this, SLOT(openImageEditor(QList<QString>)));
52
53 setCentralWidget(m_controlHealthMonitorWidget);
54
55 m_permToolBar = new QToolBar("Standard Tools", 0);
56 m_permToolBar->setObjectName("permToolBar");
57 m_permToolBar->setIconSize(QSize(22, 22));
58
59 m_activeToolBar = new QToolBar("Active Tool", 0);
60 m_activeToolBar->setObjectName("activeToolBar");
61 m_activeToolBar->setIconSize(QSize(22, 22));
62
63 m_toolPad = new ToolPad("Tool Pad", 0);
64 m_toolPad->setObjectName("toolPad");
65
66
67// m_ControlHealthMonitorWidget->addToPermanent(m_permToolBar);
68// m_ControlHealthMonitorWidget->addTo(m_activeToolBar);
69// m_ControlHealthMonitorWidget->addTo(m_toolPad);
70
71 m_activeToolBarAction = new QWidgetAction(this);
72 m_activeToolBarAction->setDefaultWidget(m_activeToolBar);
73
74 setAcceptDrops(true);
75
76 setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
77 }
78
79
84
85 return QSize(500, 700);
86 }
87
88
99 ControlPointEditWidget* widget = m_directory->addControlPointEditView()->controlPointEditWidget();
100
101 if (point && point != widget->editPoint()) {
102 widget->setEditPoint(point);
103 }
104
105 // m_directory->addCnetEditorView(m_directory->project()->activeControl());
106 }
107
108
115 void ControlHealthMonitorView::openImageEditor(QList<QString> serials) {
116 CubeDnView *cubeView = m_directory->addCubeDnView();
117 foreach (QString serial, serials) {
118 QList<ImageList*> imageLists = m_directory->project()->images();
119 foreach(ImageList *list, imageLists) {
120 foreach(Image *image, *list) {
121 QString imageSerial = image->serialNumber();
122 if (imageSerial == serial) {
123 ProjectItem *item = m_directory->model()->findItemData(QVariant::fromValue(image));
124 if (item) {
125 cubeView->addItem(item);
126 }
127 }
128 }
129 }
130 }
131 }
132
133
138 delete m_controlHealthMonitorWidget;
139 delete m_permToolBar;
140 delete m_activeToolBar;
141 delete m_toolPad;
142
143 m_permToolBar = 0;
144 m_activeToolBar = 0;
145 m_toolPad = 0;
146 }
147
148
155 return m_controlHealthMonitorWidget;
156 }
157
158
165 return m_permToolBar->actions();
166 }
167
168
175 QList<QAction *> actions;
176 actions.append(m_activeToolBarAction);
177 return actions;
178 }
179
180
187 return m_toolPad->actions();
188 }
189
190
191}
AbstractProjectItemView is a base class for views of a ProjectItemModel in Qt's model-view framework.
void openPointEditor(ControlPoint *point)
This SLOT is designed to intercept the openPointEditor() signal that's emitted Whenever a point is do...
QToolBar * m_permToolBar
The permanent tool bar.
ControlHealthMonitorWidget * controlHealthMonitorWidget()
Returns the ControlHealthMonitorWidget.
virtual QList< QAction * > permToolBarActions()
Returns a list of actions for the permanent tool bar.
virtual QSize sizeHint() const
Return a reasonable size.
ControlHealthMonitorView(Directory *directory, QWidget *parent=0)
Constructor.
QWidgetAction * m_activeToolBarAction
Stores the active tool bar.
virtual QList< QAction * > toolPadActions()
Returns a list of actions for the tool pad.
void openImageEditor(QList< QString > serials)
This SLOT is designed to intercept the openImageEditor() signal that's emitted Whenever an image is d...
QToolBar * m_activeToolBar
The active tool bar.
virtual QList< QAction * > activeToolBarActions()
Returns a list of actions for the active tool bar.
Interface that allows real-time evaluation of the state of a Control Network.
ControlNet * controlNet()
Open and return a pointer to the ControlNet for this Control.
Definition Control.cpp:150
a control network
Definition ControlNet.h:258
ControlPointEditWidget * controlPointEditWidget()
Returns the ControlPointEditWidget.
Gui for editing ControlPoints in ipce application.
void setEditPoint(ControlPoint *controlPoint, QString serialNumber="")
Slot called by Directory to set the control point for editing.
A single control point.
View that displays cubes in a QView-like way.
Definition CubeDnView.h:97
CubeDnView * addCubeDnView(QString objectName="")
Add the qview workspace to the window.
Project * project() const
Gets the Project for this directory.
ProjectItemModel * model()
Gets the ProjectItemModel for this directory.
This represents a cube in a project-based GUI interface.
Definition Image.h:107
QString serialNumber()
Returns the serial number of the Cube.
Definition Image.cpp:361
Internalizes a list of images and allows for operations on the entire list.
Definition ImageList.h:55
static QStringList images(QStringList)
Verify that the input fileNames are image files.
Definition Project.cpp:893
Control * activeControl()
Return the Active Control (control network)
Definition Project.cpp:1902
Represents an item of a ProjectItemModel in Qt's model-view framework.
ProjectItem * findItemData(const QVariant &data, int role=Qt::UserRole+1)
Returns the first item found that contains the given data in the given role or a null pointer if no i...
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16