Пример #1
0
void MD5Dialog::SetResult(int pid, const std::string& result)
{
  QString player_name = GetPlayerNameFromPID(pid);

  if (!m_status_labels.count(pid))
    return;

  m_status_labels[pid]->setText(
      tr("%1[%2]: %3").arg(player_name, QString::number(pid), QString::fromStdString(result)));

  m_results.push_back(result);

  auto client = Settings::Instance().GetNetPlayClient();
  if (client && m_results.size() >= client->GetPlayers().size())
  {
    if (std::adjacent_find(m_results.begin(), m_results.end(), std::not_equal_to<>()) ==
        m_results.end())
    {
      m_check_label->setText(tr("The hashes match!"));
    }
    else
    {
      m_check_label->setText(tr("The hashes do not match!"));
    }
  }
}
Пример #2
0
void MD5Dialog::SetProgress(int pid, int progress)
{
  QString player_name = GetPlayerNameFromPID(pid);

  if (!m_status_labels.count(pid))
    return;

  m_status_labels[pid]->setText(
      tr("%1[%2]: %3 %").arg(player_name, QString::number(pid), QString::number(progress)));
  m_progress_bars[pid]->setValue(progress);
}
Пример #3
0
void MD5Dialog::SetResult(int pid, const std::string& result)
{
  QString player_name = GetPlayerNameFromPID(pid);

  if (!m_status_labels.count(pid))
    return;

  m_status_labels[pid]->setText(
      tr("%1[%2]: %3").arg(player_name, QString::number(pid), QString::fromStdString(result)));

  if (m_last_result.empty())
  {
    m_check_label->setText(tr("The hashes match!"));
    return;
  }

  if (m_last_result != result)
  {
    m_check_label->setText(tr("The hashes do not match!"));
  }

  m_last_result = result;
}