Keep profile controls consistent with the saved avatar server

This commit is contained in:
evgeny committed 2026-10-06 12:56:20 +02:00
1 parent 5276cd0fa0
commit 6d3187db57
3 files changed
+9 -5

No files matched your search

+4 -3
View File
@@ -101,13 +101,14 @@ SettingsDialog::SettingsDialog(const QString& configPath, DbManager* db, UtunNod
note->setWordWrap(true); box->addWidget(preview); box->addWidget(server);
buttons->addWidget(upload); buttons->addWidget(clear); box->addLayout(buttons); box->addWidget(status); box->addWidget(note);
profLayout->addRow(QCoreApplication::translate("ChatGui", "Avatar:"), controls);
auto update = [avatars, server, preview, upload] {
const quint64 selected = server->currentData().toULongLong(); server->clear();
auto update = [avatars, server, preview, upload, clear] {
const quint64 selected = server->count() ? server->currentData().toULongLong() : avatars->defaultServer(); server->clear();
const auto servers = avatars->servers();
for (auto it = servers.begin(); it != servers.end(); ++it)
server->addItem(QString("%1 · %2").arg(it.value(), QString::number(it.key(), 16)), QVariant::fromValue(it.key()));
int index = server->findData(QVariant::fromValue(selected)); if (index >= 0) server->setCurrentIndex(index);
upload->setEnabled(server->count() && gui_bridge_is_uasync_ready());
upload->setEnabled(avatars->ready() && server->count() && gui_bridge_is_uasync_ready());
clear->setEnabled(avatars->ready() && gui_bridge_is_uasync_ready());
const QImage image = avatars->defaultImage();
preview->setPixmap(image.isNull() ? QPixmap() : QPixmap::fromImage(image).scaled(64, 64, Qt::KeepAspectRatio, Qt::SmoothTransformation));
if (image.isNull()) preview->setText(QCoreApplication::translate("ChatGui", "No avatar"));