diff options
author | JF002 <JF002@users.noreply.github.com> | 2021-06-12 11:02:06 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-12 11:02:06 +0200 |
commit | 0ce98c7ac7ba66acaf504be9bb042796e12f2733 (patch) | |
tree | 3f9c7f96f0fab64f581035c72480596a4cc4db43 /src/displayapp/screens/ScreenList.h | |
parent | 79f0fcb07aa80eb70385223272e29f2ba5657bc8 (diff) | |
parent | 6d524ebea2c97e309633d5e01c3a1e37c182f27d (diff) |
Merge pull request #415 from JF002/move-heap-to-static
Move dynamically allocated variables to static variables.
Diffstat (limited to 'src/displayapp/screens/ScreenList.h')
-rw-r--r-- | src/displayapp/screens/ScreenList.h | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/displayapp/screens/ScreenList.h b/src/displayapp/screens/ScreenList.h index 73ea4610..ea66bfb2 100644 --- a/src/displayapp/screens/ScreenList.h +++ b/src/displayapp/screens/ScreenList.h @@ -15,12 +15,17 @@ namespace Pinetime { public: ScreenList(DisplayApp* app, uint8_t initScreen, - std::array<std::function<std::unique_ptr<Screen>()>, N>&& screens, + const std::array<std::function<std::unique_ptr<Screen>()>, N>&& screens, ScreenListModes mode) - : Screen(app), initScreen {initScreen}, screens {std::move(screens)}, mode {mode}, current {this->screens[initScreen]()} { - screenIndex = initScreen; + : Screen(app), initScreen {initScreen}, screens {std::move(screens)}, mode {mode}, screenIndex{initScreen}, current {this->screens[initScreen]()} { + } + ScreenList(const ScreenList&) = delete; + ScreenList& operator=(const ScreenList&) = delete; + ScreenList(ScreenList&&) = delete; + ScreenList& operator=(ScreenList&&) = delete; + ~ScreenList() override { lv_obj_clean(lv_scr_act()); } @@ -97,7 +102,7 @@ namespace Pinetime { private: uint8_t initScreen = 0; - std::array<std::function<std::unique_ptr<Screen>()>, N> screens; + const std::array<std::function<std::unique_ptr<Screen>()>, N> screens; ScreenListModes mode = ScreenListModes::UpDown; uint8_t screenIndex = 0; |