~aleteoryx/muditaos

ref: 7597d388526c3f1d3c666964514db33bfcd6cf4d muditaos/module-apps/application-settings/windows/system/SARInfoWindow.cpp -rw-r--r-- 1.8 KiB
7597d388 — Przemyslaw Brudny [EGD-7857] Renamed BottomBar to NavBar 4 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include "SARInfoWindow.hpp"

#include <application-settings/windows/WindowNames.hpp>
#include <application-settings/widgets/SettingsStyle.hpp>

#include <i18n/i18n.hpp>

namespace gui
{
    SARInfoWindow::SARInfoWindow(app::ApplicationCommon *app,
                                 std::unique_ptr<SARInfoWindowContract::Presenter> &&windowPresenter)
        : gui::AppWindow(app, window::name::sar), presenter{std::move(windowPresenter)}
    {
        presenter->attach(this);
        buildInterface();
    }

    void SARInfoWindow::buildInterface()
    {
        AppWindow::buildInterface();

        setTitle(utils::translate("app_settings_sar"));

        namespace sarStyle = style::settings::window::sar;
        sarInfoText =
            new gui::Text(this, sarStyle::LeftMargin, sarStyle::TopMargin, sarStyle::Width, sarStyle::text::Height);
        sarInfoText->setEdges(gui::RectangleEdge::None);
        sarInfoText->setFont(::style::window::font::medium);
        sarInfoText->setAlignment(gui::Alignment{gui::Alignment::Vertical::Top});
        sarInfoText->setPenFocusWidth(::style::window::default_border_focus_w);
        sarInfoText->setPenWidth(::style::window::default_border_rect_no_focus);
        sarInfoText->setEditMode(gui::EditMode::Scroll);
        sarInfoText->setCursorStartPosition(gui::CursorStartPosition::DocumentBegin);

        navBar->setActive(gui::nav_bar::Side::Right, true);
        navBar->setText(gui::nav_bar::Side::Right, utils::translate(::style::strings::common::back));

        setFocusItem(sarInfoText);
    }

    void SARInfoWindow::onBeforeShow(gui::ShowMode /*mode*/, gui::SwitchData * /*data*/)
    {
        sarInfoText->setRichText(presenter->getSarInfo());
    }
} // namespace gui