在QT SDK下构建MeeGo Touch开发环境
创始人
2024-07-14 00:30:30
0

在陆续推出MeeGo移动终端设备开发UI设计基础等教程之后,我们将为大家介绍一些MeeGo开发环境的教程。也许有不少朋友会问到,网上有不少构建MeeGo Touch环境的文章了,你又何必多此一举呢?细心的朋友可能会发现,我这里不用编译QT4.7 而是用QT4.7的SDK来搭建环境的。编译QT4.7一般都需要大概一下午的时间,而是用SDK则最多不超过20分钟就搞定了。这也是希望能有更快的方法让大家来玩MeeGo。

QT-sdk-linux-x86-opensource-2010.05-rc1.bin下载

1.安装 QT-sdk-linux-x86-opensource-2010.05-rc1.bin命令:

  1. chmod 777 QT-sdk-linux-x86-opensource-2010.05-rc1.bin  
  2. ./QT-sdk-linux-x86-opensource-2010.05-rc1.bin 

2.下载编译好的dbus库文件(附件里),放到QT 2010.05的库里。

安装g++

  1. sudo apt-get install g++ 

3.安装依赖库文件:

(1) 安装依赖库

  1. sudo apt-get install libfontconfig1-dev libfreetype6-dev libx11-dev libxcursor-dev libxext-dev libxfixes-dev libxft-dev libxi-dev libxrandr-dev libxrender-dev  
  2.  
  3.  
  4.  

(2) 安装dbus库

  1. sudo apt-get install libgconf2-dev libdbus-QT-1-dev  
  2.  

(3)修改libmeegotouch/configure,将HAVE_DBUS=no改为yes

修改libmeegotouch/configure

4.安装meegotouch-theme(这个主要是一些主题css文件等)

(1) 下载meegotouch-theme 代码

  1. git clone git://gitorious.org/meegotouch/meegotouch-theme.git    
  2.  

然后执行 chmod 777 -R libmeegotouch, 给下载下来的源码全部加上最高权限

(2) 进入目录meegotouch-theme。  

  1. cd meegotouch-theme/  
  2.  

(3) 执行qmake 生成makefile :

  1. qmake  
  2.  

(4) 安装

  1. sudo make install  
  2.  

说明:

在使用make的时候可能会说make的版本不是4.7。出现qmake与qt4的连接问题

可以敲下面命令测试

  1. $qmake -v  
  2.  

出现下面情况:

  1. $Qmake version: 1.07a (QT 3.3.8b)     
  2. $Qmake is free software from Trolltech ASA.  
  3.  

怎么qmake的版本变成了qt3了,进入/usr/bin目录下

  1. root@ubuntu:/home/yyy# cd /usr/bin  
  2. root@ubuntu:/usr/bin# ls -l qmake  
  3. lrwxrwxrwx 1 root root 23 2009-10-09 09:35 qmake -> /etc/alternatives/qmake  
  4.  

查看qmake的信息,它是一个链接指向的是/etc/alternatives/qmake

  1. root@ubuntu:/usr/bin# ls -l /etc/alternatives/qmake  
  2. lrwxrwxrwx 1 root root 18 2009-12-08 12:46 /etc/alternatives/qmake -> /usr/bin/qmake-qt3  
  3.  

终于找到的根源,原来qmake被设置成了qmake-qt3

#p#

强行修改

  1. root@ubuntu:/usr/bin# rm /etc/alternatives/qmake  
  2. root@ubuntu:/usr/bin# ln -s /usr/bin/qmake /etc/alternatives/qmake  
  3. root@ubuntu:/usr/bin# qmake -v  
  4. QMake version 2.01a  
  5. Using QT version 4.5.0 in /usr/lib  
  6.  

5.安装libmeegotouch

(1) 下载源代码

  1. git clone git://gitorious.org/meegotouch/libmeegotouch.git  
  2.  

然后执行 chmod 777 -R libmeegotouch, 给下载下来的源码全部加上最高权限

(2) 安装一些依赖的库。(根据个人PC的配置情况,以及后面2.4的配置结果,可能还需要安装其他的一些依赖库)

  1. sudo apt-get install libicu-dev graphviz  
  2.  

(3) 进入目录libmeegotouch。

  1. cd libmeegotouch 

(4) 进入目录,生成makefile :

  1. qmake  
  2.  

(5) 执行make 编译

  1. make  
  2.  

(6) 安装

  1. sudo make install  

在/usr/local/lib下的目录,发现已经生成的MeeGo 库文件

已经生成的MeeGo 库文件

实践:

1)写一个hello world代码

  1. main.cpp  
  2. #include  
  3. #include  
  4. #include  
  5. #include  
  6.  
  7. int main(int argc, char **argv)  
  8. {  
  9. MApplication app(argc, argv);  
  10. MApplicationWindow window;  
  11. MApplicationPage page;  
  12.  
  13. page.setTitle("My First Page");  
  14. page.setCentralWidget(new MLabel("Hello World!"));  
  15. page.appear(&window);  
  16.  
  17. window.show();  
  18.  
  19.    return app.exec();  
  20. }  
  21.  
  22.  
  23. HelloWorld.pro  
  24.  
  25. ######################################################################  
  26. # Automatically generated by qmake (2.01a) ?? 9? 12 21:36:22 2010  
  27. ######################################################################  
  28. TEMPLATE = app 
  29. TARGET =   
  30. DEPENDPATH += .  
  31. INCLUDEPATH += .  
  32. CONFIG += meegotouch  
  33. # Input  
  34. SOURCES += main.cpp  
  35.  

如下图:

生成makefile文件

  1. qmake 

执行make

  1. make  
  2.  

运行程序 记得要加sudo

  1. sudo ./helloWorld 

程序结果如下:

程序结果

2) 编译一个编译example目录里面的 tutorial_music_catalogue 例子

(1) tutorial_music_catalogue这个例子程序,有详细的介绍文档, 在libmeegotouch的文档主页上,有个介绍 Your first MeeGo Touch application ,适合做为入门文档

(2) 由于libmeegotouch没有安装到标准路径下,因此需要修改它的pro工程文件,打开文件 tutorial_music_catalogue.pro,在里面添加如下一段(如果meegotouch的安装路径不一样,请自行对应修改):

  1. unix {  
  2. INCLUDEPATH += /usr/local/include/meegotouch  
  3. LIBS += -L/usr/local/lib -lmeegotouchcore -lmeegotouchextensions -lmeegotouchsettings -lmeegotouchviews  
  4. QMAKE_LFLAGS += -Wl,-rpath,/usr/local/lib  
  5. }  
  6.  

(3) 执行qmake

(4) 执行make,如果出现问题,可能是由于这个Makefile中需要调用mmoc。

  1. PATH=/usr/local/bin/:$PATH make 

(5) 运行tutorial_music_catalogue

  1. sudo ./tutorial_music_catalogue 

如果有花屏可以执行下面命令:

(并非所有的电脑都会黑屏或者花屏,所以运行程序的时候,可以自行尝试一下不同的情况)

  1. sudo ./tutorial_music_catalogue -software 

#p#

程序执行后的结果图:

第一页 
第一页

第二页
第二页

第三页 
第三页

(6) libmeegotouch程序通用的命令行参数。

  1.  
  2. MComponentData: Usage: ./tutorial_music_catalogue  
  3. [-software] Enable software rendering  
  4. [-fullscreen] Make the application fullscreen  
  5. [-show-br] Show the bounding rectangle for all scene items  
  6. [-show-fps] Show the FPS for the view (only with OpenGL rendering)  
  7. [-log-fps] Log the FPS for the application  
  8. [-show-size] Show widget sizes in the scene  
  9. [-show-object-names] Show the names of the objects in the scene  
  10. [-show-position] Show widget positions in the scene  
  11. [-show-cursor] Force the cursor to be visible  
  12. [-reverse] Change the layout direction to right-to-left direction  
  13. [-dev] Enable development visualization mode  
  14. [-genimglist filename] Generate list of requested images to filename  
  15. [-remote-theme] Wait until remote theme daemon is available  
  16. [-local-theme] Force usage of local theme processing instead of remote theme daemon  
  17. [-output-level debug|warning|critical] Only show messages of given output level or above  
  18. [-output-prefix ] Only show debug messages that start with the given prefix  
  19. [-no-output-prefix ] Only show debug messages that do not start with the given prefix  
  20. [-target ] Use the target device profile  
  21. [-prestart] Prestart the application (if supported)  
  22. [-fixed-orientation 0|90|180|270] Start application in fixed orientation.  
  23. This overrides keyboard state, as well as a device profile  

(7)  tutorial_music_catalogue这个示例程序很新,它依赖的QT版本和libmeegotouch版本,都高于目前MeeGo镜像中对 应的QT和libmeegotouch版本,因此在开发板上或虚拟机里并不能运行。但是,不妨碍我们用它来学习入门。example目录里面的其他示例程 序,在开发板上基本上都可以运行。

补充一些描述。

1 libmeegotouch是图形开发工具箱,从它的功能上来说,它相当于QT,gtk,clutter等这一类图形界面库。

2 libmeegotouch是基于QT的,准确点说是基于QT的graphicsview框架的,但是,它在graphicsview的基础上,又封装出 一层widget。在使用方法上和设计模式上,和原始的graphicsview或qwidget,并没有太多的交集。

3 开发MeeGo应用程序,如果没有QT开发经验,建议直接从libmeegotouch学起,在使用过程中,如果碰到了原始的QT中的class,再查阅 对应的手册。这种学习路线,消耗的时间应该是最少的。

4 另外,虽然在PC上可以安装libmeegotouch,但是这毕竟不是MeeGo的完整开发环境,它只负责MeeGo的GUI部分,因此这篇文档介绍的 方法,不能替代MeeGo的完整开发环境。之所以在PC上安装libmeegotouch,一方面是让许多没有硬件开发环境的朋友也可以在PC上体验一下 MeeGo的界面操作方式,另一方面,也是想说明一下MeeGo程序在开发上的灵活性,比如前端UI设计的时候,就可以先在PC上做一些原型设计。

[[15577]]

【编辑推荐】

  1. MeeGo移动终端设备开发UI设计基础教程
  2. Meego开发中安装Dropbox等应用详解
  3. 揭露关于MeeGo开发的15个事实
  4. 在Linux上使用MeeGo SDK进行Meego开发
  5. 虚拟机操作系统及Meego开发中MeegoSDK安装过程详解

相关内容

热门资讯

如何允许远程连接到MySQL数... [[277004]]【51CTO.com快译】默认情况下,MySQL服务器仅侦听来自localhos...
如何利用交换机和端口设置来管理... 在网络管理中,总是有些人让管理员头疼。下面我们就将介绍一下一个网管员利用交换机以及端口设置等来进行D...
施耐德电气数据中心整体解决方案... 近日,全球能效管理专家施耐德电气正式启动大型体验活动“能效中国行——2012卡车巡展”,作为该活动的...
Windows恶意软件20年“... 在Windows的早期年代,病毒游走于系统之间,偶尔删除文件(但被删除的文件几乎都是可恢复的),并弹...
20个非常棒的扁平设计免费资源 Apple设备的平面图标PSD免费平板UI 平板UI套件24平图标Freen平板UI套件PSD径向平...
德国电信门户网站可实时显示全球... 德国电信周三推出一个门户网站,直观地实时提供其安装在全球各地的传感器网络检测到的网络攻击状况。该网站...
着眼MAC地址,解救无法享受D... 在安装了DHCP服务器的局域网环境中,每一台工作站在上网之前,都要先从DHCP服务器那里享受到地址动...
为啥国人偏爱 Mybatis,... 关于 SQL 和 ORM 的争论,永远都不会终止,我也一直在思考这个问题。昨天又跟群里的小伙伴进行...