《程序結(jié)構(gòu)分析》PPT課件.ppt
Symbian程序結(jié)構(gòu)分析,主要內(nèi)容,程序結(jié)構(gòu)工程組織應(yīng)用圖標(biāo)及啟動資源文件打包圖片打包文件格式多視圖程序,程序結(jié)構(gòu),S60應(yīng)用框架MVC設(shè)計(jì)模式,程序結(jié)構(gòu),GUI應(yīng)用運(yùn)行分析代碼分析應(yīng)用類文檔類AppUi類啟動代碼運(yùn)行分析,工程組織,bld.infPRJ_PLATFORMSWINSCWARMV5GCCEPRJ_MMPFILESgnumakefileicons_scalable_dc.mkgnumakefile.helpbuild_help.mkExam0303NewGui.mmp,工程組織,工程組織文件*.mmpTARGETExam0303NewGui_0 xE2F675DA.exeTARGETTYPEexeUID0 x100039CE0 xE2F675DASOURCEPATH.srcSOURCEExam0303NewGui.cppSOURCEExam0303NewGuiApplication.cpp,工程組織,SOURCEPATH.dataSTARTRESOURCEExam0303NewGui.rssHEADERTARGETExam0303NewGui_0 xE2F675DATARGETPATHresourceappsEND/RESOURCESTARTRESOURCEExam0303NewGui_reg.rssTARGETExam0303NewGui_0 xE2F675DA_regTARGETPATHprivate10003a3fappsEND/RESOURCE,工程組織,USERINCLUDE.incUSERINCLUDE.helpSYSTEMINCLUDEepoc32includeLIBRARYeuser.libLIBRARYapparc.libLIBRARYcone.libLANGSCVENDORID0SECUREID0 xE2F675DACAPABILITYReadUserData,應(yīng)用圖標(biāo)及啟動,注冊表資源文件1.#include"Exam0303NewGui.hrh"2.#include"Exam0303NewGui.rls"3.#include4.#include5.6.UID2KUidAppRegistrationResourceFile7.UID3_UID38.9.RESOURCEAPP_REGISTRATION_INFO10.11.app_file="Exam0303NewGui_0 xE2F675DA"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.,應(yīng)用圖標(biāo)及啟動,在程序資源文件中定義下面的資源RESOURCELOCALISABLE_APP_INFOr_localisable_app_infoshort_caption=qtn_caption_string;caption_and_icon=CAPTION_AND_ICON_INFOcaption=qtn_caption_string;number_of_icons=1;icon_file="resourceappsExam0303NewGui_0 xE2F675DA.mif",打包圖片,打包矢量圖片使用*.mk文件例子Icons_scalable_dc.mk1.ifeq(WINS,$(findstringWINS,$(PLATFORM)2.ZDIR=$(EPOCROOT)epoc32release$(PLATFORM)$(CFG)Z3.else4.ZDIR=$(EPOCROOT)epoc32dataz5.endif6.7.TARGETDIR=$(ZDIR)resourceapps8.ICONTARGETFILENAME=$(TARGETDIR)ImiChatApp.mif9.11.ICONDIR=.gfx12.13.RESOURCE:$(ICONTARGETFILENAME)14.15.$(ICONTARGETFILENAME):$(ICONDIR)qgn_menu_ImiChat.svg16.mifconv$(ICONTARGETFILENAME)17./c32$(ICONDIR)qgn_menu_ImiChat.svg18.,資源文件,程序資源文件格式資源文件頭資源文件體,資源文件,資源文件頭/代碼塊1資源標(biāo)識符NAMEEXAM/4letterID/代碼塊2INCLUDES#include#include/代碼塊3定義資源文件簽名,這個(gè)資源應(yīng)該是空的RESOURCERSS_SIGNATURE/代碼塊4缺省的文檔名稱RESOURCETBUFr_default_document_namebuf="EXAM"/代碼塊5定義應(yīng)用默認(rèn)的菜單和CBA欄按鈕RESOURCEEIK_APP_INFOmenubar=r_menubar;cba=R_AVKON_SOFTKEYS_OPTIONS_EXIT;,資源文件,資源文件體RESOURCESTRUCTNAMEres_nameresource-initializer-list,資源文件,編譯資源文件,資源文件,定義菜單1.RESOURCEMENU_BARr_menubar2.3.titles=4.5.MENU_TITLEmenu_pane=r_menu;6.;8.9.,資源文件,定義菜單10./r_menu11./Menufor"Options"12.RESOURCEMENU_PANEr_menu13.14.items=15.16./addedthenewOptionsmenucommandhere17.MENU_ITEM18.mand=ECommand1;20.txt=“Message”;21.,22.MENU_ITEM23.mand=ECommand2;25.txt=qtn_command2;26.,2728.;29.,資源文件,處理菜單命令voidCExam0303NewGuiAppUi:HandleCommandL(TIntaCommand)switch(aCommand)caseEEikCmdExit:caseEAknSoftkeyExit:Exit();break;caseECommand1:/break;default:Panic(EExam0303NewGuiUi);break;,資源文件,定義CBA欄RESOURCECBAr_confirmation_softkeys_ok_cancelbuttons=CBA_BUTTONid=EAknSoftkeyOk;txt=“ok”;,CBA_BUTTONid=EAknSoftkeyCancel;txt=“cancel”;,資源文件,定義字符串資源定義本地化字符串資源#defineqtn_caption_string"Exam0303NewGui"定義資源RESOURCETBUF32r_caption_stringbuf=qtn_caption_string;使用字符串定義HBufC*textResource=StringLoader:LoadLC(R_CAPTION_STRING);CAknInformationNote*informationNote;informationNote=new(ELeave)CAknInformationNote;informationNote->ExecuteLD(*textResource);CleanupStack:PopAndDestroy(textResource);,BMP圖片打包,在mmp文件中打包位圖STARTBITMAPvas.mbmHEADERTARGETPATHresourceappsSOURCEPATH.lookandfeelbmpSOURCEc12vas_icon.bmpSOURCEc12vas_icon_mask.bmpSOURCEc12vas_title.bmpSOURCEc12vas_title_mask.bmpEND,打包文件格式,1.;程序支持的語言定義2.安裝的文件17."Symbian9.1S60_3rd_MREpoc32releasegcceurelExam0303NewGui_0 xE2F675DA.exe"-"!:sysbinExam0303NewGui_0 xE2F675DA.exe"18.,打包文件格式,S60平臺UID對照表,