stifui/qt/src/frmmain.cpp
branchRCL_3
changeset 13 822c625f7adc
parent 9 404ad6c9bc20
child 17 65b472535a0d
equal deleted inserted replaced
11:454d022d514b 13:822c625f7adc
    19 #include "stfqtuicontroller.h"
    19 #include "stfqtuicontroller.h"
    20 #include "stfqtuimodel.h"
    20 #include "stfqtuimodel.h"
    21 #include <QList>
    21 #include <QList>
    22 #include "version.h"
    22 #include "version.h"
    23 #include <QCursor>
    23 #include <QCursor>
       
    24 #include <QDesktopWidget>
    24 
    25 
    25 const QString SELECTITEMHEADER = " * ";
    26 const QString SELECTITEMHEADER = " * ";
    26 const QString UNSELECTITEMHEADER = "   ";
    27 const QString UNSELECTITEMHEADER = "   ";
    27 
    28 
    28 frmMain::frmMain()
    29 FrmMain::FrmMain()
    29     {
    30     {
    30     uiSetting = new UiSetting();
    31     uiSetting = new UiSetting();
    31     createMenus();
    32     createMenus();
    32     load();
    33     load();
    33     LoadSubMenu();
    34     LoadSubMenu();
       
    35     
       
    36     QFile file(uiSetting->ReadSetting(KStyleSheet));
       
    37     bool rst = file.open(QFile::ReadOnly);    
       
    38     if(rst)
       
    39         {
       
    40         QString styleSheet = QLatin1String(file.readAll());    
       
    41         qApp->setStyleSheet(styleSheet);    
       
    42         }
       
    43         
    34     model = new StfQtUIModel();
    44     model = new StfQtUIModel();
    35     model->AddStifModelEventListener(this);
    45     model->AddStifModelEventListener(this);
    36     controller = new StfQtUIController(model);
    46     controller = new StfQtUIController(model);
    37     controller->AddStfEventListener(this);
    47     controller->AddStfEventListener(this);
    38     loadContent();
    48     loadContent();
    39     dlgOutput = new DlgOutput(controller);
    49     dlgOutput = new DlgOutput(controller);
    40     setSetting();
    50     setSetting();
    41     }
    51     }
    42 
    52 
    43 frmMain::~frmMain()
    53 FrmMain::~FrmMain()
    44     {
    54     {
    45     model->AbortCase();
    55     model->AbortCase();
    46     controller->RemoveStfEventListener(this);
    56     controller->RemoveStfEventListener(this);
    47     model->RemoveStifModelEventListener(this);
    57     model->RemoveStifModelEventListener(this);
    48     
    58     
    50     delete dlgOutput;
    60     delete dlgOutput;
    51     delete controller;
    61     delete controller;
    52     delete model;
    62     delete model;
    53     }
    63     }
    54 
    64 
    55 void frmMain::setSetting()
    65 void FrmMain::paintEvent(QPaintEvent* event)
    56     {
    66     {
    57     controller->SetShowOutput(uiSetting->ReadSetting("showoutput") == "true");    
    67     
    58     }
    68     if(mainLayout != NULL)
    59 
    69         {
    60 void frmMain::OnGetMessage(const QString& aMessage)
    70         QDesktopWidget* desktop = QApplication::desktop();
       
    71         QRect rect = desktop->screenGeometry(0);
       
    72         bool temp = false;
       
    73         if(rect.height() > rect.width())
       
    74             {
       
    75             temp = true;
       
    76             }
       
    77         
       
    78         if(temp != layoutType)
       
    79             {
       
    80             mainLayout->removeWidget(tabWidget);
       
    81             mainLayout->removeWidget(groupBox);
       
    82             if(temp)
       
    83                 {
       
    84                 mainLayout->addWidget(tabWidget, 0, 0);
       
    85                 mainLayout->addWidget(groupBox, 1, 0, Qt::AlignBottom);
       
    86                 mainLayout->setRowStretch(0,4);
       
    87                 mainLayout->setRowStretch(1,1);
       
    88                 }
       
    89             else
       
    90                 {
       
    91                 mainLayout->addWidget(tabWidget, 0, 0);
       
    92                 mainLayout->addWidget(groupBox, 0, 1);//Qt::AlignRight
       
    93                 //groupBox->setFixedSize(60,0);
       
    94                 mainLayout->setColumnStretch(0,1);
       
    95                 mainLayout->setColumnStretch(1,1);
       
    96                 }
       
    97             layoutType = temp;
       
    98             
       
    99             }
       
   100         
       
   101         }
       
   102     event->accept();
       
   103     }
       
   104 
       
   105 void FrmMain::setSetting()
       
   106     {
       
   107     controller->SetShowOutput(uiSetting->ReadSetting(KShowOutput) == "true");    
       
   108     }
       
   109 
       
   110 void FrmMain::OnGetMessage(const QString& aMessage)
    61     {
   111     {
    62     txtOutput->appendPlainText(aMessage);
   112     txtOutput->appendPlainText(aMessage);
    63     }
   113     }
    64 
   114 
    65 void frmMain::OnRunningCaseChanged()
   115 void FrmMain::OnRunningCaseChanged()
    66     {
   116     {
    67     QList<CSTFCase> caseList = controller->GetCasesByStatus(EStatusRunning);
   117     QList<CSTFCase> caseList = controller->GetCasesByStatus(EStatusRunning);
    68     lstStartedCases->clear();
   118     lstStartedCases->clear();
    69     foreach(CSTFCase aCase, caseList)
   119     foreach(CSTFCase aCase, caseList)
    70             {
   120             {
    72             }
   122             }
    73     if (caseList.size() != 0)
   123     if (caseList.size() != 0)
    74         {
   124         {
    75         btnPauseCase->setEnabled(true);
   125         btnPauseCase->setEnabled(true);
    76         btnAbortCase->setEnabled(true);
   126         btnAbortCase->setEnabled(true);
       
   127         btnShowOutput->setEnabled(true);
    77         actPause->setEnabled(true);
   128         actPause->setEnabled(true);
    78         actAbort->setEnabled(true);
   129         actAbort->setEnabled(true);
       
   130         actOutput->setEnabled(true);
    79         }
   131         }
    80     else
   132     else
    81         {
   133         {
    82         btnPauseCase->setEnabled(false);
   134         btnPauseCase->setEnabled(false);
    83         btnAbortCase->setEnabled(false);
   135         btnAbortCase->setEnabled(false);
       
   136         btnShowOutput->setEnabled(false);
    84         actPause->setEnabled(false);
   137         actPause->setEnabled(false);
    85         actAbort->setEnabled(false);
   138         actAbort->setEnabled(false);
    86         }
   139         actOutput->setEnabled(false);
    87     }
   140         }
    88 
   141     }
    89 void frmMain::OnCaseOutputChanged(const IStfEventListener::CaseOutputCommand& /*cmd*/, const QString& /*index*/, const QString& /*msg*/)
   142 
       
   143 void FrmMain::OnCaseOutputChanged(const IStfEventListener::CaseOutputCommand& /*cmd*/, const QString& /*index*/, const QString& /*msg*/)
    90     {
   144     {
    91     //nothing to do.
   145     //nothing to do.
    92     }
   146     }
    93 
   147 
    94 void frmMain::OnSetListChanged()
   148 void FrmMain::OnSetListChanged()
    95     {
   149     {
    96     loadSetList();
   150     loadSetList();
    97     }
   151     }
    98 
   152 
    99 void frmMain::OnCaseStatisticChanged()
   153 void FrmMain::OnCaseStatisticChanged()
   100     {
   154     {
   101     loadStatistic();
   155     loadStatistic();
   102     }
   156     }
   103 
   157 
   104 void frmMain::createMenus()
   158 void FrmMain::createMenus()
   105     {
   159     {
   106     //operateMenu = menuBar()->addMenu(tr("&Operation"));
   160     //operateMenu = menuBar()->addMenu(tr("&Operation"));
   107     actAbout = new QAction(tr("&About"), this);
   161     actAbout = new QAction(tr("&About"), this);
   108     connect(actAbout, SIGNAL(triggered()), this,
   162     connect(actAbout, SIGNAL(triggered()), this,
   109             SLOT(on_actAbout_triggered()));
   163             SLOT(on_actAbout_triggered()));
   113 
   167 
   114     actOpenFile = new QAction(tr("&Open Ini File"), this);
   168     actOpenFile = new QAction(tr("&Open Ini File"), this);
   115     connect(actOpenFile, SIGNAL(triggered()), this,
   169     connect(actOpenFile, SIGNAL(triggered()), this,
   116             SLOT(on_actOpenFile_triggered()));
   170             SLOT(on_actOpenFile_triggered()));
   117 
   171 
   118     actRunCaseSeq = new QAction(tr("Run Case Sequentially"), this);
   172     menuRunCase = new QMenu(tr("Run Selected Case(s)"), this->menuBar());
       
   173     
       
   174     actRunCaseSeq = new QAction(tr("Sequentially"), this);
   119     connect(actRunCaseSeq, SIGNAL(triggered()), this,
   175     connect(actRunCaseSeq, SIGNAL(triggered()), this,
   120             SLOT(on_actRunCaseSeq_triggered()));
   176             SLOT(on_actRunCaseSeq_triggered()));
   121 
   177 
   122     actRunCasePar = new QAction(tr("Run Case Parallel"), this);
   178     actRunCasePar = new QAction(tr("Parallel"), this);
   123     connect(actRunCasePar, SIGNAL(triggered()), this,
   179     connect(actRunCasePar, SIGNAL(triggered()), this,
   124             SLOT(on_actRunCasePar_triggered()));
   180             SLOT(on_actRunCasePar_triggered()));
   125 
   181 
   126     actAddtoSet = new QAction(tr("Add cases to Set"), this);
   182     actAddtoSet = new QAction(tr("Add cases to Set"), this);
   127     connect(actAddtoSet, SIGNAL(triggered()), this,
   183     connect(actAddtoSet, SIGNAL(triggered()), this,
   137 
   193 
   138     actCollapseAll = new QAction(tr("Collapse All"), this);
   194     actCollapseAll = new QAction(tr("Collapse All"), this);
   139     connect(actCollapseAll, SIGNAL(triggered()), this,
   195     connect(actCollapseAll, SIGNAL(triggered()), this,
   140             SLOT(on_actCollapseAll_triggered()));
   196             SLOT(on_actCollapseAll_triggered()));
   141 
   197 
   142     actSetting = new QAction(tr("Setting"), this);
   198     actSetting = new QAction(tr("Settings"), this);
   143     connect(actSetting, SIGNAL(triggered()), this,
   199     connect(actSetting, SIGNAL(triggered()), this,
   144             SLOT(on_actSetting_triggered()));
   200             SLOT(on_actSetting_triggered()));
   145 
   201 
   146     actRunSetSeq = new QAction(tr("Run Set Sequentially"), this);
   202     menuRunSet = new QMenu(tr("Run Case(s) in Selected Set"), this->menuBar());
       
   203     
       
   204     actRunSetSeq = new QAction(tr("Sequentially"), this);
   147     connect(actRunSetSeq, SIGNAL(triggered()), this,
   205     connect(actRunSetSeq, SIGNAL(triggered()), this,
   148             SLOT(on_actRunSetSeq_triggered()));
   206             SLOT(on_actRunSetSeq_triggered()));
   149 
   207 
   150     actRunSetPar = new QAction(tr("Run Set Parallel"), this);
   208     actRunSetPar = new QAction(tr("Parallel"), this);
   151     connect(actRunSetPar, SIGNAL(triggered()), this,
   209     connect(actRunSetPar, SIGNAL(triggered()), this,
   152             SLOT(on_actRunSetPar_triggered()));
   210             SLOT(on_actRunSetPar_triggered()));
   153 
   211 
   154     actNewSet = new QAction(tr("Create New Set"), this);
   212     actNewSet = new QAction(tr("Create New Set"), this);
   155     connect(actNewSet, SIGNAL(triggered()), this,
   213     connect(actNewSet, SIGNAL(triggered()), this,
   166 
   224 
   167     actAbort = new QAction(tr("Abort"), this);
   225     actAbort = new QAction(tr("Abort"), this);
   168     actAbort->setEnabled(false);
   226     actAbort->setEnabled(false);
   169     connect(actAbort, SIGNAL(triggered()), this,
   227     connect(actAbort, SIGNAL(triggered()), this,
   170             SLOT(on_actAbort_triggered()));
   228             SLOT(on_actAbort_triggered()));
       
   229     
       
   230     actOutput = new QAction(tr("Output"), this);
       
   231     actOutput->setEnabled(false);
       
   232     connect(actAbort, SIGNAL(triggered()), this,
       
   233             SLOT(on_actOutput_triggered()));
   171 
   234 
   172     actClearStatistics = new QAction(tr("Clear Statistics"), this);
   235     actClearStatistics = new QAction(tr("Clear Statistics"), this);
   173     connect(actClearStatistics, SIGNAL(triggered()), this,
   236     connect(actClearStatistics, SIGNAL(triggered()), this,
   174             SLOT(on_actClearStatistics_triggered()));
   237             SLOT(on_actClearStatistics_triggered()));
   175 
   238 
   176     }
   239     }
   177 
   240 
   178 void frmMain::load()
   241 void FrmMain::load()
   179     {
   242     {
   180     this->setContextMenuPolicy(Qt::NoContextMenu);
   243     this->setContextMenuPolicy(Qt::NoContextMenu);
   181     QSize btnSize(100,35);
   244     
   182     QGridLayout *mainLayout = new QGridLayout(this);
   245     this->setWindowTitle(QtUIName);
       
   246     centerWidget = new QWidget(this);
       
   247     this->setCentralWidget(centerWidget);
       
   248     
       
   249     mainLayout = new QGridLayout(this);
   183     mainLayout->setVerticalSpacing(2);
   250     mainLayout->setVerticalSpacing(2);
   184     mainLayout->setHorizontalSpacing(2);
   251     mainLayout->setHorizontalSpacing(2);
   185     mainLayout->setSpacing(2);
   252     mainLayout->setSpacing(2);
   186     mainLayout->setMargin(2);
   253     mainLayout->setMargin(2);
   187 
   254     
   188     MainWidget = new QWidget(this);
   255     this->centralWidget()->setContextMenuPolicy(Qt::NoContextMenu);
   189     MainWidget->setContextMenuPolicy(Qt::NoContextMenu);
   256     
   190 
       
   191     //tab control
   257     //tab control
   192     tabWidget = new QTabWidget(this);
   258     tabWidget = new QTabWidget(this);
   193     tabWidget->setContextMenuPolicy(Qt::NoContextMenu);
   259     tabWidget->setContextMenuPolicy(Qt::NoContextMenu);
   194     tabCase = new QWidget(tabWidget);
   260     tabCase = new QWidget(tabWidget);
   195     tabCase->setContextMenuPolicy(Qt::NoContextMenu);
   261     tabCase->setContextMenuPolicy(Qt::NoContextMenu);
   205     tabWidget->addTab(tabStatistic, tr("Statistics"));
   271     tabWidget->addTab(tabStatistic, tr("Statistics"));
   206     connect(tabWidget, SIGNAL(currentChanged(int)), this,
   272     connect(tabWidget, SIGNAL(currentChanged(int)), this,
   207             SLOT(onTabWidgetSelectIndexChanged()));
   273             SLOT(onTabWidgetSelectIndexChanged()));
   208 
   274 
   209     //output panel
   275     //output panel
   210     QGroupBox *groupBox = new QGroupBox(this);
   276     groupBox = new QGroupBox(this);
   211     groupBox->setFixedHeight(150);
   277     //groupBox->setFixedHeight(150);
   212     groupBox->setContextMenuPolicy(Qt::NoContextMenu);
   278     groupBox->setContextMenuPolicy(Qt::NoContextMenu);
   213     groupBox->setTitle(tr("Information"));
   279     groupBox->setTitle(tr("Information"));
   214     QFont serifFont("Times", 5, QFont::Normal);
       
   215     txtOutput = new QPlainTextEdit(groupBox);
   280     txtOutput = new QPlainTextEdit(groupBox);
   216     txtOutput->setFont(serifFont);
       
   217     txtOutput->setContextMenuPolicy(Qt::NoContextMenu);
   281     txtOutput->setContextMenuPolicy(Qt::NoContextMenu);
   218     txtOutput->setReadOnly(true);
   282     txtOutput->setReadOnly(true);
   219     txtOutput->setFocusPolicy(Qt::NoFocus);
   283     txtOutput->setFocusPolicy(Qt::NoFocus);
   220     //txtOutput->setEditFocus(false);
   284     //txtOutput->setEditFocus(false);
   221     QGridLayout *groupBoxLayout = new QGridLayout(this);
   285     QGridLayout *groupBoxLayout = new QGridLayout(this);
   224     groupBoxLayout->setSpacing(2);
   288     groupBoxLayout->setSpacing(2);
   225     groupBoxLayout->setMargin(2);   
   289     groupBoxLayout->setMargin(2);   
   226     groupBoxLayout->addWidget(txtOutput, 0, 0);
   290     groupBoxLayout->addWidget(txtOutput, 0, 0);
   227     groupBox->setLayout(groupBoxLayout);
   291     groupBox->setLayout(groupBoxLayout);
   228 
   292 
       
   293     QDesktopWidget* desktop = QApplication::desktop();
       
   294     QRect rect = desktop->screenGeometry(0);
       
   295     if(rect.height() > rect.width())
       
   296         {
       
   297         mainLayout->addWidget(tabWidget, 0, 0);
       
   298         mainLayout->addWidget(groupBox, 1, 0, Qt::AlignBottom);
       
   299         mainLayout->setRowStretch(0,4);
       
   300         mainLayout->setRowStretch(1,1); 
       
   301         layoutType = true;
       
   302         }
       
   303     else
       
   304         {
       
   305         mainLayout->addWidget(tabWidget, 0, 0);
       
   306         mainLayout->addWidget(groupBox, 0, 1);//Qt::AlignRight
       
   307         //groupBox->setFixedSize(60,0);
       
   308         mainLayout->setColumnStretch(0,1);
       
   309         mainLayout->setColumnStretch(1,1);    
       
   310         layoutType = false;
       
   311         }
       
   312     
   229     //Create MainLayout and MainWidget
   313     //Create MainLayout and MainWidget
       
   314     this->centralWidget()->setLayout(mainLayout);
   230     mainLayout->addWidget(tabWidget, 0, 0);
   315     mainLayout->addWidget(tabWidget, 0, 0);
   231     mainLayout->addWidget(groupBox, 1, 0, Qt::AlignBottom);
   316     mainLayout->addWidget(groupBox, 1, 0, Qt::AlignBottom);
   232     MainWidget->setLayout(mainLayout);
   317     mainLayout->setRowStretch(0,4);
       
   318     mainLayout->setRowStretch(1,1);
   233     
   319     
   234 
   320 
   235     //Tab page: Case
   321     //Tab page: Case
   236     QGridLayout *tabCaseLayout = new QGridLayout(this);
   322     QGridLayout *tabCaseLayout = new QGridLayout(this);
   237     tabCaseLayout->setVerticalSpacing(2);
   323     tabCaseLayout->setVerticalSpacing(2);
   247             SLOT(on_treeModuleList_itemClicked(QTreeWidgetItem* , int)));
   333             SLOT(on_treeModuleList_itemClicked(QTreeWidgetItem* , int)));
   248     
   334     
   249 
   335 
   250     QWidget *caseToolWidget = new QWidget(tabCase);
   336     QWidget *caseToolWidget = new QWidget(tabCase);
   251     caseToolWidget->setContextMenuPolicy(Qt::NoContextMenu);
   337     caseToolWidget->setContextMenuPolicy(Qt::NoContextMenu);
   252     QGridLayout *caseToolWidgetLayout = new QGridLayout;
   338     QGridLayout *caseToolWidgetLayout = new QGridLayout(this);
   253     QPushButton *btnRunCase = new QPushButton(tr("Run"), caseToolWidget);
   339     QPushButton *btnRunCase = new QPushButton(tr("Run"), caseToolWidget);
   254     btnRunCase->setContextMenuPolicy(Qt::NoContextMenu);
   340     btnRunCase->setContextMenuPolicy(Qt::NoContextMenu);
   255     btnRunCase->setFixedSize(btnSize);
       
   256     connect(btnRunCase, SIGNAL(clicked()), this,
   341     connect(btnRunCase, SIGNAL(clicked()), this,
   257             SLOT(on_actRunCaseSeq_triggered()));
   342             SLOT(on_actRunCaseSeq_triggered()));
   258     QPushButton *btnExpandAll = new QPushButton(tr("Expand"), caseToolWidget);
   343     QPushButton *btnExpandAll = new QPushButton(tr("Expand"), caseToolWidget);
   259     btnExpandAll->setContextMenuPolicy(Qt::NoContextMenu);
   344     btnExpandAll->setContextMenuPolicy(Qt::NoContextMenu);
   260     btnExpandAll->setFixedSize(btnSize);
       
   261     connect(btnExpandAll, SIGNAL(clicked()), this,
   345     connect(btnExpandAll, SIGNAL(clicked()), this,
   262             SLOT(on_actExpandAll_triggered()));
   346             SLOT(on_actExpand_triggered()));
   263     QPushButton *btnCollapseAll = new QPushButton(tr("Collapse"),
   347     QPushButton *btnCollapseAll = new QPushButton(tr("Collapse"),
   264             caseToolWidget);
   348             caseToolWidget);
   265     btnCollapseAll->setContextMenuPolicy(Qt::NoContextMenu);
   349     btnCollapseAll->setContextMenuPolicy(Qt::NoContextMenu);
   266     btnCollapseAll->setFixedSize(btnSize);
       
   267     connect(btnCollapseAll, SIGNAL(clicked()), this,
   350     connect(btnCollapseAll, SIGNAL(clicked()), this,
   268             SLOT(on_actCollapseAll_triggered()));
   351             SLOT(on_actCollapse_triggered()));
   269 
   352 
   270     caseToolWidgetLayout->addWidget(btnRunCase, 0, 0);
   353     caseToolWidgetLayout->addWidget(btnRunCase, 0, 0);
   271     caseToolWidgetLayout->addWidget(btnExpandAll, 0, 1);
   354     caseToolWidgetLayout->addWidget(btnExpandAll, 0, 1);
   272     caseToolWidgetLayout->addWidget(btnCollapseAll, 0, 2);
   355     caseToolWidgetLayout->addWidget(btnCollapseAll, 0, 2);
   273     caseToolWidget->setLayout(caseToolWidgetLayout);
   356     caseToolWidget->setLayout(caseToolWidgetLayout);
   316     setToolWidgetLayout->setHorizontalSpacing(2);
   399     setToolWidgetLayout->setHorizontalSpacing(2);
   317     setToolWidgetLayout->setSpacing(2);
   400     setToolWidgetLayout->setSpacing(2);
   318     setToolWidgetLayout->setMargin(2);     
   401     setToolWidgetLayout->setMargin(2);     
   319     QPushButton *btnRunSetCase = new QPushButton(tr("Run"), setToolWidget);
   402     QPushButton *btnRunSetCase = new QPushButton(tr("Run"), setToolWidget);
   320     btnRunSetCase->setContextMenuPolicy(Qt::NoContextMenu);
   403     btnRunSetCase->setContextMenuPolicy(Qt::NoContextMenu);
   321     btnRunSetCase->setFixedSize(btnSize);
       
   322     connect(btnRunSetCase, SIGNAL(clicked()), this,
   404     connect(btnRunSetCase, SIGNAL(clicked()), this,
   323             SLOT(on_actRunSetSeq_triggered()));
   405             SLOT(on_actRunSetSeq_triggered()));
   324     QPushButton *btnNewSet = new QPushButton(tr("New Set"), setToolWidget);
   406     QPushButton *btnNewSet = new QPushButton(tr("New Set"), setToolWidget);
   325     btnNewSet->setContextMenuPolicy(Qt::NoContextMenu);
   407     btnNewSet->setContextMenuPolicy(Qt::NoContextMenu);
   326     btnNewSet->setFixedSize(btnSize);
       
   327     connect(btnNewSet, SIGNAL(clicked()), this,
   408     connect(btnNewSet, SIGNAL(clicked()), this,
   328             SLOT(on_actNewSet_triggered()));
   409             SLOT(on_actNewSet_triggered()));
   329     QPushButton *btnDelSet = new QPushButton(tr("Delete Set"), setToolWidget);
   410     QPushButton *btnDelSet = new QPushButton(tr("Delete Set"), setToolWidget);
   330     btnDelSet->setContextMenuPolicy(Qt::NoContextMenu);
   411     btnDelSet->setContextMenuPolicy(Qt::NoContextMenu);
   331     btnDelSet->setFixedSize(btnSize);
       
   332     connect(btnDelSet, SIGNAL(clicked()), this,
   412     connect(btnDelSet, SIGNAL(clicked()), this,
   333             SLOT(on_actDelSet_triggered()));
   413             SLOT(on_actDelSet_triggered()));
   334 
   414 
   335     setToolWidgetLayout->addWidget(btnRunSetCase, 0, 0);
   415     setToolWidgetLayout->addWidget(btnRunSetCase, 0, 0);
   336     setToolWidgetLayout->addWidget(btnNewSet, 0, 1);
   416     setToolWidgetLayout->addWidget(btnNewSet, 0, 1);
   356     startedToolWidgetLayout->setHorizontalSpacing(2);
   436     startedToolWidgetLayout->setHorizontalSpacing(2);
   357     startedToolWidgetLayout->setSpacing(2);
   437     startedToolWidgetLayout->setSpacing(2);
   358     startedToolWidgetLayout->setMargin(2);
   438     startedToolWidgetLayout->setMargin(2);
   359     btnPauseCase = new QPushButton(tr("Pause"), startedToolWidget);
   439     btnPauseCase = new QPushButton(tr("Pause"), startedToolWidget);
   360     btnPauseCase->setContextMenuPolicy(Qt::NoContextMenu);
   440     btnPauseCase->setContextMenuPolicy(Qt::NoContextMenu);
   361     btnPauseCase->setFixedSize(btnSize);
       
   362     connect(btnPauseCase, SIGNAL(clicked()), this,
   441     connect(btnPauseCase, SIGNAL(clicked()), this,
   363             SLOT(on_actPause_triggered()));
   442             SLOT(on_actPause_triggered()));
   364     btnPauseCase->setEnabled(false);
   443     btnPauseCase->setEnabled(false);
   365 
   444 
   366     btnAbortCase = new QPushButton(tr("Abort"), startedToolWidget);
   445     btnAbortCase = new QPushButton(tr("Abort"), startedToolWidget);
   367     btnAbortCase->setContextMenuPolicy(Qt::NoContextMenu);
   446     btnAbortCase->setContextMenuPolicy(Qt::NoContextMenu);
   368     btnAbortCase->setFixedSize(btnSize);
       
   369     connect(btnAbortCase, SIGNAL(clicked()), this,
   447     connect(btnAbortCase, SIGNAL(clicked()), this,
   370             SLOT(on_actAbort_triggered()));
   448             SLOT(on_actAbort_triggered()));
   371     btnAbortCase->setEnabled(false);
   449     btnAbortCase->setEnabled(false);
   372     //    
   450         
   373     //    QPushButton *btnShowOutput = new QPushButton(tr("Output"), startedToolWidget);
   451     btnShowOutput = new QPushButton(tr("Output"), startedToolWidget);
   374     //    connect(btnShowOutput, SIGNAL(clicked()), this,
   452     connect(btnShowOutput, SIGNAL(clicked()), this,
   375     //                SLOT(on_btnShowOutput_clicked()));
   453                 SLOT(on_actOutput_triggered()));
       
   454     btnShowOutput->setEnabled(false);
   376 
   455 
   377 
   456 
   378     startedToolWidgetLayout->addWidget(btnPauseCase, 0, 0);
   457     startedToolWidgetLayout->addWidget(btnPauseCase, 0, 0);
   379     startedToolWidgetLayout->addWidget(btnAbortCase, 0, 1);
   458     startedToolWidgetLayout->addWidget(btnAbortCase, 0, 1);
   380     //startedToolWidgetLayout->addWidget(btnShowOutput, 0, 2);
   459     startedToolWidgetLayout->addWidget(btnShowOutput, 0, 2);
   381     startedToolWidget->setLayout(startedToolWidgetLayout);
   460     startedToolWidget->setLayout(startedToolWidgetLayout);
   382 
   461 
   383     tabStartedLayout->addWidget(lstStartedCases, 0, 0);
   462     tabStartedLayout->addWidget(lstStartedCases, 0, 0);
   384     tabStartedLayout->addWidget(startedToolWidget, 1, 0);
   463     tabStartedLayout->addWidget(startedToolWidget, 1, 0);
   385     tabStarted->setLayout(tabStartedLayout);
   464     tabStarted->setLayout(tabStartedLayout);
   406     crashedItems = new QTreeWidgetItem(treeStatistic);
   485     crashedItems = new QTreeWidgetItem(treeStatistic);
   407     crashedItems->setText(0, tr("Crashed Cases(0)"));
   486     crashedItems->setText(0, tr("Crashed Cases(0)"));
   408     abortedItems = new QTreeWidgetItem(treeStatistic);
   487     abortedItems = new QTreeWidgetItem(treeStatistic);
   409     abortedItems->setText(0, tr("Aborted Cases(0)"));
   488     abortedItems->setText(0, tr("Aborted Cases(0)"));
   410     
   489     
   411     
   490     //this->repaint();
   412     setCentralWidget(MainWidget);
   491 
   413 
   492 
   414     }
   493     }
   415 
   494 
   416 void frmMain::LoadSubMenu()
   495 
       
   496 
       
   497 void FrmMain::LoadSubMenu()
   417     {
   498     {
   418     menuBar()->clear();
   499     menuBar()->clear();
   419     menuBar()->setContextMenuPolicy(Qt::NoContextMenu);
   500     menuBar()->setContextMenuPolicy(Qt::NoContextMenu);
   420     if (tabWidget->currentIndex() == 0)
   501     if (tabWidget->currentIndex() == 0)
   421         {
   502         {
   422         //Cases Tab
   503         //Cases Tab
   423         menuBar()->addAction(actOpenFile);
   504         menuBar()->addAction(actOpenFile);
   424         menuBar()->addAction(actRunCaseSeq);
   505         menuBar()->addMenu(menuRunCase);
   425         menuBar()->addAction(actRunCasePar);
   506         menuRunCase->addAction(actRunCaseSeq);
       
   507         menuRunCase->addAction(actRunCasePar);
   426         menuBar()->addSeparator();
   508         menuBar()->addSeparator();
   427         menuBar()->addAction(actAddtoSet);
   509         menuBar()->addAction(actAddtoSet);
   428         menuBar()->addSeparator();
   510         menuBar()->addSeparator();
   429         menuBar()->addAction(actSelectAll);
   511         menuBar()->addAction(actSelectAll);
   430         menuBar()->addAction(actExpandAll);
   512         menuBar()->addAction(actExpandAll);
   431         menuBar()->addAction(actCollapseAll);
   513         menuBar()->addAction(actCollapseAll);
   432         }
   514         }
   433     else if (tabWidget->currentIndex() == 1)
   515     else if (tabWidget->currentIndex() == 1)
   434         {
   516         {
   435         //Set Tab
   517         //Set Tab
   436         menuBar()->addAction(actRunSetSeq);
   518         menuBar()->addMenu(menuRunSet);
   437         menuBar()->addAction(actRunSetPar);
   519         menuRunSet->addAction(actRunSetSeq);
       
   520         menuRunSet->addAction(actRunSetPar);
   438         menuBar()->addSeparator();
   521         menuBar()->addSeparator();
   439         menuBar()->addAction(actNewSet);
   522         menuBar()->addAction(actNewSet);
   440         menuBar()->addAction(actDelSet);
   523         menuBar()->addAction(actDelSet);
   441         }
   524         }
   442     else if (tabWidget->currentIndex() == 2)
   525     else if (tabWidget->currentIndex() == 2)
   443         {
   526         {
   444         //Started Tab
   527         //Started Tab
   445         menuBar()->addAction(actPause);
   528         menuBar()->addAction(actPause);
   446         menuBar()->addAction(actAbort);
   529         menuBar()->addAction(actAbort);
       
   530         menuBar()->addAction(actOutput);
   447         
   531         
   448         }
   532         }
   449     else
   533     else
   450         {
   534         {
   451         //Staticstic tab
   535         //Staticstic tab
   456     menuBar()->addAction(actAbout);
   540     menuBar()->addAction(actAbout);
   457     menuBar()->addAction(actExit);
   541     menuBar()->addAction(actExit);
   458 
   542 
   459     }
   543     }
   460 
   544 
   461 void frmMain::onTabWidgetSelectIndexChanged()
   545 void FrmMain::onTabWidgetSelectIndexChanged()
   462     {
   546     {
   463     LoadSubMenu();
   547     LoadSubMenu();
   464     }
   548     }
   465 
   549 
   466 void frmMain::loadContent()
   550 void FrmMain::loadContent()
   467     {
   551     {
   468     //Load ModuleList
   552     //Load ModuleList
   469     loadModuleList();
   553     loadModuleList();
   470     //Load SetList
   554     //Load SetList
   471     loadSetList();
   555     loadSetList();
   472     //Load Statistic List
   556     //Load Statistic List
   473     loadStatistic();
   557     loadStatistic();
   474     }
   558     }
   475 
   559 
   476 void frmMain::loadModuleList()
   560 void FrmMain::loadModuleList()
   477     {
   561     {
   478     treeModuleList->clear();
   562     treeModuleList->clear();
   479     
   563     
   480     QList<QString> moduleList = controller->GetModuleList();
   564     QList<QString> moduleList = controller->GetModuleList();
   481     foreach(QString moduleName, moduleList)
   565     foreach(QString moduleName, moduleList)
   496         {
   580         {
   497         treeModuleList->setCurrentItem(treeModuleList->topLevelItem(0));
   581         treeModuleList->setCurrentItem(treeModuleList->topLevelItem(0));
   498         }
   582         }
   499     }
   583     }
   500 
   584 
   501 void frmMain::reloadStatisticItem(QString name, QTreeWidgetItem* item,
   585 void FrmMain::reloadStatisticItem(QString name, QTreeWidgetItem* item,
   502         TSTFCaseStatusType type)
   586         TSTFCaseStatusType type)
   503     {
   587     {
   504     QList<CSTFCase> caseList = controller->GetCasesByStatus(type);
   588     QList<CSTFCase> caseList = controller->GetCasesByStatus(type);
   505     while (item->childCount() != 0)
   589     while (item->childCount() != 0)
   506         {
   590         {
   512             QTreeWidgetItem* child = new QTreeWidgetItem(item);
   596             QTreeWidgetItem* child = new QTreeWidgetItem(item);
   513             child->setText(0, aCase.Name());
   597             child->setText(0, aCase.Name());
   514             }
   598             }
   515     }
   599     }
   516 
   600 
   517 void frmMain::loadStatistic()
   601 void FrmMain::loadStatistic()
   518     {
   602     {
   519     //executedItems;
   603     //executedItems;
   520     reloadStatisticItem("Executed Cases", executedItems, EStatusExecuted);
   604     reloadStatisticItem("Executed Cases", executedItems, EStatusExecuted);
   521 
   605 
   522     //passedItems;
   606     //passedItems;
   531     //abortedItems;
   615     //abortedItems;
   532     reloadStatisticItem("Aborted Cases", abortedItems, EStatusAborted);
   616     reloadStatisticItem("Aborted Cases", abortedItems, EStatusAborted);
   533 
   617 
   534     }
   618     }
   535 
   619 
   536 void frmMain::loadSetList()
   620 void FrmMain::loadSetList()
   537     {
   621     {
   538     cboSetList->clear();
   622     cboSetList->clear();
   539 
   623 
   540     QList<QString> setList = controller->GetSetList();
   624     QList<QString> setList = controller->GetSetList();
   541     foreach(QString setName, setList)
   625     foreach(QString setName, setList)
   547 //        //cboSetList->setCurrentIndex(0);
   631 //        //cboSetList->setCurrentIndex(0);
   548 //        on_cboSetList_currentIndexChanged(setList.at(0));
   632 //        on_cboSetList_currentIndexChanged(setList.at(0));
   549 //        }
   633 //        }
   550     }
   634     }
   551 
   635 
   552 QList<CSTFCase> frmMain::getSelectedCases()
   636 QList<CSTFCase> FrmMain::getSelectedCases()
   553     {
   637     {
   554     int index = 0;
   638     int index = 0;
   555     QTreeWidgetItem* item = treeModuleList->topLevelItem(index);
   639     QTreeWidgetItem* item = treeModuleList->topLevelItem(index);
   556     QList<CSTFCase> caseList;
   640     QList<CSTFCase> caseList;
   557     while (item != 0)
   641     while (item != 0)
   572         item = treeModuleList->topLevelItem(index);
   656         item = treeModuleList->topLevelItem(index);
   573         }
   657         }
   574     return caseList;
   658     return caseList;
   575     }
   659     }
   576 
   660 
   577 void frmMain::on_cboSetList_currentIndexChanged(QString item)
   661 void FrmMain::on_cboSetList_currentIndexChanged(QString item)
   578     {
   662     {
   579     lstSetCases->clear();
   663     lstSetCases->clear();
   580     QList<QString> list = controller->GetCaseListBySet(item);
   664     QList<QString> list = controller->GetCaseListBySet(item);
   581     foreach(QString caseName, list)
   665     foreach(QString caseName, list)
   582             {
   666             {
   583             lstSetCases->addItem(caseName);
   667             lstSetCases->addItem(caseName);
   584             }
   668             }
   585     }
   669     }
   586 
   670 
   587 void frmMain::on_actRunCaseSeq_triggered()
   671 void FrmMain::startRunning()
       
   672     {
       
   673     setSetting();
       
   674     tabWidget->setCurrentWidget(tabStarted);    
       
   675     }
       
   676 
       
   677 void FrmMain::on_actRunCaseSeq_triggered()
   588     {
   678     {
   589     //run case seq
   679     //run case seq
       
   680     startRunning();
   590     controller->RunCases(getSelectedCases(), Sequentially);
   681     controller->RunCases(getSelectedCases(), Sequentially);
   591     }
   682     }
   592 
   683 
   593 void frmMain::on_actRunCasePar_triggered()
   684 void FrmMain::on_actRunCasePar_triggered()
   594     {
   685     {
       
   686     startRunning();
   595     controller->RunCases(getSelectedCases(), Parallel);
   687     controller->RunCases(getSelectedCases(), Parallel);
   596     }
   688     }
   597 
   689 
   598 void frmMain::on_actAddtoSet_triggered()
   690 void FrmMain::on_actAddtoSet_triggered()
   599     {
   691     {
   600 
   692 
   601     QList<CSTFCase> list = getSelectedCases();
   693     QList<CSTFCase> list = getSelectedCases();
   602     if (list.size() == 0)
   694     if (list.size() == 0)
   603         {
   695         {
   604         QErrorMessage *errorMessageDialog = new QErrorMessage(this);
   696         QErrorMessage *errorMessageDialog = new QErrorMessage(this);
       
   697         errorMessageDialog->setAutoFillBackground(true);
   605         errorMessageDialog->showMessage(tr(
   698         errorMessageDialog->showMessage(tr(
   606                 "Please select cases you want to added to set."));
   699                 "<font color =black>Please select cases you want to added to set.</font>"));
   607         return;
   700         return;
   608         }
   701         }
   609 
   702 
   610     QList<QString> setList = controller->GetSetList();
   703     QList<QString> setList = controller->GetSetList();
   611 
   704 
   612     /*    
   705     DlgSetSelector dlgSet(setList, this);
   613      bool ok;
   706     int result = dlgSet.exec();
   614      QString setName = QInputDialog::getItem(this, tr(
   707     QString setName;
   615      "Add select cases to Set"), tr("Sets:"), setList, 0, false, &ok);
   708     if(result == QDialog::Accepted)
   616      if (ok && !setName.isEmpty())
   709         {
   617      {
   710         setName = dlgSet.SelectName();
   618      controller->AddCaseToSet(list, setName);
   711         }
   619      }
   712     else
   620      */
   713         {
   621 
   714         return;
   622     //temp code, because UIStore()->AddCaseToSet() is not support to define a set name.
   715         }
   623     controller->AddCaseToSet(list, "");
   716     bool rst = false;
       
   717     if(setName == "")
       
   718         {
       
   719         setName = "temp.set";
       
   720         rst = controller->CreateSet(setName);
       
   721         if(!rst)
       
   722             {
       
   723             return;
       
   724             }
       
   725         }
       
   726     controller->AddCaseToSet(list, setName);
       
   727 //
       
   728 //     bool ok;
       
   729 //     QString setName = QInputDialog::getItem(this, tr(
       
   730 //     "\r\nAdd select cases to Set"), tr("\r\n\r\nSets:"), setList, 0, false, &ok, Qt::Dialog);
       
   731 //     if (ok && !setName.isEmpty())
       
   732 //     {
       
   733 //     if(setName == newSet)
       
   734 //         {
       
   735 //         ok = controller->CreateSet(setName);
       
   736 //         if(!ok)
       
   737 //             {
       
   738 //             return;
       
   739 //             }
       
   740 //         }
       
   741 //     controller->AddCaseToSet(list, setName);
       
   742 //     }
   624     tabWidget->setCurrentIndex(1);
   743     tabWidget->setCurrentIndex(1);
   625 
   744     int index = -1;
   626     }
   745     for(int i=0;i<cboSetList->count();i++)
   627 
   746         {
   628 void frmMain::on_actSelectAll_triggered()
   747         if(cboSetList->itemText(i) == setName)
       
   748             {
       
   749             index = i;
       
   750             break;
       
   751             }
       
   752         }
       
   753     if(index != -1)
       
   754         {
       
   755         cboSetList->setCurrentIndex(index);
       
   756         }
       
   757 
       
   758     
       
   759     }
       
   760 
       
   761 void FrmMain::on_actSelectAll_triggered()
   629     {
   762     {
   630     QString header = UNSELECTITEMHEADER;
   763     QString header = UNSELECTITEMHEADER;
   631     if(actSelectAll->text() == "Select All")
   764     if(actSelectAll->text() == "Select All")
   632         {
   765         {
   633         actSelectAll->setText("UnSelect All");
   766         actSelectAll->setText("UnSelect All");
   651         index++;
   784         index++;
   652         item = treeModuleList->topLevelItem(index);
   785         item = treeModuleList->topLevelItem(index);
   653         }
   786         }
   654     }
   787     }
   655 
   788 
   656 void frmMain::on_actExpandAll_triggered()
   789 void FrmMain::on_actExpandAll_triggered()
   657     {
   790     {
       
   791     QTreeWidgetItem* item = treeModuleList->currentItem();
   658     treeModuleList->expandAll();
   792     treeModuleList->expandAll();
   659     }
   793     if(item != NULL)
   660 
   794         {
   661 void frmMain::on_actCollapseAll_triggered()
   795         treeModuleList->setCurrentItem(item);
   662     {
   796         }
       
   797         
       
   798     }
       
   799 
       
   800 void FrmMain::on_actCollapseAll_triggered()
       
   801     {
       
   802     QTreeWidgetItem* item = treeModuleList->currentItem();
       
   803     if(item != NULL)
       
   804         {
       
   805         if(item->parent() != NULL)
       
   806             {
       
   807             item = item->parent();
       
   808             }
       
   809         }
   663     treeModuleList->collapseAll();
   810     treeModuleList->collapseAll();
   664     }
   811     if(item != NULL)
   665 
   812         {
   666 void frmMain::on_actSetting_triggered()
   813         treeModuleList->setCurrentItem(item);
       
   814         }
       
   815     
       
   816     }
       
   817 
       
   818 void FrmMain::on_actSetting_triggered()
   667     {
   819     {
   668     DlgSetting dlgSet(uiSetting);
   820     DlgSetting dlgSet(uiSetting);
   669     int result = dlgSet.exec();
   821     int result = dlgSet.exec();
   670     if(result == QDialog::Accepted)
   822     if(result == QDialog::Accepted)
   671         {
   823         {
   672         setSetting();
   824         setSetting();
   673         }
   825         }
   674     }
   826     }
   675 
   827 
   676 void frmMain::on_actRunSetSeq_triggered()
   828 void FrmMain::on_actRunSetSeq_triggered()
   677     {
   829     {
       
   830     startRunning();
   678     QString setName = cboSetList->currentText();
   831     QString setName = cboSetList->currentText();
   679     controller->RunSets(setName, Sequentially);
   832     controller->RunSets(setName, Sequentially);
   680     }
   833     }
   681 
   834 
   682 void frmMain::on_actRunSetPar_triggered()
   835 void FrmMain::on_actRunSetPar_triggered()
   683     {
   836     {
       
   837     startRunning();
   684     QString setName = cboSetList->currentText();
   838     QString setName = cboSetList->currentText();
   685     controller->RunSets(setName, Parallel);
   839     controller->RunSets(setName, Parallel);
   686     }
   840     }
   687 
   841 
   688 void frmMain::on_actNewSet_triggered()
   842 void FrmMain::on_actNewSet_triggered()
   689     {
   843     {
   690     //not supported.
   844     QString name;
   691     QErrorMessage *errorMessageDialog = new QErrorMessage(this);
   845     bool rst = controller->CreateSet(name);
   692     errorMessageDialog->showMessage(
   846     if(rst)
   693             tr(
   847         {
   694                     "The feature is not supported in this version.\r\n    \
   848         QMessageBox::information(this, 
   695             If you want to Add test set.\r\n           \
   849                 tr("Create Set Successfully"), 
   696             Please switch to \"Case\" tab, Select case(s) and perform \"Add case to set\"."));
   850                 "Create a new test set, named: " + name);
   697     return;
   851 
   698     /*
   852         int index = -1;
   699      * These function is not supported in this version.
   853         for(int i=0;i<cboSetList->count();i++)
   700      * Unless this function has been impelemented:
   854             {
   701      * UIStore()->AddSet(setName);
   855             if(cboSetList->itemText(i) == name)
   702      * 
   856                 {
   703      bool ok;
   857                 index = i;
   704      QString text = QInputDialog::getText(this, tr("Create a new Set"), tr(
   858                 break;
   705      "Input a set name:"), QLineEdit::Normal, QDir::home().dirName(),
   859                 }
   706      &ok);
   860             }
   707      if (ok && !text.isEmpty())
   861         if(index != -1)
   708      {
   862             {
   709      controller->CreateSet(text);
   863             cboSetList->setCurrentIndex(index);
   710      }
   864             }
   711      */
   865 
   712     }
   866         
   713 
   867         }
   714 void frmMain::on_actDelSet_triggered()
   868     else
   715     {
   869         {
   716     //not supported.
   870         QMessageBox::information(this, 
   717     QErrorMessage *errorMessageDialog = new QErrorMessage(this);
   871                 tr("Create Set Failed"), 
   718     errorMessageDialog->showMessage(
   872                 tr("Please check the log for more information."));
   719             tr(
   873     
   720                     "The feature is not supported in this version.\r\n    \
   874         }
   721             If you want to remove test set.\r\n           \
   875     
   722             Please delete them under {epoc root}\\winscw\\c\\TestFramework  \
   876     }
   723             And restart Application"));
   877 
   724     return;
   878 void FrmMain::on_actDelSet_triggered()
   725     /*
   879     {
   726      * These function is not supported in this version.
   880         QString setName = cboSetList->currentText();
   727      * Unless this function has been impelemented:
   881         QMessageBox msgBox(QMessageBox::Warning, tr("Delete a Set"), tr(
   728      * UIStore()->RemoveSet(setName);
   882         "Do you really want to delete the set?"), 0, this);
   729      * 
   883         msgBox.addButton(tr("&Delete"), QMessageBox::AcceptRole);
   730      QString setName = cboSetList->currentText();
   884         msgBox.addButton(tr("&Cancel"), QMessageBox::RejectRole);
   731      QMessageBox msgBox(QMessageBox::Warning, tr("Delete a Set"), tr(
   885         if (msgBox.exec() == QMessageBox::AcceptRole)
   732      "Do you really want to delete the set?"), 0, this);
   886         {
   733      msgBox.addButton(tr("&Delete"), QMessageBox::AcceptRole);
   887         controller->DeleteSet(setName);
   734      msgBox.addButton(tr("&Cancel"), QMessageBox::RejectRole);
   888         }
   735      if (msgBox.exec() == QMessageBox::AcceptRole)
   889 
   736      {
   890     }
   737      controller->DeleteSet(setName);
   891 
   738      }
   892 void FrmMain::on_actPause_triggered()
   739      
       
   740      
       
   741      */
       
   742     }
       
   743 
       
   744 void frmMain::on_actPause_triggered()
       
   745     {
   893     {
   746     if (btnPauseCase->text() == "Pause")
   894     if (btnPauseCase->text() == "Pause")
   747         {
   895         {
   748         controller->PauseCase();
   896         controller->PauseCase();
   749         btnPauseCase->setText(tr("Resume"));
   897         btnPauseCase->setText(tr("Resume"));
   755         btnPauseCase->setText(tr("Pause"));
   903         btnPauseCase->setText(tr("Pause"));
   756         actPause->setText(tr("Pause"));
   904         actPause->setText(tr("Pause"));
   757         }
   905         }
   758     }
   906     }
   759 
   907 
   760 void frmMain::on_actAbort_triggered()
   908 void FrmMain::on_actAbort_triggered()
   761     {
   909     {
   762     controller->AbortCase();
   910     controller->AbortCase();
   763     }
   911     }
   764 
   912 
   765 void frmMain::on_treeModuleList_itemClicked(QTreeWidgetItem* item, int /*column*/)
   913 void FrmMain::on_treeModuleList_itemClicked(QTreeWidgetItem* item, int /*column*/)
   766     {
   914     {
   767     QString header = UNSELECTITEMHEADER;
   915     QString header = UNSELECTITEMHEADER;
   768     if(item->text(0).startsWith(UNSELECTITEMHEADER))
   916     if(item->text(0).startsWith(UNSELECTITEMHEADER))
   769         {
   917         {
   770             header = SELECTITEMHEADER;
   918             header = SELECTITEMHEADER;
   774         {
   922         {
   775             item->child(i)->setText(0, item->child(i)->text(0).replace(0, 3, header));
   923             item->child(i)->setText(0, item->child(i)->text(0).replace(0, 3, header));
   776         }
   924         }
   777     }
   925     }
   778 
   926 
   779 void frmMain::on_actAbout_triggered()
   927 void FrmMain::on_actAbout_triggered()
   780     {
   928     {
   781     QString str = QtUIVersion;
   929     QString str = QtUIName + "<&nbsp;>" + QtUIVersion;
   782     str.append("\r\n").append("STF version:");
   930     str.append("<br>").append("engine version:");
   783     
   931     
   784     str.append(QString::number(STIF_MAJOR_VERSION, 10)).append(".");
   932     str.append(QString::number(STIF_MAJOR_VERSION, 10)).append(".");
   785     str.append(QString::number(STIF_MINOR_VERSION, 10)).append(".");
   933     str.append(QString::number(STIF_MINOR_VERSION, 10)).append(".");
   786     str.append(QString::number(STIF_BUILD_VERSION, 10));
   934     str.append(QString::number(STIF_BUILD_VERSION, 10));
   787     str.append("  --").append(STIF_REL_DATE).append("\r\n");
   935     str.append("  --").append(STIF_REL_DATE).append("<br>");
   788     str.append("---");
   936     str.append("---");
   789     str.append("\r\nCopyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. ");
   937     str.append("Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. ");
   790 
   938 
   791     QMessageBox::information(this, tr("About"), str);
   939     QErrorMessage *errorMessageDialog = new QErrorMessage(this);
   792     }
   940     errorMessageDialog->showMessage("<font color =black size=12px><b>" + str + "</b></font>");
   793 
   941     
   794 void frmMain::on_actOpenFile_triggered()
   942     }
       
   943 
       
   944 void FrmMain::on_actOpenFile_triggered()
   795     {
   945     {
   796     QString fileName = QFileDialog::getOpenFileName(this, tr(
   946     QString fileName = QFileDialog::getOpenFileName(this, tr(
   797             "Select ini file"), tr("c:\\"), tr(
   947             "Select ini file"), tr("c:\\"), tr(
   798             "Ini Files (*.ini);;All Files (*)"));
   948             "Ini Files (*.ini);;All Files (*)"));
   799     if (!fileName.isEmpty())
   949     if (!fileName.isEmpty())
   800         {
   950         {
   801         controller->OpenEngineIniFile(fileName);
   951         bool result = controller->OpenEngineIniFile(fileName);
   802         this->loadModuleList();
   952         if(result)
   803         }
   953             {
   804     }
   954             this->loadModuleList();   
   805 
   955             QMessageBox::information(this, tr("Open INI File"), "Load Engine INI file successfully!");
   806 void frmMain::on_actClearStatistics_triggered()
   956             }
       
   957         else
       
   958             {
       
   959             QMessageBox::warning(this, tr("Open INI File"),"Failed to Load Engine INI file. Please check the file format and its path.");
       
   960             }
       
   961         
       
   962         }
       
   963     }
       
   964 
       
   965 void FrmMain::on_actClearStatistics_triggered()
   807     {
   966     {
   808     model->ClearCasesStatus();
   967     model->ClearCasesStatus();
   809     }
   968     }
       
   969 
       
   970 
       
   971 void FrmMain::on_actExpand_triggered()
       
   972     {
       
   973     QTreeWidgetItem* item = treeModuleList->currentItem();
       
   974     if(item != NULL)
       
   975         {
       
   976         item->setExpanded(true);
       
   977         }
       
   978     }
       
   979 
       
   980 void FrmMain::on_actCollapse_triggered()
       
   981     {
       
   982 
       
   983     QTreeWidgetItem* item = treeModuleList->currentItem();
       
   984     if(item != NULL)
       
   985         {
       
   986         item->setExpanded(false);
       
   987         }
       
   988     }
       
   989 
       
   990 void FrmMain::on_actOutput_triggered()
       
   991     {
       
   992     controller->SetShowOutput(true);
       
   993     }
       
   994 
       
   995