Code With Trance



Port GoalTime to QNX(Simulator)

Time to relax. I am looking for sth interesting stuff around me or ........qt.
You may be interested about  Qt Comes to QNX .Besides IOS,Android,WebOS,QNX,which one will be the next? Bada?!@$#@#$ no matter what happened yestoday or last-year,or what may or may not happen tomorrow.In a word, welcome to Qt family.
Follow the Instructions(check it out,, basically,no pain for you to port your qt app on the BlackBerry device(I should say at least PlayBook2 Simulator,cause no available playbook2 device for me by far :( ). 

Here,I think there are still sth useful tips for people in need.

1. Remember to set corresponding qt for qnx(arm or x86) environment variable before compiling your qt app against qnx.
2. app resolution on the BlackBerry PlayBook2 is: 1024×600

3. ./configure-qsk x86 for simulator based app building ,
    ./configure-qsk arm a9 for device based app building

4. libraries (only are declared in pro file)and bin will be packaged together and deployed in
For Qml application,importing all the qml files and necessary data (images) in app's resource file,storing them in the app's executable so that you won't get into trouble with relative path any more if do it so.Otherwise setSource() or setMainQmlFile() for QtDeclarative can't load and parse qml file correctly if  the given relative path was wrong.If your invoke this method by using default qmlapplicationviewer framework(load qml file in relative path ),little code change will be needed,As some post regarding tip here:
   Just add
   -e qml qml \

   to the bar package section of the pro file and adjust the path to main.qml in main.cpp

6. remember to explicit declare all the libraries app at runtime depends on in .pro like this. for GoalTime
-e $$[QT_INSTALL_LIBS]/libQtCore.
so.4 lib/ \
-e $$[QT_INSTALL_LIBS]/ lib/ \
-e $$[QT_INSTALL_LIBS]/ lib/ \
-e $$[QT_INSTALL_LIBS]/ lib/ \
-e $$[QT_INSTALL_LIBS]/ lib/ \
-e $$[QT_INSTALL_LIBS]/ lib/ \
-e $$[QT_INSTALL_LIBS]/ lib/ \
-e $$[QT_INSTALL_LIBS]/ lib/ \
-e $$[QT_INSTALL_LIBS]/ lib/ \
-e $$[QT_INSTALL_LIBS]/ lib/ \
More details Pls check it here Qt Comes to QNX
Even though nothing wrong on building, it will crash at startup sometimes when launching app on QNX(or at least on the simulator).The reason for this lies in one or more libraries are missing.As I metioned before,libraries which are only declared in pro file can be packaged with bin and deployed on simulator,I am not for sure if it's the same case happened on device(playbook2).
7.In case sth unexpected happened,there is still a way to figure it out.As document mentioned,

get stdout and stderr on the PlayBook:
$ cat /accounts/1000/appdata//logs/log

The same to simulator.

PS:It seems like the library is missing........


GoalTime For Soccer fan

After submitting in OVI store for QA for 4 weeks.GoalTime is finally on the market. (mobile device based on symbian^3 and symbian v5 are still not available due to the sharing functionality failed,but for N950 and N900 work fine anyway).So if you are sports fan,check it out at OVI store link for this app enjoy...........

About GoalTime

"GoalTime is Qt based App that help user to view latest  match score( Football, Italian Serie A, Barclays Premiership, Spanish Primera Division, Italian Serie A, German undesliga, French Series 1 League, basketball, Tennis...) in real-time. Besides scoring tips,user can check ongoing match score, goals, red and yellow card. And also choose matches you are interested in and strip the leagues out which you don't wanna pay attention to as well as sharing match info with your friends on social
network like facebook, twitter, weibo.... of course it will consumes a small amount of network traffic."


Different people with different life

Best wish to you  Shawn.
I will miss you.


3DHappyFrog is coming

 It takes me some time to record a video and upload it to Youtube(What a bloody GFW).hum..............

As the description I post on Youtube channel.
This app is developed by using Qt3D/QML integrated with Bullet 3D physics engine.Due to this game is 3D-game,There are 2 types of play,one is controlled by user(you can regard N950/N9 as game controller) ,another is based on sensor.More details,pls watch recorded video.The explosion effect looks like not bad.As you see,I deploy this game on N950,Basically,The performance and some details are not as good as expected.Still Some bugs are needed to be fixed and lots of room to improve,such as better 3D model, effect,audio,optimization on painting to boost FPS.On the other hand,This app is being built on Qt3D-1.0-tp1.which is not blown release(Qt3D is still in-progress).That's why I've not released the debian package and source code yet.So stay tuned.

In one word,It's far from being stable,playable and complete from my perspective. 
Keep going.Hopefully you'll like it when released. :)


Call your ideas:level design For 3D-HappyFrog

3D-HappyFrog is on the way,90 percent has been done.I suppose that it will be going to be released next week or the week after next.Be patient and it will take a while.I am working hard on the rest of it.One problem encounters besides coding,I've been racking my brain to design brand-new levels and no good idea about this though by far.Evidently I find that level design is much more difficult than programming.
So if you were me,how do you to design there levels?
One snapshot as following.

This is my humble design.If there is no any other level easier than this one,I decide to mark it as level one.If you lost more than 1 life here...(*(JHIY*T&T*&*^(H
What you have still now? fixtures?

Of course, All fixture support local transformation.

That's it,If you have good ideas,pls contact me via e-mails,expecting your wonderful work.


Keep calm and Hack on

Clearly I remember that this is my secound time recerving a gift bag from Oslo,which is as a award of Qtest Mobile App Port Contest 
It is on hand now.

Although failed to be the top 5 in the final(which means no chance to get my favorate mobile device N900 before N9/N950 was officially announced by NOKIA at Singapore),Nothing regret.My app HappyFrog attracts lots of attention.Besides gift,it's really good feeling for me to see people get something pretty enjoyable out of it.That's why I keeping working on that project.
Btw,I almost forgot the PDF ebook is still on my KDE desktop but for this gift.

Keep calm and Hack on.


HappyFrog for Harmattan

Can't wait to say finally...finally I got my N950 throught Qt-Ambassador Program.I was waiting impatiently for a long time (two suffering weeks :)) to got it on hand.Unboxing it.........very very fantastic and beautiful design and very 'soft' and fabulous to the touch.The brand-new user interface-Swipe.I feel like the whole view is completely undisciplined unbounded,yet full of the magic and power of the artist view(a image cross my mind,it reminds me of "Steve jobs" in the film "Pirates of Silicon Valley".He was yelling "I need artist!!" and speak to bill "we're artist"..........*(^*&%&^$&^%)Dreams will not remains as a dream.The Next Billion.So Come on,nokia don't let me down : ).
Well,I am prepared to deploy two games on N9.
One is HappyFrog(someone has played it),another....keep you guessing.
So first priority is to make some improvment on Happy Frog. three features on HappyFrog 0.0.3. details as follows
1.parallax scrolling(see the hills) and re-design some levels
2.add tyre fixture(enable Motor in Box2D)
3.add windmill fixture(disanble Motor in Box2D)

you can download HappyFrog for different platform here
2.HappyFrog 0.0.3 For Symbian^1(5800,n97,c6,5230..)

source code is here Happyfrog-Src-0.0.3.tar.bz2 ,you can checkout it also at here 
Next game is in-progress,stay tuned.



Making HMAC-SHA1 scriptable in apps

Long time no blog due to busy on project.
It's a funny coincident that I need to do some work based on OAUTH open protocol again.But according to the qoauth libs implementation and the previous blog I mentioned,there is a  need for me to make it with little code change for different platform(on Desktop I need to compile and import QCA libraries in addition to qca-ossl-plugin see below on that page,on Symbian I need to import hash.lib by using related class CSHA1,CMAC).Hum,is there a better solution for me to utilize to make it easier?
So I think it's time to play a small trick.My proposal is that do HMAC-SHA1 in app without any change to fit all platform with Qt(Desktop,embed,mobile device).The main idea is that making HMAC-SHA1 scriptable in apps.
The step as following.
1.Please check and import sha1.js in your project.
2.QtScript module provides powerful embedded scripting environment through the QtScript classes.So we can call a Qt script function from C++ like this.
QFile file("./sha1.js");;
QString jsContent = QString::append(file.readAll());
QScriptEngine engine;
engine.evaluate(jsContent);// very similar with function QWebFrame::evaluateJavaScript ()
QScriptValue value = engine.globalObject();
QScriptValueList paramList;
QString result ="b64_hmac_sha1").call(QStringValue(),valueList).toString()
//call js function b64_hmac_sha1 from C++ and result is what you want. ;) 

special present from Finland before my birthday.
can't wait to test it.
I will be waiting impatiently for the time when I get it.


HappyFrog........just for fun

In the wake of angry bird become more and more popular,so I just wonder how to implement it with Qt.Below are some hint.
1.GraphicsView Framework(or Declarative UI) interagted with Box2D physics engine.
2.Explosion effect can be done with function drawPixmapFragment(which is introduced in Qt 4.7,make an optimize on state changes for QPainter,so it's faster than multiple calls to drawPixmap())
3.In order to boost my development,I wanna use some Element from Qml,such as flickAble or ListView,etc..

The first two are not difficult to implement it.
basically,lots of people want to know how to integrated qml with c++ in this demo,in particularly how to add item in the flickAble element (you konw,I am a lazy and humble guy and on the flip side,I guest not everyone konws that how to make kinetic animation,In fact it's not difficult).
(more detaileds watch the video Below).
In order to dynamically add item in the flickable,we can write some code in qml
Flickable {
     id: myFlickable
     function addItem(file) {
         var component = Qt.createComponent(file)
Maybe someone just figure out an "easier" way

  id: myFlickable
  Loader { id: itemLoader }
  MouseArea {
          anchors.fill: parent
          onClicked: itemLoader.source = "items.qml"
In case code you wrote like above,unfortunately,item inserted dynamiclly can not be "flicked",so it didn't work out if you forget passing Flickable.contentItem for the item created,even thought it seems like itemLoader is a "child" of myFlickable.
In C++
consider about foregoing problem we met.There are two little things we need to care about.
1.How to get the pointer of "Flickable"
2.How to get the pointer of "myFlickable.contentItem"(a property of Flickable)
;) some related apis have been prepared by Qt,easy and convinient.
   1.create QtObject Element for Flickable element,as the qt document mentioned "It can also be useful for C++ integration, as it is just a plain QObject.This allows a C++ application to locate an item within a QML component using the QObject::findChild() method". 
   2.with QObject'property to fetch the pointer of Flickable.contentItem.
Flikable {
      objectName: "flickArea"
 QDeclarativeComponent component(&engine,QUrl("main.qml"));
 if(component.status() != QDeclarativeComponent::Ready){
     foreach(const QDeclarativeError &error,component.errors()){
 QDeclarativeItem *mainView = qobject_cast< QDeclarativeItem *>(component.create());
 QDeclarativeItem *flickArea = mainView->findChild< QDeclarativeItem * >("flickArea");
 QDeclarativeItem *contentItem = qvariant_cast< QDeclarativeItem * >(flickArea->property("contentItem"));

//pass contenItem as item's parent.
ItemInserted   *item = new (contentItem);

That's all.Btw.
If you are a qml enthusiast,qml-Box2d( plugins is on the
way,here,Maybe it's useful for you to write fantastic game or something related stuff.
of course,HappyFrog is an opensource project,you can find here
you can also checkout the latest source which is hosted on the my gitorious page.
git clone git://


Sth From Norway

This morning,I got sth which is sent from Norway,meanwhile I have been accepted as a Qt Ambassador.Maybe It's good news for me during these times(seems like the T-shirt isn't fit me,small size would be fine),
Btw,I am working on a qt-apps integrated with Box2d and Declarative UI,I call it "Happy Frog" and about to prepare to release these days,stay tuned.