From de4ea4197df6ba442beae0d52651fc4606e78417 Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Wed, 30 Mar 2011 11:30:08 -0400 Subject: [PATCH] Show that we're loading a trace. --- gui/apitrace.cpp | 4 ++++ gui/apitrace.h | 2 ++ gui/mainwindow.cpp | 31 +++++++++++++++++++++++++++++++ gui/mainwindow.h | 5 +++++ 4 files changed, 42 insertions(+) diff --git a/gui/apitrace.cpp b/gui/apitrace.cpp index 51e83b2..4d7a17c 100644 --- a/gui/apitrace.cpp +++ b/gui/apitrace.cpp @@ -8,6 +8,10 @@ ApiTrace::ApiTrace() m_loader = new LoaderThread(this); connect(m_loader, SIGNAL(parsedFrames(const QList)), this, SLOT(addFrames(const QList))); + connect(m_loader, SIGNAL(started()), + this, SIGNAL(startedLoadingTrace())); + connect(m_loader, SIGNAL(finished()), + this, SIGNAL(finishedLoadingTrace())); } ApiTrace::~ApiTrace() diff --git a/gui/apitrace.h b/gui/apitrace.h index c400deb..a46e8e0 100644 --- a/gui/apitrace.h +++ b/gui/apitrace.h @@ -43,6 +43,8 @@ public slots: void setFrameMarker(FrameMarker marker); signals: + void startedLoadingTrace(); + void finishedLoadingTrace(); void invalidated(); void framesInvalidated(); diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index a469148..63864bf 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -13,6 +13,7 @@ #include #include #include +#include #include #include @@ -24,6 +25,10 @@ MainWindow::MainWindow() m_ui.setupUi(this); m_trace = new ApiTrace(); + connect(m_trace, SIGNAL(startedLoadingTrace()), + this, SLOT(startedLoadingTrace())); + connect(m_trace, SIGNAL(finishedLoadingTrace()), + this, SLOT(finishedLoadingTrace())); m_model = new ApiTraceModel(); m_model->setApiTrace(m_trace); @@ -38,6 +43,11 @@ MainWindow::MainWindow() m_filterEdit = new QLineEdit(toolBar); toolBar->addWidget(m_filterEdit); + m_progressBar = new QProgressBar(); + m_progressBar->setRange(0, 0); + statusBar()->addPermanentWidget(m_progressBar); + m_progressBar->hide(); + m_ui.detailsDock->hide(); connect(m_ui.actionOpen, SIGNAL(triggered()), @@ -79,6 +89,7 @@ void MainWindow::loadTrace(const QString &fileName) } qDebug()<< "Loading : " <setValue(0); newTraceFile(fileName); } @@ -187,4 +198,24 @@ void MainWindow::replayError(QProcess::ProcessError err) tr("Couldn't execute the replay file '%1'").arg(m_traceFileName)); } +void MainWindow::startedLoadingTrace() +{ + Q_ASSERT(m_trace); + m_progressBar->show(); + QFileInfo info(m_trace->fileName()); + statusBar()->showMessage( + tr("Loading %1...").arg(info.fileName())); +} + +void MainWindow::finishedLoadingTrace() +{ + m_progressBar->hide(); + if (!m_trace) { + return; + } + QFileInfo info(m_trace->fileName()); + statusBar()->showMessage( + tr("Loaded %1").arg(info.fileName()), 3000); +} + #include "mainwindow.moc" diff --git a/gui/mainwindow.h b/gui/mainwindow.h index 11290e6..a771bd9 100644 --- a/gui/mainwindow.h +++ b/gui/mainwindow.h @@ -12,6 +12,7 @@ class ApiTraceFilter; class QLineEdit; class QModelIndex; class QProcess; +class QProgressBar; class MainWindow : public QMainWindow { @@ -30,6 +31,8 @@ private slots: void replayStop(); void replayFinished(); void replayError(QProcess::ProcessError err); + void startedLoadingTrace(); + void finishedLoadingTrace(); private: void newTraceFile(const QString &fileName); @@ -43,6 +46,8 @@ private: QProcess *m_replayProcess; + QProgressBar *m_progressBar; + QString m_traceFileName; }; -- 2.43.0