Esempio n. 1
0
void Data::modifyClasses(const QList<ClassData> &ocd, const QList<ClassData> &ncd, const QList<int> &ntid)
{
    int n = ocd.size();
    if (n <= 0) return;
    if (this->m_modifyReply) delete this->m_modifyReply;

    QUrl url = QUrl("http://szektam2.byethost3.com/modifyClasses.php");

    PARAMS params;
    params.addQueryItem("username", Key::username());
    params.addQueryItem("password", Key::password());
    params.addQueryItem("n", QString::number(n));
    for (int i = 0; i < n; ++i) {
        const ClassData oc = ocd[i];
        const ClassData nc = ncd[i];
        params.addQueryItem(QString("ocid%1").arg(i), oc.name);
        params.addQueryItem(QString("ncid%1").arg(i), nc.name);
        params.addQueryItem(QString("nnum%1").arg(i), QString::number(nc.number));
        params.addQueryItem(QString("ntea%1").arg(i), QString::number(ntid[i]));
    }
    QByteArray data;
#if QT5
    data.append(params.toString());
    url.setQuery(params);
#else
    data.append(params.encodedQuery());
#endif

    QNetworkRequest request(url);
    request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded");
    this->m_modifyReply = this->m_manager->post(request, data);
    //connect(this->m_modifyReply, SIGNAL(finished()), this, SLOT(getSubjects()));
    connect(this->m_modifyReply, SIGNAL(finished()), this, SLOT(readReady()));
}
void Integrator::slotRead( int fd )
{
  QIntDictIterator<Watch>	it( m_watches );
  for ( ; it.current(); ++it )
    dbus_watch_handle ( it.current()->watch, DBUS_WATCH_READABLE );

  emit readReady();
}
void ServerSearch::showEvent(QShowEvent *event)
{
    if (event->type() == QEvent::Show)
    {
        m_pUdpSocket = std::make_shared<QUdpSocket>(this);
        m_pResultSocket = std::make_shared<QUdpSocket>(this);

        m_pResultSocket->bind(QHostAddress::Any, Helper::serverSearchPort() + 1);
        connect(m_pResultSocket.get(), SIGNAL(readyRead()), this, SLOT(readReady()));
    }
}
Esempio n. 4
0
    Result
  AsyncHTTPLookup::lookup
  (
    const QString         & hostName,
    uint                    port,
    const TrackOffsetList & trackOffsetList
  )
  {
    trackOffsetList_ = trackOffsetList;

    connect( this, SIGNAL(queryReady()), SLOT(slotQueryReady()) );
    connect( this, SIGNAL(readReady()), SLOT(requestCDInfoForMatch()) );

    initURL( hostName, port );

    // Run a query.
    result_ = runQuery();

    return result_;
  }
Esempio n. 5
0
SlotSocket::SlotSocket(QObject *parent) :
	QTcpSocket(parent)
{
	connect(this, SIGNAL(readyRead()), this, SLOT(readReady()));
}
Esempio n. 6
0
    void
  HTTPLookup::jobFinished()
  {
    QStringList lineList = QString::fromUtf8(data_).split( QLatin1String( "\n" ), QString::SkipEmptyParts );
    QStringList::ConstIterator it = lineList.constBegin();

    switch ( state_ )
    {
      case WaitingForQueryResponse:

        if ( it != lineList.constEnd() )
        {
          QString line( *it );

          result_ = parseQuery( line );

          switch ( result_ )
          {
            case Success:

              if ( !block_ )
                emit queryReady();
              break;

            case MultipleRecordFound:

              ++it;
              while ( it != lineList.constEnd() )
              {
                QString line( *it );

                if ( QLatin1Char( '.' ) == line[ 0 ] )
                {
                  result_ = Success;

                  if ( !block_ )
                    emit queryReady();
                  break;
                }

                parseExtraMatch( line );
                ++it;
              }

              break;

            case ServerError:
            case NoRecordFound:
              if ( !block_ )
                emit queryReady();

              return;
              break;

            default:

              break;
          }

        }

        break;

      case WaitingForReadResponse:

        {
          CDInfo info;

          if ( info.load( QString::fromUtf8(data_) ) )
          {
            info.set( QLatin1String( "category" ), category_ );
            info.set( QLatin1String( "discid" ), discid_ );
            info.set( QLatin1String( "source" ), QLatin1String( "freedb" ) );
            cdInfoList_.append( info );
          }

          if ( !block_ )
            emit readReady();
        }

        return;

        break;

      default:

        break;
    }

    result_ = Success;
  }
Esempio n. 7
0
void     PL011::waitInput()const
{
	while(!readReady());
	rawRead();
}