Improved CueSheet import progress indicator.
This commit is contained in:
parent
5e5fbe06f9
commit
d206eccac9
@ -34,7 +34,7 @@
|
||||
#define VER_LAMEXP_MINOR_LO 9
|
||||
#define VER_LAMEXP_TYPE Alpha
|
||||
#define VER_LAMEXP_PATCH 2
|
||||
#define VER_LAMEXP_BUILD 1385
|
||||
#define VER_LAMEXP_BUILD 1386
|
||||
#define VER_LAMEXP_CONFG 1348
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -81,12 +81,6 @@ AudioFileModel_MetaInfo &AudioFileModel_MetaInfo::operator=(const AudioFileModel
|
||||
|
||||
void AudioFileModel_MetaInfo::update(const AudioFileModel_MetaInfo &model, const bool replace)
|
||||
{
|
||||
qDebug("\n-------[AudioFileModel_MetaInfo::update]-------");
|
||||
qDebug("Updating (%p):", this);
|
||||
print();
|
||||
qDebug("\nUpdating with (%p):", &model);
|
||||
model.print();
|
||||
|
||||
if((!model.m_titel.isEmpty()) && (replace || m_titel.isEmpty())) m_titel = model.m_titel;
|
||||
if((!model.m_artist.isEmpty()) && (replace || m_artist.isEmpty())) m_artist = model.m_artist;
|
||||
if((!model.m_album.isEmpty()) && (replace || m_album.isEmpty())) m_album = model.m_album;
|
||||
@ -95,10 +89,6 @@ void AudioFileModel_MetaInfo::update(const AudioFileModel_MetaInfo &model, const
|
||||
if((!model.m_cover.isEmpty()) && (replace || m_cover.isEmpty())) m_cover = model.m_cover;
|
||||
if((model.m_year > 0) && (replace || (m_year == 0))) m_year = model.m_year;
|
||||
if((model.m_position > 0) && (replace || (m_position == 0))) m_position = model.m_position;
|
||||
|
||||
qDebug("\nResult:");
|
||||
print();
|
||||
qDebug("-----------------------------------------------\n\n");
|
||||
}
|
||||
|
||||
AudioFileModel_MetaInfo::~AudioFileModel_MetaInfo(void)
|
||||
|
@ -162,7 +162,7 @@ void CueSplitter::run()
|
||||
nTracksTotal += m_model->getTrackCount(i);
|
||||
}
|
||||
|
||||
emit progressMaxChanged(nTracksTotal);
|
||||
emit progressMaxChanged(10 * nTracksTotal);
|
||||
emit progressValChanged(0);
|
||||
|
||||
const AudioFileModel_MetaInfo *albumInfo = m_model->getAlbumInfo();
|
||||
@ -172,7 +172,6 @@ void CueSplitter::run()
|
||||
{
|
||||
int nTracks = m_model->getTrackCount(i);
|
||||
QString trackFile = m_model->getFileName(i);
|
||||
int maxProgress = 0;
|
||||
|
||||
//Process all tracks
|
||||
for(int j = 0; j < nTracks; j++)
|
||||
@ -209,8 +208,8 @@ void CueSplitter::run()
|
||||
|
||||
//Call split function
|
||||
emit fileSelected(shortName(QFileInfo(outputFile).fileName()));
|
||||
splitFile(outputFile, trackNo, trackFile, trackOffset, trackLength, trackMetaInfo, maxProgress);
|
||||
emit progressValChanged(++nTracksComplete);
|
||||
splitFile(outputFile, trackNo, trackFile, trackOffset, trackLength, trackMetaInfo, nTracksComplete);
|
||||
emit progressValChanged(nTracksComplete += 10);
|
||||
|
||||
if(m_abortFlag)
|
||||
{
|
||||
@ -221,7 +220,7 @@ void CueSplitter::run()
|
||||
}
|
||||
}
|
||||
|
||||
emit progressValChanged(nTracksTotal);
|
||||
emit progressValChanged(10 * nTracksTotal);
|
||||
lamexp_sleep(333);
|
||||
|
||||
qDebug("All files were split.\n");
|
||||
@ -241,7 +240,7 @@ void CueSplitter::handleUpdate(int progress)
|
||||
// Privtae Functions
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
void CueSplitter::splitFile(const QString &output, const int trackNo, const QString &file, const double offset, const double length, const AudioFileModel_MetaInfo &metaInfo, int &maxProgress)
|
||||
void CueSplitter::splitFile(const QString &output, const int trackNo, const QString &file, const double offset, const double length, const AudioFileModel_MetaInfo &metaInfo, const int baseProgress)
|
||||
{
|
||||
qDebug("[Track %02d]", trackNo);
|
||||
qDebug("File: <%s>", file.toUtf8().constData());
|
||||
@ -251,6 +250,8 @@ void CueSplitter::splitFile(const QString &output, const int trackNo, const QStr
|
||||
qDebug("Title: <%s>", metaInfo.title().toUtf8().constData());
|
||||
qDebug("Album: <%s>", metaInfo.album().toUtf8().constData());
|
||||
|
||||
int prevProgress = baseProgress;
|
||||
|
||||
if(!m_decompressedFiles.contains(file))
|
||||
{
|
||||
qWarning("Unknown or unsupported input file, skipping!");
|
||||
@ -262,8 +263,6 @@ void CueSplitter::splitFile(const QString &output, const int trackNo, const QStr
|
||||
QString decompressedInput = m_decompressedFiles[file];
|
||||
qDebug("Input: <%s>", decompressedInput.toUtf8().constData());
|
||||
|
||||
//emit fileSelected(QString("%1 [%2%]").arg(baseName, QString::number(maxProgress)));
|
||||
|
||||
AudioFileModel outFileInfo(output);
|
||||
outFileInfo.setMetaInfo(metaInfo);
|
||||
|
||||
@ -337,8 +336,12 @@ void CueSplitter::splitFile(const QString &output, const int trackNo, const QStr
|
||||
int progress = rxProgress.cap(1).toInt(&ok);
|
||||
if(ok)
|
||||
{
|
||||
maxProgress = qMax(maxProgress, progress);
|
||||
//emit fileSelected(QString("%1 [%2%]").arg(baseName, QString::number(maxProgress)));
|
||||
const int newProgress = baseProgress + qRound(static_cast<double>(qBound(0, progress, 100)) / 10.0);
|
||||
if(newProgress > prevProgress)
|
||||
{
|
||||
emit progressValChanged(newProgress);
|
||||
prevProgress = newProgress;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(rxChannels.lastIndexIn(text) >= 0)
|
||||
|
@ -63,7 +63,7 @@ public slots:
|
||||
void abortProcess(void) { m_abortFlag = true; }
|
||||
|
||||
private:
|
||||
void splitFile(const QString &output, const int trackNo, const QString &file, const double offset, const double length, const AudioFileModel_MetaInfo &metaInfo, int &maxProgress);
|
||||
void splitFile(const QString &output, const int trackNo, const QString &file, const double offset, const double length, const AudioFileModel_MetaInfo &metaInfo, const int baseProgress);
|
||||
QString indexToString(const double index) const;
|
||||
QString shortName(const QString &longName) const;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user