这是indexloc提供的服务,不要输入任何密码
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
33 changes: 33 additions & 0 deletions app/src/actioncommands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,39 @@ Status ActionCommands::exportImage()
QString exportFormat = dialog->getExportFormat();
bool useTranparency = dialog->getTransparency();

QString extension = "";
QString formatStr = exportFormat;
if (formatStr == "PNG" || formatStr == "png")
{
exportFormat = "PNG";
extension = ".png";
}
if (formatStr == "JPG" || formatStr == "jpg" || formatStr == "JPEG" || formatStr == "jpeg")
{
exportFormat = "JPG";
extension = ".jpg";
useTranparency = false; // JPG doesn't support transparency, so we have to include the background
}
if (formatStr == "TIFF" || formatStr == "tiff" || formatStr == "TIF" || formatStr == "tif")
{
exportFormat = "TIFF";
extension = ".tiff";
}
if (formatStr == "BMP" || formatStr == "bmp")
{
exportFormat = "BMP";
extension = ".bmp";
useTranparency = false;
}
if (formatStr == "WEBP" || formatStr == "webp") {
exportFormat = "WEBP";
extension = ".webp";
}
if (!filePath.endsWith(extension, Qt::CaseInsensitive))
{
filePath += extension;
}

// Export
QString sCameraLayerName = dialog->getCameraLayerName();
LayerCamera* cameraLayer = static_cast<LayerCamera*>(mEditor->layers()->findLayerByName(sCameraLayerName, Layer::CAMERA));
Expand Down
2 changes: 2 additions & 0 deletions app/src/filedialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,8 @@ QString FileDialog::saveFileFilters(FileType fileType)

bool FileDialog::hasValidSuffix(const QString& filters, const QString& filePath)
{
if (filters.isEmpty()) return true;

QString fileName = QFileInfo(filePath).fileName();
for (const QString& filter : filters.split(";;"))
{
Expand Down