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

Add invite link QR code generation.

This commit is contained in:
John Preston
2021-02-23 18:47:43 +04:00
parent 27681db7f6
commit 16b4959e71
7 changed files with 164 additions and 18 deletions

View File

@@ -32,24 +32,6 @@ namespace Intro {
namespace details {
namespace {
[[nodiscard]] QImage TelegramLogoImage() {
const auto size = QSize(st::introQrCenterSize, st::introQrCenterSize);
auto result = QImage(
size * style::DevicePixelRatio(),
QImage::Format_ARGB32_Premultiplied);
result.fill(Qt::transparent);
result.setDevicePixelRatio(style::DevicePixelRatio());
{
auto p = QPainter(&result);
auto hq = PainterHighQualityEnabler(p);
p.setBrush(st::activeButtonBg);
p.setPen(Qt::NoPen);
p.drawEllipse(QRect(QPoint(), size));
st::introQrPlane.paintInCenter(p, QRect(QPoint(), size));
}
return result;
}
[[nodiscard]] QImage TelegramQrExact(const Qr::Data &data, int pixel) {
return Qr::Generate(data, pixel, st::windowFg->c);
}
@@ -430,5 +412,23 @@ void QrWidget::cancelled() {
api().request(base::take(_requestId)).cancel();
}
QImage TelegramLogoImage() {
const auto size = QSize(st::introQrCenterSize, st::introQrCenterSize);
auto result = QImage(
size * style::DevicePixelRatio(),
QImage::Format_ARGB32_Premultiplied);
result.fill(Qt::transparent);
result.setDevicePixelRatio(style::DevicePixelRatio());
{
auto p = QPainter(&result);
auto hq = PainterHighQualityEnabler(p);
p.setBrush(st::activeButtonBg);
p.setPen(Qt::NoPen);
p.drawEllipse(QRect(QPoint(), size));
st::introQrPlane.paintInCenter(p, QRect(QPoint(), size));
}
return result;
}
} // namespace details
} // namespace Intro

View File

@@ -59,5 +59,7 @@ private:
};
[[nodiscard]] QImage TelegramLogoImage();
} // namespace details
} // namespace Intro