2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-09-03 16:05:57 +00:00

Fit transactions id from credits history entries to table cell.

This commit is contained in:
23rd
2025-06-29 21:45:48 +03:00
parent a809ccf229
commit 388803ffdb

View File

@@ -76,6 +76,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
namespace { namespace {
constexpr auto kRarityTooltipDuration = 3 * crl::time(1000); constexpr auto kRarityTooltipDuration = 3 * crl::time(1000);
constexpr auto kHorizontalBar = QChar(0x2015);
[[nodiscard]] QString CreateMessageLink( [[nodiscard]] QString CreateMessageLink(
not_null<Main::Session*> session, not_null<Main::Session*> session,
@@ -135,9 +136,10 @@ constexpr auto kRarityTooltipDuration = 3 * crl::time(1000);
[[nodiscard]] object_ptr<Ui::FlatLabel> MakeMaybeMultilineTokenValue( [[nodiscard]] object_ptr<Ui::FlatLabel> MakeMaybeMultilineTokenValue(
not_null<Ui::TableLayout*> table, not_null<Ui::TableLayout*> table,
const QString &token, QString token,
Settings::CreditsEntryBoxStyleOverrides st) { Settings::CreditsEntryBoxStyleOverrides st) {
constexpr auto kOneLineCount = 24; constexpr auto kOneLineCount = 24;
token = token.replace(QChar('-'), kHorizontalBar);
const auto oneLine = token.length() <= kOneLineCount; const auto oneLine = token.length() <= kOneLineCount;
return object_ptr<Ui::FlatLabel>( return object_ptr<Ui::FlatLabel>(
table, table,
@@ -1381,7 +1383,9 @@ void AddStarGiftTable(
auto label = MakeMaybeMultilineTokenValue(table, address, st); auto label = MakeMaybeMultilineTokenValue(table, address, st);
label->setClickHandlerFilter([=](const auto &...) { label->setClickHandlerFilter([=](const auto &...) {
TextUtilities::SetClipboardText( TextUtilities::SetClipboardText(
TextForMimeData::Simple(address)); TextForMimeData::Simple(
base::duplicate(address)
.replace(kHorizontalBar, QChar('-'))));
show->showToast( show->showToast(
tr::lng_gift_unique_address_copied(tr::now)); tr::lng_gift_unique_address_copied(tr::now));
return false; return false;
@@ -1806,7 +1810,9 @@ void AddCreditsHistoryEntryTable(
auto label = MakeMaybeMultilineTokenValue(table, entry.id, st); auto label = MakeMaybeMultilineTokenValue(table, entry.id, st);
label->setClickHandlerFilter([=](const auto &...) { label->setClickHandlerFilter([=](const auto &...) {
TextUtilities::SetClipboardText( TextUtilities::SetClipboardText(
TextForMimeData::Simple(entry.id)); TextForMimeData::Simple(
base::duplicate(entry.id)
.replace(kHorizontalBar, QChar('-'))));
show->showToast( show->showToast(
tr::lng_credits_box_history_entry_id_copied(tr::now)); tr::lng_credits_box_history_entry_id_copied(tr::now));
return false; return false;