diff options
author | Jose Fonseca <jfonseca@vmware.com> | 2015-11-10 19:53:55 +0000 |
---|---|---|
committer | Jose Fonseca <jfonseca@vmware.com> | 2015-11-10 20:00:40 +0000 |
commit | 8f0846cfb4b15f47e30740f68b3bce3382da9fb0 (patch) | |
tree | 7812f800c5d270af9e4415691f26a5f8f4c9feed /gui | |
parent | cfc5d7346d02e748fdcd0c848d7153b5d644fbd5 (diff) |
gui: Refuse to open non-seekable (ie, non-Snappy) traces.
Diffstat (limited to 'gui')
-rw-r--r-- | gui/apitrace.cpp | 2 | ||||
-rw-r--r-- | gui/apitrace.h | 1 | ||||
-rw-r--r-- | gui/mainwindow.cpp | 11 | ||||
-rw-r--r-- | gui/mainwindow.h | 1 | ||||
-rw-r--r-- | gui/traceloader.cpp | 9 | ||||
-rw-r--r-- | gui/traceloader.h | 1 |
6 files changed, 25 insertions, 0 deletions
diff --git a/gui/apitrace.cpp b/gui/apitrace.cpp index 3e449357..18556173 100644 --- a/gui/apitrace.cpp +++ b/gui/apitrace.cpp @@ -45,6 +45,8 @@ ApiTrace::ApiTrace() this, SIGNAL(foundCallIndex(ApiTraceCall*))); + connect(m_loader, SIGNAL(parseProblem(const QString&)), + this, SIGNAL(problemLoadingTrace(const QString&))); connect(m_loader, SIGNAL(startedParsing()), this, SIGNAL(startedLoadingTrace())); connect(m_loader, SIGNAL(parsed(int)), diff --git a/gui/apitrace.h b/gui/apitrace.h index 77cac61d..d7259924 100644 --- a/gui/apitrace.h +++ b/gui/apitrace.h @@ -110,6 +110,7 @@ public slots: signals: void loadTrace(const QString &name); void requestFrame(ApiTraceFrame *frame); + void problemLoadingTrace(const QString &message); void startedLoadingTrace(); void loaded(int percent); void finishedLoadingTrace(); diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index 2264c3b6..8bf464a0 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -398,6 +398,15 @@ void MainWindow::replayError(const QString &message) this, tr("Replay Failed"), message); } +void MainWindow::loadError(const QString &message) +{ + m_progressBar->hide(); + statusBar()->showMessage( + tr("Load unsuccessful."), 2000); + QMessageBox::warning( + this, tr("Load Failed"), message); +} + void MainWindow::startedLoadingTrace() { Q_ASSERT(m_trace); @@ -993,6 +1002,8 @@ void MainWindow::initObjects() void MainWindow::initConnections() { + connect(m_trace, SIGNAL(problemLoadingTrace(const QString&)), + this, SLOT(loadError(const QString&))); connect(m_trace, SIGNAL(startedLoadingTrace()), this, SLOT(startedLoadingTrace())); connect(m_trace, SIGNAL(loaded(int)), diff --git a/gui/mainwindow.h b/gui/mainwindow.h index 1aabe2f2..34f4113e 100644 --- a/gui/mainwindow.h +++ b/gui/mainwindow.h @@ -64,6 +64,7 @@ private slots: void replayProfileFound(trace::Profile *state); void replayThumbnailsFound(const ImageHash &thumbnails); void replayError(const QString &msg); + void loadError(const QString &msg); void startedLoadingTrace(); void loadProgess(int percent); void finishedLoadingTrace(); diff --git a/gui/traceloader.cpp b/gui/traceloader.cpp index e6e37e6c..bc2af425 100644 --- a/gui/traceloader.cpp +++ b/gui/traceloader.cpp @@ -55,6 +55,15 @@ void TraceLoader::loadTrace(const QString &filename) return; } + if (!m_parser.supportsOffsets()) { + emit parseProblem( + "This trace in compressed in a format that does not allow random seeking.\n" + "Please repack the trace with `apitrace repack`." + ); + m_parser.close(); + return; + } + emit startedParsing(); if (m_parser.supportsOffsets()) { diff --git a/gui/traceloader.h b/gui/traceloader.h index daf3b3da..6fa26c32 100644 --- a/gui/traceloader.h +++ b/gui/traceloader.h @@ -56,6 +56,7 @@ public slots: void search(const ApiTrace::SearchRequest &request); signals: + void parseProblem(const QString &message); void startedParsing(); void parsed(int percent); void guessedApi(int api); |