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>
|
<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>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>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>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 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>Updated GnuPG to v1.4.15 (2013-10-05), compiled with GCC 4.8.1
|
||||||
<li>Various bugfixes and code improvements
|
<li>Various bugfixes and code improvements
|
||||||
|
@ -34,8 +34,8 @@
|
|||||||
#define VER_LAMEXP_MINOR_HI 0
|
#define VER_LAMEXP_MINOR_HI 0
|
||||||
#define VER_LAMEXP_MINOR_LO 9
|
#define VER_LAMEXP_MINOR_LO 9
|
||||||
#define VER_LAMEXP_TYPE Alpha
|
#define VER_LAMEXP_TYPE Alpha
|
||||||
#define VER_LAMEXP_PATCH 3
|
#define VER_LAMEXP_PATCH 4
|
||||||
#define VER_LAMEXP_BUILD 1418
|
#define VER_LAMEXP_BUILD 1420
|
||||||
#define VER_LAMEXP_CONFG 1348
|
#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. */
|
/* 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. */
|
/* 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. */
|
/* 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
|
// Constructor
|
||||||
@ -73,6 +73,9 @@ WorkingBanner::WorkingBanner(QWidget *parent)
|
|||||||
color.setColor(QPalette::WindowText, QColor::fromRgb(0x33, 0x33, 0x33));
|
color.setColor(QPalette::WindowText, QColor::fromRgb(0x33, 0x33, 0x33));
|
||||||
m_progress->setPalette(color);
|
m_progress->setPalette(color);
|
||||||
|
|
||||||
|
//Set Opacity
|
||||||
|
this->setWindowOpacity(0.85);
|
||||||
|
|
||||||
//Set wait cursor
|
//Set wait cursor
|
||||||
setCursor(Qt::WaitCursor);
|
setCursor(Qt::WaitCursor);
|
||||||
}
|
}
|
||||||
|
@ -39,6 +39,16 @@
|
|||||||
#include <QTime>
|
#include <QTime>
|
||||||
#include <QElapsedTimer>
|
#include <QElapsedTimer>
|
||||||
#include <QTimer>
|
#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
|
// Constructor
|
||||||
@ -161,12 +171,18 @@ void FileAnalyzer::run()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Handle playlist files
|
//Sort files
|
||||||
lamexp_natural_string_sort(m_inputFiles, true);
|
|
||||||
handlePlaylistFiles();
|
|
||||||
lamexp_natural_string_sort(m_inputFiles, true);
|
lamexp_natural_string_sort(m_inputFiles, true);
|
||||||
|
|
||||||
|
//Handle playlist files first!
|
||||||
|
handlePlaylistFiles();
|
||||||
|
|
||||||
const unsigned int nFiles = m_inputFiles.count();
|
const unsigned int nFiles = m_inputFiles.count();
|
||||||
|
if(nFiles < 1)
|
||||||
|
{
|
||||||
|
qWarning("File list is empty, nothing to do!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
//Update progress
|
//Update progress
|
||||||
emit progressMaxChanged(nFiles);
|
emit progressMaxChanged(nFiles);
|
||||||
@ -245,22 +261,51 @@ bool FileAnalyzer::analyzeNextFile(void)
|
|||||||
|
|
||||||
void FileAnalyzer::handlePlaylistFiles(void)
|
void FileAnalyzer::handlePlaylistFiles(void)
|
||||||
{
|
{
|
||||||
QStringList importedFiles;
|
QQueue<QVariant> queue;
|
||||||
|
QStringList importedFromPlaylist;
|
||||||
|
|
||||||
|
//Import playlist files into "hierarchical" list
|
||||||
while(!m_inputFiles.isEmpty())
|
while(!m_inputFiles.isEmpty())
|
||||||
{
|
{
|
||||||
const QString currentFile = m_inputFiles.takeFirst();
|
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();
|
const QVariant current = queue.dequeue();
|
||||||
if(!m_inputFiles.contains(currentFile, Qt::CaseInsensitive))
|
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…
x
Reference in New Issue
Block a user