[Marble-devel] Review Request 116525: Added support to download remote images/icons

Dennis Nienhüser earthwings at gentoo.org
Sun Jul 6 13:54:17 UTC 2014


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/116525/#review61700
-----------------------------------------------------------



src/lib/marble/RemoteIconLoader.h
<https://git.reviewboard.kde.org/r/116525/#comment42935>

    const QByteArray &, const QString &



src/lib/marble/RemoteIconLoader.cpp
<https://git.reviewboard.kde.org/r/116525/#comment42938>

    this is leaked currently, HttpDownloadManager does not take ownership of it. The easiest fix would be to change it to
    
    FileStoragePolicy m_storagePolicy;
    
    and further above likewise 
    RemoteIconLoaderPrivate() : m_storagePolicy( MarbleDirs::path( "/cache/icons/" ) ),
    ...



src/lib/marble/RemoteIconLoader.cpp
<https://git.reviewboard.kde.org/r/116525/#comment42940>

    should be deleted in the destructor (even if the class is assumed to be used statically only), or change to HttpDownloadManager m_downloadManager;



src/lib/marble/RemoteIconLoader.cpp
<https://git.reviewboard.kde.org/r/116525/#comment42936>

    cachedIcon (not a capital C at start)



src/lib/marble/RemoteIconLoader.cpp
<https://git.reviewboard.kde.org/r/116525/#comment42937>

    the name is somewhat confusing. What about loadFromDiskCache instead?



src/lib/marble/RemoteIconLoader.cpp
<https://git.reviewboard.kde.org/r/116525/#comment42948>

    QImage(path) seems to be problematic in newer Qt 5.x versions. Better use sth. along the lines of
    m_icon = QFile::exists( path ) ? QImage( path ) : QImage();
    
    Isn't the approach taken here a design flaw? RemoteIconLoader is used as a static class, and searchLocalDir writes m_icon without noting it's url/path. If you load more than one icon then the wrong one might be returned (the next call just overwrites any previous m_icon). To fix it just remove the m_icon member and store the loaded image in m_iconCache when it is not null. So something like
    
    QString const path = MarbleDirs::path( QString("/cache/icons/") + cacheFileName( url ) );
    QImage const icon = QFile::exists( path ) ? QImage( path ) : QImage();
    if ( !m_icon.isNull() ) {
      m_iconCache[url] = m_icon;
      return true;
    }
    return false;



src/lib/marble/RemoteIconLoader.cpp
<https://git.reviewboard.kde.org/r/116525/#comment42944>

    (this will stay the same even if you change the signature to const QByteArray &, const QString & above)


- Dennis Nienhüser


On July 5, 2014, 6:25 p.m., Abhinav Gangwar wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/116525/
> -----------------------------------------------------------
> 
> (Updated July 5, 2014, 6:25 p.m.)
> 
> 
> Review request for Marble, Bernhard Beschow, Dennis Nienhüser, Torsten Rahn, and Thibaut Gridel.
> 
> 
> Bugs: 310464
>     http://bugs.kde.org/show_bug.cgi?id=310464
> 
> 
> Repository: marble
> 
> 
> Description
> -------
> 
> The patch adds support to download remote images
> 
> 
> Diffs
> -----
> 
>   src/lib/marble/CMakeLists.txt a016307 
>   src/lib/marble/PlacemarkLayout.cpp 408607b 
>   src/lib/marble/RemoteIconLoader.h PRE-CREATION 
>   src/lib/marble/RemoteIconLoader.cpp PRE-CREATION 
>   src/lib/marble/VisiblePlacemark.cpp 8811598 
>   src/lib/marble/geodata/data/GeoDataIconStyle.h 8838e49 
>   src/lib/marble/geodata/data/GeoDataIconStyle.cpp 6902fcf 
>   src/lib/marble/VisiblePlacemark.h 5356f4d 
> 
> Diff: https://git.reviewboard.kde.org/r/116525/diff/
> 
> 
> Testing
> -------
> 
> Works fine on my system
> 
> 
> Thanks,
> 
> Abhinav Gangwar
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/marble-devel/attachments/20140706/ed735d9c/attachment.html>


More information about the Marble-devel mailing list