From c6d65dba93e4c0fe05f6e9976e2c6197fa3a8312 Mon Sep 17 00:00:00 2001 From: Yannick Ulrich Date: Sun, 12 Mar 2023 13:41:55 +0000 Subject: [PATCH] Stop passing app around Following 7c7a860 --- src/displayapp/DisplayApp.cpp | 2 +- src/displayapp/screens/FileView.cpp | 10 +++++----- src/displayapp/screens/FileView.h | 6 +++--- src/displayapp/screens/Gallery.cpp | 6 +++--- src/displayapp/screens/Gallery.h | 2 +- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/displayapp/DisplayApp.cpp b/src/displayapp/DisplayApp.cpp index 901753d725..daba73a7ee 100644 --- a/src/displayapp/DisplayApp.cpp +++ b/src/displayapp/DisplayApp.cpp @@ -522,7 +522,7 @@ void DisplayApp::LoadScreen(Apps app, DisplayApp::FullRefreshDirections directio currentScreen = std::make_unique(); break; case Apps::Gallery: - currentScreen = std::make_unique(this, filesystem); + currentScreen = std::make_unique(filesystem); break; case Apps::Paint: currentScreen = std::make_unique(lvgl, motorController); diff --git a/src/displayapp/screens/FileView.cpp b/src/displayapp/screens/FileView.cpp index 59d674c3ef..e9167b2d0d 100644 --- a/src/displayapp/screens/FileView.cpp +++ b/src/displayapp/screens/FileView.cpp @@ -5,8 +5,8 @@ using namespace Pinetime::Applications::Screens; -FileView::FileView(uint8_t screenID, uint8_t nScreens, DisplayApp* app, const char* path) - : screenID(screenID), nScreens(nScreens), Screen(app), pageIndicator(screenID, nScreens) { +FileView::FileView(uint8_t screenID, uint8_t nScreens, const char* path) + : screenID(screenID), nScreens(nScreens), Screen(), pageIndicator(screenID, nScreens) { label = nullptr; const char* c = strrchr(path, '/') + 1; @@ -57,7 +57,7 @@ FileView::~FileView() { lv_obj_clean(lv_scr_act()); } -ImageView::ImageView(uint8_t screenID, uint8_t nScreens, DisplayApp* app, const char* path) : FileView(screenID, nScreens, app, path) { +ImageView::ImageView(uint8_t screenID, uint8_t nScreens, const char* path) : FileView(screenID, nScreens, path) { lv_obj_t* image = lv_img_create(lv_scr_act(), nullptr); lv_img_set_src(image, path); lv_obj_align(image, lv_scr_act(), LV_ALIGN_CENTER, 0, 0); @@ -65,8 +65,8 @@ ImageView::ImageView(uint8_t screenID, uint8_t nScreens, DisplayApp* app, const ShowInfo(); } -TextView::TextView(uint8_t screenID, uint8_t nScreens, DisplayApp* app, const char* path, Pinetime::Controllers::FS& fs) - : FileView(screenID, nScreens, app, path) { +TextView::TextView(uint8_t screenID, uint8_t nScreens, const char* path, Pinetime::Controllers::FS& fs) + : FileView(screenID, nScreens, path) { lv_obj_t* label = lv_label_create(lv_scr_act(), nullptr); lv_label_set_long_mode(label, LV_LABEL_LONG_BREAK); diff --git a/src/displayapp/screens/FileView.h b/src/displayapp/screens/FileView.h index e0051c13e9..5aa61b4f53 100644 --- a/src/displayapp/screens/FileView.h +++ b/src/displayapp/screens/FileView.h @@ -10,7 +10,7 @@ namespace Pinetime { namespace Screens { class FileView : public Screen { public: - FileView(uint8_t screenID, uint8_t nScreens, DisplayApp* app, const char* path); + FileView(uint8_t screenID, uint8_t nScreens, const char* path); ~FileView() override; void ShowInfo(); @@ -27,12 +27,12 @@ namespace Pinetime { class ImageView : public FileView { public: - ImageView(uint8_t screenID, uint8_t nScreens, DisplayApp* app, const char* path); + ImageView(uint8_t screenID, uint8_t nScreens, const char* path); }; class TextView : public FileView { public: - TextView(uint8_t screenID, uint8_t nScreens, DisplayApp* app, const char* path, Pinetime::Controllers::FS& fs); + TextView(uint8_t screenID, uint8_t nScreens, const char* path, Pinetime::Controllers::FS& fs); ~TextView() override; private: diff --git a/src/displayapp/screens/Gallery.cpp b/src/displayapp/screens/Gallery.cpp index 78e122357f..8ce84eb56b 100644 --- a/src/displayapp/screens/Gallery.cpp +++ b/src/displayapp/screens/Gallery.cpp @@ -4,7 +4,7 @@ using namespace Pinetime::Applications::Screens; -Gallery::Gallery(DisplayApp* app, Pinetime::Controllers::FS& filesystem) : Screen(app), filesystem(filesystem) { +Gallery::Gallery(Pinetime::Controllers::FS& filesystem) : Screen(), filesystem(filesystem) { ListDir(); if (nScreens == 0) { @@ -94,9 +94,9 @@ bool Gallery::Open(int n) { strncat(fullname, info.name, sizeof(fullname) - strlen(directory) - 2 - 1); if (StringEndsWith(fullname, ".bin")) { - current = std::make_unique(n, nScreens, app, fullname); + current = std::make_unique(n, nScreens, fullname); } else if (StringEndsWith(fullname, ".txt")) { - current = std::make_unique(n, nScreens, app, fullname, filesystem); + current = std::make_unique(n, nScreens, fullname, filesystem); } else { return false; } diff --git a/src/displayapp/screens/Gallery.h b/src/displayapp/screens/Gallery.h index d11a269c5f..7632c6c2c2 100644 --- a/src/displayapp/screens/Gallery.h +++ b/src/displayapp/screens/Gallery.h @@ -12,7 +12,7 @@ namespace Pinetime { public: static constexpr const char* directory = "/gallery/"; - Gallery(DisplayApp* app, Pinetime::Controllers::FS& filesystem); + Gallery(Pinetime::Controllers::FS& filesystem); ~Gallery() override; bool OnTouchEvent(Pinetime::Applications::TouchEvents event) override;