Implemented progress indicator for the working banner.
This commit is contained in:
parent
a7a776ed82
commit
e13b93f51b
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -30,7 +30,7 @@
|
|||||||
</font>
|
</font>
|
||||||
</property>
|
</property>
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>1</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="usesScrollButtons">
|
<property name="usesScrollButtons">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
@ -4101,6 +4101,7 @@
|
|||||||
<include location="../res/Icons.qrc"/>
|
<include location="../res/Icons.qrc"/>
|
||||||
<include location="../res/Icons.qrc"/>
|
<include location="../res/Icons.qrc"/>
|
||||||
<include location="../res/Icons.qrc"/>
|
<include location="../res/Icons.qrc"/>
|
||||||
|
<include location="../res/Icons.qrc"/>
|
||||||
</resources>
|
</resources>
|
||||||
<connections>
|
<connections>
|
||||||
<connection>
|
<connection>
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>480</width>
|
<width>480</width>
|
||||||
<height>53</height>
|
<height>51</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
@ -96,14 +96,14 @@
|
|||||||
<widget class="QLabel" name="labelWorking">
|
<widget class="QLabel" name="labelWorking">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>36</width>
|
<width>31</width>
|
||||||
<height>0</height>
|
<height>31</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>36</width>
|
<width>31</width>
|
||||||
<height>16777215</height>
|
<height>31</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@ -143,6 +143,7 @@
|
|||||||
<include location="../res/Images.qrc"/>
|
<include location="../res/Images.qrc"/>
|
||||||
<include location="../res/Images.qrc"/>
|
<include location="../res/Images.qrc"/>
|
||||||
<include location="../res/Images.qrc"/>
|
<include location="../res/Images.qrc"/>
|
||||||
|
<include location="../res/Images.qrc"/>
|
||||||
</resources>
|
</resources>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
#define VER_LAMEXP_MINOR_LO 5
|
#define VER_LAMEXP_MINOR_LO 5
|
||||||
#define VER_LAMEXP_TYPE Alpha
|
#define VER_LAMEXP_TYPE Alpha
|
||||||
#define VER_LAMEXP_PATCH 1
|
#define VER_LAMEXP_PATCH 1
|
||||||
#define VER_LAMEXP_BUILD 1008
|
#define VER_LAMEXP_BUILD 1013
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// Tool versions (minimum expected versions!)
|
// Tool versions (minimum expected versions!)
|
||||||
|
@ -424,6 +424,7 @@ MainWindow::MainWindow(FileListModel *fileListModel, AudioFileModel *metaInfo, S
|
|||||||
connect(m_fileListModel, SIGNAL(modelReset()), m_dropBox, SLOT(modelChanged()));
|
connect(m_fileListModel, SIGNAL(modelReset()), m_dropBox, SLOT(modelChanged()));
|
||||||
connect(m_fileListModel, SIGNAL(rowsInserted(QModelIndex,int,int)), m_dropBox, SLOT(modelChanged()));
|
connect(m_fileListModel, SIGNAL(rowsInserted(QModelIndex,int,int)), m_dropBox, SLOT(modelChanged()));
|
||||||
connect(m_fileListModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), m_dropBox, SLOT(modelChanged()));
|
connect(m_fileListModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), m_dropBox, SLOT(modelChanged()));
|
||||||
|
connect(m_fileListModel, SIGNAL(rowAppended()), m_dropBox, SLOT(modelChanged()));
|
||||||
|
|
||||||
//Create message handler thread
|
//Create message handler thread
|
||||||
m_messageHandler = new MessageHandlerThread();
|
m_messageHandler = new MessageHandlerThread();
|
||||||
@ -516,6 +517,8 @@ void MainWindow::addFiles(const QStringList &files)
|
|||||||
|
|
||||||
FileAnalyzer *analyzer = new FileAnalyzer(files);
|
FileAnalyzer *analyzer = new FileAnalyzer(files);
|
||||||
connect(analyzer, SIGNAL(fileSelected(QString)), m_banner, SLOT(setText(QString)), Qt::QueuedConnection);
|
connect(analyzer, SIGNAL(fileSelected(QString)), m_banner, SLOT(setText(QString)), Qt::QueuedConnection);
|
||||||
|
connect(analyzer, SIGNAL(progressValChanged(unsigned int)), m_banner, SLOT(setProgressVal(unsigned int)), Qt::QueuedConnection);
|
||||||
|
connect(analyzer, SIGNAL(progressMaxChanged(unsigned int)), m_banner, SLOT(setProgressMax(unsigned int)), Qt::QueuedConnection);
|
||||||
connect(analyzer, SIGNAL(fileAnalyzed(AudioFileModel)), m_fileListModel, SLOT(addFile(AudioFileModel)), Qt::QueuedConnection);
|
connect(analyzer, SIGNAL(fileAnalyzed(AudioFileModel)), m_fileListModel, SLOT(addFile(AudioFileModel)), Qt::QueuedConnection);
|
||||||
connect(m_banner, SIGNAL(userAbort()), analyzer, SLOT(abortProcess()), Qt::DirectConnection);
|
connect(m_banner, SIGNAL(userAbort()), analyzer, SLOT(abortProcess()), Qt::DirectConnection);
|
||||||
|
|
||||||
|
@ -42,7 +42,8 @@
|
|||||||
|
|
||||||
WorkingBanner::WorkingBanner(QWidget *parent)
|
WorkingBanner::WorkingBanner(QWidget *parent)
|
||||||
:
|
:
|
||||||
QDialog(parent, Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint)
|
QDialog(parent, Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint),
|
||||||
|
m_progressMax(0), m_progressVal(0)
|
||||||
{
|
{
|
||||||
//Init the dialog, from the .ui file
|
//Init the dialog, from the .ui file
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
@ -54,6 +55,23 @@ WorkingBanner::WorkingBanner(QWidget *parent)
|
|||||||
labelWorking->setMovie(m_working);
|
labelWorking->setMovie(m_working);
|
||||||
m_working->start();
|
m_working->start();
|
||||||
|
|
||||||
|
//Create progress indicator
|
||||||
|
m_progress = new QLabel(labelWorking);
|
||||||
|
m_progress->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||||
|
m_progress->move(0, 0);
|
||||||
|
m_progress->resize(labelWorking->size());
|
||||||
|
|
||||||
|
//Set font size
|
||||||
|
QFont font = m_progress->font();
|
||||||
|
font.setPointSize(5);
|
||||||
|
m_progress->setFont(font);
|
||||||
|
|
||||||
|
//Set font color
|
||||||
|
QPalette color = m_progress->palette();
|
||||||
|
color.setColor(QPalette::Text, QColor::fromRgb(0x36, 0x36, 0x36));
|
||||||
|
color.setColor(QPalette::WindowText, QColor::fromRgb(0x36, 0x36, 0x36));
|
||||||
|
m_progress->setPalette(color);
|
||||||
|
|
||||||
//Set wait cursor
|
//Set wait cursor
|
||||||
setCursor(Qt::WaitCursor);
|
setCursor(Qt::WaitCursor);
|
||||||
}
|
}
|
||||||
@ -70,6 +88,8 @@ WorkingBanner::~WorkingBanner(void)
|
|||||||
delete m_working;
|
delete m_working;
|
||||||
m_working = NULL;
|
m_working = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LAMEXP_DELETE(m_progress);
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
@ -82,6 +102,9 @@ void WorkingBanner::show(const QString &text)
|
|||||||
QDialog::show();
|
QDialog::show();
|
||||||
setFixedSize(size());
|
setFixedSize(size());
|
||||||
setText(text);
|
setText(text);
|
||||||
|
|
||||||
|
m_progress->setText(QString());
|
||||||
|
|
||||||
QApplication::processEvents();
|
QApplication::processEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -205,3 +228,18 @@ void WorkingBanner::setText(const QString &text)
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WorkingBanner::setProgressMax(unsigned int max)
|
||||||
|
{
|
||||||
|
m_progressMax = max;
|
||||||
|
}
|
||||||
|
|
||||||
|
void WorkingBanner::setProgressVal(unsigned int val)
|
||||||
|
{
|
||||||
|
m_progressVal = val;
|
||||||
|
if(m_progressMax > 0)
|
||||||
|
{
|
||||||
|
int progress = qRound(qBound(0.0, static_cast<double>(m_progressVal) / static_cast<double>(m_progressMax), 1.0) * 100.0);
|
||||||
|
m_progress->setText(QString::number(progress));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -45,6 +45,8 @@ private:
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setText(const QString &text);
|
void setText(const QString &text);
|
||||||
|
void setProgressMax(unsigned int max);
|
||||||
|
void setProgressVal(unsigned int val);
|
||||||
bool close(void);
|
bool close(void);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
@ -55,4 +57,8 @@ protected:
|
|||||||
void keyReleaseEvent(QKeyEvent *event);
|
void keyReleaseEvent(QKeyEvent *event);
|
||||||
void closeEvent(QCloseEvent *event);
|
void closeEvent(QCloseEvent *event);
|
||||||
bool winEvent(MSG *message, long *result);
|
bool winEvent(MSG *message, long *result);
|
||||||
|
|
||||||
|
QLabel *m_progress;
|
||||||
|
unsigned int m_progressMax;
|
||||||
|
unsigned int m_progressVal;
|
||||||
};
|
};
|
||||||
|
@ -147,6 +147,7 @@ void FileListModel::addFile(const QString &filePath)
|
|||||||
m_fileStore.insert(key, AudioFileModel(fileInfo.canonicalFilePath(), fileInfo.baseName()));
|
m_fileStore.insert(key, AudioFileModel(fileInfo.canonicalFilePath(), fileInfo.baseName()));
|
||||||
m_fileList.append(key);
|
m_fileList.append(key);
|
||||||
if(flag) endInsertRows();
|
if(flag) endInsertRows();
|
||||||
|
emit rowAppended();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -161,6 +162,7 @@ void FileListModel::addFile(const AudioFileModel &file)
|
|||||||
m_fileStore.insert(key, file);
|
m_fileStore.insert(key, file);
|
||||||
m_fileList.append(key);
|
m_fileList.append(key);
|
||||||
if(flag) endInsertRows();
|
if(flag) endInsertRows();
|
||||||
|
emit rowAppended();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,6 +76,9 @@ public slots:
|
|||||||
void addFile(const QString &filePath);
|
void addFile(const QString &filePath);
|
||||||
void addFile(const AudioFileModel &file);
|
void addFile(const AudioFileModel &file);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void rowAppended(void);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_blockUpdates;
|
bool m_blockUpdates;
|
||||||
QList<QString> m_fileList;
|
QList<QString> m_fileList;
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
#include <QUuid>
|
#include <QUuid>
|
||||||
|
|
||||||
#define MAX_DISPLAY_ITEMS 50
|
#define MAX_DISPLAY_ITEMS 32
|
||||||
|
|
||||||
ProgressModel::ProgressModel(void)
|
ProgressModel::ProgressModel(void)
|
||||||
:
|
:
|
||||||
|
@ -108,11 +108,17 @@ const char *FileAnalyzer::g_tags_aud[] =
|
|||||||
|
|
||||||
void FileAnalyzer::run()
|
void FileAnalyzer::run()
|
||||||
{
|
{
|
||||||
m_bSuccess = false;
|
m_abortFlag = false;
|
||||||
|
|
||||||
m_bAborted = false;
|
m_bAborted = false;
|
||||||
|
m_bSuccess = false;
|
||||||
|
|
||||||
|
int nFiles = m_inputFiles.count();
|
||||||
|
|
||||||
|
emit progressMaxChanged(nFiles);
|
||||||
|
emit progressValChanged(0);
|
||||||
|
|
||||||
m_inputFiles.sort();
|
m_inputFiles.sort();
|
||||||
m_abortFlag = false;
|
|
||||||
|
|
||||||
if(!m_templateFile)
|
if(!m_templateFile)
|
||||||
{
|
{
|
||||||
@ -125,6 +131,7 @@ void FileAnalyzer::run()
|
|||||||
|
|
||||||
AnalyzeTask::reset();
|
AnalyzeTask::reset();
|
||||||
QThreadPool *pool = new QThreadPool();
|
QThreadPool *pool = new QThreadPool();
|
||||||
|
QThread::msleep(333);
|
||||||
|
|
||||||
if(pool->maxThreadCount() < 2)
|
if(pool->maxThreadCount() < 2)
|
||||||
{
|
{
|
||||||
@ -139,13 +146,15 @@ void FileAnalyzer::run()
|
|||||||
|
|
||||||
AnalyzeTask *task = new AnalyzeTask(currentFile, m_templateFile->filePath(), &m_abortFlag);
|
AnalyzeTask *task = new AnalyzeTask(currentFile, m_templateFile->filePath(), &m_abortFlag);
|
||||||
connect(task, SIGNAL(fileSelected(QString)), this, SIGNAL(fileSelected(QString)), Qt::DirectConnection);
|
connect(task, SIGNAL(fileSelected(QString)), this, SIGNAL(fileSelected(QString)), Qt::DirectConnection);
|
||||||
|
connect(task, SIGNAL(progressValChanged(unsigned int)), this, SIGNAL(progressValChanged(unsigned int)), Qt::DirectConnection);
|
||||||
|
connect(task, SIGNAL(progressMaxChanged(unsigned int)), this, SIGNAL(progressMaxChanged(unsigned int)), Qt::DirectConnection);
|
||||||
connect(task, SIGNAL(fileAnalyzed(AudioFileModel)), this, SIGNAL(fileAnalyzed(AudioFileModel)), Qt::DirectConnection);
|
connect(task, SIGNAL(fileAnalyzed(AudioFileModel)), this, SIGNAL(fileAnalyzed(AudioFileModel)), Qt::DirectConnection);
|
||||||
|
|
||||||
while(!pool->tryStart(task))
|
while(!pool->tryStart(task))
|
||||||
{
|
{
|
||||||
if(!AnalyzeTask::waitForOneThread(1250))
|
if(!AnalyzeTask::waitForOneThread(1250))
|
||||||
{
|
{
|
||||||
qWarning("FileAnalyzer::run() -> Timeout !!!");
|
qWarning("FileAnalyzer: Timeout, retrying!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(m_abortFlag)
|
if(m_abortFlag)
|
||||||
@ -162,8 +171,10 @@ void FileAnalyzer::run()
|
|||||||
MessageBeep(MB_ICONERROR);
|
MessageBeep(MB_ICONERROR);
|
||||||
m_bAborted = true;
|
m_bAborted = true;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
QThread::yieldCurrentThread();
|
{
|
||||||
|
QThread::msleep(5);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//One of the Analyze tasks may have gathered additional files from a playlist!
|
//One of the Analyze tasks may have gathered additional files from a playlist!
|
||||||
@ -171,6 +182,8 @@ void FileAnalyzer::run()
|
|||||||
{
|
{
|
||||||
pool->waitForDone();
|
pool->waitForDone();
|
||||||
AnalyzeTask::getAdditionalFiles(m_inputFiles);
|
AnalyzeTask::getAdditionalFiles(m_inputFiles);
|
||||||
|
nFiles += m_inputFiles.count();
|
||||||
|
emit progressMaxChanged(nFiles);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,6 +55,8 @@ public:
|
|||||||
signals:
|
signals:
|
||||||
void fileSelected(const QString &fileName);
|
void fileSelected(const QString &fileName);
|
||||||
void fileAnalyzed(const AudioFileModel &file);
|
void fileAnalyzed(const AudioFileModel &file);
|
||||||
|
void progressValChanged(unsigned int);
|
||||||
|
void progressMaxChanged(unsigned int);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void abortProcess(void) { m_abortFlag = true; }
|
void abortProcess(void) { m_abortFlag = true; }
|
||||||
|
@ -109,7 +109,10 @@ void AnalyzeTask::run_ex(void)
|
|||||||
int fileType = fileTypeNormal;
|
int fileType = fileTypeNormal;
|
||||||
QString currentFile = QDir::fromNativeSeparators(m_inputFile);
|
QString currentFile = QDir::fromNativeSeparators(m_inputFile);
|
||||||
qDebug("Analyzing: %s", currentFile.toUtf8().constData());
|
qDebug("Analyzing: %s", currentFile.toUtf8().constData());
|
||||||
|
|
||||||
emit fileSelected(QFileInfo(currentFile).fileName());
|
emit fileSelected(QFileInfo(currentFile).fileName());
|
||||||
|
emit progressValChanged(m_threadIdx + 1);
|
||||||
|
|
||||||
AudioFileModel file = analyzeFile(currentFile, &fileType);
|
AudioFileModel file = analyzeFile(currentFile, &fileType);
|
||||||
|
|
||||||
if(*m_abortFlag)
|
if(*m_abortFlag)
|
||||||
@ -725,7 +728,7 @@ void AnalyzeTask::waitForPreviousThreads(void)
|
|||||||
|
|
||||||
if(!AnalyzeTask::waitForOneThread(1250))
|
if(!AnalyzeTask::waitForOneThread(1250))
|
||||||
{
|
{
|
||||||
qWarning("AnalyzeTask::waitForPreviousThreads -> Timeout !!!");
|
qWarning("FileAnalyzerTask: Timeout, retrying!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -66,6 +66,8 @@ public:
|
|||||||
signals:
|
signals:
|
||||||
void fileSelected(const QString &fileName);
|
void fileSelected(const QString &fileName);
|
||||||
void fileAnalyzed(const AudioFileModel &file);
|
void fileAnalyzed(const AudioFileModel &file);
|
||||||
|
void progressValChanged(unsigned int);
|
||||||
|
void progressMaxChanged(unsigned int);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void run(void);
|
void run(void);
|
||||||
|
Loading…
Reference in New Issue
Block a user