M module-apps/application-phonebook/windows/PhonebookSearch.cpp => module-apps/application-phonebook/windows/PhonebookSearch.cpp +3 -3
@@ 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 "PhonebookSearch.hpp"
@@ 48,12 48,12 @@ namespace gui
return false;
}
- std::string searchFilter = utils::trim(inputField->getText());
+ const auto searchFilter = utils::trim(inputField->getText());
if (searchFilter.empty()) {
return false;
}
- auto app = dynamic_cast<app::ApplicationPhonebook *>(application);
+ const auto app = dynamic_cast<app::ApplicationPhonebook *>(application);
if (app == nullptr) {
LOG_ERROR("Failed to get phonebook application.");
return false;
M module-apps/apps-common/widgets/InputBox.cpp => module-apps/apps-common/widgets/InputBox.cpp +9 -8
@@ 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 "InputBox.hpp"
@@ 30,13 30,13 @@ namespace gui
input_Box::h);
verticalBox->setEdges(RectangleEdge::None);
- auto l = new Label(verticalBox);
- l->setMinimumHeight(input_Box::label_h);
- l->setMaximumWidth(style::window::default_body_width);
- l->setFont(style::window::font::small);
- l->setEdges(RectangleEdge::None);
- l->setText(header);
- l->setAlignment(Alignment(gui::Alignment::Horizontal::Left, gui::Alignment::Vertical::Bottom));
+ auto label = new Label(verticalBox);
+ label->setMinimumHeight(input_Box::label_h);
+ label->setMaximumWidth(style::window::default_body_width);
+ label->setFont(style::window::font::small);
+ label->setEdges(RectangleEdge::None);
+ label->setText(header);
+ label->setAlignment(Alignment(gui::Alignment::Horizontal::Left, gui::Alignment::Vertical::Bottom));
auto horizontalBox = new HBox(verticalBox);
horizontalBox->setAlignment({gui::Alignment::Vertical::Top});
@@ 60,6 60,7 @@ namespace gui
if (!icon.empty()) {
auto imageBox = new ImageBox(horizontalBox, new Image(icon));
imageBox->setMinimumSizeToFitImage();
+ imageBox->activeItem = false; // Prevent switching focus to the image
}
verticalBox->resizeItems();
M module-apps/apps-common/windows/AppWindow.cpp => module-apps/apps-common/windows/AppWindow.cpp +3 -4
@@ 9,14 9,13 @@
#include <Style.hpp>
#include <i18n/i18n.hpp>
#include <service-appmgr/Controller.hpp>
-#include <service-audio/AudioServiceAPI.hpp>
using namespace style::header;
namespace gui
{
- AppWindow::AppWindow(app::ApplicationCommon *app, std::string name) : Window(name), application{app}
+ AppWindow::AppWindow(app::ApplicationCommon *app, std::string name) : Window(std::move(name)), application{app}
{
setSize(style::window_width, style::window_height);
}
@@ 126,7 125,7 @@ namespace gui
void AppWindow::updatePhoneMode(sys::phone_modes::PhoneMode mode)
{
auto fn = [&](gui::status_bar::Configuration cfg) -> gui::status_bar::Configuration {
- gui::status_bar::Configuration ret(cfg);
+ gui::status_bar::Configuration ret(std::move(cfg));
ret.setPhoneMode(mode);
return ret;
};
@@ 190,7 189,7 @@ namespace gui
}
}
- if ((inputEvent.isShortRelease())) {
+ if (inputEvent.isShortRelease()) {
switch (inputEvent.getKeyCode()) {
case KeyCode::HEADSET_VOLUP:
[[fallthrough]];
M module-gui/gui/widgets/BoxLayout.cpp => module-gui/gui/widgets/BoxLayout.cpp +18 -13
@@ 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 "BoxLayout.hpp"
@@ 41,10 41,13 @@ namespace gui
bool BoxLayout::onFocus(bool state)
{
- if (state)
+ if (state) {
this->setVisible(state);
- else
+ }
+ else {
this->setFocusItem(nullptr);
+ }
+
this->setNavigation();
if (this->focusChangedCallback && state != focus) {
this->focusChangedCallback(*this);
@@ 78,7 81,7 @@ namespace gui
bool BoxLayout::removeWidget(Item *item)
{
- bool ret = Rect::removeWidget(item);
+ const auto ret = Rect::removeWidget(item);
outOfDrawAreaItems.remove(item);
resizeItems();
@@ 109,7 112,7 @@ namespace gui
void BoxLayout::setVisible(bool value, bool previous)
{
visible = value; // maybe use parent setVisible(...)? would be better but which one?
- if (value == true) {
+ if (value) {
resizeItems(); // move items in box in proper places
setNavigation(); // set navigation through kids -> TODO handle out of last/first to parent
if (children.size()) { // set first visible kid as focused item - TODO should check for actionItems too...
@@ 189,7 192,7 @@ namespace gui
void BoxLayout::addFromOutOfDrawAreaList()
{
- if (children.size() != 0) {
+ if (!children.empty()) {
for (auto it : outOfDrawAreaItems) {
it->setVisible(true);
it->setFocusItem(nullptr);
@@ 212,8 215,9 @@ namespace gui
for (auto &el : children) {
- if (!el->visible)
+ if (!el->visible) {
continue;
+ }
auto axisItemPosition = 0;
auto orthogonalItemPosition = 0;
@@ 237,8 241,9 @@ namespace gui
orthogonalItemPosition = calculateElemOrtAxisPosition<axis>(el, orthogonalItemSize);
// 6. If element still visible (not added to outOfDrawAreaList) set it Area with calculated values.
- if (el->visible)
+ if (el->visible) {
el->setAreaInAxis(axis, axisItemPosition, orthogonalItemPosition, axisItemSize, orthogonalItemSize);
+ }
}
Rect::updateDrawArea();
@@ 293,14 298,14 @@ namespace gui
Length BoxLayout::calculateElemOrtAxisSize(Item *el)
{
// Get maximum size that element in orthogonal axis can occupy in current layout size.
- Length maxOrthogonalItemInParentSize =
+ const Length maxOrthogonalItemInParentSize =
static_cast<Position>(this->area(Area::Normal).size(orthogonal(axis))) <=
el->getMargins().getSumInAxis(orthogonal(axis))
? 0
: this->area(Area::Normal).size(orthogonal(axis)) - el->getMargins().getSumInAxis(orthogonal(axis));
// Get maximum size of element in orthogonal axis based on its min-max.
- Length maxOrthogonalItemSize =
+ const Length maxOrthogonalItemSize =
el->area(Area::Max).size(orthogonal(axis)) > el->area(Area::Min).size(orthogonal(axis))
? el->area(Area::Max).size(orthogonal(axis))
: el->area(Area::Min).size(orthogonal(axis));
@@ 318,7 323,7 @@ namespace gui
auto axisItemPosition = 0;
// Check if elements in axis can fit with margins in layout free space.
- if (((Position)(axisItemSize + el->getMargins().getSumInAxis(axis))) <= leftPosition) {
+ if (static_cast<Position>(axisItemSize + el->getMargins().getSumInAxis(axis)) <= leftPosition) {
if (reverseOrder) {
startingPosition -= el->getMargins().getMarginInAxis(axis, MarginInAxis::Second);
@@ 464,8 469,8 @@ namespace gui
{
if (parent != nullptr) {
auto [w, h] = requestSize(request_w, request_h);
- request_w = std::min(w, (Length)request_w);
- request_h = std::min(h, (Length)request_h);
+ request_w = std::min(w, static_cast<Length>(request_w));
+ request_h = std::min(h, static_cast<Length>(request_h));
}
auto el = std::find(children.begin(), children.end(), child);
M module-gui/gui/widgets/Item.cpp => module-gui/gui/widgets/Item.cpp +24 -14
@@ 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 "Item.hpp"
@@ 47,11 47,13 @@ namespace gui
Item::~Item()
{
- for (auto &widget : children)
+ for (auto &widget : children) {
delete widget;
+ }
- if (navigationDirections)
+ if (navigationDirections) {
delete navigationDirections;
+ }
}
bool Item::erase(Item *item)
@@ 72,8 74,9 @@ namespace gui
void Item::addWidget(Item *item)
{
- if (item == nullptr)
+ if (item == nullptr) {
return;
+ }
if (item->parent) {
item->parent->removeWidget(item);
}
@@ 85,8 88,9 @@ namespace gui
bool Item::removeWidget(Item *item)
{
- if (item == nullptr)
+ if (item == nullptr) {
return false;
+ }
if (item == focusItem) {
focusItem = nullptr;
}
@@ 358,11 362,13 @@ namespace gui
{
auto tempAlignment = getAlignment(axis);
- if (parent->getAlignment(axis).vertical != Alignment::Vertical::None)
+ if (parent->getAlignment(axis).vertical != Alignment::Vertical::None) {
tempAlignment.vertical = parent->getAlignment(axis).vertical;
+ }
- if (parent->getAlignment(axis).horizontal != Alignment::Horizontal::None)
+ if (parent->getAlignment(axis).horizontal != Alignment::Horizontal::None) {
tempAlignment.horizontal = parent->getAlignment(axis).horizontal;
+ }
switch (tempAlignment.vertical) {
case gui::Alignment::Vertical::Top:
@@ 414,7 420,7 @@ namespace gui
result.x += parentItem->widgetArea.x;
result.y += parentItem->widgetArea.y;
BoundingBox newResult;
- if (BoundingBox::intersect(parentItem->widgetArea, result, newResult) == false) {
+ if (!BoundingBox::intersect(parentItem->widgetArea, result, newResult)) {
result.clear();
break;
}
@@ 425,8 431,9 @@ namespace gui
drawArea = result;
- for (gui::Item *it : children)
+ for (const auto &it : children) {
it->updateDrawArea();
+ }
}
Item *Item::getNavigationItem(NavigationDirection direction)
@@ 439,8 446,9 @@ namespace gui
void Item::setNavigationItem(gui::NavigationDirection direction, Item *item)
{
- if (navigationDirections == nullptr)
+ if (navigationDirections == nullptr) {
navigationDirections = new Navigation();
+ }
navigationDirections->setDirectionItem(direction, item);
}
@@ 475,8 483,9 @@ namespace gui
if (state != focus) {
focus = state;
onFocus(state);
- if (focusChangedCallback)
+ if (focusChangedCallback) {
focusChangedCallback(*this);
+ }
};
return state;
}
@@ 502,15 511,16 @@ namespace gui
return nullptr;
}
- bool Item::onFocus(bool state)
+ bool Item::onFocus([[maybe_unused]] bool state)
{
return true;
}
- bool Item::onActivated(void *data)
+ bool Item::onActivated([[maybe_unused]] void *data)
{
- if (activatedCallback)
+ if (activatedCallback) {
return activatedCallback(*this);
+ }
return false;
}
M pure_changelog.md => pure_changelog.md +3 -2
@@ 45,9 45,10 @@
* Fixed broken French translation on 'Configure passcode' screen in Onboarding
* Fixed time disappearing in SMS thread
* Fixed scrollbar behavior in call log view
-* Fixed contacts imported from SIM do not show up in Mudita Center
+* Fixed contacts imported from SIM not showing up in Mudita Center
* Fixed broken events counter on main screen for more than 99 events
-* Fixed for incorrect signal strength displayed in Center
+* Fixed incorrect signal strength displayed in Center
+* Fixed inability to enter text in search field after clicking right arrow
### Added