internetradio2.0/uiinc/irmaincontainer.h
changeset 0 09774dfdd46b
equal deleted inserted replaced
-1:000000000000 0:09774dfdd46b
       
     1 /*
       
     2 * Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Header for CIRMainContainer
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CIRMAINCONTAINER_H
       
    20 #define CIRMAINCONTAINER_H
       
    21 
       
    22 #include <aknlists.h>
       
    23 #include <EIKLBX.H>
       
    24 #include <aknsfld.h> 
       
    25 #include <eikclb.h> 
       
    26 #include <aknprogressdialog.h>
       
    27 
       
    28 #include "irimageconverterobserver.h"
       
    29 
       
    30 class CIRMainView;
       
    31 class CIRMainContainer;
       
    32 class CAknIconArray;
       
    33 class CIRImageConverter;
       
    34 /**
       
    35  * This classes are used for Advertisements
       
    36  */
       
    37 class CIRFilteredModel;
       
    38 class MIRListBoxArray;
       
    39 class CIRAdvertisingListBox;
       
    40  /**
       
    41  * Container for Search Results View.
       
    42  */
       
    43 class CIRMainContainer : public CCoeControl,
       
    44 						 public MEikListBoxObserver,
       
    45                          public MIRImageConverterObserver,
       
    46     					 MProgressDialogCallback
       
    47     {
       
    48     
       
    49 public:  // Methods
       
    50 
       
    51     
       
    52     /**
       
    53     * NewL.
       
    54     * Two-phased constructor.
       
    55     * Create a CIRMainContainer object, which will draw itself to aRect
       
    56     * @param aRect The rectangle this view will be drawn to.
       
    57     * @param aView The MainView's instance.
       
    58     * @return a pointer to the created instance of CIRMainContainer.
       
    59     */
       
    60     static CIRMainContainer* NewL( CIRMainView& aView, const TRect& aRect );
       
    61 
       
    62     /**
       
    63     * NewLC.
       
    64     * Two-phased constructor.
       
    65     * Create a CIRMainContainer object, which will draw itself to aRect
       
    66     * @param aRect The rectangle this view will be drawn to.
       
    67     * @param aView The MainView's instance.
       
    68     * @return a pointer to the created instance of CIRMainContainer.
       
    69     */
       
    70     static CIRMainContainer* NewLC( CIRMainView& aView, const TRect& aRect );
       
    71     /**
       
    72      * ConstructL
       
    73      * 2nd phase constructor.
       
    74      */
       
    75      void ConstructL( const TRect& aRect);
       
    76     
       
    77 	/**
       
    78      * CIRMainContainer()
       
    79      * C++ default constructor.
       
    80 	 * @param aView View of this container.
       
    81      */
       
    82     CIRMainContainer(CIRMainView& aView);
       
    83     
       
    84     /**
       
    85      * ~CIRMainContainer()
       
    86      * Destructor.
       
    87      */
       
    88     ~CIRMainContainer();
       
    89 
       
    90 	
       
    91 	// from base class CCoeControl
       
    92 
       
    93      /**
       
    94 	 * From CCoeControl
       
    95 	 * @see CCoeControl::OfferKeyEventL() 
       
    96 	 */    
       
    97 	
       
    98 	TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType );
       
    99     
       
   100     /**
       
   101      * From MEikListBoxObserver HandleListBoxEventL
       
   102      */ 
       
   103     void HandleListBoxEventL( CEikListBox* aListBox, TListBoxEvent aEventType );
       
   104 	/**
       
   105 	 * From CCoeControl
       
   106 	 *
       
   107 	 * @see CCoeControl::GetHelpContext( TCoeHelpContext& aContext ) const
       
   108 	 */
       
   109 	void GetHelpContext( TCoeHelpContext& aContext ) const;
       
   110 	
       
   111 
       
   112 	/**
       
   113 	* CountComponentControls() const
       
   114 	* returns the number of components in the view.
       
   115 	*/
       
   116 	TInt CountComponentControls() const;
       
   117 	
       
   118 	/**
       
   119 	* ComponentControl()
       
   120 	* returns the pointer to the control
       
   121 	*/
       
   122 	CCoeControl* ComponentControl(TInt aIndex) const ;
       
   123 
       
   124 	/**
       
   125 	* SizeChanged()
       
   126 	* Responds to changes to the size and position of the contents of this control.
       
   127 	*/
       
   128 	void SizeChanged();
       
   129 	
       
   130 	/**
       
   131 	* HandleResourceChange()
       
   132 	* Handles a change to the control's resources.
       
   133 	*/
       
   134 	void HandleResourceChange(TInt aType);
       
   135 	/*
       
   136 	* CreateFindBoxL()
       
   137 	* Creates the find box for dynamic filtering
       
   138 	*/
       
   139 	CAknSearchField* CreateFindBoxL(CEikListBox* aListBox,
       
   140 				CTextListBoxModel* aModel, CAknSearchField::TSearchFieldStyle aStyle);
       
   141 	/*
       
   142 	* GetListPointer()
       
   143 	* returns List box pointer
       
   144 	*/
       
   145 	CIRAdvertisingListBox* GetListPointer();
       
   146 	/*
       
   147 	* GetFilterdModelPointer()
       
   148 	* returns filtered model pointer
       
   149 	*/
       
   150 	CIRFilteredModel* GetFilterdModelPointer();
       
   151 	/*
       
   152 	* GetSearchBoxPointer()
       
   153 	* returns Find  box pointer
       
   154 	*/
       
   155 	CAknSearchField* GetSearchBoxPointer();
       
   156     /**
       
   157     * Formats list item string with given arguments
       
   158     * 
       
   159     * @param aFirstRow text for first row
       
   160     * @param aSecondRow text for second row
       
   161     * @param aIconId Icon ID used on item
       
   162     */
       
   163     HBufC* FormatItemStringLC( const TDesC& aFirstRow, const TDesC& aSecondRow, TInt aIconId );
       
   164 	/**
       
   165      * UpdateAllL()
       
   166      * updates the search results data to the search results list
       
   167      */
       
   168  	void UpdateAllL();
       
   169 	/*
       
   170 	* DisableFindBox()
       
   171 	* disable the listbox when foxus is not present
       
   172 	*/
       
   173 	void DisableFindBox();
       
   174 	
       
   175 	/**
       
   176 	* Function : Comparestrings
       
   177 	* Function called to get the actual index of the station
       
   178 	*/
       
   179  	void  Comparestrings();
       
   180  	
       
   181  	/**
       
   182  	* HandleImageConversionEventL()
       
   183  	* from base class MIRImageConverterObserver
       
   184  	*/
       
   185 	void HandleImageConversionEventL( MIRImageConverterObserver::TIRImageConversionEvent aEvent,
       
   186 						 TInt aId, TInt aError );
       
   187  	/**
       
   188  	* CreateCustomListBoxL()
       
   189  	* Creates the custom listbox and updates the list according to that
       
   190  	*/
       
   191 	void CreateCustomListBoxL();
       
   192 	/**
       
   193 	* StartConvertL()
       
   194 	* used to convert the images depending the index passed
       
   195 	*/
       
   196 	void LastPlayedDisplayL();
       
   197 	/**
       
   198 	* CIRSearchResultsViewContainer::cmdMarkL()
       
   199 	* implement the mark/unmark feature
       
   200 	*/
       
   201 	void cmdMarkL(TInt item,TBool mark);
       
   202 	/**
       
   203 	* DeleteMultiStationsL()
       
   204 	* Deletes multiple elements from preset
       
   205 	*/ 
       
   206 	void DeleteMultiStationsL();
       
   207 	/**
       
   208 	* DeleteChannelL()
       
   209 	* used to convert the images depending the index passed
       
   210 	*/
       
   211 	void DeleteChannelL( TInt aIndex ) ;
       
   212 	// from base class MIRPresetChangesObserver
       
   213 	/**
       
   214 	* From MPSPresetObserver
       
   215 	* 
       
   216 	* @see HandlePresetChangedL( TInt aId, TUid aDataHandler, MPSPresetObserver::TPSReason aReason )
       
   217 	*/
       
   218 	void HandlePresetChangedL( TInt aId, TUid aDataHandler, MPSPresetObserver::TPSReason aReason );
       
   219 	/**
       
   220 	* StartConvertL()
       
   221 	* used to convert the images depending the index passed
       
   222 	*/
       
   223 	void CheckConnectionL(TInt aUrlIndex);
       
   224 
       
   225 	/**
       
   226 	* DisplayFilterListBoxL()
       
   227 	* Displayin gof filter box depending on favourites
       
   228 	*/
       
   229 	void DisplayFilterListBoxL();
       
   230     /**
       
   231     * DialogDismissedL
       
   232     * Called when/if the dialog has been dismissed.
       
   233     * @param aButtonId
       
   234     */
       
   235     void DialogDismissedL( TInt aButtonId );
       
   236 	/**
       
   237 	* Function : FilteredIndexL
       
   238 	* Function called when mark all is called after dynamic filtering
       
   239 	*/
       
   240 	void FilteredIndexL();
       
   241 	/*
       
   242 	* CreateProgressBarL()
       
   243 	* creates a progress bar.
       
   244 	*/
       
   245 	void CreateProgressBarL();
       
   246 	/*
       
   247 	* SetIconsL()
       
   248 	* Set Icons to the List
       
   249 	*/
       
   250 	void SetIconsL();
       
   251 	/*
       
   252 	* RemoveFromLogoArray()
       
   253 	* Removes the station from the logoarray
       
   254 	*/
       
   255 	void RemoveFromLogoArray(TInt aIndex);
       
   256 	/*
       
   257 	* SetContextSenstiveFlag()
       
   258 	* Set context senstive flag when the element is marked and
       
   259 	* single clicked and resets when all the elements are unmarked
       
   260 	*/
       
   261 	void SetContextSenstiveFlag(TBool aContextSensitiveFlag);
       
   262 	/*
       
   263 	* EnableEmptyListBox()
       
   264 	* creates the empty listbox
       
   265 	*/
       
   266 	void EnableEmptyListBox();
       
   267   	/**
       
   268 	* GetListBoxCount()
       
   269 	* returns the number of elements in the listbox
       
   270 	*/ 
       
   271   	TInt GetListBoxCount();
       
   272 	/**
       
   273 	 * GetCurrentItemIndex()
       
   274 	 * returns the index of the currently selected item
       
   275 	 */ 
       
   276 	TInt GetCurrentItemIndex() const;
       
   277 	
       
   278 	/**
       
   279 	 * GetListBoxTopIndex()
       
   280 	 * returns the index of the top item
       
   281 	 */ 
       
   282 	TInt GetListBoxTopIndex() const;
       
   283    	/**
       
   284 	* GetUrlIndex()
       
   285 	* returns the number of elements in the listbox
       
   286 	*/ 
       
   287   	TInt GetUrlIndex();
       
   288   	/**
       
   289 	* GetLastPlayedChannel()
       
   290 	* returns whether the last played station exists/not.
       
   291 	*/ 
       
   292 	TBool GetLastPlayedChannel();
       
   293 	/*
       
   294 	* GetContextSenstiveFlag()
       
   295 	* returns the context sensitive flag 
       
   296 	*/
       
   297 	TBool GetContextSenstiveFlag();
       
   298 	/*
       
   299 	* GetFilteredFlag()
       
   300 	* returns the filtered flag 
       
   301 	*/
       
   302 	TBool GetFilteredFlag();
       
   303     /**
       
   304      * Creates default (empty) icon
       
   305      * 
       
   306      * @return  Default icon
       
   307      */
       
   308     CGulIcon* CreateDefaultIconL();
       
   309 	void SendRequestForLastPlayedLogoL();
       
   310  	/*
       
   311   	 * CIRIsdsPreset* GetTempPreset()
       
   312   	 * returns the temporary preset 
       
   313   	 */
       
   314   	CIRIsdsPreset* GetTempPreset(); 
       
   315 	/**
       
   316 	* HandleLogoErrorL()
       
   317 	* called from the iSearchResultsView when the logo is not downloaded
       
   318 	*/
       
   319 	void HandleLogoErrorL();
       
   320    	/**
       
   321  	* PresetLogoDownloadL()
       
   322  	* Used to download the  logos depending the preset values.
       
   323  	*/
       
   324  	void PresetLogoDownloadL(CIRIsdsPreset* aPreset);
       
   325     /**
       
   326  	* RefreshViewL()
       
   327  	* Resets all the values and draws the view with new values.
       
   328  	*/
       
   329 	void RefreshViewL();
       
   330     /**
       
   331  	* SetFilteredIndexArrayL()
       
   332  	* stores the indexs of all the filtered elements
       
   333  	*/
       
   334 	void  SetFilteredIndexArrayL();
       
   335     /**
       
   336  	* CheckFiltered()
       
   337  	* checks whether the deleted index exists in the filteredindex array or not
       
   338  	*/
       
   339 	TBool CheckFiltered();
       
   340 	
       
   341 private: //Methods
       
   342 
       
   343 
       
   344 	// from base class CCoeControl
       
   345 	/**
       
   346      * From CCoeControl
       
   347      *
       
   348      * @see CCoeControl::Draw( const TRect& aRect ) const
       
   349 	 */
       
   350 	void Draw( const TRect& aRect ) const;
       
   351 	/**
       
   352 	* StartConvertL()
       
   353 	* used to convert the images depending the index passed
       
   354 	* 
       
   355 	*/
       
   356 	void StartConvertL( CIRImageConverter& aConverter, TInt aIndex, TInt aId );	
       
   357 	
       
   358 	void ProcessPointerEventL( TInt /* aIndex */);
       
   359 
       
   360 private:    // Data
       
   361 	 /**
       
   362 	 * iItemArray
       
   363 	 * array for the listbox model
       
   364 	 */ 
       
   365 	 CDesCArray* iListArray;
       
   366 	 
       
   367 	 /**
       
   368 	 * iMainView
       
   369 	 * Data for CIRStationsView view
       
   370 	 */ 
       
   371 	 CIRMainView& iMainView;
       
   372     /*
       
   373 	* iConverter
       
   374 	* instance of CIRImageConverter
       
   375 	*/
       
   376 	CIRImageConverter* iConverter;
       
   377 	
       
   378 	/*
       
   379 	* iCurrentItemConverter
       
   380 	* instance of CIRImageConverter
       
   381 	*/
       
   382 	CIRImageConverter* iCurrentItemConverter;
       
   383     /*
       
   384     * iBgContext
       
   385     * Instance of CAknsBasicBackgroundControlContext
       
   386     */
       
   387     CAknsBasicBackgroundControlContext* iBgContext;
       
   388 	/**
       
   389 	* iFavouritesListBox
       
   390 	* Instance of the Stations ListBox
       
   391 	*/
       
   392 	CIRAdvertisingListBox* iFavouritesListBox;
       
   393 	/*
       
   394 	* iSearchTextBox
       
   395 	* Instance for CAknSearchField;
       
   396 	*/
       
   397 	CAknSearchField* 			iFavouritesSearchBox;	
       
   398     /**
       
   399     * iLabel
       
   400     * instance for CAknDoubleNumberStyleListBox
       
   401     */
       
   402     CAknDoubleLargeStyleListBox* iEmptyListbox;
       
   403      /**
       
   404     * iProgressDialog
       
   405     * Not owned by CAknExNoteContainer object.
       
   406     */
       
   407     CAknProgressDialog*             iProgressDialog;
       
   408 
       
   409     /**
       
   410     * iProgressInfo
       
   411     * Not owned by CAknExNoteContainer object.
       
   412     */
       
   413     CEikProgressInfo*               iProgressInfo;
       
   414  	/*
       
   415 	* iFilteredModel
       
   416 	* Instance for CAknFilteredTextListBoxModel
       
   417 	*/ 
       
   418 	CIRFilteredModel* iFilteredModel;
       
   419     /*
       
   420     * iListBoxArray
       
   421     * Instance of MIRListBoxArray
       
   422     */
       
   423    	MIRListBoxArray* iListBoxArray;
       
   424 	/**
       
   425 	* Temporary preset to store url and the logo data
       
   426 	*/
       
   427 	CIRIsdsPreset *iTempPreset;
       
   428    /*
       
   429     * iItem
       
   430     * sets the itemfor filtered zeroth index
       
   431     */
       
   432 	HBufC *iItem;
       
   433     /*
       
   434     * iLastplayed
       
   435     * sets the Lastplayed string
       
   436     */
       
   437 	HBufC *iLastplayed ;
       
   438     /*
       
   439     * iAdvString
       
   440     * sets the advertisement string
       
   441     */
       
   442     HBufC* iAdvString;
       
   443 	/*
       
   444 	* iInvalidIconIndices
       
   445 	* instance of RArray
       
   446 	*/
       
   447 	RArray<TInt> iInvalidIconIndices;
       
   448 	/*
       
   449 	* iLogosArray
       
   450 	* instance of RArray
       
   451 	*/
       
   452 	RArray<TInt> iLogosArray;
       
   453 	/*
       
   454 	* iNoLogosArray
       
   455 	* instance of RArray
       
   456 	*/
       
   457 	RArray<TInt> iNoLogosArray;    
       
   458 	/*
       
   459 	* iInvalidIconIndices
       
   460 	* instance of RArray
       
   461 	*/
       
   462 	RArray<TInt> iFilterIndexExist;
       
   463  	/*
       
   464 	* iFindString
       
   465 	* Used to Get the Entered Search string
       
   466 	*/
       
   467 	TBuf<KSearchBoxTextLength> iFindString;
       
   468     /**
       
   469 	* iMultiDeleteString
       
   470 	* contains the data that how many elements are deleted after mark
       
   471 	*/   
       
   472 	RBuf iMultiDeleteString;	
       
   473     /**
       
   474 	* iFinalCount
       
   475 	* contains the final count to present after the deletion of marked items
       
   476 	*/   
       
   477 	TInt iFinalCount;
       
   478 	/*
       
   479 	* iUrlIndex
       
   480 	* contains the indx of the url
       
   481 	*/
       
   482    	TInt iUrlIndex;
       
   483     /**
       
   484 	* iProgressCount
       
   485 	* contains the number of counts the progress has incremented
       
   486 	*/   
       
   487 	TInt iProgressCount;
       
   488  	/*
       
   489 	* iDeletingCount
       
   490 	* contains the number of elements to be deleted
       
   491 	*/
       
   492     TInt iDeletingCount;
       
   493 	/*
       
   494 	* iImageCount
       
   495 	* have the position of image that has to be placed in iconarray
       
   496 	*/
       
   497     TInt iImageCount;
       
   498     /*
       
   499    	* iLandScapeCount
       
   500    	* used to call the aknfind s HandlePopupFindSizeChanged function only once
       
   501    	*/
       
   502 	TInt iLandScapeCount;
       
   503    /**
       
   504 	* iAftertime
       
   505 	* contains the time after the deletion of station
       
   506 	*/   
       
   507 	TTime iAftertime;
       
   508     /**
       
   509 	* iBeforetime
       
   510 	* contains the time before the deletion of stations started
       
   511 	*/   
       
   512 	TTime iBeforetime;
       
   513     /**
       
   514 	* iIntervalsec
       
   515 	* contians the difference of time taken to delete the elements 
       
   516 	* i.e., (iAftertime-iBeforetime)
       
   517 	*/   
       
   518 	TTimeIntervalMicroSeconds iIntervalsec;
       
   519     /**
       
   520 	* markedCount
       
   521 	* conatians the cunt of marked elements
       
   522 	*/   
       
   523 	TReal32 iMarkedElementsCount;
       
   524    /**
       
   525 	* iProgress
       
   526 	* contains the amount of progress should be done inorder to update the progress dialog
       
   527 	*/   
       
   528 	TReal32 iProgress;
       
   529 	/*
       
   530 	* iFilteredFlag
       
   531 	* This flag is set when dynamic filtering is done and
       
   532 	* will be reseted when the characters in the filter box is deleted
       
   533 	*/
       
   534 	TBool iFilteredFlag;
       
   535 	/*
       
   536 	* iContextSensitiveFlag
       
   537 	* sets when any station is marked and the element is single clicked
       
   538 	*/
       
   539     TBool iContextSensitiveFlag;
       
   540 	/*
       
   541 	* iImageLast
       
   542 	* sets when lastplayed has logo data
       
   543 	* and resets when the logo is dowmloaded
       
   544 	*/
       
   545     TBool iImageLast;
       
   546 	/*
       
   547 	* iLastPlayedChannel
       
   548 	*  variable to set the lastplayed station
       
   549 	*/
       
   550 	TBool iLastPlayedChannel;
       
   551     /*
       
   552     *
       
   553     * Flag for progress dialog status
       
   554     */
       
   555     TBool iProgressFlag;
       
   556 	/*
       
   557 	* iProgressStart
       
   558 	* this will be set when the progressdialog is created
       
   559 	*/
       
   560 	TBool iProgressStart;
       
   561 	/*
       
   562 	* iMoveFocusLast
       
   563 	* this will be set when the Move is enabled and the focus is on the lastplayed
       
   564 	*/
       
   565 	TBool iMoveFocusLast;
       
   566    	/*
       
   567    	* iLogoDownloadError
       
   568    	* sets when the  advertisment future is not supported
       
   569    	*/
       
   570 	TBool iLogoDownloadError;
       
   571 	TInt iError;
       
   572 	};
       
   573 
       
   574 #endif      // CIRMAINCONTAINER_H