@@ -727,6 +727,7 @@ void Courtroom::set_widgets()
727727 tr (" Set your character's emote to play on your next message." ));
728728
729729 set_size_and_pos (ui_pos_dropdown, " pos_dropdown" );
730+ ui_pos_dropdown->setEditable (true );
730731 ui_pos_dropdown->setToolTip (
731732 tr (" Set your character's supplementary background." ));
732733
@@ -1317,18 +1318,34 @@ void Courtroom::set_side(QString p_side, bool block_signals)
13171318 ui_pos_dropdown->blockSignals (false );
13181319
13191320 // alright we dun, jobs done here boyos
1320- break ;
1321+ return ;
13211322 }
13221323 }
1324+ // We will only get there if we failed the last step
1325+ if (block_signals)
1326+ ui_pos_dropdown->blockSignals (true );
1327+ if (temp_side_index > -1 )
1328+ ui_pos_dropdown->removeItem (temp_side_index);
1329+ ui_pos_dropdown->addItem (f_side);
1330+ temp_side_index = ui_pos_dropdown->count ()-1 ;
1331+ ui_pos_dropdown->setCurrentIndex (temp_side_index);
1332+ if (block_signals)
1333+ ui_pos_dropdown->blockSignals (false );
13231334}
13241335
13251336void Courtroom::set_pos_dropdown (QStringList pos_dropdowns)
13261337{
13271338 // Block the signals to prevent setCurrentIndex from triggering a pos change
13281339 ui_pos_dropdown->blockSignals (true );
13291340 pos_dropdown_list = pos_dropdowns;
1341+ temp_side_index = -1 ;
13301342 ui_pos_dropdown->clear ();
13311343 ui_pos_dropdown->addItems (pos_dropdown_list);
1344+ // Custom pos
1345+ if (current_side != " " && !pos_dropdown_list.contains (current_side)) {
1346+ ui_pos_dropdown->addItem (current_side);
1347+ temp_side_index = ui_pos_dropdown->count () - 1 ;
1348+ }
13321349 // Unblock the signals so the element can be used for setting pos again
13331350 ui_pos_dropdown->blockSignals (false );
13341351 set_side (current_side);
@@ -3758,13 +3775,13 @@ void Courtroom::handle_wtce(QString p_wtce, int variant)
37583775 ui_vp_testimony->kill ();
37593776 return ;
37603777 }
3761- sfx_name = ao_app->get_court_sfx (" witnesstestimony " , bg_misc);
3778+ sfx_name = ao_app->get_court_sfx (" witness_testimony " , bg_misc);
37623779 filename = " witnesstestimony" ;
37633780 ui_vp_testimony->load_image (" testimony" , " " , bg_misc);
37643781 }
37653782 // cross examination
37663783 else if (p_wtce == " testimony2" ) {
3767- sfx_name = ao_app->get_court_sfx (" crossexamination " , bg_misc);
3784+ sfx_name = ao_app->get_court_sfx (" cross_examination " , bg_misc);
37683785 filename = " crossexamination" ;
37693786 ui_vp_testimony->kill ();
37703787 }
@@ -3774,7 +3791,7 @@ void Courtroom::handle_wtce(QString p_wtce, int variant)
37743791 // Verdict?
37753792 if (p_wtce == " judgeruling" ) {
37763793 if (variant == 0 ) {
3777- sfx_name = ao_app->get_court_sfx (" notguilty " , bg_misc);
3794+ sfx_name = ao_app->get_court_sfx (" not_guilty " , bg_misc);
37783795 filename = " notguilty" ;
37793796 ui_vp_testimony->kill ();
37803797 }
@@ -4282,10 +4299,19 @@ void Courtroom::on_pos_dropdown_changed(int p_index)
42824299 // YEAH SENDING LIKE 20 PACKETS IF THE USER SCROLLS THROUGH, GREAT IDEA
42834300 // how about this instead
42844301 set_side (f_pos);
4302+ if (temp_side_index > -1 && p_index == temp_side_index) {
4303+ ui_pos_dropdown->removeItem (temp_side_index);
4304+ temp_side_index = -1 ;
4305+ }
42854306}
42864307
42874308void Courtroom::on_pos_remove_clicked ()
42884309{
4310+ if (temp_side_index > -1 ) {
4311+ ui_pos_dropdown->removeItem (temp_side_index);
4312+ temp_side_index = -1 ;
4313+ }
4314+
42894315 QString default_side = ao_app->get_char_side (current_char);
42904316
42914317 for (int i = 0 ; i < ui_pos_dropdown->count (); ++i) {
@@ -4296,10 +4322,12 @@ void Courtroom::on_pos_remove_clicked()
42964322 }
42974323 }
42984324 int wit_index = ui_pos_dropdown->findText (" wit" );
4325+ ui_pos_dropdown->blockSignals (true );
42994326 if ((ui_pos_dropdown->currentText () != default_side) & (wit_index != -1 )) // i.e. this bg doesn't have our pos
43004327 ui_pos_dropdown->setCurrentIndex (wit_index); // fall back to "wit"
43014328 else if (ui_pos_dropdown->currentText () != default_side) // we don't have "wit" either?
43024329 ui_pos_dropdown->setCurrentIndex (0 ); // as a last resort, choose the first item in the dropdown
4330+ ui_pos_dropdown->blockSignals (false );
43034331 current_side = " " ;
43044332 ui_pos_remove->hide ();
43054333 ui_ic_chat_message->setFocus ();
0 commit comments