Exemple #1
0
GPSDataContainer GPSEditDialog::getGPSInfo()
{
    return GPSDataContainer(d->altitudeInput->text().toDouble(),
                            d->latitudeInput->text().toDouble(),
                            d->longitudeInput->text().toDouble(),
                            false);
}
Exemple #2
0
GPSListViewItem::GPSListViewItem(KIPI::Interface* interface, KIPIPlugins::ImagesListView *view, const KUrl& url)
               : KIPIPlugins::ImagesListViewItem(view, url), 
                 d(new GPSListViewItemPriv)
{
    d->interface = interface;
    d->url       = url;

    setEnabled(false);
    setIcon(KIPIPlugins::ImagesListView::Thumbnail,
            SmallIcon( "image-x-generic", KIconLoader::SizeLarge, KIconLoader::DisabledState ));
    setText(KIPIPlugins::ImagesListView::Filename, d->url.fileName());

    double alt, lat, lng;
    KExiv2Iface::KExiv2 exiv2Iface;
    QMap<QString, QVariant> attributes;
    KIPI::ImageInfo info = d->interface->info(d->url);
    attributes = info.attributes();

    if (attributes.contains("latitude") &&
        attributes.contains("longitude") &&
        attributes.contains("altitude"))
    {
        lat = attributes["latitude"].toDouble();
        lng = attributes["longitude"].toDouble();
        alt = attributes["altitude"].toDouble();
        d->hasGPSInfo = true;
    }
    else
    {
        exiv2Iface.load(d->url.path());
        d->hasGPSInfo = exiv2Iface.getGPSInfo(alt, lat, lng);
    }

    if (hasGPSInfo())
        setGPSInfo(GPSDataContainer(alt, lat, lng, false), false);

    QDateTime dt = info.time(KIPI::FromInfo);
    if (!dt.isValid())
        dt = exiv2Iface.getImageDateTime();

    if (dt.isValid())
        setDateTime(dt);
}