1 / 23

Symbian 程序结构分析

Symbian 程序结构分析. 主要内容. 程序结构 工程组织 应用图标及启动 资源文件 打包图片 打包文件格式 多视图程序. 程序结构. S60 应用框架 MVC 设计模式. 程序结构. GUI 应用运行分析 代码分析 应用类 文档类 AppUi 类 启动代码 运行分析. 工程组织. bld.inf PRJ_PLATFORMS WINSCW ARMV5 GCCE PRJ_MMPFILES gnumakefile icons_scalable_dc.mk gnumakefile ..helpbuild_help.mk

mihaly
Download Presentation

Symbian 程序结构分析

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Symbian程序结构分析

  2. 主要内容 • 程序结构 • 工程组织 • 应用图标及启动 • 资源文件 • 打包图片 • 打包文件格式 • 多视图程序

  3. 程序结构 • S60应用框架 • MVC设计模式

  4. 程序结构 • GUI应用运行分析 • 代码分析 • 应用类 • 文档类 • AppUi类 • 启动代码 • 运行分析

  5. 工程组织 • bld.inf PRJ_PLATFORMS WINSCW ARMV5 GCCE PRJ_MMPFILES gnumakefile icons_scalable_dc.mk gnumakefile ..\help\build_help.mk Exam0303NewGui.mmp

  6. 工程组织 • 工程组织文件*.mmp TARGET Exam0303NewGui_0xE2F675DA.exe TARGETTYPE exe UID 0x100039CE 0xE2F675DA SOURCEPATH ..\src SOURCE Exam0303NewGui.cpp SOURCE Exam0303NewGuiApplication.cpp

  7. 工程组织 SOURCEPATH ..\data START RESOURCE Exam0303NewGui.rss HEADER TARGET Exam0303NewGui_0xE2F675DA TARGETPATH resource\apps END //RESOURCE START RESOURCE Exam0303NewGui_reg.rss TARGET Exam0303NewGui_0xE2F675DA_reg TARGETPATH \private\10003a3f\apps END //RESOURCE

  8. 工程组织 USERINCLUDE ..\inc USERINCLUDE ..\help SYSTEMINCLUDE \epoc32\include LIBRARY euser.lib LIBRARY apparc.lib LIBRARY cone.lib LANG SC VENDORID 0 SECUREID 0xE2F675DA CAPABILITY ReadUserData

  9. 应用图标及启动 • 注册表资源文件 1. #include "Exam0303NewGui.hrh" 2. #include "Exam0303NewGui.rls" 3. #include <appinfo.rh> 4. #include <Exam0303NewGui_0xE2F675DA.rsg> 5. 6. UID2 KUidAppRegistrationResourceFile 7. UID3 _UID3 8. 9. RESOURCE APP_REGISTRATION_INFO 10. { 11. app_file="Exam0303NewGui_0xE2F675DA"; 12. localisable_resource_file = qtn_loc_resource_file_1; 13. localisable_resource_id = R_LOCALISABLE_APP_INFO; 14. 15. embeddability=KAppNotEmbeddable; 16. newfile=KAppDoesNotSupportNewFile; 17. }

  10. 应用图标及启动 • 在程序资源文件中定义下面的资源 RESOURCE LOCALISABLE_APP_INFO r_localisable_app_info { short_caption = qtn_caption_string; caption_and_icon = CAPTION_AND_ICON_INFO { caption = qtn_caption_string; number_of_icons = 1; icon_file = "\\resource\\apps\\Exam0303NewGui_0xE2F675DA.mif"; }; }

  11. 打包图片 • 打包矢量图片 • 使用*.mk文件 • 例子Icons_scalable_dc.mk 1. ifeq (WINS,$(findstring WINS, $(PLATFORM))) 2. ZDIR=$(EPOCROOT)epoc32\release\$(PLATFORM)\$(CFG)\Z 3. else 4. ZDIR=$(EPOCROOT)epoc32\data\z 5. endif 6. 7. TARGETDIR=$(ZDIR)\resource\apps 8. ICONTARGETFILENAME=$(TARGETDIR)\ImiChatApp.mif 9. 11. ICONDIR=..\gfx 12. ... ... 13. RESOURCE : $(ICONTARGETFILENAME) 14. 15. $(ICONTARGETFILENAME) : $(ICONDIR)\qgn_menu_ImiChat.svg 16. mifconv $(ICONTARGETFILENAME) \ 17. /c32 $(ICONDIR)\qgn_menu_ImiChat.svg 18. ... ...

  12. 资源文件 • 程序资源文件格式 • 资源文件头 • 资源文件体

  13. 资源文件 • 资源文件头 //代码块1 资源标识符 NAME EXAM // 4 letter ID //代码块2 INCLUDES #include <eikon.rh> #include <avkon.rsg> //代码块3 定义资源文件签名, 这个资源应该是空的 RESOURCE RSS_SIGNATURE { } //代码块4 缺省的文档名称 RESOURCE TBUF r_default_document_name { buf="EXAM"; } //代码块5 定义应用默认的菜单和CBA栏按钮 RESOURCE EIK_APP_INFO { menubar = r_menubar; cba = R_AVKON_SOFTKEYS_OPTIONS_EXIT; }

  14. 资源文件 • 资源文件体 RESOURCE STRUCTNAME res_name { resource-initializer-list }

  15. 资源文件 • 编译资源文件

  16. 资源文件 • 定义菜单 1. RESOURCE MENU_BAR r_menubar 2. { 3. titles = 4. { 5. MENU_TITLE { menu_pane = r_menu; } 6. }; 8. } 9.

  17. 资源文件 • 定义菜单 10. // r_menu 11. // Menu for "Options" 12. RESOURCE MENU_PANE r_menu 13. { 14. items = 15. { 16. // added the new Options menu command here 17. MENU_ITEM 18. { 19. command = ECommand1; 20. txt = “Message”; 21. }, 22. MENU_ITEM 23. { 24. command = ECommand2; 25. txt = qtn_command2; 26. }, 27. … … 28. }; 29. }

  18. 资源文件 • 处理菜单命令 void CExam0303NewGuiAppUi::HandleCommandL(TInt aCommand) { switch (aCommand) { case EEikCmdExit: case EAknSoftkeyExit: Exit(); break; case ECommand1: // break; default: Panic(EExam0303NewGuiUi); break; } }

  19. 资源文件 • 定义CBA栏 RESOURCE CBA r_confirmation_softkeys_ok_cancel { buttons = { CBA_BUTTON { id = EAknSoftkeyOk; txt = “ok”; }, CBA_BUTTON { id = EAknSoftkeyCancel; txt = “cancel”; } }; }

  20. 资源文件 • 定义字符串资源 • 定义本地化字符串资源 #define qtn_caption_string "Exam0303NewGui" • 定义资源 RESOURCE TBUF32 r_caption_string { buf=qtn_caption_string; } • 使用字符串定义 HBufC* textResource = StringLoader::LoadLC(R_CAPTION_STRING); CAknInformationNote* informationNote; informationNote = new ( ELeave ) CAknInformationNote; informationNote->ExecuteLD( *textResource); CleanupStack::PopAndDestroy(textResource);

  21. BMP图片打包 • 在mmp文件中打包位图 START BITMAP vas.mbm HEADER TARGETPATH \resource\apps SOURCEPATH ..\lookandfeel\bmp SOURCE c12 vas_icon.bmp SOURCE c12 vas_icon_mask.bmp SOURCE c12 vas_title.bmp SOURCE c12 vas_title_mask.bmp END

  22. 打包文件格式 1. ;程序支持的语言定义 2. &EN 3. 4. ; 标准SIS文件头 5. #{"Exam0303NewGui"},(0xE2F675DA),1,0,0 6. 7. ; 本地开发商名称 8. %{"Vendor-EN"} 9. 10. ; 开发商名称 11. :"Vendor" 12. 13. ; 安装程序支持的S60版本 14. [0x101F7961], 0, 0, 0, {"Series60ProductID"} 15. 16. ; 安装的文件 17."\Symbian\9.1\S60_3rd_MR\Epoc32\release\gcce\urel\Exam0303NewGui_0xE2F675DA.exe" -"!:\sys\bin\Exam0303NewGui_0xE2F675DA.exe" 18. … …

  23. 打包文件格式 • S60平台UID对照表

More Related