Skip to content

Commit

Permalink
Add dlf file extension when saving filter
Browse files Browse the repository at this point in the history
Signed-off-by: Viktor Kopp <[email protected]>
  • Loading branch information
vifactor committed Oct 14, 2024
1 parent 7a6700e commit 3c79789
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 3c79789

Please sign in to comment.