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