/* This overload allows for a default property that can mapped. The value of the property at that mapping will be used when clear() is called.*/ void XDataWidgetMapper::addMapping(QWidget *widget, QString fieldName, const QByteArray &propertyName, const QByteArray &defaultName) { QDataWidgetMapper::addMapping(widget, static_cast<QSqlTableModel*>(model())->fieldIndex(fieldName), propertyName); removeDefault(widget); widgetMap.append(WidgetMapper(widget, static_cast<QSqlTableModel*>(model())->fieldIndex(fieldName), defaultName)); emit newMapping(widget); }
IMapping * KeptHashTable::create(const void *key) { IMapping * match = find(key); if (!match) { match = newMapping(key); if (match) addOwn(*match); // already linked for hash table } return match; }
IMapping * HashTable::createLink(const void *key) { IMapping * match = findLink(key); if (!match) { match = newMapping(key); if (match) add(*match); // link for hash table } return match; }
void xf86MakeNewMapping(int ScreenNum, int Flags, unsigned long Base, unsigned long Size, pointer Vbase) { VidMapPtr vp; MappingPtr mp; vp = getVidMapRec(ScreenNum); mp = newMapping(vp); mp->size = Size; mp->virtBase = Vbase; }
pointer xf86MapVidMem(int ScreenNum, int Flags, unsigned long Base, unsigned long Size) { pointer vbase = NULL; VidMapPtr vp; MappingPtr mp; if (((Flags & VIDMEM_FRAMEBUFFER) && (Flags & (VIDMEM_MMIO | VIDMEM_MMIO_32BIT)))) FatalError("Mapping memory with more than one type\n"); xf86InitVidMem(); if (!vidMemInfo.initialised || !vidMemInfo.mapMem) return NULL; vbase = vidMemInfo.mapMem(ScreenNum, Base, Size, Flags); if (!vbase || vbase == (pointer)-1) return NULL; vp = getVidMapRec(ScreenNum); mp = newMapping(vp); mp->physBase = Base; mp->size = Size; mp->virtBase = vbase; mp->flags = Flags; /* * Check the "mtrr" option even when MTRR isn't supported to avoid * warnings about unrecognised options. */ checkMtrrOption(vp); if (vp->mtrrEnabled && vidMemInfo.setWC) { if (Flags & (VIDMEM_MMIO | VIDMEM_MMIO_32BIT)) mp->mtrrInfo = vidMemInfo.setWC(ScreenNum, Base, Size, FALSE, vp->mtrrFrom); else if (Flags & VIDMEM_FRAMEBUFFER) mp->mtrrInfo = vidMemInfo.setWC(ScreenNum, Base, Size, TRUE, vp->mtrrFrom); } return vbase; }
void SkPDFCatalog::setSubstitute(SkPDFObject* original, SkPDFObject* substitute) { #if defined(SK_DEBUG) // Sanity check: is the original already in substitute list? for (int i = 0; i < fSubstituteMap.count(); ++i) { if (original == fSubstituteMap[i].fSubstitute || original == fSubstituteMap[i].fOriginal) { SkASSERT(false); return; } } #endif // Check if the original is on first page. bool onFirstPage = false; for (int i = 0; i < fCatalog.count(); ++i) { if (fCatalog[i].fObject == original) { onFirstPage = fCatalog[i].fOnFirstPage; break; } #if defined(SK_DEBUG) if (i == fCatalog.count() - 1) { SkASSERT(false); // original not in catalog return; } #endif } SubstituteMapping newMapping(original, substitute); fSubstituteMap.append(1, &newMapping); // Add resource objects of substitute object to catalog. SkTDArray<SkPDFObject*>* targetList = getSubstituteList(onFirstPage); int existingSize = targetList->count(); newMapping.fSubstitute->getResources(targetList); for (int i = existingSize; i < targetList->count(); ++i) { addObject((*targetList)[i], onFirstPage); } }
void XDataWidgetMapper::addMapping(QWidget *widget, QString fieldName) { QDataWidgetMapper::addMapping(widget, static_cast<QSqlTableModel*>(model())->fieldIndex(fieldName)); emit newMapping(widget); }
bool RemapWidget::setFile(QList<QString> flnm, int voltype) { m_timeseriesFiles.clear(); Global::statusBar()->clearMessage(); hideWidgets(); if (m_histogramWidget) delete m_histogramWidget; if (m_imageWidget) delete m_imageWidget; if (m_remapVolume) delete m_remapVolume; if (m_gradientWidget) delete m_gradientWidget; if (m_slider) delete m_slider; m_histogramWidget = 0; m_imageWidget = 0; m_gradientWidget = 0; m_remapVolume = 0; m_slider = 0; m_volumeType = voltype; m_volumeFile = flnm; if (m_volumeType == RAWVolume) m_remapVolume = new RemapRawVolume(); else if (m_volumeType == TOMVolume) m_remapVolume = new RemapTomVolume(); else if (m_volumeType == AnalyzeVolume) m_remapVolume = new RemapAnalyze(); else if (m_volumeType == HDF4Volume) m_remapVolume = new RemapHDF4(); else if (m_volumeType == RawSlices) m_remapVolume = new RemapRawSlices(); else if (m_volumeType == RawSlabs) m_remapVolume = new RemapRawSlabs(); else if (m_volumeType == NCVolume) m_remapVolume = new RemapNcVolume(); else if (m_volumeType == ImageVolume) m_remapVolume = new RemapImageVolume(); else if (m_volumeType == ImageMagickVolume) m_remapVolume = new RemapDicomVolume(); if (! m_remapVolume->setFile(m_volumeFile)) return false; m_histogramWidget = new RemapHistogramWidget(); m_histogramWidget->setMinimumSize(100, 300); m_histogramWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); m_gradientWidget = new GradientEditorWidget(); m_gradientWidget->setDrawBox(false); m_gradientWidget->setMinimumSize(200, 20); m_gradientWidget->setGeneralLock(GradientEditor::LockToTop); int d, w, h; m_remapVolume->gridSize(d, w, h); m_slider = new MySlider(); m_slider->set(0, d-1, 0, d-1, 0); ui.histogramFrame->layout()->addWidget(m_histogramWidget); ui.colorFrame->layout()->addWidget(m_gradientWidget); ui.sliderFrame->layout()->addWidget(m_slider); m_imageWidget = new RemapImage(); m_imageWidget->setGridSize(d, w, h); m_scrollArea->setWidget(m_imageWidget); m_currSlice = 0; connect(m_histogramWidget, SIGNAL(getHistogram()), this, SLOT(getHistogram())); connect(m_histogramWidget, SIGNAL(newMapping()), this, SLOT(newMapping())); connect(m_histogramWidget, SIGNAL(newMinMax(float, float)), this, SLOT(newMinMax(float, float))); connect(m_imageWidget, SIGNAL(getSlice(int)), this, SLOT(getSlice(int))); connect(m_imageWidget, SIGNAL(getRawValue(int, int, int)), this, SLOT(getRawValue(int, int, int))); connect(m_imageWidget, SIGNAL(newMinMax(float, float)), this, SLOT(newMinMax(float, float))); connect(m_imageWidget, SIGNAL(saveTrimmed(int, int, int, int, int, int)), this, SLOT(saveTrimmed(int, int, int, int, int, int))); connect(m_imageWidget, SIGNAL(saveTrimmedImages(int, int, int, int, int, int)), this, SLOT(saveTrimmedImages(int, int, int, int, int, int))); connect(m_imageWidget, SIGNAL(extractRawVolume()), this, SLOT(extractRawVolume())); connect(m_gradientWidget, SIGNAL(gradientChanged(QGradientStops)), m_imageWidget, SLOT(setGradientStops(QGradientStops))); connect(m_gradientWidget, SIGNAL(gradientChanged(QGradientStops)), m_histogramWidget, SLOT(setGradientStops(QGradientStops))); connect(m_slider, SIGNAL(valueChanged(int)), m_imageWidget, SLOT(sliceChanged(int))); connect(m_slider, SIGNAL(userRangeChanged(int, int)), m_imageWidget, SLOT(userRangeChanged(int, int))); QGradientStops stops; stops << QGradientStop(0, Qt::black) << QGradientStop(1, Qt::white); m_gradientWidget->setColorGradient(stops); m_imageWidget->setGradientStops(stops); m_histogramWidget->setGradientStops(stops); setRawMinMax(); showWidgets(); return true; }