diff options
| author | Techjar <tecknojar@gmail.com> | 2018-07-04 21:30:20 -0400 |
|---|---|---|
| committer | Techjar <tecknojar@gmail.com> | 2018-07-04 22:51:11 -0400 |
| commit | f3e2d98fddce8cf9ce75554d29929635cf4a1a3f (patch) | |
| tree | 05376177dbbe2ea2288c3a4244e7338174cb6350 /Source | |
| parent | fd83937987f5a6a9152513975375c49d49028daf (diff) | |
Qt/MD5Dialog: Fix checksum result comparison
Diffstat (limited to 'Source')
| -rw-r--r-- | Source/Core/DolphinQt2/NetPlay/MD5Dialog.cpp | 27 | ||||
| -rw-r--r-- | Source/Core/DolphinQt2/NetPlay/MD5Dialog.h | 6 |
2 files changed, 21 insertions, 12 deletions
diff --git a/Source/Core/DolphinQt2/NetPlay/MD5Dialog.cpp b/Source/Core/DolphinQt2/NetPlay/MD5Dialog.cpp index d3aee5c0b8..ecfafac610 100644 --- a/Source/Core/DolphinQt2/NetPlay/MD5Dialog.cpp +++ b/Source/Core/DolphinQt2/NetPlay/MD5Dialog.cpp @@ -4,6 +4,9 @@ #include "DolphinQt2/NetPlay/MD5Dialog.h" +#include <algorithm> +#include <functional> + #include <QDialogButtonBox> #include <QGroupBox> #include <QLabel> @@ -73,6 +76,8 @@ void MD5Dialog::show(const QString& title) m_progress_bars.clear(); m_status_labels.clear(); + m_results.clear(); + m_check_label->setText(QString::fromStdString("")); for (const auto* player : Settings::Instance().GetNetPlayClient()->GetPlayers()) { @@ -83,8 +88,6 @@ void MD5Dialog::show(const QString& title) m_progress_layout->addWidget(m_status_labels[player->pid]); } - m_last_result = ""; - QDialog::show(); } @@ -110,18 +113,20 @@ void MD5Dialog::SetResult(int pid, const std::string& result) 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; - } + m_results.push_back(result); - if (m_last_result != result) + if (m_results.size() >= Settings::Instance().GetNetPlayClient()->GetPlayers().size()) { - m_check_label->setText(tr("The hashes do not match!")); + 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!")); + } } - - m_last_result = result; } void MD5Dialog::reject() diff --git a/Source/Core/DolphinQt2/NetPlay/MD5Dialog.h b/Source/Core/DolphinQt2/NetPlay/MD5Dialog.h index 8701f44d40..a68140326d 100644 --- a/Source/Core/DolphinQt2/NetPlay/MD5Dialog.h +++ b/Source/Core/DolphinQt2/NetPlay/MD5Dialog.h @@ -4,6 +4,10 @@ #pragma once +#include <map> +#include <string> +#include <vector> + #include <QDialog> class QDialogButtonBox; @@ -32,7 +36,7 @@ private: std::map<int, QProgressBar*> m_progress_bars; std::map<int, QLabel*> m_status_labels; - std::string m_last_result; + std::vector<std::string> m_results; QGroupBox* m_progress_box; QVBoxLayout* m_progress_layout; |
