Path fixes for simulator (#357)

This commit is contained in:
Ken Van Hoeylandt
2025-10-03 22:12:55 +02:00
committed by GitHub
parent efd9662cfc
commit a05a6afaaf
11 changed files with 38 additions and 12 deletions
+3 -1
View File
@@ -1,3 +1,5 @@
#include "Tactility/lvgl/Lvgl.h"
#include <Tactility/TactilityCore.h>
#include <Tactility/TactilityPrivate.h>
#include <Tactility/app/AppContext.h>
@@ -169,7 +171,7 @@ public:
} else {
logo = hal::usb::isUsbBootMode() ? "logo_usb.png" : "logo.png";
}
const auto logo_path = "A:" + paths->getAssetsPath(logo);
const auto logo_path = lvgl::PATH_PREFIX + paths->getAssetsPath(logo);
TT_LOG_I(TAG, "%s", logo_path.c_str());
lv_image_set_src(image, logo_path.c_str());
}
@@ -1,3 +1,4 @@
#include <Tactility/lvgl/Lvgl.h>
#include <Tactility/lvgl/Style.h>
#include <Tactility/lvgl/Toolbar.h>
#include <Tactility/service/loader/Loader.h>
@@ -47,7 +48,7 @@ class ImageViewerApp final : public App {
tt_check(bundle != nullptr, "Parameters not set");
std::string file_argument;
if (bundle->optString(IMAGE_VIEWER_FILE_ARGUMENT, file_argument)) {
std::string prefixed_path = "A:" + file_argument;
std::string prefixed_path = lvgl::PATH_PREFIX + file_argument;
TT_LOG_I(TAG, "Opening %s", prefixed_path.c_str());
lv_img_set_src(image, prefixed_path.c_str());
auto path = string::getLastPathSegment(file_argument);
+4 -3
View File
@@ -4,6 +4,7 @@
#include <Tactility/app/AppPaths.h>
#include <Tactility/app/AppRegistration.h>
#include <Tactility/hal/power/PowerDevice.h>
#include <Tactility/lvgl/Lvgl.h>
#include <Tactility/service/loader/Loader.h>
#include <Tactility/settings/BootSettings.h>
@@ -113,9 +114,9 @@ public:
const int32_t margin = is_landscape_display ? std::min<int32_t>(available_width / 16, button_size) : 0;
const auto paths = app.getPaths();
const auto apps_icon_path = "A:" + paths->getAssetsPath("icon_apps.png");
const auto files_icon_path = "A:" + paths->getAssetsPath("icon_files.png");
const auto settings_icon_path = "A:" + paths->getAssetsPath("icon_settings.png");
const auto apps_icon_path = lvgl::PATH_PREFIX + paths->getAssetsPath("icon_apps.png");
const auto files_icon_path = lvgl::PATH_PREFIX + paths->getAssetsPath("icon_files.png");
const auto settings_icon_path = lvgl::PATH_PREFIX + paths->getAssetsPath("icon_settings.png");
createAppButton(buttons_wrapper, ui_scale, apps_icon_path.c_str(), "AppList", margin);
createAppButton(buttons_wrapper, ui_scale, files_icon_path.c_str(), "Files", margin);
@@ -16,10 +16,16 @@ namespace tt::app::localesettings {
constexpr auto* TAG = "LocaleSettings";
#ifdef ESP_PLATFORM
constexpr auto* TEXT_RESOURCE_PATH = "/system/app/LocaleSettings/i18n";
#else
constexpr auto* TEXT_RESOURCE_PATH = "system/app/LocaleSettings/i18n";
#endif
extern const AppManifest manifest;
class LocaleSettingsApp final : public App {
tt::i18n::TextResources textResources = tt::i18n::TextResources("/system/app/LocaleSettings/i18n");
tt::i18n::TextResources textResources = tt::i18n::TextResources(TEXT_RESOURCE_PATH);
Mutex mutex = Mutex(Mutex::Type::Recursive);
lv_obj_t* timeZoneLabel = nullptr;
lv_obj_t* regionLabel = nullptr;
@@ -8,6 +8,7 @@
#include <Tactility/app/App.h>
#include <Tactility/app/AppManifest.h>
#include <Tactility/lvgl/Lvgl.h>
#include <Tactility/lvgl/LvglSync.h>
#include <Tactility/lvgl/Toolbar.h>
#include <Tactility/service/screenshot/Screenshot.h>
@@ -204,13 +205,13 @@ void ScreenshotApp::createFilePathWidgets(lv_obj_t* parent) {
TT_LOG_W(TAG, "Found multiple SD card devices - picking first");
}
if (!sdcard_devices.empty() && sdcard_devices.front()->isMounted()) {
std::string lvgl_mount_path = "A:" + sdcard_devices.front()->getMountPath();
std::string lvgl_mount_path = lvgl::PATH_PREFIX + sdcard_devices.front()->getMountPath();
lv_textarea_set_text(pathTextArea, lvgl_mount_path.c_str());
} else {
lv_textarea_set_text(pathTextArea, "Error: no SD card");
}
} else { // PC
lv_textarea_set_text(pathTextArea, "A:");
lv_textarea_set_text(pathTextArea, lvgl::PATH_PREFIX);
}
}
+2 -1
View File
@@ -2,6 +2,7 @@
#include <Tactility/app/AppManifest.h>
#include <Tactility/app/AppPaths.h>
#include <Tactility/app/timezone/TimeZone.h>
#include <Tactility/lvgl/Lvgl.h>
#include <Tactility/lvgl/Toolbar.h>
#include <Tactility/lvgl/LvglSync.h>
#include <Tactility/service/loader/Loader.h>
@@ -200,7 +201,7 @@ public:
lv_obj_set_style_image_recolor_opa(icon, 255, 0);
lv_obj_set_style_image_recolor(icon, lv_theme_get_color_primary(parent), 0);
std::string icon_path = "A:" + app.getPaths()->getAssetsPath("search.png");
std::string icon_path = lvgl::PATH_PREFIX + app.getPaths()->getAssetsPath("search.png");
lv_image_set_src(icon, icon_path.c_str());
lv_obj_set_style_image_recolor(icon, lv_theme_get_color_primary(parent), 0);