X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=gui%2Fmainwindow.cpp;h=00469bca3d9f67450daa196472ef4a7302eeed53;hb=66ce10aed5cd8c4b1df5b53645b92ee81b16d8e2;hp=caf9e370236ebed41d8aa29409cc3e253b1457a4;hpb=e7cb2b98575d5ff3801bd3527a648e0dbfdebdad;p=apitrace diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index caf9e37..00469bc 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -48,6 +48,7 @@ MainWindow::MainWindow() m_nonDefaultsLookupEvent(0) { m_ui.setupUi(this); + updateActionsState(false); initObjects(); initConnections(); } @@ -108,6 +109,11 @@ void MainWindow::loadTrace(const QString &fileName, int callNum) newTraceFile(fileName); } +void MainWindow::setRemoteTarget(const QString &host) +{ + m_retracer->setRemoteTarget(host); +} + void MainWindow::callItemSelected(const QModelIndex &index) { ApiTraceEvent *event = @@ -144,6 +150,8 @@ void MainWindow::callItemSelected(const QModelIndex &index) } } } + m_ui.backtraceBrowser->setText(call->backtrace()); + m_ui.backtraceDock->setVisible(!call->backtrace().isNull()); m_ui.vertexDataDock->setVisible(call->hasBinaryData()); m_selectedEvent = call; } else { @@ -153,6 +161,7 @@ void MainWindow::callItemSelected(const QModelIndex &index) m_selectedEvent = 0; } m_ui.detailsDock->hide(); + m_ui.backtraceDock->hide(); m_ui.vertexDataDock->hide(); } if (m_selectedEvent && m_selectedEvent->hasState()) { @@ -187,6 +196,9 @@ void MainWindow::replayStart() dlgUi.errorCheckCB->setChecked( !m_retracer->isBenchmarking()); + dlgUi.singlethreadCB->setChecked( + m_retracer->isSinglethread()); + if (dlg.exec() == QDialog::Accepted) { m_retracer->setDoubleBuffered( dlgUi.doubleBufferingCB->isChecked()); @@ -194,6 +206,9 @@ void MainWindow::replayStart() m_retracer->setBenchmarking( !dlgUi.errorCheckCB->isChecked()); + m_retracer->setSinglethread( + dlgUi.singlethreadCB->isChecked()); + m_retracer->setProfiling(false, false, false); replayTrace(false, false); @@ -228,11 +243,7 @@ void MainWindow::replayProfile() void MainWindow::replayStop() { m_retracer->quit(); - m_ui.actionStop->setEnabled(false); - m_ui.actionReplay->setEnabled(true); - m_ui.actionProfile->setEnabled(true); - m_ui.actionLookupState->setEnabled(true); - m_ui.actionShowThumbnails->setEnabled(true); + updateActionsState(true, true); } void MainWindow::newTraceFile(const QString &fileName) @@ -243,18 +254,11 @@ void MainWindow::newTraceFile(const QString &fileName) m_trace->setFileName(fileName); if (fileName.isEmpty()) { - m_ui.actionReplay->setEnabled(false); - m_ui.actionProfile->setEnabled(false); - m_ui.actionLookupState->setEnabled(false); - m_ui.actionShowThumbnails->setEnabled(false); + updateActionsState(false); setWindowTitle(tr("QApiTrace")); } else { + updateActionsState(true); QFileInfo info(fileName); - m_ui.actionReplay->setEnabled(true); - m_ui.actionProfile->setEnabled(true); - m_ui.actionLookupState->setEnabled(true); - m_ui.actionShowThumbnails->setEnabled(true); - m_ui.actionTrim->setEnabled(true); setWindowTitle( tr("QApiTrace - %1").arg(info.fileName())); } @@ -262,12 +266,7 @@ void MainWindow::newTraceFile(const QString &fileName) void MainWindow::replayFinished(const QString &message) { - m_ui.actionStop->setEnabled(false); - m_ui.actionReplay->setEnabled(true); - m_ui.actionProfile->setEnabled(true); - m_ui.actionLookupState->setEnabled(true); - m_ui.actionShowThumbnails->setEnabled(true); - + updateActionsState(true); m_progressBar->hide(); statusBar()->showMessage(message, 2000); m_stateEvent = 0; @@ -280,11 +279,7 @@ void MainWindow::replayFinished(const QString &message) void MainWindow::replayError(const QString &message) { - m_ui.actionStop->setEnabled(false); - m_ui.actionReplay->setEnabled(true); - m_ui.actionProfile->setEnabled(true); - m_ui.actionLookupState->setEnabled(true); - m_ui.actionShowThumbnails->setEnabled(true); + updateActionsState(true); m_stateEvent = 0; m_nonDefaultsLookupEvent = 0; @@ -375,8 +370,11 @@ void MainWindow::replayTrace(bool dumpState, bool dumpThumbnails) void MainWindow::trimEvent() { + int trimIndex = 0; + + Q_ASSERT(m_trimEvent->type() == ApiTraceEvent::Call || + m_trimEvent->type() == ApiTraceEvent::Frame); - int trimIndex; if (m_trimEvent->type() == ApiTraceEvent::Call) { ApiTraceCall *call = static_cast(m_trimEvent); trimIndex = call->index(); @@ -776,6 +774,7 @@ void MainWindow::initObjects() m_argsEditor = new ArgumentsEditor(this); m_ui.detailsDock->hide(); + m_ui.backtraceDock->hide(); m_ui.errorsDock->hide(); m_ui.vertexDataDock->hide(); m_ui.stateDock->hide(); @@ -783,6 +782,7 @@ void MainWindow::initObjects() tabifyDockWidget(m_ui.stateDock, m_ui.vertexDataDock); tabifyDockWidget(m_ui.detailsDock, m_ui.errorsDock); + tabifyDockWidget(m_ui.detailsDock, m_ui.backtraceDock); m_ui.surfacesTreeWidget->setContextMenuPolicy(Qt::CustomContextMenu); @@ -936,6 +936,47 @@ void MainWindow::initConnections() this, SLOT(slotJumpTo(int))); } +void MainWindow::updateActionsState(bool traceLoaded, bool stopped) +{ + if (traceLoaded) { + /* Edit */ + m_ui.actionFind ->setEnabled(true); + m_ui.actionGo ->setEnabled(true); + m_ui.actionGoFrameStart ->setEnabled(true); + m_ui.actionGoFrameEnd ->setEnabled(true); + + /* Trace */ + if (stopped) { + m_ui.actionStop->setEnabled(false); + m_ui.actionReplay->setEnabled(true); + } + else { + m_ui.actionStop->setEnabled(true); + m_ui.actionReplay->setEnabled(false); + } + + m_ui.actionProfile ->setEnabled(true); + m_ui.actionLookupState ->setEnabled(true); + m_ui.actionShowThumbnails->setEnabled(true); + m_ui.actionTrim ->setEnabled(true); + } + else { + /* Edit */ + m_ui.actionFind ->setEnabled(false); + m_ui.actionGo ->setEnabled(false); + m_ui.actionGoFrameStart ->setEnabled(false); + m_ui.actionGoFrameEnd ->setEnabled(false); + + /* Trace */ + m_ui.actionReplay ->setEnabled(false); + m_ui.actionProfile ->setEnabled(false); + m_ui.actionStop ->setEnabled(false); + m_ui.actionLookupState ->setEnabled(false); + m_ui.actionShowThumbnails->setEnabled(false); + m_ui.actionTrim ->setEnabled(false); + } +} + void MainWindow::closeEvent(QCloseEvent * event) { m_profileDialog->close();