/*! Emit unavailable signal */ void HsWidgetComponent::emitUnavailable() { if (mState == Available) { mState = Unavailable; emit unavailable(); } }
Condition::Condition(const char *aName) : DeviceDatum(aName), mBegun(false) { mActiveSize = mInitialActiveListSize; mActiveCount = 0; mActiveList = new ActiveCondition*[mActiveSize]; mHasValue = true; unavailable(); }
void FanucAdapter::disconnect() { if (mConnected) { printf("Machine has disconnected. Releasing Resources\n"); cnc_freelibhndl(mFlibhndl); mConnected = false; unavailable(); } }
void EmcAdapter::disconnect() { if (mConnected) { unavailable(); if (mEmcErrorBuffer) delete mEmcErrorBuffer; mEmcErrorBuffer = 0; if (mEmcStatusBuffer) delete mEmcStatusBuffer; mEmcStatusBuffer = 0; mConnected = false; } }
void TestHsDomainModel::testWidgetComponentEmits() { QScopedPointer<HsWidgetComponent> compo(new HsWidgetComponent("mockwidgetplugin")); QSignalSpy aboutToUninstallSpy(compo.data(),SIGNAL(aboutToUninstall())); QSignalSpy uninstalledSpy(compo.data(),SIGNAL(uninstalled())); QSignalSpy unavailableSpy(compo.data(),SIGNAL(unavailable())); QSignalSpy availableSpy(compo.data(),SIGNAL(available())); QSignalSpy updatedSpy(compo.data(),SIGNAL(updated())); compo->emitAboutToUninstall(); QVERIFY(aboutToUninstallSpy.count() == 1); // should not emit again compo->emitAboutToUninstall(); QVERIFY(aboutToUninstallSpy.count() == 1); compo->emitUninstalled(); QVERIFY(uninstalledSpy.count() == 1); // should not emit again compo->emitUninstalled(); QVERIFY(uninstalledSpy.count() == 1); compo->emitUnavailable(); QVERIFY(unavailableSpy.count() == 1); // should not emit again compo->emitUnavailable(); QVERIFY(unavailableSpy.count() == 1); compo->emitAvailable(); QVERIFY(availableSpy.count() == 1); // should not emit again compo->emitAvailable(); QVERIFY(availableSpy.count() == 1); compo->emitAboutToUninstall(); compo->emitUpdated(); QVERIFY(updatedSpy.count() == 1); // should not emit again compo->emitUpdated(); QVERIFY(updatedSpy.count() == 1); }
static void InitializeToolTipImages(ChunkBar* bar) { static bool images_initialized = false; if (images_initialized) return; images_initialized = true; Q3MimeSourceFactory* factory = Q3MimeSourceFactory::defaultFactory(); QImage excluded(16, 16, QImage::Format_RGB32); FillAndFrameBlack(&excluded, bar->palette().color(QPalette::Active, QPalette::Mid), 16); factory->setImage("excluded_color", excluded); QImage available(16, 16, QImage::Format_RGB32); FillAndFrameBlack(&available, bar->palette().color(QPalette::Active, QPalette::Highlight), 16); factory->setImage("available_color", available); QImage unavailable(16, 16, QImage::Format_RGB32); FillAndFrameBlack(&unavailable, bar->palette().color(QPalette::Active, QPalette::Base), 16); factory->setImage("unavailable_color", unavailable); }
void FanucAdapter::connect() { if (mConnected) return; printf("Connecting to Machine at %s and port %d\n", mDeviceIP, mDevicePort); short ret = ::cnc_allclibhndl3(mDeviceIP, mDevicePort, 10, &mFlibhndl); printf("Result: %d\n", ret); if (ret == EW_OK) { mAvail.available(); mConnected = true; if (!mConfigured) configure(); // Set all conditions to normal mServo.normal(); mComms.normal(); mLogic.normal(); mMotion.normal(); mSystem.normal(); mSpindle.normal(); for (int i = 0; i < mAxisCount; i++) { mAxisTravel[i]->normal(); mAxisOverheat[i]->normal(); mAxisServo[i]->normal(); } } else { mConnected = false; unavailable(); Sleep(5000); } }
void KPImageDialogPreview::showPreview(const QUrl& url) { if (!url.isValid()) { clearPreview(); return; } if (url != d->currentUrl) { QString make, model, dateTime, aperture, focalLength, exposureTime, sensitivity; QString unavailable(i18n("<i>unavailable</i>")); clearPreview(); d->currentUrl = url; if (d->iface) { d->iface->thumbnail(d->currentUrl, 256); } else { qCDebug(KIPIPLUGINS_LOG) << "No KIPI interface available : thumbnails will not generated."; } // Try to use Metadata Processor from KIPI host to identify image. if (d->meta && d->meta->load(d->currentUrl) && (d->meta->hasExif() || d->meta->hasXmp())) { make = d->meta->getExifTagString(QLatin1String("Exif.Image.Make")); if (make.isEmpty()) make = d->meta->getXmpTagString(QLatin1String("Xmp.tiff.Make")); model = d->meta->getExifTagString(QLatin1String("Exif.Image.Model")); if (model.isEmpty()) model = d->meta->getXmpTagString(QLatin1String("Xmp.tiff.Model")); if (d->meta->getImageDateTime().isValid()) dateTime = QLocale().toString(d->meta->getImageDateTime(), QLocale::ShortFormat); aperture = d->meta->getExifTagString(QLatin1String("Exif.Photo.FNumber")); if (aperture.isEmpty()) { aperture = d->meta->getExifTagString(QLatin1String("Exif.Photo.ApertureValue")); if (aperture.isEmpty()) { aperture = d->meta->getXmpTagString(QLatin1String("Xmp.exif.FNumber")); if (aperture.isEmpty()) aperture = d->meta->getXmpTagString(QLatin1String("Xmp.exif.ApertureValue")); } } focalLength = d->meta->getExifTagString(QLatin1String("Exif.Photo.FocalLength")); if (focalLength.isEmpty()) focalLength = d->meta->getXmpTagString(QLatin1String("Xmp.exif.FocalLength")); exposureTime = d->meta->getExifTagString(QLatin1String("Exif.Photo.ExposureTime")); if (exposureTime.isEmpty()) { exposureTime = d->meta->getExifTagString(QLatin1String("Exif.Photo.ShutterSpeedValue")); if (exposureTime.isEmpty()) { exposureTime = d->meta->getXmpTagString(QLatin1String("Xmp.exif.ExposureTime")); if (exposureTime.isEmpty()) exposureTime = d->meta->getXmpTagString(QLatin1String("Xmp.exif.ShutterSpeedValue")); } } sensitivity = d->meta->getExifTagString(QLatin1String("Exif.Photo.ISOSpeedRatings")); if (sensitivity.isEmpty()) { sensitivity = d->meta->getExifTagString(QLatin1String("Exif.Photo.ExposureIndex")); if (sensitivity.isEmpty()) { sensitivity = d->meta->getXmpTagString(QLatin1String("Xmp.exif.ISOSpeedRatings")); if (sensitivity.isEmpty()) sensitivity = d->meta->getXmpTagString(QLatin1String("Xmp.exif.ExposureIndex")); } } } if (make.isEmpty()) make = unavailable; if (model.isEmpty()) model = unavailable; if (dateTime.isEmpty()) dateTime = unavailable; if (aperture.isEmpty()) aperture = unavailable; if (focalLength.isEmpty()) focalLength = unavailable; if (exposureTime.isEmpty()) exposureTime = unavailable; if (sensitivity.isEmpty()) sensitivity = unavailable; else sensitivity = i18n("%1 ISO", sensitivity); QString identify(QString::fromLatin1("<qt><center>")); QString cellBeg(QString::fromLatin1("<tr><td><nobr><font size=-1>")); QString cellMid(QString::fromLatin1("</font></nobr></td><td><nobr><font size=-1>")); QString cellEnd(QString::fromLatin1("</font></nobr></td></tr>")); identify += QString::fromLatin1("<table cellspacing=0 cellpadding=0>"); identify += cellBeg + i18n("<i>Make:</i>") + cellMid + make + cellEnd; identify += cellBeg + i18n("<i>Model:</i>") + cellMid + model + cellEnd; identify += cellBeg + i18n("<i>Created:</i>") + cellMid + dateTime + cellEnd; identify += cellBeg + i18n("<i>Aperture:</i>") + cellMid + aperture + cellEnd; identify += cellBeg + i18n("<i>Focal:</i>") + cellMid + focalLength + cellEnd; identify += cellBeg + i18n("<i>Exposure:</i>") + cellMid + exposureTime + cellEnd; identify += cellBeg + i18n("<i>Sensitivity:</i>") + cellMid + sensitivity + cellEnd; identify += QString::fromLatin1("</table></center></qt>"); d->infoLabel->setText(identify); } }
void KPImageDialogPreview::showPreview(const KUrl& url) { if (!url.isValid()) { clearPreview(); return; } if (url != d->currentUrl) { QString make, model, dateTime, aperture, focalLength, exposureTime, sensitivity; QString unavailable(i18n("<i>unavailable</i>")); clearPreview(); d->currentUrl = url; if (d->iface) { d->iface->thumbnail(d->currentUrl, 256); } else { if ( !d->currentUrl.isValid() ) return; #if KDE_IS_VERSION(4,7,0) KFileItemList items; items.append(KFileItem(KFileItem::Unknown, KFileItem::Unknown, d->currentUrl, true)); KIO::PreviewJob* job = KIO::filePreview(items, QSize(256, 256)); #else KIO::PreviewJob* job = KIO::filePreview(d->currentUrl, 256); #endif connect(job, SIGNAL(gotPreview(KFileItem,QPixmap)), this, SLOT(slotKDEPreview(KFileItem,QPixmap))); connect(job, SIGNAL(failed(KFileItem)), this, SLOT(slotKDEPreviewFailed(KFileItem))); } // Try to use libkexiv2 to identify image. if (d->metaIface.load(d->currentUrl.path()) && (d->metaIface.hasExif() || d->metaIface.hasXmp())) { make = d->metaIface.getExifTagString("Exif.Image.Make"); if (make.isEmpty()) make = d->metaIface.getXmpTagString("Xmp.tiff.Make"); model = d->metaIface.getExifTagString("Exif.Image.Model"); if (model.isEmpty()) model = d->metaIface.getXmpTagString("Xmp.tiff.Model"); if (d->metaIface.getImageDateTime().isValid()) dateTime = KGlobal::locale()->formatDateTime(d->metaIface.getImageDateTime(), KLocale::ShortDate, true); aperture = d->metaIface.getExifTagString("Exif.Photo.FNumber"); if (aperture.isEmpty()) { aperture = d->metaIface.getExifTagString("Exif.Photo.ApertureValue"); if (aperture.isEmpty()) { aperture = d->metaIface.getXmpTagString("Xmp.exif.FNumber"); if (aperture.isEmpty()) aperture = d->metaIface.getXmpTagString("Xmp.exif.ApertureValue"); } } focalLength = d->metaIface.getExifTagString("Exif.Photo.FocalLength"); if (focalLength.isEmpty()) focalLength = d->metaIface.getXmpTagString("Xmp.exif.FocalLength"); exposureTime = d->metaIface.getExifTagString("Exif.Photo.ExposureTime"); if (exposureTime.isEmpty()) { exposureTime = d->metaIface.getExifTagString("Exif.Photo.ShutterSpeedValue"); if (exposureTime.isEmpty()) { exposureTime = d->metaIface.getXmpTagString("Xmp.exif.ExposureTime"); if (exposureTime.isEmpty()) exposureTime = d->metaIface.getXmpTagString("Xmp.exif.ShutterSpeedValue"); } } sensitivity = d->metaIface.getExifTagString("Exif.Photo.ISOSpeedRatings"); if (sensitivity.isEmpty()) { sensitivity = d->metaIface.getExifTagString("Exif.Photo.ExposureIndex"); if (sensitivity.isEmpty()) { sensitivity = d->metaIface.getXmpTagString("Xmp.exif.ISOSpeedRatings"); if (sensitivity.isEmpty()) sensitivity = d->metaIface.getXmpTagString("Xmp.exif.ExposureIndex"); } } } else { // Try to use libkdcraw interface to identify image. DcrawInfoContainer info; KDcraw dcrawIface; dcrawIface.rawFileIdentify(info, d->currentUrl.path()); if (info.isDecodable) { if (!info.make.isEmpty()) make = info.make; if (!info.model.isEmpty()) model = info.model; if (info.dateTime.isValid()) dateTime = KGlobal::locale()->formatDateTime(info.dateTime, KLocale::ShortDate, true); if (info.aperture != -1.0) aperture = QString::number(info.aperture); if (info.focalLength != -1.0) focalLength = QString::number(info.focalLength); if (info.exposureTime != -1.0) exposureTime = QString::number(info.exposureTime); if (info.sensitivity != -1) sensitivity = QString::number(info.sensitivity); } else { d->infoLabel->clear(); return; } } if (make.isEmpty()) make = unavailable; if (model.isEmpty()) model = unavailable; if (dateTime.isEmpty()) dateTime = unavailable; if (aperture.isEmpty()) aperture = unavailable; if (focalLength.isEmpty()) focalLength = unavailable; if (exposureTime.isEmpty()) exposureTime = unavailable; if (sensitivity.isEmpty()) sensitivity = unavailable; else sensitivity = i18n("%1 ISO", sensitivity); QString identify("<qt><center>"); QString cellBeg("<tr><td><nobr><font size=-1>"); QString cellMid("</font></nobr></td><td><nobr><font size=-1>"); QString cellEnd("</font></nobr></td></tr>"); identify += "<table cellspacing=0 cellpadding=0>"; identify += cellBeg + i18n("<i>Make:</i>") + cellMid + make + cellEnd; identify += cellBeg + i18n("<i>Model:</i>") + cellMid + model + cellEnd; identify += cellBeg + i18n("<i>Created:</i>") + cellMid + dateTime + cellEnd; identify += cellBeg + i18n("<i>Aperture:</i>") + cellMid + aperture + cellEnd; identify += cellBeg + i18n("<i>Focal:</i>") + cellMid + focalLength + cellEnd; identify += cellBeg + i18n("<i>Exposure:</i>") + cellMid + exposureTime + cellEnd; identify += cellBeg + i18n("<i>Sensitivity:</i>") + cellMid + sensitivity + cellEnd; identify += "</table></center></qt>"; d->infoLabel->setText(identify); } }
void PCSCResourceManager::run() { SCARDCONTEXT context; LONG rv; while (true) { rv = SCardEstablishContext(SCARD_SCOPE_SYSTEM, NULL, NULL, &context); if (rv == SCARD_S_SUCCESS) { DWORD readerNum = SCARD_AUTOALLOCATE; LPSTR readerNames = NULL; do { rv = SCardListReaders(context, NULL, (LPSTR) &readerNames, &readerNum); if (rv == SCARD_S_SUCCESS) { for (LPCSTR pch = readerNames; *pch != '\0'; pch += strlen(pch) + 1) { int i; for (i = 0; i < m_availabeReaders.size(); i++) if (0 == strcmp(m_availabeReaders[i]->name(), pch)) break; if (i == m_availabeReaders.size()) { SCardReader *reader = new SCardReader(pch); m_availabeReaders.append(reader); connect(reader, SIGNAL(unavailable(LPCSTR)), SLOT(clearUnavailabeReader(LPCSTR))); reader->start(); emit readerPluged(reader); } } (void) SCardFreeMemory(context, readerNames); } else std::cout << pcsc_stringify_error(rv) << std::endl; if (rv == SCARD_S_SUCCESS || rv == SCARD_E_NO_READERS_AVAILABLE) { SCARD_READERSTATE readerStates; readerStates.szReader = "\\\\?PnP?\\Notification"; readerStates.dwCurrentState = SCARD_STATE_UNAWARE; rv = SCardGetStatusChange(context, INFINITE, &readerStates, 1); if (rv != SCARD_E_TIMEOUT || rv != SCARD_S_SUCCESS) { (void) SCardReleaseContext(context); break; } } else { (void) SCardReleaseContext(context); break; } } while (true); } else { std::cout << pcsc_stringify_error(rv) << std::endl; QThread::sleep(PCSC_ERROR_BREAK_TIME); } } }
void CameraItemPropertiesTab::setCurrentItem(const CamItemInfo& itemInfo, const DMetadata& meta) { if (itemInfo.isNull()) { d->labelFile->setAdjustedText(QString()); d->labelFolder->setAdjustedText(QString()); d->labelFileIsReadable->setAdjustedText(QString()); d->labelFileIsWritable->setAdjustedText(QString()); d->labelFileDate->setAdjustedText(QString()); d->labelFileSize->setAdjustedText(QString()); d->labelImageMime->setAdjustedText(QString()); d->labelImageDimensions->setAdjustedText(QString()); d->labelImageRatio->setAdjustedText(QString()); d->labelNewFileName->setAdjustedText(QString()); d->labelAlreadyDownloaded->setAdjustedText(QString()); d->labelPhotoMake->setAdjustedText(QString()); d->labelPhotoModel->setAdjustedText(QString()); d->labelPhotoDateTime->setAdjustedText(QString()); d->labelPhotoLens->setAdjustedText(QString()); d->labelPhotoAperture->setAdjustedText(QString()); d->labelPhotoFocalLength->setAdjustedText(QString()); d->labelPhotoExposureTime->setAdjustedText(QString()); d->labelPhotoSensitivity->setAdjustedText(QString()); d->labelPhotoExposureMode->setAdjustedText(QString()); d->labelPhotoFlash->setAdjustedText(QString()); d->labelPhotoWhiteBalance->setAdjustedText(QString()); d->labelVideoAspectRatio->setAdjustedText(QString()); d->labelVideoAudioBitRate->setAdjustedText(QString()); d->labelVideoAudioChannelType->setAdjustedText(QString()); d->labelVideoAudioCompressor->setAdjustedText(QString()); d->labelVideoDuration->setAdjustedText(QString()); d->labelVideoFrameRate->setAdjustedText(QString()); d->labelVideoVideoCodec->setAdjustedText(QString()); setEnabled(false); return; } setEnabled(true); QString str; QString unknown(i18n("<i>unknown</i>")); // -- Camera file system information ------------------------------------------ d->labelFile->setAdjustedText(itemInfo.name); d->labelFolder->setAdjustedText(itemInfo.folder); if (itemInfo.readPermissions < 0) { str = unknown; } else if (itemInfo.readPermissions == 0) { str = i18n("No"); } else { str = i18n("Yes"); } d->labelFileIsReadable->setAdjustedText(str); if (itemInfo.writePermissions < 0) { str = unknown; } else if (itemInfo.writePermissions == 0) { str = i18n("No"); } else { str = i18n("Yes"); } d->labelFileIsWritable->setAdjustedText(str); if (itemInfo.ctime.isValid()) { d->labelFileDate->setAdjustedText(QLocale().toString(itemInfo.ctime, QLocale::ShortFormat)); } else { d->labelFileDate->setAdjustedText(unknown); } str = i18n("%1 (%2)", ImagePropertiesTab::humanReadableBytesCount(itemInfo.size), QLocale().toString(itemInfo.size)); d->labelFileSize->setAdjustedText(str); // -- Image Properties -------------------------------------------------- if (itemInfo.mime == QLatin1String("image/x-raw")) { d->labelImageMime->setAdjustedText(i18n("RAW Image")); } else { QMimeType mimeType = QMimeDatabase().mimeTypeForName(itemInfo.mime); if (mimeType.isValid()) { d->labelImageMime->setAdjustedText(mimeType.comment()); } else { d->labelImageMime->setAdjustedText(itemInfo.mime); // last fallback } } QString mpixels; QSize dims; if (itemInfo.width == -1 && itemInfo.height == -1) { // delayed loading to list faster from UMSCamera if (itemInfo.mime == QLatin1String("image/x-raw")) { dims = meta.getImageDimensions(); } else { dims = meta.getPixelSize(); } } else { // if available (GPCamera), take dimensions directly from itemInfo dims = QSize(itemInfo.width, itemInfo.height); } mpixels.setNum(dims.width()*dims.height()/1000000.0, 'f', 2); str = (!dims.isValid()) ? unknown : i18n("%1x%2 (%3Mpx)", dims.width(), dims.height(), mpixels); d->labelImageDimensions->setAdjustedText(str); if (!dims.isValid()) str = unknown; else ImagePropertiesTab::aspectRatioToString(dims.width(), dims.height(), str); d->labelImageRatio->setAdjustedText(str); // -- Download information ------------------------------------------ d->labelNewFileName->setAdjustedText(itemInfo.downloadName.isEmpty() ? i18n("<i>unchanged</i>") : itemInfo.downloadName); if (itemInfo.downloaded == CamItemInfo::DownloadUnknown) { str = unknown; } else if (itemInfo.downloaded == CamItemInfo::DownloadedYes) { str = i18n("Yes"); } else { str = i18n("No"); } d->labelAlreadyDownloaded->setAdjustedText(str); // -- Photograph information ------------------------------------------ // Note: If something is changed here, please updated albumfiletip section too. QString unavailable(i18n("<i>unavailable</i>")); PhotoInfoContainer photoInfo = meta.getPhotographInformation(); if (photoInfo.isEmpty()) { widget(1)->hide(); } else { widget(1)->show(); } ImagePropertiesTab::shortenedMakeInfo(photoInfo.make); ImagePropertiesTab::shortenedModelInfo(photoInfo.model); d->labelPhotoMake->setAdjustedText(photoInfo.make.isEmpty() ? unavailable : photoInfo.make); d->labelPhotoModel->setAdjustedText(photoInfo.model.isEmpty() ? unavailable : photoInfo.model); if (photoInfo.dateTime.isValid()) { str = QLocale().toString(photoInfo.dateTime, QLocale::ShortFormat); d->labelPhotoDateTime->setAdjustedText(str); } else { d->labelPhotoDateTime->setAdjustedText(unavailable); } d->labelPhotoLens->setAdjustedText(photoInfo.lens.isEmpty() ? unavailable : photoInfo.lens); d->labelPhotoAperture->setAdjustedText(photoInfo.aperture.isEmpty() ? unavailable : photoInfo.aperture); if (photoInfo.focalLength35mm.isEmpty()) { d->labelPhotoFocalLength->setAdjustedText(photoInfo.focalLength.isEmpty() ? unavailable : photoInfo.focalLength); } else { str = i18n("%1 (%2)", photoInfo.focalLength, photoInfo.focalLength35mm); d->labelPhotoFocalLength->setAdjustedText(str); } d->labelPhotoExposureTime->setAdjustedText(photoInfo.exposureTime.isEmpty() ? unavailable : photoInfo.exposureTime); d->labelPhotoSensitivity->setAdjustedText(photoInfo.sensitivity.isEmpty() ? unavailable : i18n("%1 ISO", photoInfo.sensitivity)); if (photoInfo.exposureMode.isEmpty() && photoInfo.exposureProgram.isEmpty()) { d->labelPhotoExposureMode->setAdjustedText(unavailable); } else if (!photoInfo.exposureMode.isEmpty() && photoInfo.exposureProgram.isEmpty()) { d->labelPhotoExposureMode->setAdjustedText(photoInfo.exposureMode); } else if (photoInfo.exposureMode.isEmpty() && !photoInfo.exposureProgram.isEmpty()) { d->labelPhotoExposureMode->setAdjustedText(photoInfo.exposureProgram); } else { str = QString::fromUtf8("%1 / %2").arg(photoInfo.exposureMode).arg(photoInfo.exposureProgram); d->labelPhotoExposureMode->setAdjustedText(str); } d->labelPhotoFlash->setAdjustedText(photoInfo.flash.isEmpty() ? unavailable : photoInfo.flash); d->labelPhotoWhiteBalance->setAdjustedText(photoInfo.whiteBalance.isEmpty() ? unavailable : photoInfo.whiteBalance); // -- Video information ------------------------------------------ VideoInfoContainer videoInfo = meta.getVideoInformation(); if (videoInfo.isEmpty()) { widget(2)->hide(); } else { widget(2)->show(); } d->labelVideoAspectRatio->setAdjustedText(videoInfo.aspectRatio.isEmpty() ? unavailable : videoInfo.aspectRatio); d->labelVideoAudioBitRate->setAdjustedText(videoInfo.audioBitRate.isEmpty() ? unavailable : videoInfo.audioBitRate); d->labelVideoAudioChannelType->setAdjustedText(videoInfo.audioChannelType.isEmpty() ? unavailable : videoInfo.audioChannelType); d->labelVideoAudioCompressor->setAdjustedText(videoInfo.audioCompressor.isEmpty() ? unavailable : videoInfo.audioCompressor); d->labelVideoDuration->setAdjustedText(videoInfo.duration.isEmpty() ? unavailable : videoInfo.duration); d->labelVideoFrameRate->setAdjustedText(videoInfo.frameRate.isEmpty() ? unavailable : videoInfo.frameRate); d->labelVideoVideoCodec->setAdjustedText(videoInfo.videoCodec.isEmpty() ? unavailable : videoInfo.videoCodec); }
void ImagePropertiesSideBar::setImagePropertiesInformation(const QUrl& url) { if (!url.isValid()) { return; } QString str; QString unavailable(i18n("<i>unavailable</i>")); QFileInfo fileInfo(url.toLocalFile()); DMetadata metaData(url.toLocalFile()); // -- File system information ----------------------------------------- QDateTime modifiedDate = fileInfo.lastModified(); str = QLocale().toString(modifiedDate, QLocale::ShortFormat); m_propertiesTab->setFileModifiedDate(str); str = QString::fromUtf8("%1 (%2)").arg(ImagePropertiesTab::humanReadableBytesCount(fileInfo.size())) .arg(QLocale().toString(fileInfo.size())); m_propertiesTab->setFileSize(str); m_propertiesTab->setFileOwner(QString::fromUtf8("%1 - %2").arg(fileInfo.owner()).arg(fileInfo.group())); m_propertiesTab->setFilePermissions(ImagePropertiesTab::permissionsString(fileInfo)); // -- Image Properties -------------------------------------------------- QSize dims; QString bitDepth, colorMode; QString rawFilesExt = QLatin1String(RawEngine::DRawDecoder::rawFiles()); QString ext = fileInfo.suffix().toUpper(); if (!ext.isEmpty() && rawFilesExt.toUpper().contains(ext)) { m_propertiesTab->setImageMime(i18n("RAW Image")); bitDepth = QLatin1String("48"); dims = metaData.getImageDimensions(); colorMode = i18n("Uncalibrated"); } else { m_propertiesTab->setImageMime(QMimeDatabase().mimeTypeForFile(fileInfo).comment()); dims = metaData.getPixelSize(); DImg img; img.loadImageInfo(url.toLocalFile(), false, false, false, false); bitDepth.number(img.originalBitDepth()); colorMode = DImg::colorModelToString(img.originalColorModel()); } QString mpixels; mpixels.setNum(dims.width()*dims.height()/1000000.0, 'f', 2); str = (!dims.isValid()) ? i18n("Unknown") : i18n("%1x%2 (%3Mpx)", dims.width(), dims.height(), mpixels); m_propertiesTab->setImageDimensions(str); if (!dims.isValid()) str = i18n("Unknown"); else m_propertiesTab->aspectRatioToString(dims.width(), dims.height(), str); m_propertiesTab->setImageRatio(str); m_propertiesTab->setImageBitDepth(bitDepth.isEmpty() ? unavailable : i18n("%1 bpp", bitDepth)); m_propertiesTab->setImageColorMode(colorMode.isEmpty() ? unavailable : colorMode); // -- Photograph information ------------------------------------------ PhotoInfoContainer photoInfo = metaData.getPhotographInformation(); m_propertiesTab->setPhotoInfoDisable(photoInfo.isEmpty()); ImagePropertiesTab::shortenedMakeInfo(photoInfo.make); ImagePropertiesTab::shortenedModelInfo(photoInfo.model); m_propertiesTab->setPhotoMake(photoInfo.make.isEmpty() ? unavailable : photoInfo.make); m_propertiesTab->setPhotoModel(photoInfo.model.isEmpty() ? unavailable : photoInfo.model); if (photoInfo.dateTime.isValid()) { str = QLocale().toString(photoInfo.dateTime, QLocale::ShortFormat); m_propertiesTab->setPhotoDateTime(str); } else { m_propertiesTab->setPhotoDateTime(unavailable); } m_propertiesTab->setPhotoLens(photoInfo.lens.isEmpty() ? unavailable : photoInfo.lens); m_propertiesTab->setPhotoAperture(photoInfo.aperture.isEmpty() ? unavailable : photoInfo.aperture); if (photoInfo.focalLength35mm.isEmpty()) { m_propertiesTab->setPhotoFocalLength(photoInfo.focalLength.isEmpty() ? unavailable : photoInfo.focalLength); } else { str = i18n("%1 (%2)", photoInfo.focalLength, photoInfo.focalLength35mm); m_propertiesTab->setPhotoFocalLength(str); } m_propertiesTab->setPhotoExposureTime(photoInfo.exposureTime.isEmpty() ? unavailable : photoInfo.exposureTime); m_propertiesTab->setPhotoSensitivity(photoInfo.sensitivity.isEmpty() ? unavailable : i18n("%1 ISO", photoInfo.sensitivity)); if (photoInfo.exposureMode.isEmpty() && photoInfo.exposureProgram.isEmpty()) { m_propertiesTab->setPhotoExposureMode(unavailable); } else if (!photoInfo.exposureMode.isEmpty() && photoInfo.exposureProgram.isEmpty()) { m_propertiesTab->setPhotoExposureMode(photoInfo.exposureMode); } else if (photoInfo.exposureMode.isEmpty() && !photoInfo.exposureProgram.isEmpty()) { m_propertiesTab->setPhotoExposureMode(photoInfo.exposureProgram); } else { str = QString::fromUtf8("%1 / %2").arg(photoInfo.exposureMode).arg(photoInfo.exposureProgram); m_propertiesTab->setPhotoExposureMode(str); } m_propertiesTab->setPhotoFlash(photoInfo.flash.isEmpty() ? unavailable : photoInfo.flash); m_propertiesTab->setPhotoWhiteBalance(photoInfo.whiteBalance.isEmpty() ? unavailable : photoInfo.whiteBalance); // -- Video information ------------------------------------------ VideoInfoContainer videoInfo = metaData.getVideoInformation(); m_propertiesTab->setVideoInfoDisable(videoInfo.isEmpty()); m_propertiesTab->setVideoAspectRatio(videoInfo.aspectRatio.isEmpty() ? unavailable : videoInfo.aspectRatio); m_propertiesTab->setVideoDuration(videoInfo.duration.isEmpty() ? unavailable : videoInfo.duration); m_propertiesTab->setVideoFrameRate(videoInfo.frameRate.isEmpty() ? unavailable : videoInfo.frameRate); m_propertiesTab->setVideoVideoCodec(videoInfo.videoCodec.isEmpty() ? unavailable : videoInfo.videoCodec); m_propertiesTab->setVideoAudioBitRate(videoInfo.audioBitRate.isEmpty() ? unavailable : videoInfo.audioBitRate); m_propertiesTab->setVideoAudioChannelType(videoInfo.audioChannelType.isEmpty() ? unavailable : videoInfo.audioChannelType); m_propertiesTab->setVideoAudioCompressor(videoInfo.audioCompressor.isEmpty() ? unavailable : videoInfo.audioCompressor); // -- Caption, ratings, tag information --------------------- CaptionsMap captions = metaData.getImageComments(); QString caption; if (captions.contains(QLatin1String("x-default"))) caption = captions.value(QLatin1String("x-default")).caption; else if (!captions.isEmpty()) caption = captions.begin().value().caption; m_propertiesTab->setCaption(caption); m_propertiesTab->setRating(metaData.getImageRating()); QStringList tagPaths; metaData.getImageTagsPath(tagPaths); m_propertiesTab->setTags(tagPaths); m_propertiesTab->showOrHideCaptionAndTags(); }
__attribute__((availability(ios,unavailable, message="not for iOS"))); // CHECK: FullCommentAsXML=[<Function file="{{[^"]+}}annotate-comments-availability-attrs.cpp" line="[[@LINE-3]]" column="6"><Name>attr_availability_1</Name><USR>c:@F@attr_availability_1#</USR><Declaration>void attr_availability_1()</Declaration><Abstract><Para> Aaa.</Para></Abstract><Availability distribution="iOS"><DeprecationSummary>not for iOS</DeprecationSummary><Unavailable/></Availability><Availability distribution="macOS"><IntroducedInVersion>8.0</IntroducedInVersion><DeprecatedInVersion>9.0</DeprecatedInVersion><RemovedAfterVersion>10.0</RemovedAfterVersion><DeprecationSummary>use availability_test in <foo.h></DeprecationSummary></Availability></Function>] /// Aaa. void attr_availability_2() __attribute__((availability(macosx,obsoleted=10.0.1,introduced=8.0.1,deprecated=9.0.1))); // CHECK: FullCommentAsXML=[<Function file="{{[^"]+}}annotate-comments-availability-attrs.cpp" line="[[@LINE-2]]" column="6"><Name>attr_availability_2</Name><USR>c:@F@attr_availability_2#</USR><Declaration>void attr_availability_2()</Declaration><Abstract><Para> Aaa.</Para></Abstract><Availability distribution="macOS"><IntroducedInVersion>8.0.1</IntroducedInVersion><DeprecatedInVersion>9.0.1</DeprecatedInVersion><RemovedAfterVersion>10.0.1</RemovedAfterVersion></Availability></Function>] /// Aaa. void attr_deprecated_1() __attribute__((deprecated)); // CHECK: FullCommentAsXML=[<Function file="{{[^"]+}}annotate-comments-availability-attrs.cpp" line="[[@LINE-2]]" column="6"><Name>attr_deprecated_1</Name><USR>c:@F@attr_deprecated_1#</USR><Declaration>void attr_deprecated_1()</Declaration><Abstract><Para> Aaa.</Para></Abstract><Deprecated/></Function>] /// Aaa. void attr_deprecated_2() __attribute__((deprecated("message 1 <foo.h>"))); // CHECK: FullCommentAsXML=[<Function file="{{[^"]+}}annotate-comments-availability-attrs.cpp" line="[[@LINE-2]]" column="6"><Name>attr_deprecated_2</Name><USR>c:@F@attr_deprecated_2#</USR><Declaration>void attr_deprecated_2()</Declaration><Abstract><Para> Aaa.</Para></Abstract><Deprecated>message 1 <foo.h></Deprecated></Function>] /// Aaa. void attr_unavailable_1() __attribute__((unavailable)); // CHECK: FullCommentAsXML=[<Function file="{{[^"]+}}annotate-comments-availability-attrs.cpp" line="[[@LINE-2]]" column="6"><Name>attr_unavailable_1</Name><USR>c:@F@attr_unavailable_1#</USR><Declaration>void attr_unavailable_1()</Declaration><Abstract><Para> Aaa.</Para></Abstract><Unavailable/></Function>] /// Aaa. void attr_unavailable_2() __attribute__((unavailable("message 2 <foo.h>"))); // CHECK: FullCommentAsXML=[<Function file="{{[^"]+}}annotate-comments-availability-attrs.cpp" line="[[@LINE-2]]" column="6"><Name>attr_unavailable_2</Name><USR>c:@F@attr_unavailable_2#</USR><Declaration>void attr_unavailable_2()</Declaration><Abstract><Para> Aaa.</Para></Abstract><Unavailable>message 2 <foo.h></Unavailable></Function>]
void SCardReader::onFinished() { emit unavailable(m_name); }
// rdar://9623855 void unavail(void) __attribute__((__unavailable__)); void unavail(void) { // No complains inside an unavailable function. int ir = foo(1); double dr = dfoo(1.0); void (*fp)() = &bar; double (*fp4)(double) = dfoo; } // rdar://10201690 enum foo { a = 1, b __attribute__((deprecated())) = 2, c = 3 }__attribute__((deprecated())); enum fee { // expected-note {{declaration has been explicitly marked unavailable here}} r = 1, // expected-note {{declaration has been explicitly marked unavailable here}} s = 2, t = 3 }__attribute__((unavailable())); enum fee f() { // expected-error {{'fee' is unavailable}} int i = a; // expected-warning {{'a' is deprecated}} i = b; // expected-warning {{'b' is deprecated}} return r; // expected-error {{'r' is unavailable}} }