8 #include <QScriptValueIterator>
12 m_RunSimpleServer(saver, this,
"runSimpleServer", 1,
"Run Simple Socket Server?"),
13 m_SimpleServerPort(saver, this,
"simpleServerPort", 1234,
"Port for Simple Socket Server"),
18 printf(
"QxrdSimpleServer::QxrdSimpleServer(%p)\n",
this);
30 printf(
"QxrdSimpleServer::~QxrdSimpleServer(%p)\n",
this);
50 if (QThread::currentThread() != thread()) {
51 QMetaObject::invokeMethod(
this,
"runModeChanged");
53 if (get_RunSimpleServer()) {
54 startServer(QHostAddress::Any, get_SimpleServerPort());
63 if (QThread::currentThread() != thread()) {
64 QMetaObject::invokeMethod(
this,
"serverPortChanged");
68 if (get_RunSimpleServer()) {
69 startServer(QHostAddress::Any, get_SimpleServerPort());
79 exp->printMessage(msg, ts);
88 exp->criticalMessage(msg);
95 printMessage(tr(
"Starting simple server on address %1, port %2")
96 .arg(addr.toString()).arg(port));
99 setMaxPendingConnections(1);
105 if (!listen(addr, port)) {
106 criticalMessage(tr(
"Failed to bind to address %1 port %2\nIs there another copy of qxrd running already?").arg(addr.toString()).arg(port));
140 QString
str = ts.readLine();
QSharedPointer< QxrdExperiment > QxrdExperimentPtr
static void readSettings(QObject *object, QSettings *settings, QString section)
qint64 qcepDebug(int cond)
void finishedCommand(QScriptValue result)
QWeakPointer< QxrdExperiment > QxrdExperimentWPtr
void executeCommand(QString cmd)
static QString convertToString(QScriptValue result)
static void writeSettings(QObject *object, QSettings *settings, QString section)
QxrdSimpleServer(QcepSettingsSaverWPtr saver, QxrdExperimentWPtr doc, QString name)
void criticalMessage(QString msg)
virtual ~QxrdSimpleServer()
void printMessage(QString msg, QDateTime ts=QDateTime::currentDateTime())
void startServer(QHostAddress addr, int port)
virtual void writeSettings(QSettings *settings, QString section)
void valueChanged(int val, int index)
QxrdExperimentWPtr m_Experiment
QWeakPointer< QcepSettingsSaver > QcepSettingsSaverWPtr
virtual void readSettings(QSettings *settings, QString section)