mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 14:17:12 +02:00
Moved formatting of image size text to single place.
Fixed wrong size display on retina screens. Replaced "x" with special character.
This commit is contained in:
parent
cab8a52f8f
commit
f1669674d8
6 changed files with 15 additions and 10 deletions
|
@ -646,9 +646,7 @@ void EditCaptionBox::updateEditPreview() {
|
|||
: _preparedList.files.front().content.size());
|
||||
// Show image dimensions if it should be sent as doc.
|
||||
if (_isImage && docPhotoSize.isValid()) {
|
||||
_status = qsl("%1x%2")
|
||||
.arg(docPhotoSize.width())
|
||||
.arg(docPhotoSize.height());
|
||||
_status = Ui::FormatImageSizeText(docPhotoSize);
|
||||
}
|
||||
_doc = true;
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "export/output/export_output_result.h"
|
||||
#include "export/data/export_data_types.h"
|
||||
#include "core/utils.h"
|
||||
#include "ui/text/format_values.h"
|
||||
|
||||
#include <QtCore/QSize>
|
||||
#include <QtCore/QFile>
|
||||
|
@ -1536,9 +1537,8 @@ QByteArray HtmlWriter::Wrap::pushPhotoMedia(
|
|||
if (thumb.isEmpty()) {
|
||||
auto generic = MediaData();
|
||||
generic.title = "Photo";
|
||||
generic.status = NumberToString(data.image.width)
|
||||
+ "x"
|
||||
+ NumberToString(data.image.height);
|
||||
generic.status = Ui::FormatImageSizeText(
|
||||
QSize(data.image.width, data.image.height)).toUtf8();
|
||||
if (data.image.file.relativePath.isEmpty()) {
|
||||
generic.status += ", " + FormatFileSize(data.image.file.size);
|
||||
} else {
|
||||
|
|
|
@ -76,9 +76,8 @@ AlbumThumbnail::AlbumThumbnail(
|
|||
const auto filepath = file.path;
|
||||
if (filepath.isEmpty()) {
|
||||
_name = "image.png";
|
||||
_status = u"%1x%2"_q
|
||||
.arg(_fullPreview.width())
|
||||
.arg(_fullPreview.height());
|
||||
_status = FormatImageSizeText(_fullPreview.size()
|
||||
/ _fullPreview.devicePixelRatio());
|
||||
} else {
|
||||
auto fileinfo = QFileInfo(filepath);
|
||||
_name = fileinfo.fileName();
|
||||
|
|
|
@ -92,7 +92,8 @@ void SingleFilePreview::preparePreview(const PreparedFile &file) {
|
|||
if (filepath.isEmpty()) {
|
||||
auto filename = "image.png";
|
||||
_name = filename;
|
||||
_statusText = u"%1x%2"_q.arg(preview.width()).arg(preview.height());
|
||||
_statusText = FormatImageSizeText(preview.size()
|
||||
/ preview.devicePixelRatio());
|
||||
_fileIsImage = true;
|
||||
} else {
|
||||
auto fileinfo = QFileInfo(filepath);
|
||||
|
|
|
@ -363,4 +363,10 @@ CurrencyRule LookupCurrencyRule(const QString ¤cy) {
|
|||
return result;
|
||||
}
|
||||
|
||||
QString FormatImageSizeText(const QSize &size) {
|
||||
return QString::number(size.width())
|
||||
+ QChar(215)
|
||||
+ QString::number(size.height());
|
||||
}
|
||||
|
||||
} // namespace Ui
|
||||
|
|
|
@ -22,6 +22,7 @@ inline constexpr auto FileStatusSizeFailed = 0x7FFFFFF2;
|
|||
[[nodiscard]] QString FormatDurationAndSizeText(qint64 duration, qint64 size);
|
||||
[[nodiscard]] QString FormatGifAndSizeText(qint64 size);
|
||||
[[nodiscard]] QString FormatPlayedText(qint64 played, qint64 duration);
|
||||
[[nodiscard]] QString FormatImageSizeText(const QSize &size);
|
||||
|
||||
struct CurrencyRule {
|
||||
const char *international = "";
|
||||
|
|
Loading…
Add table
Reference in a new issue