From 2f0f563591bbedce3e7220dd451012a176e4e381 Mon Sep 17 00:00:00 2001 From: pawpMudita Date: Thu, 8 Oct 2020 16:43:04 +0200 Subject: [PATCH] [EGD-4018] Messages window for apps and tools --- changelog.md | 2 + image/assets/lang/lang_en.json | 2 + .../ApplicationSettings.cpp | 4 + .../ApplicationSettings.hpp | 1 + .../application-settings-new/CMakeLists.txt | 2 + .../windows/AppsAndToolsWindow.cpp | 4 +- .../windows/MessagesWindow.cpp | 85 +++++++++++++++++++ .../windows/MessagesWindow.hpp | 19 +++++ 8 files changed, 117 insertions(+), 2 deletions(-) create mode 100644 module-apps/application-settings-new/windows/MessagesWindow.cpp create mode 100644 module-apps/application-settings-new/windows/MessagesWindow.hpp diff --git a/changelog.md b/changelog.md index d3eae550f57a73b6fe97548f102bac3fe09fbdd5..634bf8c2a65c76a6f7e58f1d02e87913e7231f6d 100644 --- a/changelog.md +++ b/changelog.md @@ -8,6 +8,8 @@ * `[audio]` Added A2DP playback backend * `[audio]` Added SendEvent audio API * `[calculator]` Add calculator application. +* `[settings]` Create Messages window for apps and tools branch. + ### Fixed diff --git a/image/assets/lang/lang_en.json b/image/assets/lang/lang_en.json index d4f39730f2bebdee4abce7bab7be97872c130f27..a101728d99bcc58dba79f167a8574394539d7825 100644 --- a/image/assets/lang/lang_en.json +++ b/image/assets/lang/lang_en.json @@ -241,6 +241,8 @@ "app_settings_system" : "System", "app_settings_apps_tools" : "Apps and tools", "app_settings_apps_messages" : "Messages", + "app_settings_show_unread_first" : "Show unread first", + "app_settings_Templates" : "Templates", "app_settings_apps_torch" : "Torch", "app_settings_date_and_time": "Date and Time", "app_settings_title_day": "Day", diff --git a/module-apps/application-settings-new/ApplicationSettings.cpp b/module-apps/application-settings-new/ApplicationSettings.cpp index 794cf2325b66cb28d692064cef817a7004527e07..7ca930cc3c3e046921e3d119f5a8eead0b688ebc 100644 --- a/module-apps/application-settings-new/ApplicationSettings.cpp +++ b/module-apps/application-settings-new/ApplicationSettings.cpp @@ -11,6 +11,7 @@ #include "windows/KeypadLightWindow.hpp" #include "windows/AppsAndToolsWindow.hpp" #include "windows/NetworkWindow.hpp" +#include "windows/MessagesWindow.hpp" #include "ApplicationSettings.hpp" @@ -91,6 +92,9 @@ namespace app windowsFactory.attach(gui::window::name::network, [](Application *app, const std::string &name) { return std::make_unique(app); }); + windowsFactory.attach(gui::window::name::messages, [](Application *app, const std::string &name) { + return std::make_unique(app); + }); } void ApplicationSettingsNew::destroyUserInterface() diff --git a/module-apps/application-settings-new/ApplicationSettings.hpp b/module-apps/application-settings-new/ApplicationSettings.hpp index f4605c498f0394e478f3f8b6c66e21e174f0c821..94eaddb48b58f4ded691121506063558ddac35dc 100644 --- a/module-apps/application-settings-new/ApplicationSettings.hpp +++ b/module-apps/application-settings-new/ApplicationSettings.hpp @@ -25,6 +25,7 @@ namespace gui::window::name inline const std::string messages = "Messages"; inline const std::string torch = "Torch"; + inline const std::string templates = "Templates"; inline const std::string display_and_keypad = "DisplayAndKeypad"; diff --git a/module-apps/application-settings-new/CMakeLists.txt b/module-apps/application-settings-new/CMakeLists.txt index 1d72d044d870faf889109772a38deabcb143df28..c8a5a8cd7a482cab00fe9b4b8b7031a1c7608079 100644 --- a/module-apps/application-settings-new/CMakeLists.txt +++ b/module-apps/application-settings-new/CMakeLists.txt @@ -26,6 +26,7 @@ target_sources( ${PROJECT_NAME} windows/DisplayAndKeypadWindow.cpp windows/AppsAndToolsWindow.cpp windows/NetworkWindow.cpp + windows/MessagesWindow.cpp PUBLIC ApplicationSettings.hpp @@ -38,6 +39,7 @@ target_sources( ${PROJECT_NAME} windows/LockedScreenWindow.hpp windows/DisplayAndKeypadWindow.hpp windows/AppsAndToolsWindow.hpp + windows/MessagesWindow.hpp ) add_dependencies(${PROJECT_NAME} version) diff --git a/module-apps/application-settings-new/windows/AppsAndToolsWindow.cpp b/module-apps/application-settings-new/windows/AppsAndToolsWindow.cpp index a8f3a865787b3364c1a3d4f68ca97060f9238c73..8970901a82b6e24150050f1e8a46a4ca0fec7fbd 100644 --- a/module-apps/application-settings-new/windows/AppsAndToolsWindow.cpp +++ b/module-apps/application-settings-new/windows/AppsAndToolsWindow.cpp @@ -17,10 +17,10 @@ namespace gui std::list optionList; auto i18 = [](std::string text) { return utils::localize.get(text); }; - auto addMenu = [&](UTF8 name, std::string window = "") { + auto addMenu = [&](UTF8 name, std::string window) { optionList.emplace_back(gui::Option{name, [=](gui::Item &item) { - if (window == "") { + if (window.empty()) { return false; } LOG_INFO("switching to %s page", window.c_str()); diff --git a/module-apps/application-settings-new/windows/MessagesWindow.cpp b/module-apps/application-settings-new/windows/MessagesWindow.cpp new file mode 100644 index 0000000000000000000000000000000000000000..9c5fcb5082db4ae5aa253c0a01439c34d2dd655c --- /dev/null +++ b/module-apps/application-settings-new/windows/MessagesWindow.cpp @@ -0,0 +1,85 @@ +#include "MessagesWindow.hpp" + +#include +#include +#include +#include + +namespace gui +{ + MessagesWindow::MessagesWindow(app::Application *app) : OptionWindow(app, gui::window::name::messages) + { + addOptions(messagesOptList()); + setTitle(utils::localize.get("app_settings_apps_messages")); + } + + std::list