APT Demod: Check filename suffix is specified

pull/2190/head
Jon Beniston 2024-06-29 11:52:34 +01:00
rodzic 97193ef34d
commit b9079e005b
1 zmienionych plików z 12 dodań i 3 usunięć

Wyświetl plik

@ -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"));
}
}
}