MainWindow::~MainWindow()
{
+ delete m_trace;
+ m_trace = 0;
+
+ delete m_proxyModel;
+ delete m_model;
}
static void
QVariant var = item->data(0, Qt::UserRole);
QImage img = var.value<QImage>();
ImageViewer *viewer = new ImageViewer(this);
+
+ QString title;
+ if (currentCall()) {
+ title = tr("QApiTrace - Surface at %1 (%2)")
+ .arg(currentCall()->name())
+ .arg(currentCall()->index());
+ } else {
+ title = tr("QApiTrace - Surface Viewer");
+ }
+ viewer->setWindowTitle(title);
viewer->setAttribute(Qt::WA_DeleteOnClose, true);
viewer->setImage(img);
QRect screenRect = QApplication::desktop()->availableGeometry();
m_searchWidget->show();
}
-void MainWindow::slotSearchNext(const QString &str, Qt::CaseSensitivity sensitivity)
+void MainWindow::slotSearchNext(const QString &str,
+ Qt::CaseSensitivity sensitivity)
{
QModelIndex index = m_ui.callView->currentIndex();
ApiTraceEvent *event = 0;
for (int i = callNum + 1; i < calls.count(); ++i) {
ApiTraceCall *testCall = calls[i];
- QString txt = testCall->filterText();
- if (txt.contains(str, sensitivity)) {
- QModelIndex index = m_proxyModel->indexForCall(testCall);
- /* if it's not valid it means that the proxy model has already
- * filtered it out */
- if (index.isValid()) {
+ QModelIndex index = m_proxyModel->indexForCall(testCall);
+ /* if it's not valid it means that the proxy model has already
+ * filtered it out */
+ if (index.isValid()) {
+ QString txt = testCall->filterText();
+ if (txt.contains(str, sensitivity)) {
m_ui.callView->setCurrentIndex(index);
m_searchWidget->setFound(true);
return;
m_searchWidget->setFound(false);
}
-void MainWindow::slotSearchPrev(const QString &str, Qt::CaseSensitivity sensitivity)
+void MainWindow::slotSearchPrev(const QString &str,
+ Qt::CaseSensitivity sensitivity)
{
QModelIndex index = m_ui.callView->currentIndex();
ApiTraceEvent *event = 0;
for (int i = callNum - 1; i >= 0; --i) {
ApiTraceCall *testCall = calls[i];
- QString txt = testCall->filterText();
- if (txt.contains(str, sensitivity)) {
- QModelIndex index = m_proxyModel->indexForCall(testCall);
- /* if it's not valid it means that the proxy model has already
- * filtered it out */
- if (index.isValid()) {
+ QModelIndex index = m_proxyModel->indexForCall(testCall);
+ /* if it's not valid it means that the proxy model has already
+ * filtered it out */
+ if (index.isValid()) {
+ QString txt = testCall->filterText();
+ if (txt.contains(str, sensitivity)) {
m_ui.callView->setCurrentIndex(index);
m_searchWidget->setFound(true);
return;
}
}
+ApiTraceCall * MainWindow::currentCall() const
+{
+ if (m_selectedEvent &&
+ m_selectedEvent->type() == ApiTraceEvent::Call) {
+ return static_cast<ApiTraceCall*>(m_selectedEvent);
+ }
+ return NULL;
+}
+
#include "mainwindow.moc"