mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Increased size of stickerset preview in webpages.
This commit is contained in:
parent
ed13a325e9
commit
3a2c5c6d0a
1 changed files with 15 additions and 10 deletions
|
@ -42,6 +42,7 @@ namespace HistoryView {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
constexpr auto kMaxOriginalEntryLines = 8192;
|
constexpr auto kMaxOriginalEntryLines = 8192;
|
||||||
|
constexpr auto kStickerSetLines = 3;
|
||||||
|
|
||||||
[[nodiscard]] int ArticleThumbWidth(not_null<PhotoData*> thumb, int height) {
|
[[nodiscard]] int ArticleThumbWidth(not_null<PhotoData*> thumb, int height) {
|
||||||
const auto size = thumb->location(Data::PhotoSize::Thumbnail);
|
const auto size = thumb->location(Data::PhotoSize::Thumbnail);
|
||||||
|
@ -300,8 +301,8 @@ QSize WebPage::countOptimalSize() {
|
||||||
_stickerSet->views.push_back(
|
_stickerSet->views.push_back(
|
||||||
std::make_unique<Sticker>(_parent, sticker, true));
|
std::make_unique<Sticker>(_parent, sticker, true));
|
||||||
}
|
}
|
||||||
const auto side = std::ceil(_stickerSet->views.size() / 2.);
|
const auto side = std::ceil(std::sqrt(_stickerSet->views.size()));
|
||||||
const auto box = lineHeight * 2;
|
const auto box = lineHeight * kStickerSetLines;
|
||||||
const auto single = box / side;
|
const auto single = box / side;
|
||||||
for (const auto &view : _stickerSet->views) {
|
for (const auto &view : _stickerSet->views) {
|
||||||
view->setWebpagePart();
|
view->setWebpagePart();
|
||||||
|
@ -547,7 +548,11 @@ QSize WebPage::countCurrentSize(int newWidth) {
|
||||||
&& _sponsoredData->peer);
|
&& _sponsoredData->peer);
|
||||||
constexpr auto kSponsoredUserpicLines = 2;
|
constexpr auto kSponsoredUserpicLines = 2;
|
||||||
_pixh = lineHeight
|
_pixh = lineHeight
|
||||||
* (specialRightPix ? kSponsoredUserpicLines : linesMax);
|
* (_stickerSet
|
||||||
|
? kStickerSetLines
|
||||||
|
: specialRightPix
|
||||||
|
? kSponsoredUserpicLines
|
||||||
|
: linesMax);
|
||||||
do {
|
do {
|
||||||
_pixw = specialRightPix
|
_pixw = specialRightPix
|
||||||
? _pixh
|
? _pixh
|
||||||
|
@ -755,9 +760,9 @@ void WebPage::draw(Painter &p, const PaintContext &context) const {
|
||||||
auto lineHeight = UnitedLineHeight();
|
auto lineHeight = UnitedLineHeight();
|
||||||
if (_stickerSet) {
|
if (_stickerSet) {
|
||||||
const auto viewsCount = _stickerSet->views.size();
|
const auto viewsCount = _stickerSet->views.size();
|
||||||
const auto topLeft = QPoint(inner.left() + paintw - _pixh, tshift);
|
const auto box = _pixh;
|
||||||
const auto side = std::ceil(viewsCount / 2.);
|
const auto topLeft = QPoint(inner.left() + paintw - box, tshift);
|
||||||
const auto box = lineHeight * 2;
|
const auto side = std::ceil(std::sqrt(viewsCount));
|
||||||
const auto single = box / side;
|
const auto single = box / side;
|
||||||
for (auto i = 0; i < side; i++) {
|
for (auto i = 0; i < side; i++) {
|
||||||
for (auto j = 0; j < side; j++) {
|
for (auto j = 0; j < side; j++) {
|
||||||
|
@ -769,15 +774,15 @@ void WebPage::draw(Painter &p, const PaintContext &context) const {
|
||||||
const auto size = view->countOptimalSize();
|
const auto size = view->countOptimalSize();
|
||||||
const auto offsetX = (single - size.width()) / 2.;
|
const auto offsetX = (single - size.width()) / 2.;
|
||||||
const auto offsetY = (single - size.height()) / 2.;
|
const auto offsetY = (single - size.height()) / 2.;
|
||||||
const auto x = j * size.width() + offsetX;
|
const auto x = j * single + offsetX;
|
||||||
const auto y = i * size.height() + offsetY;
|
const auto y = i * single + offsetY;
|
||||||
const auto w = size.width();
|
const auto w = size.width();
|
||||||
const auto h = size.height();
|
const auto h = size.height();
|
||||||
view->draw(p, context, QRect(QPoint(x, y) + topLeft, size));
|
view->draw(p, context, QRect(QPoint(x, y) + topLeft, size));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
paintw -= box;
|
||||||
if (asArticle()) {
|
} else if (asArticle()) {
|
||||||
ensurePhotoMediaCreated();
|
ensurePhotoMediaCreated();
|
||||||
|
|
||||||
auto pix = QPixmap();
|
auto pix = QPixmap();
|
||||||
|
|
Loading…
Add table
Reference in a new issue