Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. [Solved] Compressing and uncompressing zip files: unclear documentation about qCompress and qUncompress functions

[Solved] Compressing and uncompressing zip files: unclear documentation about qCompress and qUncompress functions

Scheduled Pinned Locked Moved Mobile and Embedded
12 Posts 4 Posters 18.0k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    tobias.hunger
    wrote on last edited by
    #2

    From what I understand qCompress/qUncompress are based on zlib and not compatible with zip. Is that your question?

    If you found some issue in the documentation, please "file a bug report":http://bugreports.qt.nokia.com/ against it.

    1 Reply Last reply
    0
    • AlicemirrorA Offline
      AlicemirrorA Offline
      Alicemirror
      wrote on last edited by
      #3

      I have not clear two things, now that I read your post :)

      Why qCompress / qUncompress are not compatibile with zip files if I have read somewhere that are for file zippped (probably I have not clear ideas on these aspects) and what is the difference between zip and zlib for compressing / uncompressing file?

      The second question is: I have not idea if this is bug. I should to find the documentation on these fucntions before to know if the link is bugged or if these functions are part of QByteArray but are not documented...

      Some advice ?

      Enrico Miglino (aka Alicemirror)
      Balearic Dynamics
      Islas Baleares, Ibiza (Spain)
      www.balearicdynamics.com

      1 Reply Last reply
      0
      • L Offline
        L Offline
        lgeyer
        wrote on last edited by
        #4

        The "documentation":http://doc.qt.nokia.com/latest/qbytearray.html#qCompress-2 is very sparse on qCompress / qUncompress. As far as I know both functions are just "zlib":http://www.zlib.net/ wrappers.

        Even though they can be used to uncompress data stored in ZIP archives you still need additional code which handles the ZIP archives themselves. The zlib package includes such code (minizip). A widely known Qt-style wrapper around this code is - as you've already found out - QuaZip.

        So if it is about handling ZIP files you should start with QuaZip or your own wrapper around minizip. If it is just about handling archives in general you might select another archive format (tar for example).

        As to the documentation: I usually use Google or Qt Creator to dig through the documentation. Both usually yield more suitable results then the QDN doc search.

        1 Reply Last reply
        0
        • L Offline
          L Offline
          lgeyer
          wrote on last edited by
          #5

          [quote author="Alicemirror" date="1316096117"]Why qCompress / qUncompress are not compatibile with zip files if I have read somewhere that are for file zippped (probably I have not clear ideas on these aspects) and what is the difference between zip and zlib for compressing / uncompressing file? [/quote]

          There is a difference between a compressed byte stream and an archive.

          If you want to combine multiple files into a single compressed file there are two steps involved

          • creating a single file out of multiple files (archive)
          • compress this single file (compress)

          Whereas the zlib can handle the second part well, it has no clue on how to split the resulting byte stream into multiple files. This where minizip shines.

          A perfect example is compression in Linux, where both steps are still seperated. You first archive your data (tar) and then compress it (gzip, bzip2), which results in .tar.gz or .tar.bz2 files.

          1 Reply Last reply
          0
          • AlicemirrorA Offline
            AlicemirrorA Offline
            Alicemirror
            wrote on last edited by
            #6

            @Lukas: now things are more clear. So, first thanks :)

            bq. Even though they can be used to uncompress data stored in ZIP archives you still need additional code which handles the ZIP archives themselves. The zlib package includes such code (minizip). A widely known Qt-style wrapper around this code is – as you’ve already found out – QuaZip.

            As a matter of fact this is the case that I should handle: a web service send me a QByteStream containing a .zip file that includes at least two folders and a set of images. Thus we return to the Qazip library that I have already downlaoded. It seems a step impossible to avoid.

            bq. As to the documentation: I usually use Google or Qt Creator to dig through the documentation. Both usually yield more suitable results then the QDN doc search.

            Me too, but in this case I searched on the online doc because I was aware before that I need help so it is useful to post the links of the references in the discussion :)

            bq. A perfect example is compression in Linux, where both steps are still seperated. You first archive your data (tar) and then compress it (gzip, bzip2), which results in .tar.gz or .tar.bz2 files.

            I know this, so I have already searched for something like this but I can't decide how to do on the server side that send me a zip file only.

            Enrico Miglino (aka Alicemirror)
            Balearic Dynamics
            Islas Baleares, Ibiza (Spain)
            www.balearicdynamics.com

            1 Reply Last reply
            0
            • L Offline
              L Offline
              lgeyer
              wrote on last edited by
              #7

              I think the easiest and fastest way is to go with QuaZip. As far as I can see it is licensed under the terms of the zlib license which permits intergration into commercial projects. And there is even recent development too. What more could one want ;-)

              1 Reply Last reply
              0
              • AlicemirrorA Offline
                AlicemirrorA Offline
                Alicemirror
                wrote on last edited by
                #8

                Me too. Many thanks Lukas. I have downloaded the sources anche cked them, are really well documented and already Qt-Oriented. Maybe not so difficult to recompile a version running for Symbian and Meego. My concern is only about the way to manage local libraries in Qt Quick applicaitons but I think that I will find some example about, i.e. the QPaint application shows the plugins management.

                Enrico Miglino (aka Alicemirror)
                Balearic Dynamics
                Islas Baleares, Ibiza (Spain)
                www.balearicdynamics.com

                1 Reply Last reply
                0
                • L Offline
                  L Offline
                  lgeyer
                  wrote on last edited by
                  #9

                  You're welcome.

                  As to integration: the zlib license is very permissive. Just link it statically or even add the source to your project and compile it along with it.

                  1 Reply Last reply
                  0
                  • AlicemirrorA Offline
                    AlicemirrorA Offline
                    Alicemirror
                    wrote on last edited by
                    #10

                    Thank you for the suggestions. I saw that the QaZip includes also a Qt project. So I was unsure on what to do. I'll try to compile it stand alone to see what are the issues for the mobile devices then with a stable code I integrate in my application at all.

                    As it works I will prepare a open component based on this library. Maybe useful for a lot of people.

                    Enrico Miglino (aka Alicemirror)
                    Balearic Dynamics
                    Islas Baleares, Ibiza (Spain)
                    www.balearicdynamics.com

                    1 Reply Last reply
                    0
                    • AlicemirrorA Offline
                      AlicemirrorA Offline
                      Alicemirror
                      wrote on last edited by
                      #11

                      Many thanks for the help supporting the considerations above helping me to find a decision on how-to-proceed.

                      I will develop a QaZip derived version for Symbian and Meego.

                      Cheers :)

                      Enrico Miglino (aka Alicemirror)
                      Balearic Dynamics
                      Islas Baleares, Ibiza (Spain)
                      www.balearicdynamics.com

                      1 Reply Last reply
                      0
                      • W Offline
                        W Offline
                        wtgalaxysemi
                        wrote on last edited by
                        #12

                        KArchive seems now to be able to uncompress lot of different formats, not limited to Zip...

                        1 Reply Last reply
                        0

                        • Login

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • Users
                        • Groups
                        • Search
                        • Get Qt Extensions
                        • Unsolved