diff --git a/Platformio/OmoteUI/core/ScreenManager.cpp b/Platformio/OmoteUI/core/ScreenManager.cpp index e56aeb1..b349002 100644 --- a/Platformio/OmoteUI/core/ScreenManager.cpp +++ b/Platformio/OmoteUI/core/ScreenManager.cpp @@ -1,4 +1,5 @@ #include "ScreenManager.hpp" +#include "PopUpScreen.hpp" using namespace UI::Screen; @@ -19,6 +20,12 @@ void Manager::pushScreen(Screen::Base::Ptr aScreen) { mScreens.top()->Show(); } +void Manager::pushPopUp(Page::Base::Ptr aPopUpPage, + lv_scr_load_anim_t aPushAnimation) { + pushScreen(std::make_unique(std::move(aPopUpPage)), + aPushAnimation); +} + bool Manager::distributeKeyEvent(KeyPressAbstract::KeyEvent aKeyEvent) { // Send Key Even to top Screen for handling return mScreens.top()->KeyEvent(aKeyEvent); diff --git a/Platformio/OmoteUI/core/ScreenManager.hpp b/Platformio/OmoteUI/core/ScreenManager.hpp index d1ca226..ac3fbc6 100644 --- a/Platformio/OmoteUI/core/ScreenManager.hpp +++ b/Platformio/OmoteUI/core/ScreenManager.hpp @@ -1,5 +1,6 @@ #pragma once +#include "PageBase.hpp" #include "ScreenBase.hpp" #include #include @@ -11,7 +12,12 @@ public: static Manager &getInstance(); void pushScreen(Screen::Base::Ptr aScreen); - void pushScreen(Screen::Base::Ptr aScreen, lv_scr_load_anim_t aPushAnimation); + void pushScreen(Screen::Base::Ptr aScreen, + lv_scr_load_anim_t aPushAnimationOverride); + + void + pushPopUp(UI::Page::Base::Ptr aPopUpPage, + lv_scr_load_anim_t aPushAnimation = LV_SCR_LOAD_ANIM_OVER_LEFT); bool distributeKeyEvent(KeyPressAbstract::KeyEvent aKeyEvent); diff --git a/Platformio/OmoteUI/core/UIElementIds.hpp b/Platformio/OmoteUI/core/UIElementIds.hpp index 35b935c..9edb87c 100644 --- a/Platformio/OmoteUI/core/UIElementIds.hpp +++ b/Platformio/OmoteUI/core/UIElementIds.hpp @@ -20,6 +20,7 @@ public: enum class Pages { Settings = static_cast(Widgets::INVALID_WIDGET_ID) + 1, + DisplaySettings, INVALID_PAGE_ID }; diff --git a/Platformio/OmoteUI/core/page/DisplaySettings.cpp b/Platformio/OmoteUI/core/page/DisplaySettings.cpp new file mode 100644 index 0000000..5adbee9 --- /dev/null +++ b/Platformio/OmoteUI/core/page/DisplaySettings.cpp @@ -0,0 +1,6 @@ +#include "DisplaySettings.hpp" + +using namespace UI::Page; + +DisplaySettings::DisplaySettings(std::shared_ptr aDisplay) + : Base(UI::ID::Pages::DisplaySettings), mDisplay(aDisplay) {} \ No newline at end of file diff --git a/Platformio/OmoteUI/core/page/DisplaySettings.hpp b/Platformio/OmoteUI/core/page/DisplaySettings.hpp new file mode 100644 index 0000000..e2ca363 --- /dev/null +++ b/Platformio/OmoteUI/core/page/DisplaySettings.hpp @@ -0,0 +1,13 @@ +#pragma once +#include "DisplayAbstract.h" +#include "PageBase.hpp" + +namespace UI::Page { +class DisplaySettings : public Base { +public: + DisplaySettings(std::shared_ptr aDisplay); + +private: + std::shared_ptr mDisplay; +}; +} // namespace UI::Page diff --git a/Platformio/OmoteUI/core/page/SettingsPage.cpp b/Platformio/OmoteUI/core/page/SettingsPage.cpp index d4062bd..9b3d9a4 100644 --- a/Platformio/OmoteUI/core/page/SettingsPage.cpp +++ b/Platformio/OmoteUI/core/page/SettingsPage.cpp @@ -1,13 +1,16 @@ #include "SettingsPage.hpp" #include "BackgroundScreen.hpp" #include "Button.hpp" +#include "DisplaySettings.hpp" +#include "PopUpScreen.hpp" +#include "ScreenManager.hpp" using namespace UI::Page; SettingsPage::SettingsPage(std::shared_ptr aHardware) : Base(ID::Pages::Settings), mHardware(aHardware) { SetBgColor(lv_color_make(255, 0, 0)); - auto button = std::make_unique([this] { AddSlider(); }); + auto button = std::make_unique([this] { PushDisplaySettings(); }); button->SetY(0); button->SetHeight(lv_pct(10)); button->SetWidth(lv_pct(10)); @@ -17,6 +20,11 @@ SettingsPage::SettingsPage(std::shared_ptr aHardware) void SettingsPage::OnShow() {} +void SettingsPage::PushDisplaySettings() { + UI::Screen::Manager::getInstance().pushPopUp( + std::make_unique(mHardware->display())); +} + void SettingsPage::AddSlider() { auto fakeSlider = std::make_unique( lv_slider_create(UI::Screen::BackgroundScreen::getLvInstance())); diff --git a/Platformio/OmoteUI/core/page/SettingsPage.hpp b/Platformio/OmoteUI/core/page/SettingsPage.hpp index 23cea9b..623d71a 100644 --- a/Platformio/OmoteUI/core/page/SettingsPage.hpp +++ b/Platformio/OmoteUI/core/page/SettingsPage.hpp @@ -9,6 +9,7 @@ public: bool OnKeyEvent(KeyPressAbstract::KeyEvent aKeyEvent) override; void AddSlider(); + void PushDisplaySettings(); protected: void OnShow() override;