From b9079e005b21c516c1b809044f24edf8830a881b Mon Sep 17 00:00:00 2001 From: Jon Beniston Date: Sat, 29 Jun 2024 11:52:34 +0100 Subject: [PATCH] APT Demod: Check filename suffix is specified --- plugins/channelrx/demodapt/aptdemodgui.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/plugins/channelrx/demodapt/aptdemodgui.cpp b/plugins/channelrx/demodapt/aptdemodgui.cpp index 2cf848bda..079600216 100644 --- a/plugins/channelrx/demodapt/aptdemodgui.cpp +++ b/plugins/channelrx/demodapt/aptdemodgui.cpp @@ -504,9 +504,18 @@ void APTDemodGUI::on_saveImage_clicked() QStringList fileNames = fileDialog.selectedFiles(); if (fileNames.size() > 0) { - qDebug() << "APT: Saving image to " << fileNames; - if (!m_image.save(fileNames[0])) { - QMessageBox::critical(this, "APT Demodulator", QString("Failed to save image to %1").arg(fileNames[0])); + QFileInfo fileInfo(fileNames[0]); + + if (fileInfo.suffix() != "") + { + qDebug() << "APT: Saving image to " << fileNames; + if (!m_image.save(fileNames[0])) { + QMessageBox::critical(this, "APT Demodulator", QString("Failed to save image to %1").arg(fileNames[0])); + } + } + else + { + QMessageBox::critical(this, "APT Demodulator", QString("Please specify a filename with an extension such as .png or .jpg")); } } }