Fixed custom icon on Windows
This commit is contained in:
parent
1ef451b1ed
commit
99debb9730
1 changed files with 12 additions and 7 deletions
|
|
@ -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;
|
||||||
}();
|
}();
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue