// Called by the database system on loadFromDb() to give us our new set of AMDetectorInfo objects. We copy these ones into our internal list and then delete them. void AMOldDetectorInfoSet::dbLoadDetectorInfos(const AMDbObjectList& newDetectorInfos) { clear(); // get rid of our existing for(int i=0; i<newDetectorInfos.count(); i++) { AMOldDetectorInfo* newDetectorInfo = qobject_cast<AMOldDetectorInfo*>(newDetectorInfos.at(i)); if(newDetectorInfo) addDetectorInfo(newDetectorInfo); } }
void SGMElementInfo::dbLoadSGMFastScanParameters(const AMDbObjectList &sgmFastScanParameters){ availableFastScanParameters_.clear(); for(int x = 0; x < sgmFastScanParameters.count(); x++){ SGMFastScanParameters* newFastScanParameter = qobject_cast<SGMFastScanParameters*>(sgmFastScanParameters.at(x)); if(newFastScanParameter) availableFastScanParameters_.append(newFastScanParameter, (int)newFastScanParameter->runSeconds());// note: makes a copy of object pointed to by newStandardScanInfo, and stores in our internal list. } }
void SGMElementInfo::dbLoadSGMEdgeInfos(const AMDbObjectList &sgmEdgeInfos){ sgmEdgeInfos_.clear(); for(int x = 0; x < sgmEdgeInfos.count(); x++){ SGMScanInfo* newEdgeInfo = qobject_cast<SGMScanInfo*>(sgmEdgeInfos.at(x)); if(newEdgeInfo) sgmEdgeInfos_.append(*newEdgeInfo, newEdgeInfo->edge());// note: makes a copy of object pointed to by newStandardScanInfo, and stores in our internal list. delete sgmEdgeInfos.at(x); // we're copying these; don't need to keep these ones around. They're our responsibility to delete. } }
/* Usually, this would only happen when calling loadFromDb() a scan object for the first time, or when re-loading after creating additional raw data sources but not saving them.*/ void AMScan::dbLoadRawDataSources(const AMDbObjectList& newRawSources) { // delete the existing raw data sources, since they will be replaced. (Does nothing if there are no sources yet.) int count; while( (count = rawDataSources_.count()) ) { AMRawDataSource* deleteMe = rawDataSources_.at(count-1); rawDataSources_.remove(count-1); // removing at the end is fastest. deleteMe->deleteLater(); } // add new sources. Simply adding these to rawDataSources_ will be enough to emit the signals that tell everyone watching we have new data channels. for(int i=0; i<newRawSources.count(); i++) { AMRawDataSource* newRawSource = qobject_cast<AMRawDataSource*>(newRawSources.at(i)); if(newRawSource) { rawDataSources_.append(newRawSource, newRawSource->name()); connect(newRawSource, SIGNAL(modifiedChanged(bool)), this, SLOT(onDataSourceModified(bool))); } else AMErrorMon::report(AMErrorReport(this, AMErrorReport::Debug, 0, "There was an error reloading one of this scan's raw data sources from the database. Your database might be corrupted. Please report this bug to the Acquaman developers.")); }