2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-09-02 07:35:12 +00:00

Fixed custom icon on Windows

This commit is contained in:
RadRussianRus
2021-12-17 16:10:45 +03:00
parent 1ef451b1ed
commit 99debb9730

View File

@@ -77,10 +77,11 @@ using namespace Microsoft::WRL;
Main::Session *session, Main::Session *session,
bool smallIcon) { bool smallIcon) {
static constexpr auto kCount = 3; static constexpr auto kCount = 3;
static constexpr auto kLogoCount = 6; static constexpr auto kLogoCount = 7;
static constexpr auto kTotalCount = kLogoCount * kCount; static constexpr auto kTotalCount = kLogoCount * kCount;
static auto ScaledLogo = std::array<QImage, kTotalCount>(); static auto ScaledLogo = std::array<QImage, kTotalCount>();
static auto ScaledLogoNoMargin = std::array<QImage, kTotalCount>(); static auto ScaledLogoNoMargin = std::array<QImage, kTotalCount>();
static auto CustomIcon = QImage(cWorkingDir() + "tdata/icon.png");
struct Dimensions { struct Dimensions {
int index = 0; int index = 0;
@@ -109,9 +110,13 @@ using namespace Microsoft::WRL;
auto &scaled = smallIcon ? ScaledLogoNoMargin : ScaledLogo; auto &scaled = smallIcon ? ScaledLogoNoMargin : ScaledLogo;
auto result = [&] { auto result = [&] {
auto &image = scaled[cCustomAppIcon() * kCount + d.index]; const auto idx = CustomIcon.isNull() ? cCustomAppIcon() : kLogoCount - 1;
auto &image = scaled[idx * kCount + d.index];
if (image.isNull()) { if (image.isNull()) {
image = (smallIcon image = !CustomIcon.isNull()
? CustomIcon.scaledToWidth(d.size, Qt::SmoothTransformation)
: (smallIcon
? Window::LogoNoMargin(cCustomAppIcon()) ? Window::LogoNoMargin(cCustomAppIcon())
: Window::Logo(cCustomAppIcon())).scaledToWidth( : Window::Logo(cCustomAppIcon())).scaledToWidth(
d.size, d.size,