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:
@@ -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,13 +110,17 @@ 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()
|
||||||
? Window::LogoNoMargin(cCustomAppIcon())
|
? CustomIcon.scaledToWidth(d.size, Qt::SmoothTransformation)
|
||||||
: Window::Logo(cCustomAppIcon())).scaledToWidth(
|
: (smallIcon
|
||||||
d.size,
|
? Window::LogoNoMargin(cCustomAppIcon())
|
||||||
Qt::SmoothTransformation);
|
: Window::Logo(cCustomAppIcon())).scaledToWidth(
|
||||||
|
d.size,
|
||||||
|
Qt::SmoothTransformation);
|
||||||
}
|
}
|
||||||
return image;
|
return image;
|
||||||
}();
|
}();
|
||||||
|
Reference in New Issue
Block a user