Skip to content

Commit 141390e

Browse files
[EGD-2629] Add Phone name window (#887)
[EGD-2629] Update changelog and minor fixes
1 parent cf62c87 commit 141390e

File tree

13 files changed

+115
-33
lines changed

13 files changed

+115
-33
lines changed

changelog.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# MuditaOS changelog
22

3+
## Current release
4+
5+
### Added
6+
* `[settings][bluetooth]` Add "Phone name" window.
7+
8+
9+
### Fixed
10+
11+
### Other
12+
313
## [0.43.1 2020-10-23]
414

515
### Added

image/assets/lang/lang_en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@
236236
"app_settings_bluetooth_all_devices_indent" : " All devices",
237237
"app_settings_bluetooth_searching_devices" : "Searching devices... \nIt may take a moment.",
238238
"app_settings_bluetooth_main" : "Bluetooth",
239+
"app_settings_bluetooth_phone_name" : "Phone name",
239240
"app_settings_bluetooth_phone_name_indent" : " Phone name",
240241
"app_settings_bluetooth_phone_visibility" : "Phone visibility",
241242
"app_settings_net" : "Network",

module-apps/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ set( SOURCES
2222
"windows/OptionsWindowOption.cpp"
2323
"windows/Dialog.cpp"
2424
"windows/NoEvents.cpp"
25-
"widgets/SearchBox.cpp"
25+
"widgets/InputBox.cpp"
2626
"windows/OptionSetting.cpp"
2727
)
2828

module-apps/application-messages/windows/SearchStart.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include "SearchStart.hpp"
55
#include "../ApplicationMessages.hpp"
66
#include <i18/i18.hpp>
7-
#include <widgets/SearchBox.hpp>
7+
#include <widgets/InputBox.hpp>
88
#include <cassert>
99

1010
namespace gui
@@ -21,7 +21,7 @@ namespace gui
2121
body = new gui::Item();
2222
body->setBoundingBox(bodySize());
2323
addWidget(body);
24-
auto text = searchBox(this, utils::localize.get("common_search_uc"), "search");
24+
auto text = inputBox(this, utils::localize.get("common_search_uc"), "search");
2525

2626
inputCallback = [=](Item &, const InputEvent &inputEvent) -> bool {
2727
auto app = dynamic_cast<app::ApplicationMessages *>(application);

module-apps/application-phonebook/windows/PhonebookSearch.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
#include "PhonebookSearch.hpp"
55
#include "application-phonebook/ApplicationPhonebook.hpp"
6-
#include "widgets/SearchBox.hpp"
6+
#include "widgets/InputBox.hpp"
77

88
#include <Utils.hpp>
99

@@ -21,7 +21,7 @@ namespace gui
2121

2222
setTitle(utils::localize.get("app_phonebook_title_main"));
2323

24-
inputField = searchBox(this, utils::localize.get("common_search_uc"), "search");
24+
inputField = inputBox(this, utils::localize.get("common_search_uc"), "search");
2525
bottomBar->setActive(BottomBar::Side::LEFT, false);
2626
bottomBar->setActive(BottomBar::Side::CENTER, true);
2727
bottomBar->setActive(BottomBar::Side::RIGHT, true);

module-apps/application-settings-new/ApplicationSettings.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include "windows/AppsAndToolsWindow.hpp"
1717
#include "windows/NetworkWindow.hpp"
1818
#include "windows/MessagesWindow.hpp"
19+
#include "windows/PhoneNameWindow.hpp"
1920

2021
#include "Dialog.hpp"
2122

@@ -115,6 +116,9 @@ namespace app
115116
windowsFactory.attach(gui::window::name::messages, [](Application *app, const std::string &name) {
116117
return std::make_unique<gui::MessagesWindow>(app);
117118
});
119+
windowsFactory.attach(gui::window::name::phone_name, [](Application *app, const std::string &name) {
120+
return std::make_unique<gui::PhoneNameWindow>(app);
121+
});
118122
}
119123

120124
void ApplicationSettingsNew::destroyUserInterface()

module-apps/application-settings-new/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ target_sources( ${PROJECT_NAME}
2929
windows/AppsAndToolsWindow.cpp
3030
windows/NetworkWindow.cpp
3131
windows/MessagesWindow.cpp
32+
windows/PhoneNameWindow.cpp
3233
widgets/UpDown.cpp
3334
widgets/Toggle.cpp
3435

module-apps/application-settings-new/windows/BluetoothWindow.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ namespace gui
1313
{
1414

1515
BluetoothWindow::BluetoothWindow(app::Application *app) : OptionWindow(app, gui::window::name::bluetooth)
16-
{}
16+
{
17+
topBar->setActive(TopBar::Elements::BATTERY, false);
18+
topBar->setActive(TopBar::Elements::SIM, false);
19+
}
1720

1821
void BluetoothWindow::onBeforeShow(ShowMode mode, SwitchData *data)
1922
{

module-apps/application-settings-new/windows/NetworkWindow.cpp

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
33

44
#include "NetworkWindow.hpp"
5+
#include "application-settings-new/ApplicationSettings.hpp"
56

6-
#include <i18/i18.hpp>
7-
#include "OptionsStyle.hpp"
87
#include "OptionSetting.hpp"
9-
#include <application-settings-new/ApplicationSettings.hpp>
8+
9+
#include <i18/i18.hpp>
1010

1111
namespace gui
1212
{
@@ -33,16 +33,13 @@ namespace gui
3333
return true;
3434
},
3535
[=](gui::Item &item) {
36-
auto nlb = dynamic_cast<gui::Label *>(&item);
37-
if (nullptr != nlb) {
38-
if (item.focus) {
39-
this->setBottomBarText(utils::localize.get(style::strings::common::Switch),
40-
BottomBar::Side::CENTER);
41-
}
42-
else {
43-
this->setBottomBarText(utils::localize.get(style::strings::common::select),
44-
BottomBar::Side::CENTER);
45-
}
36+
if (item.focus) {
37+
this->setBottomBarText(utils::localize.get(style::strings::common::Switch),
38+
BottomBar::Side::CENTER);
39+
}
40+
else {
41+
this->setBottomBarText(utils::localize.get(style::strings::common::select),
42+
BottomBar::Side::CENTER);
4643
}
4744
return true;
4845
},
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// Copyright (c) 2017-2020, Mudita Sp. z.o.o. All rights reserved.
2+
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
3+
4+
#include "PhoneNameWindow.hpp"
5+
#include "application-settings-new/ApplicationSettings.hpp"
6+
#include "widgets/InputBox.hpp"
7+
8+
#include <Utils.hpp>
9+
10+
namespace gui
11+
{
12+
PhoneNameWindow::PhoneNameWindow(app::Application *app) : AppWindow(app, gui::window::name::phone_name)
13+
{
14+
buildInterface();
15+
}
16+
17+
void PhoneNameWindow::buildInterface()
18+
{
19+
AppWindow::buildInterface();
20+
topBar->setActive(TopBar::Elements::SIM, false);
21+
topBar->setActive(TopBar::Elements::TIME, true);
22+
23+
setTitle(utils::localize.get("app_settings_bluetooth_phone_name"));
24+
25+
inputField = inputBox(this, utils::localize.get("app_settings_bluetooth_phone_name"));
26+
bottomBar->setActive(BottomBar::Side::LEFT, false);
27+
bottomBar->setActive(BottomBar::Side::CENTER, true);
28+
bottomBar->setActive(BottomBar::Side::RIGHT, true);
29+
30+
bottomBar->setText(BottomBar::Side::CENTER, utils::localize.get(style::strings::common::save));
31+
bottomBar->setText(BottomBar::Side::RIGHT, utils::localize.get(style::strings::common::back));
32+
33+
setFocusItem(inputField);
34+
}
35+
36+
void PhoneNameWindow::onBeforeShow(ShowMode mode, SwitchData *data)
37+
{
38+
inputField->clear();
39+
setFocusItem(inputField);
40+
}
41+
} // namespace gui

0 commit comments

Comments
 (0)