示例#1
0
void StressTest::OnTimer(int timerIdGot)
{
    CrashIf(timerId != timerIdGot);
    KillTimer(win->hwndFrame, timerId);
    if (!win->IsDocLoaded()) {
        if (!GoToNextFile()) {
            Finished(true);
            return;
        }
        TickTimer();
        return;
    }

    // chm documents aren't rendered and we block until we show them
    // so we can assume previous page has been shown and go to next page
    if (!win->AsFixed()) {
        if (!GoToNextPage())
            return;
        goto Next;
    }

    // For non-image files, we detect if a page was rendered by checking the cache
    // (but we don't wait more than 3 seconds).
    // Image files are always fully rendered in WM_PAINT, so we know the page
    // has already been rendered.
    DisplayModel *dm = win->AsFixed();
    bool didRender = gRenderCache.Exists(dm, currPage, dm->GetRotation());
    if (!didRender && dm->ShouldCacheRendering(currPage)) {
        double timeInMs = currPageRenderTime.GetTimeInMs();
        if (timeInMs > 3.0 * 1000) {
            if (!GoToNextPage())
                return;
        }
    }
    else if (!GoToNextPage()) {
        return;
    }
    MakeRandomSelection(win, currPage);

Next:
    TickTimer();
}
示例#2
0
void UltrasoundSupport::CreateQtPartControl( QWidget *parent )
{
m_Timer = new QTimer(this);

// create GUI widgets from the Qt Designer's .ui file
m_Controls.setupUi( parent );

connect( m_Controls.m_DeviceManagerWidget, SIGNAL(NewDeviceButtonClicked()), this, SLOT(OnClickedAddNewDevice()) ); // Change Widget Visibilities
connect( m_Controls.m_DeviceManagerWidget, SIGNAL(NewDeviceButtonClicked()), this->m_Controls.m_NewVideoDeviceWidget, SLOT(CreateNewDevice()) ); // Init NewDeviceWidget
connect( m_Controls.m_ActiveVideoDevices, SIGNAL(ServiceSelectionChanged(us::ServiceReferenceU)), this, SLOT(OnChangedActiveDevice()) );
connect( m_Controls.m_RunImageTimer, SIGNAL(clicked()), this, SLOT(OnChangedActiveDevice()) );
connect( m_Controls.m_ShowImageStream, SIGNAL(clicked()), this, SLOT(OnChangedActiveDevice()) );
connect( m_Controls.m_NewVideoDeviceWidget, SIGNAL(Finished()), this, SLOT(OnNewDeviceWidgetDone()) ); // After NewDeviceWidget finished editing
connect( m_Controls.m_FrameRate, SIGNAL(valueChanged(int)), this, SLOT(OnChangedFramerateLimit(int)) );
connect( m_Controls.m_FreezeButton, SIGNAL(clicked()), this, SLOT(OnClickedFreezeButton()) );
connect( m_Timer, SIGNAL(timeout()), this, SLOT(DisplayImage()));

// Initializations
m_Controls.m_NewVideoDeviceWidget->setVisible(false);
std::string filter = "(&(" + us::ServiceConstants::OBJECTCLASS() + "="
+ "org.mitk.services.UltrasoundDevice)("
+ mitk::USDevice::GetPropertyKeys().US_PROPKEY_ISACTIVE + "=true))";
m_Controls.m_ActiveVideoDevices->Initialize<mitk::USDevice>(
mitk::USDevice::GetPropertyKeys().US_PROPKEY_LABEL ,filter);
m_Controls.m_ActiveVideoDevices->SetAutomaticallySelectFirstEntry(true);
m_FrameCounter = 0;

// Create Node for US Stream
if (m_Node.IsNull())
{
m_Node = mitk::DataNode::New();
m_Node->SetName("US Support Viewing Stream");
//create a dummy image (gray values 0..255) for correct initialization of level window, etc.
mitk::Image::Pointer dummyImage = mitk::ImageGenerator::GenerateRandomImage<float>(100, 100, 1, 1, 1, 1, 1, 255,0);
m_Node->SetData(dummyImage);
m_OldGeometry = dynamic_cast<mitk::SlicedGeometry3D*>(dummyImage->GetGeometry());
}

m_Controls.tabWidget->setTabEnabled(1, false);

LoadUISettings();
}
void MagnatuneDownloadDialog::AllFinished(bool error) {
  current_reply_ = NULL;

  if (error)
    ui_->button_box->button(QDialogButtonBox::Ok)->show();
  ui_->button_box->button(QDialogButtonBox::Close)->show();
  ui_->button_box->button(QDialogButtonBox::Cancel)->hide();
  ui_->options->setEnabled(true);

  // Make the taskbar flash
  QApplication::alert(this);

  if (!error) {
    QStringList albums;
    for (int i=0 ; i<ui_->albums->topLevelItemCount() ; ++i) {
      albums << ui_->albums->topLevelItem(i)->text(0);
    }
    emit Finished(albums);
  }
}
void ImportCmd::Run()
{
    ToolSystem* tsystem = GetSubsystem<ToolSystem>();
    Project* project = tsystem->GetProject();
    String resourcePath = project->GetResourcePath();

    String ext = GetExtension(assetFilename_);

    if (ext == ".json")
    {
        Poco::File file(assetFilename_.CString());

        if (!file.exists())
        {
            Error(ToString("JSON source scene does not exist: %s", assetFilename_.CString()));
            return;
        }

        LOGRAWF("Importing JSON: %s", assetFilename_.CString());

        SharedPtr<JSONSceneImporter> jimporter;
        jimporter = new JSONSceneImporter(context_);
        jimporter->Import(assetFilename_);

        SharedPtr<JSONSceneProcess> sceneProcess;
        sceneProcess = new JSONSceneProcess(context_, jimporter);
        sceneProcess->Process(resourcePath);
        sceneProcess->Write();
    }
    else
    {
        SharedPtr<OpenAssetImporter> importer(new OpenAssetImporter(context_));
        if (importer->Load(assetFilename_))
        {
            importer->ExportModel("/Users/josh/Desktop/ExportedModel.mdl");
        }

    }

    Finished();
}
void UltimateLyricsProvider::LyricsFetched(QByteArray bytes)
{
    //Debug::debug() << "[UltimateLyricsProvider] " << name_ << " LyricsFetched";
 
    QObject* reply = qobject_cast<QObject*>(sender());
    if (!reply || !m_requests.contains(reply))   return;

    INFO::InfoRequestData request =  m_requests.take(reply);

    const QTextCodec* codec = QTextCodec::codecForName(charset_.toAscii().constData());
    const QString original_content = codec->toUnicode(bytes);
    //Debug::debug() << "[UltimateLyricsProvider] original_content :" << original_content;

    QString lyrics;

    // Check for invalid indicators
    foreach (const QString& indicator, invalid_indicators_) {
      if (original_content.contains(indicator)) {
        emit Finished(request);
        return;
      }
    }

    
    // Apply extract rules
    foreach (const Rule& rule, extract_rules_) {
      // Modify the rule for this request's metadata
      Rule rule_copy(rule);
      for (Rule::iterator it = rule_copy.begin() ; it != rule_copy.end() ; ++it) {
        ReplaceFields(request, &it->first);
      }

      QString content = original_content;
      ApplyExtractRule(rule_copy, &content);
      //Debug::debug() << "Extract rule" << rule_copy << "matched" << content.length();

      if (!content.isEmpty()) {
        lyrics = content;
        break;
      }
    }
示例#6
0
  void BulkRound::PrepareBlameShuffle()
  {
    QSharedPointer<Network> net(GetNetwork()->Clone());
    QVariantHash headers = net->GetHeaders();
    headers["bulk"] = false;
    net->SetHeaders(headers);

    Hash hashalgo;
    QByteArray roundid = GetRoundId().GetByteArray();
    roundid = hashalgo.ComputeHash(roundid);
    roundid = hashalgo.ComputeHash(roundid);
    Id sr_id(roundid);

    _shuffle_round = _create_shuffle(GetGroup(), GetPrivateIdentity(), sr_id, net,
        _get_blame_data);

    _shuffle_round->SetSink(&_shuffle_sink);

    QObject::connect(_shuffle_round.data(), SIGNAL(Finished()),
        this, SLOT(BlameShuffleFinished()));
  }
示例#7
0
bool ProcessProxy::Terminate()
{
	if ( !m_process )
	{
		Utils::__TRACE(L"[ProcessProxy] Cannot terminate process because the process isn't exist.\r\n");
		return false;
	}

	if ( !TerminateProcess(m_process, -1) )
	{
		Utils::__TRACE(L"[ProcessProxy] TerminateProcess failed. [%d]\r\n", GetLastError());
		return false;
	}

	CloseHandle(m_process);
	m_process = NULL;

	emit Finished();

	return true;
}
void QServerManager::InitServer(const QString& scenarioName)
{
    if(mServer || mEndPoint)
    {
        LOG("Server already exists");
        return;
    }

    if(!PrepareTestCase(scenarioName))
    {
        //LOG();
        emit Finished(false);
        return;
    }

    mEndPoint = new H323EndPoint();
    mServer = new GatekeeperServer(*mEndPoint, mScenario->GetStateMachine());
    ConnectObjects(mServer->GetListener());
    LogManager::Instance().clearLogs();
    LOG("Scenario " + scenarioName + " is opened");
    LOG("server run!");
}
示例#9
0
void GameList::PopulateAsync(const QString& dir_path, bool deep_scan)
{
    if (!FileUtil::Exists(dir_path.toStdString()) || !FileUtil::IsDirectory(dir_path.toStdString())) {
        LOG_ERROR(Frontend, "Could not find game list folder at %s", dir_path.toLocal8Bit().data());
        return;
    }

    tree_view->setEnabled(false);
    // Delete any rows that might already exist if we're repopulating
    item_model->removeRows(0, item_model->rowCount());

    emit ShouldCancelWorker();
    GameListWorker* worker = new GameListWorker(dir_path, deep_scan);

    connect(worker, SIGNAL(EntryReady(QList<QStandardItem*>)), this, SLOT(AddEntry(QList<QStandardItem*>)), Qt::QueuedConnection);
    connect(worker, SIGNAL(Finished()), this, SLOT(DonePopulating()), Qt::QueuedConnection);
    // Use DirectConnection here because worker->Cancel() is thread-safe and we want it to cancel without delay.
    connect(this, SIGNAL(ShouldCancelWorker()), worker, SLOT(Cancel()), Qt::DirectConnection);

    QThreadPool::globalInstance()->start(worker);
    current_worker = std::move(worker);
}
示例#10
0
void OAuthenticator::FetchAccessTokenFinished(QNetworkReply* reply) {
  reply->deleteLater();

  if (reply->attribute(QNetworkRequest::HttpStatusCodeAttribute) != 200) {
    qLog(Error) << "Failed to get access token" << reply->readAll();
    return;
  }

  QJson::Parser parser;
  bool ok = false;
  QVariantMap result = parser.parse(reply, &ok).toMap();
  if (!ok) {
    qLog(Error) << "Failed to parse oauth reply";
    return;
  }

  access_token_ = result["access_token"].toString();
  refresh_token_ = result["refresh_token"].toString();
  SetExpiryTime(result["expires_in"].toInt());

  emit Finished();
}
void EngineStatePlayerStats::Red(bool down)
{
  if (!down)
  {
    return;
  }

  // If changing state do nothing
  if (GetEngine()->IsFading())
  {
    return;
  }

  // So transitions work for all players.
  m_time = 0;
  // Store the new stats for this player.
  PoolGameState::PlayerInfo* pInfo = 
    GetEngine()->GetGameState()->GetPlayerInfo(m_currentPlayer);
  Assert(pInfo);
  StoreStats(m_currentPlayer, pInfo->m_stats);

  // Show next player's stats
  ++m_currentPlayer;
  int numPlayers = GetEngine()->GetGameState()->GetNumberOfPlayers();
  Assert(m_currentPlayer <= numPlayers);
  if (m_currentPlayer == numPlayers)
  {
    // Final player has been displayed. Go to next state.
    Finished();
    // Restore current player so we can fade out if required.
    --m_currentPlayer;
  }
  else
  {
    InitPlayer();
    // TODO sound effect
  }
  
}
void QmitkUSNewVideoDeviceWidget::OnClickedDone(){
  m_Active = false;
  
  // Assemble Metadata
  mitk::USImageMetadata::Pointer metadata = mitk::USImageMetadata::New();
  metadata->SetDeviceComment(m_Controls->m_Comment->text().toStdString());
  metadata->SetDeviceModel(m_Controls->m_Model->text().toStdString());
  metadata->SetDeviceManufacturer(m_Controls->m_Manufacturer->text().toStdString());
  metadata->SetProbeName(m_Controls->m_Probe->text().toStdString());
  metadata->SetZoom(m_Controls->m_Zoom->text().toStdString());


  // Create Device
  mitk::USVideoDevice::Pointer newDevice;
  if (m_Controls->m_RadioDeviceSource->isChecked()){
    int deviceID = m_Controls->m_DeviceSelector->value();
    newDevice = mitk::USVideoDevice::New(deviceID, metadata);
  } else {
    std::string filepath = m_Controls->m_FilePathSelector->text().toStdString();
    newDevice = mitk::USVideoDevice::New(filepath, metadata);
  }

  // Set Video Options
   newDevice->GetSource()->SetColorOutput(! m_Controls->m_CheckGreyscale->isChecked());

  // If Resolution override is activated, apply it
  if (m_Controls->m_CheckResolutionOverride->isChecked())
  {
    int width  = m_Controls->m_ResolutionWidth->value();
    int height = m_Controls->m_ResolutionHeight->value();
    newDevice->GetSource()->OverrideResolution(width, height);
    newDevice->GetSource()->SetResolutionOverride(true);
  }

  newDevice->Connect();

  emit Finished();
}
void QmitkRegistrationJob::run()
{
  try
  {
    mitk::MITKAlgorithmHelper helper(m_spLoadedAlgorithm);
    mitk::MaskedAlgorithmHelper maskedHelper(m_spLoadedAlgorithm);

    //*@TODO Data Check and failure handle
    helper.SetData(this->m_spMovingData, this->m_spTargetData);
    maskedHelper.SetMasks(this->m_spMovingMask, this->m_spTargetMask);

    // perform registration
    m_spResultRegistration = helper.GetRegistration();

    // wrap the registration in a data node
    if (m_spResultRegistration.IsNull())
    {
      emit Error(QString("Error. No registration was determined. No results to store."));
    }
    else
    {
      mitk::MAPRegistrationWrapper::Pointer spRegWrapper = mitk::MAPRegistrationWrapper::New();
      spRegWrapper->SetRegistration(m_spResultRegistration);

      emit RegResultIsAvailable(spRegWrapper, this);
    }
  }
  catch (::std::exception &e)
  {
    emit Error(QString("Error while registering data. Details: ") + QString::fromLatin1(e.what()));
  }
  catch (...)
  {
    emit Error(QString("Unkown error when registering data."));
  }

  emit Finished();
};
void UltimateLyricsProvider::FetchInfo(int id, const Song& metadata) {
  // Get the text codec
  const QTextCodec* codec = QTextCodec::codecForName(charset_.toAscii().constData());
  if (!codec) {
    qLog(Warning) << "Invalid codec" << charset_;
    emit Finished(id);
    return;
  }

  // Fill in fields in the URL
  QString url_text(url_);
  ReplaceFields(metadata, &url_text);

  QUrl url(url_text);
  qLog(Debug) << "Fetching lyrics from" << url;

  // Fetch the URL, follow redirects
  metadata_ = metadata;
  redirect_count_ = 0;
  QNetworkReply* reply = network_->get(QNetworkRequest(url));
  requests_[reply] = id;
  connect(reply, SIGNAL(finished()), SLOT(LyricsFetched()));
}
示例#15
0
bool Adventure::Process()
{
	if(players.size() == 0)
	{
		return false;
	}

	if(current_timer->Check())
	{
		//Timer wore out while waiting for zone in.
		if(status == AS_WaitingForZoneIn)
		{
			MoveCorpsesToGraveyard();
			database.DeleteInstance(instance_id);
			return false;
		}
		else if(status == AS_WaitingForPrimaryEndTime)
		{
			//Do partial failure: send a message to the clients that they can only get a certain amount of points.
			SendAdventureMessage(13, "You failed to complete your adventure in time.  Complete your adventure goal within 30 minutes to "
				"receive a lesser reward.  This adventure will end in 30 minutes and your party will be ejected from the dungeon.");
			SetStatus(AS_WaitingForSecondaryEndTime);
		}
		else
		{
			if(count < GetTemplate()->type_count)
			{
				Finished(AWS_Lose);
			}
			
			MoveCorpsesToGraveyard();
			database.DeleteInstance(instance_id);
			return false;
		}
	}
	return true;
}
void QmitkUSNewVideoDeviceWidget::OnClickedCancel(){
  m_TargetDevice = 0;
  m_Active = false;
  emit Finished();
}
示例#17
0
//---------------------------------------------------------------------------
void File_Mz::FileHeader_Parse()
{
    //Parsing
    int32u lfanew;
    int16u magic;
    Element_Begin("MZ");
    Get_C2 (magic,                                              "magic");
    if (magic!=0x4D5A) //"MZ"
    {
        Finished();
        return;
    }
    Skip_L2(                                                    "cblp");
    Skip_L2(                                                    "cp");
    Skip_L2(                                                    "crlc");
    Skip_L2(                                                    "cparhdr");
    Skip_L2(                                                    "minalloc");
    Skip_L2(                                                    "maxalloc");
    Skip_L2(                                                    "ss");
    Skip_L2(                                                    "sp");
    Skip_L2(                                                    "csum");
    Skip_L2(                                                    "ip");
    Skip_L2(                                                    "cs");
    Skip_L2(                                                    "lsarlc");
    Skip_L2(                                                    "ovno");
    Skip_L2(                                                    "res");
    Skip_L2(                                                    "res");
    Skip_L2(                                                    "res");
    Skip_L2(                                                    "res");
    Skip_L2(                                                    "oemid");
    Skip_L2(                                                    "oeminfo");
    Skip_L2(                                                    "res2");
    Skip_L2(                                                    "res2");
    Skip_L2(                                                    "res2");
    Skip_L2(                                                    "res2");
    Skip_L2(                                                    "res2");
    Skip_L2(                                                    "res2");
    Skip_L2(                                                    "res2");
    Skip_L2(                                                    "res2");
    Skip_L2(                                                    "res2");
    Skip_L2(                                                    "res2");
    Get_L4 (lfanew,                                             "lfanew");

    //Computing
    if (lfanew>Element_Offset)
    {
        Skip_XX(lfanew-Element_Offset,                          "MZ data");
        Element_End();
    }
    if (Element_Offset>lfanew)
    {
        Element_End();
        Element_Offset=lfanew; //Multi usage off the first bytes
    }

    //Parsing
    int32u Signature, TimeDateStamp=0;
    int16u Machine=0, Characteristics=0;
    Peek_B4(Signature);
    if (Signature==0x50450000) //"PE"
    {
        Element_Begin("PE");
        Skip_C4(                                                "Header");
        Get_L2 (Machine,                                        "Machine"); Param_Info(Mz_Machine(Machine));
        Skip_L2(                                                "NumberOfSections");
        Get_L4 (TimeDateStamp,                                  "TimeDateStamp"); Param_Info(Ztring().Date_From_Seconds_1970(TimeDateStamp));
        Skip_L4(                                                "PointerToSymbolTable");
        Skip_L4(                                                "NumberOfSymbols");
        Skip_L2(                                                "SizeOfOptionalHeader");
        Get_L2 (Characteristics,                                "Characteristics");
        Element_End("PE");
    }

    //Filling
    Stream_Prepare(Stream_General);
    Fill(Stream_General, 0, General_Format, "MZ");
    if (Characteristics&0x2000)
        Fill(Stream_General, 0, General_Format_Profile, "DLL");
    else if (Characteristics&0x0002)
        Fill(Stream_General, 0, General_Format_Profile, "Executable");
    Fill(Stream_General, 0, General_Format_Profile, Mz_Machine(Machine));
    if (TimeDateStamp)
        Fill(Stream_General, 0, General_Encoded_Date, Ztring().Date_From_Seconds_1970(TimeDateStamp));

    //No need of more
    Finished();
}
示例#18
0
void QmitkSimpleMeasurement::CreateQtPartControl( QWidget* parent )
{
  m_CreatedDistances = std::vector<mitk::DataNode::Pointer>();
  m_CreatedAngles = std::vector<mitk::DataNode::Pointer>();
  m_CreatedPaths = std::vector<mitk::DataNode::Pointer>();


  m_Controls = new Ui::QmitkSimpleMeasurementControls;
  m_Controls->setupUi(parent);

  connect( (QObject*)(m_Controls->pbDistance), SIGNAL(clicked()),(QObject*) this, SLOT(AddDistanceSimpleMeasurement()) );
  connect( (QObject*)(m_Controls->pbAngle), SIGNAL(clicked()),(QObject*) this, SLOT(AddAngleSimpleMeasurement()) );
  connect( (QObject*)(m_Controls->pbPath), SIGNAL(clicked()),(QObject*) this, SLOT(AddPathSimpleMeasurement()) );
  connect( (QObject*)(m_Controls->m_Finished), SIGNAL(clicked()),(QObject*) this, SLOT(Finished()) );

  EndEditingMeasurement();

}
示例#19
0
void Player::Go(Player *P, int numplayers, const Boundary &Path, const Boundary &BLL,const Boundary &BL,const Boundary &BR,const Boundary &BRR, const Button &B, Hook h[],int numHooks)
{
	if(B.reset)
	{
		Reset();
	}

	if(caught)
	{
		Hook myHookobj = *myHook;

		y = myHookobj.getY();
		caught = myHookobj.caughtOrNot();
		
		if(!caught)
		{
			y = .5;
			z += myHookobj.getRadius()+2;
		}

	}
	else
	{
			//Does everything for the player
		//Works for every type of player. no specifications need to be given, just a lot of objects get passed in

		Input(B);//Keyboard input for all players

		//Player-Player interaction
		if(!finish)//The player hasn't finished
		{
			Race(Path);//Follow the path
			AI(P,numplayers);//Act
		}
		else
			Finished();		//Act finished
		Bounce(P,numplayers);	//Check for bounces between each player

		//Player-Env. Interaction
		DetectBoundary(BLL,BL);	//Check left boundary
		DetectBoundary(BR,BRR);	//Check right boundary
		DetectEndCond(Path);	//Check end line&beginning


	
		if(usedtobeinabound==1||inabound==1)
			MoveBound();
		else//if not in a boundary
			MoveDamp();
	
		//Combine all
		Move();
	
		//Check to see that the Players have not exicted the outer boundary
		Check(BLL, BL,Path,BR, BRR);
		CheckFinished(Path);//Check to see if the player is passed the ifinish line
		if(pt == 0)
		{
			CheckCollision(h, numHooks);
		}

	}
}
示例#20
0
SongkickConcerts::SongkickConcerts() {
  Geolocator* geolocator = new Geolocator;
  geolocator->Geolocate();
  connect(geolocator, SIGNAL(Finished(Geolocator::LatLng)), SLOT(GeolocateFinished(Geolocator::LatLng)));
  NewClosure(geolocator, SIGNAL(Finished(Geolocator::LatLng)), geolocator, SLOT(deleteLater()));
}
示例#21
0
void SongkickConcerts::CalendarRequestFinished(QNetworkReply* reply, int id) {
  QJson::Parser parser;
  bool ok = false;
  QVariant result = parser.parse(reply, &ok);

  if (!ok) {
    qLog(Error) << "Error parsing Songkick reply";
    emit Finished(id);
    return;
  }

  QVariantMap root = result.toMap();
  QVariantMap results_page = root["resultsPage"].toMap();
  QVariantMap results = results_page["results"].toMap();
  QVariantList events = results["event"].toList();

  if (events.isEmpty()) {
    emit Finished(id);
    return;
  }

  QWidget* container = new QWidget;
  QVBoxLayout* layout = new QVBoxLayout(container);

  foreach (const QVariant& v, events) {
    QVariantMap event = v.toMap();
    QString display_name = event["displayName"].toString();
    QString start_date = event["start"].toMap()["date"].toString();
    QString city = event["location"].toMap()["city"].toString();
    QString uri = event["uri"].toString();

    // Try to get the lat/lng coordinates of the venue.
    QVariantMap venue = event["venue"].toMap();
    const bool valid_latlng =
        venue["lng"].isValid() && venue["lat"].isValid();

    if (valid_latlng && latlng_.IsValid()) {
      static const int kFilterDistanceMetres = 250 * 1e3;  // 250km
      Geolocator::LatLng latlng(
          venue["lat"].toString(), venue["lng"].toString());
      if (latlng_.IsValid() && latlng.IsValid()) {
        int distance_metres = latlng_.Distance(latlng);
        if (distance_metres > kFilterDistanceMetres) {
          qLog(Debug) << "Filtered concert:"
                      << display_name
                      << "as too far away:"
                      << distance_metres;
          continue;
        }
      }
    }

    SongKickConcertWidget* widget = new SongKickConcertWidget(container);
    widget->Init(display_name, uri, start_date, city);

    if (valid_latlng) {
      widget->SetMap(venue["lat"].toString(), venue["lng"].toString(),
                     venue["displayName"].toString());
    }

    layout->addWidget(widget);
  }
示例#22
0
bool GSTrailMakingTest::OnCursorEvent(const CursorEvent& ce)
{
    // Check if cursor is on a circle
    bool noCircle = true;
    for (int i = 0; i < (int)m_circles.size(); i++)
    {
        if (m_circles[i].IsClicked(Vec2f(ce.x, ce.y)))
        {
            noCircle = false;

            if (i == m_currentCircle)
            {
                // On current dot - do nothing?
            }
            else if (i == m_currentCircle + 1)
            {
                // On next dot in sequence - correct!
                m_correct++;
                m_currentCircle++;
                m_circles[m_currentCircle].m_clicked = true;

                if (m_currentCircle == (int)m_circles.size() - 1)
                {
                    std::cout << "FINISHED!\n";
                    // Save num errors, time, num completed, (other info ?)
                    Finished();
                    // TODO Tada! sound
                }
                else
                {
                    std::cout << "CORRECT! Now on to circle " << m_currentCircle + 1 << " (" +
                              m_circles[m_currentCircle + 1].m_str + ")\n";

                    TheSoundManager::Instance()->PlayWav(
                        ROConfig()->GetValue("sound-cogtest-correct"));
                }
            }
            else
            {
                // If a circle has already been correctly clicked, then this is not
                //  an incorrect choice.
                // Don't start counting incorrect choices until the first circle is clicked.
                if (m_correct > 0 && !m_circles[i].m_clicked)
                {
                    // On a different dot. Incorrect? But only score incorrect once.
                    if (!m_circles[i].m_incorrect)
                    {
                        // TODO Get this to print out only once per incorrect circle,
                        //  then can use for incorrect score.
                        std::cout << "Incorrect!\n";
                        m_incorrect++;
                    }
                    m_circles[i].m_incorrect = true;

                    TheSoundManager::Instance()->PlayWav(
                        ROConfig()->GetValue("sound-cogtest-fail"));
                }
            }
        }
    }

    if (noCircle)
    {
        for (int i = 0; i < (int)m_circles.size(); i++)
        {
            m_circles[i].m_incorrect = false;
        }
    }

    return true;
}
void QmitkTrackingDeviceConfigurationWidget::ConfigurationFinished()
{
  Finished();
}
示例#24
0
 void UrlStringBoxLoader::Reqeust()
 {
     Waiter->WaitForSignal(HttpClient,SIGNAL(Finished()),this,SLOT(LoadComplete()),this, SLOT(OnFail()));
     HttpClient->Get(UrlList.at(UrlIterator));
 }
示例#25
0
	void Cancel()
	{
		Finished();
	}
void UltimateLyricsProvider::LyricsFetched() {
  QNetworkReply* reply = qobject_cast<QNetworkReply*>(sender());
  if (!reply) {
    url_hop_ = false;
    return;
  }

  int id = requests_.take(reply);
  reply->deleteLater();

  if (reply->error() != QNetworkReply::NoError) {
    url_hop_ = false;
    emit Finished(id);
    return;
  }

  // Handle redirects
  QVariant redirect_target = reply->attribute(QNetworkRequest::RedirectionTargetAttribute);
  if (redirect_target.isValid()) {
    if (redirect_count_ >= kRedirectLimit) {
      url_hop_ = false;
      emit Finished(id);
      return;
    }

    QUrl target = redirect_target.toUrl();
    if (target.scheme().isEmpty() || target.host().isEmpty()) {
      QString path = target.path();
      target = reply->url();
      target.setPath(path);
    }

    redirect_count_ ++;
    QNetworkReply* reply = network_->get(QNetworkRequest(target));
    requests_[reply] = id;
    connect(reply, SIGNAL(finished()), SLOT(LyricsFetched()));
    return;
  }

  const QTextCodec* codec = QTextCodec::codecForName(charset_.toAscii().constData());
  const QString original_content = codec->toUnicode(reply->readAll());
  QString lyrics;

  // Check for invalid indicators
  foreach (const QString& indicator, invalid_indicators_) {
    if (original_content.contains(indicator)) {
      qLog(Debug) << "Found invalid indicator" << indicator;
      url_hop_ = false;
      emit Finished(id);
      return;
    }
  }

  if (!url_hop_) {
    // Apply extract rules
    foreach (const Rule& rule, extract_rules_) {
      // Modify the rule for this request's metadata
      Rule rule_copy(rule);
      for (Rule::iterator it = rule_copy.begin() ; it != rule_copy.end() ; ++it) {
        ReplaceFields(metadata_, &it->first);
      }

      QString content = original_content;
      if (ApplyExtractRule(rule_copy, &content)) {
        url_hop_ = true;
        QUrl url(content);
        qLog(Debug) << "Next url hop: " << url;
        QNetworkReply* reply = network_->get(QNetworkRequest(url));
        requests_[reply] = id;
        connect(reply, SIGNAL(finished()), SLOT(LyricsFetched()));
        return;
      }

      // Apply exclude rules
      foreach (const Rule& rule, exclude_rules_) {
        ApplyExcludeRule(rule, &lyrics);
      }
示例#27
0
void GameListWorker::run()
{
    stop_processing = false;
    AddFstEntriesToGameList(dir_path.toStdString(), deep_scan);
    emit Finished();
}
示例#28
0
 void AddNoSwapEdit(const CompositableOperation& op)
 {
   NS_ABORT_IF_FALSE(!Finished(), "forgot BeginTransaction?");
   mOperations.push_back(op);
 }
示例#29
0
	/**
	 *  @post Finished()
	 *  @see Get()
	 *  @see Finished()
	 */
	AttributeList& Finish(void)
	{
		if(!Finished()) _attribs.push_back(_traits.ListEnd());
		return *this;
	}
示例#30
0
        //void deroulement_du_jeu()	
        int main(int argc, char *argv[] )
        {
            
            // if( !InitGUI() ){ return 0; }
            
            if( !CheckCommand(argc,argv) ){ return 0; }
            
            if( !InitLogFile() ){ printf("Fail init logFile\n"); }
            
            PrintHeaderMatch();
            
            //Il faut nbMaxCps pour chaques joueurs, donc on multiplie par 2
            nbMaxCps *= 2;
            
            if( !PrintLibInitHeader() ){ printf("Fail print libHeader\n"); }
            if( !LoadLibraries() ){ return(0); }
            PrintTLine();
            
            SGameState* gameState = CreateBoard();
            
            //Srand pour obtenir des nombres aléatoires 
            srand(time(NULL));

            //Initialisation des joueurs    
            j1InitLibrary(j1Name);   
            j2InitLibrary(j2Name);

            if( strlen(pathIA1) && !strlen(pathIA2) ){ PrintPhysicalPlayers(NULL,j2Name); }
            else if( !strlen(pathIA1) && strlen(pathIA2) ){ PrintPhysicalPlayers(j1Name,NULL); }
            else if( !strlen(pathIA1) && !strlen(pathIA2) ){ PrintPhysicalPlayers(j1Name,j2Name); }
            else { PrintPhysicalPlayers(NULL,NULL); }
            
            PrintIAPlayers(pathIA1,pathIA2);
            PrintMaxCps(nbMaxCps/2);
            
            j1StartMatch();
            j2StartMatch();

            int nbMatch = 3;
            int j1Win = 0;
            int j2Win = 0;

            while( nbMatch>0 && j1Win<2 && j2Win<2){

                PrintMatch(4-nbMatch);
                
                //   InitBoard
                
                //On initialise le nombre de coups maximums
                 int cptCps = nbMaxCps;
                 j1NbPenalty = 0;
                 j2NbPenalty = 0;
                 
                 InitGameState(gameState);
                 
                EPiece j1BoardInit[4][10];
                EPiece j2BoardInit[4][10];

                SetPlayerColors();
                
                j1StartGame(j1Color,j1BoardInit);
                j2StartGame(j2Color,j2BoardInit);

                if( j1Color == ECblue ){ PrintColors(j2Name, j1Name); }
                else{ PrintColors(j1Name, j2Name); }
                
                //Initialisation des pions sur le plateau
                if( j1Color == ECblue ){
                    if( !InitBlueBoard(gameState,j1BoardInit) ){PrintBoardInitError(ECblue);return 0;}           
                    if( !InitRedBoard(gameState,j2BoardInit) ){PrintBoardInitError(ECred);return 0;}
                }
                else{
                    if( !InitRedBoard(gameState,j1BoardInit) ){PrintBoardInitError(ECred);return 0;}
                    if( !InitBlueBoard(gameState,j2BoardInit) ){PrintBoardInitError(ECblue);return 0;}
                }

                //Le premier joueur est le rouge
                EColor player = ECred;

                EColor winner = 0;
                
                PrintLine();
                PrintGameState(gameState);
                
                while( !winner && cptCps>0 ){

                    SMove move;
                    
                    //Duplication du plateau
                    SGameState *gameStateCpy = (SGameState*) malloc(sizeof(SGameState));
                    GameStateCpy(gameState,gameStateCpy);
                    
                    //Si c'est le tour du joueur rouge, on inverse son plateau 
                    if( player == ECred ){
                        RevertGame(gameStateCpy);
                    }

                    //On cache les pions du joueur ennemi
                    HideColor(gameStateCpy,abs((player+1)%2)+2);
                    
                    if( player == j1Color ){ move = j1NextMove(gameStateCpy); }
                    else{ move = j2NextMove(gameStateCpy); }
                    
                    if( player == ECred ){
                        move.start.line = 9-move.start.line;
                        move.end.line = 9-move.end.line;
                    }
                    
                    int moveType = CorrectMove(gameState,move,player);

                    PrintMove(player,move);
                    
                    //Mouvement incorrecte
                    if( moveType == 0 ){
                        if( player == j1Color ){
                            j1NbPenalty++;
                            j1Penalty();
                            PrintInvalidMove(player,j1NbPenalty);
                            if( j1NbPenalty == 3 ){
                                PrintPenalty(j1Name,j1Color);
                                winner = abs((j1Color+1)%2)+2;
                                break;
                            }
                        }
                        else{ 
                            j2NbPenalty++;
                            j2Penalty(); 
                            PrintInvalidMove(player,j2NbPenalty);
                            if( j2NbPenalty == 3 ){
                                PrintPenalty(j2Name,j2Color);
                                winner = abs((j2Color+1)%2)+2;
                                break;
                            }
                        }
                    }
                    else{
                        //Attaque
                        if( moveType == 1 ){
                            EPiece army = gameState->board[move.start.line][move.start.col].piece;
                            EPiece enemy = gameState->board[move.end.line][move.end.col].piece;
                            if( player == j1Color ){
                                j1AttackResult(move.start,army,move.end,enemy);
                                j2AttackResult(move.end,enemy,move.start,army);
                            }
                            else{
                                j1AttackResult(move.end,enemy,move.start,army);
                                j2AttackResult(move.start,army,move.end,enemy);
                            }
                            
                            PrintAttackResult(player,move.start,army,move.end,enemy);
                        }
                        
                        ExecuteMove(gameState,move,player);
                    }
                    PrintGameState(gameState);

                    free(gameStateCpy);

                    if( player == ECred ){ player = ECblue; }
                    else{ player = ECred; }

                    winner = Finished(gameState);
                    cptCps--;
                }
                
                if( cptCps == 0){ PrintMaxMoveReached(); }
                else{ 
                    if( j1Color == winner ){ PrintMatchWinner(j1Name, winner, 4-nbMatch);j1Win++; }
                    else{ PrintMatchWinner(j2Name, winner, 4-nbMatch);j2Win++; }
                }
                nbMatch--;
                
                j1EndGame();
                j2EndGame();
                
                printf("j1Win : %d\nj2Win : %d\n",j1Win,j2Win);
            }
            if( j1Win >= 2 ){ PrintGameWinner(j1Name, j1Color); }
            else{ PrintGameWinner(j2Name, j2Color); }
            
            j1EndMatch();
            j2EndMatch();

            free(gameState);
            return(0);
        }