FIX Exiting without selecting an imported clip will be prompted

This commit is contained in:
likehomedream 2023-11-20 16:05:19 +08:00
parent ba2c2f42c6
commit f51c02e9f8
2 changed files with 22 additions and 18 deletions

View File

@ -138,12 +138,13 @@ void GlobalThemeWidget::initCoverWidget()
connect(m_coverbtn, &QPushButton::clicked, this, [=]() {
QString newFilePath = QFileDialog::getOpenFileName(this, tr("Select picture file"), "", tr("Picture file (*.png *.jpg)"));
bool legalFile = FileCheck::isLegalWallPaperFile(newFilePath,"cover");
if (newFilePath.isEmpty() || !legalFile) {
if (newFilePath.isEmpty()) {
newFilePath = m_coverpath;
}else{
if(!FileCheck::isLegalWallPaperFile(newFilePath,"cover")){
newFilePath = m_coverpath;
}
}
m_coverpath = newFilePath;
m_coverbtn->setIcon(QIcon(m_coverpath));
m_coverbtn->setIconSize(m_coverbtn->size());
@ -185,14 +186,16 @@ void GlobalThemeWidget::initWallPaperWidget()
connect(wallpaperbtn, &QPushButton::clicked, this, [=]() {
QString newFilePath = QFileDialog::getOpenFileName(this, tr("Select picture file"), "", tr("Picture file (*.png *.jpg)"));
if (!newFilePath.isEmpty() && FileCheck::isLegalWallPaperFile(newFilePath,"wallpaper")) {
updateWallpaperFilePath(newFilePath);
emit wallpaperupdate(newFilePath);
emit newWallpaperFilePath(newFilePath);
if (!newFilePath.isEmpty()) {
if(FileCheck::isLegalWallPaperFile(newFilePath,"wallpaper")){
updateWallpaperFilePath(newFilePath);
emit wallpaperupdate(newFilePath);
emit newWallpaperFilePath(newFilePath);
QPixmap pixmap(newFilePath);
wallpaperbtn->setIcon(QIcon(pixmap));
wallpaperbtn->setIconSize(wallpaperbtn->size());
QPixmap pixmap(newFilePath);
wallpaperbtn->setIcon(QIcon(pixmap));
wallpaperbtn->setIconSize(wallpaperbtn->size());
}
} else {
qDebug() << "Selected file path:" << newFilePath;
updateWallpaperFilePath(m_wallpaperpath);

View File

@ -61,13 +61,14 @@ void GrubThemeWidget::initEditWidget()
connect(showBtn, &QPushButton::clicked, this, [=]() {
QString newFilePath = QFileDialog::getOpenFileName(this, tr("Select picture file"), "", tr("Picture file (*.png *.jpg)"));
if (!newFilePath.isEmpty()/* && FileCheck::isLegalWallPaperFile(newFilePath,"wallpaper")*/) {
m_preview->updateBackground(newFilePath);
QPixmap pixmap(newFilePath);
showBtn->setIcon(QIcon(pixmap));
showBtn->setIconSize(showBtn->size());
emit newGrubFilePath(newFilePath);
if (!newFilePath.isEmpty()) {
if(FileCheck::isLegalWallPaperFile(newFilePath,"wallpaper")){
m_preview->updateBackground(newFilePath);
QPixmap pixmap(newFilePath);
showBtn->setIcon(QIcon(pixmap));
showBtn->setIconSize(showBtn->size());
emit newGrubFilePath(newFilePath);
}
} else {
qDebug() << "Selected file path:" << newFilePath;