2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 06:35:14 +00:00

Fixed not loaded messages with bot keyboard display

Fixed saved gifs row layout
Removed information about channel members count / left to invite
in invite-to-channel box (channels have no participants limit)
This commit is contained in:
John Preston
2016-03-24 20:30:31 +03:00
parent 6710ef3e2f
commit b86d8638bc
3 changed files with 22 additions and 8 deletions

View File

@@ -1828,15 +1828,26 @@ StickerPanInner::InlineRow &StickerPanInner::layoutInlineRow(InlineRow &row, int
int32 count = row.items.size();
t_assert(count <= SavedGifsMaxPerRow);
// enumerate items in the order of growing maxWidth()
// for that sort item indices by maxWidth()
int indices[SavedGifsMaxPerRow];
for (int i = 0; i < count; ++i) {
indices[i] = i;
}
std::sort(indices, indices + count, [&row](int a, int b) -> bool {
return row.items.at(a)->maxWidth() < row.items.at(b)->maxWidth();
});
row.height = 0;
int32 availw = width() - st::inlineResultsLeft - st::inlineResultsSkip * (count - 1);
for (int32 i = 0; i < count; ++i) {
int32 w = sumWidth ? (row.items.at(i)->maxWidth() * availw / sumWidth) : row.items.at(i)->maxWidth();
int32 actualw = qMax(w, int32(st::inlineResultsMinWidth));
row.height = qMax(row.height, row.items.at(i)->resizeGetHeight(actualw));
int availw = width() - st::inlineResultsLeft - st::inlineResultsSkip * (count - 1);
for (int i = 0; i < count; ++i) {
int index = indices[i];
int w = sumWidth ? (row.items.at(index)->maxWidth() * availw / sumWidth) : row.items.at(index)->maxWidth();
int actualw = qMax(w, int(st::inlineResultsMinWidth));
row.height = qMax(row.height, row.items.at(index)->resizeGetHeight(actualw));
if (sumWidth) {
availw -= actualw;
sumWidth -= row.items.at(i)->maxWidth();
sumWidth -= row.items.at(index)->maxWidth();
}
}
return row;