~aleteoryx/muditaos

9269d9c72ea5d3d46bee4ddc87140e0e945849e7 — Lucjan Bryndza 5 years ago dca37de + 8618ea5
[EGD-5737] Merge master into experimental

Keep experimental up to date with changes from master
M .gitmessage => .gitmessage +1 -3
@@ 1,7 1,5 @@
# Commit subject: [JIRA-TICKET] <Add/Change/Fix> changes summary, don't end with a period
# Commit subject: [JIRA-TICKET] Changes summary, don't end with a period
# No more than 72 chars. ########################### 72 chars is here: #
<Title>
# Remember blank line between title and commit message.

# Commit message: Explain *what* and *why* (not *how*).
# Wrap at 72 chars. ################################### which is here: #

M doc/development_workflow.md => doc/development_workflow.md +9 -9
@@ 15,18 15,19 @@ Each commit that makes it from your branch or fork into the master branch must h
If you're part of the MuditaOS core development team, your commit's title *must* start with a Jira ticket number in square brackets e.g. `[EGD-5555]`. 

Commits from the community will be accompanied by a relevant Jira ticket number during the merge. Don't add commits that are out of the scope of the Jira issue you are working on.
You should have exactly one commit in a single PR.

Your commit's subject line should be a single sentence describing what you are changing using present simple tense and an imperative mood. Please follow these rules:

- It must start with one of the following verbs: "Add", "Change" or "Fix", depending on whether you are adding a new feature, changing its behavior, or fixing it. This sentence will be a part of the project changelog, so please ensure it will be clear to the non-technical readers. 
- It must start with a verb. This sentence will be a part of the project changelog, so please ensure it will be clear to the non-technical readers. 
- If you are adding a new feature start with "Add"; start with "Fix" if you are fixing one.
- Don't use proper names such as names of classes or functions. 
- Try to be as concise as possible in the limit of 72 characters (including the Jira ticket number - 11 characters). 
- Don't end the subject line with a period. 

Then, in the commit message, you must include a short description of what the commit is changing in the project. You should be clear about
your motivation to do the change and how it influences the project.

If it's impossible to provide any of the above information, then your commit is likely excessive or redundant and should be squashed with another commit.
Focus more on *why* than *how*.

An example of a correctly formatted commit:
```


@@ 50,13 51,12 @@ You can add a commit template and hook that will help with proper defining both 

Before submitting a Pull Request please go through some basic checks:

- test your changes on both Linux and RT1051 platforms (please pay special attention to the things you might break unintentionally, e.g. when working on calling funcionality, check call log too)
- [include changelog description](changelog_howto.md) (if applicable),
- test your changes on both Linux and RT1051 platforms (please pay special attention to the things you might break unintentionally, e.g. when working on calling, check call log too,
- run unit tests (`make check`),
- check if your code formatting complies with [`.clang-format`](../clang-format),
- whenever you add a third party software to MuditaOS source code, please make sure that the software component is added to a dedicated [section in `LICENSE.md` file on MuditaOS GitHub repository](../LICENSE.md) with a link to the text of the license where applicable.
- whenever you add third-party software to MuditaOS source code, please make sure that the software component is added to a dedicated [section in `LICENSE.md` file on MuditaOS GitHub repository](../LICENSE.md) with a link to the text of the license where applicable.

As a part of our continuous integration proccess we will be soon introducing our own [test harness](../test/README.md).
As a part of our continuous integration process we will be soon introducing our own [test harness](../test/README.md).

## Submit a Pull Request



@@ 78,7 78,7 @@ During a PR review, team members will ask you questions regarding your solution.

## PR review - act on feedback

Add changes to your PR that are requested by reviewers and push the feature branch once again. Update comments requesting changes with a simple `Done`. Don't resolve discussion on your own, it's the reviewer's responsibility to do so.
Add changes to your PR that are requested by reviewers and push the feature branch once again. Update comments requesting changes with a simple `Done`. Don't resolve a discussion on your own, it's the reviewer's responsibility to do so.

## Merge to `master` branch



@@ 110,7 110,7 @@ git rebase origin/master  # update branch you are at to origin/master

`Rebase` changes your commit history (moves them on top). This means two things:

 - when you did a lot of changes in a lot of places - either `git push` your branch on server, or make its copy
 - when you did a lot of changes in a lot of places - either `git push` your branch to the server, or make its copy
 - when you're happy of `git rebase` results - you'll need to push your branch with force to server - since you've changed its history (updated it) 

A minimal set of commands:

M doc/quickstart.md => doc/quickstart.md +3 -3
@@ 148,14 148,14 @@ To fix the style for Pull Request CI:

### Commit message template

To add commit message template use this command:
To add a commit message template use this command:

```bash
git config commit.template .gitmessage
```

This way each time you add new commit you will see template that will help
you with proper message format. More about that in (Development Workflow)[./doc/development_workflow.md#commit-changes]
This way each time you add a new commit you will see the template that will help
you with the proper message format. More about that in (Development Workflow)[./doc/development_workflow.md#commit-changes]

### Commit message hook
This hooks automatically converts your branch name to commit title

M host-tools/CMakeLists.txt => host-tools/CMakeLists.txt +11 -2
@@ 6,9 6,18 @@ if (CMAKE_CROSSCOMPILING)
        COMMAND ${CMAKE_COMMAND}
        -DCMAKE_BUILD_TYPE:STRING="Release"
        -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE:PATH="${CMAKE_BINARY_DIR}"
        -B"build"
        -B"lfsfuse"
        -H"${CMAKE_SOURCE_DIR}/host-tools/littlefs-fuse"
        COMMAND ${CMAKE_COMMAND} --build build --config Release
        COMMAND ${CMAKE_COMMAND} --build lfsfuse --config Release
    )
    add_custom_target(
        genlittlefs ALL
        COMMAND ${CMAKE_COMMAND}
        -DCMAKE_BUILD_TYPE:STRING="Release"
        -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE:PATH="${CMAKE_BINARY_DIR}"
        -B"genlittlefs"
        -H"${CMAKE_SOURCE_DIR}/host-tools/genlittlefs"
        COMMAND ${CMAKE_COMMAND} --build genlittlefs --config Release
    )
else()
    set(_genlittlefs "${CMAKE_BINARY_DIR}/genlittlefs${CMAKE_EXECUTABLE_SUFFIX}")

M host-tools/genlittlefs/CMakeLists.txt => host-tools/genlittlefs/CMakeLists.txt +7 -0
@@ 5,6 5,13 @@ set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake" ${CMAKE_MODULE_PATH})

find_package(BLKID REQUIRED)

# only add LittleFS subdirectory during a standalone config of genlittlefs
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
    add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../../module-vfs/thirdparty/lfsfs
        ${CMAKE_CURRENT_BINARY_DIR}/lfsfs EXCLUDE_FROM_ALL
    )
endif()

set(GENLITTLEFS_SRCS
    mklfs.c
    parse_partitions.c

M host-tools/genlittlefs/mklfs.c => host-tools/genlittlefs/mklfs.c +2 -2
@@ 187,7 187,7 @@ static int add_to_lfs(lfs_t *lfs, const char *dir, struct lfs_info_summary *summ
        tgt_dir[0] = '/';
        strcpy(tgt_dir + 1, sep_ptr + 1);
    }
    int err;
    int err = 0;
    if (is_dir) {
        err = create_dir_in_lfs(lfs, tgt_dir, verbose);
        if (err) {


@@ 246,7 246,7 @@ static void configure_lfs_params(struct lfs_config *lfsc, const struct littlefs_
int main(int argc, char **argv)
{

    int err;
    int err = 0;
    struct littlefs_opts lopts;
    struct lfs_config cfg;
    struct lfs_info_summary prog_summary;

M image/assets/lang/Deutsch.json => image/assets/lang/Deutsch.json +1 -0
@@ 38,6 38,7 @@
  "common_yesterday": "Yesterday",
  "common_today": "Today",
  "locale_12hour_min": "%I:%M %p",
  "locale_12hour_min_short": "%I:%M",
  "locale_24hour_min": "%H:%M",
  "locale_date_full": "%m/%d/%y",
  "locale_date_short": "%d/%m",

M image/assets/lang/English.json => image/assets/lang/English.json +4 -0
@@ 62,6 62,7 @@
  "common_search": "SEARCH",
  "common_empty_list": "Default Info: No elements on list.",
  "locale_12hour_min": "%I:%M %p",
  "locale_12hour_min_short": "%I:%M",
  "locale_24hour_min": "%H:%M",
  "locale_date_full": "%m/%d/%y",
  "locale_date_short": "%d/%m",


@@ 333,6 334,9 @@
  "app_settings_phone_modes": "Phone Modes",
  "app_settings_security": "Security",
  "app_settings_language": "Language",
  "app_settings_factory_reset": "Factory reset",
  "app_settings_about_your_pure": "About your Pure",
  "app_settings_certification": "Certification",
  "app_settings_about": "About Mudita Pure",
  "app_settings_title_languages": "Language Selection",
  "app_settings_language_english": "English",

M image/assets/lang/Espanol.json => image/assets/lang/Espanol.json +1 -0
@@ 38,6 38,7 @@
  "common_yesterday": "Yesterday",
  "common_today": "Today",
  "locale_12hour_min": "%I:%M %p",
  "locale_12hour_min_short": "%I:%M",
  "locale_24hour_min": "%H:%M",
  "locale_date_full": "%m/%d/%y",
  "locale_date_short": "%d/%m",

M image/assets/lang/Francais.json => image/assets/lang/Francais.json +1 -0
@@ 38,6 38,7 @@
  "common_yesterday": "Yesterday",
  "common_today": "Today",
  "locale_12hour_min": "%I:%M %p",
  "locale_12hour_min_short": "%I:%M",
  "locale_24hour_min": "%H:%M",
  "locale_date_full": "%m/%d/%y",
  "locale_date_short": "%d/%m",

M image/assets/lang/Polski.json => image/assets/lang/Polski.json +1 -0
@@ 38,6 38,7 @@
  "common_yesterday": "wczoraj",
  "common_today": "dzisiaj",
  "locale_12hour_min": "%I:%M",
  "locale_12hour_min_short": "%I:%M",
  "locale_24hour_min": "%H:%M",
  "locale_date_full": "%d.%m.%y",
  "locale_date_short": "%d.%m",

M module-apps/application-desktop/data/Style.hpp => module-apps/application-desktop/data/Style.hpp +2 -2
@@ 24,7 24,7 @@ namespace style::desktop
        constexpr auto X     = 0;
        constexpr auto Y     = 106;
        constexpr auto Width = style::window_width;
        constexpr auto Hight = 96;
        constexpr auto Height = 96;

    } // namespace timeLabel



@@ 33,7 33,7 @@ namespace style::desktop
        constexpr auto X     = 0;
        constexpr auto Y     = 204;
        constexpr auto Width = style::window_width;
        constexpr auto Hight = 51;
        constexpr auto Height = 51;

    } // namespace dayLabel


M module-apps/application-desktop/windows/DesktopMainWindow.cpp => module-apps/application-desktop/windows/DesktopMainWindow.cpp +2 -2
@@ 40,14 40,14 @@ namespace gui

        using namespace style::desktop;

        time = new gui::Label(this, timeLabel::X, timeLabel::Y, timeLabel::Width, timeLabel::Hight);
        time = new gui::Label(this, timeLabel::X, timeLabel::Y, timeLabel::Width, timeLabel::Height);
        time->setFilled(false);
        time->setBorderColor(gui::ColorNoColor);
        time->setFont(style::window::font::supersizemelight);
        time->setText(ttime);
        time->setAlignment(Alignment(gui::Alignment::Horizontal::Center, gui::Alignment::Vertical::Top));

        dayText = new gui::Label(this, dayLabel::X, dayLabel::Y, dayLabel::Width, dayLabel::Hight);
        dayText = new gui::Label(this, dayLabel::X, dayLabel::Y, dayLabel::Width, dayLabel::Height);
        dayText->setFilled(false);
        dayText->setBorderColor(gui::ColorNoColor);
        dayText->setFont(style::window::font::biglight);

M module-apps/application-settings-new/ApplicationSettings.cpp => module-apps/application-settings-new/ApplicationSettings.cpp +4 -0
@@ 27,6 27,7 @@
#include "windows/SecurityMainWindow.hpp"
#include "windows/QuotesOptionsWindow.hpp"
#include "windows/ChangePasscodeWindow.hpp"
#include "windows/SystemMainWindow.hpp"

#include "Dialog.hpp"



@@ 232,6 233,9 @@ namespace app
        windowsFactory.attach(gui::window::name::security, [](Application *app, const std::string &name) {
            return std::make_unique<gui::SecurityMainWindow>(app);
        });
        windowsFactory.attach(gui::window::name::system, [](Application *app, const std::string &name) {
            return std::make_unique<gui::SystemMainWindow>(app);
        });
    }

    void ApplicationSettingsNew::destroyUserInterface()

M module-apps/application-settings-new/ApplicationSettings.hpp => module-apps/application-settings-new/ApplicationSettings.hpp +6 -0
@@ 49,6 49,12 @@ namespace gui::window::name
    inline constexpr auto dialog_settings    = "DialogSettings";
    inline constexpr auto change_passcode    = "ChangePasscode";

    inline constexpr auto language        = "Language";
    inline constexpr auto date_and_time   = "DateAndTime";
    inline constexpr auto factory_reset   = "FactoryReset";
    inline constexpr auto about_your_pure = "AboutYourPure";
    inline constexpr auto certification   = "Certification";

} // namespace gui::window::name

namespace app

M module-apps/application-settings-new/CMakeLists.txt => module-apps/application-settings-new/CMakeLists.txt +2 -0
@@ 44,6 44,7 @@ target_sources( ${PROJECT_NAME}
        windows/ChangePasscodeWindow.cpp
        widgets/SpinBox.cpp
        widgets/SpinBoxOptionSetting.cpp
        windows/SystemMainWindow.cpp

    PUBLIC
        ApplicationSettings.hpp


@@ 60,6 61,7 @@ target_sources( ${PROJECT_NAME}
        widgets/SettingsStyle.hpp
        windows/AutolockWindow.hpp
        windows/WallpaperWindow.hpp
        windows/SystemMainWindow.hpp
)

add_dependencies(${PROJECT_NAME} version)

A module-apps/application-settings-new/windows/SystemMainWindow.cpp => module-apps/application-settings-new/windows/SystemMainWindow.cpp +37 -0
@@ 0,0 1,37 @@
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include "application-settings-new/ApplicationSettings.hpp"
#include "OptionSetting.hpp"
#include "SystemMainWindow.hpp"

namespace gui
{
    SystemMainWindow::SystemMainWindow(app::Application *app) : BaseSettingsWindow(app, window::name::system)
    {}

    auto SystemMainWindow::buildOptionsList() -> std::list<Option>
    {
        std::list<Option> optionList;
        auto addOption = [&](UTF8 name, const std::string &window) {
            optionList.emplace_back(std::make_unique<option::OptionSettings>(
                utils::translateI18(name),
                [=](Item &item) {
                    LOG_INFO("switching to %s page", window.c_str());
                    application->switchWindow(window, nullptr);
                    return true;
                },
                nullptr,
                nullptr,
                option::SettingRightItem::ArrowWhite));
        };

        addOption("app_settings_language", gui::window::name::language);
        addOption("app_settings_date_and_time", gui::window::name::date_and_time);
        addOption("app_settings_factory_reset", gui::window::name::factory_reset);
        addOption("app_settings_about_your_pure", gui::window::name::about_your_pure);
        addOption("app_settings_certification", gui::window::name::certification);

        return optionList;
    }
} // namespace gui

A module-apps/application-settings-new/windows/SystemMainWindow.hpp => module-apps/application-settings-new/windows/SystemMainWindow.hpp +18 -0
@@ 0,0 1,18 @@
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#pragma once

#include "BaseSettingsWindow.hpp"

namespace gui
{
    class SystemMainWindow : public BaseSettingsWindow
    {
      public:
        explicit SystemMainWindow(app::Application *app);

      private:
        auto buildOptionsList() -> std::list<Option> override;
    };
} // namespace gui

M module-utils/time/time_conversion.cpp => module-utils/time/time_conversion.cpp +1 -1
@@ 277,7 277,7 @@ namespace utils::time
        }
        else {
            return Timestamp::str(
                Locale::format(Locale::FormatTime12H)); // @TODO: M.G. FormatLocaleTime which actually works
                Locale::format(Locale::FormatTime12HShort)); // @TODO: M.G. FormatLocaleTime which actually works
        }
    }


M module-utils/time/time_locale.hpp => module-utils/time/time_locale.hpp +3 -1
@@ 21,7 21,7 @@ namespace utils
        {
            static const int num_days       = 7;
            static const int num_monts      = 12;
            static const int num_formatters = 4;
            static const int num_formatters = 5;
            // imo it would be nicer to have datetime locales in different json with thiny bit nicer and more effective
            // getters
            const std::array<std::string, num_days> daysShort = {


@@ 50,6 50,7 @@ namespace utils

            const std::array<std::string, num_formatters> time_formats{
                "locale_12hour_min",
                "locale_12hour_min_short",
                "locale_24hour_min",
                "locale_date_full",
                "locale_date_short",


@@ 90,6 91,7 @@ namespace utils
            enum TimeFormat
            {
                FormatTime12H = 0,     // H:M in 12h format
                FormatTime12HShort,    // H:M in 12h format, am/pm excluded
                FormatTime24H,         // H:M in 24h format
                FormatLocaleDateFull,  // format locale specified format
                FormatLocaleDateShort, // format locale specified format