diff options
| author | Leifa♥ <26681464+TrickyLeifa@users.noreply.github.com> | 2022-07-07 12:55:44 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-07-07 13:55:44 +0300 |
| commit | 7805e80e8337d538b671a35cf15335fbcc54d3e5 (patch) | |
| tree | d37a2d349b43f8a225fc907b08e3c4792ee03906 /src/courtroom.cpp | |
| parent | 7b4b297a22e97046a3fca860ad3faf08438c6a8c (diff) | |
Added Play SFX context menu action (#791)
* Added Play SFX context menu action
Resolve #746
* The SFX context menu now allows the user to preview the sound selected by playing it.
* Changed declarations for methods.
Diffstat (limited to 'src/courtroom.cpp')
| -rw-r--r-- | src/courtroom.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 55fc35fe..fe3517d1 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -4553,18 +4553,24 @@ void Courtroom::on_sfx_context_menu_requested(const QPoint &pos) menu->setAttribute(Qt::WA_DeleteOnClose); menu->addSeparator(); + menu->addAction(QString("Play"), this, &Courtroom::on_sfx_play_clicked); if (file_exists(ao_app->get_real_path( - ao_app->get_character_path(current_char, "soundlist.ini")))) + ao_app->get_character_path(current_char, "soundlist.ini")))) menu->addAction(QString("Edit " + current_char + "/soundlist.ini"), this, - SLOT(on_sfx_edit_requested())); + &Courtroom::on_sfx_edit_requested); else menu->addAction(QString("Edit global soundlist.ini"), this, - SLOT(on_sfx_edit_requested())); + &Courtroom::on_sfx_edit_requested); if (!custom_sfx.isEmpty()) - menu->addAction(QString("Clear Edit Text"), this, SLOT(on_sfx_remove_clicked())); + menu->addAction(QString("Clear Edit Text"), this, &Courtroom::on_sfx_remove_clicked); menu->popup(ui_sfx_dropdown->mapToGlobal(pos)); } +void Courtroom::on_sfx_play_clicked() +{ + sfx_player->play(get_char_sfx(), get_current_char()); +} + void Courtroom::on_sfx_edit_requested() { QString p_path = ao_app->get_real_path(ao_app->get_character_path(current_char, "soundlist.ini")); |
