void SerialPort::connects()
{
    connect(serial, SIGNAL(readyRead()), this, SLOT(lineReceived()));
    connect(serial, SIGNAL(error(QSerialPort::SerialPortError)),
            this, SLOT(serialError(QSerialPort::SerialPortError)));

    connect(timer, SIGNAL(timeout()), this, SLOT(onTimerTimeout()));
}
Beispiel #2
0
void NonNativeIrcEngine::relayReadyRead() {
	QString bulk;
	QString line;
	while (sock->canReadLine()) {
		/* On ajoute à la masse que si non PING/PONG :) */
		if (returnLine(line)) bulk += line;
	}
		emit lineReceived(bulk);
}
Beispiel #3
0
void Client::read()
{
	buffer += socket->read(socket->bytesAvailable());
	if (buffer.endsWith('\n')) {
		QString line{buffer};
		emit lineReceived(QString{"Received: %1"}.arg(line));
		buffer.clear();
	}
}
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    resetPortList();

    //////////////////////////////////////////////////// for .svg display
    scene = new QGraphicsScene(this);
    ui->graphicsView->setScene(scene);
    ////////////////////////////////////////////////////

    this->bot = new spherebot();
    Receiver = new rxThread(this->bot);

    penDownAngle = DEFAULTPENDOWN;
    penUpAngle = DEFAULTPENUP;

    layerIndex = 0;

    connect(bot->port,  SIGNAL(readyRead()), Receiver,      SLOT(receiveData()));
    connect(bot,        SIGNAL(dataSent(QString)),this,     SLOT(sendDataUI(QString)));
    connect(bot,        SIGNAL(progressChanged(int)),this,  SLOT(refreshSendProgress(int)));
    //connect(bot,        SIGNAL(fileTransmitted()),this,     SLOT(finishedTransmission()));
    connect(Receiver,   SIGNAL(lineReceived(QString)),this, SLOT(processReceivedData(QString)));
    connect(Receiver,   SIGNAL(lineReceived(QString)),this->bot,  SLOT(processAnswer(QString)));

    initUI();
    initSateMachine();

    if(LoadSettings())
    {
        FitInTimer.setInterval(10);
        FitInTimer.setSingleShot(true);
        connect(&FitInTimer,SIGNAL(timeout()),this,SLOT(fitgraphicsView()));
        FitInTimer.start();
    }

    setWindowTitle("Spherebot Controll");

    qDebug()<<"mainwindow initialised: ";
    connect(restartLayerMsgBox,SIGNAL(accepted()),this,SLOT(hey()));
}
Beispiel #5
0
rfid::rfid(QObject *parent, QString port, int baudrate) :
    QObject(parent)
{
    serial = new QAsyncSerial(port, baudrate);

    connect(serial, SIGNAL(lineReceived(QString)),
            this, SLOT(receiveID(QString)));

    sendReset();
}
mainwindow::mainwindow(QWidget *parent, Qt::WFlags flags)
	: QMainWindow(parent, flags)
{
	ui.setupUi(this);
	//QTimer *timer = new QTimer(this);
	//connect(timer, SIGNAL(timeout()), this, SLOT(try_receive()));
	connect(&newport,SIGNAL(lineReceived(QString)),
		this,SLOT(onlineReceived(QString)));
	//timer->start(250);
	mainwindow::try_receive();
	mainwindow::initialize_maxmins();
	initialize_spacing();
	checkbox_enables();
}
void ConsoleReader::run()
{
    QTextStream stream(stdin);
    QString line;

    m_stop_requested = false;

    forever
    {
        if (isStopRequested()) break;
        line = stream.readLine();
        if (line.isNull()) continue;
        emit lineReceived(line);
    }
}
void QAsyncSerial::readCallback(const char *data, size_t size)
{
    pimpl->receivedData+=QString::fromAscii(data,size);
    if(pimpl->receivedData.contains('\n'))
    {
        QStringList lineList=pimpl->receivedData.split(QRegExp("\r\n|\n"));
        //If line ends with \n lineList will contain a trailing empty string
        //otherwise it will contain part of a line without the terminating \n
        //In both cases lineList.at(lineList.size()-1) should not be sent
        //with emit.
        int numLines=lineList.size()-1;
        pimpl->receivedData=lineList.at(lineList.size()-1);
        for(int i=0;i<numLines;i++)
        {
            emit lineReceived(lineList.at(i));
        }
    }
}
Beispiel #9
0
/*!
 * \fn int main(int argc, char **argv)
 * Fonction principale
 * \return Le code de fin d'execution de la main loop.
 */
int main (int argc,char **argv) {
    QApplication app(argc,argv);

    MainWindow *fen = new MainWindow(NULL);

    IIrcEngine *engine = NonNativeIrcEngine::engine();



    QObject::connect(fen,
    		SIGNAL(connectMe(const QString&, int, const QString&)),
    		engine,
    		SLOT(initiateConnection(const QString&, int, const QString&)));
    QObject::connect(engine, SIGNAL(lineReceived(QString)), fen, SLOT(readServer(QString)));
    QObject::connect(fen, SIGNAL(sendASCIIMessage(const QString&)), engine, SLOT(sendASCIIMessage(const QString&)));
	/* La QMainWindow */
	MainWindowView *mW = new MainWindowView(fen,NULL);
	mW->show();

	XmlConfManager *confMan = XmlConfManager::confManager();
	/*confMan->addServer("test");
	confMan->addNetwork("test", confMan->createNetwork("irc.fansub-irc.eu", "6667"));
	confMan->changeUser("test", confMan->createUser("pierre", "pierreghost", "user", "real"));
	confMan->changeFavChan("test", "#fsf,#Kyubi-Wolf");
	confMan->changeCommand("test", "/ns identify albachat");
	confMan->save();*/
	confMan->read();

	ServerList *serverList = new ServerList();
	QObject::connect(serverList, SIGNAL(connectSignal(QString&, int, QString&)),
					 fen, SLOT(connexion(QString&, int, QString&)));
	QObject::connect(engine, SIGNAL(connectError()),
					 serverList, SLOT(reconnect()));
	serverList->show();

    return app.exec();
    }