14 #include <QTreeWidget> 15 #include <QTreeWidgetItem> 16 #include <QStringList> 17 #include <QVBoxLayout> 43 BaseWidget(parent,
"tool_properties_widget",
"Tool Properties")
46 QVBoxLayout* layout =
new QVBoxLayout(
this);
49 layout->addWidget(activeToolWidget);
54 info->layout()->setMargin(0);
55 layout->addWidget(info);
69 BaseWidget(parent,
"ToolCorePropertiesWidget",
"Tool Properties"),
70 mSelector(toolSelector),
71 mTrackingService(trackingService),
72 mSpaceProvider(spaceProvider),
73 mManualToolWidget(NULL)
75 mToptopLayout =
new QVBoxLayout(
this);
85 if (mManualToolWidget)
88 this->setToolTip(
"Tool properties");
92 QHBoxLayout* generalLayout =
new QHBoxLayout;
93 mReferenceStatusLabel =
new QLabel(
"Reference frame <undefined>",
this);
94 generalLayout->addWidget(mReferenceStatusLabel);
95 mTrackingSystemStatusLabel =
new QLabel(
"Tracking <undefined>",
this);
96 generalLayout->addWidget(mTrackingSystemStatusLabel);
98 mToptopLayout->addLayout(generalLayout);
100 QGroupBox* activeGroup =
new QGroupBox(
this);
101 activeGroup->setTitle(
"Tool");
102 mToptopLayout->addWidget(activeGroup);
103 QVBoxLayout* activeGroupLayout =
new QVBoxLayout;
104 activeGroup->setLayout(activeGroupLayout);
106 QHBoxLayout* activeToolLayout =
new QHBoxLayout;
107 activeToolLayout->addWidget(
new QLabel(
"Name:",
this));
108 mToolNameLabel =
new QLabel(
this);
109 activeToolLayout->addWidget(mToolNameLabel);
110 mActiveToolVisibleLabel =
new QLabel(
"Visible: NA");
111 activeToolLayout->addWidget(mActiveToolVisibleLabel);
112 activeGroupLayout->addLayout(activeToolLayout);
114 QGroupBox* manualGroup =
new QGroupBox(
this);
115 manualGroup->setTitle(
"Manual Tool");
116 mToptopLayout->addWidget(manualGroup);
117 QVBoxLayout* manualGroupLayout =
new QVBoxLayout;
118 mManualGroup = manualGroup;
119 manualGroup->setLayout(manualGroupLayout);
120 manualGroupLayout->setMargin(0);
122 manualGroupLayout->addWidget(mManualToolWidget);
127 "Select coordinate system to store position in.");
128 mSpaceSelector->setSpaceProvider(mSpaceProvider);
131 mSpaceSelector->setValue(mSpaceProvider->getPr());
132 manualGroupLayout->addWidget(
new SpaceEditWidget(
this, mSpaceSelector));
136 mToptopLayout->addWidget(mUSSectorConfigBox);
137 mUSSectorConfigBox->hide();
139 QGridLayout* gridLayout =
new QGridLayout;
140 activeGroupLayout->addLayout(gridLayout);
145 mMetadataLabel =
new QTextEdit;
146 mToptopLayout->addWidget(mMetadataLabel);
152 this->reconnectTools();
160 this->updateFrontend();
161 this->toolPositionChanged();
164 void ToolPropertiesWidget::toolPositionChanged()
169 mManualGroup->setVisible(mTool->getVisible());
170 mManualToolWidget->blockSignals(
true);
175 Transform3D qMt = mSpaceProvider->get_toMfrom(space_mt, space_q);
178 mManualToolWidget->blockSignals(
false);
180 this->updateBrowser();
183 QString ToolPropertiesWidget::createDescriptionForTool(
ToolPtr current)
185 bool hasProbe =
false;
186 if(current->getProbe())
188 QString meta = current->getMetadata().toString();
189 return QString(
"Tool=%1: visible=%2 has_probe=%3\n%4\n")
190 .arg(current->getName())
191 .arg(current->getVisible())
196 void ToolPropertiesWidget::updateBrowser()
200 for (TrackingService::ToolMap::iterator i=mTools.begin(); i!=mTools.end(); ++i)
202 text += this->createDescriptionForTool(i->second) +
"\n";
205 int sstart = mMetadataLabel->textCursor().selectionStart();
206 int send = mMetadataLabel->textCursor().selectionEnd();
207 int textPos = mMetadataLabel->textCursor().position();
209 mMetadataLabel->setPlainText(text);
210 QTextCursor cursor = mMetadataLabel->textCursor();
212 cursor.setPosition(sstart, QTextCursor::MoveAnchor);
213 cursor.setPosition(send, QTextCursor::KeepAnchor);
215 mMetadataLabel->setTextCursor(cursor);
227 Transform3D qMpr = mSpaceProvider->get_toMfrom(space_pr, space_q);
230 mTool->set_prMt(prMt);
238 mSpaceSelector->setValue(space);
239 mSpaceSelector->setHelp(QString(
"The space q to display tool position in,\n" 245 void ToolPropertiesWidget::reconnectTools()
247 for (TrackingService::ToolMap::iterator i=mTools.begin(); i!=mTools.end(); ++i)
252 mTools = mTrackingService->getTools();
253 for (TrackingService::ToolMap::iterator i=mTools.begin(); i!=mTools.end(); ++i)
262 mTool = mTrackingService->getTool(mSelector->getValue());
264 mToolOffset->setTool(mTool);
266 mToptopLayout->update();
271 void ToolPropertiesWidget::updateFrontend()
275 mToolNameLabel->setText(
qstring_cast(mTool->getName()));
276 QString text = mTool->getVisible() ?
"Visible" :
"Not Visible";
277 mActiveToolVisibleLabel->setText(text);
281 mToolNameLabel->setText(
"none");
282 mActiveToolVisibleLabel->setText(
"");
285 ToolPtr reference = mTrackingService->getReferenceTool();
288 QString text = reference->getVisible() ?
"Visible" :
"Not Visible";
289 mReferenceStatusLabel->setText(
"Reference " + text);
293 mReferenceStatusLabel->setText(
"Reference is the tracker");
296 QString status =
"Unconfigured";
298 status =
"Configured";
300 status =
"Initialized";
303 mTrackingSystemStatusLabel->setText(
"Tracking status: " + status);
boost::shared_ptr< class SpaceProvider > SpaceProviderPtr
QString qstring_cast(const T &val)
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
boost::shared_ptr< class TrackingService > TrackingServicePtr
static SpacePropertyPtr initialize(const QString &uid, QString name, QString help, Space value=Space(), std::vector< Space > range=std::vector< Space >(), QDomNode root=QDomNode())
static StringPropertyActiveProbeConfigurationPtr New(TrackingServicePtr trackingService)
boost::shared_ptr< class StringPropertyBase > StringPropertyBasePtr
Identification of a Coordinate system.
void changed()
emit when the underlying data value is changed: The user interface will be updated.
Namespace for all CustusX production code.
boost::shared_ptr< class Tool > ToolPtr