Fix incorrect judge-button display behaviour(#884)

Co-authored-by: stonedDiscord <Tukz@gmx.de>
This commit is contained in:
Salanto 2023-01-29 22:11:04 +01:00 committed by GitHub
parent 74b02513e3
commit 50beb7de44
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 13 deletions

View File

@ -1420,17 +1420,13 @@ void Courtroom::set_background(QString p_background, bool display)
void Courtroom::set_side(QString p_side) void Courtroom::set_side(QString p_side)
{ {
QString f_side; if (p_side.isEmpty() || p_side == ao_app->get_char_side(current_char)) {
if (p_side == ao_app->get_char_side(current_char))
p_side = "";
current_side = p_side;
if (current_side == "") {
f_side = ao_app->get_char_side(current_char);
ui_pos_remove->hide(); ui_pos_remove->hide();
current_side = ao_app->get_char_side(current_char);
} }
else { else {
f_side = current_side;
ui_pos_remove->show(); ui_pos_remove->show();
current_side = p_side;
} }
set_judge_buttons(); set_judge_buttons();
@ -1440,7 +1436,7 @@ void Courtroom::set_side(QString p_side)
ui_pos_dropdown->blockSignals(true); ui_pos_dropdown->blockSignals(true);
for (int i = 0; i < ui_pos_dropdown->count(); ++i) { for (int i = 0; i < ui_pos_dropdown->count(); ++i) {
QString pos = ui_pos_dropdown->itemText(i); QString pos = ui_pos_dropdown->itemText(i);
if (pos == f_side) { if (pos == current_side) {
// Set the index on dropdown ui element to let you know what pos you're on // Set the index on dropdown ui element to let you know what pos you're on
// right now // right now
@ -1453,7 +1449,7 @@ void Courtroom::set_side(QString p_side)
} }
} }
// We will only get there if we failed the last step // We will only get there if we failed the last step
ui_pos_dropdown->setEditText(f_side); ui_pos_dropdown->setEditText(current_side);
// Unblock the signals so the element can be used for setting pos again // Unblock the signals so the element can be used for setting pos again
ui_pos_dropdown->blockSignals(false); ui_pos_dropdown->blockSignals(false);
} }
@ -1479,7 +1475,6 @@ void Courtroom::set_pos_dropdown(QStringList pos_dropdowns)
// Unblock the signals so the element can be used for setting pos again // Unblock the signals so the element can be used for setting pos again
ui_pos_dropdown->blockSignals(false); ui_pos_dropdown->blockSignals(false);
set_side(current_side);
} }
void Courtroom::update_character(int p_cid, QString char_name, bool reset_emote) void Courtroom::update_character(int p_cid, QString char_name, bool reset_emote)
@ -1506,6 +1501,7 @@ void Courtroom::update_character(int p_cid, QString char_name, bool reset_emote)
} }
current_char = f_char; current_char = f_char;
current_side = ao_app->get_char_side(current_char);
set_side(current_side); set_side(current_side);
set_text_color_dropdown(); set_text_color_dropdown();

View File

@ -388,6 +388,8 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
if (f_contents.size() >= 2) { if (f_contents.size() >= 2) {
// We have a pos included in the background packet! // We have a pos included in the background packet!
if (!f_contents.at(1).isEmpty())
//Not touching it when its empty.
w_courtroom->set_side(f_contents.at(1)); w_courtroom->set_side(f_contents.at(1));
} }
w_courtroom->set_background(f_contents.at(0), f_contents.size() >= 2); w_courtroom->set_background(f_contents.at(0), f_contents.size() >= 2);