18 #include <QtGui> |
18 #include <QtGui> |
19 |
19 |
20 DlgOutput::DlgOutput(IStfQtUIController* ctl, QWidget *parent) : |
20 DlgOutput::DlgOutput(IStfQtUIController* ctl, QWidget *parent) : |
21 QDialog(parent), controller(ctl) |
21 QDialog(parent), controller(ctl) |
22 { |
22 { |
23 QSize btnSize(100,30); |
|
24 QGridLayout *mainLayout = new QGridLayout(this); |
23 QGridLayout *mainLayout = new QGridLayout(this); |
25 this->setLayout(mainLayout); |
24 this->setLayout(mainLayout); |
26 this->setContextMenuPolicy(Qt::NoContextMenu); |
25 this->setContextMenuPolicy(Qt::NoContextMenu); |
27 |
26 |
28 tabMain = new QTabWidget(); |
27 tabMain = new QTabWidget(this); |
29 tabMain->setContextMenuPolicy(Qt::NoContextMenu); |
28 tabMain->setContextMenuPolicy(Qt::NoContextMenu); |
30 |
29 |
31 QWidget *toolWidget = new QWidget(this); |
30 QWidget *toolWidget = new QWidget(this); |
32 toolWidget->setContextMenuPolicy(Qt::NoContextMenu); |
31 toolWidget->setContextMenuPolicy(Qt::NoContextMenu); |
33 QGridLayout *toolLayout = new QGridLayout(); |
32 QGridLayout *toolLayout = new QGridLayout(this); |
34 toolWidget->setLayout(toolLayout); |
33 toolWidget->setLayout(toolLayout); |
35 btnPause = new QPushButton(tr("Pause"), toolWidget); |
34 btnPause = new QPushButton(tr("Pause"), toolWidget); |
36 btnPause->setContextMenuPolicy(Qt::NoContextMenu); |
35 btnPause->setContextMenuPolicy(Qt::NoContextMenu); |
37 btnPause->setFixedSize(btnSize); |
|
38 QObject::connect(btnPause, SIGNAL(clicked()), this, |
36 QObject::connect(btnPause, SIGNAL(clicked()), this, |
39 SLOT(on_btnPause_clicked())); |
37 SLOT(on_btnPause_clicked())); |
40 btnAbort = new QPushButton(tr("Abort"), toolWidget); |
38 btnAbort = new QPushButton(tr("Abort"), toolWidget); |
41 btnAbort->setContextMenuPolicy(Qt::NoContextMenu); |
39 btnAbort->setContextMenuPolicy(Qt::NoContextMenu); |
42 btnAbort->setFixedSize(btnSize); |
|
43 QObject::connect(btnAbort, SIGNAL(clicked()), this, |
40 QObject::connect(btnAbort, SIGNAL(clicked()), this, |
44 SLOT(on_btnAbort_clicked())); |
41 SLOT(on_btnAbort_clicked())); |
|
42 |
|
43 btnClose = new QPushButton(tr("Hide"), toolWidget); |
|
44 btnClose->setContextMenuPolicy(Qt::NoContextMenu); |
|
45 QObject::connect(btnClose, SIGNAL(clicked()), this, |
|
46 SLOT(on_btnClose_clicked())); |
45 toolLayout->addWidget(btnPause, 0, 0); |
47 toolLayout->addWidget(btnPause, 0, 0); |
46 toolLayout->addWidget(btnAbort, 0, 1); |
48 toolLayout->addWidget(btnAbort, 0, 1); |
|
49 toolLayout->addWidget(btnClose, 0, 2); |
|
50 |
47 |
51 |
48 mainLayout->addWidget(toolWidget, 0, 0); |
52 mainLayout->addWidget(toolWidget, 0, 0); |
49 mainLayout->addWidget(tabMain, 1, 0); |
53 mainLayout->addWidget(tabMain, 1, 0); |
50 controller->AddStfEventListener(this); |
54 controller->AddStfEventListener(this); |
51 } |
55 } |
99 void DlgOutput::on_btnAbort_clicked() |
111 void DlgOutput::on_btnAbort_clicked() |
100 { |
112 { |
101 controller->AbortCase(); |
113 controller->AbortCase(); |
102 } |
114 } |
103 |
115 |
|
116 void DlgOutput::on_btnClose_clicked() |
|
117 { |
|
118 controller->SetShowOutput(false); |
|
119 this->close(); |
|
120 } |
|
121 |
104 void DlgOutput::OnCaseOutputChanged(const IStfEventListener::CaseOutputCommand& cmd, |
122 void DlgOutput::OnCaseOutputChanged(const IStfEventListener::CaseOutputCommand& cmd, |
105 const QString& index, const QString& msg) |
123 const QString& index, const QString& msg) |
106 { |
124 { |
107 this->showMaximized(); |
125 if(controller->ShowOutput() && this->isVisible() == false) |
|
126 { |
|
127 this->showMaximized(); |
|
128 } |
108 switch (cmd) |
129 switch (cmd) |
109 { |
130 { |
110 case IStfEventListener::ECreate: |
131 case IStfEventListener::ECreate: |
111 CreateItem(index, msg); |
132 CreateItem(index, msg); |
112 break; |
133 break; |