From 526a633b61a007bbbacd8b6310edd9cb9affef82 Mon Sep 17 00:00:00 2001 From: liudun Date: Fri, 23 Feb 2024 15:29:35 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B1=8F=E4=BF=9D=E5=B4=A9=E6=BA=83=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- screensaver/scconfiguration.cpp | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/screensaver/scconfiguration.cpp b/screensaver/scconfiguration.cpp index 9232138..2166381 100644 --- a/screensaver/scconfiguration.cpp +++ b/screensaver/scconfiguration.cpp @@ -147,19 +147,24 @@ QString SCConfiguration::getDefaultBackground() if(ispicture(backgroundFile)) { return backgroundFile; } else { + QString defaultBackground; #ifdef KDKINFO_FOUND - char *systemName = kdk_system_get_systemName(); -#else - char *systemName = "none"; -#endif + char *systemName = nullptr; // 初始化为 nullptr + systemName = kdk_system_get_systemName(); if (systemName) { if (QString(systemName) == "openKylin") { - free(systemName); - return "/usr/share/backgrounds/1-openkylin.jpg"; + defaultBackground = "/usr/share/backgrounds/1-openkylin.jpg"; + } else { + defaultBackground = "/usr/share/backgrounds/1-warty-final-ubuntukylin.jpg"; } - free(systemName); + } else { + defaultBackground = "/usr/share/backgrounds/1-warty-final-ubuntukylin.jpg"; } - return "/usr/share/backgrounds/1-warty-final-ubuntukylin.jpg"; + free(systemName); +#else + defaultBackground = "/usr/share/backgrounds/1-openkylin.jpg"; +#endif + return defaultBackground; } }