fix on the saving setting dialog
This commit is contained in:
parent
4020a2aeac
commit
187b3b5b7f
|
@ -4023,34 +4023,25 @@ void DigiSettingsPanel::SaveSetting(int opt){
|
||||||
|
|
||||||
QString filePath = QFileDialog::getSaveFileName(this,
|
QString filePath = QFileDialog::getSaveFileName(this,
|
||||||
"Save Settings File",
|
"Save Settings File",
|
||||||
rawDataPath,
|
QDir::toNativeSeparators(rawDataPath + "/" + defaultFileName),
|
||||||
opt == 0 ? "Binary (*.bin)" : "Text file (*.txt)");
|
opt == 0 ? "Binary (*.bin)" : "Text file (*.txt)");
|
||||||
|
|
||||||
if (!filePath.isEmpty()) {
|
if (!filePath.isEmpty()) {
|
||||||
|
|
||||||
QFileDialog dialog;
|
|
||||||
dialog.selectFile(defaultFileName);
|
|
||||||
|
|
||||||
if( dialog.exec() == QDialog::Accepted){
|
|
||||||
|
|
||||||
filePath = dialog.selectedFiles().first();
|
|
||||||
|
|
||||||
QFileInfo fileInfo(filePath);
|
QFileInfo fileInfo(filePath);
|
||||||
QString ext = fileInfo.suffix();
|
QString ext = fileInfo.suffix();
|
||||||
if( opt == 0 ){
|
if( opt == 0 ){
|
||||||
if( ext.isEmpty() ) filePath += ".bin";
|
if( ext.isEmpty() ) filePath += ".bin";
|
||||||
digi[ID]->SaveAllSettingsAsBin(filePath.toStdString().c_str());
|
digi[ID]->SaveAllSettingsAsBin(filePath.toStdString().c_str());
|
||||||
leSaveFilePath[ID]->setText(filePath);
|
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 <b>" + filePath + "</b>.");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
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 <b>" + filePath + "</b>.");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user