From 04daff7446061bb87bdf85ed080079041a75f142 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Wed, 18 Sep 2019 15:46:43 +0300 Subject: [PATCH] When the realization button is pressed, update the Effects thing too. --- include/courtroom.h | 1 + src/courtroom.cpp | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/include/courtroom.h b/include/courtroom.h index 6ba3d65..a980aba 100644 --- a/include/courtroom.h +++ b/include/courtroom.h @@ -627,6 +627,7 @@ private slots: void set_effects_dropdown(); void on_effects_dropdown_changed(int p_index); + bool effects_dropdown_find_and_set(QString effect); QString get_char_sfx(); int get_char_sfx_delay(); diff --git a/src/courtroom.cpp b/src/courtroom.cpp index bcf3a42..423c560 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -3564,6 +3564,20 @@ void Courtroom::on_effects_dropdown_changed(int p_index) ui_ic_chat_message->setFocus(); } +bool Courtroom::effects_dropdown_find_and_set(QString effect) +{ + for (int i = 0; i < ui_effects_dropdown->count(); ++i) + { + QString entry = ui_effects_dropdown->itemText(i); + if (entry == effect) + { + ui_effects_dropdown->setCurrentIndex(i); + return true; + } + } + return false; +} + QString Courtroom::get_char_sfx() { QString sfx = ui_sfx_dropdown->itemText(ui_sfx_dropdown->currentIndex()); @@ -3775,11 +3789,14 @@ void Courtroom::on_realization_clicked() if (realization_state == 0) { realization_state = 1; + effects_dropdown_find_and_set("realization"); ui_realization->set_image("realization_pressed"); } else { realization_state = 0; + ui_effects_dropdown->setCurrentIndex(0); + on_effects_dropdown_changed(ui_effects_dropdown->currentIndex()); ui_realization->set_image("realization"); }