mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
NetPlay: rename md5 -> game digest
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
// Copyright 2017 Dolphin Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "DolphinQt/NetPlay/MD5Dialog.h"
|
||||
#include "DolphinQt/NetPlay/GameDigestDialog.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
@ -36,7 +36,7 @@ static QString GetPlayerNameFromPID(int pid)
|
||||
return player_name;
|
||||
}
|
||||
|
||||
MD5Dialog::MD5Dialog(QWidget* parent) : QDialog(parent)
|
||||
GameDigestDialog::GameDigestDialog(QWidget* parent) : QDialog(parent)
|
||||
{
|
||||
CreateWidgets();
|
||||
ConnectWidgets();
|
||||
@ -45,7 +45,7 @@ MD5Dialog::MD5Dialog(QWidget* parent) : QDialog(parent)
|
||||
setWindowModality(Qt::WindowModal);
|
||||
}
|
||||
|
||||
void MD5Dialog::CreateWidgets()
|
||||
void GameDigestDialog::CreateWidgets()
|
||||
{
|
||||
m_main_layout = new QVBoxLayout;
|
||||
m_progress_box = new QGroupBox;
|
||||
@ -61,12 +61,12 @@ void MD5Dialog::CreateWidgets()
|
||||
setLayout(m_main_layout);
|
||||
}
|
||||
|
||||
void MD5Dialog::ConnectWidgets()
|
||||
void GameDigestDialog::ConnectWidgets()
|
||||
{
|
||||
connect(m_button_box, &QDialogButtonBox::rejected, this, &MD5Dialog::reject);
|
||||
connect(m_button_box, &QDialogButtonBox::rejected, this, &GameDigestDialog::reject);
|
||||
}
|
||||
|
||||
void MD5Dialog::show(const QString& title)
|
||||
void GameDigestDialog::show(const QString& title)
|
||||
{
|
||||
m_progress_box->setTitle(title);
|
||||
|
||||
@ -118,7 +118,7 @@ void MD5Dialog::show(const QString& title)
|
||||
QDialog::show();
|
||||
}
|
||||
|
||||
void MD5Dialog::SetProgress(int pid, int progress)
|
||||
void GameDigestDialog::SetProgress(int pid, int progress)
|
||||
{
|
||||
QString player_name = GetPlayerNameFromPID(pid);
|
||||
|
||||
@ -130,7 +130,7 @@ void MD5Dialog::SetProgress(int pid, int progress)
|
||||
m_progress_bars[pid]->setValue(progress);
|
||||
}
|
||||
|
||||
void MD5Dialog::SetResult(int pid, const std::string& result)
|
||||
void GameDigestDialog::SetResult(int pid, const std::string& result)
|
||||
{
|
||||
QString player_name = GetPlayerNameFromPID(pid);
|
||||
|
||||
@ -162,12 +162,12 @@ void MD5Dialog::SetResult(int pid, const std::string& result)
|
||||
}
|
||||
}
|
||||
|
||||
void MD5Dialog::reject()
|
||||
void GameDigestDialog::reject()
|
||||
{
|
||||
auto server = Settings::Instance().GetNetPlayServer();
|
||||
|
||||
if (server)
|
||||
server->AbortMD5();
|
||||
server->AbortGameDigest();
|
||||
|
||||
QDialog::reject();
|
||||
}
|
@ -16,15 +16,15 @@ class QProgressBar;
|
||||
class QVBoxLayout;
|
||||
class QWidget;
|
||||
|
||||
class MD5Dialog : public QDialog
|
||||
class GameDigestDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit MD5Dialog(QWidget* parent);
|
||||
explicit GameDigestDialog(QWidget* parent);
|
||||
|
||||
void show(const QString& title);
|
||||
void SetProgress(int pid, int progress);
|
||||
void SetResult(int pid, const std::string& md5);
|
||||
void SetResult(int pid, const std::string& result);
|
||||
|
||||
void reject() override;
|
||||
|
@ -45,8 +45,8 @@
|
||||
#include "Core/SyncIdentifier.h"
|
||||
|
||||
#include "DolphinQt/NetPlay/ChunkedProgressDialog.h"
|
||||
#include "DolphinQt/NetPlay/GameDigestDialog.h"
|
||||
#include "DolphinQt/NetPlay/GameListDialog.h"
|
||||
#include "DolphinQt/NetPlay/MD5Dialog.h"
|
||||
#include "DolphinQt/NetPlay/PadMappingDialog.h"
|
||||
#include "DolphinQt/QtUtils/ModalMessageBox.h"
|
||||
#include "DolphinQt/QtUtils/QueueOnObject.h"
|
||||
@ -100,7 +100,7 @@ NetPlayDialog::NetPlayDialog(const GameListModel& game_list_model,
|
||||
setWindowIcon(Resources::GetAppIcon());
|
||||
|
||||
m_pad_mapping = new PadMappingDialog(this);
|
||||
m_md5_dialog = new MD5Dialog(this);
|
||||
m_game_digest_dialog = new GameDigestDialog(this);
|
||||
m_chunked_progress_dialog = new ChunkedProgressDialog(this);
|
||||
|
||||
ResetExternalIP();
|
||||
@ -182,19 +182,20 @@ void NetPlayDialog::CreateMainLayout()
|
||||
m_network_mode_group->addAction(m_golf_mode_action);
|
||||
m_fixed_delay_action->setChecked(true);
|
||||
|
||||
m_md5_menu = m_menu_bar->addMenu(tr("Checksum"));
|
||||
m_md5_menu->addAction(tr("Current game"), this, [this] {
|
||||
Settings::Instance().GetNetPlayServer()->ComputeMD5(m_current_game_identifier);
|
||||
m_game_digest_menu = m_menu_bar->addMenu(tr("Checksum"));
|
||||
m_game_digest_menu->addAction(tr("Current game"), this, [this] {
|
||||
Settings::Instance().GetNetPlayServer()->ComputeGameDigest(m_current_game_identifier);
|
||||
});
|
||||
m_md5_menu->addAction(tr("Other game..."), this, [this] {
|
||||
m_game_digest_menu->addAction(tr("Other game..."), this, [this] {
|
||||
GameListDialog gld(m_game_list_model, this);
|
||||
|
||||
if (gld.exec() != QDialog::Accepted)
|
||||
return;
|
||||
Settings::Instance().GetNetPlayServer()->ComputeMD5(gld.GetSelectedGame().GetSyncIdentifier());
|
||||
Settings::Instance().GetNetPlayServer()->ComputeGameDigest(
|
||||
gld.GetSelectedGame().GetSyncIdentifier());
|
||||
});
|
||||
m_md5_menu->addAction(tr("SD Card"), this, [] {
|
||||
Settings::Instance().GetNetPlayServer()->ComputeMD5(
|
||||
m_game_digest_menu->addAction(tr("SD Card"), this, [] {
|
||||
Settings::Instance().GetNetPlayServer()->ComputeGameDigest(
|
||||
NetPlay::NetPlayClient::GetSDCardIdentifier());
|
||||
});
|
||||
|
||||
@ -506,7 +507,7 @@ void NetPlayDialog::show(std::string nickname, bool use_traversal)
|
||||
|
||||
m_data_menu->menuAction()->setVisible(is_hosting);
|
||||
m_network_menu->menuAction()->setVisible(is_hosting);
|
||||
m_md5_menu->menuAction()->setVisible(is_hosting);
|
||||
m_game_digest_menu->menuAction()->setVisible(is_hosting);
|
||||
#ifdef HAS_LIBMGBA
|
||||
m_hide_remote_gbas_action->setVisible(is_hosting);
|
||||
#else
|
||||
@ -1175,39 +1176,39 @@ void NetPlayDialog::SaveSettings()
|
||||
Config::SetBase(Config::NETPLAY_NETWORK_MODE, network_mode);
|
||||
}
|
||||
|
||||
void NetPlayDialog::ShowMD5Dialog(const std::string& title)
|
||||
void NetPlayDialog::ShowGameDigestDialog(const std::string& title)
|
||||
{
|
||||
QueueOnObject(this, [this, title] {
|
||||
m_md5_menu->setEnabled(false);
|
||||
m_game_digest_menu->setEnabled(false);
|
||||
|
||||
if (m_md5_dialog->isVisible())
|
||||
m_md5_dialog->close();
|
||||
if (m_game_digest_dialog->isVisible())
|
||||
m_game_digest_dialog->close();
|
||||
|
||||
m_md5_dialog->show(QString::fromStdString(title));
|
||||
m_game_digest_dialog->show(QString::fromStdString(title));
|
||||
});
|
||||
}
|
||||
|
||||
void NetPlayDialog::SetMD5Progress(int pid, int progress)
|
||||
void NetPlayDialog::SetGameDigestProgress(int pid, int progress)
|
||||
{
|
||||
QueueOnObject(this, [this, pid, progress] {
|
||||
if (m_md5_dialog->isVisible())
|
||||
m_md5_dialog->SetProgress(pid, progress);
|
||||
if (m_game_digest_dialog->isVisible())
|
||||
m_game_digest_dialog->SetProgress(pid, progress);
|
||||
});
|
||||
}
|
||||
|
||||
void NetPlayDialog::SetMD5Result(int pid, const std::string& result)
|
||||
void NetPlayDialog::SetGameDigestResult(int pid, const std::string& result)
|
||||
{
|
||||
QueueOnObject(this, [this, pid, result] {
|
||||
m_md5_dialog->SetResult(pid, result);
|
||||
m_md5_menu->setEnabled(true);
|
||||
m_game_digest_dialog->SetResult(pid, result);
|
||||
m_game_digest_menu->setEnabled(true);
|
||||
});
|
||||
}
|
||||
|
||||
void NetPlayDialog::AbortMD5()
|
||||
void NetPlayDialog::AbortGameDigest()
|
||||
{
|
||||
QueueOnObject(this, [this] {
|
||||
m_md5_dialog->close();
|
||||
m_md5_menu->setEnabled(true);
|
||||
m_game_digest_dialog->close();
|
||||
m_game_digest_menu->setEnabled(true);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
class BootSessionData;
|
||||
class ChunkedProgressDialog;
|
||||
class MD5Dialog;
|
||||
class GameDigestDialog;
|
||||
class PadMappingDialog;
|
||||
class QCheckBox;
|
||||
class QComboBox;
|
||||
@ -85,10 +85,10 @@ public:
|
||||
void LoadSettings();
|
||||
void SaveSettings();
|
||||
|
||||
void ShowMD5Dialog(const std::string& title) override;
|
||||
void SetMD5Progress(int pid, int progress) override;
|
||||
void SetMD5Result(int pid, const std::string& result) override;
|
||||
void AbortMD5() override;
|
||||
void ShowGameDigestDialog(const std::string& title) override;
|
||||
void SetGameDigestProgress(int pid, int progress) override;
|
||||
void SetGameDigestResult(int pid, const std::string& result) override;
|
||||
void AbortGameDigest() override;
|
||||
|
||||
void ShowChunkedProgressDialog(const std::string& title, u64 data_size,
|
||||
const std::vector<int>& players) override;
|
||||
@ -136,7 +136,7 @@ private:
|
||||
QMenuBar* m_menu_bar;
|
||||
QMenu* m_data_menu;
|
||||
QMenu* m_network_menu;
|
||||
QMenu* m_md5_menu;
|
||||
QMenu* m_game_digest_menu;
|
||||
QMenu* m_other_menu;
|
||||
QPushButton* m_game_button;
|
||||
QPushButton* m_start_button;
|
||||
@ -159,7 +159,7 @@ private:
|
||||
QActionGroup* m_network_mode_group;
|
||||
|
||||
QGridLayout* m_main_layout;
|
||||
MD5Dialog* m_md5_dialog;
|
||||
GameDigestDialog* m_game_digest_dialog;
|
||||
ChunkedProgressDialog* m_chunked_progress_dialog;
|
||||
PadMappingDialog* m_pad_mapping;
|
||||
NetPlay::SyncIdentifier m_current_game_identifier;
|
||||
|
Reference in New Issue
Block a user