2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Improve screencast source choosing design.

This commit is contained in:
John Preston
2021-04-29 20:28:12 +04:00
parent 022c0a1327
commit a48649987e
12 changed files with 304 additions and 74 deletions

View File

@@ -93,16 +93,6 @@ QImage FromInlineBytes(const QByteArray &bytes) {
return App::readImage(ExpandInlineBytes(bytes));
}
QSize GetSizeForDocument(const QVector<MTPDocumentAttribute> &attributes) {
for (const auto &attribute : attributes) {
if (attribute.type() == mtpc_documentAttributeImageSize) {
auto &size = attribute.c_documentAttributeImageSize();
return QSize(size.vw().v, size.vh().v);
}
}
return QSize();
}
} // namespace Images
Image::Image(const QString &path) : Image(ReadContent(path)) {

View File

@@ -14,9 +14,6 @@ namespace Images {
[[nodiscard]] QByteArray ExpandInlineBytes(const QByteArray &bytes);
[[nodiscard]] QImage FromInlineBytes(const QByteArray &bytes);
[[nodiscard]] QSize GetSizeForDocument(
const QVector<MTPDocumentAttribute> &attributes);
} // namespace Images
class Image final {

View File

@@ -13,6 +13,19 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include <QtCore/QBuffer>
namespace Images {
namespace {
QSize GetSizeForDocument(const QVector<MTPDocumentAttribute> &attributes) {
for (const auto &attribute : attributes) {
if (attribute.type() == mtpc_documentAttributeImageSize) {
auto &size = attribute.c_documentAttributeImageSize();
return QSize(size.vw().v, size.vh().v);
}
}
return QSize();
}
} // namespace
ImageWithLocation FromPhotoSize(
not_null<Main::Session*> session,