本文整理汇总了C++中KPMetadata::getImageDateTime方法的典型用法代码示例。如果您正苦于以下问题:C++ KPMetadata::getImageDateTime方法的具体用法?C++ KPMetadata::getImageDateTime怎么用?C++ KPMetadata::getImageDateTime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KPMetadata
的用法示例。
在下文中一共展示了KPMetadata::getImageDateTime方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setImage
bool ClockPhotoDialog::setImage(const KUrl& imageFile)
{
bool success = false;
if (d->imagePreview->load(imageFile.toLocalFile()))
{
// Try to read the datetime data.
KPMetadata meta;
if (meta.load(imageFile.toLocalFile()))
{
d->photoDateTime = meta.getImageDateTime();
if (d->photoDateTime.isValid())
{
// Set the datetime widget to the photo datetime.
d->calendar->setDateTime(d->photoDateTime);
d->calendar->setEnabled(true);
success = true;
}
else
{
// If datetime information couldn't be loaded, display a
// warning and disable the datetime widget.
QString warning = i18n("<font color=\"red\"><b>Could not "
"obtain<br>date and time information<br>"
"from image %1.</b></font>",
imageFile.fileName());
d->imagePreview->setText(warning);
}
}
}
else
{
// If the image couldn't be loaded, display a warning, disable all the
// GUI elements and load an empty photo into d->image.
QString warning = i18n("<font color=\"red\"><b>Could not load<br>"
"image %1.</b></font>",
imageFile.fileName());
d->imagePreview->setText(warning);
}
// Disable all the GUI elements if loading failed.
d->calendar->setEnabled(success);
return success;
}
示例2: info
//.........这里部分代码省略.........
addKmlTextElement(kmlGeometry, "coordinates", QString("%1,%2 ")
.arg(lng, 0, 'f', 8)
.arg(lat, 0, 'f', 8));
}
if (m_altitudeMode == 2 )
{
addKmlTextElement(kmlGeometry, "altitudeMode", "absolute");
}
else if (m_altitudeMode == 1 )
{
addKmlTextElement(kmlGeometry, "altitudeMode", "relativeToGround");
}
else
{
addKmlTextElement(kmlGeometry, "altitudeMode", "clampToGround");
}
addKmlTextElement(kmlGeometry, "extrude", "1");
// we try to load exif value if any otherwise, try the application db
/** we need to take the DateTimeOriginal
* if we refer to http://www.exif.org/Exif2-2.PDF
* (standard)DateTime: is The date and time of image creation. In this standard it is the date and time the file was changed
* DateTimeOriginal: The date and time when the original image data was generated.
* For a DSC the date and time the picture was taken are recorded.
* DateTimeDigitized: The date and time when the image was stored as digital data.
* So for:
* - a DSC: the right time is the DateTimeDigitized which is also DateTimeOriginal
* if the picture has been modified the (standard)DateTime should change.
* - a scanned picture, the right time is the DateTimeOriginal which should also be the DateTime
* the (standard)DateTime should be the same except if the picture is modified
* - a panorama created from several pictures, the right time is the DateTimeOriginal (average of DateTimeOriginal actually)
* The (standard)DateTime is the creation date of the panorama.
* it's seems the time to take into acccount is the DateTimeOriginal.
* but the KPMetadata::getImageDateTime() return the (standard)DateTime first
* KPMetadata seems to take Original dateTime first so it shoul be alright now.
*/
QDateTime datetime = meta.getImageDateTime();
if (datetime.isValid())
{
QDomElement kmlTimeStamp = addKmlElement(kmlPlacemark, "TimeStamp");
addKmlTextElement(kmlTimeStamp, "when", datetime.toString("yyyy-MM-ddThh:mm:ssZ"));
}
else if (m_interface->hasFeature(ImagesHasTime))
{
QDomElement kmlTimeStamp = addKmlElement(kmlPlacemark, "TimeStamp");
addKmlTextElement(kmlTimeStamp, "when", (info.date()).toString("yyyy-MM-ddThh:mm:ssZ"));
}
QString my_description;
if (m_optimize_googlemap)
{
my_description = "<img src=\"" + m_UrlDestDir + m_imageDir + fullFileName + "\">";
}
else
{
my_description = "<img src=\"" + m_imageDir + fullFileName + "\">";
}
if ( m_interface->hasFeature( ImagesHasComments ) )
{
my_description += "<br/>" + info.description() ;
}
addKmlTextElement(kmlPlacemark, "description", my_description);
logInfo(i18n("Creation of placemark '%1'", fullFileName));
// Save icon
QString iconFileName = "thumb_" + baseFileName + '.' + imageFormat.toLower();
QString destPath = m_tempDestDir + m_imageDir + iconFileName;
if (!icon.save(destPath, imageFormat.toAscii(), 85))
{
logWarning(i18n("Could not save icon for image '%1' to '%2'",path,destPath));
}
else
{
//logInfo(i18n("Creation of icon '%1'").arg(iconFileName));
// style et icon
QDomElement kmlStyle = addKmlElement(kmlPlacemark, "Style");
QDomElement kmlIconStyle = addKmlElement(kmlStyle, "IconStyle");
QDomElement kmlIcon = addKmlElement(kmlIconStyle, "Icon");
if (m_optimize_googlemap)
{
addKmlTextElement(kmlIcon, "href", m_UrlDestDir + m_imageDir + iconFileName);
}
else
{
addKmlTextElement(kmlIcon, "href", m_imageDir + iconFileName);
}
QDomElement kmlBallonStyle = addKmlElement(kmlStyle, "BalloonStyle");
addKmlTextElement(kmlBallonStyle, "text", "$[description]");
}
}
}