Skip to content

Commit

Permalink
Stop passing app around
Browse files Browse the repository at this point in the history
Following 7c7a860
  • Loading branch information
yannickulrich committed May 27, 2023
1 parent e77219e commit c6d65db
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/displayapp/DisplayApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ void DisplayApp::LoadScreen(Apps app, DisplayApp::FullRefreshDirections directio
currentScreen = std::make_unique<Screens::Twos>();
break;
case Apps::Gallery:
currentScreen = std::make_unique<Screens::Gallery>(this, filesystem);
currentScreen = std::make_unique<Screens::Gallery>(filesystem);
break;
case Apps::Paint:
currentScreen = std::make_unique<Screens::InfiniPaint>(lvgl, motorController);
Expand Down
10 changes: 5 additions & 5 deletions src/displayapp/screens/FileView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -57,16 +57,16 @@ 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);

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);
Expand Down
6 changes: 3 additions & 3 deletions src/displayapp/screens/FileView.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions src/displayapp/screens/Gallery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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<ImageView>(n, nScreens, app, fullname);
current = std::make_unique<ImageView>(n, nScreens, fullname);
} else if (StringEndsWith(fullname, ".txt")) {
current = std::make_unique<TextView>(n, nScreens, app, fullname, filesystem);
current = std::make_unique<TextView>(n, nScreens, fullname, filesystem);
} else {
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion src/displayapp/screens/Gallery.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit c6d65db

Please sign in to comment.