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 <vifactor@gmail.com>
  • Loading branch information
vifactor committed Oct 13, 2024
1 parent b461a21 commit 1452ecb
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6825,17 +6825,26 @@ 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!"));
setCurrentFilters(fileName);
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)) {
QMessageBox::critical(0, "DLT Viewer", "Save DLT Filter file failed!");
return;
}

setCurrentFilters(fileName);
}


Expand Down

0 comments on commit 1452ecb

Please sign in to comment.