Merge pull request #16506 from xuzhen/master

Fix the Qt/SDL window icon path
This commit is contained in:
Henrik Rydgård
2022-12-09 11:56:35 +01:00
committed by GitHub
2 changed files with 14 additions and 0 deletions
+8
View File
@@ -5,6 +5,7 @@
#include <QApplication>
#include <QDesktopServices>
#include <QDesktopWidget>
#include <QFile>
#include <QFileDialog>
#include <QMessageBox>
@@ -26,7 +27,14 @@ MainWindow::MainWindow(QWidget *parent, bool fullscreen) :
nextState(CORE_POWERDOWN),
lastUIState(UISTATE_MENU)
{
#if defined(ASSETS_DIR)
if (QFile::exists(ASSETS_DIR "icon_regular_72.png"))
setWindowIcon(QIcon(ASSETS_DIR "icon_regular_72.png"));
else
setWindowIcon(QIcon(qApp->applicationDirPath() + "/assets/icon_regular_72.png"));
#else
setWindowIcon(QIcon(qApp->applicationDirPath() + "/assets/icon_regular_72.png"));
#endif
SetGameTitle("");
emugl = new MainUI(this);
+6
View File
@@ -773,7 +773,13 @@ int main(int argc, char *argv[]) {
SDL_SetWindowTitle(window, (app_name_nice + " " + PPSSPP_GIT_VERSION).c_str());
char iconPath[PATH_MAX];
#if defined(ASSETS_DIR)
snprintf(iconPath, PATH_MAX, "%sicon_regular_72.png", ASSETS_DIR);
if (access(iconPath, F_OK) != 0)
snprintf(iconPath, PATH_MAX, "%sassets/icon_regular_72.png", SDL_GetBasePath() ? SDL_GetBasePath() : "");
#else
snprintf(iconPath, PATH_MAX, "%sassets/icon_regular_72.png", SDL_GetBasePath() ? SDL_GetBasePath() : "");
#endif
int width = 0, height = 0;
unsigned char *imageData;
if (pngLoad(iconPath, &width, &height, &imageData) == 1) {