EditorPipe::EditorPipe() : QThread(NULL) { if(!ipServer) ipServer = new IntProcServer(); ipServer->listen(QHostAddress::LocalHost, 58486); while(ipServer->isListening() == false) { ipServer->listen(QHostAddress::LocalHost); msleep(100); } qDebug() << "Listen " << ipServer->isListening() << "localhost:58486"; qDebug() << "Construct interprocess pipe"; do_acceptLevelData=false; do_parseLevelData=false; accepted_lvl_raw=""; accepted_lvl.ReadFileValid = false; isWorking = false; lastMsgSuccess=true; levelAccepted=false; connect(ipServer, SIGNAL(messageIn(QString)), this, SLOT(slotOnData(QString))); connect(this, SIGNAL(sendMessage(QString)), ipServer, SLOT(writeMessage(QString))); }
void OSCServer::setPort(int port) { this->serverPort = port; serverThread = std::unique_ptr<OSCServerThread>(new OSCServerThread(port)); connect(serverThread.get(), SIGNAL(messageIn(QVariant)), this, SLOT(gotMessageInFromNetwork(QVariant))); }
void IpsEngineClient::readyRead() { if(!socket) return; qDebug() << "reading..."; // read the data from the socket QByteArray arr = socket->readAll(); emit messageIn(QString::fromUtf8(arr)); }
void IntProcServer::readData() { QObject * object = QObject::sender(); // далее и ниже до цикла идет преобразования "отправителя сигнала" в сокет, дабы извлечь данные if (!object) return; QTcpSocket * socket = static_cast<QTcpSocket *>(object); QByteArray arr = socket->readAll(); emit messageIn(QString::fromUtf8(arr)); }
void OSCServerThread::run() { oscpkt::UdpSocket server; server.bindTo(this->port); if (!server.isOk()) { std::cerr << "Error opening OSC server at " << port << std::endl; return; } std::cout << "Started OSC Server at " << port << std::endl; oscpkt::PacketReader reader; oscpkt::PacketWriter writer; while (server.isOk() && !mustQuit) { if (server.receiveNextPacket(30)) { reader.init(server.packetData(), server.packetSize()); oscpkt::Message *msg; while (reader.isOk() && (msg = reader.popMessage()) != 0) { QVariantList message; message.append(QString::fromStdString( msg->addressPattern())); auto args = msg->arg(); while (!args.isOkNoMoreArgs()) { if (args.isInt32()) { int32_t i; args = args.popInt32(i); message.append(i); } else if (args.isInt64()) { int64_t i; args = args.popInt64(i); message.append( static_cast<qlonglong>(i)); } else if (args.isFloat()) { float f; args = args.popFloat(f); message.append(f); } else if (args.isDouble()) { double d; args = args.popDouble(d); message.append(d); } else if (args.isStr()) { std::string s; args = args.popStr(s); message.append( QString::fromStdString(s)); } } emit messageIn(message); } } } }
PanelConfig::PanelConfig(QWidget *parent) : QWidget(parent), ui(new Ui::PanelConfig) { ui->setupUi(this); connect(ui->configList, SIGNAL(currentRowChanged(int)), this, SLOT(selectConfig(int))); connect(ui->configTable, SIGNAL(cellClicked(int,int)), this, SLOT(selectDescription(int,int))); connect(this, SIGNAL(initializePanel(QMap<QString,QString>)), this, SLOT(initialize(QMap<QString,QString>))); connect(this, SIGNAL(messageIn(QByteArray)), this, SLOT(parseMessage(QByteArray))); connect(this, SIGNAL(connectionState(bool)), this, SLOT(updateConnectionState(bool))); }
PanelMonitor::PanelMonitor(QWidget *parent) : QWidget(parent), ui(new Ui::PanelMonitor) { ui->setupUi(this); ui->console->setReadOnly(true); ui->console->setMaximumBlockCount(1024); ui->console->setWordWrapMode(QTextOption::NoWrap); connect(ui->commandLine, SIGNAL(returnPressed()), this, SLOT(on_sendButton_clicked())); connect(this, SIGNAL(initializePanel(QMap<QString,QString>)), this, SLOT(initialize(QMap<QString,QString>))); connect(this, SIGNAL(messageIn(QByteArray)), this, SLOT(parseMessage(QByteArray))); connect(this, SIGNAL(connectionState(bool)), this, SLOT(updateConnectionState(bool))); }
/** * @brief EngineClient::~LocalServer * Destructor */ EngineClient::~EngineClient() { if(ipClient) { disconnect(this, SIGNAL(sendMessage(QString)), ipClient, SLOT(sendMessage(QString))); disconnect(ipClient, SIGNAL(messageIn(QString)), this, SLOT(slotOnData(QString))); disconnect(this, SIGNAL(closed()), ipClient, SLOT(doClose())); disconnect(this, SIGNAL(open()), ipClient, SLOT(doOpen())); disconnect(ipClient, SIGNAL(closeThread()), this, SLOT(connectionLost())); delete ipClient; } ipClient=NULL; }
EngineClient::EngineClient() : QThread(NULL) { if(!ipClient) { ipClient = new IpsEngineClient(); connect(this, SIGNAL(sendMessage(QString)), ipClient, SLOT(sendMessage(QString))); connect(ipClient, SIGNAL(messageIn(QString)), this, SLOT(slotOnData(QString))); connect(this, SIGNAL(closed()), ipClient, SLOT(doClose())); connect(this, SIGNAL(open()), ipClient, SLOT(doOpen())); connect(ipClient, SIGNAL(closeThread()), this, SLOT(connectionLost())); } readyToSendLvlx = false; _connected = false; _busy = false; working=false; doSendData = false; }
PanelFirmware::PanelFirmware(QWidget *parent) : QWidget(parent), ui(new Ui::PanelFirmware) { ui->setupUi(this); scroll = false; upload = new QProcess(this); connect(this, SIGNAL(initializePanel(QMap<QString,QString>)), this, SLOT(initialize(QMap<QString,QString>))); connect(this, SIGNAL(messageIn(QByteArray)), this, SLOT(parseMessage(QByteArray))); connect(this, SIGNAL(connectionState(bool)), this, SLOT(updateConnectionState(bool))); connect(upload, SIGNAL(readyReadStandardOutput()), this, SLOT(printConsole())); connect(upload, SIGNAL(readyReadStandardError()), this, SLOT(printErrors())); connect(ui->webView->page(), SIGNAL(loadStarted()), this, SLOT(startFirmwareUpload())); connect(ui->webView->page(), SIGNAL(loadProgress(int)), this, SLOT(scrollToBottom(int))); connect(ui->webView->page(), SIGNAL(loadFinished(bool)), this, SLOT(downloadFirmware(bool))); connect(&networkManager, SIGNAL(finished(QNetworkReply *)), this, SLOT(firmwareDownloaded(QNetworkReply*))); QFont consoleFont = ui->console->font(); consoleFont.setPointSize(12); ui->console->setFont(consoleFont); ui->console->append("To return the board it's default factory configuration, select the Bootloader button. To upload existing firmware, select the Firmware button.\n\nTo create and upload new firmware, complete the selections below. You will need to be connected to the internet for this feature."); }
PanelPlot::PanelPlot(QWidget *parent) : QWidget(parent), ui(new Ui::PanelPlot) { connect(this, SIGNAL(initializePanel(QMap<QString,QString>)), this, SLOT(initialize(QMap<QString,QString>))); connect(this, SIGNAL(messageIn(QByteArray)), this, SLOT(parseMessage(QByteArray))); connect(this, SIGNAL(connectionState(bool)), this, SLOT(updateConnectionState(bool))); timeAxisLength = 15; // seconds ui->setupUi(this); ui->plotWindow->xAxis->setTickLabelType(QCPAxis::ltDateTime); ui->plotWindow->xAxis->setDateTimeFormat("hh:mm:ss"); ui->plotWindow->xAxis->setAutoTickStep(false); ui->plotWindow->xAxis->setTickStep(2); ui->plotWindow->axisRect()->setupFullAxesBox(); ui->plotWindow->autoAddPlottableToLegend(); ui->plotWindow->legend->setVisible(true); ui->plotWindow->axisRect()->insetLayout()->setInsetAlignment(0, Qt::AlignLeft|Qt::AlignTop); ui->plotWindow->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom | QCP::iSelectPlottables); //Should we read this from file? colorNames.append("blue"); colorNames.append("red"); colorNames.append("green"); colorNames.append("orange"); colorNames.append("purple"); colorNames.append("brown"); colorNames.append("light blue"); colorNames.append("light red"); colorNames.append("lime"); colorNames.append("violet"); //setupPlotNames(0); connect(ui->plotWindow->xAxis, SIGNAL(rangeChanged(QCPRange)), ui->plotWindow->xAxis2, SLOT(setRange(QCPRange))); connect(ui->plotWindow->yAxis, SIGNAL(rangeChanged(QCPRange)), ui->plotWindow->yAxis2, SLOT(setRange(QCPRange))); connect(ui->plotTypes, SIGNAL(currentRowChanged(int)), this, SLOT(initializePlot(int))); connect(ui->plotTypes, SIGNAL(currentRowChanged(int)), this, SLOT(setupPlotNames(int))); connect(ui->plotNames, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(selectPlot(QListWidgetItem*))); }
void OSCServer::gotMessageInFromNetwork(QVariant data) { emit messageIn(data); }