From 20fe1b88890b26d33c72745fda785b9e5a30ddb6 Mon Sep 17 00:00:00 2001 From: RobertPiet Date: Mon, 8 Mar 2021 16:23:29 +0100 Subject: [PATCH] [EGD-5934] Adjust add/edit quote to the design Changed order of fields Author/Note, counter only for Note. --- image/assets/lang/English.json | 4 +- .../windows/QuotesAddWindow.cpp | 88 ++++++++----------- .../windows/QuotesAddWindow.hpp | 3 +- 3 files changed, 40 insertions(+), 55 deletions(-) diff --git a/image/assets/lang/English.json b/image/assets/lang/English.json index ac11d0cfab355681873f6edad281f6c87e871bdb..d6df35569695c4f01b2f7a0418ace4e35d57400b 100644 --- a/image/assets/lang/English.json +++ b/image/assets/lang/English.json @@ -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", diff --git a/module-apps/application-settings-new/windows/QuotesAddWindow.cpp b/module-apps/application-settings-new/windows/QuotesAddWindow.cpp index 537fa3d0d627351f514c0273e62afed1a1461b27..dc425c44c865817533133b3834f97f68f70bc017 100644 --- a/module-apps/application-settings-new/windows/QuotesAddWindow.cpp +++ b/module-apps/application-settings-new/windows/QuotesAddWindow.cpp @@ -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)); diff --git a/module-apps/application-settings-new/windows/QuotesAddWindow.hpp b/module-apps/application-settings-new/windows/QuotesAddWindow.hpp index 637f394ed85c1a9615e7d12b597f03f3574f8ed3..741e6976c0566ab6316613a0eee16c67f1ae617a 100644 --- a/module-apps/application-settings-new/windows/QuotesAddWindow.hpp +++ b/module-apps/application-settings-new/windows/QuotesAddWindow.hpp @@ -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;