Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overlays folder #31

Merged
merged 18 commits into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/aolayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ class BackgroundLayer : public AOLayer {
Q_OBJECT
public:
BackgroundLayer(QWidget *p_parent, AOApplication *p_ao_app);
void load_image(QString p_filename);
void load_image(QString p_filename, bool desk = false);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is bool desk necessary?

signals:
void hide_void();
protected:
Expand Down
15 changes: 13 additions & 2 deletions src/aolayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ void AOLayer::move_and_center(int ax, int ay)
center_pixmap(movie_frames[0]); // just use the first frame since dimensions are all that matter
}

void BackgroundLayer::load_image(QString p_filename)
void BackgroundLayer::load_image(QString p_filename, bool desk)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is bool desk necessary?

{
play_once = false;
cull_image = false;
Expand All @@ -155,7 +155,18 @@ void BackgroundLayer::load_image(QString p_filename)
#ifdef DEBUG_MOVIE
qDebug() << "[BackgroundLayer] BG loaded: " << p_filename;
#endif
QString final_path = ao_app->get_image_suffix(ao_app->get_background_path(p_filename));
QString final_path = "";
if (!desk) {
final_path = ao_app->get_image_suffix(ao_app->get_background_path(p_filename));
}
else {
if (file_exists(ao_app->get_image_suffix(ao_app->get_background_path(p_filename)))) {
final_path = ao_app->get_image_suffix(ao_app->get_background_path(p_filename));
}
else {
final_path = ao_app->get_image_suffix(VPath("overlays/" + p_filename));
}
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of this should be done in get_pos_path, not here.


if (final_path == last_path) {
// Don't restart background if background is unchanged
Expand Down
2 changes: 1 addition & 1 deletion src/courtroom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4509,7 +4509,7 @@ void Courtroom::set_scene(bool show_desk, const QString f_side)
{
current_side = f_side;
ui_vp_background->load_image(ao_app->get_pos_path(f_side));
ui_vp_desk->load_image(ao_app->get_pos_path(f_side, true));
ui_vp_desk->load_image(ao_app->get_pos_path(f_side, true), true);

if (show_desk)
ui_vp_desk->show();
Expand Down
12 changes: 8 additions & 4 deletions src/path_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,17 @@ QString AOApplication::get_pos_path(const QString& pos, const bool desk)
QString desk_override = read_design_ini("overlays/" + f_background, get_background_path("design.ini"));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

design_ini override is checked here. But overlays/ folder override is only checked after the image is attempted to be loaded, inside the background layer itself? Doesn't that order betray the PR description?

if (desk_override != "") {
f_desk_image = desk_override;
} else if (w_courtroom->server_overlay != "") { // BN+ Packet
}
else if (w_courtroom->server_overlay != "") { // BN+ Packet
if (file_exists(get_image_suffix(
get_background_path(w_courtroom->server_overlay))))
{
get_background_path(w_courtroom->server_overlay)))) {
f_desk_image = w_courtroom->server_overlay;
}
}
else if (file_exists(get_image_suffix(
VPath("overlays/" + w_courtroom->server_overlay)))) {
f_desk_image = w_courtroom->server_overlay;
Copy link
Owner

@Crystalwarrior Crystalwarrior Dec 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what even changes? This is the same line as L147

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
f_desk_image = w_courtroom->server_overlay;
f_desk_image = "overlays/" + w_courtroom->server_overlay;

}
}
if (desk) {
return f_desk_image;
}
Expand Down