M module-apps/apps-common/ApplicationCommon.cpp => module-apps/apps-common/ApplicationCommon.cpp +13 -13
@@ 2,10 2,10 @@
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#include "ApplicationCommon.hpp"
-#include "Common.hpp" // for RefreshModes
-#include "GuiTimer.hpp" // for GuiTimer
-#include "Item.hpp" // for Item
-#include "MessageType.hpp" // for MessageType
+#include "Common.hpp" // for RefreshModes
+#include "GuiTimer.hpp" // for GuiTimer
+#include "Item.hpp" // for Item
+#include "MessageType.hpp" // for MessageType
#include "Service/Message.hpp"
#include "Timers/TimerFactory.hpp" // for Timer
#include "StatusBar.hpp"
@@ 14,10 14,10 @@
#include "Translator.hpp" // for KeyInputSim...
#include <EventStore.hpp> // for Battery
#include <hal/key_input/RawKey.hpp>
-#include "gui/input/InputEvent.hpp" // for InputEvent
-#include <log/debug.hpp> // for DEBUG_APPLI...
-#include <log/log.hpp> // for LOG_INFO
-#include "messages/AppMessage.hpp" // for AppSwitchMe...
+#include "gui/input/InputEvent.hpp" // for InputEvent
+#include <log/debug.hpp> // for DEBUG_APPLI...
+#include <log/log.hpp> // for LOG_INFO
+#include "messages/AppMessage.hpp" // for AppSwitchMe...
#include "messages/AppSwitchWindowPopupMessage.hpp"
#include "service-appmgr/Controller.hpp" // for Controller
#include "actions/AlarmClockStatusChangeParams.hpp"
@@ 896,6 896,11 @@ namespace app
return *popupFilter;
}
+ void ApplicationCommon::clearPendingPopups()
+ {
+ windowsPopupQueue->clear();
+ }
+
bool ApplicationCommon::tryShowPopup()
{
auto request = windowsPopupQueue->popRequest(getPopupFilter());
@@ 1065,9 1070,4 @@ namespace app
getCurrentWindow()->updateBatteryStatus();
getCurrentWindow()->updateSim();
}
-
- void ApplicationCommon::registerOnPopCallback(std::function<void(WindowsStack &)> callback)
- {
- windowsStack().registerOnPopCallback(std::move(callback));
- }
} /* namespace app */
M module-apps/apps-common/ApplicationCommon.hpp => module-apps/apps-common/ApplicationCommon.hpp +3 -4
@@ 185,7 185,6 @@ namespace app
private:
std::unique_ptr<gui::popup::Filter> popupFilter;
std::unique_ptr<WindowsStack> windowsStackImpl;
- WindowsStack &windowsStack() const;
std::string default_window;
State state = State::DEACTIVATED;
@@ 220,6 219,7 @@ namespace app
public:
sys::TimerHandle longPressTimer;
void clearLongPressTimeout();
+ WindowsStack &windowsStack() const;
explicit ApplicationCommon(std::string name,
std::string parent = "",
@@ 275,8 275,6 @@ namespace app
/// Find and pop window from stack by window name
void popWindow(const std::string &window);
- void registerOnPopCallback(std::function<void(WindowsStack &)> callback);
-
/// Pops the current window from the windows stack
void popCurrentWindow();
@@ 362,13 360,14 @@ namespace app
/// Method used to attach popups windows to application
virtual void attachPopups(const std::vector<gui::popup::ID> &popupsList) = 0;
virtual void actionPopupPush(std::unique_ptr<gui::SwitchData> params);
+ virtual void clearPendingPopups();
virtual bool tryShowPopup();
void abortPopup(gui::popup::ID id);
bool userInterfaceDBNotification(sys::Message *msg, const UiNotificationFilter &filter = nullptr);
virtual gui::popup::Filter &getPopupFilter() const;
- void requestShutdownWindow(std::string windowName);
+ void requestShutdownWindow(std::string windowName);
public:
/// push window to the top of windows stack
M => +5 -0
@@ 6,6 6,11 @@
namespace app
{
void WindowsPopupQueue::clear()
{
requests.clear();
}
std::optional<gui::popup::Request> WindowsPopupQueue::popRequest(const gui::popup::Filter &filter)
{
for (const auto &val : requests) {
M => +3 -0
@@ 24,6 24,9 @@ namespace app
class WindowsPopupQueue
{
public:
/// clears popup queue
void clear();
/// pops next available popup we require to show
/// * in order set by Disposition
/// * limited by Filter passed to request
M module-apps/apps-common/WindowsStack.cpp => module-apps/apps-common/WindowsStack.cpp +1 -7
@@ 70,9 70,6 @@ namespace app
auto ret = findInStack(window);
if (ret != stack.end()) {
stack.erase(std::next(ret), stack.end());
- if (onPopCallback) {
- onPopCallback(*this);
- }
return true;
}
return false;
@@ 118,10 115,7 @@ namespace app
{
return std::find_if(stack.begin(), stack.end(), [&](auto &el) { return el.name == window; });
}
- void WindowsStack::registerOnPopCallback(std::function<void(WindowsStack &)> callback)
- {
- onPopCallback = std::move(callback);
- }
+
void WindowsStack::dropPendingPopups()
{
auto it = stack.rbegin();
M module-apps/apps-common/WindowsStack.hpp => module-apps/apps-common/WindowsStack.hpp +1 -3
@@ 1,4 1,4 @@
-// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
+// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#pragma once
@@ 40,7 40,6 @@ namespace app
class WindowsStack
{
- std::function<void(WindowsStack &)> onPopCallback = nullptr;
std::map<std::string, std::unique_ptr<gui::AppWindow>> windows{};
std::vector<WindowData> stack;
decltype(stack)::iterator findInStack(const std::string &);
@@ 75,7 74,6 @@ namespace app
void clear();
bool rebuildWindows(app::WindowsFactory &windowsFactory, ApplicationCommon *app);
- void registerOnPopCallback(std::function<void(WindowsStack &)> callback);
};
} // namespace app
M module-bsp/board/rt1051/bsp/lpm/RT1051LPMCommon.cpp => module-bsp/board/rt1051/bsp/lpm/RT1051LPMCommon.cpp +1 -1
@@ 23,7 23,7 @@ namespace bsp
RT1051LPMCommon::RT1051LPMCommon()
{
driverSEMC = drivers::DriverSEMC::Create(drivers::name::ExternalRAM);
- CpuFreq = std::make_unique<CpuFreqLPM>();
+ CpuFreq = std::make_unique<CpuFreqLPM>();
}
int32_t RT1051LPMCommon::PowerOff()
M => +4 -2
@@ 1,4 1,4 @@
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#pragma once
@@ 11,6 11,8 @@ namespace gui
{
public:
AlarmActivatedPopupRequestParams() : PopupRequestParams{gui::popup::ID::AlarmActivated}
{}
{
// ignoreCurrentWindowOnStack = true;
}
};
} // namespace gui
M => +4 -2
@@ 1,4 1,4 @@
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#pragma once
@@ 11,6 11,8 @@ namespace gui
{
public:
AlarmDeactivatedPopupRequestParams() : PopupRequestParams{gui::popup::ID::AlarmDeactivated}
{}
{
// ignoreCurrentWindowOnStack = true;
}
};
} // namespace gui
M products/BellHybrid/apps/application-bell-main/ApplicationBellMain.cpp => products/BellHybrid/apps/application-bell-main/ApplicationBellMain.cpp +5 -1
@@ 39,7 39,10 @@ namespace app
std::uint32_t stackDepth)
: Application(name, parent, statusIndicators, startInBackground, stackDepth)
{
- registerOnPopCallback([](WindowsStack &windowsStack) { windowsStack.dropPendingPopups(); });
+ getPopupFilter().addAppDependentFilter([&](const gui::PopupRequestParams &) {
+ return gui::name::window::main_window != getCurrentWindow()->getName();
+ });
+
bus.channels.push_back(sys::BusChannel::ServiceDBNotifications);
addActionReceiver(manager::actions::ShowAlarm, [this](auto &&data) {
@@ 166,6 169,7 @@ namespace app
else if (newWindowName == gui::window::name::bell_main_menu ||
newWindowName == gui::window::name::bell_main_menu_dialog) {
startIdleTimer();
+ clearPendingPopups();
}
}
return ApplicationCommon::handleSwitchWindow(msgl);
M => +12 -1
@@ 1,4 1,4 @@
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#include <ApplicationCommon.hpp>
@@ 14,6 14,7 @@
#include <service-time/Constants.hpp>
#include <application-bell-alarm/ApplicationBellAlarmNames.hpp>
#include <application-bell-main/ApplicationBellMain.hpp>
#include <WindowsStack.hpp>
namespace
{
@@ 65,6 66,16 @@ namespace gui
application,
app::manager::actions::AbortPopup,
std::make_unique<gui::PopupRequestParams>(gui::popup::ID::AlarmDeactivated));
if (application->windowsStack().pop(gui::window::name::bellAlarmSet)) {
app::manager::Controller::sendAction(
application,
app::manager::actions::Launch,
std::make_unique<app::ApplicationLaunchData>(app::applicationBellName));
}
else {
application->returnToPreviousWindow();
}
}
bool AlarmActivatedWindow::onInput(const InputEvent &inputEvent)
M => +11 -1
@@ 1,4 1,4 @@
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#include <ApplicationCommon.hpp>
@@ 15,6 15,7 @@
#include <service-time/Constants.hpp>
#include <application-bell-alarm/ApplicationBellAlarmNames.hpp>
#include <application-bell-main/ApplicationBellMain.hpp>
#include <WindowsStack.hpp>
namespace gui
{
@@ 67,5 68,14 @@ namespace gui
app::manager::Controller::sendAction(application,
app::manager::actions::AbortPopup,
std::make_unique<gui::PopupRequestParams>(gui::popup::ID::AlarmActivated));
if (application->windowsStack().pop(gui::window::name::bellAlarmSet)) {
app::manager::Controller::sendAction(
application,
app::manager::actions::Launch,
std::make_unique<app::ApplicationLaunchData>(app::applicationBellName));
}
else {
application->returnToPreviousWindow();
}
}
} /* namespace gui */