]> git.cworth.org Git - apitrace/blobdiff - gui/mainwindow.cpp
Encode format as a member and not part of the label.
[apitrace] / gui / mainwindow.cpp
index 8d7af8a0a1f4a5c24041f7a511e0c1930f1c06b6..6e3e8a3c064a9425a071737fb19a5cbd86de3a1c 100644 (file)
@@ -97,6 +97,10 @@ void MainWindow::callItemSelected(const QModelIndex &index)
 
     if (event && event->type() == ApiTraceEvent::Call) {
         ApiTraceCall *call = static_cast<ApiTraceCall*>(event);
+        m_ui.detailsDock->setWindowTitle(
+            tr("Details View. Frame %1, Call %2")
+            .arg(call->parentFrame() ? call->parentFrame()->number : 0)
+            .arg(call->index()));
         m_ui.detailsWebView->setHtml(call->toHtml());
         m_ui.detailsDock->show();
         if (call->hasBinaryData()) {
@@ -458,8 +462,9 @@ static void addSurfaceItem(const ApiSurface &surface,
     int width = surface.size().width();
     int height = surface.size().height();
     QString descr =
-        QString::fromLatin1("%1, %2 x %3")
+        QString::fromLatin1("%1, %2, %3 x %4")
         .arg(label)
+        .arg(surface.formatName())
         .arg(width)
         .arg(height);
 
@@ -618,9 +623,6 @@ void MainWindow::showSelectedSurface()
     QImage img = var.value<QImage>();
     viewer->setImage(img);
 
-    QRect screenRect = QApplication::desktop()->availableGeometry();
-    viewer->resize(qMin(int(0.75 * screenRect.width()), img.width()) + 40,
-                   qMin(int(0.75 * screenRect.height()), img.height()) + 40);
     viewer->show();
     viewer->raise();
     viewer->activateWindow();
@@ -708,8 +710,8 @@ void MainWindow::initConnections()
             this, SLOT(slotSaved()));
     connect(m_trace, SIGNAL(changed(ApiTraceCall*)),
             this, SLOT(slotTraceChanged(ApiTraceCall*)));
-    connect(m_trace, SIGNAL(findResult(ApiTrace::SearchResult,ApiTraceCall*)),
-            this, SLOT(slotSearchResult(ApiTrace::SearchResult,ApiTraceCall*)));
+    connect(m_trace, SIGNAL(findResult(ApiTrace::SearchRequest,ApiTrace::SearchResult,ApiTraceCall*)),
+            this, SLOT(slotSearchResult(ApiTrace::SearchRequest,ApiTrace::SearchResult,ApiTraceCall*)));
     connect(m_trace, SIGNAL(foundFrameStart(ApiTraceFrame*)),
             this, SLOT(slotFoundFrameStart(ApiTraceFrame*)));
     connect(m_trace, SIGNAL(foundFrameEnd(ApiTraceFrame*)),
@@ -763,7 +765,7 @@ void MainWindow::initConnections()
     connect(m_ui.actionOptions, SIGNAL(triggered()),
             this, SLOT(showSettings()));
 
-    connect(m_ui.callView, SIGNAL(activated(const QModelIndex &)),
+    connect(m_ui.callView->selectionModel(), SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)),
             this, SLOT(callItemSelected(const QModelIndex &)));
     connect(m_ui.callView, SIGNAL(customContextMenuRequested(QPoint)),
             this, SLOT(customContextMenuRequested(QPoint)));
@@ -801,7 +803,7 @@ void MainWindow::initConnections()
     connect(m_ui.actionShowErrorsDock, SIGNAL(triggered(bool)),
             m_ui.errorsDock, SLOT(setVisible(bool)));
     connect(m_ui.errorsTreeWidget,
-            SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)),
+            SIGNAL(itemActivated(QTreeWidgetItem*, int)),
             this, SLOT(slotErrorSelected(QTreeWidgetItem*)));
 }
 
@@ -1096,7 +1098,8 @@ void MainWindow::loadProgess(int percent)
     m_progressBar->setValue(percent);
 }
 
-void MainWindow::slotSearchResult(ApiTrace::SearchResult result,
+void MainWindow::slotSearchResult(const ApiTrace::SearchRequest &request,
+                                  ApiTrace::SearchResult result,
                                   ApiTraceCall *call)
 {
     switch (result) {
@@ -1105,8 +1108,28 @@ void MainWindow::slotSearchResult(ApiTrace::SearchResult result,
         break;
     case ApiTrace::SearchResult_Found: {
         QModelIndex index = m_proxyModel->indexForCall(call);
-        m_ui.callView->setCurrentIndex(index);
-        m_searchWidget->setFound(true);
+
+        if (index.isValid()) {
+            m_ui.callView->setCurrentIndex(index);
+            m_searchWidget->setFound(true);
+        } else {
+            //call is filtered out, so continue searching but from the
+            // filtered call
+            if (!call) {
+                qDebug()<<"Error: search success with no call";
+                return;
+            }
+//            qDebug()<<"filtered! search from "<<call->searchText()
+//                   <<", call idx = "<<call->index();
+
+            if (request.direction == ApiTrace::SearchRequest::Next) {
+                m_trace->findNext(call->parentFrame(), call,
+                                  request.text, request.cs);
+            } else {
+                m_trace->findNext(call->parentFrame(), call,
+                                  request.text, request.cs);
+            }
+        }
     }
         break;
     case ApiTrace::SearchResult_Wrapped: