stifui/qt/src/stfqtuicontroller.cpp
branchRCL_3
changeset 12 aefcba28a3e0
parent 9 404ad6c9bc20
child 17 65b472535a0d
--- a/stifui/qt/src/stfqtuicontroller.cpp	Tue May 11 16:14:15 2010 +0300
+++ b/stifui/qt/src/stfqtuicontroller.cpp	Tue May 25 12:43:15 2010 +0300
@@ -18,18 +18,16 @@
 #include "stfqtuicontroller.h"
 #include <stifinternal/UIStoreIf.h>
 #include <stifinternal/UIStoreContainer.h>
-//#include "stiflogger.h"
 #include <QDateTime>
 
 const QString TEMPSETNAME = "TEMPSET";
 const QString DEFAULTINI = "c:\\testframework\\testframework.ini";
 
-//__DECLARE_LOG
+
 
 StfQtUIController::StfQtUIController(IStfQtUIModel* aModel) :
     model(aModel), isShowOutput(false)
     {
-//    __OPENLOGL ("\\STFQtUI\\", "StifQtUi.log" );
     executor = new CStifExecutor();
     executor->OpenIniFile(DEFAULTINI);
     executor->AddStifCaseUpdateListener(this);
@@ -40,15 +38,20 @@
     executor->RemoveStifCaseUpdateListener(this);
     delete executor;
     executor = NULL;
-//    __CLOSELOG;
     }
 //for cases
 
 bool StfQtUIController::OpenEngineIniFile(const QString& fileName)
     {
+    QString path = fileName;
+    if(path.contains('/'))
+        {
+        path = path.replace('/', '\\');
+        }
+    executor->RemoveStifCaseUpdateListener(this);
     delete executor;
     executor = new CStifExecutor();
-    bool rst = executor->OpenIniFile(fileName);
+    bool rst = executor->OpenIniFile(path);
     executor->AddStifCaseUpdateListener(this);
     return rst;
     }
@@ -132,19 +135,26 @@
         }
     }
 
-void StfQtUIController::AddCaseToSet(const QList<CSTFCase>& caseList,
-        const QString& /*setName*/)
+bool StfQtUIController::AddCaseToSet(const QList<CSTFCase>& caseList,
+        const QString& setName)
     {
-    QString setName = QDateTime::currentDateTime().toString("hh_mm_ss");
-    setName.append(".set");
-    executor->CreateSet(setName);
+    QString name = setName;
+    bool rst = true;
     foreach(CSTFCase aCase, caseList)
             {
-            executor->AddtoSet(setName, aCase);
+            rst = executor->AddtoSet(name, aCase);
+            if(!rst)
+                {
+                break;
+                }
             }
-    executor->SaveSet(setName);
-    executor->RemoveSet(setName);
+    if(!rst)
+        {
+        return false;
+        }
+    rst = executor->SaveSet(name);
     FireOnSetListChanged();
+    return rst;
     }
 
 //for set
@@ -164,18 +174,29 @@
     return caseList;
     }
 
-void StfQtUIController::CreateSet(const QString& setName)
+bool StfQtUIController::CreateSet(QString& setName)
     {
-    executor->CreateSet(setName);
-    //executor->SaveSet(setName);
+    bool rst = executor->CreateSet(setName);
+    if(!rst)
+        {
+        return rst;
+        }
+    rst = executor->SaveSet(setName);
     FireOnSetListChanged();
+    return rst;
     }
 
-void StfQtUIController::DeleteSet(const QString& setName)
+bool StfQtUIController::DeleteSet(const QString& setName)
     {
-    executor->RemoveSet(setName);
-    //executor->SaveSet(setName);
+    bool rst = executor->RemoveSet(setName);
+    if(!rst)
+        {
+        return false;
+        }
+    QString name = setName;
+    rst = executor->SaveSet(name);
     FireOnSetListChanged();
+    return rst;
     }
 
 void StfQtUIController::RunSets(const QString& setName, const TSTFCaseRunningType& type)
@@ -203,6 +224,12 @@
     FireOnGetOutput("Case Aborted");
     }
 
+CSTFCase StfQtUIController::GetRunningCase(int index)
+    {
+    CStartedTestCase* startedCase = (CStartedTestCase*) index;
+    return model->GetRunningCase(startedCase);
+    }
+
 bool StfQtUIController::ShowOutput()
     {
     return isShowOutput;
@@ -297,7 +324,7 @@
 void StfQtUIController::FireOnCaseOutputChanged(
         IStfEventListener::CaseOutputCommand cmd, int index, QString msg)
     {
-    if (ShowOutput())
+    if (true)//ShowOutput
         {
         foreach(IStfEventListener* listener, listenerList)
                 {