~aleteoryx/muditaos

20fe1b88890b26d33c72745fda785b9e5a30ddb6 — RobertPiet 5 years ago 9534a84
[EGD-5934] Adjust add/edit quote to the design

Changed order of fields Author/Note, counter only for Note.
M image/assets/lang/English.json => image/assets/lang/English.json +2 -2
@@ 353,8 353,8 @@
  "app_settings_display_wallpaper_quotes_new": "New quote",
  "app_settings_display_wallpaper_quotes_select": "Select quotes",
  "app_settings_display_wallpaper_quotes_delete_confirmation": "Delete quote?",
  "app_settings_display_wallpaper_quotes_quote": "Quote text",
  "app_settings_display_wallpaper_quotes_author": "Quote author",
  "app_settings_display_wallpaper_quotes_note": "Note",
  "app_settings_display_wallpaper_quotes_author": "Author",
  "app_settings_system": "System",
  "app_settings_apps_tools": "Apps and tools",
  "app_settings_apps_messages": "Messages",

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

#include "QuotesAddWindow.hpp"


@@ 56,6 56,35 @@ namespace gui
        vBox->setPenFocusWidth(::style::window::default_border_focus_w);
        vBox->setPenWidth(::style::window::default_border_rect_no_focus);

        auto authorHeader = new HBox(vBox, 0, 0, 0, 0);
        authorHeader->setMinimumSize(style::window::default_body_width, style::window::label::default_h);
        authorHeader->setEdges(gui::RectangleEdge::None);
        authorHeader->activeItem = false;

        auto authorLabel = new Label(authorHeader, 0, 0, 0, 0);
        authorLabel->setMinimumSize(style::headerWidth, style::window::label::default_h);
        authorLabel->setEdges(RectangleEdge::None);
        authorLabel->setAlignment(gui::Alignment{gui::Alignment::Horizontal::Left});
        authorLabel->setText(utils::localize.get("app_settings_display_wallpaper_quotes_author"));
        authorLabel->setPenFocusWidth(::style::window::default_border_focus_w);
        authorLabel->setFont(::style::window::font::verysmall);
        authorLabel->setPadding(gui::Padding(0, 0, 0, 0));
        authorLabel->activeItem = false;

        authorText = new gui::Text(vBox, 0, 0, 0, 0);
        authorText->setMinimumSize(style::window::default_body_width, style::window::label::default_h);
        authorText->setAlignment(gui::Alignment{gui::Alignment::Vertical::Top});
        authorText->setPenFocusWidth(::style::window::default_border_focus_w);
        authorText->setPenWidth(::style::window::default_border_rect_no_focus);
        authorText->setEdges(gui::RectangleEdge::Bottom);
        authorText->setFont(::style::window::font::medium);
        authorText->setInputMode(new InputMode(
            {InputMode::ABC, InputMode::abc, InputMode::digit},
            [=](const UTF8 &text) { bottomBarTemporaryMode(text); },
            [=]() { bottomBarRestoreFromTemporaryMode(); },
            [=]() { selectSpecialCharacter(); }));
        authorText->setTextLimitType(gui::TextLimitType::MaxSignsCount, maxAuthorCharactersCount);

        auto quoteHeader = new HBox(vBox, 0, 0, 0, 0);
        quoteHeader->setMinimumSize(style::window::default_body_width, style::window::label::default_h);
        quoteHeader->activeItem = false;


@@ 65,24 94,18 @@ namespace gui
        quoteLabel->setMinimumSize(style::headerWidth, style::window::label::default_h);
        quoteLabel->setEdges(RectangleEdge::None);
        quoteLabel->setPenFocusWidth(::style::window::default_border_focus_w);
        quoteLabel->setText(utils::localize.get("app_settings_display_wallpaper_quotes_quote"));
        quoteLabel->setText(utils::localize.get("app_settings_display_wallpaper_quotes_note"));
        quoteLabel->setFont(::style::window::font::verysmall);
        quoteLabel->setAlignment(gui::Alignment{gui::Alignment::Horizontal::Left});
        quoteLabel->activeItem = false;

        quoteCharCounter = new gui::Label(quoteHeader, 0, 0, 0, 0);
        quoteCharCounter->setMinimumSize(style::counterWidth, style::window::label::default_h);
        quoteCharCounter->setEdges(gui::RectangleEdge::None);
        quoteCharCounter->setFont(::style::window::font::verysmall);
        quoteCharCounter->setAlignment(gui::Alignment{gui::Alignment::Horizontal::Right});

        quoteText = new gui::Text(vBox, 0, 0, 0, 0);
        quoteText->setAlignment(gui::Alignment{gui::Alignment::Vertical::Top});
        quoteText->setMinimumSize(style::window::default_body_width,
                                  style::window::label::default_h * maxQuoteLinesCount);
        quoteText->setPenFocusWidth(::style::window::default_border_focus_w);
        quoteText->setPenWidth(::style::window::default_border_rect_no_focus);
        quoteText->setEdges(gui::RectangleEdge::None);
        quoteText->setEdges(gui::RectangleEdge::Bottom);
        quoteText->setFont(::style::window::font::medium);
        quoteText->setInputMode(new InputMode(
            {InputMode::ABC, InputMode::abc, InputMode::digit},


@@ 92,42 115,11 @@ namespace gui
        quoteText->setTextLimitType(gui::TextLimitType::MaxSignsCount, maxQuoteCharactersCount);
        quoteText->setTextChangedCallback([this](Item &, const UTF8 &text) { setQuoteCharactersCount(text.length()); });

        auto authorHeader = new HBox(vBox, 0, 0, 0, 0);
        authorHeader->setMinimumSize(style::window::default_body_width, style::window::label::default_h);
        authorHeader->setEdges(gui::RectangleEdge::None);
        authorHeader->activeItem = false;

        auto authorLabel = new Label(authorHeader, 0, 0, 0, 0);
        authorLabel->setMinimumSize(style::headerWidth, style::window::label::default_h);
        authorLabel->setEdges(RectangleEdge::None);
        authorLabel->setAlignment(gui::Alignment{gui::Alignment::Horizontal::Left});
        authorLabel->setText(utils::localize.get("app_settings_display_wallpaper_quotes_author"));
        authorLabel->setPenFocusWidth(::style::window::default_border_focus_w);
        authorLabel->setFont(::style::window::font::verysmall);
        authorLabel->setPadding(gui::Padding(0, 0, 0, 0));
        authorLabel->activeItem = false;

        authorCharCounter = new gui::Label(authorHeader, 0, 0, 0, 0);
        authorCharCounter->setMinimumSize(style::counterWidth, style::window::label::default_h);
        authorCharCounter->setEdges(gui::RectangleEdge::None);
        authorCharCounter->setFont(::style::window::font::verysmall);
        authorCharCounter->setAlignment(gui::Alignment{gui::Alignment::Horizontal::Right});

        authorText = new gui::Text(vBox, 0, 0, 0, 0);
        authorText->setMinimumSize(style::window::default_body_width, style::window::label::default_h);
        authorText->setAlignment(gui::Alignment{gui::Alignment::Vertical::Top});
        authorText->setPenFocusWidth(::style::window::default_border_focus_w);
        authorText->setPenWidth(::style::window::default_border_rect_no_focus);
        authorText->setEdges(gui::RectangleEdge::None);
        authorText->setFont(::style::window::font::medium);
        authorText->setInputMode(new InputMode(
            {InputMode::ABC, InputMode::abc, InputMode::digit},
            [=](const UTF8 &text) { bottomBarTemporaryMode(text); },
            [=]() { bottomBarRestoreFromTemporaryMode(); },
            [=]() { selectSpecialCharacter(); }));
        authorText->setTextLimitType(gui::TextLimitType::MaxSignsCount, maxAuthorCharactersCount);
        authorText->setTextChangedCallback(
            [this](Item &, const UTF8 &text) { setAuthorCharactersCount(text.length()); });
        quoteCharCounter = new gui::Label(vBox, 0, 0, 0, 0);
        quoteCharCounter->setMinimumSize(style::counterWidth, style::window::label::default_h);
        quoteCharCounter->setEdges(gui::RectangleEdge::None);
        quoteCharCounter->setFont(::style::window::font::verysmall);
        quoteCharCounter->setAlignment(gui::Alignment{gui::Alignment::Horizontal::Right});

        setTitle(utils::localize.get("app_settings_display_wallpaper_quotes_new"));
        vBox->resizeItems();


@@ 153,7 145,6 @@ namespace gui
            setTitle(utils::localize.get("app_settings_display_wallpaper_quotes_new"));
        }

        setAuthorCharactersCount(authorText->getText().length());
        setQuoteCharactersCount(quoteText->getText().length());
    }



@@ 175,11 166,6 @@ namespace gui
        return AppWindow::onInput(inputEvent);
    }

    void QuoteAddEditWindow::setAuthorCharactersCount(std::uint32_t count)
    {
        authorCharCounter->setText(formatCounterText(count, maxAuthorCharactersCount));
    }

    void QuoteAddEditWindow::setQuoteCharactersCount(std::uint32_t count)
    {
        quoteCharCounter->setText(formatCounterText(count, maxQuoteCharactersCount));

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

#pragma once


@@ 20,7 20,6 @@ namespace gui
      private:
        auto onInput(const InputEvent &inputEvent) -> bool override;
        void onBeforeShow(ShowMode mode, SwitchData *data) override;
        void setAuthorCharactersCount(uint32_t count);
        void setQuoteCharactersCount(uint32_t count);

        gui::Text *quoteText          = nullptr;