phim xxx

indian girls

Archive for the ‘Qt’ Category

GLModel part 3

Today I posted the third chapter of the GLModel article series. You can find a link to the article on the sidebar of the blog.

QUiViewer

I have written a small application today which aims at viewing UI files from Qt4. Nothing special, but can be very usefull. I based the idea on KUIViewer program which allows the user to view Qt3 UI files (unfortunately it crashes when fed with an UI from Qt4).

You can get the app tarball here.

Syntax highlighter

Today my thoughts about making syntax highlighting for my blog came back to me. As my blog is based on bash scripts, I needed an application that would do the actual highlighting. I know there exists a plugin for nanoblogger that enables syntax highlighting, but it’s fair from being mature. So I sat down and implemented
my own generic syntax highlighter. It’s not complete yet, but it already does some highlighting and it only took about an hour to implement. Qt was very helpful, as usual :)

Testing the highlighter should include trying to parse the code of the highlighter itself and so I did. You can see the result below.

  1. #include
  2. #include
  3. #include
  4. #include
  5. #include
  6. #include
  7. #include
  8. class�QHighlighter{
  9. public:
  10. ��QHighlighter(QIODevice�*indevice);
  11. ��void�readConfig(QIODevice�*configdevice);
  12. ��QString�parse();
  13. protected:
  14. ��QString�isKeyword(const�QString�&);
  15. ��QString�parseNumber();
  16. ��QString�parseIdentifier();
  17. ��QString�parseString();
  18. ��QString�parseComment();
  19. ��QString�parsePreproc();
  20. ��QString�parseSLComment();
  21. ��void�makeLines(bool�count=false);
  22. ��QIODevice�*_indevice;
  23. ��bool�_perror;
  24. ��QString�output;
  25. ��QMap<QString,�QStringList>�keywords;
  26. ��
  27. };
  28. void�QHighlighter::readConfig(QIODevice�*configdevice){
  29. ����QDomDocument�doc;
  30. ����if(!doc.setContent(configdevice)){
  31. ��������qDebug(“CONFIG ERROR”);
  32. ��������return;
  33. ����}
  34. ����QDomElement�root�=�doc.documentElement();
  35. ����for(QDomElement�keywselem�=�root.firstChildElement(“keywords”);�
  36. ��������!keywselem.isNull();�
  37. ��������keywselem�=�keywselem.nextSiblingElement(“keywords”))
  38. ����{
  39. ��������QStringList�kw;
  40. ��������for(QDomElement�key�=�keywselem.firstChildElement(“keyword”);�
  41. ������������!key.isNull();
  42. ������������key�=�key.nextSiblingElement(“keyword”))
  43. ��������{
  44. ������������kw�<<�key.text().trimmed();
  45. ��������}
  46. ��������QDomElement�keystyle�=�keywselem.firstChildElement(“style”);
  47. ��������QString�kstyle�=�keystyle.text().replace(“$”,�“%”).replace(“[“,�“<").replace(“]–>,�“>”);
  48. ��������keywords[kstyle]�=�kw;
  49. ����}
  50. }
  51. QString�QHighlighter::isKeyword(const�QString�&s){
  52. ��foreach(QString�k,�keywords.keys()){
  53. ����const�QStringList�&slist�=�keywords[k];
  54. ����foreach(QString�el,�slist){
  55. ������if(QRegExp(el).exactMatch(s))�return�k.arg(s);
  56. ����}
  57. �}
  58. �return�s;
  59. }
  60. QHighlighter::QHighlighter(QIODevice�*indevice){
  61. ��_indevice�=�indevice;
  62. ��_perror�=�false;
  63. }
  64. void�QHighlighter::makeLines(bool�countLines){
  65. ��if(!countLines)�output�=�output.replace(“\n”,�
    );
  66. ��else�{
  67. ����QString�n�=�
      “;

    1. ����foreach(QString�line,�output.split(“\n”)){
    2. ������n+=QString(
    3. %1
    4. \n”).arg(line);

    5. ����}
    6. ����n+=

    ;

  68. ����output�=�n;
  69. ��}
  70. }
  71. QString�QHighlighter::parse(){
  72. ��QString�current;
  73. ��while(!_indevice->atEnd()){
  74. ����char�c�=�_indevice->peek(1).at(0);
  75. ����QChar�ch(c);
  76. ����if(ch.isNumber())�{
  77. ������current�=�parseNumber();
  78. ������output�+=QString(%1).arg(current);
  79. ����}�else�if(ch.isLetter()�||�ch==‘_’)�{
  80. ������current�=�parseIdentifier();
  81. ������output�+=�isKeyword(current);
  82. ����}�else�if(c==‘”‘||�c==‘\”�)�{
  83. ������current�=�parseString().replace(“<“,�“<“);
  84. ������output�+=QString(%1).arg(current);
  85. ����}�else�if(c==‘/’�&&�_indevice->peek(2)==“/*”)�{
  86. ������current�=�parseComment().replace(“<“,�“<“);
  87. ������output�+=QString(%1).arg(current);
  88. ����}�else�if(c==‘/’�&&�_indevice->peek(2)==“//”){
  89. ������current�=�parseSLComment().replace(“<“,�“<“);
  90. ������output�+=�QString(%1).arg(current);
  91. ����}�else�if(c==‘#’){
  92. ������current�=�parsePreproc().replace(“<“,�“<“);
  93. ������output�+=�QString(%1).arg(current);
  94. ����}�else�if(c==‘<‘){
  95. ����_indevice->getChar(&c);
  96. ������output�+=�“<“;
  97. ����}�else�{
  98. ������_indevice->getChar(&c);
  99. ������if(c!=‘ ‘)
  100. ������output�+=�c;
  101. ������else�output�+=“�”;
  102. ����}
  103. ��}
  104. ��makeLines(true);
  105. ��return�output;
  106. }
  107. QString�QHighlighter::parsePreproc(){
  108. ��return�_indevice->readLine();
  109. }
  110. QString�QHighlighter::parseSLComment(){
  111. ��return�_indevice->readLine();
  112. }
  113. QString�QHighlighter::parseNumber(){
  114. ��QString�result;
  115. ��char�c;
  116. ��while(!_indevice->atEnd()){
  117. ����if(!_indevice->getChar(&c)){
  118. ������_perror�=�true;
  119. ������return�result;
  120. ����}
  121. ����QChar�ch(c);
  122. ����if(ch.isNumber()�||�c==‘.’){
  123. ������result+=c;
  124. ����}�else�{
  125. ������_indevice->ungetChar(c);
  126. ������return�result;
  127. ����}
  128. ��}
  129. ��return�result;
  130. }
  131. QString�QHighlighter::parseComment(){
  132. ��QString�result;
  133. ��char�c=‘\0′;
  134. ��char�prev=‘\0′;
  135. ��while(!_indevice->atEnd()){
  136. ����if(!_indevice->getChar(&c)){
  137. ������_perror�=�true;
  138. ������return�result;
  139. ����}
  140. ����// match */
  141. ����if(c==‘/’�&&�prev==‘*’){
  142. ��������result�+=c;
  143. ��������return�result;
  144. ����}
  145. ����prev�=�c;
  146. ����result+=c;
  147. ��}
  148. ���_perror�=�true;
  149. ��return�result;
  150. }
  151. QString�QHighlighter::parseIdentifier(){
  152. ��QString�result;
  153. ��char�c;
  154. ��while(!_indevice->atEnd()){
  155. ����if(!_indevice->getChar(&c)){
  156. ������_perror�=�true;
  157. ������return�result;
  158. ����}
  159. ����QChar�ch(c);
  160. ����if(ch.isLetter()�||�ch.isDigit()�||�c==‘_’�||�c==‘:’){
  161. ������result+=c;
  162. ����}�else�{
  163. ������_indevice->ungetChar(c);
  164. ������return�result;
  165. ����}
  166. ��}
  167. ��return�result;
  168. }
  169. QString�QHighlighter::parseString(){
  170. ��QString�result;
  171. ��char�c;
  172. ��char�sep;
  173. ��_indevice->getChar(&sep);
  174. ��result+=sep;
  175. ��while(!_indevice->atEnd()){
  176. ����if(!_indevice->getChar(&c)){
  177. ������_perror�=�true;
  178. ������return�result;
  179. ����}
  180. ����if(c==‘\\’){
  181. ������if(!_indevice->getChar(&c)){
  182. ��������_perror�=�true;
  183. ��������return�result;
  184. ������}
  185. ������result+=‘\\’;
  186. ������result+=c;
  187. ����}�else�if(c!=sep)�
  188. ������result+=c;
  189. �����else�{
  190. ������// _indevice->ungetChar(c);
  191. ��������result+=c;
  192. �������return�result;
  193. �����}
  194. ��}
  195. ��_perror�=�true;
  196. ��return�result;
  197. }
  198. int�main(int�argc,�char�**argv){
  199. ��QFile�infile(argv[1]);
  200. ��if(!infile.open(QFile::ReadOnly))�return�2;
  201. ��QHighlighter�h(&infile);
  202. ��QFile�config(“h.config”);
  203. ��if(!config.open(QFile::ReadOnly))�return�2;
  204. ��h.readConfig(&config);
  205. ��QString�result�=�h.parse();
  206. ��QFile�outfile(“hh.html”);
  207. ��outfile.open(QFile::WriteOnly);
  208. // outfile.write(”
    ");

  209. ��outfile.write(result.toLocal8Bit());
  210. // outfile.write(“”);

  211. ��return�0;
  212. }

  213. ]]>

Mandriva and Qt4.2 font problems

Yes! I finally managed to solve my font problems with Mandriva and Qt 4.2. What was happening was that font antialiasing was not working for any of the Qt4.2 applications. What was funny was that for Qt4.1.4 everything was (and still is) working fine.

I was trying to find a solution since the very beginning of Qt4.2 public snapshots. At first I thought that this was caused by the fact that Qt4.2 was still unstable but when 4.2.0 came out and the problem persisted, I became worried. I even talked to Trolltech support during DevDays in Munich about the issue, but without any result.

Today I finally managed to get my fonts antialiased in Mandriva. The problem is caused by a configuration file from Mandriva’s fontconfig package, which disables antialiasing for some fonts. I don’t know why, but although it shouldn’t, Qt4.2 triggers one of the sections in the file that disables antialiasing. What is strange is that changing font faces in qtconfig doesn’t solve anything – the section is still triggered,
so the problem might be within Qt or fontconfig.
The workaround is to remove the file (or comment out the section) – it is situated in /etc/fonts/conf.d/ and is called 02-mdk-disable-antialias.conf.

I just sent a bug report to Trolltech about it, let’s see if they can do anything about it.

Finally I can start playing around with a fully working Qt4.2 installation…

Designer Tutorial

Some time ago I created and published a video tutorial for Qt4 Designer. Nothing funky, some small speaking problems, but hopefully next tutorial will be better.

I received a good feedback from people who have seen the tutorial before I published it, so hopefully someone will find my work useful.

You can download the tutorial from my webpage.

Impressions from DevDays 2006

I came back from Munich (Germany) where I attended Trolltech Developer Days and after a week I’d like to describe the trip and my impressions.

One of the main goals of going to that conference was to meet other admins of QtCentre.org. Unfortunately Johan and Axel couldn’t come, but the rest of (more or less) active admins were there – I went to Munich together with Jacek and Daniel lives in Munich so it was easy for him to come.

The conference took place in Hilton Hotel in Munich and consisted of two days with each day divided into sessions (called “Breakouts”). In each session one could choose from three different lectures on various topics.
I noticed that the biggest effort was put on the model-view framework.

The Trolls themselves were really kind. They were wearing T-shirts with “I’m a Troll” writing on the front side and “Ask me” on the back (see pictures below). You could ask them any question and really expect it to be
answered (although my question remained unanswered :P).

I'm a Troll
Ask me

Advanced Item-Views
The quality of sessions was very high. All the Trolls were speaking fluent and plain English. The lectures included examples (like during the “Advanced Item-Views” session, see the picture on the left) and (at least to me) were easy to understand. Some of the lectures were so popular, that people had problems squeezing into the room, but that’s because the three rooms used for Breakouts had different sizes and obviously Trolls made some errors estimating which course will be the most popular in each session.


As I mentioned before, one of the main goals of attending DevDays was to finally meet other administrators in person. I’ve met Daniel Kish (“theLSB” on QtCentre aka “hatulflezet” on QtForum) and together with Jacek (I’ve
known Jacek for 10 years now) we talked a lot and discussed the future of QtCentre.

Daniel taking part in Froglogic contest Jacek and I

Knut and Daniel We’ve also met Knuth Yrwin, the Qt Community Manager in Trolltech. He’s the person responsible for contact with the community, so I expect more contacts between him and QtCentre team. Knut held a “BOF: Open Source” talk which aimed to give goals to Trolltech on how to more support Free Software.
Unfortunately, only a few people attended (one of them was Karin “kyrah”
Kosina
). The discussion was live, loud and firm, but unfortunately didn’t lead to some binding statements on the Trolltech side. Let’s see how the situation develops – the Trolls were notified of Open Source
expectations (although I don’t consider myself a person who might speak on behalf of “Open Source”, but surely consider myself a person who might speak on behalf of Qt community) and we’re in contact with Knut, so
hopefully that’s not the end of this story.


Harald Fernengel (Trolltech Release Manager) demonstrating the penalty for not using QTestLib for developing Qt.

Benoit Schillings (Trolltech CTO) conducting the trivia question contest: “Remember, multiple inheritance is a beautiful thing!”



One of API additions planned for Qt 4.3 – QWidget::setWidowIcon().

Eirik Chambe-Eng (Trolltech Co-CEO) welcomes people to the conference.


GLModel part 2

Today, motivated by a comment on my blog and Johan’s blog post, I have published the next article about making a custom Qt model that holds information about objects in a 3D scene. This article aims to show how to create an internal representation of data used by the model.

Charts 0.2

I’ve been sick for a few days now and I don’t feel like doing anything serious, so I have a lot free time to do “other things”.

I started thinking and finally decided that I should release an update to my MVC charts. I wrote the updated class some time ago but never put it on the Web. Now it’s time to do that. Nothing funky, I added some stuff for manipulating the chart title and axis descriptions. Unfortunately something weird causes charts to eat up all my cpu cycles and I can’t find the reason. I even tried profiling the code but without success. Oh well… maybe I’ll go back to the application and try to trace what’s going on. Better that than lying in bed whole day.

You can download the bundle from my website.

OpenGL Model articles

I decided to write a series of articles about implementing a complete data model based on Qt4 model-view framework called Interview which will hold object data from 3D scenes for use with OpenGL (a series of articles about implementing an OpenGL view in Qt4 will follow).

First two articles are ready:

If you have any commments or requests about those or future articles, drop me a line here or on QtCentre.

New Year — new forum, farewell QtForum!

First of all, Happy New Year everyone!

Phew… it’s been some time now since my last note here, but that time wasn’t wasted. I was busy putting up QtCentre, a new community site dedicated to Qt. The reason for that? Well, simply put, QtForum was sold to a 3rd party, who already owns some other linux-related forums like kde-forum.org, kde-forum.de, ubuntu-forum, gentoo-forum and probably others. We (the moderators of QtForum) tried contacting him both by other people — Christian (previous owner of the board) or directly (via e-mail), but with no success. After that we decided to open our own site and so we did :)

24 hours of QtCentre activity passed an hour ago and we already have about 30 threads, more than 100 posts and about 100 members. That’s not a bad result, isn’t it?

It wasn’t easy for me to give up on QtForum. I spent a lot of time there. It was my first place in the Internet which I could consider “my own”. I posted more than 4200 times there within 20 months. I remember my first days there. Actually it was quite of funny — me, with almost no Qt experience at all, answering complex Qt related questions just by reading the docs. Well, to be honest that’s how I answer most of Qt questions, as Trolltech made a really good job with the reference…

I hope QtForum community spirit will follow us to QtCentre, although I know it’ll not be the same — I’m not just a simple user (or a moderator, as for last months), but an admin now! Whoaa! :)

Ok, enough for today, I have to get up in 6 hours…

And read the docs, Luke! Read the docs… *)


*) That used to be my QtForum signature 😉

xnxx indian