Esempio n. 1
0
void SpawnPointListItem::update()
{
  QString tmpStr;
  // set the coordinate information
  if (showeq_params->retarded_coords)
  {
    setText(tSpawnPointCoord1, QString::number(m_spawnPoint->y()));
    setText(tSpawnPointCoord2, QString::number(m_spawnPoint->x()));
  }
  else
  {
    setText(tSpawnPointCoord1, QString::number(m_spawnPoint->x()));
    setText(tSpawnPointCoord2, QString::number(m_spawnPoint->y()));
  }
  setText(tSpawnPointCoord3, 
	  QString::number(m_spawnPoint->z(), 'f', 1));

  // construct and set the time remaining string
  if ( m_spawnPoint->diffTime() == 0 || m_spawnPoint->deathTime() == 0 )
    tmpStr = "\277 ?";  // upside down questoin mark followed by question mark
  else
  {
    long secs = m_spawnPoint->secsLeft();
    
    if ( secs > 0 )
      tmpStr.sprintf( "%2ld:%02ld", secs / 60, secs % 60  );
    else
      tmpStr = "   now"; // spaces followed by now
  }
  setText(tSpawnPointRemaining, tmpStr);

  // set the name and last spawn info
  setText(tSpawnPointName, m_spawnPoint->name());
  setText(tSpawnPointLast, m_spawnPoint->last());

  // construct and set the spawned string
  QDateTime       dateTime;
  dateTime.setTime_t( m_spawnPoint->spawnTime() );
  QDate           createDate = dateTime.date();
  tmpStr = "";
  // spawn time
  if ( createDate != QDate::currentDate() )
    tmpStr = createDate.dayName( createDate.dayOfWeek() ) + " ";
  
  tmpStr += dateTime.time().toString();

  // set when it spawned and the count
  setText(tSpawnPointSpawned, tmpStr);
  setText(tSpawnPointCount, QString::number(m_spawnPoint->count()));
}