Translate desktop avatar editor and gallery controls

This commit is contained in:
evgeny committed 2026-10-06 19:51:53 +02:00
1 parent 27fd9ee62d
commit cbe6da09ee
2 files changed
+10 -2

No files matched your search

+4 -2
View File
@@ -2,6 +2,7 @@
#include "avatarmanager.h"
#include "../imageviewer_window.h"
#include <QDialog>
#include <QCoreApplication>
#include <QHBoxLayout>
#include <QLabel>
#include <QPointer>
@@ -10,10 +11,11 @@
#include <QVBoxLayout>
namespace {
QString text(const char* source) { return QCoreApplication::translate("ChatGui",source); }
class Gallery : public QDialog {
public:
explicit Gallery(AvatarManager* source) : manager(source) {
setAttribute(Qt::WA_DeleteOnClose); resize(850,720); setWindowTitle(tr("Avatars"));
setAttribute(Qt::WA_DeleteOnClose); resize(850,720); setWindowTitle(text("Avatars"));
auto* layout = new QVBoxLayout(this); viewer = new ImageViewerWindow(this); layout->addWidget(viewer,1);
status = new QLabel(this); status->setAlignment(Qt::AlignCenter); layout->addWidget(status);
auto* strip = new QHBoxLayout; strip->addStretch(); previous = new QPushButton("←",this); strip->addWidget(previous);
@@ -49,7 +51,7 @@ public:
const bool full=!image.isNull(); if (!full) image=manager->galleryImage(selected);
if (image.cacheKey()!=displayed) { viewer->loadImage(image); displayed=image.cacheKey(); }
if (full) status->setText(QString("%1 / %2").arg(index+1).arg(files.size()));
else if (!image.isNull()) status->setText(tr("Loading original…"));
else if (!image.isNull()) status->setText(text("Loading original…"));
for (int i=0;i<5;i++) {
const int item=index+i-2; const bool valid=item>=0 && item<files.size(); previews[i]->setEnabled(valid);
previews[i]->setIcon(valid ? QIcon(QPixmap::fromImage(manager->galleryImage(files[item]))) : QIcon());