!69 fix wallpaper bug and add wallpaper init copy

Merge pull request !69 from likehomedream/plymouthshow
This commit is contained in:
KevinDuan 2023-12-06 03:21:16 +00:00 committed by Gitee
commit a3a92b037d
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
9 changed files with 18 additions and 10 deletions

View File

@ -93,6 +93,7 @@ RESOURCES += \
resource.qrc
DISTFILES += \
resource/background/1-openkylin.jpg \
translation/themebuilder_en_US.qm \
translation/themebuilder_zh_CN.qm

View File

@ -42,7 +42,6 @@
<file>resource/systemicons/kylin-settings-security.png</file>
<file>resource/systemicons/kylin-settings-system.png</file>
<file>resource/systemicons/kylin-settings-update.png</file>
<file>resource/background/1-warty-final-ubuntukylin.jpg</file>
<file>resource/time-cursor/left_ptr_watch_1.png</file>
<file>resource/background/controlcenter-light.png</file>
<file>resource/background/controlcenter-dark.png</file>
@ -221,5 +220,6 @@
<file>resource/plymouth/2.png</file>
<file>resource/plymouth/1.png</file>
<file>resource/background/custom-preview.png</file>
<file>resource/background/1-openkylin.jpg</file>
</qresource>
</RCC>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 MiB

View File

@ -18,8 +18,11 @@ 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->copyPictoCacheDir(m_wallpaperpath,QDir::homePath()+"/.cache/theme-build/"
+m_time+"/src/globalTheme","wallpaper");
}
void Bridge::coverPathChanged(QString path)
@ -140,6 +143,8 @@ void Bridge::createConfig()
+ m_time + "/src/globalTheme/");
m_configfilemanager->copyPictoCacheDir(m_coverpath,QDir::homePath()+"/.cache/theme-build/"
+m_time+"/src/globalTheme","cover");
m_configfilemanager->copyPictoCacheDir(m_wallpaperpath,QDir::homePath()+"/.cache/theme-build/"
+m_time+"/src/globalTheme","wallpaper");
}
void Bridge::createGrub()

View File

@ -48,8 +48,8 @@ private:
QMap<QString, QString> *m_cursorpathmap = nullptr;
QMap<QString, QString> *m_timecursorpathmap = nullptr;
QString m_wallpaperpath = ":/resource/background/1-warty-final-ubuntukylin.jpg";
QString m_coverpath = ":/resource/background/background-light.png";
QString m_wallpaperpath = ":/resource/background/1-openkylin.jpg";
QString m_coverpath = ":/resource/background/custom-preview.png";
QString m_plymouthpath = ":/resource/background/openKylin.svg";
QString m_plymouthdir = ":/resource/plymouth/";
QString m_grubpath = ":/resource/background/1-warty-final-ubuntukylin.jpg";

View File

@ -487,10 +487,12 @@ void ConfigFileManager::copyPictoCacheDir(const QString &destinationFilePath, QD
targetFileName = "preview." + sourceFileExt;
}else if (type == "grub"){
targetFileName = "background." + sourceFileExt;
}else if (type == "wallpaper"){
targetFileName = "1-openkylin." + sourceFileExt;
}
QString targetFilePath = cachedir.filePath(targetFileName);
QFile::remove(targetFilePath);
if (!QFile::copy(sourceFilePath, targetFilePath))
{

View File

@ -65,8 +65,8 @@ void GlobalThemeWidget::refresh()
this->setAccentColor("#3790FA");
this->setWindowRadius(6);
this->setTransparency(65);
this->setCover(":/resource/background/background-glazing.png");
this->setWallpaper(":/resource/background/background-light.png");
this->setCover(":/resource/background/custom-preview.png");
this->setWallpaper(":/resource/background/1-openkylin.jpg");
m_preview->updateWallpaper(":/resource/background/background-light.png");
m_preview->updatescale1();
}
@ -201,7 +201,7 @@ void GlobalThemeWidget::initCoverWidget()
QPixmap pixmap(":/resource/background/custom-preview.png");
m_coverbtn->setIcon(QIcon(pixmap));
m_coverbtn->setIconSize(QSize(130,80));
emit newCoverFilePath("/usr/share/backgrounds/ubuntukylin-default-settings.jpg");
emit newCoverFilePath(":/resource/background/custom-preview.png");
});
layout->addStretch(1);
layout->addWidget(title);
@ -259,10 +259,10 @@ void GlobalThemeWidget::initWallPaperWidget()
});
connect(wallpaperbtn,&EditButton::deleteCustomPic,this,[=](){
m_preview->updateWallpaper(":/resource/background/background-light.png");
QPixmap pixmap(":/resource/background/background-light.png");
QPixmap pixmap(":/resource/background/1-openkylin.jpg");
wallpaperbtn->setIcon(QIcon(pixmap));
wallpaperbtn->setIconSize(QSize(130,80));
emit newWallpaperFilePath("/usr/share/backgrounds/ubuntukylin-default-settings.jpg");
emit newWallpaperFilePath(":/resource/background/1-openkylin.jpg");
});
layout->addStretch(1);

View File

@ -117,7 +117,7 @@ void PlymouthThemeWidget::initEditWidget()
}
}
else{
QString newFilePath = QFileDialog::getOpenFileName(this, tr("Select MP4 file"), "", tr("MP4 file (*.svg *.png *.gif *.mp4)"));
QString newFilePath = QFileDialog::getOpenFileName(this, tr("Select MP4 file"), "", tr("MP4 file (*.mp4)"));
if (!newFilePath.isEmpty()) {
QPixmap pixmap(newFilePath);
pixmap = pixmap.scaled(64,64, Qt::KeepAspectRatio);