From 12f5239900eba947a9c3164095a03d5794e925a5 Mon Sep 17 00:00:00 2001 From: EinTim23 Date: Wed, 6 Nov 2024 13:07:31 +0100 Subject: [PATCH] windows app icon finished --- src/main.cpp | 8 +++++--- win/app_icon.rc | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 4854874..7a6a90b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -164,11 +164,12 @@ protected: wxCheckBox* autostartCheckbox; public: - PlayerLinkFrame(wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, + PlayerLinkFrame(wxWindow* parent, wxIcon& icon, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize(300, 200), long style = wxDEFAULT_FRAME_STYLE & ~wxRESIZE_BORDER & ~wxMAXIMIZE_BOX) : wxFrame(parent, id, title, pos, size, style) { this->SetSizeHints(wxDefaultSize, wxDefaultSize); + this->SetIcon(icon); wxBoxSizer* mainContainer; mainContainer = new wxBoxSizer(wxVERTICAL); @@ -267,7 +268,8 @@ public: this->SetAppearance(wxAppBase::Appearance::Dark); wxInitAllImageHandlers(); - PlayerLinkFrame* frame = new PlayerLinkFrame(nullptr, wxID_ANY, _("PlayerLink")); + wxIcon icon = utils::loadIconFromMemory(icon_png, icon_png_size); + PlayerLinkFrame* frame = new PlayerLinkFrame(nullptr, icon, wxID_ANY, _("PlayerLink")); trayIcon = new PlayerLinkIcon(frame); frame->Bind(wxEVT_CLOSE_WINDOW, [=](wxCloseEvent& event) { if (event.CanVeto()) { @@ -276,7 +278,7 @@ public: } else std::exit(0); }); - wxIcon icon = utils::loadIconFromMemory(icon_png, icon_png_size); + trayIcon->SetIcon(icon, _("PlayerLink")); return true; } diff --git a/win/app_icon.rc b/win/app_icon.rc index cfc93e2..14d43bd 100644 --- a/win/app_icon.rc +++ b/win/app_icon.rc @@ -1 +1 @@ -IDI_ICON1 ICON "win/icon.ico" \ No newline at end of file +IDI_ICON1 ICON "icon.ico" \ No newline at end of file