diff --git a/tools/chatgui/src/avatars/avatarcrop.cpp b/tools/chatgui/src/avatars/avatarcrop.cpp index 77cda0a6..5c5bfc19 100644 --- a/tools/chatgui/src/avatars/avatarcrop.cpp +++ b/tools/chatgui/src/avatars/avatarcrop.cpp @@ -44,9 +44,10 @@ protected: QPainter p(this); p.fillRect(rect(), QColor(20,20,22)); if (image.isNull()) return; clamp(); const double s = scale(); const QSizeF size(originalSize.width()*s, originalSize.height()*s); p.setRenderHint(QPainter::SmoothPixmapTransform); + p.setRenderHint(QPainter::Antialiasing); p.drawImage(QRectF(QPointF(width()/2.0,height()/2.0)+offset-QPointF(size.width()/2,size.height()/2), size), image); - QPainterPath mask; mask.addRect(rect()); mask.addRect(frame()); p.fillPath(mask, QColor(0,0,0,150)); - p.setPen(QPen(Qt::white, 2)); p.drawRect(frame()); + QPainterPath mask; mask.addRect(rect()); mask.addEllipse(frame()); p.fillPath(mask, QColor(0,0,0,150)); + p.setPen(QPen(Qt::white, 2)); p.drawEllipse(frame()); } void wheelEvent(QWheelEvent* e) override { if (image.isNull()) return; @@ -65,7 +66,7 @@ bool selectAvatarCrop(const QString& source, QRectF& crop, QWidget* parent) { QDialog dialog(parent); dialog.setWindowTitle(QCoreApplication::translate("ChatGui", "Crop avatar")); dialog.resize(620,650); auto* layout = new QVBoxLayout(&dialog); auto* view = new CropView(&dialog); layout->addWidget(view, 1); view->setObjectName("avatarCropView"); - auto* status = new QLabel(QCoreApplication::translate("ChatGui", "Drag photo and use the wheel to select a square"), &dialog); + auto* status = new QLabel(QCoreApplication::translate("ChatGui", "Drag photo and use the wheel to fit the circle"), &dialog); layout->addWidget(status); auto* buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, &dialog); buttons->button(QDialogButtonBox::Ok)->setText(QCoreApplication::translate("ChatGui", "Upload avatar")); buttons->button(QDialogButtonBox::Ok)->setObjectName("avatarCropUpload"); @@ -88,6 +89,8 @@ bool selectAvatarCrop(const QString& source, QRectF& crop, QWidget* parent) { status->setText(QCoreApplication::translate("ChatGui", "Cannot load avatar image")); return; } view->image=image; view->originalSize=orientedSize; view->update(); buttons->button(QDialogButtonBox::Ok)->setEnabled(true); + DEBUG_DEBUG(DEBUG_CATEGORY_MEDIA, "avatar: editor loaded original=%dx%d preview=%dx%d mask=circle", + orientedSize.width(), orientedSize.height(), image.width(), image.height()); }, Qt::QueuedConnection); })); const int result=dialog.exec(); pool.waitForDone(); diff --git a/tools/chatgui/src/avatars/avatarcrop.h b/tools/chatgui/src/avatars/avatarcrop.h index 41d3dd94..6d0b9786 100644 --- a/tools/chatgui/src/avatars/avatarcrop.h +++ b/tools/chatgui/src/avatars/avatarcrop.h @@ -1,4 +1,4 @@ -/* Модальный выбор квадрата: рамка неподвижна, фото перемещается и масштабируется. */ +/* Выбор области аватара: круглая рамка неподвижна, фото перемещается и масштабируется. */ #pragma once #include #include diff --git a/tools/chatgui/translations/chatgui_ru.ts b/tools/chatgui/translations/chatgui_ru.ts index abef3529..630eeba2 100644 --- a/tools/chatgui/translations/chatgui_ru.ts +++ b/tools/chatgui/translations/chatgui_ru.ts @@ -2100,7 +2100,7 @@ Directories: %5 No avatarНет аватарки Choose avatarВыбор аватарки Crop avatarВыбор области аватарки - Drag photo and use the wheel to select a squareПеремещайте фото мышью и масштабируйте колесом, чтобы выбрать квадрат + Drag photo and use the wheel to fit the circleПеремещайте фото мышью и масштабируйте колесом, чтобы вписать его в круг Cannot load avatar imageНе удалось открыть изображение аватарки AvatarsАватарки Loading original…Загрузка оригинала…