35 #include <QPushButton>
40 #include "boost/bind.hpp"
47 BaseWidget(parent,
"OpenIGTLinkConnectionWidget",
"OpenIGTLink Connection"),
55 mConnectButton =
new QPushButton(
"Connect",
this);
56 mConnectButton->setCheckable(
true);
57 connect(mConnectButton, &QPushButton::clicked,
this, &NetworkConnectionWidget::connectButtonClicked);
61 QVBoxLayout* topLayout =
new QVBoxLayout(
this);
63 mOptionsWidget =
new QWidget(
this);
64 QVBoxLayout* optionsLayout =
new QVBoxLayout(mOptionsWidget);
65 optionsLayout->setMargin(0);
66 topLayout->addWidget(mOptionsWidget);
68 QHBoxLayout* hostipLayout =
new QHBoxLayout;
69 optionsLayout->addLayout(hostipLayout);
74 topLayout->addWidget(mConnectButton);
75 topLayout->addStretch();
77 this->onStateChanged(mClient->getNetworkConnection()->getState());
89 "<h3>Connect to an OpenIGTLink server</h3>"
91 "Specify the ip address and port of the server you want to connect to. "
102 QString action = (state==
scsINACTIVE) ?
"Connect" :
"Disconnect";
104 mConnectButton->blockSignals(
true);
107 mConnectButton->setText(QString(
"%1 (%2)").arg(action).arg(status));
108 mConnectButton->blockSignals(
false);
113 void NetworkConnectionWidget::connectButtonClicked(
bool checked)
118 mClient->getNetworkConnection()->invoke(connect);
123 mClient->getNetworkConnection()->invoke(disconnect);
QString qstring_cast(const T &val)
CX_SOCKETCONNECTION_STATE
void stateChanged(CX_SOCKETCONNECTION_STATE status)
virtual void requestDisconnect()
not thread-safe: use invoke
virtual void requestConnect()
not thread-safe: use invoke
boost::shared_ptr< class StringPropertyBase > StringPropertyBasePtr
boost::shared_ptr< class DoublePropertyBase > DoublePropertyBasePtr
boost::shared_ptr< class NetworkConnectionHandle > NetworkConnectionHandlePtr