Find the Best Demos and Examples

Check out this quick tour to find the best demos and examples for you, and to see how the Felgo SDK can help you to develop your next app or game!

Forums

OverviewFelgo 2 Support (Qt 5) › How to deal with partially loaded DownloadableResource?

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #23779

    Dmitry

    Hi!

    I`m using DownloadableResource to store images in cache folder.

    But, as it is an image, and can be used in ListView, and delegate can be destroyed before DownloadableResource is actually loaded.

    As an error, when AppImage loads such an image, I have string in logs:

    Corrupt JPEG data: premature end of data segment

    In this case there is no Image.Error status when image loads file from local fs.

    And there is no (visible for me) method to determine is image was really loaded.

    remove() in Component.onDestruction when DownloadableResource  status is Downloading also does not help.

    Also, DownloadableResource status===Available does not mean file is ready (for me, dont know why), its become available after downloadFinished signal, is it correct?

    so
    1) How can I validate jpeg before loading?

    or…

    2) How can I detect and remove partially-downloaded file, if DownloadableResource component is destroyed while downloading?

    #23780

    Alex
    Felgo Team

    Hi,

    as a first approach, would it be possible t avoid destroying the DownloadableResource item, because it is effectively not designed to just be destroyed mid-download. E.g. have a download manager class in your app root that takes care of the downloads and is not destroyed at runtime.

    Other than that, you’d probably need to analyze the image yourself. As far as I know, Qt uses libjpeg to decode images. Since the AppImage (using a Qt Image internally, which is derived from QImage) does not display an error, Qt does not seem to report possible decoding errors the image. This is just guessing though.

    Best,
    Alex

Viewing 2 posts - 1 through 2 (of 2 total)

RSS feed for this thread

You must be logged in to reply to this topic.