|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: QT C++ based Class. |
|
15 * |
|
16 */ |
|
17 #include <QtGui> |
|
18 #include "frmmain.h" |
|
19 #include "stfqtuicontroller.h" |
|
20 #include "stfqtuimodel.h" |
|
21 #include <QList> |
|
22 #include "version.h" |
|
23 #include <QCursor> |
|
24 #include <QDesktopWidget> |
|
25 |
|
26 const QString SELECTITEMHEADER = " * "; |
|
27 const QString UNSELECTITEMHEADER = " "; |
|
28 |
|
29 FrmMain::FrmMain() |
|
30 { |
|
31 lastItemSelected = NULL; |
|
32 uiSetting = new UiSetting(); |
|
33 createMenus(); |
|
34 load(); |
|
35 LoadSubMenu(); |
|
36 |
|
37 QFile file(uiSetting->ReadSetting(KStyleSheet)); |
|
38 bool rst = file.open(QFile::ReadOnly); |
|
39 if(rst) |
|
40 { |
|
41 QString styleSheet = QLatin1String(file.readAll()); |
|
42 qApp->setStyleSheet(styleSheet); |
|
43 } |
|
44 |
|
45 model = new StfQtUIModel(); |
|
46 model->AddStifModelEventListener(this); |
|
47 controller = new StfQtUIController(model); |
|
48 controller->AddStfEventListener(this); |
|
49 loadContent(); |
|
50 dlgOutput = new DlgOutput(controller); |
|
51 setSetting(); |
|
52 } |
|
53 |
|
54 FrmMain::~FrmMain() |
|
55 { |
|
56 model->AbortCase(); |
|
57 controller->RemoveStfEventListener(this); |
|
58 model->RemoveStifModelEventListener(this); |
|
59 |
|
60 //lastItemSelected does not own any memory, don't need to delete. |
|
61 lastItemSelected = NULL; |
|
62 delete uiSetting; |
|
63 delete dlgOutput; |
|
64 delete controller; |
|
65 delete model; |
|
66 } |
|
67 |
|
68 void FrmMain::paintEvent(QPaintEvent* event) |
|
69 { |
|
70 |
|
71 if(mainLayout != NULL) |
|
72 { |
|
73 QDesktopWidget* desktop = QApplication::desktop(); |
|
74 QRect rect = desktop->screenGeometry(0); |
|
75 bool temp = false; |
|
76 if(rect.height() > rect.width()) |
|
77 { |
|
78 temp = true; |
|
79 } |
|
80 |
|
81 if(temp != layoutType) |
|
82 { |
|
83 mainLayout->removeWidget(tabWidget); |
|
84 mainLayout->removeWidget(groupBox); |
|
85 if(temp) |
|
86 { |
|
87 mainLayout->addWidget(tabWidget, 0, 0); |
|
88 mainLayout->addWidget(groupBox, 1, 0, Qt::AlignBottom); |
|
89 mainLayout->setRowStretch(0,4); |
|
90 mainLayout->setRowStretch(1,1); |
|
91 } |
|
92 else |
|
93 { |
|
94 mainLayout->addWidget(tabWidget, 0, 0); |
|
95 mainLayout->addWidget(groupBox, 0, 1);//Qt::AlignRight |
|
96 //groupBox->setFixedSize(60,0); |
|
97 mainLayout->setColumnStretch(0,1); |
|
98 mainLayout->setColumnStretch(1,1); |
|
99 } |
|
100 layoutType = temp; |
|
101 |
|
102 } |
|
103 |
|
104 } |
|
105 event->accept(); |
|
106 } |
|
107 |
|
108 void FrmMain::setSetting() |
|
109 { |
|
110 controller->SetShowOutput(uiSetting->ReadSetting(KShowOutput) == "true"); |
|
111 // Apply filter changes |
|
112 QString newFilter = uiSetting->ReadSetting(KFilter); |
|
113 QString newFilterCaseSens = uiSetting->ReadSetting(KFilterCaseSens); |
|
114 if(currentFilter != newFilter || currentFilterCaseSens != newFilterCaseSens) |
|
115 { |
|
116 // Store new filter for further use |
|
117 currentFilter = newFilter; |
|
118 currentFilterCaseSens = newFilterCaseSens; |
|
119 |
|
120 // Create and setup regular expression for wildcard searching |
|
121 QRegExp filter; |
|
122 filter.setPattern((newFilter == "") ? ("*") : (tr("*") + newFilter + tr("*"))); |
|
123 filter.setCaseSensitivity((newFilterCaseSens == "true") ? (Qt::CaseSensitive) : (Qt::CaseInsensitive)); |
|
124 filter.setPatternSyntax(QRegExp::Wildcard); |
|
125 |
|
126 // Go through top level entries (modules) |
|
127 bool isAnythingHidden = false; |
|
128 for(int i = 0; i < treeModuleList->topLevelItemCount(); i++) |
|
129 { |
|
130 QTreeWidgetItem* top = treeModuleList->topLevelItem(i); |
|
131 // And through test cases for each module |
|
132 for(int j = 0; j < top->childCount(); j++) |
|
133 { |
|
134 QTreeWidgetItem *child = top->child(j); |
|
135 // Remove first three chars to get valid test case title |
|
136 QString title = (child->text(0)).mid(3); |
|
137 // Check if title is matching to filter and show or hide it |
|
138 if(filter.exactMatch(title)) |
|
139 { |
|
140 child->setHidden(false); |
|
141 } |
|
142 else |
|
143 { |
|
144 child->setHidden(true); |
|
145 child->setText(0, child->text(0).replace(0, 3, UNSELECTITEMHEADER)); |
|
146 isAnythingHidden = true; |
|
147 } |
|
148 } |
|
149 } |
|
150 |
|
151 if(isAnythingHidden) |
|
152 treeModuleList->headerItem()->setText(0, tr("Module List (filtered)")); |
|
153 else |
|
154 treeModuleList->headerItem()->setText(0, tr("Module List")); |
|
155 } |
|
156 } |
|
157 |
|
158 void FrmMain::OnGetMessage(const QString& aMessage) |
|
159 { |
|
160 txtOutput->appendPlainText(aMessage); |
|
161 } |
|
162 |
|
163 void FrmMain::OnRunningCaseChanged() |
|
164 { |
|
165 QList<CSTFCase> caseList = controller->GetCasesByStatus(EStatusRunning); |
|
166 lstStartedCases->clear(); |
|
167 foreach(CSTFCase aCase, caseList) |
|
168 { |
|
169 lstStartedCases->addItem(aCase.Name()); |
|
170 } |
|
171 if (caseList.size() != 0) |
|
172 { |
|
173 btnPauseCase->setEnabled(true); |
|
174 btnAbortCase->setEnabled(true); |
|
175 btnShowOutput->setEnabled(true); |
|
176 actPause->setEnabled(true); |
|
177 actAbort->setEnabled(true); |
|
178 actOutput->setEnabled(true); |
|
179 } |
|
180 else |
|
181 { |
|
182 btnPauseCase->setEnabled(false); |
|
183 btnAbortCase->setEnabled(false); |
|
184 btnShowOutput->setEnabled(false); |
|
185 actPause->setEnabled(false); |
|
186 actAbort->setEnabled(false); |
|
187 actOutput->setEnabled(false); |
|
188 } |
|
189 } |
|
190 |
|
191 void FrmMain::OnCaseOutputChanged(const IStfEventListener::CaseOutputCommand& /*cmd*/, const QString& /*index*/, const QString& /*msg*/) |
|
192 { |
|
193 //nothing to do. |
|
194 } |
|
195 |
|
196 void FrmMain::OnSetListChanged() |
|
197 { |
|
198 loadSetList(); |
|
199 } |
|
200 |
|
201 void FrmMain::OnCaseStatisticChanged() |
|
202 { |
|
203 loadStatistic(); |
|
204 } |
|
205 |
|
206 void FrmMain::createMenus() |
|
207 { |
|
208 //operateMenu = menuBar()->addMenu(tr("&Operation")); |
|
209 actAbout = new QAction(tr("&About"), this); |
|
210 connect(actAbout, SIGNAL(triggered()), this, |
|
211 SLOT(on_actAbout_triggered())); |
|
212 |
|
213 actExit = new QAction(tr("&Exit"), this); |
|
214 connect(actExit, SIGNAL(triggered()), this, SLOT(close())); |
|
215 |
|
216 actOpenFile = new QAction(tr("&Open Ini File"), this); |
|
217 connect(actOpenFile, SIGNAL(triggered()), this, |
|
218 SLOT(on_actOpenFile_triggered())); |
|
219 |
|
220 menuRunCase = new QMenu(tr("Run Selected Case(s)"), this->menuBar()); |
|
221 |
|
222 actRunCaseSeq = new QAction(tr("Sequentially"), this); |
|
223 connect(actRunCaseSeq, SIGNAL(triggered()), this, |
|
224 SLOT(on_actRunCaseSeq_triggered())); |
|
225 |
|
226 actRunCasePar = new QAction(tr("Parallel"), this); |
|
227 connect(actRunCasePar, SIGNAL(triggered()), this, |
|
228 SLOT(on_actRunCasePar_triggered())); |
|
229 |
|
230 //////////////////// |
|
231 actReapeatRunSeq = new QAction(tr("Repeat run sequentially"), this); |
|
232 connect(actReapeatRunSeq, SIGNAL(triggered()), this, |
|
233 SLOT(on_actReapeatRunSeq_triggered())); |
|
234 |
|
235 actAddtoSet = new QAction(tr("Add cases to Set"), this); |
|
236 connect(actAddtoSet, SIGNAL(triggered()), this, |
|
237 SLOT(on_actAddtoSet_triggered())); |
|
238 |
|
239 actSelectAll = new QAction(tr("Select All"), this); |
|
240 connect(actSelectAll, SIGNAL(triggered()), this, |
|
241 SLOT(on_actSelectAll_triggered())); |
|
242 |
|
243 actExpandAll = new QAction(tr("Expand All"), this); |
|
244 connect(actExpandAll, SIGNAL(triggered()), this, |
|
245 SLOT(on_actExpandAll_triggered())); |
|
246 |
|
247 actCollapseAll = new QAction(tr("Collapse All"), this); |
|
248 connect(actCollapseAll, SIGNAL(triggered()), this, |
|
249 SLOT(on_actCollapseAll_triggered())); |
|
250 |
|
251 actSetting = new QAction(tr("Settings"), this); |
|
252 connect(actSetting, SIGNAL(triggered()), this, |
|
253 SLOT(on_actSetting_triggered())); |
|
254 |
|
255 menuRunSet = new QMenu(tr("Run Case(s) in Selected Set"), this->menuBar()); |
|
256 |
|
257 actRunSetSeq = new QAction(tr("Sequentially"), this); |
|
258 connect(actRunSetSeq, SIGNAL(triggered()), this, |
|
259 SLOT(on_actRunSetSeq_triggered())); |
|
260 |
|
261 actRunSetPar = new QAction(tr("Parallel"), this); |
|
262 connect(actRunSetPar, SIGNAL(triggered()), this, |
|
263 SLOT(on_actRunSetPar_triggered())); |
|
264 |
|
265 actNewSet = new QAction(tr("Create New Set"), this); |
|
266 connect(actNewSet, SIGNAL(triggered()), this, |
|
267 SLOT(on_actNewSet_triggered())); |
|
268 |
|
269 actDelSet = new QAction(tr("Delete Set"), this); |
|
270 connect(actDelSet, SIGNAL(triggered()), this, |
|
271 SLOT(on_actDelSet_triggered())); |
|
272 |
|
273 actPause = new QAction(tr("Pause"), this); |
|
274 actPause->setEnabled(false); |
|
275 connect(actPause, SIGNAL(triggered()), this, |
|
276 SLOT(on_actPause_triggered())); |
|
277 |
|
278 actAbort = new QAction(tr("Abort"), this); |
|
279 actAbort->setEnabled(false); |
|
280 connect(actAbort, SIGNAL(triggered()), this, |
|
281 SLOT(on_actAbort_triggered())); |
|
282 |
|
283 actOutput = new QAction(tr("Output"), this); |
|
284 actOutput->setEnabled(false); |
|
285 connect(actAbort, SIGNAL(triggered()), this, |
|
286 SLOT(on_actOutput_triggered())); |
|
287 |
|
288 actClearStatistics = new QAction(tr("Clear Statistics"), this); |
|
289 connect(actClearStatistics, SIGNAL(triggered()), this, |
|
290 SLOT(on_actClearStatistics_triggered())); |
|
291 |
|
292 } |
|
293 |
|
294 void FrmMain::load() |
|
295 { |
|
296 this->setContextMenuPolicy(Qt::NoContextMenu); |
|
297 |
|
298 this->setWindowTitle(QtUIName); |
|
299 centerWidget = new QWidget(this); |
|
300 this->setCentralWidget(centerWidget); |
|
301 |
|
302 mainLayout = new QGridLayout(this); |
|
303 mainLayout->setVerticalSpacing(2); |
|
304 mainLayout->setHorizontalSpacing(2); |
|
305 mainLayout->setSpacing(2); |
|
306 mainLayout->setMargin(2); |
|
307 |
|
308 this->centralWidget()->setContextMenuPolicy(Qt::NoContextMenu); |
|
309 |
|
310 //tab control |
|
311 tabWidget = new QTabWidget(this); |
|
312 tabWidget->setContextMenuPolicy(Qt::NoContextMenu); |
|
313 tabCase = new QWidget(tabWidget); |
|
314 tabCase->setContextMenuPolicy(Qt::NoContextMenu); |
|
315 tabWidget->addTab(tabCase, tr("Cases")); |
|
316 tabSet = new QWidget(tabWidget); |
|
317 tabSet->setContextMenuPolicy(Qt::NoContextMenu); |
|
318 tabWidget->addTab(tabSet, tr(" Set ")); |
|
319 tabStarted = new QWidget(tabWidget); |
|
320 tabStarted->setContextMenuPolicy(Qt::NoContextMenu); |
|
321 tabWidget->addTab(tabStarted, tr("Running")); |
|
322 tabStatistic = new QWidget(tabWidget); |
|
323 tabStatistic->setContextMenuPolicy(Qt::NoContextMenu); |
|
324 tabWidget->addTab(tabStatistic, tr("Statistics")); |
|
325 connect(tabWidget, SIGNAL(currentChanged(int)), this, |
|
326 SLOT(onTabWidgetSelectIndexChanged())); |
|
327 |
|
328 //output panel |
|
329 groupBox = new QGroupBox(this); |
|
330 //groupBox->setFixedHeight(150); |
|
331 groupBox->setContextMenuPolicy(Qt::NoContextMenu); |
|
332 groupBox->setTitle(tr("Information")); |
|
333 txtOutput = new QPlainTextEdit(groupBox); |
|
334 txtOutput->setContextMenuPolicy(Qt::NoContextMenu); |
|
335 txtOutput->setReadOnly(true); |
|
336 txtOutput->setFocusPolicy(Qt::NoFocus); |
|
337 //txtOutput->setEditFocus(false); |
|
338 QGridLayout *groupBoxLayout = new QGridLayout(this); |
|
339 groupBoxLayout->setVerticalSpacing(2); |
|
340 groupBoxLayout->setHorizontalSpacing(2); |
|
341 groupBoxLayout->setSpacing(2); |
|
342 groupBoxLayout->setMargin(2); |
|
343 groupBoxLayout->addWidget(txtOutput, 0, 0); |
|
344 groupBox->setLayout(groupBoxLayout); |
|
345 |
|
346 QDesktopWidget* desktop = QApplication::desktop(); |
|
347 QRect rect = desktop->screenGeometry(0); |
|
348 if(rect.height() > rect.width()) |
|
349 { |
|
350 mainLayout->addWidget(tabWidget, 0, 0); |
|
351 mainLayout->addWidget(groupBox, 1, 0, Qt::AlignBottom); |
|
352 mainLayout->setRowStretch(0,4); |
|
353 mainLayout->setRowStretch(1,1); |
|
354 layoutType = true; |
|
355 } |
|
356 else |
|
357 { |
|
358 mainLayout->addWidget(tabWidget, 0, 0); |
|
359 mainLayout->addWidget(groupBox, 0, 1);//Qt::AlignRight |
|
360 //groupBox->setFixedSize(60,0); |
|
361 mainLayout->setColumnStretch(0,1); |
|
362 mainLayout->setColumnStretch(1,1); |
|
363 layoutType = false; |
|
364 } |
|
365 |
|
366 //Create MainLayout and MainWidget |
|
367 this->centralWidget()->setLayout(mainLayout); |
|
368 mainLayout->addWidget(tabWidget, 0, 0); |
|
369 mainLayout->addWidget(groupBox, 1, 0, Qt::AlignBottom); |
|
370 mainLayout->setRowStretch(0,4); |
|
371 mainLayout->setRowStretch(1,1); |
|
372 |
|
373 |
|
374 //Tab page: Case |
|
375 QGridLayout *tabCaseLayout = new QGridLayout(this); |
|
376 tabCaseLayout->setVerticalSpacing(2); |
|
377 tabCaseLayout->setHorizontalSpacing(2); |
|
378 tabCaseLayout->setSpacing(2); |
|
379 tabCaseLayout->setMargin(2); |
|
380 treeModuleList = new QTreeWidget(tabCase); |
|
381 treeModuleList->setContextMenuPolicy(Qt::NoContextMenu); |
|
382 treeModuleList->headerItem()->setText(0, tr("Module List")); |
|
383 treeModuleList->setSelectionBehavior(QAbstractItemView::SelectRows); |
|
384 treeModuleList->setEditFocus(false); |
|
385 connect(treeModuleList, SIGNAL(itemClicked(QTreeWidgetItem* , int)), this, |
|
386 SLOT(on_treeModuleList_itemClicked(QTreeWidgetItem* , int))); |
|
387 |
|
388 |
|
389 QWidget *caseToolWidget = new QWidget(tabCase); |
|
390 caseToolWidget->setContextMenuPolicy(Qt::NoContextMenu); |
|
391 QGridLayout *caseToolWidgetLayout = new QGridLayout(this); |
|
392 QPushButton *btnRunCase = new QPushButton(tr("Run"), caseToolWidget); |
|
393 btnRunCase->setContextMenuPolicy(Qt::NoContextMenu); |
|
394 connect(btnRunCase, SIGNAL(clicked()), this, |
|
395 SLOT(on_actRunCaseSeq_triggered())); |
|
396 QPushButton *btnExpandAll = new QPushButton(tr("Expand"), caseToolWidget); |
|
397 btnExpandAll->setContextMenuPolicy(Qt::NoContextMenu); |
|
398 connect(btnExpandAll, SIGNAL(clicked()), this, |
|
399 SLOT(on_actExpand_triggered())); |
|
400 QPushButton *btnCollapseAll = new QPushButton(tr("Collapse"), |
|
401 caseToolWidget); |
|
402 btnCollapseAll->setContextMenuPolicy(Qt::NoContextMenu); |
|
403 connect(btnCollapseAll, SIGNAL(clicked()), this, |
|
404 SLOT(on_actCollapse_triggered())); |
|
405 |
|
406 caseToolWidgetLayout->addWidget(btnRunCase, 0, 0); |
|
407 caseToolWidgetLayout->addWidget(btnExpandAll, 0, 1); |
|
408 caseToolWidgetLayout->addWidget(btnCollapseAll, 0, 2); |
|
409 caseToolWidget->setLayout(caseToolWidgetLayout); |
|
410 |
|
411 tabCaseLayout->addWidget(caseToolWidget, 1, 0); |
|
412 tabCaseLayout->addWidget(treeModuleList, 0, 0); |
|
413 tabCase->setLayout(tabCaseLayout); |
|
414 |
|
415 //Tab page: Set |
|
416 |
|
417 QGridLayout *tabSetLayout = new QGridLayout(this); |
|
418 tabSetLayout->setVerticalSpacing(2); |
|
419 tabSetLayout->setHorizontalSpacing(2); |
|
420 tabSetLayout->setSpacing(2); |
|
421 tabSetLayout->setMargin(2); |
|
422 |
|
423 QGridLayout *tabSetMainLayout = new QGridLayout(this); |
|
424 tabSetMainLayout->setVerticalSpacing(2); |
|
425 tabSetMainLayout->setHorizontalSpacing(2); |
|
426 tabSetMainLayout->setSpacing(2); |
|
427 tabSetMainLayout->setMargin(2); |
|
428 QWidget *tabSetMainWidget = new QWidget(tabSet); |
|
429 tabSetMainWidget->setContextMenuPolicy(Qt::NoContextMenu); |
|
430 QLabel *lblSet = new QLabel(tr("Test Set:"), tabSetMainWidget); |
|
431 lblSet->setContextMenuPolicy(Qt::NoContextMenu); |
|
432 QLabel *lblCase = new QLabel(tr("Cases:"), tabSetMainWidget); |
|
433 lblCase->setContextMenuPolicy(Qt::NoContextMenu); |
|
434 cboSetList = new QComboBox(tabSetMainWidget); |
|
435 cboSetList->setContextMenuPolicy(Qt::NoContextMenu); |
|
436 cboSetList->setEditable(false); |
|
437 connect(cboSetList, SIGNAL(currentIndexChanged(QString)), this, |
|
438 SLOT(on_cboSetList_currentIndexChanged(QString))); |
|
439 lstSetCases = new QListWidget(tabSetMainWidget); |
|
440 lstSetCases->setContextMenuPolicy(Qt::NoContextMenu); |
|
441 tabSetMainLayout->addWidget(lblSet, 0, 0); |
|
442 tabSetMainLayout->addWidget(cboSetList, 0, 1); |
|
443 tabSetMainLayout->addWidget(lblCase, 1, 0, |
|
444 (Qt::AlignTop | Qt::AlignRight)); |
|
445 tabSetMainLayout->addWidget(lstSetCases, 1, 1); |
|
446 tabSetMainWidget->setLayout(tabSetMainLayout); |
|
447 |
|
448 QWidget *setToolWidget = new QWidget(tabSet); |
|
449 setToolWidget->setContextMenuPolicy(Qt::NoContextMenu); |
|
450 QGridLayout *setToolWidgetLayout = new QGridLayout(this); |
|
451 setToolWidgetLayout->setVerticalSpacing(2); |
|
452 setToolWidgetLayout->setHorizontalSpacing(2); |
|
453 setToolWidgetLayout->setSpacing(2); |
|
454 setToolWidgetLayout->setMargin(2); |
|
455 QPushButton *btnRunSetCase = new QPushButton(tr("Run"), setToolWidget); |
|
456 btnRunSetCase->setContextMenuPolicy(Qt::NoContextMenu); |
|
457 connect(btnRunSetCase, SIGNAL(clicked()), this, |
|
458 SLOT(on_actRunSetSeq_triggered())); |
|
459 QPushButton *btnNewSet = new QPushButton(tr("New Set"), setToolWidget); |
|
460 btnNewSet->setContextMenuPolicy(Qt::NoContextMenu); |
|
461 connect(btnNewSet, SIGNAL(clicked()), this, |
|
462 SLOT(on_actNewSet_triggered())); |
|
463 QPushButton *btnDelSet = new QPushButton(tr("Delete Set"), setToolWidget); |
|
464 btnDelSet->setContextMenuPolicy(Qt::NoContextMenu); |
|
465 connect(btnDelSet, SIGNAL(clicked()), this, |
|
466 SLOT(on_actDelSet_triggered())); |
|
467 |
|
468 setToolWidgetLayout->addWidget(btnRunSetCase, 0, 0); |
|
469 setToolWidgetLayout->addWidget(btnNewSet, 0, 1); |
|
470 setToolWidgetLayout->addWidget(btnDelSet, 0, 2); |
|
471 setToolWidget->setLayout(setToolWidgetLayout); |
|
472 |
|
473 tabSetLayout->addWidget(tabSetMainWidget, 0, 0); |
|
474 tabSetLayout->addWidget(setToolWidget, 1, 0); |
|
475 tabSet->setLayout(tabSetLayout); |
|
476 |
|
477 //Tab Started |
|
478 QGridLayout *tabStartedLayout = new QGridLayout(this); |
|
479 tabStartedLayout->setVerticalSpacing(2); |
|
480 tabStartedLayout->setHorizontalSpacing(2); |
|
481 tabStartedLayout->setSpacing(2); |
|
482 tabStartedLayout->setMargin(2); |
|
483 lstStartedCases = new QListWidget(tabStarted); |
|
484 lstStartedCases->setContextMenuPolicy(Qt::NoContextMenu); |
|
485 QWidget *startedToolWidget = new QWidget(tabStarted); |
|
486 startedToolWidget->setContextMenuPolicy(Qt::NoContextMenu); |
|
487 QGridLayout *startedToolWidgetLayout = new QGridLayout(this); |
|
488 startedToolWidgetLayout->setVerticalSpacing(2); |
|
489 startedToolWidgetLayout->setHorizontalSpacing(2); |
|
490 startedToolWidgetLayout->setSpacing(2); |
|
491 startedToolWidgetLayout->setMargin(2); |
|
492 btnPauseCase = new QPushButton(tr("Pause"), startedToolWidget); |
|
493 btnPauseCase->setContextMenuPolicy(Qt::NoContextMenu); |
|
494 connect(btnPauseCase, SIGNAL(clicked()), this, |
|
495 SLOT(on_actPause_triggered())); |
|
496 btnPauseCase->setEnabled(false); |
|
497 |
|
498 btnAbortCase = new QPushButton(tr("Abort"), startedToolWidget); |
|
499 btnAbortCase->setContextMenuPolicy(Qt::NoContextMenu); |
|
500 connect(btnAbortCase, SIGNAL(clicked()), this, |
|
501 SLOT(on_actAbort_triggered())); |
|
502 btnAbortCase->setEnabled(false); |
|
503 |
|
504 btnShowOutput = new QPushButton(tr("Output"), startedToolWidget); |
|
505 connect(btnShowOutput, SIGNAL(clicked()), this, |
|
506 SLOT(on_actOutput_triggered())); |
|
507 btnShowOutput->setEnabled(false); |
|
508 |
|
509 |
|
510 startedToolWidgetLayout->addWidget(btnPauseCase, 0, 0); |
|
511 startedToolWidgetLayout->addWidget(btnAbortCase, 0, 1); |
|
512 startedToolWidgetLayout->addWidget(btnShowOutput, 0, 2); |
|
513 startedToolWidget->setLayout(startedToolWidgetLayout); |
|
514 |
|
515 tabStartedLayout->addWidget(lstStartedCases, 0, 0); |
|
516 tabStartedLayout->addWidget(startedToolWidget, 1, 0); |
|
517 tabStarted->setLayout(tabStartedLayout); |
|
518 |
|
519 //Tab Statistic |
|
520 QGridLayout *tabStatisticLayout = new QGridLayout(this); |
|
521 tabStatisticLayout->setVerticalSpacing(2); |
|
522 tabStatisticLayout->setHorizontalSpacing(2); |
|
523 tabStatisticLayout->setSpacing(2); |
|
524 tabStatisticLayout->setMargin(2); |
|
525 |
|
526 treeStatistic = new QTreeWidget(tabStatistic); |
|
527 treeStatistic->setContextMenuPolicy(Qt::NoContextMenu); |
|
528 treeStatistic->headerItem()->setText(0, tr("Statistics")); |
|
529 tabStatisticLayout->addWidget(treeStatistic, 0, 0); |
|
530 tabStatistic->setLayout(tabStatisticLayout); |
|
531 |
|
532 executedItems = new QTreeWidgetItem(treeStatistic); |
|
533 executedItems->setText(0, tr("Executed Cases(0)")); |
|
534 passedItems = new QTreeWidgetItem(treeStatistic); |
|
535 passedItems->setText(0, tr("Passed Cases(0)")); |
|
536 failedItems = new QTreeWidgetItem(treeStatistic); |
|
537 failedItems->setText(0, tr("Failed Cases(0)")); |
|
538 crashedItems = new QTreeWidgetItem(treeStatistic); |
|
539 crashedItems->setText(0, tr("Crashed Cases(0)")); |
|
540 abortedItems = new QTreeWidgetItem(treeStatistic); |
|
541 abortedItems->setText(0, tr("Aborted Cases(0)")); |
|
542 |
|
543 //this->repaint(); |
|
544 |
|
545 |
|
546 } |
|
547 |
|
548 |
|
549 |
|
550 void FrmMain::LoadSubMenu() |
|
551 { |
|
552 menuBar()->clear(); |
|
553 menuBar()->setContextMenuPolicy(Qt::NoContextMenu); |
|
554 if (tabWidget->currentIndex() == 0) |
|
555 { |
|
556 //Cases Tab |
|
557 menuBar()->addAction(actOpenFile); |
|
558 menuBar()->addMenu(menuRunCase); |
|
559 menuRunCase->addAction(actRunCaseSeq); |
|
560 menuRunCase->addAction(actRunCasePar); |
|
561 menuBar()->addAction(actReapeatRunSeq); |
|
562 menuBar()->addSeparator(); |
|
563 menuBar()->addAction(actAddtoSet); |
|
564 menuBar()->addSeparator(); |
|
565 menuBar()->addAction(actSelectAll); |
|
566 menuBar()->addAction(actExpandAll); |
|
567 menuBar()->addAction(actCollapseAll); |
|
568 } |
|
569 else if (tabWidget->currentIndex() == 1) |
|
570 { |
|
571 //Set Tab |
|
572 menuBar()->addMenu(menuRunSet); |
|
573 menuRunSet->addAction(actRunSetSeq); |
|
574 menuRunSet->addAction(actRunSetPar); |
|
575 menuBar()->addSeparator(); |
|
576 menuBar()->addAction(actNewSet); |
|
577 menuBar()->addAction(actDelSet); |
|
578 } |
|
579 else if (tabWidget->currentIndex() == 2) |
|
580 { |
|
581 //Started Tab |
|
582 menuBar()->addAction(actPause); |
|
583 menuBar()->addAction(actAbort); |
|
584 menuBar()->addAction(actOutput); |
|
585 |
|
586 } |
|
587 else |
|
588 { |
|
589 //Staticstic tab |
|
590 menuBar()->addAction(actClearStatistics); |
|
591 } |
|
592 menuBar()->addSeparator(); |
|
593 menuBar()->addAction(actSetting); |
|
594 menuBar()->addAction(actAbout); |
|
595 menuBar()->addAction(actExit); |
|
596 |
|
597 } |
|
598 |
|
599 void FrmMain::onTabWidgetSelectIndexChanged() |
|
600 { |
|
601 LoadSubMenu(); |
|
602 } |
|
603 |
|
604 void FrmMain::loadContent() |
|
605 { |
|
606 //Load ModuleList |
|
607 loadModuleList(); |
|
608 //Load SetList |
|
609 loadSetList(); |
|
610 //Load Statistic List |
|
611 loadStatistic(); |
|
612 } |
|
613 |
|
614 void FrmMain::loadModuleList() |
|
615 { |
|
616 treeModuleList->clear(); |
|
617 |
|
618 QList<QString> moduleList = controller->GetModuleList(); |
|
619 foreach(QString moduleName, moduleList) |
|
620 { |
|
621 QTreeWidgetItem* item = new QTreeWidgetItem(treeModuleList); |
|
622 item->setText(0, UNSELECTITEMHEADER + moduleName); |
|
623 |
|
624 QList<QString> caseList = controller->GetCaseListByModule( |
|
625 moduleName); |
|
626 |
|
627 foreach(QString caseName, caseList) |
|
628 { |
|
629 QTreeWidgetItem* caseItem = new QTreeWidgetItem(item); |
|
630 caseItem->setText(0, UNSELECTITEMHEADER + caseName); |
|
631 } |
|
632 } |
|
633 if (moduleList.size() > 0) |
|
634 { |
|
635 treeModuleList->setCurrentItem(treeModuleList->topLevelItem(0)); |
|
636 } |
|
637 } |
|
638 |
|
639 void FrmMain::reloadStatisticItem(QString name, QTreeWidgetItem* item, |
|
640 TSTFCaseStatusType type) |
|
641 { |
|
642 QList<CSTFCase> caseList = controller->GetCasesByStatus(type); |
|
643 while (item->childCount() != 0) |
|
644 { |
|
645 item->removeChild(item->child(0)); |
|
646 } |
|
647 item->setText(0, name + "(" + QString::number(caseList.size(), 10) + ")"); |
|
648 foreach(CSTFCase aCase, caseList) |
|
649 { |
|
650 QTreeWidgetItem* child = new QTreeWidgetItem(item); |
|
651 child->setText(0, aCase.Name()); |
|
652 } |
|
653 } |
|
654 |
|
655 void FrmMain::loadStatistic() |
|
656 { |
|
657 //executedItems; |
|
658 reloadStatisticItem("Executed Cases", executedItems, EStatusExecuted); |
|
659 |
|
660 //passedItems; |
|
661 reloadStatisticItem("Passed Cases", passedItems, EStatusPassed); |
|
662 |
|
663 //failedItems; |
|
664 reloadStatisticItem("Failed Cases", failedItems, EStatusFailed); |
|
665 |
|
666 //crashedItems; |
|
667 reloadStatisticItem("Crashed Cases", crashedItems, EStatusCrashed); |
|
668 |
|
669 //abortedItems; |
|
670 reloadStatisticItem("Aborted Cases", abortedItems, EStatusAborted); |
|
671 |
|
672 } |
|
673 |
|
674 void FrmMain::loadSetList() |
|
675 { |
|
676 cboSetList->clear(); |
|
677 |
|
678 QList<QString> setList = controller->GetSetList(); |
|
679 foreach(QString setName, setList) |
|
680 { |
|
681 cboSetList->addItem(setName); |
|
682 } |
|
683 // if (setList.size() > 0) |
|
684 // { |
|
685 // //cboSetList->setCurrentIndex(0); |
|
686 // on_cboSetList_currentIndexChanged(setList.at(0)); |
|
687 // } |
|
688 } |
|
689 |
|
690 QList<CSTFCase> FrmMain::getSelectedCases() |
|
691 { |
|
692 int index = 0; |
|
693 QTreeWidgetItem* item = treeModuleList->topLevelItem(index); |
|
694 QList<CSTFCase> caseList; |
|
695 while (item != 0) |
|
696 { |
|
697 for (int i = 0; i < item->childCount(); i++) |
|
698 { |
|
699 QTreeWidgetItem* child = item->child(i); |
|
700 if (child->text(0).startsWith(SELECTITEMHEADER)) |
|
701 { |
|
702 CSTFCase aCase(child->text(0).remove(0,3), i); |
|
703 aCase.SetIndex(i); |
|
704 //aCase.SetModuleName(moduleBox->text()); |
|
705 aCase.SetModuleName(item->text(0).remove(0,3)); |
|
706 caseList.append(aCase); |
|
707 } |
|
708 } |
|
709 index++; |
|
710 item = treeModuleList->topLevelItem(index); |
|
711 } |
|
712 return caseList; |
|
713 } |
|
714 |
|
715 void FrmMain::on_cboSetList_currentIndexChanged(QString item) |
|
716 { |
|
717 lstSetCases->clear(); |
|
718 QList<QString> list = controller->GetCaseListBySet(item); |
|
719 foreach(QString caseName, list) |
|
720 { |
|
721 lstSetCases->addItem(caseName); |
|
722 } |
|
723 } |
|
724 |
|
725 void FrmMain::startRunning() |
|
726 { |
|
727 setSetting(); |
|
728 tabWidget->setCurrentWidget(tabStarted); |
|
729 } |
|
730 |
|
731 void FrmMain::on_actRunCaseSeq_triggered() |
|
732 { |
|
733 //run case seq |
|
734 startRunning(); |
|
735 controller->RunCases(getSelectedCases(), Sequentially); |
|
736 } |
|
737 |
|
738 void FrmMain::on_actRunCasePar_triggered() |
|
739 { |
|
740 startRunning(); |
|
741 controller->RunCases(getSelectedCases(), Parallel); |
|
742 } |
|
743 |
|
744 void FrmMain::on_actReapeatRunSeq_triggered() |
|
745 { |
|
746 DlgRepeatRun dlgRepeatRun(this); |
|
747 int result = dlgRepeatRun.exec(); |
|
748 if(result == QDialog::Accepted) |
|
749 { |
|
750 QList<CSTFCase> selectedCases = getSelectedCases(); |
|
751 if(selectedCases.count() > 0) |
|
752 { |
|
753 startRunning(); |
|
754 controller->RepeatRunCases( selectedCases, |
|
755 dlgRepeatRun.isRepeatInfinitely(), |
|
756 dlgRepeatRun.GetLoopTimes() ); |
|
757 } |
|
758 |
|
759 } |
|
760 } |
|
761 |
|
762 void FrmMain::on_actAddtoSet_triggered() |
|
763 { |
|
764 QList<CSTFCase> list = getSelectedCases(); |
|
765 if (list.size() == 0) |
|
766 { |
|
767 QErrorMessage *errorMessageDialog = new QErrorMessage(this); |
|
768 errorMessageDialog->setAutoFillBackground(true); |
|
769 errorMessageDialog->showMessage(tr( |
|
770 "<font color =black>Please select cases you want to added to set.</font>")); |
|
771 return; |
|
772 } |
|
773 |
|
774 QList<QString> setList = controller->GetSetList(); |
|
775 |
|
776 DlgSetSelector dlgSet(setList, this); |
|
777 int result = dlgSet.exec(); |
|
778 QString setName; |
|
779 if(result == QDialog::Accepted) |
|
780 { |
|
781 setName = dlgSet.SelectName(); |
|
782 } |
|
783 else |
|
784 { |
|
785 return; |
|
786 } |
|
787 bool rst = false; |
|
788 if(setName == "") |
|
789 { |
|
790 setName = "temp.set"; |
|
791 rst = controller->CreateSet(setName); |
|
792 if(!rst) |
|
793 { |
|
794 return; |
|
795 } |
|
796 } |
|
797 controller->AddCaseToSet(list, setName); |
|
798 // |
|
799 // bool ok; |
|
800 // QString setName = QInputDialog::getItem(this, tr( |
|
801 // "\r\nAdd select cases to Set"), tr("\r\n\r\nSets:"), setList, 0, false, &ok, Qt::Dialog); |
|
802 // if (ok && !setName.isEmpty()) |
|
803 // { |
|
804 // if(setName == newSet) |
|
805 // { |
|
806 // ok = controller->CreateSet(setName); |
|
807 // if(!ok) |
|
808 // { |
|
809 // return; |
|
810 // } |
|
811 // } |
|
812 // controller->AddCaseToSet(list, setName); |
|
813 // } |
|
814 tabWidget->setCurrentIndex(1); |
|
815 int index = -1; |
|
816 for(int i=0;i<cboSetList->count();i++) |
|
817 { |
|
818 if(cboSetList->itemText(i) == setName) |
|
819 { |
|
820 index = i; |
|
821 break; |
|
822 } |
|
823 } |
|
824 if(index != -1) |
|
825 { |
|
826 cboSetList->setCurrentIndex(index); |
|
827 } |
|
828 |
|
829 |
|
830 } |
|
831 |
|
832 void FrmMain::on_actSelectAll_triggered() |
|
833 { |
|
834 QString header = UNSELECTITEMHEADER; |
|
835 if(actSelectAll->text() == "Select All") |
|
836 { |
|
837 actSelectAll->setText("UnSelect All"); |
|
838 header = SELECTITEMHEADER; |
|
839 } |
|
840 else |
|
841 { |
|
842 actSelectAll->setText("Select All"); |
|
843 } |
|
844 |
|
845 int index = 0; |
|
846 QTreeWidgetItem* item = treeModuleList->topLevelItem(index); |
|
847 while (item != 0) |
|
848 { |
|
849 if(!item->isHidden()) |
|
850 item->setText(0, item->text(0).replace(0,3, header)); |
|
851 for (int i = 0; i < item->childCount(); i++) |
|
852 { |
|
853 QTreeWidgetItem* child = item->child(i); |
|
854 if(!child->isHidden()) |
|
855 child->setText(0,child->text(0).replace(0,3,header)); |
|
856 } |
|
857 index++; |
|
858 item = treeModuleList->topLevelItem(index); |
|
859 } |
|
860 } |
|
861 |
|
862 void FrmMain::on_actExpandAll_triggered() |
|
863 { |
|
864 QTreeWidgetItem* item = treeModuleList->currentItem(); |
|
865 treeModuleList->expandAll(); |
|
866 if(item != NULL) |
|
867 { |
|
868 treeModuleList->setCurrentItem(item); |
|
869 } |
|
870 |
|
871 } |
|
872 |
|
873 void FrmMain::on_actCollapseAll_triggered() |
|
874 { |
|
875 QTreeWidgetItem* item = treeModuleList->currentItem(); |
|
876 if(item != NULL) |
|
877 { |
|
878 if(item->parent() != NULL) |
|
879 { |
|
880 item = item->parent(); |
|
881 } |
|
882 } |
|
883 treeModuleList->collapseAll(); |
|
884 if(item != NULL) |
|
885 { |
|
886 treeModuleList->setCurrentItem(item); |
|
887 } |
|
888 |
|
889 } |
|
890 |
|
891 void FrmMain::on_actSetting_triggered() |
|
892 { |
|
893 DlgSetting dlgSet(uiSetting); |
|
894 currentFilter = uiSetting->ReadSetting(KFilter); |
|
895 currentFilterCaseSens = uiSetting->ReadSetting(KFilterCaseSens); |
|
896 int result = dlgSet.exec(); |
|
897 if(result == QDialog::Accepted) |
|
898 { |
|
899 setSetting(); |
|
900 } |
|
901 } |
|
902 |
|
903 void FrmMain::on_actRunSetSeq_triggered() |
|
904 { |
|
905 startRunning(); |
|
906 QString setName = cboSetList->currentText(); |
|
907 controller->RunSets(setName, Sequentially); |
|
908 } |
|
909 |
|
910 void FrmMain::on_actRunSetPar_triggered() |
|
911 { |
|
912 startRunning(); |
|
913 QString setName = cboSetList->currentText(); |
|
914 controller->RunSets(setName, Parallel); |
|
915 } |
|
916 |
|
917 void FrmMain::on_actNewSet_triggered() |
|
918 { |
|
919 QString name; |
|
920 bool rst = controller->CreateSet(name); |
|
921 if(rst) |
|
922 { |
|
923 QMessageBox::information(this, |
|
924 tr("Create Set Successfully"), |
|
925 "Create a new test set, named: " + name); |
|
926 |
|
927 int index = -1; |
|
928 for(int i=0;i<cboSetList->count();i++) |
|
929 { |
|
930 if(cboSetList->itemText(i) == name) |
|
931 { |
|
932 index = i; |
|
933 break; |
|
934 } |
|
935 } |
|
936 if(index != -1) |
|
937 { |
|
938 cboSetList->setCurrentIndex(index); |
|
939 } |
|
940 |
|
941 |
|
942 } |
|
943 else |
|
944 { |
|
945 QMessageBox::information(this, |
|
946 tr("Create Set Failed"), |
|
947 tr("Please check the log for more information.")); |
|
948 |
|
949 } |
|
950 |
|
951 } |
|
952 |
|
953 void FrmMain::on_actDelSet_triggered() |
|
954 { |
|
955 QString setName = cboSetList->currentText(); |
|
956 QMessageBox msgBox(QMessageBox::Warning, tr("Delete a Set"), tr( |
|
957 "Do you really want to delete the set?"), 0, this); |
|
958 msgBox.addButton(tr("&Delete"), QMessageBox::AcceptRole); |
|
959 msgBox.addButton(tr("&Cancel"), QMessageBox::RejectRole); |
|
960 if (msgBox.exec() == QMessageBox::AcceptRole) |
|
961 { |
|
962 controller->DeleteSet(setName); |
|
963 } |
|
964 |
|
965 } |
|
966 |
|
967 void FrmMain::on_actPause_triggered() |
|
968 { |
|
969 if (btnPauseCase->text() == "Pause") |
|
970 { |
|
971 controller->PauseCase(); |
|
972 btnPauseCase->setText(tr("Resume")); |
|
973 actPause->setText(tr("Resume")); |
|
974 } |
|
975 else |
|
976 { |
|
977 controller->ResumeCase(); |
|
978 btnPauseCase->setText(tr("Pause")); |
|
979 actPause->setText(tr("Pause")); |
|
980 } |
|
981 } |
|
982 |
|
983 void FrmMain::on_actAbort_triggered() |
|
984 { |
|
985 controller->AbortCase(); |
|
986 } |
|
987 |
|
988 void FrmMain::on_treeModuleList_itemClicked(QTreeWidgetItem* item, int /*column*/) |
|
989 { |
|
990 //Check if shift key is pressed |
|
991 bool isShiftPressed = false; |
|
992 Qt::KeyboardModifiers keyMod = QApplication::keyboardModifiers(); |
|
993 isShiftPressed=keyMod.testFlag(Qt::ShiftModifier); |
|
994 |
|
995 //Handle shift key. |
|
996 //Shift not pressed. |
|
997 if(!isShiftPressed) |
|
998 { |
|
999 setItemClicked(item); |
|
1000 } |
|
1001 //Shift pressed. |
|
1002 else |
|
1003 { |
|
1004 enum Direction |
|
1005 { |
|
1006 Item_NoDirection, |
|
1007 Item_Above, |
|
1008 Item_Below |
|
1009 }; |
|
1010 Direction direction = Item_NoDirection; |
|
1011 QTreeWidgetItem* tempItem = item; |
|
1012 //check direction of last selected item comparing current one. |
|
1013 while(tempItem) |
|
1014 { |
|
1015 tempItem = treeModuleList->itemAbove(tempItem); |
|
1016 if(tempItem == lastItemSelected) |
|
1017 { |
|
1018 direction = Item_Above; |
|
1019 break; |
|
1020 } |
|
1021 } |
|
1022 if (direction != Item_Above) |
|
1023 { |
|
1024 tempItem = item; |
|
1025 while(tempItem) |
|
1026 { |
|
1027 tempItem = treeModuleList->itemBelow(tempItem); |
|
1028 if(tempItem == lastItemSelected) |
|
1029 { |
|
1030 direction = Item_Below; |
|
1031 break; |
|
1032 } |
|
1033 } |
|
1034 } |
|
1035 |
|
1036 // Select all items between current item and last selected item. |
|
1037 tempItem = item; |
|
1038 if(direction != Item_NoDirection) |
|
1039 { |
|
1040 while(tempItem) |
|
1041 { |
|
1042 //check if this item been selected. |
|
1043 bool isItemSelected = false; |
|
1044 if ( tempItem->text(0).left(3).compare(SELECTITEMHEADER)==0 ) |
|
1045 { |
|
1046 isItemSelected = true; |
|
1047 } |
|
1048 // If not selected, set to selected. |
|
1049 if (!isItemSelected ) |
|
1050 { |
|
1051 setItemClicked(tempItem); |
|
1052 } |
|
1053 |
|
1054 //Go above/below |
|
1055 if (direction == Item_Above) |
|
1056 { |
|
1057 tempItem = treeModuleList->itemAbove(tempItem); |
|
1058 } |
|
1059 if (direction == Item_Below) |
|
1060 { |
|
1061 tempItem = treeModuleList->itemBelow(tempItem); |
|
1062 } |
|
1063 |
|
1064 if (tempItem == lastItemSelected) |
|
1065 { |
|
1066 break; |
|
1067 } |
|
1068 } |
|
1069 } |
|
1070 } |
|
1071 |
|
1072 // Set current clicked item to last selected item. |
|
1073 lastItemSelected = item; |
|
1074 |
|
1075 |
|
1076 } |
|
1077 |
|
1078 void FrmMain::setItemClicked(QTreeWidgetItem* item) |
|
1079 { |
|
1080 QString header = UNSELECTITEMHEADER; |
|
1081 if(item->text(0).startsWith(UNSELECTITEMHEADER)) |
|
1082 { |
|
1083 header = SELECTITEMHEADER; |
|
1084 } |
|
1085 item->setText(0 , item->text(0).replace(0, 3, header)); |
|
1086 for(int i=0;i<item->childCount();i++) |
|
1087 { |
|
1088 item->child(i)->setText(0, item->child(i)->text(0).replace(0, 3, header)); |
|
1089 } |
|
1090 } |
|
1091 |
|
1092 void FrmMain::on_actAbout_triggered() |
|
1093 { |
|
1094 QString str = QtUIName + "< >" + QtUIVersion; |
|
1095 str.append("<br>").append("engine version:"); |
|
1096 |
|
1097 str.append(QString::number(STIF_MAJOR_VERSION, 10)).append("."); |
|
1098 str.append(QString::number(STIF_MINOR_VERSION, 10)).append("."); |
|
1099 str.append(QString::number(STIF_BUILD_VERSION, 10)); |
|
1100 str.append(" --").append(STIF_REL_DATE).append("<br>"); |
|
1101 str.append("---"); |
|
1102 str.append("Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. "); |
|
1103 |
|
1104 QErrorMessage *errorMessageDialog = new QErrorMessage(this); |
|
1105 errorMessageDialog->showMessage("<font color =black size=12px><b>" + str + "</b></font>"); |
|
1106 |
|
1107 } |
|
1108 |
|
1109 void FrmMain::on_actOpenFile_triggered() |
|
1110 { |
|
1111 QString fileName = QFileDialog::getOpenFileName(this, tr( |
|
1112 "Select ini file"), tr("c:\\"), tr( |
|
1113 "Ini Files (*.ini);;All Files (*)")); |
|
1114 if (!fileName.isEmpty()) |
|
1115 { |
|
1116 bool result = controller->OpenEngineIniFile(fileName); |
|
1117 if(result) |
|
1118 { |
|
1119 this->loadModuleList(); |
|
1120 QMessageBox::information(this, tr("Open INI File"), "Load Engine INI file successfully!"); |
|
1121 } |
|
1122 else |
|
1123 { |
|
1124 QMessageBox::warning(this, tr("Open INI File"),"Failed to Load Engine INI file. Please check the file format and its path."); |
|
1125 } |
|
1126 |
|
1127 } |
|
1128 } |
|
1129 |
|
1130 void FrmMain::on_actClearStatistics_triggered() |
|
1131 { |
|
1132 model->ClearCasesStatus(); |
|
1133 } |
|
1134 |
|
1135 |
|
1136 void FrmMain::on_actExpand_triggered() |
|
1137 { |
|
1138 QTreeWidgetItem* item = treeModuleList->currentItem(); |
|
1139 if(item != NULL) |
|
1140 { |
|
1141 item->setExpanded(true); |
|
1142 } |
|
1143 } |
|
1144 |
|
1145 void FrmMain::on_actCollapse_triggered() |
|
1146 { |
|
1147 |
|
1148 QTreeWidgetItem* item = treeModuleList->currentItem(); |
|
1149 if(item != NULL) |
|
1150 { |
|
1151 item->setExpanded(false); |
|
1152 } |
|
1153 } |
|
1154 |
|
1155 void FrmMain::on_actOutput_triggered() |
|
1156 { |
|
1157 controller->SetShowOutput(true); |
|
1158 } |
|
1159 |
|
1160 // End of File |