!73 fix some bugs
Merge pull request !73 from likehomedream/plymouthshow
This commit is contained in:
commit
bb24ad9eb8
|
@ -24,7 +24,7 @@ cursorThemeName=dark-sense
|
||||||
soundThemeName=Light-Seeking
|
soundThemeName=Light-Seeking
|
||||||
|
|
||||||
[wallpaper]
|
[wallpaper]
|
||||||
wallPaperPath=/usr/share/backgrounds/ubuntukylin-default-settings.jpg
|
wallPaperPath=/usr/share/backgrounds/1-openkylin.jpg
|
||||||
|
|
||||||
[effect]
|
[effect]
|
||||||
supportBlur=true
|
supportBlur=true
|
||||||
|
|
|
@ -72,7 +72,7 @@ void buildCheckWidget::buildForGlobal(){
|
||||||
qDebug() << "Name field not found.";
|
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";
|
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");
|
QDir directory(QDir::homePath() + "/.cache/theme-build/" + FileProcess::g_themeENName + "/src/globalTheme");
|
||||||
QStringList fileList = directory.entryList(QDir::Files);
|
QStringList fileList = directory.entryList(QDir::Files);
|
||||||
|
|
|
@ -19,8 +19,8 @@ Bridge *Bridge::getInstance(QObject *parent)
|
||||||
void Bridge::wallpaperPathChanged(QString path)
|
void Bridge::wallpaperPathChanged(QString path)
|
||||||
{
|
{
|
||||||
m_wallpaperpath = path;
|
m_wallpaperpath = path;
|
||||||
m_configfilemanager->modifyWallPaperConf(path,QDir::homePath() + "/.cache/theme-build/"
|
// m_configfilemanager->modifyWallPaperConf(path,QDir::homePath() + "/.cache/theme-build/"
|
||||||
+m_time + "/src/globalTheme/theme.conf");
|
// +m_time + "/src/globalTheme/theme.conf");
|
||||||
m_configfilemanager->copyPictoCacheDir(m_wallpaperpath,QDir::homePath()+"/.cache/theme-build/"
|
m_configfilemanager->copyPictoCacheDir(m_wallpaperpath,QDir::homePath()+"/.cache/theme-build/"
|
||||||
+m_time+"/src/globalTheme","wallpaper");
|
+m_time+"/src/globalTheme","wallpaper");
|
||||||
}
|
}
|
||||||
|
|
|
@ -242,10 +242,13 @@ bool ConfigFileManager::modifyWallPaperConf(QString wallpaperpath,QString confFi
|
||||||
QString content = in.readAll();
|
QString content = in.readAll();
|
||||||
file.close();
|
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) {
|
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);
|
content.replace(startIndex, content.indexOf('\n', startIndex) - startIndex, substr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -156,34 +156,19 @@ void HistoryInfoLoad::getRadius()
|
||||||
*/
|
*/
|
||||||
void HistoryInfoLoad::getWallpaper()
|
void HistoryInfoLoad::getWallpaper()
|
||||||
{
|
{
|
||||||
QString filePath = m_historyInfo.filepath + "/src/globalTheme/theme.conf";
|
QDir folder(m_historyInfo.filepath + "/src/globalTheme");
|
||||||
// 读取文件内容
|
QStringList filters;
|
||||||
QFile file(filePath);
|
filters << "*.png" << "*.jpg";
|
||||||
if (!file.open(QIODevice::ReadWrite | QIODevice::Text)) {
|
folder.setNameFilters(filters);
|
||||||
qDebug() << "无法打开文件:" << filePath;
|
QStringList fileList = folder.entryList();
|
||||||
return;
|
|
||||||
|
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -142,7 +142,7 @@ void HistoryWidget::updateHistoryDir()
|
||||||
QVBoxLayout *alllayout = qobject_cast<QVBoxLayout*>(this->layout());
|
QVBoxLayout *alllayout = qobject_cast<QVBoxLayout*>(this->layout());
|
||||||
if (alllayout) {
|
if (alllayout) {
|
||||||
// 删除原来的widget
|
// 删除原来的widget
|
||||||
while (QWidget* w = alllayout->takeAt(0)->widget()) { // 从索引0开始,因删除了所有的widget
|
while (QWidget* w = alllayout->takeAt(1)->widget()) { // 从索引0开始,因删除了所有的widget
|
||||||
delete w;
|
delete w;
|
||||||
}
|
}
|
||||||
alllayout->addWidget(widget);
|
alllayout->addWidget(widget);
|
||||||
|
|
|
@ -176,9 +176,17 @@ void PlymouthThemeWidget::eidtInitWidget(const HistoryInfo &InfoData)
|
||||||
m_preview->updatePlymouth(imagedirpath);
|
m_preview->updatePlymouth(imagedirpath);
|
||||||
m_preview->showPlymouth();
|
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");
|
QPixmap pixmap(InfoData.filepath+"/src/plymouthTheme/40.png");
|
||||||
pixmap = pixmap.scaled(64,64, Qt::KeepAspectRatio);
|
pixmap = pixmap.scaled(64,64, Qt::KeepAspectRatio);
|
||||||
m_customLabel->setPixmap(pixmap);
|
m_customLabel->setPixmap(pixmap);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlymouthThemeWidget::refresh()
|
void PlymouthThemeWidget::refresh()
|
||||||
|
|
Loading…
Reference in New Issue