[Development] MIME type support in Qt5

wolf-michael.bolle at nokia.com wolf-michael.bolle at nokia.com
Fri Dec 16 16:02:23 CET 2011


Hi folks,

the Qt addon for MIME type support has been progressing along quite nicely, and I thought it was time for a little status update.

David Faure contributed quite a bit of work particularly with the database backends. He implemented a mmap'ed binary cache generated by shared-mime-info where available (UNIX systems) with fallback to parsing the raw XML files otherwise. This makes the MIME type support fast and with very low memory usage on UNIX, and it makes it easy to use on Windows (no dependency on shared-mime-info, Qt even ships a freedesktop.xml file to use if none are found on the system). Here's a (shortened) list from his commits:

  *   Many changes to glob matching: faster, and more correct
  *   Remove the notion of 'levels'.
  *   Add findByNameAndData, useful for remote URLs with data available
  *   Add findByUrl for convenience
  *   Introducing QMimeProviderBase
  *   Load all mime.cache and all packages/*.xml files from the system
  *   Implement mmap-ed-mime.cache glob matching.
  *   Implement lookup in the reverse suffix tree.
  *   Implement support for directories and for special files on UNIX (inode/*)
  *   Parse and process icon tag.
  *   Implement isTextFile as per the spec
  *   Reimplement findByFile to have the proper logic.
  *   Make default icon name from the MIME type name
  *   Rework support for MIME type inheritance
  *   Add support for x-zerosize
  *   Follow the spec: return application/octet-stream in findBy* by default.
  *   Move alias map to XML provider; merge my old unit tests for aliases
  *   Move nameMimeTypeMap to XML provider (to load on demand in binary provider)
  *   Handle nesting of magic rules
  *   Move magic matchers to a global list (in XML provider).
  *   Updated from current shared-mime-info git on freedesktop.org
  *   Binary provider: implement on-demand parsing of XML files
  *   Binary provider: implement magic matching.
  *   Implement magic-matching with mask.
  *   Binary provider: Fix parents(), implement alias().
  *   Remove QMimeFileMatchContext, and just read 16K. Faster.
  *   Speed: only call globPatterns on failure
  *   Move QMimeGlobMatchResult to qmimeglobpattern in order to reuse it
  *   Use QMimeGlobMatchResult logic in the XML provider too.
  *   Binary provider: Implement loading of icons and generic icons.
  *   Share implementation of matchString, the orig one was broken.
  *   Import more unit tests from my KMimeType code. Fix off by one (tnef test)
  *   Binary provider: implement allMimeTypes. Add unit-test
  *   suffixes() is now calculated from globPatterns.
  *   Implement and test suffixForFilename
  *   Remove unused "aliases" member and method
  *   Merge comment and localeComment
  *   Test QMimeDatabase from multiple concurrent threads
  *   Add missing method findByData(QIODevice *)

Thank you David for your impressive amount of work so far.

I mostly worked on the following topics:

  *   Removed ability to update the database during runtime.
  *   Provided a QML wrapper.
  *   Worked on make install
  *   Provided debug messages
  *   Provided support for C++2011 rvalue references.

Beyond that, a lot of work by both of us went into

  *   Code cleanup,
  *   Bug fixing,
  *   Qt4 backward compatibility,
  *   Unit testing and
  *   Documentation.

One of the next steps that I'd like to pursue is moving the repository to qt-project.org. We seem to have the option of adding QtMimeType as a playground project or a real addon module. Since I've never actually done this myself I'd like get some feedback about which of the two options makes more sense to QtMimeType. Thanks in advance for your review.

In any case, to be accepted into Gerrit all previous contributors are required to accept the contributor agreement. I don't have a way to tell if that has happened, already. Can David, Ivan and Konstantin please let me know if you have done that or what your plans are?

Feel free to download the current code from ssh://git@gitorious.org/qmime/qmime.git, and review heavily.

Michael


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20111216/1d981ea0/attachment.html>


More information about the Development mailing list