extras/about/src/AboutContainer.cpp
branchRCL_3
changeset 18 a7d8840c0b8c
parent 14 a616540b95d9
equal deleted inserted replaced
16:99b535de1dda 18:a7d8840c0b8c
    84 void CAboutContainer::ConstructL( const TRect& aRect )
    84 void CAboutContainer::ConstructL( const TRect& aRect )
    85     {
    85     {
    86     CreateWindowL();
    86     CreateWindowL();
    87 
    87 
    88     iScrollBarDragged = EFalse;
    88     iScrollBarDragged = EFalse;
       
    89     iBreakFlag = EFalse;
       
    90     iIsSvg = EFalse;
    89 	iSkinContext = NULL;
    91 	iSkinContext = NULL;
    90 	iText = NULL;
    92 	iText = NULL;
    91 	iImages = NULL;
    93 	iImages = NULL;
    92 	iScreenStarts = NULL;
    94 	iScreenStarts = NULL;
    93 	iSBFrame = NULL;
    95 	iSBFrame = NULL;
   226                 }
   228                 }
   227 
   229 
   228             gc.BitBlt( position, image->Bitmap(), aRect );
   230             gc.BitBlt( position, image->Bitmap(), aRect );
   229             }
   231             }
   230         }
   232         }
   231      /*   if(iCurrentScreen == 0)
       
   232     {
       
   233         TAknWindowLineLayout area = AknLayoutScalable_Apps::mce_icon_pane().LayoutLine();
       
   234  	    TAknLayoutRect layoutRect;
       
   235  	    TRect iconrect = Rect();
       
   236  	    iconrect.iTl.iX = position.iX;
       
   237 	    layoutRect.LayoutRect(iconrect, area);
       
   238   	    layoutRect.DrawImage(gc, iIcon->Bitmap(),iIcon->Mask());
       
   239         
       
   240     }*/
       
   241 
       
   242     }
   233     }
   243 
   234 
   244 // -----------------------------------------------------------------------------
   235 // -----------------------------------------------------------------------------
   245 // CAboutContainer::ActivateL()
   236 // CAboutContainer::ActivateL()
   246 // -----------------------------------------------------------------------------
   237 // -----------------------------------------------------------------------------
   270     TInt numLines( wrappedArray->Count() );
   261     TInt numLines( wrappedArray->Count() );
   271     for ( TInt i = 0 ; i < numLines ; i++ )
   262     for ( TInt i = 0 ; i < numLines ; i++ )
   272         {
   263         {
   273         HBufC* line = (*wrappedArray)[i].AllocLC();
   264         HBufC* line = (*wrappedArray)[i].AllocLC();
   274 
   265 
       
   266 		switch( aItem )
       
   267 			{
       
   268 			// The fourteen string's setting
       
   269 			case 14:
       
   270 				{
       
   271 				iBreakFlag = ETrue;
       
   272 				break;
       
   273 				}
       
   274 			default:
       
   275 				break;
       
   276 			}
   275         if(!line->Length())
   277         if(!line->Length())
   276             {
   278             {
   277             iText->AppendL( NULL );
   279             iText->AppendL( NULL );
   278 			
   280 			
   279             CleanupStack::PopAndDestroy(line);  // line
   281             CleanupStack::PopAndDestroy(line);  // line
   280             }
   282             }
   281         else
   283         else
   282             {
   284             {
   283             iText->AppendL( line );
   285             if( iBreakFlag && ( numLines - 1 ) == i )
   284             CleanupStack::Pop(line);  // line
   286             	{
       
   287                 iText->AppendL( line );
       
   288                 // Get the text's lines' count for set break
       
   289                 TInt textCount = iText->Count();
       
   290                 TInt count = iLinesPerScreen - ( textCount % ( iLinesPerScreen - 1 ) ) - 1;
       
   291                 if( iLinesPerScreen == count + 1 )
       
   292                 	{
       
   293                 	// When the last line has content, we should set count zero 
       
   294                 	count = 0;
       
   295                 	}
       
   296                 for( TInt j = 0; j < count; j++ )
       
   297                 	{
       
   298                 	iText->AppendL( NULL );
       
   299                 	}
       
   300                 CleanupStack::Pop( line );  // line
       
   301                 iBreakFlag = EFalse;
       
   302             	}
       
   303             else
       
   304             	{
       
   305                 iText->AppendL( line );
       
   306                 CleanupStack::Pop( line );  // line
       
   307             	}
   285             }
   308             }
   286         }
   309         }
   287 	iText->AppendL( NULL );
   310 	iText->AppendL( NULL );
   288 
   311 
   289     // If the last char was newline, add one extra, since
   312     // If the last char was newline, add one extra, since
   329 
   352 
   330 void CAboutContainer::SetImageL( const TDesC& aFileName, TInt aBitmapId )
   353 void CAboutContainer::SetImageL( const TDesC& aFileName, TInt aBitmapId )
   331     {
   354     {
   332     TInt firstLineOfImage( iText->Count() );
   355     TInt firstLineOfImage( iText->Count() );
   333 
   356 
       
   357     // If flag is ETrue, the file type is bmp 
   334     CAboutImage* image =
   358     CAboutImage* image =
   335     CAboutImage::NewLC( aFileName, aBitmapId, firstLineOfImage, iBaseLineDelta );
   359     CAboutImage::NewLC( aFileName, aBitmapId, firstLineOfImage, iBaseLineDelta, ETrue );
   336 
   360 
   337     // new lines to make room for the picture
   361     // new lines to make room for the picture
   338 
   362 
   339     for ( TInt i = 0 ; i < image->Lines() ; i++ )
   363     for ( TInt i = 0 ; i < image->Lines() ; i++ )
   340         {
   364         {
   651 #else
   675 #else
   652     // real resource
   676     // real resource
   653     TResourceReader reader;
   677     TResourceReader reader;
   654     iEikonEnv->CreateResourceReaderLC( reader, R_ABOUT_MAIN_TEXT );
   678     iEikonEnv->CreateResourceReaderLC( reader, R_ABOUT_MAIN_TEXT );
   655 #endif
   679 #endif
   656     
   680  
   657     CFbsBitmap* bitmap,*mask;
       
   658     bitmap = NULL;
       
   659     mask= NULL;
       
   660     TFileName bmpPath;
       
   661     _LIT( KMbmFileName, "Z:about.mif" );
       
   662 
       
   663     TParse* fpMbm = new(ELeave) TParse ();
       
   664     fpMbm->Set ( KMbmFileName, &KDC_APP_BITMAP_DIR, NULL );
       
   665     bmpPath.Copy( fpMbm ->FullName() );
       
   666     delete fpMbm;
       
   667     fpMbm=NULL;
       
   668 
       
   669     TResourceReader readerSVG;                   
       
   670     iEikonEnv->CreateResourceReaderLC( readerSVG, R_ABOUT_SVG_TEXT );
       
   671     TInt svgId = readerSVG.ReadInt16();
       
   672     TInt svgIdmask = readerSVG.ReadInt16();
       
   673     TInt height = readerSVG.ReadInt16();
       
   674     TInt width = readerSVG.ReadInt16();
       
   675     CleanupStack::PopAndDestroy();      // readerSVG
       
   676 	  
       
   677     MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance();
       
   678     AknsUtils::CreateIconL( skinInstance, KAknsIIDQgnMenuSmsvoLst, bitmap, mask, bmpPath, svgId, svgIdmask );	
       
   679     //AknsUtils::CreateIconL( skinInstance, KAknsIIDQgnMenuSmsvoLst, bitmap, bmpPath, EMbmAboutQgn_graf_java_logo );	
       
   680     if ( iIcon )
       
   681         {
       
   682         delete( iIcon );
       
   683         iIcon = NULL;
       
   684         }
       
   685     iIcon = CGulIcon::NewL( bitmap,mask );
       
   686     
       
   687     TRect rect1; 
       
   688    	rect1.iTl.iX = 0;
       
   689    	rect1.iTl.iY = 0;
       
   690    	rect1.iBr.iX = height;
       
   691    	rect1.iBr.iY = width;
       
   692 	  AknIconUtils::SetSize( iIcon->Bitmap(), rect1.Size() ); 
       
   693 	  AknIconUtils::SetSize( iIcon->Mask(), rect1.Size() );
       
   694 
       
   695     TInt lines( bitmap->SizeInPixels().iHeight +
       
   696                   KImageTopMargin + 
       
   697                   KImageBottomMargin +
       
   698                   ( iBaseLineDelta - 1 ) / iBaseLineDelta );
       
   699 
       
   700 /*        for(TInt i =0; i< 2; i++)
       
   701 		{
       
   702 		    iText->AppendL(NULL);    
       
   703 		}*/
       
   704     TInt NumItem( reader.ReadInt16() );
   681     TInt NumItem( reader.ReadInt16() );
   705     iNumItem = NumItem;
   682     iNumItem = NumItem;
   706 
   683 
   707     for ( TInt i = 0 ; i < iNumItem ; i++ )
   684     for ( TInt i = 0 ; i < iNumItem ; i++ )
   708         {
   685         {
   709         TInt type = reader.ReadInt8();
   686         TInt type = reader.ReadInt8();
   710 
       
   711         if ( type == EAboutTextItem )    
   687         if ( type == EAboutTextItem )    
   712             { 
   688             { 
   713             HBufC* text;  
   689             HBufC* text;  
   714             if ( reader.ReadInt8() == EAboutUpdateTime )
   690             if ( reader.ReadInt8() == EAboutUpdateTime )
   715                 {  
   691                 {  
   721                 }
   697                 }
   722             else
   698             else
   723                 {
   699                 {
   724                 text = iEikonEnv->AllocReadResourceLC( reader.ReadInt32() );
   700                 text = iEikonEnv->AllocReadResourceLC( reader.ReadInt32() );
   725                 }
   701                 }
   726             SetTextL( *text , i );
   702 			SetTextL( *text , i );
   727             CleanupStack::PopAndDestroy( text );
   703 			CleanupStack::PopAndDestroy( text );
   728             }
   704             }
   729         else if ( type == EAboutImageItem )
   705         else if ( type == EAboutImageItem )
   730             {
   706             {
   731             TPtrC bitmapFile = reader.ReadTPtrC();
   707             TPtrC bitmapFile = reader.ReadTPtrC();
   732             TInt bitmapId = reader.ReadInt16();
   708             TInt bitmapId = reader.ReadInt16();
   733             SetImageL( bitmapFile, bitmapId );
   709             if( iIsSvg )
       
   710             	{
       
   711             	TFileName svgPath;
       
   712             	_LIT( KSvgFileName, "Z:about.mif" );
       
   713             	TParse* fpSvg = new( ELeave ) TParse ();
       
   714             	fpSvg->Set( KSvgFileName, &KDC_APP_BITMAP_DIR, NULL );
       
   715             	svgPath.Copy( fpSvg ->FullName() );
       
   716             	delete fpSvg;
       
   717             	fpSvg = NULL;    
       
   718             	SetImageL( svgPath, EMbmAboutQgn_graf_java_logo );
       
   719             	}
       
   720             else
       
   721             	{
       
   722             	SetImageL( bitmapFile, bitmapId );
       
   723             	}
   734             }
   724             }
   735         else
   725         else
   736             {
   726             {
   737             User::Panic( KAboutPanicCategory, EAboutNotSupported );
   727             User::Panic( KAboutPanicCategory, EAboutNotSupported );
   738             }
   728             }