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