stifui/qt/inc/stfqtuicontroller.h
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Tue, 25 May 2010 12:43:15 +0300
branchRCL_3
changeset 12 aefcba28a3e0
parent 9 404ad6c9bc20
child 15 65b472535a0d
permissions -rw-r--r--
Revision: 201019 Kit: 2010121

/*
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description: QT C++ based Class.
*              Application's controller.
*
*/
#ifndef STFQTUICONTROLLER_H_
#define STFQTUICONTROLLER_H_

#include "istfqtuicontroller.h"
#include "istfqtuimodel.h"
#include "stifexecutor.h"

class StfQtUIController : public IStfQtUIController, public IStifCaseUpdateListener
    {
public:
    StfQtUIController(IStfQtUIModel* aModel);
    ~StfQtUIController();
public: //Implement IStfQtUIController.
    //for cases

    bool OpenEngineIniFile(const QString& fileName);
    QList<QString> GetModuleList();
    QList<QString> GetCaseListByModule(const QString& moduleName);
    CSTFCase GetCase(const QString& moduleName, const int index);
    void RunCases(const QList<CSTFCase>& caseList, const TSTFCaseRunningType& type);
    bool AddCaseToSet(const QList<CSTFCase>& aCase, const QString& setName);
    
    //for set
    QList<QString> GetSetList();
    QList<QString> GetCaseListBySet(const QString& setName);
    bool CreateSet(QString& setName);
    bool DeleteSet(const QString& setName);
    void RunSets(const QString& setName, const TSTFCaseRunningType& type);
    
    //for Started
    void PauseCase();
    void ResumeCase();
    void AbortCase();
    bool ShowOutput();
    CSTFCase GetRunningCase(int index);
    void SetShowOutput(bool isShow);
    
    //for staticstic
    QList<CSTFCase> GetCasesByStatus(const TSTFCaseStatusType& type);
    
    //listener
    void AddStfEventListener(IStfEventListener* listener);
    void RemoveStfEventListener(IStfEventListener* listener);

public://implement IStifCaseUpdateListener
    void OnGetCaseUpdated(CStartedTestCase* aCase, CSTFCase& stfcase, int flags);
    void OnGetCaseOutput(CStartedTestCase* aCase, QString& msg);
    
private: //Fire event
    void FireOnGetOutput(QString message);
    void FireOnSetListChanged();
    void FireOnCaseOutputChanged(IStfEventListener::CaseOutputCommand cmd, int index, QString msg);
    
private://help methods
    CSTFModule GetModuleByName(const QString& moduleName);
    
private:
    CStifExecutor* executor;
    IStfQtUIModel* model;
    QList<IStfEventListener*> listenerList;
    bool isShowOutput;
    
    
        
    };




#endif /* STFQTUICONTROLLER_H_ */