Of course sorry:
I didnt change writing to the slot only reading from it.
array = socket->readAll();
quint32 dataType;
*streamOut >> dataType;
qDebug() << "data thread dataType" << dataType;
if (dataType == Data::PluginData)
emit pluginDataIn(streamOut);
...
...
QByteArray array;
array = socket->readAll();
QDataStream *streamOut = new QDataStream(array);
streamOut->setVersion(QDataStream::Qt_4_4);
quint32 dataType;
*streamOut >> dataType;
qDebug() << "data thread dataType" << dataType;
if (dataType == Data::PluginData)
emit pluginDataIn(streamOut);
...
connect(connection, SIGNAL(pluginDataIn(QDataStream*)), plugins, SLOT(dataIn(QDataStream*)));
...
To copy to clipboard, switch view to plain text mode
{
*streamOut >> name;
qDebug() << name;
quint32 type;
*streamOut >> type;
qDebug() << type;
Menu *menu = menus.value(name);
if(!menu)
{
qDebug() << "return menu";
return;
}
menu->readData(streamOut);
void Plugins::dataIn(QDataStream* streamOut)
{
QString name;
*streamOut >> name;
qDebug() << name;
quint32 type;
*streamOut >> type;
qDebug() << type;
Menu *menu = menus.value(name);
if(!menu)
{
qDebug() << "return menu";
return;
}
menu->readData(streamOut);
To copy to clipboard, switch view to plain text mode
{
if (!isListening)
return;
window->getData(stream);
showWindow();
}
{
quint32 data;
*streamOut >> data;
qDebug() << "viewer window data" << quint32(data);
switch (data)
{
case ViewerWindow::NewImage :
setImage(streamOut);
break;
case ViewerWindow::Pixels :
setPixels(streamOut);
break;
case ViewerWindow::Stop :
clearImage();
emit closing();
break;
}
void ProgramViewerMenu::readData(QDataStream* stream)
{
if (!isListening)
return;
window->getData(stream);
showWindow();
}
void ViewerWindow::getData(QDataStream* streamOut)
{
quint32 data;
*streamOut >> data;
qDebug() << "viewer window data" << quint32(data);
switch (data)
{
case ViewerWindow::NewImage :
setImage(streamOut);
break;
case ViewerWindow::Pixels :
setPixels(streamOut);
break;
case ViewerWindow::Stop :
clearImage();
emit closing();
break;
}
To copy to clipboard, switch view to plain text mode
I hope it helps.
But I will be pleased if it could be do in other way than passing QDataStream*. Maybe somehow use QByteArray or another class I dont know.
Bookmarks