diff --git a/src/fileProcess/historyinfoload.cpp b/src/fileProcess/historyinfoload.cpp index eb4d11a..4339223 100644 --- a/src/fileProcess/historyinfoload.cpp +++ b/src/fileProcess/historyinfoload.cpp @@ -170,6 +170,7 @@ void HistoryInfoLoad::getWallpaper() // 查找 wallPaperPath= 所在行的位置 int startIndex = content.indexOf("wallPaperPath="); + QString configwallpath; if (startIndex != -1) { int lineStartIndex = content.lastIndexOf('\n', startIndex) + 1; int lineEndIndex = content.indexOf('\n', startIndex); @@ -181,9 +182,27 @@ void HistoryInfoLoad::getWallpaper() QString lineContent = content.mid(lineStartIndex, lineEndIndex - lineStartIndex).trimmed(); lineContent.remove("wallPaperPath="); - m_historyInfo.wallpaperpath = lineContent; + configwallpath = lineContent; } + QFile file1(configwallpath); + if(!file1.exists()){ + QDir folder(m_historyInfo.filepath + "/src/globalTheme"); + QStringList filters; + filters << "*.png" << "*.jpg"; + folder.setNameFilters(filters); + QStringList fileList = folder.entryList(); + + if(fileList.contains("1-openkylin.png")){ + m_historyInfo.wallpaperpath = m_historyInfo.filepath + "/src/globalTheme/1-openkylin.png"; + } else if (fileList.contains("1-openkylin.jpg")){ + m_historyInfo.wallpaperpath = m_historyInfo.filepath + "/src/globalTheme/1-openkylin.jpg"; + } else { + qDebug()<<"wallpaper file is null"; + } + }else{ + m_historyInfo.wallpaperpath = configwallpath; + } } /**