42 #include "igtl_header.h"
57 mThread.reset(
new QThread());
58 mThread->setObjectName(threadname);
61 mClient->moveToThread(mThread.get());
63 mOptions = options.
descend(mClient->getUid());
65 mIp = this->createIpOption();
66 mPort = this->createPortOption();
67 mProtocols = this->createDialectOption();
68 mRole = this->createRoleOption();
70 this->onPropertiesChanged();
75 void NetworkConnectionHandle::onPropertiesChanged()
78 info.
role = mRole->getValue();
79 info.
host = mIp->getValue();
80 info.
port = mPort->getValue();
81 info.
protocol = mProtocols->getValue();
83 mClient->setConnectionInfo(info);
86 void NetworkConnectionHandle::onConnectionInfoChanged()
88 NetworkConnection::ConnectionInfo info = mClient->getConnectionInfo();
89 mRole->setValue(info.role);
90 mIp->setValue(info.host);
91 mPort->setValue(info.port);
92 mProtocols->setValue(info.protocol);
106 return mClient.get();
112 QStringList dialectnames;
114 dialectnames = mClient->getAvailableDialects();
116 mClient->getConnectionInfo().protocol,
118 retval->setValueRange(dialectnames);
119 retval->setGroup(
"Connection");
120 connect(retval.get(), &
Property::changed,
this, &NetworkConnectionHandle::onPropertiesChanged);
128 mClient->getConnectionInfo().host,
130 retval->setGroup(
"Connection");
131 connect(retval.get(), &
Property::changed,
this, &NetworkConnectionHandle::onPropertiesChanged);
139 int defval = mClient->getConnectionInfo().port;
141 "Network Port (default "+QString::number(defval)+
")",
143 DoubleRange(1024, 49151, 1), 0,
146 retval->setAdvanced(
true);
147 retval->setGroup(
"Connection");
148 connect(retval.get(), &
Property::changed,
this, &NetworkConnectionHandle::onPropertiesChanged);
155 QStringList values = QStringList() <<
"client" <<
"server";
157 "Act as client or server in the network connection",
158 mClient->getConnectionInfo().role,
160 retval->setGroup(
"Connection");
161 connect(retval.get(), &
Property::changed,
this, &NetworkConnectionHandle::onPropertiesChanged);
NetworkConnection * getNetworkConnection()
QDomElement getElement()
return the current element
boost::shared_ptr< class StringProperty > StringPropertyPtr
boost::shared_ptr< class StringPropertyBase > StringPropertyBasePtr
~NetworkConnectionHandle()
boost::shared_ptr< class DoublePropertyBase > DoublePropertyBasePtr
NetworkConnectionHandle(QString threadname, XmlOptionFile options)
void connectionInfoChanged()
void changed()
emit when the underlying data value is changed: The user interface will be updated.
static StringPropertyPtr initialize(const QString &uid, QString name, QString help, QString value, QStringList range, QDomNode root=QDomNode())
boost::shared_ptr< class DoubleProperty > DoublePropertyPtr
The NetworkConnection class handles incoming OpenIGTLink packages.
static DoublePropertyPtr initialize(const QString &uid, QString name, QString help, double value, DoubleRange range, int decimals, QDomNode root=QDomNode())
Helper class for xml files used to store ssc/cx data.
XmlOptionFile descend(QString element) const
step one level down in the xml tree