fix wallpaper error
This commit is contained in:
parent
9a499cde87
commit
09a684785e
|
@ -170,6 +170,7 @@ void HistoryInfoLoad::getWallpaper()
|
||||||
|
|
||||||
// 查找 wallPaperPath= 所在行的位置
|
// 查找 wallPaperPath= 所在行的位置
|
||||||
int startIndex = content.indexOf("wallPaperPath=");
|
int startIndex = content.indexOf("wallPaperPath=");
|
||||||
|
QString configwallpath;
|
||||||
if (startIndex != -1) {
|
if (startIndex != -1) {
|
||||||
int lineStartIndex = content.lastIndexOf('\n', startIndex) + 1;
|
int lineStartIndex = content.lastIndexOf('\n', startIndex) + 1;
|
||||||
int lineEndIndex = content.indexOf('\n', startIndex);
|
int lineEndIndex = content.indexOf('\n', startIndex);
|
||||||
|
@ -181,9 +182,27 @@ void HistoryInfoLoad::getWallpaper()
|
||||||
QString lineContent = content.mid(lineStartIndex, lineEndIndex - lineStartIndex).trimmed();
|
QString lineContent = content.mid(lineStartIndex, lineEndIndex - lineStartIndex).trimmed();
|
||||||
lineContent.remove("wallPaperPath=");
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue