mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-19 07:21:40 +00:00
DolphinQT/Netplay: Make variables constant
This commit is contained in:
parent
b2e5d6df25
commit
cb30862cfb
6 changed files with 51 additions and 51 deletions
|
@ -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));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue