diff --git a/resource/config/theme.conf b/resource/config/theme.conf index 11223d1..7c247f7 100644 --- a/resource/config/theme.conf +++ b/resource/config/theme.conf @@ -24,7 +24,7 @@ cursorThemeName=dark-sense soundThemeName=Light-Seeking [wallpaper] -wallPaperPath=/usr/share/backgrounds/ubuntukylin-default-settings.jpg +wallPaperPath=/usr/share/backgrounds/1-openkylin.jpg [effect] supportBlur=true diff --git a/src/build/buildcheckwidget.cpp b/src/build/buildcheckwidget.cpp index 8a1b92a..c2ad9ad 100644 --- a/src/build/buildcheckwidget.cpp +++ b/src/build/buildcheckwidget.cpp @@ -72,7 +72,7 @@ void buildCheckWidget::buildForGlobal(){ qDebug() << "Name field not found."; } - QString m_themeWallpaper = "wallPaperPath=/usr/share/backgrounds/ubuntukylin-default-settings.jpg"; + QString m_themeWallpaper = "wallPaperPath=/usr/share/backgrounds/1-openkylin.jpg"; QString m_themeNewWallpaper = "wallPaperPath=/usr/share/config/globaltheme/"+FileProcess::g_themeENName+"/1-openkylin.png"; QDir directory(QDir::homePath() + "/.cache/theme-build/" + FileProcess::g_themeENName + "/src/globalTheme"); QStringList fileList = directory.entryList(QDir::Files); diff --git a/src/fileProcess/bridge.cpp b/src/fileProcess/bridge.cpp index bb7f283..b4c887e 100644 --- a/src/fileProcess/bridge.cpp +++ b/src/fileProcess/bridge.cpp @@ -19,8 +19,8 @@ Bridge *Bridge::getInstance(QObject *parent) void Bridge::wallpaperPathChanged(QString path) { m_wallpaperpath = path; - m_configfilemanager->modifyWallPaperConf(path,QDir::homePath() + "/.cache/theme-build/" - +m_time + "/src/globalTheme/theme.conf"); +// m_configfilemanager->modifyWallPaperConf(path,QDir::homePath() + "/.cache/theme-build/" +// +m_time + "/src/globalTheme/theme.conf"); m_configfilemanager->copyPictoCacheDir(m_wallpaperpath,QDir::homePath()+"/.cache/theme-build/" +m_time+"/src/globalTheme","wallpaper"); } diff --git a/src/fileProcess/configfilemanager.cpp b/src/fileProcess/configfilemanager.cpp index 9e0eada..fa9c1db 100644 --- a/src/fileProcess/configfilemanager.cpp +++ b/src/fileProcess/configfilemanager.cpp @@ -242,10 +242,13 @@ bool ConfigFileManager::modifyWallPaperConf(QString wallpaperpath,QString confFi QString content = in.readAll(); file.close(); + QFile file1(wallpaperpath); + QFileInfo info(file1); + QString suffix = info.suffix(); // 修改内容 - int startIndex = content.indexOf("wallPaperPath="); + int startIndex = content.indexOf("wallPaperPath=/usr/share/backgrounds/1-openkylin."); if (startIndex != -1) { - QString substr = "wallPaperPath="+wallpaperpath; + QString substr = "wallPaperPath=/usr/share/backgrounds/1-openkylin."+suffix; content.replace(startIndex, content.indexOf('\n', startIndex) - startIndex, substr); } diff --git a/src/fileProcess/historyinfoload.cpp b/src/fileProcess/historyinfoload.cpp index eb4d11a..d74b475 100644 --- a/src/fileProcess/historyinfoload.cpp +++ b/src/fileProcess/historyinfoload.cpp @@ -156,34 +156,19 @@ void HistoryInfoLoad::getRadius() */ void HistoryInfoLoad::getWallpaper() { - QString filePath = m_historyInfo.filepath + "/src/globalTheme/theme.conf"; - // 读取文件内容 - QFile file(filePath); - if (!file.open(QIODevice::ReadWrite | QIODevice::Text)) { - qDebug() << "无法打开文件:" << filePath; - return; + 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"; } - - QTextStream in(&file); - QString content = in.readAll(); - file.close(); - - // 查找 wallPaperPath= 所在行的位置 - int startIndex = content.indexOf("wallPaperPath="); - if (startIndex != -1) { - int lineStartIndex = content.lastIndexOf('\n', startIndex) + 1; - int lineEndIndex = content.indexOf('\n', startIndex); - - if (lineEndIndex == -1) { - lineEndIndex = content.size(); - } - - QString lineContent = content.mid(lineStartIndex, lineEndIndex - lineStartIndex).trimmed(); - lineContent.remove("wallPaperPath="); - - m_historyInfo.wallpaperpath = lineContent; - } - } /** diff --git a/src/module/historywidget.cpp b/src/module/historywidget.cpp index 211d6a0..3d70eef 100644 --- a/src/module/historywidget.cpp +++ b/src/module/historywidget.cpp @@ -142,7 +142,7 @@ void HistoryWidget::updateHistoryDir() QVBoxLayout *alllayout = qobject_cast(this->layout()); if (alllayout) { // 删除原来的widget - while (QWidget* w = alllayout->takeAt(0)->widget()) { // 从索引0开始,因删除了所有的widget + while (QWidget* w = alllayout->takeAt(1)->widget()) { // 从索引0开始,因删除了所有的widget delete w; } alllayout->addWidget(widget); diff --git a/src/module/plymouththemewidget.cpp b/src/module/plymouththemewidget.cpp index e784496..9df782d 100644 --- a/src/module/plymouththemewidget.cpp +++ b/src/module/plymouththemewidget.cpp @@ -176,9 +176,17 @@ void PlymouthThemeWidget::eidtInitWidget(const HistoryInfo &InfoData) m_preview->updatePlymouth(imagedirpath); m_preview->showPlymouth(); + //加载图像文件,判断是否进行修改 + QImage image1(InfoData.filepath+"/src/plymouthTheme/1.png"); + QImage image2(":/resource/plymouth/1.png"); + + if (image1 == image2) { + m_customLabel->setPixmap(QPixmap()); + } else { QPixmap pixmap(InfoData.filepath+"/src/plymouthTheme/40.png"); pixmap = pixmap.scaled(64,64, Qt::KeepAspectRatio); m_customLabel->setPixmap(pixmap); + } } void PlymouthThemeWidget::refresh()