Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. General talk
  3. Brainstorm
  4. Qt and zlib.
QtWS25 Last Chance

Qt and zlib.

Scheduled Pinned Locked Moved Brainstorm
8 Posts 7 Posters 23.8k 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.
  • S Offline
    S Offline
    Skalli
    wrote on 9 Aug 2010, 17:45 last edited by
    #1

    Hello folks!

    What can I say, I've stumbled about something that is puzzling me.

    I'm pretty new to Qt and I'm experimenting with the functions Qt has. In one of those experiments I wanted to load a zip file from the hard disk. A zip file is pretty useless if it's still zipped. Therefore I wanted to unzip the file. I knew Qt has these nice QCompress() and QUncompress() functions, yet I wanted to achieve my objective with zlib.

    Using zlib in my Qt project was easy, the project compiled and run perfectly. Then I stumbled about something: When I printed out the version number of zlib, the result was 1.2.3. Wasn't I using 1.2.5? Indeed, I did!
    My first thought was that there might be older version of the DLL in my system files, but there wasn't. Yet the project ran. Even without the zlib1.dll in the executive path. I realised that the project compiled in release mode to. And even linked, but I haven't set the linker settings for zlib in release mode. So I created another small C++ project where I used zlib and printed the version number. Nothing else. It said 1.2.5. It didn't run without zlib1.dll in the executive path or didn't link without the reference to zlib.dll. ;)

    I can't remove the zlib header file from my project, otherwise the project won't compile. Now, how can this be? Is there a wrapper around zlib in Qt, and are the functions available in a global scope? Or how comes that everything works fine with just the zlib header file in my project?

    Also, has someone an idea how I can achieve the goal of opening password protected zip files? I want to store sensitive files in a password protected zip file, so users can't change them without the programms supervision. Any libs, best practices or hints to achieve that? It hasn't to be a zip file, it also can be some kind of encrypted file.

    Thanks in advance!

    Greetings,
    Skalli :D

    1 Reply Last reply
    0
    • V Offline
      V Offline
      vsorokin
      wrote on 9 Aug 2010, 20:27 last edited by
      #2

      For work with ZIP look here: http://osdab.42cows.org/snippets/zip.php?mode=advanced
      and here: http://quazip.sourceforge.net/

      And more, Qt have undocumented classes QZipReader and QZipWriter.

      --
      Vasiliy

      1 Reply Last reply
      0
      • T Offline
        T Offline
        tzander
        wrote on 9 Aug 2010, 20:34 last edited by
        #3

        Those classes are not only undocumented, they are also not exported so you won't be able to use them.

        But indeed, Qt uses zip internally for things like writing compressed data into a pdf as well as compressing the XML that goes into an ODF document. So QtGui at least links to the libs and if your linker is not too picky it will just work with only a header file.

        1 Reply Last reply
        0
        • A Offline
          A Offline
          andre
          wrote on 10 Aug 2010, 07:08 last edited by
          #4

          If you want to use .zip files, you can also take a look at Bugless Archive. It works as a standard QIODevice, so you can use all normal Qt file IO functions on it. It is available under both a commercial and the GPL licence.

          http://www.bugless.co.uk/products/archive/archive.html

          1 Reply Last reply
          0
          • S Offline
            S Offline
            Smar
            wrote on 10 Aug 2010, 08:12 last edited by
            #5

            QuaZip is very lightweight(just few files that can be included to the source) and powerful for packaging, so I have been using it. IIRC it provides its own zlib headers, though, but then again, it will work anywhere.

            1 Reply Last reply
            0
            • S Offline
              S Offline
              Skalli
              wrote on 12 Aug 2010, 18:05 last edited by
              #6

              Thanks for the replies. :)

              That's alot of useful information there. I will evaluate the libraries you recommended. :)
              I ahve to say, Qt is a great framework. So powerful and easy to use. I hope there'll be a Plug-In for VS2010 soon.

              1 Reply Last reply
              0
              • I Offline
                I Offline
                iksaif
                wrote on 4 Sept 2010, 09:58 last edited by
                #7

                Here are some examples with quazip and libzip: "http://gitorious.org/serieswatcher/serieswatcher/blobs/master/src/updateworker.cpp":http://gitorious.org/serieswatcher/serieswatcher/blobs/master/src/updateworker.cpp

                Check parseShowAndEpisodesZip function.

                1 Reply Last reply
                0
                • Y Offline
                  Y Offline
                  Yash
                  wrote on 6 Sept 2010, 15:56 last edited by
                  #8

                  Excellent resource list.

                  Thank you guys

                  http://kineticwing.com : Web IDE, QSS Editor
                  http://speedovation.com : Development Lab

                  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