From 7efaa2ed68903a5361cfe88421b9090f786f6cd1 Mon Sep 17 00:00:00 2001 From: Kevin Ottens Date: Thu, 8 Oct 2020 17:39:24 +0200 Subject: [PATCH] Fix the secure lock label aspect Make sure we got a fixed size for that label. Also ensure that the pixmap we display there is properly scaled to fit while maintaining the aspect ratio. Signed-off-by: Kevin Ottens --- src/gui/wizard/owncloudsetupnocredspage.ui | 8 +++++++- src/gui/wizard/owncloudsetuppage.cpp | 17 +++++++++-------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/src/gui/wizard/owncloudsetupnocredspage.ui b/src/gui/wizard/owncloudsetupnocredspage.ui index bad3323d3..e158cc19c 100644 --- a/src/gui/wizard/owncloudsetupnocredspage.ui +++ b/src/gui/wizard/owncloudsetupnocredspage.ui @@ -221,11 +221,17 @@ - + 0 0 + + + 24 + 24 + + diff --git a/src/gui/wizard/owncloudsetuppage.cpp b/src/gui/wizard/owncloudsetuppage.cpp index 428f18a03..f286eebc1 100644 --- a/src/gui/wizard/owncloudsetuppage.cpp +++ b/src/gui/wizard/owncloudsetuppage.cpp @@ -175,14 +175,15 @@ void OwncloudSetupPage::slotUrlChanged(const QString &url) _ui.leUrl->setText(newUrl); } - if (!url.startsWith(QLatin1String("https://"))) { - _ui.urlLabel->setPixmap(QPixmap(Theme::hidpiFileName(":/client/theme/lock-http.svg"))); - _ui.urlLabel->setToolTip(tr("This URL is NOT secure as it is not encrypted.\n" - "It is not advisable to use it.")); - } else { - _ui.urlLabel->setPixmap(QPixmap(Theme::hidpiFileName(":/client/theme/lock-https.svg"))); - _ui.urlLabel->setToolTip(tr("This URL is secure. You can use it.")); - } + const auto isSecure = url.startsWith(QLatin1String("https://")); + const auto toolTip = isSecure ? tr("This URL is secure. You can use it.") + : tr("This URL is NOT secure as it is not encrypted.\n" + "It is not advisable to use it."); + const auto pixmap = isSecure ? QPixmap(Theme::hidpiFileName(":/client/theme/lock-https.svg")) + : QPixmap(Theme::hidpiFileName(":/client/theme/lock-http.svg")); + + _ui.urlLabel->setToolTip(toolTip); + _ui.urlLabel->setPixmap(pixmap.scaled(_ui.urlLabel->size(), Qt::KeepAspectRatio)); } void OwncloudSetupPage::slotUrlEditFinished() -- 2.30.2