Example #1
0
void TestClass::fetch()
{
  QTextStream qtin(stdin);
  QString mail, pass;

  qDebug() << "input user mail : ";
  qtin >> mail;
  qDebug() << "input user password : "******"login error : " << code << "\n" << description;
    QCoreApplication::quit();
  });
  connect(login, &nicolive::AlertLogin::got, this, [=](QString ticket){
    admin->get(ticket);
  });

  connect(admin, &nicolive::AlertAdmin::error, this, [](QString code){
    qDebug() << "admin error : " << code;
    QCoreApplication::quit();
  });
  connect(admin, &nicolive::AlertAdmin::got,
          this, [&](QStringList myCommunities, QString addr,
          qint16 port, QString thread){
    qDebug() << "your communities : " << myCommunities << "\n";

    alertConnection = new nicolive::AlertConnection(addr, port, thread, this);
    connect(alertConnection, &nicolive::AlertConnection::error,
            this, [](QString errorPosition, QString code){
      qDebug() << "alert error " << errorPosition << " : " << code;
      QCoreApplication::quit();
    });
    connect(alertConnection, &nicolive::AlertConnection::gotNewWaku,
            this, [](QString broadID, QString communityID, QString nushiID){
      (void)communityID, (void)nushiID;
      qDebug() << "broadID : " << broadID;
    });
    alertConnection->doConnect();
  });

  login->get(mail, pass);
}
void Moderator::playerHasMoved(bool isPlayer1){
    Player* player;
    if(isPlayer1) player = player1;
    else player = player2;
    if(!player)
        return;
    if(gamestate!=GAME_STOPPED){
        QString input = QString(player->readNewInput());
        QTextStream qtin(stdin);
        if(player->isManual && commandLine){
            timer->stop();
            timePerTurnTimer->stop();
            qtin >> input;
            timer->start(10);
            timePerTurnTimer->start(10);
        }
Example #3
0
void TestClass::fetch()
{
  QTextStream qtin(stdin);

  qDebug() << "input user session : ";
  qtin >> userSession;
  qDebug() << "input broadcast ID : ";
  qtin >> broadID;
  qDebug() << "input owner comment : ";
  qtin >> text;


  // create a broadcast manager
  // This instance will be deleted with this class.
  waku = new nicolive::LiveWaku(broadID, this);

  // API classes emit signals.
  // In this case, this lambda expression will receive.
  connect(waku, &nicolive::LiveWaku::gotOwnerCommentToken, this, [&](){
    auto cmft = new nicolive::OwnerComment(this);
    // OwnerComment class emits "got" signal if it correctly do.
    connect(cmft, &nicolive::OwnerComment::got, this, [](){
      qDebug() << "submitted";
      QCoreApplication::quit();
    });
    // if error occurred
    connect(cmft, &nicolive::OwnerComment::error, this, [](QString code){
      qDebug() << code;
      QCoreApplication::quit();
    });
    cmft->get(text, "", *waku, userSession);
  });

  // if error occurred
  connect(waku, &nicolive::LiveWaku::gotOwnerCommentTokenError,
          this, [](){
    qDebug() << "fetchOwnerCommentToken error";
    QCoreApplication::quit();
  });

  // Finally, need to call get method.
  waku->fetchOwnerCommentToken(userSession);
  
  // An instance of most API classes will be deleted automatically.
}