stifui/qt/src/dlgoutput.cpp
branchRCL_3
changeset 12 aefcba28a3e0
parent 9 404ad6c9bc20
child 19 d40e813b23c0
--- a/stifui/qt/src/dlgoutput.cpp	Tue May 11 16:14:15 2010 +0300
+++ b/stifui/qt/src/dlgoutput.cpp	Tue May 25 12:43:15 2010 +0300
@@ -20,30 +20,34 @@
 DlgOutput::DlgOutput(IStfQtUIController* ctl, QWidget *parent) :
     QDialog(parent), controller(ctl)
     {
-    QSize btnSize(100,30);
     QGridLayout *mainLayout = new QGridLayout(this);
     this->setLayout(mainLayout);
     this->setContextMenuPolicy(Qt::NoContextMenu);
 
-    tabMain = new QTabWidget();
+    tabMain = new QTabWidget(this);
     tabMain->setContextMenuPolicy(Qt::NoContextMenu);
 
     QWidget *toolWidget = new QWidget(this);
     toolWidget->setContextMenuPolicy(Qt::NoContextMenu);
-    QGridLayout *toolLayout = new QGridLayout();
+    QGridLayout *toolLayout = new QGridLayout(this);
     toolWidget->setLayout(toolLayout);
     btnPause = new QPushButton(tr("Pause"), toolWidget);
     btnPause->setContextMenuPolicy(Qt::NoContextMenu);
-    btnPause->setFixedSize(btnSize);
     QObject::connect(btnPause, SIGNAL(clicked()), this,
             SLOT(on_btnPause_clicked()));
     btnAbort = new QPushButton(tr("Abort"), toolWidget);
     btnAbort->setContextMenuPolicy(Qt::NoContextMenu);
-    btnAbort->setFixedSize(btnSize);
     QObject::connect(btnAbort, SIGNAL(clicked()), this,
             SLOT(on_btnAbort_clicked()));
+    
+    btnClose = new QPushButton(tr("Hide"), toolWidget);
+    btnClose->setContextMenuPolicy(Qt::NoContextMenu);
+    QObject::connect(btnClose, SIGNAL(clicked()), this,
+            SLOT(on_btnClose_clicked()));
     toolLayout->addWidget(btnPause, 0, 0);
     toolLayout->addWidget(btnAbort, 0, 1);
+    toolLayout->addWidget(btnClose, 0, 2);
+        
 
     mainLayout->addWidget(toolWidget, 0, 0);
     mainLayout->addWidget(tabMain, 1, 0);
@@ -66,8 +70,9 @@
 void DlgOutput::CloseItem(QString index)
     {
     int u = tabList.keys().indexOf(index);
+    
+    delete tabList.value(index);
     tabList.remove(index);
-    tabMain->removeTab(u);
     if (tabMain->count() == 0)
         {
         this->close();
@@ -80,6 +85,13 @@
         {
         tabList.value(index)->setPlainText(msg);    
         }
+    else
+        {
+//        bool ok;
+//        CSTFCase acase = controller->GetRunningCase(index.toInt(&ok, 10));
+//        CreateItem(index, acase.Name());
+//        ShowMessage(index, msg);
+        }
     }
 
 void DlgOutput::on_btnPause_clicked()
@@ -101,10 +113,19 @@
     controller->AbortCase();
     }
 
+void DlgOutput::on_btnClose_clicked()
+    {
+    controller->SetShowOutput(false);
+    this->close();
+    }
+
 void DlgOutput::OnCaseOutputChanged(const IStfEventListener::CaseOutputCommand& cmd,
         const QString& index, const QString& msg)
     {
-    this->showMaximized();
+    if(controller->ShowOutput() && this->isVisible() == false)
+        {
+        this->showMaximized();
+        }
     switch (cmd)
         {
         case IStfEventListener::ECreate: