Skip to content

Commit

Permalink
APT Demod: Check filename suffix is specified
Browse files Browse the repository at this point in the history
  • Loading branch information
srcejon committed Jun 29, 2024
1 parent 97193ef commit b9079e0
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions plugins/channelrx/demodapt/aptdemodgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
}
}
}
Expand Down

0 comments on commit b9079e0

Please sign in to comment.