diff --git a/data/ui/options_dialog.ui b/data/ui/options_dialog.ui index 044186730..ad34caaa8 100644 --- a/data/ui/options_dialog.ui +++ b/data/ui/options_dialog.ui @@ -6,12 +6,12 @@ 0 0 - 450 + 478 415 - Qt::ContextMenuPolicy::NoContextMenu + Qt::NoContextMenu Settings @@ -20,7 +20,7 @@ - Qt::FocusPolicy::NoFocus + Qt::NoFocus 0 @@ -39,9 +39,9 @@ 0 - -585 - 394 - 902 + -365 + 422 + 952 @@ -131,10 +131,7 @@ - QFrame::Shape::HLine - - - QFrame::Shadow::Sunken + QFrame::NoFrame @@ -198,7 +195,7 @@ Chat Rate Limit: - Qt::TextFormat::AutoText + Qt::PlainText @@ -215,10 +212,7 @@ - QFrame::Shape::HLine - - - QFrame::Shadow::Sunken + QFrame::NoFrame @@ -272,10 +266,7 @@ - QFrame::Shape::HLine - - - QFrame::Shadow::Sunken + QFrame::NoFrame @@ -322,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. @@ -349,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. @@ -366,14 +340,14 @@ - + - + Use the markup colors in the server IC chatlog. @@ -383,14 +357,14 @@ - + - + Turn this on to prevent the sound dropdown from clearing the sound after playing it. @@ -400,14 +374,14 @@ - + - + Turn this on to prevent the effects dropdown from clearing the effect after playing it. @@ -417,14 +391,14 @@ - + - + Turn this on to prevent preanimation checkbox from clearing after playing the emote. @@ -434,14 +408,14 @@ - + - + Turn this on to allow characters to define their own custom chat box designs. @@ -451,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). @@ -468,14 +442,14 @@ - + - + Whether or not to resume playing animations from where they left off. Turning off might reduce lag. @@ -485,14 +459,14 @@ - + - + Stop music when double-clicking a category. If this is disabled, use the right-click context menu to stop music. @@ -502,14 +476,14 @@ - + - + If the SFX dropdown has an SFX selected, send the custom SFX alongside the message even if Preanim is OFF. @@ -519,14 +493,14 @@ - + - + If ticked, Evidence needs a double-click to view rather than a single click. @@ -536,14 +510,14 @@ - + - + If ticked, slide animations will play when requested. @@ -553,7 +527,7 @@ - + @@ -592,7 +566,7 @@ - + If ticked, some windows restore their last known position where they were closed. @@ -602,23 +576,58 @@ - + - + Playerlist Format: - + + + + + 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: + + + + + + + + + + @@ -663,10 +672,7 @@ - QFrame::Shape::HLine - - - QFrame::Shadow::Sunken + QFrame::NoFrame @@ -693,10 +699,7 @@ - QFrame::Shape::HLine - - - QFrame::Shadow::Sunken + QFrame::NoFrame @@ -829,7 +832,7 @@ - Qt::Orientation::Horizontal + Qt::Vertical @@ -868,10 +871,10 @@ - Qt::Orientation::Horizontal + Qt::Vertical - QSizePolicy::Policy::Expanding + QSizePolicy::Fixed @@ -1126,10 +1129,7 @@ Default: 0. - QFrame::Shape::HLine - - - QFrame::Shadow::Sunken + QFrame::NoFrame diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 349e5a5bd..2cad01479 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -1407,31 +1407,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 QString &key : default_pos.keys()) + // 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(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]); + QDir directory(ao_app->get_real_path(VPath("background/" + get_current_background()))); + for (const QString &file : directory.entryList(QDir::Files)) + { + 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 f312bc5a3..b4f5d0d3f 100644 --- a/src/options.cpp +++ b/src/options.cpp @@ -648,6 +648,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 58b02253b..eabe9fab9 100644 --- a/src/options.h +++ b/src/options.h @@ -260,6 +260,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 4ff9dc18b..e1d81ba0f 100644 --- a/src/widgets/aooptionsdialog.cpp +++ b/src/widgets/aooptionsdialog.cpp @@ -372,6 +372,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); @@ -411,6 +412,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 4409c9eff..767b02468 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;