This commit is contained in:
Tygyh 2025-04-23 21:30:01 -04:00 committed by GitHub
commit 78bcf79bb1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 51 additions and 51 deletions

View file

@ -25,7 +25,7 @@
static QString GetPlayerNameFromPID(int pid)
{
QString player_name = QObject::tr("Invalid Player ID");
auto client = Settings::Instance().GetNetPlayClient();
const auto client = Settings::Instance().GetNetPlayClient();
if (!client)
return player_name;
@ -73,13 +73,13 @@ void ChunkedProgressDialog::show(const QString& title, const u64 data_size,
m_progress_box->setTitle(title);
m_data_size = data_size;
for (auto& pair : m_progress_bars)
for (const auto& pair : m_progress_bars)
{
m_progress_layout->removeWidget(pair.second);
pair.second->deleteLater();
}
for (auto& pair : m_status_labels)
for (const auto& pair : m_status_labels)
{
m_progress_layout->removeWidget(pair.second);
pair.second->deleteLater();
@ -88,7 +88,7 @@ void ChunkedProgressDialog::show(const QString& title, const u64 data_size,
m_progress_bars.clear();
m_status_labels.clear();
auto client = Settings::Instance().GetNetPlayClient();
const auto client = Settings::Instance().GetNetPlayClient();
if (!client)
return;
@ -142,7 +142,7 @@ void ChunkedProgressDialog::SetProgress(const int pid, const u64 progress)
void ChunkedProgressDialog::reject()
{
auto server = Settings::Instance().GetNetPlayServer();
const auto server = Settings::Instance().GetNetPlayServer();
if (server)
server->AbortGameStart();

View file

@ -21,7 +21,7 @@
static QString GetPlayerNameFromPID(int pid)
{
QString player_name = QObject::tr("Invalid Player ID");
auto client = Settings::Instance().GetNetPlayClient();
const auto client = Settings::Instance().GetNetPlayClient();
if (!client)
return player_name;
@ -70,13 +70,13 @@ void GameDigestDialog::show(const QString& title)
{
m_progress_box->setTitle(title);
for (auto& pair : m_progress_bars)
for (const auto& pair : m_progress_bars)
{
m_progress_layout->removeWidget(pair.second);
pair.second->deleteLater();
}
for (auto& pair : m_status_labels)
for (const auto& pair : m_status_labels)
{
m_progress_layout->removeWidget(pair.second);
pair.second->deleteLater();
@ -87,7 +87,7 @@ void GameDigestDialog::show(const QString& title)
m_results.clear();
m_check_label->setText(QString::fromStdString(""));
auto client = Settings::Instance().GetNetPlayClient();
const auto client = Settings::Instance().GetNetPlayClient();
if (!client)
return;
@ -142,7 +142,7 @@ void GameDigestDialog::SetResult(int pid, const std::string& result)
m_results.push_back(result);
auto client = Settings::Instance().GetNetPlayClient();
const auto client = Settings::Instance().GetNetPlayClient();
if (client && m_results.size() >= client->GetPlayers().size())
{
if (std::ranges::adjacent_find(m_results, std::ranges::not_equal_to{}) == m_results.end())
@ -163,7 +163,7 @@ void GameDigestDialog::SetResult(int pid, const std::string& result)
void GameDigestDialog::reject()
{
auto server = Settings::Instance().GetNetPlayServer();
const auto server = Settings::Instance().GetNetPlayServer();
if (server)
server->AbortGameDigest();

View file

@ -289,7 +289,7 @@ void NetPlayBrowser::accept()
const int index = m_table_widget->selectedItems()[0]->row();
NetPlaySession& session = m_sessions[index];
const NetPlaySession& session = m_sessions[index];
std::string server_id = session.server_id;
@ -309,7 +309,7 @@ void NetPlayBrowser::accept()
const std::string password = dialog.textValue().toStdString();
auto decrypted_id = session.DecryptID(password);
const auto decrypted_id = session.DecryptID(password);
if (!decrypted_id)
{

View file

@ -113,7 +113,7 @@ NetPlayDialog::NetPlayDialog(const GameListModel& game_list_model,
LoadSettings();
ConnectWidgets();
auto& settings = Settings::Instance().GetQSettings();
const auto& settings = Settings::Instance().GetQSettings();
restoreGeometry(settings.value(QStringLiteral("netplaydialog/geometry")).toByteArray());
m_splitter->restoreState(settings.value(QStringLiteral("netplaydialog/splitter")).toByteArray());
@ -330,12 +330,12 @@ void NetPlayDialog::ConnectWidgets()
QApplication::clipboard()->setText(m_hostcode_label->text());
});
connect(m_players_list, &QTableWidget::itemSelectionChanged, [this] {
int row = m_players_list->currentRow();
const int row = m_players_list->currentRow();
m_kick_button->setEnabled(row > 0 &&
!m_players_list->currentItem()->data(Qt::UserRole).isNull());
});
connect(m_kick_button, &QPushButton::clicked, [this] {
auto id = m_players_list->currentItem()->data(Qt::UserRole).toInt();
const auto id = m_players_list->currentItem()->data(Qt::UserRole).toInt();
Settings::Instance().GetNetPlayServer()->KickPlayer(id);
});
connect(m_assign_ports_button, &QPushButton::clicked, [this] {
@ -358,8 +358,8 @@ void NetPlayDialog::ConnectWidgets()
if (value == m_buffer_size)
return;
auto client = Settings::Instance().GetNetPlayClient();
auto server = Settings::Instance().GetNetPlayServer();
const auto client = Settings::Instance().GetNetPlayClient();
const auto server = Settings::Instance().GetNetPlayServer();
if (server && !m_host_input_authority)
server->AdjustPadBufferSize(value);
else
@ -369,7 +369,7 @@ void NetPlayDialog::ConnectWidgets()
const auto hia_function = [this](bool enable) {
if (m_host_input_authority != enable)
{
auto server = Settings::Instance().GetNetPlayServer();
const auto server = Settings::Instance().GetNetPlayServer();
if (server)
server->SetHostInputAuthority(enable);
}
@ -442,7 +442,7 @@ void NetPlayDialog::SendMessage(const std::string& msg)
void NetPlayDialog::OnChat()
{
QueueOnObject(this, [this] {
auto msg = m_chat_type_edit->text().toStdString();
const auto msg = m_chat_type_edit->text().toStdString();
if (msg.empty())
return;
@ -516,7 +516,7 @@ void NetPlayDialog::show(std::string nickname, bool use_traversal)
m_chat_edit->clear();
m_chat_type_edit->clear();
bool is_hosting = Settings::Instance().GetNetPlayServer() != nullptr;
const bool is_hosting = Settings::Instance().GetNetPlayServer() != nullptr;
if (is_hosting)
{
@ -616,8 +616,8 @@ void NetPlayDialog::UpdateDiscordPresence()
void NetPlayDialog::UpdateGUI()
{
auto client = Settings::Instance().GetNetPlayClient();
auto server = Settings::Instance().GetNetPlayServer();
const auto client = Settings::Instance().GetNetPlayClient();
const auto server = Settings::Instance().GetNetPlayServer();
if (!client)
return;
@ -629,9 +629,9 @@ void NetPlayDialog::UpdateGUI()
m_player_count = static_cast<int>(players.size());
int selection_pid = m_players_list->currentItem() ?
m_players_list->currentItem()->data(Qt::UserRole).toInt() :
-1;
const int selection_pid = m_players_list->currentItem() ?
m_players_list->currentItem()->data(Qt::UserRole).toInt() :
-1;
m_players_list->clear();
m_players_list->setHorizontalHeaderLabels(
@ -803,7 +803,7 @@ void NetPlayDialog::DisplayMessage(const QString& msg, const std::string& color,
.arg(QString::fromStdString(color), msg.toHtmlEscaped()));
});
QColor c(color.empty() ? QStringLiteral("white") : QString::fromStdString(color));
const QColor c(color.empty() ? QStringLiteral("white") : QString::fromStdString(color));
if (Config::Get(Config::GFX_SHOW_NETPLAY_MESSAGES) &&
Core::IsRunning(Core::System::GetInstance()))
@ -886,11 +886,11 @@ void NetPlayDialog::OnMsgStartGame()
}
QueueOnObject(this, [this] {
auto client = Settings::Instance().GetNetPlayClient();
const auto client = Settings::Instance().GetNetPlayClient();
if (client)
{
if (auto game = FindGameFile(m_current_game_identifier))
if (const auto game = FindGameFile(m_current_game_identifier))
client->StartGame(game->GetFilePath());
else
PanicAlertFmtT("Selected game doesn't exist in game list!");
@ -1052,7 +1052,7 @@ void NetPlayDialog::OnTtlDetermined(u8 ttl)
bool NetPlayDialog::IsRecording()
{
std::optional<bool> is_recording = RunOnObject(m_record_input_action, &QAction::isChecked);
const std::optional<bool> is_recording = RunOnObject(m_record_input_action, &QAction::isChecked);
if (is_recording)
return *is_recording;
return false;
@ -1068,7 +1068,7 @@ NetPlayDialog::FindGameFile(const NetPlay::SyncIdentifier& sync_identifier,
*found = NetPlay::SyncIdentifierComparison::DifferentGame;
std::optional<std::shared_ptr<const UICommon::GameFile>> game_file =
const std::optional<std::shared_ptr<const UICommon::GameFile>> game_file =
RunOnObject(this, [this, &sync_identifier, found] {
for (int i = 0; i < m_game_list_model.rowCount(QModelIndex()); i++)
{
@ -1088,7 +1088,7 @@ std::string NetPlayDialog::FindGBARomPath(const std::array<u8, 20>& hash, std::s
int device_number)
{
#ifdef HAS_LIBMGBA
auto result = RunOnObject(this, [&, this] {
const auto result = RunOnObject(this, [&, this] {
std::string rom_path;
std::array<u8, 20> rom_hash;
std::string rom_title;
@ -1279,7 +1279,7 @@ void NetPlayDialog::SetChunkedProgress(const int pid, const u64 progress)
void NetPlayDialog::SetHostWiiSyncData(std::vector<u64> titles, std::string redirect_folder)
{
auto client = Settings::Instance().GetNetPlayClient();
const auto client = Settings::Instance().GetNetPlayClient();
if (client)
client->SetWiiSyncData(nullptr, std::move(titles), std::move(redirect_folder));
}

View file

@ -36,19 +36,19 @@ NetPlaySetupDialog::NetPlaySetupDialog(const GameListModel& game_list_model, QWi
CreateMainLayout();
bool use_index = Config::Get(Config::NETPLAY_USE_INDEX);
std::string index_region = Config::Get(Config::NETPLAY_INDEX_REGION);
std::string index_name = Config::Get(Config::NETPLAY_INDEX_NAME);
std::string index_password = Config::Get(Config::NETPLAY_INDEX_PASSWORD);
std::string nickname = Config::Get(Config::NETPLAY_NICKNAME);
std::string traversal_choice = Config::Get(Config::NETPLAY_TRAVERSAL_CHOICE);
int connect_port = Config::Get(Config::NETPLAY_CONNECT_PORT);
int host_port = Config::Get(Config::NETPLAY_HOST_PORT);
int host_listen_port = Config::Get(Config::NETPLAY_LISTEN_PORT);
bool enable_chunked_upload_limit = Config::Get(Config::NETPLAY_ENABLE_CHUNKED_UPLOAD_LIMIT);
u32 chunked_upload_limit = Config::Get(Config::NETPLAY_CHUNKED_UPLOAD_LIMIT);
const bool use_index = Config::Get(Config::NETPLAY_USE_INDEX);
const std::string index_region = Config::Get(Config::NETPLAY_INDEX_REGION);
const std::string index_name = Config::Get(Config::NETPLAY_INDEX_NAME);
const std::string index_password = Config::Get(Config::NETPLAY_INDEX_PASSWORD);
const std::string nickname = Config::Get(Config::NETPLAY_NICKNAME);
const std::string traversal_choice = Config::Get(Config::NETPLAY_TRAVERSAL_CHOICE);
const int connect_port = Config::Get(Config::NETPLAY_CONNECT_PORT);
const int host_port = Config::Get(Config::NETPLAY_HOST_PORT);
const int host_listen_port = Config::Get(Config::NETPLAY_LISTEN_PORT);
const bool enable_chunked_upload_limit = Config::Get(Config::NETPLAY_ENABLE_CHUNKED_UPLOAD_LIMIT);
const u32 chunked_upload_limit = Config::Get(Config::NETPLAY_CHUNKED_UPLOAD_LIMIT);
#ifdef USE_UPNP
bool use_upnp = Config::Get(Config::NETPLAY_USE_UPNP);
const bool use_upnp = Config::Get(Config::NETPLAY_USE_UPNP);
m_host_upnp->setChecked(use_upnp);
#endif
@ -305,7 +305,7 @@ void NetPlaySetupDialog::OnConnectionTypeChanged(int index)
m_reset_traversal_button->setHidden(index == 0);
std::string address =
const std::string address =
index == 0 ? Config::Get(Config::NETPLAY_ADDRESS) : Config::Get(Config::NETPLAY_HOST_CODE);
m_ip_label->setText(index == 0 ? tr("IP Address:") : tr("Host Code:"));

View file

@ -67,8 +67,8 @@ void PadMappingDialog::ConnectWidgets()
int PadMappingDialog::exec()
{
auto client = Settings::Instance().GetNetPlayClient();
auto server = Settings::Instance().GetNetPlayServer();
const auto client = Settings::Instance().GetNetPlayClient();
const auto server = Settings::Instance().GetNetPlayServer();
// Load Settings
m_players = client->GetPlayers();
m_pad_mapping = server->GetPadMapping();
@ -87,7 +87,7 @@ int PadMappingDialog::exec()
for (auto& combo_group : {m_gc_boxes, m_wii_boxes})
{
bool gc = combo_group == m_gc_boxes;
const bool gc = combo_group == m_gc_boxes;
for (size_t i = 0; i < combo_group.size(); i++)
{
auto& combo = combo_group[i];
@ -131,8 +131,8 @@ void PadMappingDialog::OnMappingChanged()
{
for (unsigned int i = 0; i < m_wii_boxes.size(); i++)
{
int gc_id = m_gc_boxes[i]->currentIndex();
int wii_id = m_wii_boxes[i]->currentIndex();
const int gc_id = m_gc_boxes[i]->currentIndex();
const int wii_id = m_wii_boxes[i]->currentIndex();
m_pad_mapping[i] = gc_id > 0 ? m_players[gc_id - 1]->pid : 0;
m_gba_config[i].enabled = m_gba_boxes[i]->isChecked();