Exemplo n.º 1
0
wpHdMap::wpHdMap(QWidget *parent) : QWizardPage(parent)
{
  setupUi(this);
  backend = Backend::instance();
  connect(backend, SIGNAL(receivedDataLine(QString,QString)), this, SLOT(receivedDataLine(QString,QString)));
  connect(backend, SIGNAL(receivedCommand(QString,QString)), this, SLOT(receivedCommand(QString,QString)));
  connect(backend, SIGNAL(finishedCommand(QString)), this, SLOT(backendFinishedCommand(QString)));
  tableWidget->horizontalHeader()->setResizeMode(QHeaderView::Stretch);

  checkPassed = false;
}
Exemplo n.º 2
0
void StdInListenerWin::run()
{
    TRACE_OBJ
    bool ok = true;
    char chBuf[4096];
    DWORD dwRead;

#ifndef Q_OS_WINCE
    HANDLE hStdin, hStdinDup;

    hStdin = GetStdHandle(STD_INPUT_HANDLE);
    if (hStdin == INVALID_HANDLE_VALUE)
        return;

    DuplicateHandle(GetCurrentProcess(), hStdin,
        GetCurrentProcess(), &hStdinDup,
        0, false, DUPLICATE_SAME_ACCESS);

    CloseHandle(hStdin);
#else
    HANDLE hStdinDup;
    hStdinDup = stdin;
#endif

    while (ok) {
        ok = ReadFile(hStdinDup, chBuf, sizeof(chBuf), &dwRead, NULL);
        if (ok && dwRead != 0)
            emit receivedCommand(QString::fromLocal8Bit(chBuf, dwRead));
    }
}
Exemplo n.º 3
0
void Server::incomingConnection( const qintptr socketHandle )
{
    QThread* workerThread = new QThread( this );
    ServerWorker* worker = new ServerWorker( socketHandle );

    worker->moveToThread( workerThread );

    connect( workerThread, SIGNAL( started( )),
             worker, SLOT( initConnection( )));
    connect( worker, SIGNAL( connectionClosed( )),
             workerThread, SLOT( quit( )));

    // Make sure the thread will be deleted
    connect( workerThread, SIGNAL( finished( )), worker, SLOT( deleteLater( )));
    connect( workerThread, SIGNAL( finished( )),
             workerThread, SLOT( deleteLater( )));

    // public signals/slots, forwarding from/to worker
    connect( worker, SIGNAL( registerToEvents( QString, bool,
                                               deflect::EventReceiver* )),
             this, SIGNAL( registerToEvents( QString, bool,
                                             deflect::EventReceiver* )));
    connect( this, SIGNAL( _pixelStreamerClosed( QString )),
             worker, SLOT( closeConnection( QString )));
    connect( this, SIGNAL( _eventRegistrationReply( QString, bool )),
             worker, SLOT( replyToEventRegistration( QString, bool )));

    // Commands
    connect( worker, SIGNAL( receivedCommand( QString, QString )),
             &_impl->commandHandler, SLOT( process( QString, QString )));

    // PixelStreamDispatcher
    connect( worker, SIGNAL( addStreamSource( QString, size_t )),
             &_impl->pixelStreamDispatcher, SLOT(addSource( QString, size_t )));
    connect( worker,
             SIGNAL( receivedSegement( QString, size_t, deflect::Segment )),
             &_impl->pixelStreamDispatcher,
             SLOT( processSegment( QString, size_t, deflect::Segment )));
    connect( worker,
             SIGNAL( receivedFrameFinished( QString, size_t )),
             &_impl->pixelStreamDispatcher,
             SLOT( processFrameFinished( QString, size_t )));
    connect( worker,
             SIGNAL( removeStreamSource( QString, size_t )),
             &_impl->pixelStreamDispatcher,
             SLOT( removeSource( QString, size_t )));

    workerThread->start();
}
Exemplo n.º 4
0
void StdInListener::receivedData()
{
    TRACE_OBJ
    QByteArray ba;
    while (true) {
        const int c = getc(stdin);
        if (c == EOF) {
            setEnabled(false);
            break;
        }
        if (c == '\0')
            break;
        if (c)
            ba.append(char(c));
         if (c == '\n')
             break;
    }
    emit receivedCommand(QString::fromLocal8Bit(ba));
}
Exemplo n.º 5
0
QT_BEGIN_NAMESPACE

RemoteControl::RemoteControl(MainWindow *mainWindow)
    : QObject(mainWindow)
    , m_mainWindow(mainWindow)
    , m_debug(false)
    , m_caching(true)
    , m_syncContents(false)
    , m_expandTOC(-2)
    , helpEngine(HelpEngineWrapper::instance())

{
    TRACE_OBJ
    connect(m_mainWindow, SIGNAL(initDone()), this, SLOT(applyCache()));

    StdInListener *l = new StdInListener(this);
    connect(l, SIGNAL(receivedCommand(QString)),
        this, SLOT(handleCommandString(QString)));
    l->start();
}
void IPCThread_Recv::run()
{
	setTerminationEnabled(true);
	QStringList params;
	quint32 command, flags;

	while(!m_stopFlag)
	{
		if(m_ipcChannel->read(command, flags, params))
		{
			if(command != IPC_OPCODE_NOOP)
			{
				emit receivedCommand(command, params, flags);
			}
		}
		else
		{
			qWarning("Failed to read next IPC message!");
			break;
		}
	}
}
Exemplo n.º 7
0
RemoteControl::RemoteControl(MainWindow *mainWindow)
    : QObject(mainWindow)
    , m_mainWindow(mainWindow)
    , m_debug(false)
    , m_caching(true)
    , m_syncContents(false)
    , m_expandTOC(-2)
    , helpEngine(HelpEngineWrapper::instance())

{
    TRACE_OBJ
    connect(m_mainWindow, SIGNAL(initDone()), this, SLOT(applyCache()));
#ifdef Q_OS_WIN
    StdInListenerWin *l = new StdInListenerWin(this);
    connect(l, SIGNAL(receivedCommand(QString)),
        this, SLOT(handleCommandString(QString)));
    l->start();
#else
    QSocketNotifier *notifier = new QSocketNotifier(fileno(stdin),
        QSocketNotifier::Read, this);
    connect(notifier, SIGNAL(activated(int)), this, SLOT(receivedData()));
    notifier->setEnabled(true);
#endif
}
Exemplo n.º 8
0
void ServerWorker::_handleMessage( const MessageHeader& messageHeader,
                                   const QByteArray& byteArray )
{
    const QString uri( messageHeader.uri );
    if( uri.isEmpty( ))
    {
        std::cerr << "Warning: rejecting streamer with empty uri"
                  << std::endl;
        closeConnection( _streamUri );
        return;
    }
    if( uri != _streamUri &&
            messageHeader.type != MESSAGE_TYPE_PIXELSTREAM_OPEN )
    {
        std::cerr << "Warning: ingnoring message with incorrect stream uri: '"
                  << messageHeader.uri << "', expected: '"
                  << _streamUri.toStdString() << "'" <<  std::endl;
        return;
    }

    switch( messageHeader.type )
    {
    case MESSAGE_TYPE_QUIT:
        emit removeStreamSource( _streamUri, _sourceId );
        _streamUri = QString();
        break;

    case MESSAGE_TYPE_PIXELSTREAM_OPEN:
        if( !_streamUri.isEmpty( ))
        {
            std::cerr << "Warning: PixelStream already opened!" << std::endl;
            return;
        }
        _streamUri = uri;
        emit addStreamSource( _streamUri, _sourceId );
        break;

    case MESSAGE_TYPE_PIXELSTREAM_FINISH_FRAME:
        emit receivedFrameFinished( _streamUri, _sourceId );
        break;

    case MESSAGE_TYPE_PIXELSTREAM:
        _handlePixelStreamMessage( byteArray );
        break;

    case MESSAGE_TYPE_COMMAND:
        emit receivedCommand( QString( byteArray.data( )), _streamUri );
        break;

    case MESSAGE_TYPE_SIZE_HINTS:
    {
        const SizeHints* hints =
                reinterpret_cast< const SizeHints* >( byteArray.data( ));
        emit receivedSizeHints( _streamUri, SizeHints( *hints ));
        break;
    }

    case MESSAGE_TYPE_BIND_EVENTS:
    case MESSAGE_TYPE_BIND_EVENTS_EX:
        if( _registeredToEvents )
            std::cerr << "We are already bound!!" << std::endl;
        else
        {
            const bool exclusive =
                    (messageHeader.type == MESSAGE_TYPE_BIND_EVENTS_EX);
            emit registerToEvents( _streamUri, exclusive, this );
        }
        break;

    default:
        break;
    }
}