Skip to content

Commit

Permalink
Add dlf file extension when saving filter (#567)
Browse files Browse the repository at this point in the history
Signed-off-by: Viktor Kopp <[email protected]>
  • Loading branch information
vifactor authored Oct 17, 2024
1 parent e150401 commit 05d05cb
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6795,16 +6795,24 @@ void MainWindow::filterAdd()

void MainWindow::on_action_menuFilter_Save_As_triggered()
{

QString fileName = QFileDialog::getSaveFileName(this,
tr("Save DLT Filters"), workingDirectory.getDlfDirectory(), tr("DLT Filter File (*.dlf);;All files (*.*)"));

if(!fileName.isEmpty())
{
workingDirectory.setDlfDirectory(QFileInfo(fileName).absolutePath());
if(!project.SaveFilter(fileName))
QMessageBox::critical(0, QString("DLT Viewer"),QString("Save DLT Filter file failed!"));
if(fileName.isEmpty())
return;

const QFileInfo fileInfo(fileName);

workingDirectory.setDlfDirectory(fileInfo.absolutePath());

if (const auto extension = fileInfo.suffix(); extension.isEmpty()) {
fileName.append(".dlf");
}

if(project.SaveFilter(fileName)) {
setCurrentFilters(fileName);
} else {
QMessageBox::critical(0, "DLT Viewer", "Save DLT Filter file failed!");
}
}

Expand Down

0 comments on commit 05d05cb

Please sign in to comment.