mirror of https://github.com/procxx/kepka.git
Use new toast style structure.
This commit is contained in:
parent
8a4c7e3994
commit
dd78052f92
|
@ -218,8 +218,11 @@ stickerGroupCategoryAbout: defaultTextStyle;
|
|||
stickerGroupCategoryAddMargin: margins(0px, 10px, 0px, 5px);
|
||||
stickerGroupCategoryAdd: stickersTrendingAdd;
|
||||
|
||||
stickersToastMaxWidth: 340px;
|
||||
stickersToastPadding: margins(16px, 13px, 16px, 12px);
|
||||
stickersToast: Toast(defaultToast) {
|
||||
minWidth: 340px;
|
||||
maxWidth: 340px;
|
||||
padding: margins(16px, 13px, 16px, 12px);
|
||||
}
|
||||
|
||||
stickersEmpty: icon {{ "stickers_empty", windowSubTextFg }};
|
||||
|
||||
|
|
|
@ -77,12 +77,11 @@ void ApplyArchivedResult(const MTPDmessages_stickerSetInstallResultArchive &d) {
|
|||
Local::writeInstalledStickers();
|
||||
Local::writeArchivedStickers();
|
||||
|
||||
auto toast = Ui::Toast::Config();
|
||||
toast.text = { tr::lng_stickers_packs_archived(tr::now) };
|
||||
toast.maxWidth = toast.minWidth = st::stickersToastMaxWidth;
|
||||
toast.multiline = true;
|
||||
toast.padding = st::stickersToastPadding;
|
||||
Ui::Toast::Show(toast);
|
||||
Ui::Toast::Show(Ui::Toast::Config{
|
||||
.text = { tr::lng_stickers_packs_archived(tr::now) },
|
||||
.st = &st::stickersToast,
|
||||
.multiline = true,
|
||||
});
|
||||
// Ui::show(Box<StickersBox>(archived, &Auth()), Ui::LayerOption::KeepOther);
|
||||
|
||||
Auth().data().notifyStickersUpdated();
|
||||
|
|
|
@ -379,6 +379,17 @@ botKbTinyButton: BotKeyboardButton {
|
|||
botKbScroll: defaultSolidScroll;
|
||||
|
||||
historyDateFadeDuration: 200;
|
||||
historyDiceToast: Toast(defaultToast) {
|
||||
minWidth: msgMinWidth;
|
||||
maxWidth: 640px;
|
||||
}
|
||||
historyErrorToast: Toast(defaultToast) {
|
||||
minWidth: msgMinWidth;
|
||||
}
|
||||
historyInfoToast: Toast(defaultToast) {
|
||||
minWidth: msgMinWidth;
|
||||
maxWidth: 380px;
|
||||
}
|
||||
|
||||
historyPhotoLeft: 14px;
|
||||
historyPhotoBubbleMinWidth: 200px;
|
||||
|
|
|
@ -2484,19 +2484,18 @@ void HistoryInner::elementStartStickerLoop(
|
|||
}
|
||||
|
||||
void HistoryInner::elementShowPollResults(
|
||||
not_null<PollData*> poll,
|
||||
FullMsgId context) {
|
||||
_controller->showPollResults(poll, context);
|
||||
not_null<PollData*> poll,
|
||||
FullMsgId context) {
|
||||
}
|
||||
|
||||
void HistoryInner::elementShowTooltip(const TextWithEntities &text) {
|
||||
auto config = Ui::Toast::Config();
|
||||
config.multiline = config.dark = true;
|
||||
config.minWidth = st::msgMinWidth;
|
||||
config.maxWidth = st::windowMinWidth;
|
||||
config.text = text;
|
||||
config.durationMs = CountToastDuration(config.text);
|
||||
Ui::Toast::Show(_widget, config);
|
||||
Ui::Toast::Show(_widget, Ui::Toast::Config{
|
||||
.text = text,
|
||||
.st = &st::historyInfoToast,
|
||||
.durationMs = CountToastDuration(text),
|
||||
.multiline = true,
|
||||
.dark = true,
|
||||
});
|
||||
}
|
||||
|
||||
auto HistoryInner::getSelectionState() const
|
||||
|
|
|
@ -236,11 +236,11 @@ object_ptr<Ui::FlatButton> SetupDiscussButton(
|
|||
}
|
||||
|
||||
void ShowErrorToast(const QString &text) {
|
||||
auto config = Ui::Toast::Config();
|
||||
config.multiline = true;
|
||||
config.minWidth = st::msgMinWidth;
|
||||
config.text = { text };
|
||||
Ui::Toast::Show(config);
|
||||
Ui::Toast::Show(Ui::Toast::Config{
|
||||
.text = { text },
|
||||
.st = &st::historyErrorToast,
|
||||
.multiline = true,
|
||||
});
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
|
|
@ -48,11 +48,11 @@ namespace HistoryView {
|
|||
namespace {
|
||||
|
||||
void ShowErrorToast(const QString &text) {
|
||||
auto config = Ui::Toast::Config();
|
||||
config.multiline = true;
|
||||
config.minWidth = st::msgMinWidth;
|
||||
config.text = { text };
|
||||
Ui::Toast::Show(config);
|
||||
Ui::Toast::Show(Ui::Toast::Config{
|
||||
.text = { text },
|
||||
.st = &st::historyErrorToast,
|
||||
.multiline = true,
|
||||
});
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
|
|
@ -19,6 +19,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "ui/text/text_utilities.h"
|
||||
#include "lang/lang_keys.h"
|
||||
#include "main/main_session.h"
|
||||
#include "styles/style_history.h"
|
||||
|
||||
namespace HistoryView {
|
||||
namespace {
|
||||
|
@ -35,12 +36,12 @@ namespace {
|
|||
not_null<History*> history,
|
||||
const QString &emoji) {
|
||||
return std::make_shared<LambdaClickHandler>([=] {
|
||||
auto config = Ui::Toast::Config();
|
||||
config.multiline = true;
|
||||
config.minWidth = st::msgMinWidth;
|
||||
config.maxWidth = st::toastMaxWidth + st::msgMinWidth;
|
||||
config.text = { tr::lng_about_random(tr::now, lt_emoji, emoji) };
|
||||
config.durationMs = Ui::Toast::kDefaultDuration * 2;
|
||||
auto config = Ui::Toast::Config{
|
||||
.text = { tr::lng_about_random(tr::now, lt_emoji, emoji) },
|
||||
.st = &st::historyDiceToast,
|
||||
.durationMs = Ui::Toast::kDefaultDuration * 2,
|
||||
.multiline = true,
|
||||
};
|
||||
auto link = Ui::Text::Link(
|
||||
tr::lng_about_random_send(tr::now).toUpper());
|
||||
link.entities.push_back(
|
||||
|
|
|
@ -759,9 +759,9 @@ std::vector<not_null<const Value*>> FormController::submitGetErrors() {
|
|||
_view->showToast(tr::lng_passport_success(tr::now));
|
||||
|
||||
base::call_delayed(
|
||||
(st::toastFadeInDuration
|
||||
(st::defaultToast.durationFadeIn
|
||||
+ Ui::Toast::kDefaultDuration
|
||||
+ st::toastFadeOutDuration),
|
||||
+ st::defaultToast.durationFadeOut),
|
||||
this,
|
||||
[=] { cancel(); });
|
||||
}).fail([=](const RPCError &error) {
|
||||
|
|
|
@ -828,7 +828,7 @@ void ForwardsPrivacyController::PaintForwardedTooltip(
|
|||
}
|
||||
Unexpected("Option value in ForwardsPrivacyController.");
|
||||
}();
|
||||
const auto &font = st::toastTextStyle.font;
|
||||
const auto &font = st::defaultToast.style.font;
|
||||
const auto textWidth = font->width(text);
|
||||
const auto arrowSkip = st::settingsForwardPrivacyArrowSkip;
|
||||
const auto arrowSize = st::settingsForwardPrivacyArrowSize;
|
||||
|
|
|
@ -310,6 +310,11 @@ windowFilterChatsSectionSubtitle: FlatLabel(defaultFlatLabel) {
|
|||
windowFilterChatsSectionSubtitlePadding: margins(17px, 7px, 17px, 7px);
|
||||
windowFilterAboutPadding: margins(22px, 0px, 22px, 19px);
|
||||
|
||||
windowArchiveToast: Toast(defaultToast) {
|
||||
minWidth: boxWideWidth;
|
||||
maxWidth: boxWideWidth;
|
||||
}
|
||||
|
||||
// Mac specific
|
||||
|
||||
macAccessoryWidth: 450.;
|
||||
|
|
|
@ -53,6 +53,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "styles/style_layers.h"
|
||||
#include "styles/style_boxes.h"
|
||||
#include "styles/style_window.h" // st::windowMinWidth
|
||||
#include "styles/style_history.h" // st::historyErrorToast
|
||||
|
||||
#include <QtWidgets/QAction>
|
||||
|
||||
|
@ -654,12 +655,12 @@ void FolderFiller::addTogglesForArchive() {
|
|||
});
|
||||
|
||||
_addAction(tr::lng_context_archive_to_menu(tr::now), [=] {
|
||||
auto toast = Ui::Toast::Config();
|
||||
toast.text = { tr::lng_context_archive_to_menu_info(tr::now) };
|
||||
toast.minWidth = toast.maxWidth = st::boxWideWidth;
|
||||
toast.multiline = true;
|
||||
toast.durationMs = kArchivedToastDuration;
|
||||
Ui::Toast::Show(toast);
|
||||
Ui::Toast::Show(Ui::Toast::Config{
|
||||
.text = { tr::lng_context_archive_to_menu_info(tr::now) },
|
||||
.st = &st::windowArchiveToast,
|
||||
.durationMs = kArchivedToastDuration,
|
||||
.multiline = true,
|
||||
});
|
||||
|
||||
controller->session().settings().setArchiveInMainMenu(
|
||||
!controller->session().settings().archiveInMainMenu());
|
||||
|
@ -949,11 +950,11 @@ QPointer<Ui::RpWidget> ShowSendNowMessagesBox(
|
|||
session->data().idsToItems(items),
|
||||
TextWithTags());
|
||||
if (!error.isEmpty()) {
|
||||
auto config = Ui::Toast::Config();
|
||||
config.multiline = true;
|
||||
config.minWidth = st::msgMinWidth;
|
||||
config.text = { error };
|
||||
Ui::Toast::Show(config);
|
||||
Ui::Toast::Show(Ui::Toast::Config{
|
||||
.text = { error },
|
||||
.st = &st::historyErrorToast,
|
||||
.multiline = true,
|
||||
});
|
||||
return { nullptr };
|
||||
}
|
||||
const auto box = std::make_shared<QPointer<Ui::BoxContent>>();
|
||||
|
@ -1060,16 +1061,16 @@ void PeerMenuAddMuteAction(
|
|||
//
|
||||
void ToggleHistoryArchived(not_null<History*> history, bool archived) {
|
||||
const auto callback = [=] {
|
||||
auto toast = Ui::Toast::Config();
|
||||
toast.text = { archived
|
||||
? tr::lng_archived_added(tr::now)
|
||||
: tr::lng_archived_removed(tr::now) };
|
||||
toast.minWidth = toast.maxWidth = st::boxWideWidth;
|
||||
toast.multiline = true;
|
||||
if (archived) {
|
||||
toast.durationMs = kArchivedToastDuration;
|
||||
}
|
||||
Ui::Toast::Show(toast);
|
||||
Ui::Toast::Show(Ui::Toast::Config{
|
||||
.text = { (archived
|
||||
? tr::lng_archived_added(tr::now)
|
||||
: tr::lng_archived_removed(tr::now)) },
|
||||
.st = &st::windowArchiveToast,
|
||||
.durationMs = (archived
|
||||
? kArchivedToastDuration
|
||||
: Ui::Toast::kDefaultDuration),
|
||||
.multiline = true,
|
||||
});
|
||||
};
|
||||
history->session().api().toggleHistoryArchived(
|
||||
history,
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 1647b0b76a3352f5d9b2892441eeaf002256a481
|
||||
Subproject commit 48a83157407c555d3a0c17026aced41308138d49
|
Loading…
Reference in New Issue