Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add dlf file extension when saving filter #567

Merged
merged 1 commit into from
Oct 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading