28 #include <Ice/Initialize.h>
29 #include <IceStorm/IceStorm.h>
36 #include <ArmarXGui/libraries/ArmarXGuiBase/ui_IceProxyFinder.h>
55 if (
impl->refreshProxyListTask)
57 impl->refreshProxyListTask->stop(
true);
65 this->
impl->icemanager = icemanager;
75 return ui->cbProxyName->currentText();
81 ui->cbProxyName->setEditText(proxyName);
87 impl->defaultItem = proxyName;
93 ui->edtSearchMask->setText(searchMask);
99 ui->edtSearchMask->setVisible(show);
100 ui->labelMask->setVisible(show);
106 ui->labelMask->setVisible(show);
107 ui->labelProxy->setVisible(show);
110 ::Ui::IceProxyFinder*
119 return ui->cbProxyName;
125 if (searchMask.length() == 0)
130 Ice::StringSeq proxyList;
131 QStringList qProxyList;
132 if (!
impl->icemanager)
134 throw LocalException(
"IceManager must not be NULL");
136 auto searchMasks =
Split(searchMask.toStdString(),
"|");
137 for (
auto& subSearchMasks : searchMasks)
139 if (
impl->icemanager &&
impl->icemanager->getIceGridSession())
143 IceGrid::AdminPrx admin = iceGridSession->getAdmin();
144 Ice::AsyncResultPtr localBegin_getAllObjectInfos =
145 admin->begin_getAllObjectInfos(subSearchMasks);
146 while (!localBegin_getAllObjectInfos->isCompleted())
148 if (
impl->refreshProxyListTask->isStopped())
154 IceGrid::ObjectInfoSeq objects =
155 admin->end_getAllObjectInfos(localBegin_getAllObjectInfos);
156 Ice::StringSeq tempProxyList;
158 for (
auto&
object : objects)
163 if (
impl->refreshProxyListTask->isStopped())
168 if (!typedName.empty())
170 tempProxyList.push_back(typedName);
179 proxyList.insert(proxyList.end(), tempProxyList.begin(), tempProxyList.end());
184 for (
unsigned int i = 0; i < proxyList.size(); ++i)
186 qProxyList << QString::fromStdString(proxyList.at(i));
188 qProxyList.removeDuplicates();
195 if (
impl->refreshProxyListTask &&
impl->refreshProxyListTask->isRunning())
200 ui->btnRefresh->setEnabled(
false);
201 ui->btnRefresh->setToolTip(
"Refreshing proxy list with mask '" +
ui->edtSearchMask->text() +
202 "'. Please wait...");
203 impl->refreshProxyListTask =
205 impl->refreshProxyListTask->start();
217 ui->cbProxyName->clear();
218 if (not
impl->defaultItem.isEmpty())
220 ui->cbProxyName->addItem(
impl->defaultItem);
221 ui->cbProxyName->setCurrentIndex(0);
225 for (; i < proxyList.size(); ++i)
227 if (proxyList.at(i) !=
impl->defaultItem)
229 ui->cbProxyName->addItem(proxyList.at(i));
233 ui->btnRefresh->setEnabled(
true);
234 ui->btnRefresh->setToolTip(
235 "Press to refetch all available Kinematic Units with the given mask");
244 IceGrid::AdminPrx admin = this->
impl->icemanager->getIceGridSession()->getAdmin();
245 Ice::Identity objectIceId = Ice::stringToIdentity(proxyName.toStdString());
246 Ice::ObjectPrx objPrx = admin->getObjectInfo(objectIceId).proxy;
264 if (!
impl->refreshProxyListTask->isStopped())
273 this->
ui->setupUi(
this);
283 this->connect(this->
ui->edtSearchMask,
284 SIGNAL(textEdited(QString)),
294 this->connect(this->
ui->cbProxyName,
295 SIGNAL(editTextChanged(QString)),
298 this->connect(this->
ui->cbProxyName,
299 SIGNAL(currentIndexChanged(QString)),
306 ui->labelProxy->setText(
"Topic");
312 if (searchMask.length() == 0)
317 IceStorm::TopicDict topicList;
319 if (!
impl->icemanager)
321 throw LocalException(
"IceManager must not be NULL");
324 if (
impl->icemanager &&
impl->icemanager->getIceGridSession())
326 topicList =
impl->icemanager->getTopicManager()->retrieveAll();
329 QStringList qProxyList;
331 for (
auto& e : topicList)
333 auto name = QString::fromStdString(e.first);
334 QRegExp rex(searchMask, Qt::CaseInsensitive, QRegExp::Wildcard);
336 if (name.contains(rex))