From 1f05c8db1fb857be4e1dbc2b246021cbe58b36da Mon Sep 17 00:00:00 2001 From: Milian Wolff Date: Wed, 16 Dec 2015 12:56:42 +0100 Subject: [PATCH] Add some indication on the file load process. --- gui/mainwindow.cpp | 2 ++ gui/mainwindow.ui | 13 +++++++++++++ gui/parser.cpp | 4 ++++ gui/parser.h | 1 + 4 files changed, 20 insertions(+) diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index 5621e52..87c6514 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -77,6 +77,8 @@ MainWindow::MainWindow(QWidget* parent) sizeHistogramModel, &HistogramModel::resetData); connect(m_parser, &Parser::summaryAvailable, m_ui->summary, &QLabel::setText); + connect(m_parser, &Parser::progressMessageAvailable, + m_ui->progressLabel, &QLabel::setText); connect(m_parser, &Parser::topDownDataAvailable, m_ui->flameGraphTab, &FlameGraph::setTopDownData); connect(m_parser, &Parser::bottomUpDataAvailable, diff --git a/gui/mainwindow.ui b/gui/mainwindow.ui index c58fa1f..d4dee41 100644 --- a/gui/mainwindow.ui +++ b/gui/mainwindow.ui @@ -64,6 +64,19 @@ + + + Progress Message... + + + Qt::AlignCenter + + + true + + + + Qt::Vertical diff --git a/gui/parser.cpp b/gui/parser.cpp index c12de77..bf97556 100644 --- a/gui/parser.cpp +++ b/gui/parser.cpp @@ -494,17 +494,21 @@ void Parser::parse(const QString& path) stream() << make_job([this, path]() { const auto stdPath = path.toStdString(); auto data = make_shared(); + emit progressMessageAvailable(i18n("parsing data...")); data->read(stdPath); data->updateStringCache(); emit summaryAvailable(generateSummary(*data)); + emit progressMessageAvailable(i18n("merging allocations...")); // merge allocations before modifying the data again const auto mergedAllocations = mergeAllocations(*data); + emit progressMessageAvailable(i18n("building size histogram...")); // also calculate the size histogram const auto sizeHistogram = buildSizeHistogram(*data); // now data can be modified again for the chart data evaluation + emit progressMessageAvailable(i18n("building charts...")); auto parallel = new Collection; *parallel << make_job([this, mergedAllocations, sizeHistogram]() { emit bottomUpDataAvailable(mergedAllocations); diff --git a/gui/parser.h b/gui/parser.h index 72e0e46..7aaace3 100644 --- a/gui/parser.h +++ b/gui/parser.h @@ -37,6 +37,7 @@ public slots: void parse(const QString& path); signals: + void progressMessageAvailable(const QString& progress); void summaryAvailable(const QString& summary); void bottomUpDataAvailable(const TreeData& data); void topDownDataAvailable(const TreeData& data); -- 2.7.4