Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Quazip functions



  • hi to every one
    i had a problem with -qunzip- quazip compilation that it was solved, thanks to every one
    but now i want to use this lib
    i have a QString containing the data of a file that is compressed and variable's name is comp
    i use this code
    @ JlCompress l;
    comp = l.extractFile(comp,"mm");@
    i think now comp variable should have a extracted file ,is it correct?
    should i use another way?

    [edit : changed qunzip in title to quazip, Eddy]



  • What is qunzip? I didn't find anything in google.



  • Is this a different question than what you are aready discussing in "this":http://developer.qt.nokia.com/forums/viewthread/10120/ topic?



  • yes it is a different question



  • Again, can you get link to qunzip reference or source. We can't help you without this, because it's not popular library.



  • but the documentation in qunzip is italian and i know only english and persian
    i don't see any forum to answers questions
    what should i do?



  • Ok just give link to italian documentation, some Italian guys are on this forum



  • this is a italian documentation
    http://quazip.sourceforge.net/classJlCompress.html



  • So.... it's still qu a zip, not qu n zip



  • yes it was a writing problem i had ,sorry for that



  • OK, this method:
    @static QString extractFile(QString fileCompressed, QString file, QString fileDest = QString());@

    get first param - path to your .zip file
    get second param - name of file for extracting in .zip archive.
    get third param - name for uncompressed version of file.

    if third param is not set, fileDest = file, i.e. destination file will has same name ("mm" in your example)
    After this method finished, destination file will created. and method return you path to this file (not data, data already in file on hdd).

    More, it is static method, you are not needed create instance of JlCompress

    just make:

    @QString comp = JlCompress::extractFile(comp,"mm"); // comp is a filePath
    ....
    @



  • but i have my compressed file in the one of the cells of my table in db, it is bubble data
    and i read it to a qstring
    and i don't have the name of files on my compressed file
    should i write it to a file?



  • I think you can.
    But for this you need use lower level of quazip, you need use QuaZip class
    It has constructor
    @QuaZip(QIODevice *ioDevice);@
    and you can set QDataStream.

    Also QuaZip class was written by russian guy and it has english documentation, also you can look to tests - its are good examples of using.



  • A [[Doc:QDataStream]] is not a [[Doc:QIODevice]], one would have to pass a [[Doc:QFile]] or another QIODevice subclass to the QuaZip constructor.

    How do you "have the compressed file in the cell" of your table? We speak of arbitrary binary data, which needs to be stored in a QByteArray and which is hardly ever readable to a human.



  • [quote author="Volker" date="1317330881"]A :QDataStream is not a QIODevice[/quote]
    Ahh! Shame on me! :-/



  • it is a blob cell that contain a zipped file, how can i use this with quazip?
    i tried to open this blob cell to a qstring or qbytearray but it does'nt work correctly , it load only a few charachters , i think it has null values into it , what should i do?



  • Sorry, I misread your post. A "cell in the table" usually triggers the concept of something like a [[Doc:QTableWidget]] in Qt world (and not only there). You were referring to a BLOB column of a database table, which make much more sense.

    In that case:
    Read the BLOB data into a [[Doc:QByteArray]], feed that as that data storage to a [[Doc:QBuffer]] and feed that to the QuaZip constructor mentioned by Vass.


Log in to reply