当前位置: 首页>>代码示例>>C++>>正文


C++ dataReady函数代码示例

本文整理汇总了C++中dataReady函数的典型用法代码示例。如果您正苦于以下问题:C++ dataReady函数的具体用法?C++ dataReady怎么用?C++ dataReady使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了dataReady函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: gotoIdle

void DSPEngine::handleSetSource(SampleSource* source)
{
	gotoIdle();
	if(m_sampleSource != NULL)
		disconnect(m_sampleSource->getSampleFifo(), SIGNAL(dataReady()), this, SLOT(handleData()));
	m_sampleSource = source;
	if(m_sampleSource != NULL)
		connect(m_sampleSource->getSampleFifo(), SIGNAL(dataReady()), this, SLOT(handleData()), Qt::QueuedConnection);
	generateReport();
}
开发者ID:zoutepopcorn,项目名称:rtl-sdrangelove,代码行数:10,代码来源:dspengine.cpp

示例2: dataReady

inline void AudioDataOutput::packetReady(const int samples, const qint16 *buffer, const qint64 vpts)
{
    //TODO: support floats, we currently only handle ints
    if (m_format == Phonon::AudioDataOutput::FloatFormat)
        return;

    if (m_channels < 0 || m_channels > 2)
        return;

    // Check if it has been cleared
    if (m_pendingFrames.isEmpty())
        m_pendingFrames.append(Frame());

    for (int i=0; i<samples; i++) {
        if (m_pendingFrames.first().map[Phonon::AudioDataOutput::LeftChannel].size() >= m_dataSize) {
            m_pendingFrames.prepend(Frame());
            m_pendingFrames.first().timestamp = vpts;

            // Tell the QVector how much data we're expecting, speeds things up a bit
            m_pendingFrames.first().map[Phonon::AudioDataOutput::LeftChannel].reserve(m_dataSize);
            if (m_channels == 2)
                m_pendingFrames.first().map[Phonon::AudioDataOutput::RightChannel].reserve(m_dataSize);
        }

        m_pendingFrames.first().map[Phonon::AudioDataOutput::LeftChannel].append(buffer[i]);
        if (m_channels == 2)
            m_pendingFrames.first().map[Phonon::AudioDataOutput::RightChannel].append(buffer[i++]);
    }

    // Are we supposed to keep our signals in sync?
    if (m_keepInSync) {
        /*while (m_mediaObject && !m_pendingFrames.isEmpty() &&
               m_pendingFrames.first().timestamp < m_mediaObject->stream()->currentVpts() &&
               m_pendingFrames.first().map[Phonon::AudioDataOutput::LeftChannel].size() >= m_dataSize) {
            emit dataReady(m_pendingFrames.takeFirst().map);
        }*/
        for (int i=0; i<m_pendingFrames.size(); i++) {
            if (m_pendingFrames[i].timestamp < m_mediaObject->stream()->currentVpts() &&
                    m_pendingFrames[i].map[Phonon::AudioDataOutput::LeftChannel].size() >= m_dataSize) {
                emit dataReady(m_pendingFrames.takeAt(i).map);
            }
        }
    } else { // Fire at will, as long as there is enough data
        while (!m_pendingFrames.isEmpty() &&
                m_pendingFrames.last().map[Phonon::AudioDataOutput::LeftChannel].size() >= m_dataSize)
            emit dataReady(m_pendingFrames.takeLast().map);
    }
}
开发者ID:sandsmark,项目名称:phonon-visualization-gsoc,代码行数:48,代码来源:audiodataoutput.cpp

示例3: WriteFile

void TerminalWindow::lineEditReady()
{
    QString s;
    QByteArray a;
    s = lineEdit->text();
#if QT_VERSION >= 0x050000
    a = s.toLatin1();
#else
    a = s.toAscii();
#endif
    a.append('\n');
#ifdef Q_WS_WIN
    DWORD n=a.length();
    DWORD res;
    if ( s == "EOF" )
    {
        a[0] = 3;
        a[1] = '\n';
        WriteFile(toChild,a.data(),2,&res,NULL);
    }
    else if ( ! WriteFile(toChild,a.data(),n,&res,NULL) )
    {
        qDebug() << tr("error writing to child on lineEditReady");
    }
    dataReady(s+"\n");
#else
    if (write(pty, a.data(), a.length()) < 1) {
        qDebug() << tr("error writing to pty on lineEditReady");
    }
#endif
    lineEdit->clear();
}
开发者ID:seyfarth,项目名称:ebe,代码行数:32,代码来源:terminalwindow.cpp

示例4: sizeof

void MjpegClient::dataReady()
{
	m_blockSize = m_socket->bytesAvailable();
	
	char * data = (char*)malloc(m_blockSize * sizeof(char));
	if(data == NULL)
	{
		qDebug() << "Error allocating memory for incomming data - asked for "<<m_blockSize<<" bytes, got nothing, exiting.";
		exit();
		return;
	}
	
	int bytesRead = m_socket->read(data,m_blockSize);
	if(bytesRead > 0)
	{
		m_dataBlock.append(data,m_blockSize);
		processBlock();
	}
	
	free(data);
	data = 0;
	
	if(m_socket->bytesAvailable())
	{
		QTimer::singleShot(0, this, SLOT(dataReady()));
	}
}
开发者ID:dtbinh,项目名称:dviz,代码行数:27,代码来源:MjpegClient.cpp

示例5: QTcpSocket

bool MjpegClient::connectTo(const QString& host, int port, QString url, const QString& user, const QString& pass)
{
    if(url.isEmpty())
        url = "/";

    m_host = host;
    m_port = port > 0 ? port : 80;
    m_url = url;
    m_user = user;
    m_pass = pass;

    if(m_socket)
    {
        m_socket->abort();
        delete m_socket;
        m_socket = 0;
    }

    m_socket = new QTcpSocket(this);
    connect(m_socket, SIGNAL(readyRead()),    this,   SLOT(dataReady()));
    connect(m_socket, SIGNAL(disconnected()), this,   SLOT(lostConnection()));
    connect(m_socket, SIGNAL(disconnected()), this, SIGNAL(socketDisconnected()));
    connect(m_socket, SIGNAL(connected()),    this, SIGNAL(socketConnected()));
    connect(m_socket, SIGNAL(connected()),    this,   SLOT(connectionReady()));
    connect(m_socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SIGNAL(socketError(QAbstractSocket::SocketError)));
    connect(m_socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(lostConnection(QAbstractSocket::SocketError)));

    m_socket->connectToHost(host,port);
    m_socket->setReadBufferSize(1024 * 1024);

    return true;
}
开发者ID:dtbinh,项目名称:dviz,代码行数:32,代码来源:MjpegClient.cpp

示例6: QMainWindow

QTweetDeck::QTweetDeck(QWidget *parent) : QMainWindow(parent) {
  setWindowTitle("QTweetDeck");

  QByteArray key, secret;
  QFile file;
  file.setFileName("../qtweet_private/consumer.key");
  if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
    key = file.readLine();
    file.close();
  }

  file.setFileName("../qtweet_private/consumer.secret");
  if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
    secret = file.readLine();
    file.close();
  }

  QTweet::setConsumer(key, secret);

  QTweet::User u;
  u.setUserId(12065042);
  c = new QTweet::Client();
  r = c->requestUserTimeLine(u);

  connect(r, SIGNAL(dataReady()), this, SLOT(printStatusList()));
}
开发者ID:juansimp,项目名称:QTweetDeck,代码行数:26,代码来源:qtweetdeck.cpp

示例7: QMainWindow

TKN_Window::TKN_Window(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::TKN_Window)
{
    /* Ui setup */
    ui->setupUi(this);
    ui->buttonStartStop->setText(buttonStartText);
    self = this;
    mTime = new QTime();
    int i;

    /* available ports */
    char** port_list = listSerialPorts();
    if (port_list){
        for (i=0; *port_list; i++, port_list++)
            ui->comboBox_ComPort->insertItem(i, QString(*port_list));
    }

    /* baud rates */
    for (i=0; i<sizeof(baudList)/sizeof(baudList[0]) ; i++)
        ui->comboBox_Baud->insertItem(i, baudList[i]);

    this->mTknStarted = false;

    /* Signal connections */
    connect(this, SIGNAL(tokenReceived()), this, SLOT(onTokenReceived()), Qt::QueuedConnection);
    connect(this, SIGNAL(dataReady()), this, SLOT(dataReceive()), Qt::QueuedConnection);

    this->ui->labelAVR->setPixmap( QPixmap(":/AVR_Chip-W180px.png"));
    this->updateUI();
}
开发者ID:chrispap,项目名称:TKN,代码行数:31,代码来源:TKN_Window.cpp

示例8: dataReady

void SSH1Channel::receiveData()
{
    m_in->getUInt8();
    QByteArray data = m_in->getString();
    m_data += data;
    emit dataReady();
}
开发者ID:adaptee,项目名称:qterm-hack,代码行数:7,代码来源:channel.cpp

示例9: stream

/**
  * @brief receive chunk of data from a socket to this packet
  */
void OpenNICPacket::recv(QTcpSocket* socket)
{
	QByteArray chunk;
	QDataStream stream(socket);
	switch(mRXState)
	{
	case 0:
		mRXData.clear();
		stream >> mRXLength;
		if (mRXLength == 0xFFFFFFFF)
		{
			return;
		}
		mRXState=1;
	case 1:
		chunk = stream.device()->readAll();
		mRXData.append(chunk);
		if (mRXData.length()<(int)mRXLength)
		{
			return;
		}
		mRXState=0;
		break;
	}
	QDataStream dataStream(&mRXData,QIODevice::ReadOnly);
	dataStream >> mData;
	emit dataReady();
}
开发者ID:8bitgeek,项目名称:OpenNIC-Wizard,代码行数:31,代码来源:opennicpacket.cpp

示例10: updateHugeImage

void WebCamData::trackFace() {
  CvConnectedComp comps;
  updateHugeImage(d->data);

  cvCalcBackProject(&d->hueImage, d->prob, d->histogram);
  cvAnd(d->prob, d->mask, d->prob, 0);
  CvBox2D box;
  cvCamShift(d->prob, d->faceRect,
             cvTermCriteria(CV_TERMCRIT_EPS | CV_TERMCRIT_ITER, 10, 1), &comps,
             &box);

  d->faceRect = comps.rect;

  int radius = cvRound((d->faceRect.width + d->faceRect.height) * 0.25);
  CvPoint center;
  center.x = cvRound(d->faceRect.x + d->faceRect.width * 0.5);
  center.y = cvRound(d->faceRect.y + d->faceRect.height * 0.5);
  /*
      qDebug() << Q_FUNC_INFO
      << comps.rect.x
      << comps.rect.y
      << comps.rect.width
      << comps.rect.height
      << box.angle
      << center.x
      << center.y
      << radius;
   */
  d->dataMap.clear();
  d->dataMap["z"] = QVariant(radius);
  d->dataMap["x"] = QVariant(center.x);
  d->dataMap["y"] = QVariant(center.y);
  d->dataMap["angle"] = QVariant(box.angle);
  Q_EMIT dataReady();
}
开发者ID:shaheeqa,项目名称:plexydesk,代码行数:35,代码来源:webcam.cpp

示例11: emit

void SerialPort::checkPort()
{
	if(serial->bytesAvailable()>0)
	{
		emit(dataReady());
	}
}
开发者ID:diogenesleonel,项目名称:CalouradaLivre2011,代码行数:7,代码来源:SerialPort.cpp

示例12: dataReady

void FileDownloader::downloadComplete()
{
    fileData = reply->readAll();

    reply->deleteLater();
    emit dataReady();
}
开发者ID:ssunny7,项目名称:File-Downloader,代码行数:7,代码来源:filedownloader.cpp

示例13: QDialog

ReportManager::ReportManager(_structs * data, QWidget *parent) :
    QDialog(parent),
    ui(new Ui::ReportManager)
{
    processSwitch = 0;
    connect(&socketConn, SIGNAL(dataReady(QString)), this, SLOT(processData(QString)));

    ui->setupUi(this);

    for(int i = 1; i <= 12; i++ )
    {
        ui->monthSelector->addItem(QString::number(i));
    }
    // Build list of years
    QDate now = QDate::currentDate();
    int year = now.year();
    QStringList years;
    for(int i =0; i < 5; i++)
    {
        years.append(QString::number(year-i));
    }

    // Add to combo
    ui->yearSelector->addItems(years);

    dataStructs = data;
    ui->startDate->setDate(QDate::currentDate().addDays(-7));
    ui->endDate->setDate(QDate::currentDate());

}
开发者ID:joshbosley,项目名称:SalesSystem,代码行数:30,代码来源:reportmanager.cpp

示例14: qDebug

void PreviewFileLoader::run()
{
    QImage pixmap;

    // make sure this function doesn't crash because of some exiv issues.
    ExivFacade* exiv = ExivFacade::createExivReader();

    if (!exiv->openFile(mPath))
    {
        qDebug() << "Failed to load embedded preview";
        return;
    }
    qDebug() << "Reading image:" << mPath;

    pixmap = exiv->getPreview();

    // if the image contained no thumbnail attempt to load it from disk directly
    if (pixmap.isNull())
        pixmap.load(mPath);
    QImage image = pixmap.scaled(QSize(PREVIEW_IMG_WIDTH,
            PREVIEW_IMG_HEIGHT), Qt::KeepAspectRatio);

    emit dataReady(mModelIndex, image);
    delete exiv;
}
开发者ID:jaapgeurts,项目名称:photostage,代码行数:25,代码来源:previewfileloader.cpp

示例15: printf

bool Caen785Module::pollTrigger()
{
    printf("Polling.\n");fflush(stdout);
    bool triggered = true;
    uint32_t pollcount = 0;
    conf.pollcount = 100000;

    while(!dataReady())
    {
        pollcount++;
        if(pollcount == conf.pollcount)
        {
            triggered = false;
            break;
        }
    }

    if(!triggered)
    {
        printf("No trigger in %d polls.\n",pollcount);fflush(stdout);
        return false;
    }
    else
    {
        printf("Triggered after %d polls.\n",pollcount);fflush(stdout);
        return true;
    }
}
开发者ID:mojca,项目名称:gecko,代码行数:28,代码来源:caen785module.cpp


注:本文中的dataReady函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。