Mercurial > hg > svcore
diff data/fileio/OggVorbisFileReader.cpp @ 357:b92513201610
* better progress reporting in FileSource
* fix set-to-default for audio dials with mappers
author | Chris Cannam |
---|---|
date | Fri, 04 Jan 2008 17:08:10 +0000 |
parents | 1afaf98dbf11 |
children | e6d11871e4c9 |
line wrap: on
line diff
--- a/data/fileio/OggVorbisFileReader.cpp Mon Dec 17 12:32:28 2007 +0000 +++ b/data/fileio/OggVorbisFileReader.cpp Fri Jan 04 17:08:10 2008 +0000 @@ -17,6 +17,8 @@ #ifdef HAVE_FISHSOUND #include "OggVorbisFileReader.h" +#include "ProgressPrinter.h" + #include "base/Profiler.h" #include "system/System.h" @@ -75,6 +77,9 @@ (QObject::tr("Decoding %1...").arg(QFileInfo(m_path).fileName()), QObject::tr("Stop"), 0, 100); m_progress->hide(); + } else { + ProgressPrinter *pp = new ProgressPrinter(tr("Decoding..."), this); + connect(this, SIGNAL(progress(int)), pp, SLOT(progress(int))); } while (oggz_read(m_oggz, 1024) > 0); @@ -145,14 +150,15 @@ // The number of bytes read by this function is smaller than // the file size because of the packet headers - int progress = lrint(double(reader->m_bytesRead) * 114 / - double(reader->m_fileSize)); - if (progress > 99) progress = 99; - reader->m_completion = progress; - + int p = lrint(double(reader->m_bytesRead) * 114 / + double(reader->m_fileSize)); + if (p > 99) p = 99; + reader->m_completion = p; + reader->progress(p); + if (reader->m_fileSize > 0 && reader->m_progress) { - if (progress > reader->m_progress->value()) { - reader->m_progress->setValue(progress); + if (p > reader->m_progress->value()) { + reader->m_progress->setValue(p); reader->m_progress->show(); reader->m_progress->raise(); qApp->processEvents();