M products/BellHybrid/apps/application-bell-main/presenters/StateController.cpp => products/BellHybrid/apps/application-bell-main/presenters/StateController.cpp +1 -0
@@ 367,6 367,7 @@ namespace app::home_screen
"AlarmRinging"_s + event<Events::BackPress> [Helpers::isSnoozeAllowed] = "AlarmSnoozedWait"_s,
"AlarmRinging"_s + event<Events::BackPress> [not Helpers::isSnoozeAllowed] / Helpers::turnOffRingingAlarm = "ActivatedWait"_s,
"AlarmRinging"_s + event<Events::DeepDownPress> = "AlarmRingingDeactivatedWait"_s,
+ "AlarmRinging"_s + event<Events::BatteryUpdate> / Helpers::updateBatteryStatus,
"AlarmRingingDeactivatedWait"_s + sml::on_entry<_> / AlarmRingingDeactivatedWait::entry,
"AlarmRingingDeactivatedWait"_s + sml::on_exit<_> / AlarmRingingDeactivatedWait::exit,
M products/BellHybrid/apps/application-bell-settings/presenter/TimeUnitsPresenter.cpp => products/BellHybrid/apps/application-bell-settings/presenter/TimeUnitsPresenter.cpp +13 -5
@@ 1,4 1,4 @@
-// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
+// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#include "models/TemperatureUnitModel.hpp"
@@ 6,10 6,18 @@
#include <common/layouts/HomeScreenLayouts.hpp>
#include <common/models/LayoutModel.hpp>
+#include <common/layouts/HomeScreenLayoutNames.hpp>
#include <appmgr/messages/ChangeHomescreenLayoutMessage.hpp>
#include <service-appmgr/Constants.hpp>
+namespace
+{
+ constexpr auto classicPrefix = "Classic";
+ constexpr auto verticalPrefix = "Vertical";
+
+} // namespace
+
namespace app::bell_settings
{
TimeUnitsWindowPresenter::TimeUnitsWindowPresenter(
@@ 48,11 56,11 @@ namespace app::bell_settings
}
if (isCurrentLayout12h) {
std::string fallbackLayout;
- if (currentLayout->rfind("Classic", 0) == 0) {
- fallbackLayout = "Classic";
+ if (currentLayout->rfind(classicPrefix, 0) == 0) {
+ fallbackLayout = gui::layout::Classic;
}
- else if (currentLayout->rfind("Vertical", 0) == 0) {
- fallbackLayout = "VerticalSimple";
+ else if (currentLayout->rfind(verticalPrefix, 0) == 0) {
+ fallbackLayout = gui::layout::VerticalSimple;
}
auto layoutChangeRequest = std::make_shared<ChangeHomescreenLayoutMessage>(fallbackLayout);
app->bus.sendUnicast(layoutChangeRequest, service::name::appmgr);
M products/BellHybrid/apps/common/CMakeLists.txt => products/BellHybrid/apps/common/CMakeLists.txt +1 -0
@@ 123,6 123,7 @@ target_sources(application-bell-common
include/common/layouts/HomeScreenLayoutVerticalSimple.hpp
include/common/layouts/HomeScreenLayoutVerticalWithAmPm.hpp
include/common/layouts/HomeScreenLayoutVerticalWithDate.hpp
+ include/common/layouts/HomeScreenLayoutNames.hpp
)
target_link_libraries(application-bell-common
M products/BellHybrid/apps/common/include/common/layouts/HomeScreenLayoutClassic.hpp => products/BellHybrid/apps/common/include/common/layouts/HomeScreenLayoutClassic.hpp +9 -3
@@ 9,9 9,11 @@
namespace style::homescreen_classic
{
- constexpr inline auto status_box_layout_w = 350U;
- constexpr inline auto info_box_layout_h = 70U;
- constexpr inline auto connection_box_layout_h = 44U;
+ constexpr inline auto status_box_layout_w = 350U;
+ constexpr inline auto info_box_layout_h = 70U;
+ constexpr inline auto connection_box_layout_h = 44U;
+ constexpr inline auto connection_box_top_margin = 20U;
+ constexpr inline auto connection_box_bottom_margin = -20;
} // namespace style::homescreen_classic
namespace gui
@@ 68,6 70,10 @@ namespace gui
virtual bool isBatteryVisibilityAllowed(const Store::Battery &batteryContext);
void removeTextDescription();
+ private:
+ void adjustConnectionStatusPosition();
+
+ protected:
VBox *widgetBox = nullptr;
HBox *timeHBox = nullptr;
TimeSetFmtSpinner *time = nullptr;
A products/BellHybrid/apps/common/include/common/layouts/HomeScreenLayoutNames.hpp => products/BellHybrid/apps/common/include/common/layouts/HomeScreenLayoutNames.hpp +24 -0
@@ 0,0 1,24 @@
+// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
+// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
+
+#pragma once
+
+namespace gui
+{
+ namespace layout
+ {
+ constexpr auto Classic = "Classic";
+ constexpr auto ClassicWithBattery = "ClassicWithBattery";
+ constexpr auto ClassicWithAmPm = "ClassicWithAmPm";
+ constexpr auto ClassicWithDate = "ClassicWithDate";
+ constexpr auto VerticalSimple = "VerticalSimple";
+ constexpr auto VerticalWithDate = "VerticalWithDate";
+ constexpr auto VerticalWithAmPm = "VerticalWithAmPm";
+ constexpr auto VerticalWithDateAmPm = "VerticalWithDateAmPm";
+
+#if CONFIG_ENABLE_TEMP == 1
+ constexpr auto ClassicWithTemp = "ClassicWithTemp";
+#endif
+
+ } // namespace layout
+} // namespace gui
M products/BellHybrid/apps/common/src/layouts/HomeScreenLayoutClassic.cpp => products/BellHybrid/apps/common/src/layouts/HomeScreenLayoutClassic.cpp +25 -0
@@ 2,6 2,7 @@
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#include "layouts/HomeScreenLayoutClassic.hpp"
+#include "layouts/HomeScreenLayoutNames.hpp"
#include "data/BellMainStyle.hpp"
#include "widgets/BellBattery.hpp"
#include "widgets/BellConnectionStatus.hpp"
@@ 247,6 248,7 @@ namespace gui
}
battery->informContentChanged();
connectionStatus->informContentChanged();
+ adjustConnectionStatusPosition();
}
void HomeScreenLayoutClassic::setTime(std::time_t newTime)
@@ 301,4 303,27 @@ namespace gui
connectionStatus->setConnected();
connectionStatus->informContentChanged();
}
+
+ auto HomeScreenLayoutClassic::adjustConnectionStatusPosition() -> void
+ {
+ if (getName() == gui::layout::Classic) {
+ if (battery->visible) {
+ widgetBox->removeWidget(infoBox);
+ widgetBox->removeWidget(connectionBox);
+ connectionBox->setMargins(Margins(0, 0, 0, 0));
+ widgetBox->addWidget(infoBox);
+ widgetBox->addWidget(connectionBox);
+ }
+ else {
+ widgetBox->removeWidget(infoBox);
+ widgetBox->removeWidget(connectionBox);
+ connectionBox->setMargins(Margins(0,
+ style::homescreen_classic::connection_box_top_margin,
+ 0,
+ style::homescreen_classic::connection_box_bottom_margin));
+ widgetBox->addWidget(connectionBox);
+ widgetBox->addWidget(infoBox);
+ }
+ }
+ }
}; // namespace gui
M products/BellHybrid/apps/common/src/layouts/HomeScreenLayoutClassicWithAmPm.cpp => products/BellHybrid/apps/common/src/layouts/HomeScreenLayoutClassicWithAmPm.cpp +5 -1
@@ 23,7 23,7 @@ namespace gui
battery->setAlignment(Alignment(Alignment::Horizontal::Center, Alignment::Vertical::Center));
- fmt = new TextFixedSize(infoBox);
+ fmt = new TextFixedSize(nullptr);
fmt->setMaximumSize(style::homescreen_classic::status_box_layout_w, style::bell_base_layout::outer_layouts_h);
fmt->setAlignment(Alignment(Alignment::Horizontal::Center, Alignment::Vertical::Center));
fmt->setFont(mainWindow::bottomDescription::font_normal);
@@ 32,6 32,10 @@ namespace gui
fmt->drawUnderline(false);
fmt->setText("");
fmt->setMargins({0, style::bell_base_layout::info_box_top_margin, 0, 0});
+
+ infoBox->removeWidget(battery);
+ infoBox->addWidget(battery);
+ infoBox->addWidget(fmt);
}
auto HomeScreenLayoutClassicWithAmPm::setTime(std::time_t newTime) -> void
M products/BellHybrid/apps/common/src/layouts/HomeScreenLayouts.cpp => products/BellHybrid/apps/common/src/layouts/HomeScreenLayouts.cpp +27 -15
@@ 1,7 1,8 @@
-// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
+// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
+#include <common/layouts/HomeScreenLayoutNames.hpp>
#include <common/layouts/HomeScreenLayouts.hpp>
#include <common/layouts/HomeScreenLayoutClassic.hpp>
#include <common/layouts/HomeScreenLayoutClassicWithAmPm.hpp>
@@ 21,17 22,22 @@ namespace gui::factory
{
return
{
- {"Classic", []() { return new HomeScreenLayoutClassic("Classic"); }},
- {"ClassicWithBattery", []() { return new HomeScreenLayoutClassicWithBattery("ClassicWithBattery"); }},
- {"ClassicWithDate", []() { return new HomeScreenLayoutClassicWithDate("ClassicWithDate"); }},
- {"VerticalSimple", []() { return new HomeScreenLayoutVerticalSimple("VerticalSimple"); }},
+ {gui::layout::Classic, []() { return new HomeScreenLayoutClassic(gui::layout::Classic); }},
+ {gui::layout::ClassicWithBattery,
+ []() { return new HomeScreenLayoutClassicWithBattery(gui::layout::ClassicWithBattery); }},
+ {gui::layout::ClassicWithDate,
+ []() { return new HomeScreenLayoutClassicWithDate(gui::layout::ClassicWithDate); }},
+ {gui::layout::VerticalSimple,
+ []() { return new HomeScreenLayoutVerticalSimple(gui::layout::VerticalSimple); }},
{
- "VerticalWithDate", []() { return new HomeScreenLayoutVerticalWithDate("VerticalWithDate"); }
+ gui::layout::VerticalWithDate,
+ []() { return new HomeScreenLayoutVerticalWithDate(gui::layout::VerticalWithDate); }
}
#if CONFIG_ENABLE_TEMP == 1
,
{
- "ClassicWithTemp", []() { return new HomeScreenLayoutClassicWithTemp("ClassicWithTemp"); }
+ gui::layout::ClassicWithTemp,
+ []() { return new HomeScreenLayoutClassicWithTemp(gui::layout::ClassicWithTemp); }
}
#endif
};
@@ 41,14 47,20 @@ namespace gui::factory
{
return
{
- {"Classic", []() { return new HomeScreenLayoutClassic("Classic"); }},
- {"ClassicWithAmPm", []() { return new HomeScreenLayoutClassicWithAmPm("ClassicWithAmPm"); }},
- {"ClassicWithBattery", []() { return new HomeScreenLayoutClassicWithBattery("ClassicWithBattery"); }},
- {"ClassicWithDate", []() { return new HomeScreenLayoutClassicWithDate("ClassicWithDateAmPm"); }},
- {"VerticalSimple", []() { return new HomeScreenLayoutVerticalSimple("VerticalSimple"); }},
- {"VerticalWithAmPm", []() { return new HomeScreenLayoutVerticalWithAmPm("VerticalWithAmPm"); }},
+ {gui::layout::Classic, []() { return new HomeScreenLayoutClassic(gui::layout::Classic); }},
+ {gui::layout::ClassicWithAmPm,
+ []() { return new HomeScreenLayoutClassicWithAmPm(gui::layout::ClassicWithAmPm); }},
+ {gui::layout::ClassicWithBattery,
+ []() { return new HomeScreenLayoutClassicWithBattery(gui::layout::ClassicWithBattery); }},
+ {gui::layout::ClassicWithDate,
+ []() { return new HomeScreenLayoutClassicWithDate(gui::layout::ClassicWithDate); }},
+ {gui::layout::VerticalSimple,
+ []() { return new HomeScreenLayoutVerticalSimple(gui::layout::VerticalSimple); }},
+ {gui::layout::VerticalWithAmPm,
+ []() { return new HomeScreenLayoutVerticalWithAmPm(gui::layout::VerticalWithAmPm); }},
{
- "VerticalWithDate", []() { return new HomeScreenLayoutVerticalWithDate("VerticalWithDateAmPm"); }
+ gui::layout::VerticalWithDate,
+ []() { return new HomeScreenLayoutVerticalWithDate(gui::layout::VerticalWithDateAmPm); }
}
#if CONFIG_ENABLE_TEMP == 1
,
@@ 66,7 78,7 @@ namespace gui::factory
std::string getDefaultLayout()
{
- return "ClassicWithBattery";
+ return gui::layout::ClassicWithBattery;
}
} // namespace gui::factory
M products/BellHybrid/apps/common/src/widgets/BellConnectionStatus.cpp => products/BellHybrid/apps/common/src/widgets/BellConnectionStatus.cpp +1 -1
@@ 37,7 37,7 @@ namespace gui
void BellConnectionStatus::checkIfConnected(const Store::Battery::State &state)
{
- if (state == Store::Battery::State::Discharging) {
+ if (state != Store::Battery::State::PluggedNotCharging) {
statusText->setVisible(false);
}
}