More detailed error output when process failed to create + use UUID's to index jobs.
This commit is contained in:
parent
3170f358fe
commit
092e664ad1
@ -13,6 +13,10 @@
|
||||
<property name="windowTitle">
|
||||
<string>LameXP - Processing</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="../res/Icons.qrc">
|
||||
<normaloff>:/icons/sound.png</normaloff>:/icons/sound.png</iconset>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
@ -169,7 +173,7 @@
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>12</width>
|
||||
<width>16</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
@ -428,6 +432,8 @@
|
||||
<include location="../res/Images.qrc"/>
|
||||
<include location="../res/Icons.qrc"/>
|
||||
<include location="../res/Images.qrc"/>
|
||||
<include location="../res/Icons.qrc"/>
|
||||
<include location="../res/Images.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
|
BIN
res/icons/media_play.png
Normal file
BIN
res/icons/media_play.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 663 B |
@ -25,7 +25,7 @@
|
||||
#define VER_LAMEXP_MAJOR 4
|
||||
#define VER_LAMEXP_MINOR_HI 0
|
||||
#define VER_LAMEXP_MINOR_LO 0
|
||||
#define VER_LAMEXP_BUILD 38
|
||||
#define VER_LAMEXP_BUILD 40
|
||||
#define VER_LAMEXP_SUFFIX TechPreview
|
||||
|
||||
/*
|
||||
|
@ -45,9 +45,14 @@ ProcessingDialog::ProcessingDialog(void)
|
||||
//Init the dialog, from the .ui file
|
||||
setupUi(this);
|
||||
setWindowFlags(windowFlags() ^ Qt::WindowContextHelpButtonHint);
|
||||
|
||||
//Setup version info
|
||||
label_versionInfo->setText(QString().sprintf("v%d.%02d %s (Build %d)", lamexp_version_major(), lamexp_version_minor(), lamexp_version_release(), lamexp_version_build()));
|
||||
label_versionInfo->installEventFilter(this);
|
||||
|
||||
//Register meta type
|
||||
qRegisterMetaType<QUuid>("QUuid");
|
||||
|
||||
//Center window in screen
|
||||
QRect desktopRect = QApplication::desktop()->screenGeometry();
|
||||
QRect thisRect = this->geometry();
|
||||
@ -102,7 +107,7 @@ void ProcessingDialog::showEvent(QShowEvent *event)
|
||||
|
||||
void ProcessingDialog::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
if(!button_closeDialog->isEnabled() || m_thread) event->ignore();
|
||||
if(!button_closeDialog->isEnabled()) event->ignore();
|
||||
}
|
||||
|
||||
bool ProcessingDialog::eventFilter(QObject *obj, QEvent *event)
|
||||
@ -149,8 +154,8 @@ void ProcessingDialog::initEncoding(void)
|
||||
{
|
||||
m_thread[i] = new ProcessThread();
|
||||
connect(m_thread[i], SIGNAL(finished()), this, SLOT(doneEncoding()), Qt::QueuedConnection);
|
||||
connect(m_thread[i], SIGNAL(processStateInitialized(QString,QString,QString,int)), m_progressModel, SLOT(addJob(QString,QString,QString,int)), Qt::QueuedConnection);
|
||||
connect(m_thread[i], SIGNAL(processStateChanged(QString,QString,int)), m_progressModel, SLOT(updateJob(QString,QString,int)), Qt::QueuedConnection);
|
||||
connect(m_thread[i], SIGNAL(processStateInitialized(QUuid,QString,QString,int)), m_progressModel, SLOT(addJob(QUuid,QString,QString,int)), Qt::QueuedConnection);
|
||||
connect(m_thread[i], SIGNAL(processStateChanged(QUuid,QString,int)), m_progressModel, SLOT(updateJob(QUuid,QString,int)), Qt::QueuedConnection);
|
||||
m_thread[i]->start();
|
||||
}
|
||||
|
||||
|
@ -21,6 +21,8 @@
|
||||
|
||||
#include "Model_Progress.h"
|
||||
|
||||
#include <QUuid>
|
||||
|
||||
ProgressModel::ProgressModel(void) :
|
||||
m_iconRunning(":/icons/media_play.png"),
|
||||
m_iconPaused(":/icons/control_pause_blue.png"),
|
||||
@ -113,34 +115,30 @@ QVariant ProgressModel::headerData(int section, Qt::Orientation orientation, int
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
void ProgressModel::addJob(const QString &jobId, const QString &jobName, const QString &jobInitialStatus, int jobInitialState)
|
||||
void ProgressModel::addJob(const QUuid &jobId, const QString &jobName, const QString &jobInitialStatus, int jobInitialState)
|
||||
{
|
||||
if(m_jobList.contains(jobId, Qt::CaseInsensitive))
|
||||
if(m_jobList.contains(jobId))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QString id = jobId.toLower();
|
||||
|
||||
beginResetModel();
|
||||
m_jobList.append(id);
|
||||
m_jobName.insert(id, jobName);
|
||||
m_jobStatus.insert(id, jobInitialStatus);
|
||||
m_jobState.insert(id, jobInitialState);
|
||||
m_jobList.append(jobId);
|
||||
m_jobName.insert(jobId, jobName);
|
||||
m_jobStatus.insert(jobId, jobInitialStatus);
|
||||
m_jobState.insert(jobId, jobInitialState);
|
||||
endResetModel();
|
||||
}
|
||||
|
||||
void ProgressModel::updateJob(const QString &jobId, const QString &newStatus, int newState)
|
||||
void ProgressModel::updateJob(const QUuid &jobId, const QString &newStatus, int newState)
|
||||
{
|
||||
if(!m_jobList.contains(jobId, Qt::CaseInsensitive))
|
||||
if(!m_jobList.contains(jobId))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QString id = jobId.toLower();
|
||||
|
||||
beginResetModel();
|
||||
if(!newStatus.isEmpty()) m_jobStatus.insert(id, newStatus);
|
||||
if(newState >= 0) m_jobState.insert(id, newState);
|
||||
if(!newStatus.isEmpty()) m_jobStatus.insert(jobId, newStatus);
|
||||
if(newState >= 0) m_jobState.insert(jobId, newState);
|
||||
endResetModel();
|
||||
}
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include <QStringList>
|
||||
#include <QMap>
|
||||
#include <QIcon>
|
||||
#include <QUuid>
|
||||
|
||||
class ProgressModel : public QAbstractTableModel
|
||||
{
|
||||
@ -52,14 +53,14 @@ public:
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
|
||||
|
||||
public slots:
|
||||
void addJob(const QString &jobId, const QString &jobName, const QString &jobInitialStatus = QString("Initializing..."), int jobInitialState = JobRunning);
|
||||
void updateJob(const QString &jobId, const QString &newStatus, int newState);
|
||||
void addJob(const QUuid &jobId, const QString &jobName, const QString &jobInitialStatus = QString("Initializing..."), int jobInitialState = JobRunning);
|
||||
void updateJob(const QUuid &jobId, const QString &newStatus, int newState);
|
||||
|
||||
private:
|
||||
QStringList m_jobList;
|
||||
QMap<QString, QString> m_jobName;
|
||||
QMap<QString, QString> m_jobStatus;
|
||||
QMap<QString, int> m_jobState;
|
||||
QList<QUuid> m_jobList;
|
||||
QMap<QUuid, QString> m_jobName;
|
||||
QMap<QUuid, QString> m_jobStatus;
|
||||
QMap<QUuid, int> m_jobState;
|
||||
|
||||
const QIcon m_iconRunning;
|
||||
const QIcon m_iconPaused;
|
||||
|
@ -116,6 +116,7 @@ const AudioFileModel FileAnalyzer::analyzeFile(const QString &filePath)
|
||||
if(!process.waitForStarted())
|
||||
{
|
||||
qWarning("MediaInfo process failed to create!");
|
||||
qWarning("Error message: \"%s\"\n", process.errorString().toLatin1().constData());
|
||||
process.kill();
|
||||
process.waitForFinished(-1);
|
||||
return audioFile;
|
||||
@ -134,10 +135,11 @@ const AudioFileModel FileAnalyzer::analyzeFile(const QString &filePath)
|
||||
}
|
||||
}
|
||||
|
||||
QByteArray data = process.readLine().constData();
|
||||
while(data.size() > 0)
|
||||
QByteArray data;
|
||||
|
||||
while(process.canReadLine())
|
||||
{
|
||||
QString line = QString::fromUtf8(data).simplified();
|
||||
QString line = QString::fromUtf8(process.readLine().constData()).simplified();
|
||||
if(!line.isEmpty())
|
||||
{
|
||||
int index = line.indexOf(':');
|
||||
@ -155,7 +157,6 @@ const AudioFileModel FileAnalyzer::analyzeFile(const QString &filePath)
|
||||
updateSection(line);
|
||||
}
|
||||
}
|
||||
data = process.readLine().constData();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -177,6 +177,7 @@ void InitializationThread::initNeroAac(void)
|
||||
if(!process.waitForStarted())
|
||||
{
|
||||
qWarning("Nero process failed to create!");
|
||||
qWarning("Error message: \"%s\"\n", process.errorString().toLatin1().constData());
|
||||
process.kill();
|
||||
process.waitForFinished(-1);
|
||||
for(int i = 0; i < 3; i++) LAMEXP_DELETE(neroBin[i]);
|
||||
@ -199,10 +200,9 @@ void InitializationThread::initNeroAac(void)
|
||||
}
|
||||
}
|
||||
|
||||
QByteArray data = process.readLine();
|
||||
while(!data.isEmpty())
|
||||
while(process.canReadLine())
|
||||
{
|
||||
QString line = QString::fromUtf8(data.constData()).simplified();
|
||||
QString line = QString::fromUtf8(process.readLine().constData()).simplified();
|
||||
QStringList tokens = line.split(" ", QString::SkipEmptyParts, Qt::CaseInsensitive);
|
||||
int index1 = tokens.indexOf("Package");
|
||||
int index2 = tokens.indexOf("version:");
|
||||
@ -218,7 +218,6 @@ void InitializationThread::initNeroAac(void)
|
||||
neroVersion += versionTokens.at(0).toInt() * 1000;
|
||||
}
|
||||
}
|
||||
data = process.readLine();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
ProcessThread::ProcessThread(void)
|
||||
: m_jobId(QUuid::createUuid().toString()), m_aborted(false)
|
||||
: m_jobId(QUuid::createUuid()), m_aborted(false)
|
||||
{
|
||||
}
|
||||
|
||||
@ -45,11 +45,11 @@ void ProcessThread::run()
|
||||
{
|
||||
m_aborted = false;
|
||||
|
||||
qDebug("Process thread %s has started.", m_jobId.toLatin1().constData());
|
||||
qDebug("Process thread %s has started.", m_jobId.toString().toLatin1().constData());
|
||||
emit processStateInitialized(m_jobId, "Slime - Der Tod Ist Ein Meister Aus Deutschland.mp3", "Starting...", ProgressModel::JobRunning);
|
||||
|
||||
QUuid uuid = QUuid::createUuid();
|
||||
qsrand(uuid.data1 * uuid.data2 * uuid.data3);
|
||||
qsrand(uuid.data1 * uuid.data2 * uuid.data3 * uuid.data4[0] * uuid.data4[1] * uuid.data4[2] * uuid.data4[3] * uuid.data4[4] * uuid.data4[5] * uuid.data4[6] * uuid.data4[7]);
|
||||
unsigned long delay = 250 + (qrand() % 500);
|
||||
|
||||
|
||||
@ -63,11 +63,10 @@ void ProcessThread::run()
|
||||
|
||||
QThread::msleep(delay);
|
||||
emit processStateChanged(m_jobId, QString("Encoding (%1%)").arg(i), ProgressModel::JobRunning);
|
||||
qDebug("Process thread is alive.");
|
||||
}
|
||||
|
||||
emit processStateChanged(m_jobId, "Done (100%)", ProgressModel::JobComplete);
|
||||
qDebug("Process thread is about to die...");
|
||||
qDebug("Process thread is done.");
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
@ -22,6 +22,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <QThread>
|
||||
#include <QUuid>
|
||||
|
||||
class ProcessThread: public QThread
|
||||
{
|
||||
@ -34,10 +35,10 @@ public:
|
||||
void abort() { m_aborted = true; }
|
||||
|
||||
signals:
|
||||
void processStateInitialized(const QString &jobId, const QString &jobName, const QString &jobInitialStatus, int jobInitialState);
|
||||
void processStateChanged(const QString &jobId, const QString &newStatus, int newState);
|
||||
void processStateInitialized(const QUuid &jobId, const QString &jobName, const QString &jobInitialStatus, int jobInitialState);
|
||||
void processStateChanged(const QUuid &jobId, const QString &newStatus, int newState);
|
||||
|
||||
private:
|
||||
const QString m_jobId;
|
||||
const QUuid m_jobId;
|
||||
volatile bool m_aborted;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user