Improved file analyzer to retain the original ordering of files imported from a playlist.
This commit is contained in:
parent
8b88b6f432
commit
18b645f349
@ -19,9 +19,10 @@ a:visited { color: #0000EE; }
|
||||
|
||||
<a name="4.09"></a>Changes between v4.08 and v4.09 [<font color="darkred">unreleased</font>]:<br><ul>
|
||||
<li>Upgraded build environment to Microsoft Visual Studio 2013 RTM
|
||||
<li>Improved internal encoder API, so each encoder can define its own configuration options
|
||||
<li>Complete overhaul of the file analyzer, resulting in up to 2.5x faster file import speed
|
||||
<li>Reworked the application initialization code, resulting in notably faster startup speed
|
||||
<li>Improved file analyzer to retain the original ordering of files imported from a playlist
|
||||
<li>Improved internal encoder API, so each encoder can define its own configuration options
|
||||
<li>Updated mpg123 decoder to v1.16.0 (2013-10-06), compiled with GCC 4.8.1
|
||||
<li>Updated GnuPG to v1.4.15 (2013-10-05), compiled with GCC 4.8.1
|
||||
<li>Various bugfixes and code improvements
|
||||
|
@ -34,8 +34,8 @@
|
||||
#define VER_LAMEXP_MINOR_HI 0
|
||||
#define VER_LAMEXP_MINOR_LO 9
|
||||
#define VER_LAMEXP_TYPE Alpha
|
||||
#define VER_LAMEXP_PATCH 3
|
||||
#define VER_LAMEXP_BUILD 1418
|
||||
#define VER_LAMEXP_PATCH 4
|
||||
#define VER_LAMEXP_BUILD 1420
|
||||
#define VER_LAMEXP_CONFG 1348
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -35,7 +35,7 @@
|
||||
/* It can happen that the QThread has just terminated and already emitted the 'terminated' signal, but did NOT change the 'isRunning' flag to FALSE yet. */
|
||||
/* For this reason the macro will first check the 'isRunning' flag. If (and only if) the flag still returns TRUE, then we will wait() for at most 50 ms. */
|
||||
/* If, after 50 ms, the wait() function returns with FALSE, then the thread probably is still running and we return TRUE. Otherwise we can return FALSE. */
|
||||
#define THREAD_RUNNING(THRD) (((THRD)->isRunning()) ? (!((THRD)->wait(50))) : false)
|
||||
#define THREAD_RUNNING(THRD) (((THRD)->isRunning()) ? (!((THRD)->wait(1))) : false)
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Constructor
|
||||
@ -73,6 +73,9 @@ WorkingBanner::WorkingBanner(QWidget *parent)
|
||||
color.setColor(QPalette::WindowText, QColor::fromRgb(0x33, 0x33, 0x33));
|
||||
m_progress->setPalette(color);
|
||||
|
||||
//Set Opacity
|
||||
this->setWindowOpacity(0.85);
|
||||
|
||||
//Set wait cursor
|
||||
setCursor(Qt::WaitCursor);
|
||||
}
|
||||
|
@ -39,6 +39,16 @@
|
||||
#include <QTime>
|
||||
#include <QElapsedTimer>
|
||||
#include <QTimer>
|
||||
#include <QQueue>
|
||||
|
||||
//Insert into QStringList *without* duplicates
|
||||
static inline void SAFE_APPEND_STRING(QStringList &list, const QString &str)
|
||||
{
|
||||
if(!list.contains(str, Qt::CaseInsensitive))
|
||||
{
|
||||
list << str;
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Constructor
|
||||
@ -161,12 +171,18 @@ void FileAnalyzer::run()
|
||||
}
|
||||
}
|
||||
|
||||
//Handle playlist files
|
||||
lamexp_natural_string_sort(m_inputFiles, true);
|
||||
handlePlaylistFiles();
|
||||
//Sort files
|
||||
lamexp_natural_string_sort(m_inputFiles, true);
|
||||
|
||||
//Handle playlist files first!
|
||||
handlePlaylistFiles();
|
||||
|
||||
const unsigned int nFiles = m_inputFiles.count();
|
||||
if(nFiles < 1)
|
||||
{
|
||||
qWarning("File list is empty, nothing to do!");
|
||||
return;
|
||||
}
|
||||
|
||||
//Update progress
|
||||
emit progressMaxChanged(nFiles);
|
||||
@ -245,22 +261,51 @@ bool FileAnalyzer::analyzeNextFile(void)
|
||||
|
||||
void FileAnalyzer::handlePlaylistFiles(void)
|
||||
{
|
||||
QStringList importedFiles;
|
||||
QQueue<QVariant> queue;
|
||||
QStringList importedFromPlaylist;
|
||||
|
||||
//Import playlist files into "hierarchical" list
|
||||
while(!m_inputFiles.isEmpty())
|
||||
{
|
||||
const QString currentFile = m_inputFiles.takeFirst();
|
||||
if(!PlaylistImporter::importPlaylist(importedFiles, currentFile))
|
||||
QStringList importedFiles;
|
||||
if(PlaylistImporter::importPlaylist(importedFiles, currentFile))
|
||||
{
|
||||
importedFiles << currentFile;
|
||||
queue.enqueue(importedFiles);
|
||||
importedFromPlaylist << importedFiles;
|
||||
}
|
||||
else
|
||||
{
|
||||
queue.enqueue(currentFile);
|
||||
}
|
||||
}
|
||||
|
||||
while(!importedFiles.isEmpty())
|
||||
//Reduce temporary list
|
||||
importedFromPlaylist.removeDuplicates();
|
||||
|
||||
//Now build the complete "flat" file list (files imported from playlist take precedence!)
|
||||
while(!queue.isEmpty())
|
||||
{
|
||||
const QString currentFile = importedFiles.takeFirst();
|
||||
if(!m_inputFiles.contains(currentFile, Qt::CaseInsensitive))
|
||||
const QVariant current = queue.dequeue();
|
||||
if(current.type() == QVariant::String)
|
||||
{
|
||||
m_inputFiles << currentFile;
|
||||
const QString temp = current.toString();
|
||||
if(!importedFromPlaylist.contains(temp, Qt::CaseInsensitive))
|
||||
{
|
||||
SAFE_APPEND_STRING(m_inputFiles, temp);
|
||||
}
|
||||
}
|
||||
else if(current.type() == QVariant::StringList)
|
||||
{
|
||||
const QStringList temp = current.toStringList();
|
||||
for(QStringList::ConstIterator iter = temp.constBegin(); iter != temp.constEnd(); iter++)
|
||||
{
|
||||
SAFE_APPEND_STRING(m_inputFiles, (*iter));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
qWarning("Encountered an unexpected variant type!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user