|
From: Tapio V. <aa...@us...> - 2011-01-12 18:39:30
|
Module: editor
Branch: master
Commit: 1f1c4294ca6303695fdc8764d1e8eca8d8eeb737
Author: Tapio Vierros <tap...@gm...>
Date: Wed Jan 12 17:50:56 2011 +0200
Another progress dialog for actual pitch rendering.
---
notegraphwidget.cc | 7 +++++++
pitchvis.cc | 2 +-
2 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/notegraphwidget.cc b/notegraphwidget.cc
index 799cda4..5747ef2 100644
--- a/notegraphwidget.cc
+++ b/notegraphwidget.cc
@@ -13,14 +13,21 @@ NoteGraphWidget::NoteGraphWidget(QWidget *parent)
: QLabel(parent), m_panHotSpot(), m_selectedNote(), m_selectedAction(NONE), m_pitch("music.raw")
{
unsigned width = m_pitch.width(), height = m_pitch.height;
+ QProgressDialog progress(tr("Rendering pitch data..."), tr("&Abort"), 0, width, this);
+ progress.setWindowModality(Qt::WindowModal);
+
QImage image(width, height, QImage::Format_ARGB32_Premultiplied);
unsigned* rgba = reinterpret_cast<unsigned*>(image.bits());
for (unsigned x = 0; x < width; ++x) {
+ progress.setValue(x);
+ if (progress.wasCanceled()) break;
+
for (unsigned y = 0; y < height; ++y) {
rgba[y * width + x] = m_pitch(x, y).rgba();
}
}
setPixmap(QPixmap::fromImage(image));
+ progress.setValue(width);
// FIXME: Width should come from song length * pixPerSec
setFixedSize(std::max(width, (unsigned)1024), height);
diff --git a/pitchvis.cc b/pitchvis.cc
index ca04b8e..2124fb4 100644
--- a/pitchvis.cc
+++ b/pitchvis.cc
@@ -29,7 +29,7 @@ PitchVis::PitchVis(std::string const& filename): height(1024) {
img.resize(width * height);
Analyzer analyzer(44100, "");
MusicalScale scale;
- QProgressDialog progress(tr("Analyzing and rendering pitch data..."), tr("&Abort"), 0, width, this);
+ QProgressDialog progress(tr("Analyzing pitch data..."), tr("&Abort"), 0, width, this);
progress.setWindowModality(Qt::WindowModal);
for (unsigned x = 0; x < width; ++x) {
|