diff --git a/data/ui/options_dialog.ui b/data/ui/options_dialog.ui
index 3dd3389ef..4ceac852a 100644
--- a/data/ui/options_dialog.ui
+++ b/data/ui/options_dialog.ui
@@ -313,24 +313,7 @@
-
- -
-
-
- Allows screenshaking. Disable this if you have concerns or issues with photosensitivity and/or seizures.
-
-
- Allow Screenshake:
-
-
-
- -
-
-
-
-
-
-
- -
+
-
Allows screen effects. Disable this if you have concerns or issues with photosensitivity and/or seizures.
@@ -340,14 +323,14 @@
- -
+
-
- -
+
-
Send screen-shaking, flashes and sounds as defined in the char.ini over the network. Only works for servers that support this functionality.
@@ -357,14 +340,14 @@
- -
+
-
- -
+
-
Use the markup colors in the server IC chatlog.
@@ -374,14 +357,14 @@
- -
+
-
- -
+
-
Turn this on to prevent the sound dropdown from clearing the sound after playing it.
@@ -391,14 +374,14 @@
- -
+
-
- -
+
-
Turn this on to prevent the effects dropdown from clearing the effect after playing it.
@@ -408,14 +391,14 @@
- -
+
-
- -
+
-
Turn this on to prevent preanimation checkbox from clearing after playing the emote.
@@ -425,14 +408,14 @@
- -
+
-
- -
+
-
Turn this on to allow characters to define their own custom chat box designs.
@@ -442,14 +425,14 @@
- -
+
-
- -
+
-
Turn this on to allow characters to define their own stickers (unique images that show up over the chatbox - like avatars or shownames).
@@ -459,14 +442,14 @@
- -
+
-
- -
+
-
Whether or not to resume playing animations from where they left off. Turning off might reduce lag.
@@ -476,14 +459,14 @@
- -
+
-
- -
+
-
Stop music when double-clicking a category. If this is disabled, use the right-click context menu to stop music.
@@ -493,14 +476,14 @@
- -
+
-
- -
+
-
If the SFX dropdown has an SFX selected, send the custom SFX alongside the message even if Preanim is OFF.
@@ -510,14 +493,14 @@
- -
+
-
- -
+
-
If ticked, Evidence needs a double-click to view rather than a single click.
@@ -527,14 +510,14 @@
- -
+
-
- -
+
-
If ticked, slide animations will play when requested.
@@ -544,7 +527,7 @@
- -
+
-
@@ -583,7 +566,7 @@
- -
+
-
If ticked, some windows restore their last known position where they were closed.
@@ -593,14 +576,14 @@
- -
+
-
- -
+
-
<html><head/><body>Set the format for the player list to use.<br><br>Valid fields are:<br>{id} - Client ID<br>{displayname} - Character display name<br>{character} - Character folder name<br>{username} - Out-of-character name<br>(Note: Some servers may hide out-of-character names.)</body></html>
@@ -610,9 +593,44 @@
- -
+
-
+ -
+
+
+ Enables a simpler form of background position detection. If you're unsure, leave this off.
+
+
+ Simple Position Detection
+(EXPERIMENTAL)
+
+
+
+ -
+
+
+
+
+
+
+ -
+
+
+ Allows screenshaking. Disable this if you have concerns or issues with photosensitivity and/or seizures.
+
+
+ Allow Screenshake:
+
+
+
+ -
+
+
+
+
+
+
diff --git a/src/courtroom.cpp b/src/courtroom.cpp
index 04943deae..fddd4b88a 100644
--- a/src/courtroom.cpp
+++ b/src/courtroom.cpp
@@ -1395,31 +1395,63 @@ void Courtroom::set_background(QString p_background, bool display)
// Populate the dropdown list with all pos that exist on this bg
QStringList pos_list = {};
- for (const QPair &pos_pair : std::as_const(legacy_positions))
+ // Alternative simple list of files with minimal processing
+ if (Options::getInstance().simplePositionDetection())
{
- if (file_exists(ao_app->get_image_suffix(ao_app->get_background_path(pos_pair.first))) || // if we have 2.8-style positions, e.g. def.png, wit.webp, hld.apng
- file_exists(ao_app->get_image_suffix(ao_app->get_background_path(pos_pair.second)))) // if we have pre-2.8-style positions, e.g. defenseempty.png
+ QDir directory(ao_app->get_real_path(VPath("background/" + get_current_background())));
+ for (const QString &file : directory.entryList(QDir::Files))
{
- pos_list.append(pos_pair.first); // the dropdown always uses the new style
+ if ((file.endsWith(".png") || file.endsWith(".jpg") || file.endsWith(".apng") || file.endsWith(".webp") || file.endsWith(".gif")) && !file.split(".")[0].endsWith("_overlay"))
+ {
+ QFileInfo fi(file);
+ pos_list.append(fi.completeBaseName());
+ }
+ // Fix old-style positions
+ pos_list.removeAll("defensedesk");
+ pos_list.removeAll("prosecutordesk");
+ pos_list.removeAll("judgedesk");
+ pos_list.removeAll("prohelperdesk");
+ pos_list.removeAll("helperdesk");
+ pos_list.removeAll("jurydesk");
+ pos_list.removeAll("seancedesk");
+ pos_list.replaceInStrings("defenseempty", "def");
+ pos_list.replaceInStrings("prohelperstand", "hlp");
+ pos_list.replaceInStrings("helperstand", "hld");
+ pos_list.replaceInStrings("prosecutorempty", "pro");
+ pos_list.replaceInStrings("witnessempty", "wit");
+ pos_list.replaceInStrings("judgestand", "jud");
+ pos_list.replaceInStrings("jurystand", "jur");
+ pos_list.replaceInStrings("seancestand", "sea");
}
}
- if (file_exists(ao_app->get_image_suffix(ao_app->get_background_path("court"))))
+ else
{
- const QStringList overrides = {"def", "wit", "pro"};
- for (const QString &override_pos : overrides)
+ for (const QString &key : default_pos.keys())
+ {
+ 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
+ file_exists(ao_app->get_image_suffix(ao_app->get_background_path(key))))
+ { // if we have pre-2.8-style positions, e.g. defenseempty.png
+ pos_list.append(default_pos[key]);
+ }
+ }
+ if (file_exists(ao_app->get_image_suffix(ao_app->get_background_path("court"))))
{
- if (!ao_app->read_design_ini("court:" + override_pos + "/origin", ao_app->get_background_path("design.ini")).isEmpty())
+ const QStringList overrides = {"def", "wit", "pro"};
+ for (const QString &override_pos : overrides)
{
- pos_list.append(override_pos);
+ if (!ao_app->read_design_ini("court:" + override_pos + "/origin", ao_app->get_background_path("design.ini")).isEmpty())
+ {
+ pos_list.append(override_pos);
+ }
}
}
- }
- for (const QString &pos : ao_app->read_design_ini("positions", ao_app->get_background_path("design.ini")).split(","))
- {
- QString real_pos = pos.split(":")[0];
- if ((file_exists(ao_app->get_image_suffix(ao_app->get_background_path(real_pos)))))
+ for (const QString &pos : ao_app->read_design_ini("positions", ao_app->get_background_path("design.ini")).split(","))
{
- pos_list.append(pos);
+ QString real_pos = pos.split(":")[0];
+ if ((file_exists(ao_app->get_image_suffix(ao_app->get_background_path(real_pos)))))
+ {
+ pos_list.append(pos);
+ }
}
}
diff --git a/src/options.cpp b/src/options.cpp
index e87ba5a9a..31bb388e8 100644
--- a/src/options.cpp
+++ b/src/options.cpp
@@ -654,6 +654,16 @@ void Options::setPlayerlistFormatString(QString value)
config.setValue("visuals/playerlist_format", value);
}
+bool Options::simplePositionDetection() const
+{
+ return config.value("dumb_pos", false).toBool();
+}
+
+void Options::setSimplePositionDetection(bool value)
+{
+ config.setValue("dumb_pos", value);
+}
+
void Options::clearConfig()
{
config.clear();
diff --git a/src/options.h b/src/options.h
index 9b259edc4..d02d309c8 100644
--- a/src/options.h
+++ b/src/options.h
@@ -263,6 +263,9 @@ class Options
QString playerlistFormatString() const;
void setPlayerlistFormatString(QString value);
+ bool simplePositionDetection() const;
+ void setSimplePositionDetection(bool value);
+
// Clears the configuration file. Essentially restoring it to default.
void clearConfig();
diff --git a/src/widgets/aooptionsdialog.cpp b/src/widgets/aooptionsdialog.cpp
index d580caaf8..5f0de1113 100644
--- a/src/widgets/aooptionsdialog.cpp
+++ b/src/widgets/aooptionsdialog.cpp
@@ -386,6 +386,7 @@ void AOOptionsDialog::setupUI()
FROM_UI(QCheckBox, slides_cb);
FROM_UI(QCheckBox, restoreposition_cb);
FROM_UI(QLineEdit, playerlist_format_edit);
+ FROM_UI(QCheckBox, dumb_pos_cb);
registerOption("theme_scaling_factor_sb", &Options::themeScalingFactor, &Options::setThemeScalingFactor);
registerOption("animated_theme_cb", &Options::animatedThemeEnabled, &Options::setAnimatedThemeEnabled);
@@ -425,6 +426,7 @@ void AOOptionsDialog::setupUI()
registerOption("slides_cb", &Options::slidesEnabled, &Options::setSlidesEnabled);
registerOption("restoreposition_cb", &Options::restoreWindowPositionEnabled, &Options::setRestoreWindowPositionEnabled);
registerOption("playerlist_format_edit", &Options::playerlistFormatString, &Options::setPlayerlistFormatString);
+ registerOption("dumb_pos_cb", &Options::simplePositionDetection, &Options::setSimplePositionDetection);
// Callwords tab. This could just be a QLineEdit, but no, we decided to allow
// people to put a billion entries in.
diff --git a/src/widgets/aooptionsdialog.h b/src/widgets/aooptionsdialog.h
index b82829e5d..b3b5eda9d 100644
--- a/src/widgets/aooptionsdialog.h
+++ b/src/widgets/aooptionsdialog.h
@@ -77,6 +77,7 @@ class AOOptionsDialog : public QDialog
QCheckBox *ui_sfx_on_idle_cb;
QCheckBox *ui_restoreposition_cb;
QLineEdit *ui_playerlist_format_edit;
+ QCheckBox *ui_dumb_pos_cb;
// The callwords tab
QPlainTextEdit *ui_callwords_textbox;