~aleteoryx/muditaos

ref: 42ca53a732487f7dabf5e06ee4c03f73c329882b muditaos/module-apps/application-settings/widgets/system/TechnicalInformationItem.cpp -rw-r--r-- 1.5 KiB
42ca53a7 — Maciej-Mudita [MOS-686] Fix the accessibility of user files by MTP 3 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
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include "TechnicalInformationItem.hpp"

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

namespace gui
{
    TechnicalInformationItem::TechnicalInformationItem(const std::string &titleText, const std::string &valueText)
    {
        setMinimumSize(style::technical_info::width, style::technical_info::height);
        setMargins(Margins(0, style::margins::big, 0, style::margins::big));
        activeItem = false;

        body = new VBox(this, 0, 0, 0, 0);
        body->setEdges(RectangleEdge::None);

        title = new gui::Text(body, 0, 0, 0, 0);
        title->setMinimumSize(style::technical_info::width, style::technical_info::title_height);
        title->setFont(style::window::font::small);
        title->setAlignment(Alignment(gui::Alignment::Horizontal::Left, gui::Alignment::Vertical::Top));
        title->setText(titleText);

        value = new gui::Text(body, 0, 0, 0, 0);
        value->setMinimumSize(style::technical_info::width, style::technical_info::value_height);
        value->setAlignment(Alignment(gui::Alignment::Horizontal::Left, gui::Alignment::Vertical::Bottom));
        value->setFont(style::window::font::medium);
        value->setText(valueText);

        dimensionChangedCallback = [&]([[maybe_unused]] gui::Item &item, const BoundingBox &newDim) -> bool {
            body->setArea({0, 0, newDim.w, newDim.h});
            return true;
        };
    }
} /* namespace gui */