Skip to content

Commit dd378d1

Browse files
committed
clazy cleanup
1 parent dc50839 commit dd378d1

1 file changed

Lines changed: 14 additions & 12 deletions

File tree

src/courtroom.cpp

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1407,7 +1407,7 @@ void Courtroom::set_background(QString p_background, bool display)
14071407

14081408
// Populate the dropdown list with all pos that exist on this bg
14091409
QStringList pos_list = {};
1410-
for (const QString &key : default_pos.keys())
1410+
for (const QString &key : default_pos)
14111411
{
14121412
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
14131413
file_exists(ao_app->get_image_suffix(ao_app->get_background_path(key))))
@@ -3729,7 +3729,8 @@ QString Courtroom::filter_ic_text(QString p_text, bool html, int target_pos, int
37293729
// white-space: pre; stylesheet tag, but for whataver reason it doesn't work
37303730
// no matter where I try it. If somoene else can get that piece of HTML
37313731
// memery to work, please do.
3732-
p_text_escaped.replace(QRegularExpression("^\\s|(?<=\\s)\\s"), "&nbsp;");
3732+
static QRegularExpression whitespace("^\\s|(?<=\\s)\\s");
3733+
p_text_escaped.replace(whitespace, "&nbsp;");
37333734
if (!align.isEmpty())
37343735
{
37353736
p_text_escaped.append("</div>");
@@ -5079,9 +5080,10 @@ void Courtroom::on_ooc_return_pressed()
50795080
casefile.setValue("doc", "");
50805081
casefile.setValue("status", command[2]);
50815082
casefile.sync();
5083+
static QRegularExpression owner_regexp("<owner = ...>...");
50825084
for (int i = 0; i < local_evidence_list.size(); i++)
50835085
{
5084-
QString clean_evidence_dsc = local_evidence_list[i].description.replace(QRegularExpression("<owner = ...>..."), "");
5086+
QString clean_evidence_dsc = local_evidence_list[i].description.replace(owner_regexp, "");
50855087
clean_evidence_dsc = clean_evidence_dsc.replace(clean_evidence_dsc.lastIndexOf(">"), 1, "");
50865088
casefile.beginGroup(QString::number(i));
50875089
casefile.sync();
@@ -5750,19 +5752,19 @@ void Courtroom::on_music_list_context_menu_requested(const QPoint &pos)
57505752
menu->addSeparator();
57515753

57525754
menu->addAction(new QAction(tr("Fade Out Previous"), this));
5753-
menu->actions().back()->setCheckable(true);
5754-
menu->actions().back()->setChecked(music_flags & FADE_OUT);
5755-
connect(menu->actions().back(), &QAction::toggled, this, &Courtroom::music_fade_out);
5755+
menu->actions().constLast()->setCheckable(true);
5756+
menu->actions().constLast()->setChecked(music_flags & FADE_OUT);
5757+
connect(menu->actions().constLast(), &QAction::toggled, this, &Courtroom::music_fade_out);
57565758

57575759
menu->addAction(new QAction(tr("Fade In"), this));
5758-
menu->actions().back()->setCheckable(true);
5759-
menu->actions().back()->setChecked(music_flags & FADE_IN);
5760-
connect(menu->actions().back(), &QAction::toggled, this, &Courtroom::music_fade_in);
5760+
menu->actions().constLast()->setCheckable(true);
5761+
menu->actions().constLast()->setChecked(music_flags & FADE_IN);
5762+
connect(menu->actions().constLast(), &QAction::toggled, this, &Courtroom::music_fade_in);
57615763

57625764
menu->addAction(new QAction(tr("Synchronize"), this));
5763-
menu->actions().back()->setCheckable(true);
5764-
menu->actions().back()->setChecked(music_flags & SYNC_POS);
5765-
connect(menu->actions().back(), &QAction::toggled, this, &Courtroom::music_synchronize);
5765+
menu->actions().constLast()->setCheckable(true);
5766+
menu->actions().constLast()->setChecked(music_flags & SYNC_POS);
5767+
connect(menu->actions().constLast(), &QAction::toggled, this, &Courtroom::music_synchronize);
57665768

57675769
menu->addSeparator();
57685770
menu->addAction(QString("Open base music folder"), this, [=] {

0 commit comments

Comments
 (0)