add default setting name

This commit is contained in:
splitPoleDAQ 2024-01-19 13:21:59 -05:00
parent 2e65bbf233
commit 4020a2aeac
4 changed files with 36 additions and 21 deletions

View File

@ -183,7 +183,7 @@ inline void Data::AllocateDataSize(uShort dataSize){
printf("dataSize cannot < 1, set dataSize = 1.\n"); printf("dataSize cannot < 1, set dataSize = 1.\n");
dataSize = 1; dataSize = 1;
} }
printf("Data::%s, size: %u\n", __func__, dataSize); //printf("Data::%s, size: %u\n", __func__, dataSize);
this->dataSize = dataSize; this->dataSize = dataSize;
@ -219,8 +219,6 @@ inline void Data::AllocateDataSize(uShort dataSize){
inline void Data::ClearDataPointer(){ inline void Data::ClearDataPointer(){
printf("Data::%s\n", __func__);
for(int ch = 0; ch < numInputCh; ch++){ for(int ch = 0; ch < numInputCh; ch++){
delete [] Timestamp[ch] ; delete [] Timestamp[ch] ;
delete [] fineTime[ch]; delete [] fineTime[ch];

View File

@ -1022,6 +1022,8 @@ void Digitizer::SaveSettingToFile(Reg registerAddress, unsigned int value, unsig
if ( !isSettingFileExist ) return ; if ( !isSettingFileExist ) return ;
if ( !isSettingFileCoupled ) return; if ( !isSettingFileCoupled ) return;
printf("Write setting file : %s. %s, ch:%u, 0x%8X\n", settingFileName.c_str(), registerAddress.GetNameChar(), ch, value);
unsigned short index = registerAddress.Index(ch); unsigned short index = registerAddress.Index(ch);
setting[index] = value; setting[index] = value;

View File

@ -4019,24 +4019,38 @@ void DigiSettingsPanel::SaveSetting(int opt){
QDir dir(rawDataPath); QDir dir(rawDataPath);
if( !dir.exists() ) dir.mkpath("."); if( !dir.exists() ) dir.mkpath(".");
QString filePath = QFileDialog::getSaveFileName(this, "Save Settings File", rawDataPath, opt == 0 ? "Binary (*.bin)" : "Text file (*.txt)"); QString defaultFileName = "Digi-" + QString::number(digi[ID]->GetSerialNumber()) + "_" + QString::fromStdString(digi[ID]->GetData()->DPPTypeStr) + ".bin";
QString filePath = QFileDialog::getSaveFileName(this,
"Save Settings File",
rawDataPath,
opt == 0 ? "Binary (*.bin)" : "Text file (*.txt)");
if (!filePath.isEmpty()) { if (!filePath.isEmpty()) {
QFileInfo fileInfo(filePath); QFileDialog dialog;
QString ext = fileInfo.suffix(); dialog.selectFile(defaultFileName);
if( opt == 0 ){
if( ext == "") filePath += ".bin";
digi[ID]->SaveAllSettingsAsBin(filePath.toStdString().c_str());
leSaveFilePath[ID]->setText(filePath);
}
if( opt == 1 ){
if( ext == "") filePath += ".txt";
digi[ID]->SaveAllSettingsAsText(filePath.toStdString().c_str());
leSaveFilePath[ID]->setText(filePath + " | not loadable!!");
}
SendLogMsg("Saved setting file <b>" + filePath + "</b>."); 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 <b>" + filePath + "</b>.");
}
} }

View File

@ -639,10 +639,11 @@ void Scope::SetUpSpinBox(RSpinBox * &sb, QString str, int row, int col, const Re
uint32_t value = sb->value() / tick2ns / abs(para.GetPartialStep()); uint32_t value = sb->value() / tick2ns / abs(para.GetPartialStep());
if( para == DPP::RecordLength_G){ //todo NEED TO CHECK
int factor = digi[ID]->IsDualTrace_PHA() ? 2 : 1; // if( para == DPP::RecordLength_G){
value = value * factor; // int factor = digi[ID]->IsDualTrace_PHA() ? 2 : 1;
} // value = value * factor;
// }
if( para == DPP::ChannelDCOffset || para == DPP::QDC::DCOffset){ if( para == DPP::ChannelDCOffset || para == DPP::QDC::DCOffset){
value = uint16_t((1.0 - sb->value()/100.) * 0xFFFF); value = uint16_t((1.0 - sb->value()/100.) * 0xFFFF);