@@ -211,6 +211,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
211211 ui_music_search->setObjectName (" ui_music_search" );
212212
213213 ui_pos_dropdown = new QComboBox (this );
214+ ui_pos_dropdown->setContextMenuPolicy (Qt::CustomContextMenu);
214215 ui_pos_dropdown->view ()->setTextElideMode (Qt::ElideLeft);
215216 ui_pos_dropdown->setObjectName (" ui_pos_dropdown" );
216217
@@ -359,6 +360,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
359360 ui_prosecution_minus->setObjectName (" ui_prosecution_minus" );
360361
361362 ui_text_color = new QComboBox (this );
363+ ui_text_color->setContextMenuPolicy (Qt::CustomContextMenu);
362364 ui_text_color->setObjectName (" ui_text_color" );
363365
364366 ui_music_slider = new QSlider (Qt::Horizontal, this );
@@ -401,6 +403,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
401403 ui_pair_button->setObjectName (" ui_pair_button" );
402404
403405 ui_evidence_button = new AOButton (this , ao_app);
406+ ui_evidence_button->setContextMenuPolicy (Qt::CustomContextMenu);
404407 ui_evidence_button->setObjectName (" ui_evidence_button" );
405408
406409 initialize_emotes ();
@@ -431,6 +434,8 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
431434 QOverload<int >::of (&Courtroom::on_pos_dropdown_changed));
432435 connect (ui_pos_dropdown, &QComboBox::editTextChanged, this ,
433436 QOverload<QString>::of (&Courtroom::on_pos_dropdown_changed));
437+ connect (ui_pos_dropdown, &QComboBox::customContextMenuRequested, this ,
438+ &Courtroom::on_pos_dropdown_context_menu_requested);
434439 connect (ui_pos_remove, &AOButton::clicked, this , &Courtroom::on_pos_remove_clicked);
435440
436441 connect (ui_iniswap_dropdown, QOverload<int >::of (&QComboBox::currentIndexChanged), this ,
@@ -500,6 +505,8 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
500505
501506 connect (ui_text_color, QOverload<int >::of (&QComboBox::currentIndexChanged), this ,
502507 &Courtroom::on_text_color_changed);
508+ connect (ui_text_color, &QComboBox::customContextMenuRequested, this ,
509+ &Courtroom::on_text_color_context_menu_requested);
503510
504511 connect (ui_music_slider, &QSlider::valueChanged, this ,
505512 &Courtroom::on_music_slider_moved);
@@ -554,6 +561,8 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
554561
555562 connect (ui_evidence_button, &AOButton::clicked, this ,
556563 &Courtroom::on_evidence_button_clicked);
564+ connect (ui_evidence_button, &QComboBox::customContextMenuRequested, this ,
565+ &Courtroom::on_evidence_context_menu_requested);
557566
558567 connect (qApp, QOverload<Qt::ApplicationState>::of (&QApplication::applicationStateChanged), this ,
559568 &Courtroom::on_application_state_changed);
@@ -4532,6 +4541,25 @@ void Courtroom::on_pos_dropdown_changed(QString p_text)
45324541 set_side (p_text);
45334542}
45344543
4544+ void Courtroom::on_pos_dropdown_context_menu_requested (const QPoint &pos)
4545+ {
4546+ QMenu *menu = ui_iniswap_dropdown->lineEdit ()->createStandardContextMenu ();
4547+
4548+ menu->setAttribute (Qt::WA_DeleteOnClose);
4549+ menu->addSeparator ();
4550+
4551+ menu->addAction (QString (" Open background " + current_background), this ,
4552+ [=] {
4553+ QString p_path = ao_app->get_real_path (VPath (" background/" + current_background + " /" ));
4554+ if (!dir_exists (p_path)) {
4555+ return ;
4556+ }
4557+ QDesktopServices::openUrl (QUrl::fromLocalFile (p_path));
4558+ }
4559+ );
4560+ menu->popup (ui_iniswap_dropdown->mapToGlobal (pos));
4561+ }
4562+
45354563void Courtroom::on_pos_remove_clicked ()
45364564{
45374565 ui_pos_dropdown->blockSignals (true );
@@ -4633,18 +4661,32 @@ void Courtroom::on_iniswap_context_menu_requested(const QPoint &pos)
46334661 if (file_exists (ao_app->get_real_path (
46344662 ao_app->get_character_path (current_char, " char.ini" ))))
46354663 menu->addAction (QString (" Edit " + current_char + " /char.ini" ), this ,
4636- SLOT ( on_iniswap_edit_requested ()) );
4664+ &Courtroom:: on_iniswap_edit_requested);
46374665 if (ui_iniswap_dropdown->itemText (ui_iniswap_dropdown->currentIndex ()) !=
46384666 char_list.at (m_cid).name )
46394667 menu->addAction (QString (" Remove " + current_char), this ,
4640- SLOT (on_iniswap_remove_clicked ()));
4668+ &Courtroom::on_iniswap_remove_clicked);
4669+
4670+ menu->addSeparator ();
4671+ menu->addAction (QString (" Open character folder " + current_char), this ,
4672+ [=] {
4673+ QString p_path = ao_app->get_real_path (VPath (" characters/" + current_char + " /" ));
4674+ if (!dir_exists (p_path)) {
4675+ return ;
4676+ }
4677+
4678+ QDesktopServices::openUrl (QUrl::fromLocalFile (p_path));
4679+ }
4680+ );
46414681 menu->popup (ui_iniswap_dropdown->mapToGlobal (pos));
46424682}
4683+
46434684void Courtroom::on_iniswap_edit_requested ()
46444685{
46454686 QString p_path = ao_app->get_real_path (ao_app->get_character_path (current_char, " char.ini" ));
4646- if (!file_exists (p_path))
4687+ if (!file_exists (p_path)) {
46474688 return ;
4689+ }
46484690 QDesktopServices::openUrl (QUrl::fromLocalFile (p_path));
46494691}
46504692
@@ -4690,8 +4732,9 @@ void Courtroom::set_sfx_dropdown()
46904732 for (const QString &sound : qAsConst (sound_list)) {
46914733 QStringList unpacked = sound.split (" =" );
46924734 QString display = unpacked[0 ].trimmed ();
4693- if (unpacked.size () > 1 )
4735+ if (unpacked.size () > 1 ) {
46944736 display = unpacked[1 ].trimmed ();
4737+ }
46954738
46964739 display_sounds.append (display);
46974740 }
@@ -4726,7 +4769,11 @@ void Courtroom::on_sfx_context_menu_requested(const QPoint &pos)
47264769
47274770 menu->setAttribute (Qt::WA_DeleteOnClose);
47284771 menu->addSeparator ();
4729- menu->addAction (QString (" Play" ), this , &Courtroom::on_sfx_play_clicked);
4772+ // SFX is not "Nothing" or "Default"?
4773+ if (get_char_sfx () != " 0" && get_char_sfx () != " 1" && get_char_sfx () != " -" ) {
4774+ // Add an option to play the SFX
4775+ menu->addAction (QString (" Play " + get_char_sfx ()), this , &Courtroom::on_sfx_play_clicked);;
4776+ }
47304777 if (file_exists (ao_app->get_real_path (
47314778 ao_app->get_character_path (current_char, " soundlist.ini" ))))
47324779 menu->addAction (QString (" Edit " + current_char + " /soundlist.ini" ), this ,
@@ -4736,6 +4783,16 @@ void Courtroom::on_sfx_context_menu_requested(const QPoint &pos)
47364783 &Courtroom::on_sfx_edit_requested);
47374784 if (!custom_sfx.isEmpty ())
47384785 menu->addAction (QString (" Clear Edit Text" ), this , &Courtroom::on_sfx_remove_clicked);
4786+ menu->addSeparator ();
4787+ menu->addAction (QString (" Open base sounds folder" ), this ,
4788+ [=] {
4789+ QString p_path = ao_app->get_base_path () + " sounds/general/" ;
4790+ if (!dir_exists (p_path)) {
4791+ return ;
4792+ }
4793+ QDesktopServices::openUrl (QUrl::fromLocalFile (p_path));
4794+ }
4795+ );
47394796 menu->popup (ui_sfx_dropdown->mapToGlobal (pos));
47404797}
47414798
@@ -4809,9 +4866,9 @@ void Courtroom::on_effects_context_menu_requested(const QPoint &pos)
48094866 QString (" Open misc/" +
48104867 ao_app->read_char_ini (current_char, " effects" , " Options" ) +
48114868 " folder" ),
4812- this , SLOT ( on_character_effects_edit_requested ()) );
4869+ this , &Courtroom:: on_character_effects_edit_requested);
48134870 menu->addAction (QString (" Open theme's effects folder" ), this ,
4814- SLOT ( on_effects_edit_requested ()) );
4871+ &Courtroom:: on_effects_edit_requested);
48154872 menu->popup (ui_effects_dropdown->mapToGlobal (pos));
48164873}
48174874void Courtroom::on_effects_edit_requested ()
@@ -5001,6 +5058,17 @@ void Courtroom::on_music_list_context_menu_requested(const QPoint &pos)
50015058 connect (menu->actions ().back (), &QAction::toggled, this ,
50025059 &Courtroom::music_synchronize);
50035060
5061+ menu->addSeparator ();
5062+ menu->addAction (QString (" Open base music folder" ), this ,
5063+ [=] {
5064+ QString p_path = ao_app->get_base_path () + " sounds/music/" ;
5065+ if (!dir_exists (p_path)) {
5066+ return ;
5067+ }
5068+ QDesktopServices::openUrl (QUrl::fromLocalFile (p_path));
5069+ }
5070+ );
5071+
50045072 menu->popup (ui_music_list->mapToGlobal (pos));
50055073}
50065074
@@ -5313,6 +5381,22 @@ void Courtroom::on_prosecution_plus_clicked()
53135381 new AOPacket (" HP" , {" 2" , QString::number (f_state)}));
53145382}
53155383
5384+ void Courtroom::on_text_color_context_menu_requested (const QPoint &pos)
5385+ {
5386+ QMenu *menu = new QMenu (this );
5387+
5388+ menu->addAction (QString (" Open currently used chat_config.ini" ), this ,
5389+ [=] {
5390+ QString p_path = ao_app->get_asset (" chat_config.ini" , ao_app->current_theme , ao_app->get_subtheme (), ao_app->default_theme , ao_app->get_chat (current_char));
5391+ if (!file_exists (p_path)) {
5392+ return ;
5393+ }
5394+ QDesktopServices::openUrl (QUrl::fromLocalFile (p_path));
5395+ }
5396+ );
5397+ menu->popup (ui_text_color->mapToGlobal (pos));
5398+ }
5399+
53165400void Courtroom::set_text_color_dropdown ()
53175401{
53185402 // Clear the lists
@@ -5617,6 +5701,21 @@ void Courtroom::on_evidence_button_clicked()
56175701 }
56185702}
56195703
5704+ void Courtroom::on_evidence_context_menu_requested (const QPoint &pos)
5705+ {
5706+ QMenu *menu = new QMenu (this );
5707+ menu->addAction (QString (" Open base evidence folder" ), this ,
5708+ [=] {
5709+ QString p_path = ao_app->get_base_path () + " evidence/" ;
5710+ if (!dir_exists (p_path)) {
5711+ return ;
5712+ }
5713+ QDesktopServices::openUrl (QUrl::fromLocalFile (p_path));
5714+ }
5715+ );
5716+ menu->popup (ui_evidence_button->mapToGlobal (pos));
5717+ }
5718+
56205719void Courtroom::on_switch_area_music_clicked ()
56215720{
56225721 if (ui_area_list->isHidden ()) {
0 commit comments