creator/inc/engine.h
changeset 19 4b22a598b890
parent 17 4f2773374eff
child 23 c9bf25a20c9f
equal deleted inserted replaced
17:4f2773374eff 19:4b22a598b890
    21 
    21 
    22 // INCLUDES
    22 // INCLUDES
    23 #include <e32std.h>
    23 #include <e32std.h>
    24 #include <e32base.h>
    24 #include <e32base.h>
    25 #include <f32file.h>
    25 #include <f32file.h>
    26 #include <W32STD.H>
    26 #include <s32file.h>
       
    27 #include <s32mem.h>
       
    28 #include <w32std.h>
    27 
    29 
    28 //#include <aknenv.h>
    30 //#include <aknenv.h>
    29 #include <coeutils.h>
    31 #include <coeutils.h>
    30 #include <apparc.h>
    32 #include <apparc.h>
    31 #include <eikenv.h>
    33 #include <eikenv.h>
    32 //#include <aknprogressdialog.h>
       
    33 //#include <eikprogi.h>
    34 //#include <eikprogi.h>
    34 #include <bautils.h>
    35 #include <bautils.h>
    35 #include <commdb.h>
    36 #include <commdb.h>
    36 #include <imageconversion.h> //TFrameInfo
    37 #include <imageconversion.h> //TFrameInfo
    37 
    38 
    38 #include "creator.hrh"
    39 #include "creator.hrh"
    39 #include "creator_std.h"
    40 #include "creator_std.h"
    40 #include "creator_scriptentry.h"
       
    41 #include "creator_modulebase.h"
       
    42 #include "creator_browser.h"
       
    43 #include "creator_calendar.h"
       
    44 #include "creator_phonebookbase.h"
       
    45 #include "creator_note.h"
       
    46 #include "creator_log.h"
       
    47 #include "creator_connectionmethodbase.h"
       
    48 #include "creator_mailbox.h"
       
    49 //#include "creator_imps.h"
       
    50 #include "creator_message.h"
       
    51 #include "creator_landmark.h"
       
    52 #include "creator_randomdataparser.h"
    41 #include "creator_randomdataparser.h"
    53 
    42 
    54 //class CCreatorAppUi;
    43 //class CCreatorAppUi;
    55 class TCommand;
    44 class TCommand;
    56 class CCreatorBrowser;
    45 class CCreatorBrowser;
    61 class CCreatorMailboxes;
    50 class CCreatorMailboxes;
    62 class CCreatorIMPS;
    51 class CCreatorIMPS;
    63 class CCreatorFiles;
    52 class CCreatorFiles;
    64 class CCreatorMessages;
    53 class CCreatorMessages;
    65 class CCreatorLandmarks;
    54 class CCreatorLandmarks;
       
    55 class MCreatorModuleBase;
       
    56 class CCreatorPhonebookBase;
       
    57 class CCreatorModuleBaseParameters;
       
    58 class CCreatorConnectionSettingsBase;
    66 class CDictionaryFileStore;
    59 class CDictionaryFileStore;
    67 class CImageDecoder;
    60 class CImageDecoder;
    68 class CFbsBitmap;
    61 class CFbsBitmap;
    69 class CBitmapScaler;
    62 class CBitmapScaler;
    70 
    63 class CCommandParser;
    71 class EngineWrapper;
    64 class EngineWrapper;
    72 class CCreatorCmdScriptRun;
    65 class CCreatorCmdScriptRun;
    73 
    66 
    74 static const TUid KUidCreatorApp = {0x20011383};
    67 static const TUid KUidCreatorApp = {0x20011383};
    75 
    68 
    82 	R_UNREAD_QUERY,
    75 	R_UNREAD_QUERY,
    83 	R_ATTACHMENT_MULTI_SELECTION_QUERY,
    76 	R_ATTACHMENT_MULTI_SELECTION_QUERY,
    84 	R_AMS_ATTACHMENT_SINGLE_SELECTION_QUERY,
    77 	R_AMS_ATTACHMENT_SINGLE_SELECTION_QUERY,
    85 	R_ATTACHMENT_SINGLE_SELECTION_QUERY
    78 	R_ATTACHMENT_SINGLE_SELECTION_QUERY
    86 	};
    79 	};
       
    80 
       
    81 /*
       
    82  * Interface for UI dialogs
       
    83  */
       
    84 class MUIObserver
       
    85     {
       
    86 public:
       
    87     /**
       
    88      * Called when some dialog in UI is closed
       
    89      *
       
    90      * @since S60 10.1
       
    91      * @param aPositiveAction ETrue if "Ok", "Yes" or other "positive" button was pressed
       
    92      * @param aUserData number that was passed to UI before dialog was opened
       
    93      * @return None.
       
    94      */
       
    95     virtual void QueryDialogClosedL(TBool aPositiveAction, TInt aUserData) = 0;
       
    96 
       
    97     };
       
    98 
       
    99 /*
       
   100  * Interface for CCommandParser
       
   101  */
       
   102 class MCommandParserObserver
       
   103     {
       
   104 public:
       
   105     /**
       
   106      * Called when CCommandParser user has choosen some file(script file, random data file)
       
   107      *
       
   108      * @since S60 10.1
       
   109      * @param aSuccess ETrue if "Ok", "Yes" or other "positive" button was pressed
       
   110      * @param aFileName filename chosen by user
       
   111      * @return None.
       
   112      */
       
   113     virtual void FileChosenL(TBool aSuccess, const TDesC& aFileName = KNullDesC) = 0;
       
   114 
       
   115     };
    87 
   116 
    88 /**
   117 /**
    89  * Device memory information
   118  * Device memory information
    90  */
   119  */
    91 class TMemoryDetails
   120 class TMemoryDetails
   102 	TBuf<16> iHSize;
   131 	TBuf<16> iHSize;
   103 	};
   132 	};
   104 // Common constant for undefined integer value:
   133 // Common constant for undefined integer value:
   105 const TInt KUndef = KErrNotFound;
   134 const TInt KUndef = KErrNotFound;
   106 
   135 
   107 class CCreatorEngine : public CActive 
   136 class CCreatorEngine : public CActive, public MUIObserver, public MCommandParserObserver
   108 	{
   137 	{
   109 public:
   138 public:
   110     
   139     
   111     enum TRandomStringType
   140     enum TRandomStringType
   112         {
   141         {
   211     void Init();
   240     void Init();
   212     void RunL();
   241     void RunL();
   213     TInt RunError(TInt aError);
   242     TInt RunError(TInt aError);
   214     void DoCancel();
   243     void DoCancel();
   215 
   244 
   216     void ExecuteFirstCommandL(const TDesC& aText);
       
   217     void ExecuteCommand();
   245     void ExecuteCommand();
   218     void StartEnginesL();
   246     void StartEnginesL();
   219     void ShutDownEnginesL();
       
   220     void CheckForMoreCommandsL();
   247     void CheckForMoreCommandsL();
   221     
   248     
   222     TBool IsDeleteCommand( TInt aCommand );
   249     TBool IsDeleteCommand( TInt aCommand );
   223     
   250     
   224     TInt ReadRandomDataL(const TRandomStringType aRandomStringType,
   251     TInt ReadRandomDataL(const TRandomStringType aRandomStringType,
   226     		             const TDesC& aFilename,
   253     		             const TDesC& aFilename,
   227     		             const CCreatorRandomDataParser::TRandomDataType aRandomDataType);
   254     		             const CCreatorRandomDataParser::TRandomDataType aRandomDataType);
   228     void GenerateSourceImageFileL( const TTestDataPath aFileType, const TDesC& aFileName );
   255     void GenerateSourceImageFileL( const TTestDataPath aFileType, const TDesC& aFileName );
   229     void GenereteSourceTextFileL( const TDesC& aFileName, TInt aSize );
   256     void GenereteSourceTextFileL( const TDesC& aFileName, TInt aSize );
   230 
   257 
       
   258 public: // from MUIObserver
       
   259     /**
       
   260      * Called when some dialog in UI is closed
       
   261      *
       
   262      * @since S60 10.1
       
   263      * @param aPositiveAction ETrue if "Ok", "Yes" or other "positive" button was pressed
       
   264      * @param aUserData number that was passed to UI before dialog was opened
       
   265      * @return ?description
       
   266      */
       
   267     virtual void QueryDialogClosedL(TBool aPositiveAction, TInt aUserData);
       
   268     
       
   269 public: // from MCommandParserObserver
       
   270     /**
       
   271      * Called when CCommandParser user has choosen some file(script file, random data file)
       
   272      *
       
   273      * @since S60 10.1
       
   274      * @param aSuccess ETrue if "Ok", "Yes" or other "positive" button was pressed
       
   275      * @param aFileName filename chosen by user
       
   276      * @return None.
       
   277      */
       
   278     virtual void FileChosenL(TBool aSuccess, const TDesC& aFileName = KNullDesC);
       
   279     
   231 public:
   280 public:
   232     void ExecuteOptionsMenuCommandL(TInt aCommand);
   281     void ExecuteOptionsMenuCommandL(TInt aCommand);
   233     void RunScriptL();
   282     void RunScriptL();
   234     TInt RunScriptL(const TDesC& aScriptFile);
   283     TInt RunScriptL(const TDesC& aScriptFile);
   235 
   284     void ShutDownEnginesL();
       
   285     void ExecuteFirstCommandL(const TDesC& aText);
       
   286     
   236     void AppendToCommandArrayL(TInt aCommand, CCreatorModuleBaseParameters* aParameters, TInt aNumberOfEntries = 1);
   287     void AppendToCommandArrayL(TInt aCommand, CCreatorModuleBaseParameters* aParameters, TInt aNumberOfEntries = 1);
   237     TInt CommandArrayCount();
   288     TInt CommandArrayCount();
   238  
   289  
   239     TPtrC TestDataPathL(enum TTestDataPath aTestDataPath);
   290     TPtrC TestDataPathL(enum TTestDataPath aTestDataPath);
   240     TPtrC RandomSoundFileL(); // Returns temporary path, which will be removed on shutdown 
   291     TPtrC RandomSoundFileL(); // Returns temporary path, which will be removed on shutdown 
   278             const TDesC& domain,
   329             const TDesC& domain,
   279             const TDesC& country) const;
   330             const TDesC& country) const;
   280     
   331     
   281     void SetDefaultPathForFileCommandL(TInt aCommand, TFileName& aPath);
   332     void SetDefaultPathForFileCommandL(TInt aCommand, TFileName& aPath);
   282 
   333 
   283     TBool GetRandomDataFilenameL(TDes& aFilename);
   334     TBool GetRandomDataL();
   284     TBool GetRandomDataFromFileL(const TDesC& aFilename);
   335     TBool GetRandomDataFromFileL(const TDesC& aFilename);
   285     void CancelComplete();
   336     void CancelComplete();
   286     CDictionaryFileStore* FileStoreLC();
   337     CDictionaryFileStore* FileStoreLC();
   287     void ReadEntryIdsFromStoreL( RArray<TInt>& aEntryIds, const TUid aModuleUid );
   338     void ReadEntryIdsFromStoreL( RArray<TInt>& aEntryIds, const TUid aModuleUid );
   288     void WriteEntryIdsToStoreL( RArray<TInt>& aEntryIds, const TUid aModuleUid );
   339     void WriteEntryIdsToStoreL( RArray<TInt>& aEntryIds, const TUid aModuleUid );
   336     CCreatorIMPS* iIMPS;
   387     CCreatorIMPS* iIMPS;
   337     CCreatorFiles* iFiles;
   388     CCreatorFiles* iFiles;
   338     CCreatorMessages* iMessages;
   389     CCreatorMessages* iMessages;
   339     CCreatorLandmarks* iLandmarks;
   390     CCreatorLandmarks* iLandmarks;
   340 	CCreatorCmdScriptRun* iCmdScriptRun;
   391 	CCreatorCmdScriptRun* iCmdScriptRun;
       
   392 	CCommandParser* iCommandParser;
   341 
   393 
   342     // options menu command home module
   394     // options menu command home module
   343     MCreatorModuleBase* iUsedOptionsMenuModule;
   395     MCreatorModuleBase* iUsedOptionsMenuModule;
   344     
   396     
   345     HBufC* iTempPath;
   397     HBufC* iTempPath;