From 187b3b5b7f2a42a0fb196f00bdb9cec3c87adb81 Mon Sep 17 00:00:00 2001 From: splitPoleDAQ Date: Fri, 19 Jan 2024 13:29:14 -0500 Subject: [PATCH] fix on the saving setting dialog --- DigiSettingsPanel.cpp | 37 ++++++++++++++----------------------- 1 file changed, 14 insertions(+), 23 deletions(-) diff --git a/DigiSettingsPanel.cpp b/DigiSettingsPanel.cpp index eb40369..4f56cc5 100644 --- a/DigiSettingsPanel.cpp +++ b/DigiSettingsPanel.cpp @@ -4023,34 +4023,25 @@ void DigiSettingsPanel::SaveSetting(int opt){ QString filePath = QFileDialog::getSaveFileName(this, "Save Settings File", - rawDataPath, + QDir::toNativeSeparators(rawDataPath + "/" + defaultFileName), opt == 0 ? "Binary (*.bin)" : "Text file (*.txt)"); if (!filePath.isEmpty()) { - - QFileDialog dialog; - dialog.selectFile(defaultFileName); - - if( dialog.exec() == QDialog::Accepted){ - - filePath = dialog.selectedFiles().first(); - QFileInfo fileInfo(filePath); - QString ext = fileInfo.suffix(); - if( opt == 0 ){ - if( ext.isEmpty() ) filePath += ".bin"; - digi[ID]->SaveAllSettingsAsBin(filePath.toStdString().c_str()); - leSaveFilePath[ID]->setText(filePath); - } - if( opt == 1 ){ - if( ext.isEmpty() ) filePath += ".txt"; - digi[ID]->SaveAllSettingsAsText(filePath.toStdString().c_str()); - leSaveFilePath[ID]->setText(filePath + " | not loadable!!"); - } - - SendLogMsg("Saved setting file " + filePath + "."); - + QFileInfo fileInfo(filePath); + QString ext = fileInfo.suffix(); + if( opt == 0 ){ + if( ext.isEmpty() ) filePath += ".bin"; + digi[ID]->SaveAllSettingsAsBin(filePath.toStdString().c_str()); + leSaveFilePath[ID]->setText(filePath); } + if( opt == 1 ){ + if( ext.isEmpty() ) filePath += ".txt"; + digi[ID]->SaveAllSettingsAsText(filePath.toStdString().c_str()); + leSaveFilePath[ID]->setText(filePath + " | not loadable!!"); + } + + SendLogMsg("Saved setting file " + filePath + "."); }