diff options
| author | Alex Noir <Varsash@gmail.com> | 2022-02-18 22:02:18 +0300 |
|---|---|---|
| committer | Alex Noir <Varsash@gmail.com> | 2022-02-18 22:02:18 +0300 |
| commit | 0e2bd0b110fe44f485871d20b5e614a214470f12 (patch) | |
| tree | 0d7502d10080634aca25c43a3f72470410630473 /src | |
| parent | e6f06d8959ff65be11b20dcba27977f8935bb044 (diff) | |
Add icons for iniswaps and emotes in the dropdown
Fix iniswap list not recognizing a name that's different from a character folder when switching to that character
Diffstat (limited to 'src')
| -rw-r--r-- | src/courtroom.cpp | 14 | ||||
| -rw-r--r-- | src/emotes.cpp | 10 |
2 files changed, 16 insertions, 8 deletions
diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 3fb691e9..8596ee79 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -4322,6 +4322,10 @@ void Courtroom::set_iniswap_dropdown() QStringList iniswaps = ao_app->get_list_file(ao_app->get_character_path(char_list.at(m_cid).name, "iniswaps.ini")) + ao_app->get_list_file(ao_app->get_base_path() + "iniswaps.ini"); + + if (ao_app->get_char_name(char_list.at(m_cid).name) != char_list.at(m_cid).name) + iniswaps.append(ao_app->get_char_name(char_list.at(m_cid).name)); + iniswaps.removeDuplicates(); iniswaps.prepend(char_list.at(m_cid).name); if (iniswaps.size() <= 0) { @@ -4330,16 +4334,17 @@ void Courtroom::set_iniswap_dropdown() return; } ui_iniswap_dropdown->show(); - ui_iniswap_dropdown->addItems(iniswaps); - for (int i = 0; i < iniswaps.size(); ++i) { + ui_iniswap_dropdown->addItem(iniswaps.at(i)); + QString icon_path = ao_app->get_image_suffix(ao_app->get_character_path( + iniswaps.at(i), "char_icon")); + ui_iniswap_dropdown->setItemIcon(i, QIcon(icon_path)); if (iniswaps.at(i) == current_char) { ui_iniswap_dropdown->setCurrentIndex(i); if (i != 0) ui_iniswap_remove->show(); else ui_iniswap_remove->hide(); - break; } } ui_iniswap_dropdown->blockSignals(false); @@ -4365,6 +4370,9 @@ void Courtroom::on_iniswap_dropdown_changed(int p_index) ui_iniswap_dropdown->setCurrentIndex(p_index); ui_iniswap_dropdown->blockSignals(false); update_character(m_cid); + QString icon_path = ao_app->get_image_suffix(ao_app->get_character_path( + iniswap, "char_icon")); + ui_iniswap_dropdown->setItemIcon(p_index, QIcon(icon_path)); if (p_index != 0) ui_iniswap_remove->show(); else diff --git a/src/emotes.cpp b/src/emotes.cpp index 53f2b065..547dc0ea 100644 --- a/src/emotes.cpp +++ b/src/emotes.cpp @@ -141,14 +141,14 @@ void Courtroom::set_emote_dropdown() ui_emote_dropdown->clear(); int total_emotes = ao_app->get_emote_number(current_char); - QStringList emote_list; for (int n = 0; n < total_emotes; ++n) { - emote_list.append(QString::number(n + 1) + ": " + - ao_app->get_emote_comment(current_char, n)); + ui_emote_dropdown->addItem(QString::number(n + 1) + ": " + + ao_app->get_emote_comment(current_char, n)); + QString icon_path = ao_app->get_image_suffix(ao_app->get_character_path( + current_char, "emotions/button" + QString::number(n + 1) + "_off")); + ui_emote_dropdown->setItemIcon(n, QIcon(icon_path)); } - - ui_emote_dropdown->addItems(emote_list); } void Courtroom::select_emote(int p_id) |
