forked from ShuriZma/suyu
1
0
Fork 0

applets/controller: Resolve several compiler warnings

Resolves -Wsign-compare and -Wunused-variable
This commit is contained in:
Morph 2020-08-28 13:14:19 -04:00
parent 076e4d44c3
commit b65456b958
2 changed files with 8 additions and 7 deletions

View File

@ -29,7 +29,8 @@ void DefaultControllerApplet::ReconfigureControllers(std::function<void()> callb
auto& players = Settings::values.players; auto& players = Settings::values.players;
const auto min_supported_players = parameters.enable_single_mode ? 1 : parameters.min_players; const std::size_t min_supported_players =
parameters.enable_single_mode ? 1 : parameters.min_players;
// Disconnect Handheld first. // Disconnect Handheld first.
npad.DisconnectNPadAtIndex(8); npad.DisconnectNPadAtIndex(8);

View File

@ -289,11 +289,9 @@ void QtControllerSelectorDialog::CallConfigureInputDialog() {
void QtControllerSelectorDialog::CheckIfParametersMet() { void QtControllerSelectorDialog::CheckIfParametersMet() {
// Here, we check and validate the current configuration against all applicable parameters. // Here, we check and validate the current configuration against all applicable parameters.
const auto& players = Settings::values.players; const auto num_connected_players = static_cast<int>(
const auto num_connected_players =
std::count_if(player_groupboxes.begin(), player_groupboxes.end(), std::count_if(player_groupboxes.begin(), player_groupboxes.end(),
[this](const QGroupBox* player) { return player->isChecked(); }); [this](const QGroupBox* player) { return player->isChecked(); }));
const auto min_supported_players = parameters.enable_single_mode ? 1 : parameters.min_players; const auto min_supported_players = parameters.enable_single_mode ? 1 : parameters.min_players;
const auto max_supported_players = parameters.enable_single_mode ? 1 : parameters.max_players; const auto max_supported_players = parameters.enable_single_mode ? 1 : parameters.max_players;
@ -489,7 +487,8 @@ void QtControllerSelectorDialog::UpdateLEDPattern(std::size_t player_index) {
} }
void QtControllerSelectorDialog::UpdateBorderColor(std::size_t player_index) { void QtControllerSelectorDialog::UpdateBorderColor(std::size_t player_index) {
if (!parameters.enable_border_color || player_index >= parameters.max_players || if (!parameters.enable_border_color ||
player_index >= static_cast<std::size_t>(parameters.max_players) ||
player_groupboxes[player_index]->styleSheet().contains(QStringLiteral("QGroupBox"))) { player_groupboxes[player_index]->styleSheet().contains(QStringLiteral("QGroupBox"))) {
return; return;
} }
@ -506,7 +505,8 @@ void QtControllerSelectorDialog::UpdateBorderColor(std::size_t player_index) {
} }
void QtControllerSelectorDialog::SetExplainText(std::size_t player_index) { void QtControllerSelectorDialog::SetExplainText(std::size_t player_index) {
if (!parameters.enable_explain_text || player_index >= parameters.max_players) { if (!parameters.enable_explain_text ||
player_index >= static_cast<std::size_t>(parameters.max_players)) {
return; return;
} }