void OutputPane::tabChanged(int i) { if (i == -1) { m_stopAction->setEnabled(false); m_reRunButton->setEnabled(false); } else { RunControl *rc = runControlForTab(i); m_stopAction->setEnabled(rc->isRunning()); m_reRunButton->setEnabled(!rc->isRunning()); } }
void OutputPane::createNewOutputWindow(RunControl *rc) { connect(rc, SIGNAL(started()), this, SLOT(runControlStarted())); connect(rc, SIGNAL(finished()), this, SLOT(runControlFinished())); // First look if we can reuse a tab bool found = false; for (int i = 0; i < m_tabWidget->count(); ++i) { RunControl *old = runControlForTab(i); if (old->sameRunConfiguration(rc) && !old->isRunning()) { // Reuse this tab delete old; m_outputWindows.remove(old); OutputWindow *ow = static_cast<OutputWindow *>(m_tabWidget->widget(i)); ow->grayOutOldContent(); ow->verticalScrollBar()->setValue(ow->verticalScrollBar()->maximum()); ow->setFormatter(rc->createOutputFormatter(ow)); m_outputWindows.insert(rc, ow); found = true; break; } } if (!found) { OutputWindow *ow = new OutputWindow(m_tabWidget); ow->setFormatter(rc->createOutputFormatter(ow)); Aggregation::Aggregate *agg = new Aggregation::Aggregate; agg->add(ow); agg->add(new Find::BaseTextFind(ow)); m_outputWindows.insert(rc, ow); m_tabWidget->addTab(ow, rc->displayName()); } }
void OutputPane::closeTab(int index) { OutputWindow *ow = static_cast<OutputWindow *>(m_tabWidget->widget(index)); RunControl *rc = m_outputWindows.key(ow); if (rc->isRunning()) { QMessageBox messageBox(QMessageBox::Warning, tr("Unable to close"), tr("The application is still running."), QMessageBox::Cancel | QMessageBox::Yes, ow->window()); messageBox.setInformativeText(tr("Force it to quit?")); messageBox.setDefaultButton(QMessageBox::Yes); messageBox.button(QMessageBox::Yes)->setText(tr("Force Quit")); if (messageBox.exec() != QMessageBox::Yes) return; rc->stop(); } m_tabWidget->removeTab(index); delete ow; delete rc; }
void OutputPane::coreAboutToClose() { while (m_tabWidget->count()) { RunControl *rc = runControlForTab(0); if (rc->isRunning()) rc->stop(); closeTab(0); } }