Provide scaled pixmaps by UIThemeManager

Avoid leaking the paths of the theme resource files outside of the theme support implementation.

PR #18269.
This commit is contained in:
Vladimir Golovnev 2023-01-17 09:29:00 +03:00 committed by GitHub
parent 43e059801e
commit 53cec6db09
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 33 additions and 55 deletions

View file

@ -884,11 +884,11 @@ void OptionsDialog::loadSpeedTabOptions()
const auto *pref = Preferences::instance();
const auto *session = BitTorrent::Session::instance();
m_ui->labelGlobalRate->setPixmap(Utils::Gui::scaledPixmapSvg(UIThemeManager::instance()->getIconPath(u"slow_off"_qs), this, Utils::Gui::mediumIconSize(this).height()));
m_ui->labelGlobalRate->setPixmap(UIThemeManager::instance()->getScaledPixmap(u"slow_off"_qs, Utils::Gui::mediumIconSize(this).height()));
m_ui->spinUploadLimit->setValue(session->globalUploadSpeedLimit() / 1024);
m_ui->spinDownloadLimit->setValue(session->globalDownloadSpeedLimit() / 1024);
m_ui->labelAltRate->setPixmap(Utils::Gui::scaledPixmapSvg(UIThemeManager::instance()->getIconPath(u"slow"_qs), this, Utils::Gui::mediumIconSize(this).height()));
m_ui->labelAltRate->setPixmap(UIThemeManager::instance()->getScaledPixmap(u"slow"_qs, Utils::Gui::mediumIconSize(this).height()));
m_ui->spinUploadLimitAlt->setValue(session->altGlobalUploadSpeedLimit() / 1024);
m_ui->spinDownloadLimitAlt->setValue(session->altGlobalDownloadSpeedLimit() / 1024);
@ -1769,8 +1769,8 @@ void OptionsDialog::webUIHttpsCertChanged(const Path &path)
};
m_ui->textWebUIHttpsCert->setSelectedPath(path);
m_ui->lblSslCertStatus->setPixmap(Utils::Gui::scaledPixmapSvg(UIThemeManager::instance()->getIconPath(
isCertFileValid() ? u"security-high"_qs : u"security-low"_qs), this, 24));
m_ui->lblSslCertStatus->setPixmap(UIThemeManager::instance()->getScaledPixmap(
(isCertFileValid() ? u"security-high"_qs : u"security-low"_qs), 24));
}
void OptionsDialog::webUIHttpsKeyChanged(const Path &path)
@ -1791,8 +1791,8 @@ void OptionsDialog::webUIHttpsKeyChanged(const Path &path)
};
m_ui->textWebUIHttpsKey->setSelectedPath(path);
m_ui->lblSslKeyStatus->setPixmap(Utils::Gui::scaledPixmapSvg(UIThemeManager::instance()->getIconPath(
isKeyFileValid() ? u"security-high"_qs : u"security-low"_qs), this, 24));
m_ui->lblSslKeyStatus->setPixmap(UIThemeManager::instance()->getScaledPixmap(
(isKeyFileValid() ? u"security-high"_qs : u"security-low"_qs), 24));
}
bool OptionsDialog::isWebUiEnabled() const