@@ -705,7 +705,7 @@ void Courtroom::set_mute_list()
705705
706706 QStringList sorted_mute_list;
707707
708- for (const CharacterSlot &i_char : qAsConst (char_list))
708+ for (const CharacterSlot &i_char : std::as_const (char_list))
709709 {
710710 sorted_mute_list.append (i_char.name );
711711 }
@@ -723,7 +723,7 @@ void Courtroom::set_pair_list()
723723{
724724 QStringList sorted_pair_list;
725725
726- for (const CharacterSlot &i_char : qAsConst (char_list))
726+ for (const CharacterSlot &i_char : std::as_const (char_list))
727727 {
728728 sorted_pair_list.append (i_char.name );
729729 }
@@ -1408,7 +1408,7 @@ void Courtroom::set_background(QString p_background, bool display)
14081408
14091409 // Populate the dropdown list with all pos that exist on this bg
14101410 QStringList pos_list = {};
1411- for (const QString &key : default_pos. keys ( ))
1411+ for (const QString &key : std::as_const (default_pos ))
14121412 {
14131413 if (file_exists (ao_app->get_image_suffix (ao_app->get_background_path (default_pos[key]))) || // if we have 2.8-style positions, e.g. def.png, wit.webp, hld.apng
14141414 file_exists (ao_app->get_image_suffix (ao_app->get_background_path (key))))
@@ -3120,7 +3120,7 @@ void Courtroom::do_transition(QString p_desk_mod, QString oldPosId, QString newP
31203120
31213121void Courtroom::post_transition_cleanup ()
31223122{
3123- for (kal::CharacterAnimationLayer *layer : qAsConst (ui_vp_char_list))
3123+ for (kal::CharacterAnimationLayer *layer : std::as_const (ui_vp_char_list))
31243124 {
31253125 bool is_visible = layer->isVisible ();
31263126 layer->stopPlayback ();
@@ -3404,7 +3404,7 @@ void Courtroom::handle_callwords()
34043404 // No more file IO on every message.
34053405 QStringList call_words = Options::getInstance ().callwords ();
34063406 // Loop through each word in the call words list
3407- for (const QString &word : qAsConst (call_words))
3407+ for (const QString &word : std::as_const (call_words))
34083408 {
34093409 // If our message contains that specific call word
34103410 if (f_message.contains (word, Qt::CaseInsensitive))
@@ -3765,7 +3765,8 @@ QString Courtroom::filter_ic_text(QString p_text, bool html, int target_pos, int
37653765 // white-space: pre; stylesheet tag, but for whataver reason it doesn't work
37663766 // no matter where I try it. If somoene else can get that piece of HTML
37673767 // memery to work, please do.
3768- p_text_escaped.replace (QRegularExpression (" ^\\ s|(?<=\\ s)\\ s" ), " " );
3768+ static QRegularExpression whitespace (" ^\\ s|(?<=\\ s)\\ s" );
3769+ p_text_escaped.replace (whitespace, " " );
37693770 if (!align.isEmpty ())
37703771 {
37713772 p_text_escaped.append (" </div>" );
@@ -5115,9 +5116,10 @@ void Courtroom::on_ooc_return_pressed()
51155116 casefile.setValue (" doc" , " " );
51165117 casefile.setValue (" status" , command[2 ]);
51175118 casefile.sync ();
5119+ static QRegularExpression owner_regexp (" <owner = ...>..." );
51185120 for (int i = 0 ; i < local_evidence_list.size (); i++)
51195121 {
5120- QString clean_evidence_dsc = local_evidence_list[i].description .replace (QRegularExpression ( " <owner = ...>... " ) , " " );
5122+ QString clean_evidence_dsc = local_evidence_list[i].description .replace (owner_regexp , " " );
51215123 clean_evidence_dsc = clean_evidence_dsc.replace (clean_evidence_dsc.lastIndexOf (" >" ), 1 , " " );
51225124 casefile.beginGroup (QString::number (i));
51235125 casefile.sync ();
@@ -5428,7 +5430,7 @@ void Courtroom::set_sfx_dropdown()
54285430 sound_list += ao_app->get_list_file (VPath (" soundlist.ini" ));
54295431
54305432 QStringList display_sounds;
5431- for (const QString &sound : qAsConst (sound_list))
5433+ for (const QString &sound : std::as_const (sound_list))
54325434 {
54335435 QStringList unpacked = sound.split (" =" );
54345436 QString display = unpacked[0 ].trimmed ();
@@ -5730,7 +5732,7 @@ void Courtroom::on_pair_list_clicked(QModelIndex p_index)
57305732 // Redo the character list.
57315733 QStringList sorted_pair_list;
57325734
5733- for (const CharacterSlot &i_char : qAsConst (char_list))
5735+ for (const CharacterSlot &i_char : std::as_const (char_list))
57345736 {
57355737 sorted_pair_list.append (i_char.name );
57365738 }
@@ -5798,19 +5800,19 @@ void Courtroom::on_music_list_context_menu_requested(const QPoint &pos)
57985800 }
57995801
58005802 menu->addAction (new QAction (tr (" Fade Out Previous" ), this ));
5801- menu->actions ().back ()->setCheckable (true );
5802- menu->actions ().back ()->setChecked (music_flags & FADE_OUT );
5803- connect (menu->actions ().back (), &QAction::toggled, this , &Courtroom::music_fade_out);
5803+ menu->actions ().constLast ()->setCheckable (true );
5804+ menu->actions ().constLast ()->setChecked (music_flags & FADE_OUT );
5805+ connect (menu->actions ().constLast (), &QAction::toggled, this , &Courtroom::music_fade_out);
58045806
58055807 menu->addAction (new QAction (tr (" Fade In" ), this ));
5806- menu->actions ().back ()->setCheckable (true );
5807- menu->actions ().back ()->setChecked (music_flags & FADE_IN );
5808- connect (menu->actions ().back (), &QAction::toggled, this , &Courtroom::music_fade_in);
5808+ menu->actions ().constLast ()->setCheckable (true );
5809+ menu->actions ().constLast ()->setChecked (music_flags & FADE_IN );
5810+ connect (menu->actions ().constLast (), &QAction::toggled, this , &Courtroom::music_fade_in);
58095811
58105812 menu->addAction (new QAction (tr (" Synchronize" ), this ));
5811- menu->actions ().back ()->setCheckable (true );
5812- menu->actions ().back ()->setChecked (music_flags & SYNC_POS );
5813- connect (menu->actions ().back (), &QAction::toggled, this , &Courtroom::music_synchronize);
5813+ menu->actions ().constLast ()->setCheckable (true );
5814+ menu->actions ().constLast ()->setChecked (music_flags & SYNC_POS );
5815+ connect (menu->actions ().constLast (), &QAction::toggled, this , &Courtroom::music_synchronize);
58145816
58155817 menu->addSeparator ();
58165818 menu->addAction (QString (" Open base music folder" ), this , [=] {
@@ -5930,7 +5932,7 @@ void Courtroom::music_stop(bool no_effects)
59305932 if (!music_list.contains (fake_song))
59315933 {
59325934 // Loop through our music list
5933- for (const QString &song : qAsConst (music_list))
5935+ for (const QString &song : std::as_const (music_list))
59345936 {
59355937 // Pick first song that does not contain a file extension
59365938 if (!song.contains (' .' ))
0 commit comments