creator/inc/engine.h
branchGCC_SURGE
changeset 37 c20154ccf3c0
parent 35 98924d2efce9
child 48 da3ec8478e66
--- a/creator/inc/engine.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/creator/inc/engine.h	Thu Jul 22 16:33:59 2010 +0100
@@ -22,14 +22,15 @@
 // INCLUDES
 #include <e32std.h>
 #include <e32base.h>
-#include <f32file.h>
-#include <W32STD.H>
+#include <e32hal.h>
+#include <s32file.h>
+#include <s32mem.h>
+#include <w32std.h>
 
 //#include <aknenv.h>
 #include <coeutils.h>
 #include <apparc.h>
 #include <eikenv.h>
-//#include <aknprogressdialog.h>
 //#include <eikprogi.h>
 #include <bautils.h>
 #include <commdb.h>
@@ -37,18 +38,6 @@
 
 #include "creator.hrh"
 #include "creator_std.h"
-#include "creator_scriptentry.h"
-#include "creator_modulebase.h"
-#include "creator_browser.h"
-#include "creator_calendar.h"
-#include "creator_phonebookbase.h"
-#include "creator_note.h"
-#include "creator_log.h"
-#include "creator_connectionmethodbase.h"
-#include "creator_mailbox.h"
-//#include "creator_imps.h"
-#include "creator_message.h"
-#include "creator_landmark.h"
 #include "creator_randomdataparser.h"
 
 //class CCreatorAppUi;
@@ -57,17 +46,21 @@
 class CCreatorCalendarBase;
 class CCreatorNotepad;
 class CCreatorLogs;
-class CCreatorAccessPoints;
+//class CCreatorAccessPoints;
 class CCreatorMailboxes;
 class CCreatorIMPS;
 class CCreatorFiles;
 class CCreatorMessages;
 class CCreatorLandmarks;
+class MCreatorModuleBase;
+class CCreatorPhonebookBase;
+class CCreatorModuleBaseParameters;
+//class CCreatorConnectionSettingsBase;
 class CDictionaryFileStore;
 class CImageDecoder;
 class CFbsBitmap;
 class CBitmapScaler;
-
+class CCommandParser;
 class EngineWrapper;
 class CCreatorCmdScriptRun;
 
@@ -85,27 +78,79 @@
 	R_ATTACHMENT_SINGLE_SELECTION_QUERY
 	};
 
+/*
+ * Interface for UI dialogs
+ */
+class MUIObserver
+    {
+public:
+    /**
+     * Called when some dialog in UI is closed
+     *
+     * @since S60 10.1
+     * @param aPositiveAction ETrue if "Ok", "Yes" or other "positive" button was pressed
+     * @param aUserData number that was passed to UI before dialog was opened
+     * @return None.
+     */
+    virtual void QueryDialogClosedL(TBool aPositiveAction, TInt aUserData) = 0;
+
+    };
+
+/*
+ * Interface for CCommandParser
+ */
+class MCommandParserObserver
+    {
+public:
+    /**
+     * Called when CCommandParser user has choosen script file
+     *
+     * @since S60 10.1
+     * @param aSuccess ETrue if "Ok", "Yes" or other "positive" button was pressed
+     * @param aFileName filename chosen by user
+     * @return None.
+     */
+    virtual void ScriptChosenL(TBool aSuccess, const TDesC& aFileName = KNullDesC) = 0;
+
+    /**
+     * Called when CCommandParser user has choosen random data file
+     *
+     * @since S60 10.1
+     * @param aSuccess ETrue if "Ok", "Yes" or other "positive" button was pressed
+     * @param aFileName filename chosen by user
+     * @return None.
+     */
+    virtual void RandomDataFileChosenL(TBool aSuccess, const TDesC& aFileName = KNullDesC) = 0;
+    };
+
 /**
  * Device memory information
  */
 class TMemoryDetails
 	{
 public:
-    TBuf<16> iCFree;
-    TBuf<16> iDFree;
-    TBuf<16> iEFree;
-    TBuf<16> iHFree;
-	TBuf<16> iCSize;
-    TBuf<16> iDSize;
+	
+	TBuf<16> iFree;
+	TBuf<16> iSize;
+	TChar iDriveLetter;
+
+    TBuf<16> iRamFree;
+    TBuf<16> iRomFree;
+    
 	TBool    iENotAvailable;
-    TBuf<16> iESize;
-	TBuf<16> iHSize;
+
+	TBuf<16> iRamSize;
+	TBuf<16> iRomSize;
 	};
 // Common constant for undefined integer value:
 const TInt KUndef = KErrNotFound;
 
-class CCreatorEngine : public CActive 
+class CCreatorEngine : public CActive, public MUIObserver, public MCommandParserObserver
 	{
+enum ECreatorEngineState{
+    ECreatorEngineDeleteAllEntries,
+    ECreatorEngineDeleteAllCreatorEntries,
+};
 public:
     
     enum TRandomStringType
@@ -196,6 +241,7 @@
     static CCreatorEngine* NewLC(EngineWrapper *aEngineWrapper);	
     ~CCreatorEngine();
 	
+    inline RPointerArray<TMemoryDetails> GetMemoryDetailsList(){ return iMemoryDetailsList; };
 	inline TMemoryDetails GetMemoryDetails(){ return iMemoryDetails; };
 	inline EngineWrapper* GetEngineWrapper(){ return iEngineWrapper; };
 	
@@ -213,10 +259,8 @@
     TInt RunError(TInt aError);
     void DoCancel();
 
-    void ExecuteFirstCommandL(const TDesC& aText);
     void ExecuteCommand();
     void StartEnginesL();
-    void ShutDownEnginesL();
     void CheckForMoreCommandsL();
     
     TBool IsDeleteCommand( TInt aCommand );
@@ -228,11 +272,45 @@
     void GenerateSourceImageFileL( const TTestDataPath aFileType, const TDesC& aFileName );
     void GenereteSourceTextFileL( const TDesC& aFileName, TInt aSize );
 
+public: // from MUIObserver
+    /**
+     * Called when some dialog in UI is closed
+     *
+     * @since S60 10.1
+     * @param aPositiveAction ETrue if "Ok", "Yes" or other "positive" button was pressed
+     * @param aUserData number that was passed to UI before dialog was opened
+     * @return ?description
+     */
+    virtual void QueryDialogClosedL(TBool aPositiveAction, TInt aUserData);
+    
+public: // from MCommandParserObserver
+    /**
+     * Called when CCommandParser user has choosen script file
+     *
+     * @since S60 10.1
+     * @param aSuccess ETrue if "Ok", "Yes" or other "positive" button was pressed
+     * @param aFileName filename chosen by user
+     * @return None.
+     */
+    virtual void ScriptChosenL(TBool aSuccess, const TDesC& aFileName = KNullDesC);
+    
+    /**
+     * Called when CCommandParser user has choosen random data file
+     *
+     * @since S60 10.1
+     * @param aSuccess ETrue if "Ok", "Yes" or other "positive" button was pressed
+     * @param aFileName filename chosen by user
+     * @return None.
+     */
+    virtual void RandomDataFileChosenL(TBool aSuccess, const TDesC& aFileName = KNullDesC);
+    
 public:
     void ExecuteOptionsMenuCommandL(TInt aCommand);
     void RunScriptL();
     TInt RunScriptL(const TDesC& aScriptFile);
-
+    void ShutDownEnginesL();
+    void ExecuteFirstCommandL(const TDesC& aText);
+    
     void AppendToCommandArrayL(TInt aCommand, CCreatorModuleBaseParameters* aParameters, TInt aNumberOfEntries = 1);
     TInt CommandArrayCount();
  
@@ -280,7 +358,7 @@
     
     void SetDefaultPathForFileCommandL(TInt aCommand, TFileName& aPath);
 
-    TBool GetRandomDataFilenameL(TDes& aFilename);
+    TBool GetRandomDataL();
     TBool GetRandomDataFromFileL(const TDesC& aFilename);
     void CancelComplete();
     CDictionaryFileStore* FileStoreLC();
@@ -290,6 +368,8 @@
     void WriteEntryIdsToStoreL( RArray<TUint32>& aEntryIds, const TUid aModuleUid );
     void RemoveStoreL( const TUid aModuleUid );
 	void ProgressDialogCancelledL();
+	
+	void SortCommands();
     
 private:
     // needed by the engine itself
@@ -297,7 +377,6 @@
     CEikonEnv* iEnv;
     //CCreatorAppUi* iAppUi;
     TInt iCurrentEntry;
-    TInt iEntriesToBeCreated;
     TInt iFailedCommands;
 
     CDesCArrayFlat* iSoundFileArray;
@@ -331,13 +410,14 @@
     CCreatorPhonebookBase* iPhonebook;
     CCreatorNotepad* iNotepad;
     CCreatorLogs* iLogs;
-    CCreatorConnectionSettingsBase* iAccessPoints;
+//    CCreatorConnectionSettingsBase* iAccessPoints;
     CCreatorMailboxes* iMailboxes;
     CCreatorIMPS* iIMPS;
     CCreatorFiles* iFiles;
     CCreatorMessages* iMessages;
     CCreatorLandmarks* iLandmarks;
 	CCreatorCmdScriptRun* iCmdScriptRun;
+	CCommandParser* iCommandParser;
 
     // options menu command home module
     MCreatorModuleBase* iUsedOptionsMenuModule;
@@ -359,6 +439,9 @@
 
     EngineWrapper* iEngineWrapper; // Enginewrapper that is used for communicating between QT and Symbian
 	TMemoryDetails iMemoryDetails;
+	
+	RPointerArray<TMemoryDetails> iMemoryDetailsList;
+	
 	TInt iResourceFileId;
 
 	HBufC* iCommandLineScriptName;