aboutsummaryrefslogtreecommitdiff
path: root/src/path_functions.cpp
diff options
context:
space:
mode:
authorin1tiate <32779090+in1tiate@users.noreply.github.com>2024-05-20 08:47:27 -0500
committerin1tiate <32779090+in1tiate@users.noreply.github.com>2024-05-20 08:47:27 -0500
commitadf32f47275a2bac02034b848215d4413e0f9b37 (patch)
treec9b6bfa99b61d7ff97f6de4391534ee309fc3029 /src/path_functions.cpp
parent4b0f7e4d806c79313e493a3c58818e995af25847 (diff)
Initial slide rebase commit
Diffstat (limited to 'src/path_functions.cpp')
-rw-r--r--src/path_functions.cpp37
1 files changed, 31 insertions, 6 deletions
diff --git a/src/path_functions.cpp b/src/path_functions.cpp
index d68535c4..18602453 100644
--- a/src/path_functions.cpp
+++ b/src/path_functions.cpp
@@ -78,9 +78,34 @@ VPath AOApplication::get_default_background_path(QString p_file)
return VPath("background/default/" + p_file);
}
-QString AOApplication::get_pos_path(const QString &pos, const bool desk)
+QPair<QString, int> AOApplication::get_pos_path(const QString &pos, const bool desk)
{
// witness is default if pos is invalid
+ QString f_pos = pos;
+ // legacy overrides for new format if found
+ if (pos == "def" && file_exists(get_image_suffix(get_background_path("court"))))
+ {
+ f_pos = "court:def";
+ }
+ else if (pos == "pro" && file_exists(get_image_suffix(get_background_path("court"))))
+ {
+ f_pos = "court:pro";
+ }
+ else if (pos == "wit" && file_exists(get_image_suffix(get_background_path("court"))))
+ {
+ f_pos = "court:wit";
+ }
+ QStringList f_pos_split = f_pos.split(":");
+ int f_center = -1;
+ if (f_pos_split.size() > 1)
+ { // Subposition, get center info
+ bool bOk;
+ int subpos_center = read_design_ini(f_pos + "/pos_center", get_background_path("design.ini")).toInt(&bOk);
+ if (bOk)
+ {
+ f_center = subpos_center;
+ }
+ }
QString f_background;
QString f_desk_image;
if (file_exists(get_image_suffix(get_background_path("witnessempty"))))
@@ -130,10 +155,10 @@ QString AOApplication::get_pos_path(const QString &pos, const bool desk)
f_desk_image = "seancedesk";
}
- if (file_exists(get_image_suffix(get_background_path(pos)))) // Unique pos path
+ if (file_exists(get_image_suffix(get_background_path(f_pos_split[0])))) // Unique pos path
{
- f_background = pos;
- f_desk_image = pos + "_overlay";
+ f_background = f_pos_split[0];
+ f_desk_image = f_pos_split[0] + "_overlay";
}
QString desk_override = read_design_ini("overlays/" + f_background, get_background_path("design.ini"));
@@ -143,9 +168,9 @@ QString AOApplication::get_pos_path(const QString &pos, const bool desk)
}
if (desk)
{
- return f_desk_image;
+ return {f_desk_image, f_center};
}
- return f_background;
+ return {f_background, f_center};
}
VPath AOApplication::get_evidence_path(QString p_file)