M changelog.md => changelog.md +10 -0
@@ 1,5 1,15 @@
# MuditaOS changelog
+## Current release
+
+### Added
+* `[settings][bluetooth]` Add "Phone name" window.
+
+
+### Fixed
+
+### Other
+
## [0.43.1 2020-10-23]
### Added
M image/assets/lang/lang_en.json => image/assets/lang/lang_en.json +1 -0
@@ 236,6 236,7 @@
"app_settings_bluetooth_all_devices_indent" : " All devices",
"app_settings_bluetooth_searching_devices" : "Searching devices... \nIt may take a moment.",
"app_settings_bluetooth_main" : "Bluetooth",
+ "app_settings_bluetooth_phone_name" : "Phone name",
"app_settings_bluetooth_phone_name_indent" : " Phone name",
"app_settings_bluetooth_phone_visibility" : "Phone visibility",
"app_settings_net" : "Network",
M module-apps/CMakeLists.txt => module-apps/CMakeLists.txt +1 -1
@@ 22,7 22,7 @@ set( SOURCES
"windows/OptionsWindowOption.cpp"
"windows/Dialog.cpp"
"windows/NoEvents.cpp"
- "widgets/SearchBox.cpp"
+ "widgets/InputBox.cpp"
"windows/OptionSetting.cpp"
)
M module-apps/application-messages/windows/SearchStart.cpp => module-apps/application-messages/windows/SearchStart.cpp +2 -2
@@ 4,7 4,7 @@
#include "SearchStart.hpp"
#include "../ApplicationMessages.hpp"
#include <i18/i18.hpp>
-#include <widgets/SearchBox.hpp>
+#include <widgets/InputBox.hpp>
#include <cassert>
namespace gui
@@ 21,7 21,7 @@ namespace gui
body = new gui::Item();
body->setBoundingBox(bodySize());
addWidget(body);
- auto text = searchBox(this, utils::localize.get("common_search_uc"), "search");
+ auto text = inputBox(this, utils::localize.get("common_search_uc"), "search");
inputCallback = [=](Item &, const InputEvent &inputEvent) -> bool {
auto app = dynamic_cast<app::ApplicationMessages *>(application);
M module-apps/application-phonebook/windows/PhonebookSearch.cpp => module-apps/application-phonebook/windows/PhonebookSearch.cpp +2 -2
@@ 3,7 3,7 @@
#include "PhonebookSearch.hpp"
#include "application-phonebook/ApplicationPhonebook.hpp"
-#include "widgets/SearchBox.hpp"
+#include "widgets/InputBox.hpp"
#include <Utils.hpp>
@@ 21,7 21,7 @@ namespace gui
setTitle(utils::localize.get("app_phonebook_title_main"));
- inputField = searchBox(this, utils::localize.get("common_search_uc"), "search");
+ inputField = inputBox(this, utils::localize.get("common_search_uc"), "search");
bottomBar->setActive(BottomBar::Side::LEFT, false);
bottomBar->setActive(BottomBar::Side::CENTER, true);
bottomBar->setActive(BottomBar::Side::RIGHT, true);
M module-apps/application-settings-new/ApplicationSettings.cpp => module-apps/application-settings-new/ApplicationSettings.cpp +4 -0
@@ 16,6 16,7 @@
#include "windows/AppsAndToolsWindow.hpp"
#include "windows/NetworkWindow.hpp"
#include "windows/MessagesWindow.hpp"
+#include "windows/PhoneNameWindow.hpp"
#include "Dialog.hpp"
@@ 115,6 116,9 @@ namespace app
windowsFactory.attach(gui::window::name::messages, [](Application *app, const std::string &name) {
return std::make_unique<gui::MessagesWindow>(app);
});
+ windowsFactory.attach(gui::window::name::phone_name, [](Application *app, const std::string &name) {
+ return std::make_unique<gui::PhoneNameWindow>(app);
+ });
}
void ApplicationSettingsNew::destroyUserInterface()
M module-apps/application-settings-new/CMakeLists.txt => module-apps/application-settings-new/CMakeLists.txt +1 -0
@@ 29,6 29,7 @@ target_sources( ${PROJECT_NAME}
windows/AppsAndToolsWindow.cpp
windows/NetworkWindow.cpp
windows/MessagesWindow.cpp
+ windows/PhoneNameWindow.cpp
widgets/UpDown.cpp
widgets/Toggle.cpp
M module-apps/application-settings-new/windows/BluetoothWindow.cpp => module-apps/application-settings-new/windows/BluetoothWindow.cpp +4 -1
@@ 13,7 13,10 @@ namespace gui
{
BluetoothWindow::BluetoothWindow(app::Application *app) : OptionWindow(app, gui::window::name::bluetooth)
- {}
+ {
+ topBar->setActive(TopBar::Elements::BATTERY, false);
+ topBar->setActive(TopBar::Elements::SIM, false);
+ }
void BluetoothWindow::onBeforeShow(ShowMode mode, SwitchData *data)
{
M module-apps/application-settings-new/windows/NetworkWindow.cpp => module-apps/application-settings-new/windows/NetworkWindow.cpp +10 -13
@@ 2,11 2,11 @@
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#include "NetworkWindow.hpp"
+#include "application-settings-new/ApplicationSettings.hpp"
-#include <i18/i18.hpp>
-#include "OptionsStyle.hpp"
#include "OptionSetting.hpp"
-#include <application-settings-new/ApplicationSettings.hpp>
+
+#include <i18/i18.hpp>
namespace gui
{
@@ 33,16 33,13 @@ namespace gui
return true;
},
[=](gui::Item &item) {
- auto nlb = dynamic_cast<gui::Label *>(&item);
- if (nullptr != nlb) {
- if (item.focus) {
- this->setBottomBarText(utils::localize.get(style::strings::common::Switch),
- BottomBar::Side::CENTER);
- }
- else {
- this->setBottomBarText(utils::localize.get(style::strings::common::select),
- BottomBar::Side::CENTER);
- }
+ if (item.focus) {
+ this->setBottomBarText(utils::localize.get(style::strings::common::Switch),
+ BottomBar::Side::CENTER);
+ }
+ else {
+ this->setBottomBarText(utils::localize.get(style::strings::common::select),
+ BottomBar::Side::CENTER);
}
return true;
},
A module-apps/application-settings-new/windows/PhoneNameWindow.cpp => module-apps/application-settings-new/windows/PhoneNameWindow.cpp +41 -0
@@ 0,0 1,41 @@
+// Copyright (c) 2017-2020, Mudita Sp. z.o.o. All rights reserved.
+// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
+
+#include "PhoneNameWindow.hpp"
+#include "application-settings-new/ApplicationSettings.hpp"
+#include "widgets/InputBox.hpp"
+
+#include <Utils.hpp>
+
+namespace gui
+{
+ PhoneNameWindow::PhoneNameWindow(app::Application *app) : AppWindow(app, gui::window::name::phone_name)
+ {
+ buildInterface();
+ }
+
+ void PhoneNameWindow::buildInterface()
+ {
+ AppWindow::buildInterface();
+ topBar->setActive(TopBar::Elements::SIM, false);
+ topBar->setActive(TopBar::Elements::TIME, true);
+
+ setTitle(utils::localize.get("app_settings_bluetooth_phone_name"));
+
+ inputField = inputBox(this, utils::localize.get("app_settings_bluetooth_phone_name"));
+ bottomBar->setActive(BottomBar::Side::LEFT, false);
+ bottomBar->setActive(BottomBar::Side::CENTER, true);
+ bottomBar->setActive(BottomBar::Side::RIGHT, true);
+
+ bottomBar->setText(BottomBar::Side::CENTER, utils::localize.get(style::strings::common::save));
+ bottomBar->setText(BottomBar::Side::RIGHT, utils::localize.get(style::strings::common::back));
+
+ setFocusItem(inputField);
+ }
+
+ void PhoneNameWindow::onBeforeShow(ShowMode mode, SwitchData *data)
+ {
+ inputField->clear();
+ setFocusItem(inputField);
+ }
+} // namespace gui
A module-apps/application-settings-new/windows/PhoneNameWindow.hpp => module-apps/application-settings-new/windows/PhoneNameWindow.hpp +23 -0
@@ 0,0 1,23 @@
+// Copyright (c) 2017-2020, Mudita Sp. z.o.o. All rights reserved.
+// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
+
+#pragma once
+
+#include "AppWindow.hpp"
+
+#include <Text.hpp>
+
+namespace gui
+{
+ class PhoneNameWindow : public AppWindow
+ {
+ public:
+ PhoneNameWindow(app::Application *app);
+ void buildInterface() override;
+ void onBeforeShow(ShowMode mode, SwitchData *data) override;
+
+ private:
+ Text *inputField = nullptr;
+ };
+
+} /* namespace gui */
R module-apps/widgets/SearchBox.cpp => module-apps/widgets/InputBox.cpp +15 -13
@@ 1,9 1,9 @@
// Copyright (c) 2017-2020, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
-#include "SearchBox.hpp"
+#include "InputBox.hpp"
+
#include <BoxLayout.hpp>
-#include "i18/i18.hpp"
#include <Image.hpp>
namespace gui
@@ 11,13 11,13 @@ namespace gui
constexpr uint32_t default_x = style::window::default_left_margin;
constexpr uint32_t default_w =
style::window_width - style::window::default_left_margin - style::window::default_right_margin;
- namespace searchHeader
+ namespace inputHeader
{
constexpr uint32_t x = style::window::default_left_margin;
constexpr uint32_t y = 127;
- constexpr uint32_t w = 86;
+ constexpr uint32_t w = default_w;
constexpr uint32_t h = 20;
- } // namespace searchHeader
+ } // namespace inputHeader
namespace horizontalBox
{
@@ 46,7 46,7 @@ namespace gui
namespace gui
{
- gui::Text *searchBox(gui::Item *parent, const std::string &header, const std::string &icon)
+ auto inputBox(gui::Item *parent, const std::string &header, const std::string &icon) -> gui::Text *
{
auto inputField = new Text(nullptr,
horizontalBox::inputField::x,
@@ 61,19 61,21 @@ namespace gui
auto horizontalBox = new HBox(parent, horizontalBox::x, horizontalBox::y, horizontalBox::w, horizontalBox::h);
horizontalBox->addWidget(inputField);
- horizontalBox->addWidget(new Image(nullptr,
- horizontalBox::searchTop::x,
- horizontalBox::searchTop::y,
- horizontalBox::searchTop::w,
- horizontalBox::searchTop::h,
- icon));
+ if (!icon.empty()) {
+ horizontalBox->addWidget(new Image(nullptr,
+ horizontalBox::searchTop::x,
+ horizontalBox::searchTop::y,
+ horizontalBox::searchTop::w,
+ horizontalBox::searchTop::h,
+ icon));
+ }
horizontalBox->setPenWidth(horizontalBox::penWidth);
horizontalBox->setEdges(RectangleEdge::Bottom);
const RectangleEdge edges = RectangleEdge::None;
const Alignment alignment = Alignment(gui::Alignment::Horizontal::Left, gui::Alignment::Vertical::Bottom);
- auto l = new Label(parent, searchHeader::x, searchHeader::y, searchHeader::w, searchHeader::h);
+ auto l = new Label(parent, inputHeader::x, inputHeader::y, inputHeader::w, inputHeader::h);
l->setFont(style::window::font::small);
l->setEdges(edges);
R module-apps/widgets/SearchBox.hpp => module-apps/widgets/InputBox.hpp +1 -1
@@ 7,5 7,5 @@
namespace gui
{
- gui::Text *searchBox(gui::Item *parent, const std::string &header, const std::string &icon);
+ auto inputBox(gui::Item *parent, const std::string &header, const std::string &icon = std::string()) -> gui::Text *;
}; // namespace gui