!129 fix some errors

Merge pull request !129 from likehomedream/UIFIX
This commit is contained in:
likehomedream 2024-05-25 01:49:46 +00:00 committed by Gitee
commit 54c638837a
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
6 changed files with 111 additions and 89 deletions

View File

@ -95,6 +95,10 @@ bool FileCheck::isLegalWallPaperFile(const QString& filePath, const QString& typ
qint64 fileSize = fileInfo.size();
if (type == "wallpaper") {
if(fileInfo.suffix()!="png"){
QMessageBox::information(nullptr, tr("error"), tr("The file is not a jpg"));
return false;
}
if (imageSize.width() != 3840 || imageSize.height() != 2160){
QMessageBox::information(nullptr, tr("error"), tr("The wallpaper size must be 3840x2160"));
return false;
@ -104,11 +108,11 @@ bool FileCheck::isLegalWallPaperFile(const QString& filePath, const QString& typ
QMessageBox::information(nullptr, tr("error"), tr("The file size cannot exceed 10MB"));
return false;
}
if(fileInfo.suffix()!="jpg"){
QMessageBox::information(nullptr, tr("error"), tr("The file is not a jpg"));
} else if (type == "cover") {
if(fileInfo.suffix()!="png"){
QMessageBox::information(nullptr, tr("error"), tr("The file is not a png"));
return false;
}
} else if (type == "cover") {
if (imageSize.width() != 1640 || imageSize.height() != 1080){
QMessageBox::information(nullptr, tr("error"), tr("Cover size must be 1640x1080"));
return false;
@ -119,6 +123,10 @@ bool FileCheck::isLegalWallPaperFile(const QString& filePath, const QString& typ
return false;
}
} else if (type == "grub") {
if(fileInfo.suffix()!="png"){
QMessageBox::information(nullptr, tr("error"), tr("The file is not a png"));
return false;
}
if (imageSize.width() != 3840 || imageSize.height() != 2160){
QMessageBox::information(nullptr, tr("error"), tr("The wallpaper size must be 3840x2160"));
return false;
@ -128,10 +136,6 @@ bool FileCheck::isLegalWallPaperFile(const QString& filePath, const QString& typ
QMessageBox::information(nullptr, tr("error"), tr("The file size cannot exceed 10MB"));
return false;
}
if(fileInfo.suffix()!="png"){
QMessageBox::information(nullptr, tr("error"), tr("The file is not a png"));
return false;
}
}
return true;

View File

@ -326,18 +326,22 @@ void CursorThemeWidget::initRightWidget()
QString newFilePath = QFileDialog::getOpenFileName(this, tr("Select SVG file"), QDir::homePath(), tr("SVG file (*.svg)"));
// 如果用户选择了文件,且文件路径不为空
if (!newFilePath.isEmpty()) {
// 将widgetName和newFilePath插入到m_customiconpathmap中以便后续可以通过widgetName找到自定义图标路径
m_customiconpathmap->insert(widgetName, newFilePath);
// 调用m_preview的updateIcon函数更新预览图标
m_preview->updateIcon(widgetName, newFilePath);
// 设置widget的自定义图标为newFilePath指定的文件路径
clickedWidget->setcustomicon(newFilePath);
// 发出newCursorMap信号通知其他部分更新图标映射
emit newCursorMap(m_customiconpathmap);
//导入成功图标修改QMap状态true
m_themeChangeMap->insert(widgetName, true);
// 传递当前主题变化信号
emit cursorthemeChange(m_themeChangeMap);
if(FileCheck::isLegalCursorFile(newFilePath)){
// 将widgetName和newFilePath插入到m_customiconpathmap中以便后续可以通过widgetName找到自定义图标路径
m_customiconpathmap->insert(widgetName, newFilePath);
// 调用m_preview的updateIcon函数更新预览图标
m_preview->updateIcon(widgetName, newFilePath);
// 设置widget的自定义图标为newFilePath指定的文件路径
clickedWidget->setcustomicon(newFilePath);
// 发出newCursorMap信号通知其他部分更新图标映射
emit newCursorMap(m_customiconpathmap);
//导入成功图标修改QMap状态true
m_themeChangeMap->insert(widgetName, true);
// 传递当前主题变化信号
emit cursorthemeChange(m_themeChangeMap);
}else{
qDebug()<<"file is not legal";
}
}
}
}
@ -410,22 +414,24 @@ void CursorThemeWidget::initRightWidget()
// 判断选择的文件路径是否为空,如果不为空,则执行下面的代码
if (!newFilePath.isEmpty()) {
// 将选择的文件路径插入到m_timecustomiconpathmap中假设widgetName为键
m_timecustomiconpathmap->insert(widgetName, newFilePath);
if(FileCheck::isLegalCursorFile(newFilePath)){
// 将选择的文件路径插入到m_timecustomiconpathmap中假设widgetName为键
m_timecustomiconpathmap->insert(widgetName, newFilePath);
// 更新m_preview2的对应图标
m_preview2->updateIcon(widgetName, newFilePath);
// 更新m_preview2的对应图标
m_preview2->updateIcon(widgetName, newFilePath);
// 设置clickedWidget的自定义图标
clickedWidget->setcustomicon(newFilePath);
// 设置clickedWidget的自定义图标
clickedWidget->setcustomicon(newFilePath);
// 发出一个新的时间光标映射信号假设m_timecustomiconpathmap为数据源
emit newTimeCursorMap(m_timecustomiconpathmap);
// 发出一个新的时间光标映射信号假设m_timecustomiconpathmap为数据源
emit newTimeCursorMap(m_timecustomiconpathmap);
//导入成功图标修改QMap状态true
m_themeChangeMap->insert(widgetName, true);
// 传递当前主题变化信号
emit cursorthemeChange(m_themeChangeMap);
//导入成功图标修改QMap状态true
m_themeChangeMap->insert(widgetName, true);
// 传递当前主题变化信号
emit cursorthemeChange(m_themeChangeMap);
}
}
}
}

View File

@ -357,7 +357,7 @@ void GlobalThemeWidget::initWallPaperWidget()
QHBoxLayout *coverlayout = new QHBoxLayout(cover);
wallpaperbtn = new EditButton(cover,"wallpaper");
QLabel *tip = new QLabel(cover);
tip->setText("<html>*尺寸为 3840 X 2160 的 PNG 图片,<br>*大小不超过 10 MB</html>");
tip->setText("<html>*尺寸为 3840 X 2160 的 JPG 图片,<br>*大小不超过 10 MB</html>");
QPalette palette = tip->palette();
palette.setColor(QPalette::WindowText, Qt::gray);
tip->setPalette(palette);
@ -376,7 +376,7 @@ void GlobalThemeWidget::initWallPaperWidget()
connect(wallpaperbtn, &EditButton::changePic, this, [=]() {
DataCollect::sendGlobalThemeKdkDataAsync(DataCollect::g_WallPaperWidget);
QString newFilePath = QFileDialog::getOpenFileName(this, tr("Select picture file"), QDir::homePath(), tr("Picture file (*.png)"));
QString newFilePath = QFileDialog::getOpenFileName(this, tr("Select picture file"), QDir::homePath(), tr("Picture file (*.jpg)"));
if (!newFilePath.isEmpty()) {
if(FileCheck::isLegalWallPaperFile(newFilePath,"wallpaper")){

View File

@ -31,19 +31,19 @@
<name>CursorThemeWidget</name>
<message>
<location filename="../src/module/cursorthemewidget.cpp" line="326"/>
<location filename="../src/module/cursorthemewidget.cpp" line="409"/>
<location filename="../src/module/cursorthemewidget.cpp" line="413"/>
<source>Select SVG file</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/module/cursorthemewidget.cpp" line="326"/>
<location filename="../src/module/cursorthemewidget.cpp" line="409"/>
<location filename="../src/module/cursorthemewidget.cpp" line="413"/>
<source>SVG file (*.svg)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/module/cursorthemewidget.cpp" line="175"/>
<location filename="../src/module/cursorthemewidget.cpp" line="499"/>
<location filename="../src/module/cursorthemewidget.cpp" line="505"/>
<source>Start Cursor Theme Building</source>
<translation type="unfinished"></translation>
</message>
@ -53,17 +53,17 @@
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/module/cursorthemewidget.cpp" line="497"/>
<location filename="../src/module/cursorthemewidget.cpp" line="503"/>
<source>Batch addition</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/module/cursorthemewidget.cpp" line="509"/>
<location filename="../src/module/cursorthemewidget.cpp" line="515"/>
<source>Select Batch</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/module/cursorthemewidget.cpp" line="584"/>
<location filename="../src/module/cursorthemewidget.cpp" line="590"/>
<source>*The uploaded ICONS are 96 X 96 in SVG format</source>
<translation type="unfinished"></translation>
</message>
@ -86,17 +86,18 @@
<location filename="../src/fileProcess/filecheck.cpp" line="74"/>
<location filename="../src/fileProcess/filecheck.cpp" line="80"/>
<location filename="../src/fileProcess/filecheck.cpp" line="99"/>
<location filename="../src/fileProcess/filecheck.cpp" line="104"/>
<location filename="../src/fileProcess/filecheck.cpp" line="103"/>
<location filename="../src/fileProcess/filecheck.cpp" line="108"/>
<location filename="../src/fileProcess/filecheck.cpp" line="113"/>
<location filename="../src/fileProcess/filecheck.cpp" line="118"/>
<location filename="../src/fileProcess/filecheck.cpp" line="123"/>
<location filename="../src/fileProcess/filecheck.cpp" line="128"/>
<location filename="../src/fileProcess/filecheck.cpp" line="132"/>
<location filename="../src/fileProcess/filecheck.cpp" line="145"/>
<location filename="../src/fileProcess/filecheck.cpp" line="153"/>
<location filename="../src/fileProcess/filecheck.cpp" line="165"/>
<location filename="../src/fileProcess/filecheck.cpp" line="173"/>
<location filename="../src/fileProcess/filecheck.cpp" line="117"/>
<location filename="../src/fileProcess/filecheck.cpp" line="122"/>
<location filename="../src/fileProcess/filecheck.cpp" line="127"/>
<location filename="../src/fileProcess/filecheck.cpp" line="131"/>
<location filename="../src/fileProcess/filecheck.cpp" line="136"/>
<location filename="../src/fileProcess/filecheck.cpp" line="149"/>
<location filename="../src/fileProcess/filecheck.cpp" line="157"/>
<location filename="../src/fileProcess/filecheck.cpp" line="169"/>
<location filename="../src/fileProcess/filecheck.cpp" line="177"/>
<source>error</source>
<translation type="unfinished"></translation>
</message>
@ -123,50 +124,51 @@
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/fileProcess/filecheck.cpp" line="99"/>
<location filename="../src/fileProcess/filecheck.cpp" line="123"/>
<location filename="../src/fileProcess/filecheck.cpp" line="103"/>
<location filename="../src/fileProcess/filecheck.cpp" line="131"/>
<source>The wallpaper size must be 3840x2160</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/fileProcess/filecheck.cpp" line="104"/>
<location filename="../src/fileProcess/filecheck.cpp" line="128"/>
<location filename="../src/fileProcess/filecheck.cpp" line="108"/>
<location filename="../src/fileProcess/filecheck.cpp" line="136"/>
<source>The file size cannot exceed 10MB</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/fileProcess/filecheck.cpp" line="108"/>
<location filename="../src/fileProcess/filecheck.cpp" line="99"/>
<source>The file is not a jpg</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/fileProcess/filecheck.cpp" line="113"/>
<location filename="../src/fileProcess/filecheck.cpp" line="117"/>
<source>Cover size must be 1640x1080</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/fileProcess/filecheck.cpp" line="118"/>
<location filename="../src/fileProcess/filecheck.cpp" line="122"/>
<source>The file size cannot exceed 5MB</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/fileProcess/filecheck.cpp" line="132"/>
<location filename="../src/fileProcess/filecheck.cpp" line="165"/>
<location filename="../src/fileProcess/filecheck.cpp" line="113"/>
<location filename="../src/fileProcess/filecheck.cpp" line="127"/>
<location filename="../src/fileProcess/filecheck.cpp" line="169"/>
<source>The file is not a png</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/fileProcess/filecheck.cpp" line="145"/>
<location filename="../src/fileProcess/filecheck.cpp" line="149"/>
<source>The file is not a mp4</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/fileProcess/filecheck.cpp" line="153"/>
<location filename="../src/fileProcess/filecheck.cpp" line="157"/>
<source>The file size cannot exceed 1MB</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/fileProcess/filecheck.cpp" line="173"/>
<location filename="../src/fileProcess/filecheck.cpp" line="177"/>
<source>The file size cannot exceed 20KB</source>
<translation type="unfinished"></translation>
</message>
@ -186,7 +188,6 @@
</message>
<message>
<location filename="../src/module/globalthemewidget.cpp" line="289"/>
<location filename="../src/module/globalthemewidget.cpp" line="379"/>
<source>Picture file (*.png)</source>
<translation type="unfinished"></translation>
</message>
@ -195,6 +196,11 @@
<source>Desktop wallpaper</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/module/globalthemewidget.cpp" line="379"/>
<source>Picture file (*.jpg)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/module/globalthemewidget.cpp" line="457"/>
<source>Window appearance</source>

Binary file not shown.

View File

@ -31,19 +31,19 @@
<name>CursorThemeWidget</name>
<message>
<location filename="../src/module/cursorthemewidget.cpp" line="326"/>
<location filename="../src/module/cursorthemewidget.cpp" line="409"/>
<location filename="../src/module/cursorthemewidget.cpp" line="413"/>
<source>Select SVG file</source>
<translation>SVG文件</translation>
</message>
<message>
<location filename="../src/module/cursorthemewidget.cpp" line="326"/>
<location filename="../src/module/cursorthemewidget.cpp" line="409"/>
<location filename="../src/module/cursorthemewidget.cpp" line="413"/>
<source>SVG file (*.svg)</source>
<translation>SVG (*.svg)</translation>
</message>
<message>
<location filename="../src/module/cursorthemewidget.cpp" line="175"/>
<location filename="../src/module/cursorthemewidget.cpp" line="499"/>
<location filename="../src/module/cursorthemewidget.cpp" line="505"/>
<source>Start Cursor Theme Building</source>
<translation></translation>
</message>
@ -53,17 +53,17 @@
<translation></translation>
</message>
<message>
<location filename="../src/module/cursorthemewidget.cpp" line="497"/>
<location filename="../src/module/cursorthemewidget.cpp" line="503"/>
<source>Batch addition</source>
<translation></translation>
</message>
<message>
<location filename="../src/module/cursorthemewidget.cpp" line="509"/>
<location filename="../src/module/cursorthemewidget.cpp" line="515"/>
<source>Select Batch</source>
<translation></translation>
</message>
<message>
<location filename="../src/module/cursorthemewidget.cpp" line="584"/>
<location filename="../src/module/cursorthemewidget.cpp" line="590"/>
<source>*The uploaded ICONS are 96 X 96 in SVG format</source>
<translation>96 X 96 SVG</translation>
</message>
@ -86,17 +86,18 @@
<location filename="../src/fileProcess/filecheck.cpp" line="74"/>
<location filename="../src/fileProcess/filecheck.cpp" line="80"/>
<location filename="../src/fileProcess/filecheck.cpp" line="99"/>
<location filename="../src/fileProcess/filecheck.cpp" line="104"/>
<location filename="../src/fileProcess/filecheck.cpp" line="103"/>
<location filename="../src/fileProcess/filecheck.cpp" line="108"/>
<location filename="../src/fileProcess/filecheck.cpp" line="113"/>
<location filename="../src/fileProcess/filecheck.cpp" line="118"/>
<location filename="../src/fileProcess/filecheck.cpp" line="123"/>
<location filename="../src/fileProcess/filecheck.cpp" line="128"/>
<location filename="../src/fileProcess/filecheck.cpp" line="132"/>
<location filename="../src/fileProcess/filecheck.cpp" line="145"/>
<location filename="../src/fileProcess/filecheck.cpp" line="153"/>
<location filename="../src/fileProcess/filecheck.cpp" line="165"/>
<location filename="../src/fileProcess/filecheck.cpp" line="173"/>
<location filename="../src/fileProcess/filecheck.cpp" line="117"/>
<location filename="../src/fileProcess/filecheck.cpp" line="122"/>
<location filename="../src/fileProcess/filecheck.cpp" line="127"/>
<location filename="../src/fileProcess/filecheck.cpp" line="131"/>
<location filename="../src/fileProcess/filecheck.cpp" line="136"/>
<location filename="../src/fileProcess/filecheck.cpp" line="149"/>
<location filename="../src/fileProcess/filecheck.cpp" line="157"/>
<location filename="../src/fileProcess/filecheck.cpp" line="169"/>
<location filename="../src/fileProcess/filecheck.cpp" line="177"/>
<source>error</source>
<translation></translation>
</message>
@ -123,50 +124,51 @@
<translation>96x96</translation>
</message>
<message>
<location filename="../src/fileProcess/filecheck.cpp" line="99"/>
<location filename="../src/fileProcess/filecheck.cpp" line="123"/>
<location filename="../src/fileProcess/filecheck.cpp" line="103"/>
<location filename="../src/fileProcess/filecheck.cpp" line="131"/>
<source>The wallpaper size must be 3840x2160</source>
<translation>3840x2160</translation>
</message>
<message>
<location filename="../src/fileProcess/filecheck.cpp" line="104"/>
<location filename="../src/fileProcess/filecheck.cpp" line="128"/>
<location filename="../src/fileProcess/filecheck.cpp" line="108"/>
<location filename="../src/fileProcess/filecheck.cpp" line="136"/>
<source>The file size cannot exceed 10MB</source>
<translation>10MB</translation>
</message>
<message>
<location filename="../src/fileProcess/filecheck.cpp" line="108"/>
<location filename="../src/fileProcess/filecheck.cpp" line="99"/>
<source>The file is not a jpg</source>
<translation>jpg格式</translation>
</message>
<message>
<location filename="../src/fileProcess/filecheck.cpp" line="113"/>
<location filename="../src/fileProcess/filecheck.cpp" line="117"/>
<source>Cover size must be 1640x1080</source>
<translation>1640x1080</translation>
</message>
<message>
<location filename="../src/fileProcess/filecheck.cpp" line="118"/>
<location filename="../src/fileProcess/filecheck.cpp" line="122"/>
<source>The file size cannot exceed 5MB</source>
<translation>5MB</translation>
</message>
<message>
<location filename="../src/fileProcess/filecheck.cpp" line="132"/>
<location filename="../src/fileProcess/filecheck.cpp" line="165"/>
<location filename="../src/fileProcess/filecheck.cpp" line="113"/>
<location filename="../src/fileProcess/filecheck.cpp" line="127"/>
<location filename="../src/fileProcess/filecheck.cpp" line="169"/>
<source>The file is not a png</source>
<translation>png格式</translation>
</message>
<message>
<location filename="../src/fileProcess/filecheck.cpp" line="145"/>
<location filename="../src/fileProcess/filecheck.cpp" line="149"/>
<source>The file is not a mp4</source>
<translation>mp4格式</translation>
</message>
<message>
<location filename="../src/fileProcess/filecheck.cpp" line="153"/>
<location filename="../src/fileProcess/filecheck.cpp" line="157"/>
<source>The file size cannot exceed 1MB</source>
<translation>1MB</translation>
</message>
<message>
<location filename="../src/fileProcess/filecheck.cpp" line="173"/>
<location filename="../src/fileProcess/filecheck.cpp" line="177"/>
<source>The file size cannot exceed 20KB</source>
<translation>20KB</translation>
</message>
@ -190,7 +192,6 @@
</message>
<message>
<location filename="../src/module/globalthemewidget.cpp" line="289"/>
<location filename="../src/module/globalthemewidget.cpp" line="379"/>
<source>Picture file (*.png)</source>
<translation> (*.png)</translation>
</message>
@ -199,6 +200,11 @@
<source>Desktop wallpaper</source>
<translation></translation>
</message>
<message>
<location filename="../src/module/globalthemewidget.cpp" line="379"/>
<source>Picture file (*.jpg)</source>
<translation> (*.jpg)</translation>
</message>
<message>
<location filename="../src/module/globalthemewidget.cpp" line="457"/>
<source>Window appearance</source>