mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-14 05:07:10 +02:00
Fit transactions id from credits history entries to table cell.
This commit is contained in:
parent
983c949e8c
commit
77e7796b3f
2 changed files with 19 additions and 3 deletions
|
@ -1242,12 +1242,24 @@ void AddCreditsHistoryEntryTable(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!entry.id.isEmpty()) {
|
if (!entry.id.isEmpty()) {
|
||||||
constexpr auto kOneLineCount = 18;
|
constexpr auto kOneLineCount = 22;
|
||||||
const auto oneLine = entry.id.length() <= kOneLineCount;
|
const auto oneLine = entry.id.size() <= kOneLineCount;
|
||||||
|
auto multiLine = QString();
|
||||||
|
if (!oneLine) {
|
||||||
|
for (auto i = 0; i < entry.id.size(); ++i) {
|
||||||
|
multiLine.append(entry.id[i]);
|
||||||
|
if ((i + 1) % kOneLineCount == 0) {
|
||||||
|
multiLine.append('\n');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
auto label = object_ptr<Ui::FlatLabel>(
|
auto label = object_ptr<Ui::FlatLabel>(
|
||||||
table,
|
table,
|
||||||
rpl::single(
|
rpl::single(
|
||||||
Ui::Text::Wrapped({ entry.id }, EntityType::Code, {})),
|
Ui::Text::Wrapped(
|
||||||
|
{ oneLine ? entry.id : std::move(multiLine) },
|
||||||
|
EntityType::Code,
|
||||||
|
{})),
|
||||||
oneLine
|
oneLine
|
||||||
? st::giveawayGiftCodeValue
|
? st::giveawayGiftCodeValue
|
||||||
: st::giveawayGiftCodeValueMultiline);
|
: st::giveawayGiftCodeValueMultiline);
|
||||||
|
|
|
@ -96,6 +96,10 @@ giveawayGiftCodeValue: FlatLabel(defaultFlatLabel) {
|
||||||
giveawayGiftCodeValueMultiline: FlatLabel(giveawayGiftCodeValue) {
|
giveawayGiftCodeValueMultiline: FlatLabel(giveawayGiftCodeValue) {
|
||||||
minWidth: 128px;
|
minWidth: 128px;
|
||||||
maxHeight: 100px;
|
maxHeight: 100px;
|
||||||
|
style: TextStyle(defaultTextStyle) {
|
||||||
|
font: font(10px);
|
||||||
|
linkUnderline: kLinkUnderlineNever;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
giveawayGiftMessage: FlatLabel(giveawayGiftCodeValue) {
|
giveawayGiftMessage: FlatLabel(giveawayGiftCodeValue) {
|
||||||
minWidth: 128px;
|
minWidth: 128px;
|
||||||
|
|
Loading…
Add table
Reference in a new issue