~aleteoryx/muditaos

dc96b90fad36ba5da9ed33831ca28718d5e6920b — DariuszSabala 4 years ago bf9b3ea
[BH-495] Created Bell Hybrid home screen

Cleaned up PurePhone remainings, modified UI to comply with
documentation, cleaned up include paths to comply Mudita guide
M image/assets/lang/English.json => image/assets/lang/English.json +0 -1
@@ 576,7 576,6 @@
  "app_bellmain_meditation_timer": "Meditation timer",
  "app_bellmain_media_library": "Media Library",
  "app_bellmain_settings": "Settings",
  "app_bellmain_main_window_title": "Bell Hybrid+",
  "tethering": "Tethering",
  "tethering_turn_off_question": "Turn tethering off?",
  "tethering_enable_question": "<text>You're connected to the computer.<br />Turn tethering on?<br /><text color='9'>(some functions may be disabled)</text></text>",

M module-apps/application-bell-main/ApplicationBellMain.cpp => module-apps/application-bell-main/ApplicationBellMain.cpp +3 -3
@@ 1,9 1,9 @@
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include "ApplicationBellMain.hpp"
#include "windows/BellMainWindow.hpp"
#include "windows/BellMainMenuWindow.hpp"
#include <application-bell-main/ApplicationBellMain.hpp>
#include <windows/BellMainWindow.hpp>
#include <windows/BellMainMenuWindow.hpp>
#include <windows/Dialog.hpp>

namespace app

M module-apps/application-bell-main/data/BellMainStyle.hpp => module-apps/application-bell-main/data/BellMainStyle.hpp +23 -0
@@ 5,6 5,29 @@

namespace bellMainStyle
{
    namespace mainWindow
    {
        namespace timeLabel
        {
            inline constexpr auto posX   = 0;
            inline constexpr auto posY   = 200;
            inline constexpr auto width  = 480;
            inline constexpr auto height = 100;
            inline constexpr auto font   = "gt_pressura_light_90";
        } // namespace timeLabel

        namespace temperatureLabel
        {
            inline constexpr auto posX   = 0;
            inline constexpr auto posY   = 300;
            inline constexpr auto width  = 480;
            inline constexpr auto height = 50;
            inline constexpr auto font   = "gt_pressura_regular_30";
            inline constexpr auto degree = "\u00B0";
        } // namespace temperatureLabel

    } // namespace mainWindow

    namespace mainMenuWindow
    {
        inline constexpr gui::Length options_list_x     = 40;

M module-apps/application-bell-main/windows/BellMainMenuWindow.cpp => module-apps/application-bell-main/windows/BellMainMenuWindow.cpp +6 -4
@@ 2,12 2,14 @@
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include "BellMainMenuWindow.hpp"
#include <OptionBellMenu.hpp>
#include <service-appmgr/Controller.hpp>

#include <application-bell-main/ApplicationBellMain.hpp>
#include <windows/Dialog.hpp>
#include <data/BellMainStyle.hpp>

#include <Dialog.hpp>
#include <DialogMetadataMessage.hpp>
#include <application-bell-main/data/BellMainStyle.hpp>
#include <OptionBellMenu.hpp>
#include <service-appmgr/Controller.hpp>

namespace gui
{

M module-apps/application-bell-main/windows/BellMainWindow.cpp => module-apps/application-bell-main/windows/BellMainWindow.cpp +37 -5
@@ 2,11 2,15 @@
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include "BellMainWindow.hpp"

#include <application-bell-main/ApplicationBellMain.hpp>
#include <data/BellMainStyle.hpp>

#include <gui/input/InputEvent.hpp>
#include <i18n/i18n.hpp>
#include <log/log.hpp>
#include <service-appmgr/Controller.hpp>
#include <gui/input/InputEvent.hpp>
#include <application-bell-main/ApplicationBellMain.hpp>
#include <time/time_conversion.hpp>

namespace gui
{


@@ 19,9 23,26 @@ namespace gui
    {
        AppWindow::buildInterface();

        bottomBar->setActive(BottomBar::Side::CENTER, true);
        bottomBar->setText(gui::BottomBar::Side::CENTER, utils::translate(style::strings::common::start));
        setTitle(utils::translate("app_bellmain_main_window_title"));
        statusBar->setVisible(false);
        header->setTitleVisibility(false);
        bottomBar->setVisible(false);

        namespace timeLabel = bellMainStyle::mainWindow::timeLabel;
        time = new gui::Label(this, timeLabel::posX, timeLabel::posY, timeLabel::width, timeLabel::height);
        time->setFilled(false);
        time->setBorderColor(gui::ColorNoColor);
        time->setFont(timeLabel::font);
        time->setAlignment(Alignment(gui::Alignment::Horizontal::Center, gui::Alignment::Vertical::Center));

        namespace temperatureLabel = bellMainStyle::mainWindow::temperatureLabel;
        temperature                = new gui::Label(
            this, temperatureLabel::posX, temperatureLabel::posY, temperatureLabel::width, temperatureLabel::height);
        temperature->setFilled(false);
        temperature->setBorderColor(gui::ColorNoColor);
        temperature->setFont(temperatureLabel::font);
        temperature->setAlignment(Alignment(gui::Alignment::Horizontal::Center, gui::Alignment::Vertical::Center));
        std::string degree_sign(temperatureLabel::degree);
        temperature->setText("12 " + degree_sign + "C");
    }

    bool BellMainWindow::onInput(const InputEvent &inputEvent)


@@ 43,4 64,15 @@ namespace gui
        return AppWindow::onInput(inputEvent);
    }

    bool BellMainWindow::updateTime()
    {
        if (time != nullptr) {
            utils::time::Timestamp timestamp{std::time(nullptr)};
            time->setText(timestamp.str("%H:%M"));
            return true;
        }

        return false;
    }

} // namespace gui

M module-apps/application-bell-main/windows/BellMainWindow.hpp => module-apps/application-bell-main/windows/BellMainWindow.hpp +4 -0
@@ 14,5 14,9 @@ namespace gui

        void buildInterface() override;
        bool onInput(const InputEvent &inputEvent) override;
        bool updateTime() override;

        gui::Label *time        = nullptr;
        gui::Label *temperature = nullptr;
    };
} // namespace gui