From: Martin P. <ma...@pe...> - 2009-05-29 10:47:42
|
Considering "qt won't start without config file" problems: I saw article: https://www.abclinuxu.cz/clanky/programovani/graficke-programy-v-qt-4-7-lokalizace-a-data-programu and I though of solution - some files (perhaps the main config file and maybe some/all icons and scripts) can be put into resources. If we put up a resource file like: <!DOCTYPE RCC><RCC version="1.0"> <qresource> <file>pdfeditrc</file> <file>icon/Tango/about.png</file> .... </qresource> </RCC> Then add to pdfedit.pro something like this: RESOURCES += resources.qrc then the specified files would end up embedded in the binary, and we can access them like this: QPixmap icon(":/icon/Tango/about.png"); QFile and QDir can be used too for reading(QFile)/enumerating(QDir) resources (http://doc.trolltech.com/4.5/resources.html) So we'll just add the resource path ":/" to search path for icons and scripts and we can put these to resources, which will basically eliminate "main config file not found" bugs, since it would be embedded in the binary by the compiler (though i'll keep it so it would look in the "usual directories" first, so you can override these data files without having to recompile the binary) What could be easily put up in resources and be used from there: * Scripts. Icons. Main config file What probably can't be put there (or at least it won't be easy to do): * Translations. Help files Note that this resource system is Qt4 only - Qt3 does not have this mechanism. So we can use it once qt4 will be complete. Any thoughts/opinions? Martin Petricek -- GPG/PGP Public key: http://www.petricek.net/petricm.pgp Fingerprint 6AA8 FFCE C061 1CB2 55F0 A1F3 3AA9 EB4F BD50 C1B8 /------------------------------------------------------------\ | WWW: http://www.petricek.net/ | \------------------------------------------------------------/ |