21 #include <QMessageBox>
25 "org.mitk.views.QmitkUSDeviceManagerWidget";
44 m_Controls =
new Ui::QmitkUSDeviceManagerWidgetControls;
48 m_Controls->m_ConnectedDevices->SetAutomaticallySelectFirstEntry(
true);
52 std::string empty =
"";
54 mitk::USDevice::GetPropertyKeys().US_PROPKEY_LABEL, empty);
61 connect(
m_Controls->m_BtnActivate, SIGNAL(clicked()),
this,
65 connect(
m_Controls->m_BtnRemove, SIGNAL(clicked()),
this,
67 connect(
m_Controls->m_BtnNewDevice, SIGNAL(clicked()),
this,
72 connect(
m_Controls->m_BtnEdit, SIGNAL(clicked()),
this,
88 if (device->GetIsActive())
95 QApplication::setOverrideCursor(Qt::WaitCursor);
100 if (device->GetIsConnected())
104 QApplication::restoreOverrideCursor();
106 if (!device->GetIsActive())
108 QMessageBox::warning(
109 this,
"Activation failed",
110 "Could not activate device. Check logging for details.");
120 m_Controls->m_ConnectedDevices->GetSelectedServiceReference());
132 if (device->GetIsConnected())
134 device->Disconnect();
138 if (!device->Connect())
140 QMessageBox::warning(
141 this,
"Connecting failed",
142 "Could not connect to device. Check logging for details.");
156 if (device->GetDeviceClass() ==
"org.mitk.modules.us.USVideoDevice")
158 if (device->GetIsActive())
160 device->Deactivate();
162 if (device->GetIsConnected())
164 device->Disconnect();
168 ->UnregisterOnService();
193 std::string isConnected =
194 reference.GetProperty(
195 mitk::USDevice::GetPropertyKeys().US_PROPKEY_ISCONNECTED)
197 std::string isActive =
198 reference.GetProperty(
199 mitk::USDevice::GetPropertyKeys().US_PROPKEY_ISACTIVE)
202 if (isActive.compare(
"false") == 0)
205 m_Controls->m_BtnActivate->setText(
"Activate");
210 m_Controls->m_BtnActivate->setText(
"Deactivate");
213 std::string deviceClass =
214 reference.GetProperty(mitk::USDevice::GetPropertyKeys().US_PROPKEY_CLASS)
216 m_Controls->m_BtnRemove->setEnabled(deviceClass ==
217 "org.mitk.modules.us.USVideoDevice");
218 m_Controls->m_BtnEdit->setEnabled((deviceClass ==
"org.mitk.modules.us.USVideoDevice") && (isActive.compare(
"false") == 0));
226 std::vector<us::ServiceReference<mitk::USDevice> > services =
230 it != services.end(); ++it)
235 MITK_INFO <<
"Disconnected ALL US devises!";
A device holds information about it's model, make and the connected probes. It is the common super cl...
A mitk::USVideoDevice is the common class for video only devices. They capture video input either fro...
bool Disconnect()
Works analogously to mitk::USDevice::Connect(). Don't override this Method, but onDisconnection inste...
static ModuleContext * GetModuleContext()
Returns the module context of the calling module.