41 #include "QApplication"
54 std::vector<PropertyPtr> retval;
65 bool defaultValue =
true;
67 bool defaultValue =
false;
71 "Run streamer in a separate process",
73 retval->setAdvanced(
false);
74 retval->setGroup(
"Connection");
80 QString filename =
"OpenIGTLinkServer";
85 QStringList paths = QStringList() << qApp->applicationDirPath();
93 "Name of server executable, used only if Run Local Server is set.",
97 retval->setAdvanced(
false);
98 retval->setGroup(
"Connection");
114 QStringList cmdlineArguments;
115 for (StringMap::iterator i=args.begin(); i!=args.end(); ++i)
116 cmdlineArguments << i->first << i->second;
119 QString localServer = localServerProp->getEmbeddedPath().getAbsoluteFilepath();
120 boost::shared_ptr<LocalServerStreamer> streamer;
127 mServerName(serverName),
128 mServerArguments(serverArguments)
130 mLocalVideoServerProcess.reset(
new ProcessWrapper(QString(
"Local Video Server: %1").arg(mServerName)));
133 int defaultport = 18333;
134 igtLinkStreamer->setAddress(
"Localhost", defaultport);
135 mBase = igtLinkStreamer;
146 mLocalVideoServerProcess->launchWithRelativePath(mServerName, mServerArguments.split(
" "));
149 void LocalServerStreamer::processStateChanged()
151 if(mLocalVideoServerProcess->isRunning())
152 mBase->startStreaming(
mSender);
157 mBase->stopStreaming();
159 if (mLocalVideoServerProcess->getProcess())
161 mLocalVideoServerProcess->getProcess()->close();
162 mLocalVideoServerProcess.reset();
168 return localVideoServerIsRunning();
171 bool LocalServerStreamer::localVideoServerIsRunning()
173 if (!mLocalVideoServerProcess || !mLocalVideoServerProcess->getProcess())
175 return this->mLocalVideoServerProcess->isRunning();
static BoolPropertyPtr initialize(const QString &uid, QString name, QString help, bool value, QDomNode root=QDomNode())
FilePathPropertyPtr getLocalServerNameOption(QDomElement root)
virtual void stopStreaming()
static StreamerPtr createStreamerIfEnabled(QDomElement root, StringMap args)
LocalServerStreamer(QString serverName, QString serverArguments)
BoolPropertyBasePtr getRunLocalServerOption(QDomElement root)
virtual void startStreaming(SenderPtr sender)
std::map< QString, QString > StringMap
boost::shared_ptr< class BoolPropertyBase > BoolPropertyBasePtr
virtual bool isStreaming()
static FilePathPropertyPtr initialize(const QString &uid, QString name, QString help, QString value, QStringList paths, QDomNode root=QDomNode())
virtual ~LocalServerStreamer()
boost::shared_ptr< class FilePathProperty > FilePathPropertyPtr
boost::shared_ptr< class BoolProperty > BoolPropertyPtr
boost::shared_ptr< Sender > SenderPtr
static QString getBundlePath()
return the folder where the bundle or executable are located.
boost::shared_ptr< class Streamer > StreamerPtr
std::vector< PropertyPtr > getSettings(QDomElement root)