Qt Quick development process

From GCompris
Revision as of 23:10, 10 February 2014 by Bruno (talk | contribs) (added link to source code)
Jump to: navigation, search

Compilation

  • Get the source code
  • Download and Install the lastest stable version of QtCreator for Android
  • Start QtCreator and open the project file GCompris.pro at the root of the source code
  • Compile and run it.

To make it run on Android you need first to follow these instructions.

Adding a new activity

Let's say you want to port the algebra_by activity.

  • create a directory algebra_by in src/activities:

cd src/activities mkdir algebra_by

  • Copy the existing old GCompris menu

git mv menus/algebra_by.qml algebra_by/ActivityInfo.qml

the svg icon is not under git so you have to pick the old GCompris's icon named algebra_by.svg and copy it in algebra_by. You can get it from the GCompris-gtk GitHub: https://github.com/bdoin/GCompris/tree/master/src

  • Copy an existing activity for example erase_2clic

cp erase_2clic/Activity.qml algebra_by/ cp erase_2clic/erase_2clic.pri algebra_by/algebra_by.pri edit ../../GCompris.pro and add the line include(src/activities/algebra_by/algebra_by.pri) to be correct it should be kept sorted with the others but this is a detail

  • now in Creator, algebra_by should appear, no restart needed
  • edit algebra_by.pri and replace erase_2clic.svg by algebra_by.svg
  • in core edit ActivityInfoTree.cpp and at about line 100, add << "algebra_by" in the activities list.
  • in algebra_by/ActivityInfo.qml replace the icon line to icon: "algebra_by/algebra_by.svg"
  • in algebra_by.pri replace the icon by algebra_by.svg
  • run GCompris and the new activity is there !
  • Ok, the activity is just an extension of an existing one
  • now copy and existing Activity.qml and its javascript from another activity
  • If you look at erase / Activity , the root of you activity is in pageComponent:
  • For the media, you have to put them in the qrc file and then reference it by qrc: in the source. The path is defined in the qrc file.
  • You can see the qrc in qtcreator, it is Ressources/gcompris.qrc it is auto generated at build time
  • To add new images, create a resource directory in your activity folder and in you .pri file add:

APP_FILES += \ $$PWD/resource/myCuteImage.jpg \

  • And in your source use : qrc:/gcompris/src/activities/algebra_by/resource/myCuteImage.jpg