Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/service/filehander.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -716,8 +716,14 @@ bool FileHander::saveToImage(PageContext *context, const QString &file, const QS
QImageWriter w(file, stuff.toLocal8Bit());
w.setCompression(1);
return w.write(image);
} else
return image.save(file, stuff.toLocal8Bit(), imageQuility);
} else {
bool ret = image.save(file, stuff.toLocal8Bit(), imageQuility);
if (!ret) {
qWarning() << "save image:" << file << "FAILED!";
d_pri()->setError(EUnSupportFile, tr("Unable to save \"%1\", unsupported file format").arg(info.fileName()));
}
return ret;
}
}
return false;
}
Expand Down
6 changes: 6 additions & 0 deletions src/widgets/dialog/cexportimagedialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,9 @@ void CExportImageDialog::initUI()
setWgtAccesibleName(m_formatCombox, "Export format comboBox");
auto writeableFormats = drawApp->writableFormatNameFilters();
writeableFormats.removeAt(0);
// 移除不支持的格式,避免显示出来误导用户
writeableFormats.removeAll("AVIF(*.avif)");
writeableFormats.removeAll("HEIC(*.heic *.heif)");
m_formatCombox->addItems(writeableFormats);

m_qualitySlider = new DSlider(Qt::Horizontal, this);
Expand Down Expand Up @@ -390,6 +393,9 @@ void CExportImageDialog::showEvent(QShowEvent *event)
int index = drawApp->writableFormatNameFilters().indexOf(formatFilter);
if (index != -1) {
--index;
if (index >= m_formatCombox->count()) {
index = 0;
}
} else {
index = 0;
}
Expand Down
5 changes: 5 additions & 0 deletions translations/deepin-draw_zh_CN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,11 @@
<source>Damaged file, unable to open it</source>
<translation>文件已损坏,无法打开</translation>
</message>
<message>
<location filename="../src/service/filehander.cpp" line="723"/>
<source>Unable to save &quot;%1&quot;, unsupported file format</source>
<translation>不支持“%1”的文件格式,无法保存</translation>
</message>
<message>
<location filename="../src/service/filehander.cpp" line="727"/>
<location filename="../src/service/filehander.cpp" line="867"/>
Expand Down
Loading