+}
+
+void MainWindow::slotErrorSelected(QTreeWidgetItem *current)
+{
+ if (current) {
+ ApiTraceCall *call =
+ current->data(0, Qt::UserRole).value<ApiTraceCall*>();
+ Q_ASSERT(call);
+ QModelIndex index = m_proxyModel->indexForCall(call);
+ if (index.isValid()) {
+ m_ui.callView->setCurrentIndex(index);
+ } else {
+ statusBar()->showMessage(tr("Call has been filtered out."));
+ }
+ }
+}
+
+ApiTraceCall * MainWindow::currentCall() const
+{
+ if (m_selectedEvent &&
+ m_selectedEvent->type() == ApiTraceEvent::Call) {
+ return static_cast<ApiTraceCall*>(m_selectedEvent);
+ }
+ return NULL;
+}
+
+void MainWindow::saveSelectedSurface()
+{
+ QTreeWidgetItem *item =
+ m_ui.surfacesTreeWidget->currentItem();
+
+ if (!item || !m_trace)
+ return;
+
+ QVariant var = item->data(0, Qt::UserRole);
+ QImage img = var.value<QImage>();
+
+ QString imageIndex;
+ if (currentCall()) {
+ imageIndex = tr("_call_%1")
+ .arg(currentCall()->index());
+ } else if (currentFrame()) {
+ ApiTraceCall *firstCall = currentFrame()->call(0);
+ if (firstCall) {
+ imageIndex = tr("_frame_%1")
+ .arg(firstCall->index());
+ } else {
+ qDebug()<<"unknown frame number";
+ imageIndex = tr("_frame_%1")
+ .arg(firstCall->index());
+ }
+ }