///////////////////////////////////////////////////////////////////////////////
// LameXP - Audio Encoder Front-End
-// Copyright (C) 2004-2012 LoRd_MuldeR <MuldeR2@GMX.de>
+// Copyright (C) 2004-2020 LoRd_MuldeR <MuldeR2@GMX.de>
//
// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
+// it under the terms of the GNU GENERAL PUBLIC LICENSE as published by
// the Free Software Foundation; either version 2 of the License, or
-// (at your option) any later version.
+// (at your option) any later version; always including the non-optional
+// LAMEXP GNU GENERAL PUBLIC LICENSE ADDENDUM. See "License.txt" file!
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
#include <QUuid>
-#define MAX_DISPLAY_ITEMS 48
+#define MAX_DISPLAY_ITEMS 64
ProgressModel::ProgressModel(void)
:
m_iconFailed(":/icons/exclamation.png"),
m_iconSystem(":/icons/computer.png"),
m_iconWarning(":/icons/error.png"),
- m_iconPerformance(":/icons/clock.png")
+ m_iconPerformance(":/icons/clock.png"),
+ m_iconSkipped(":/icons/step_over.png"),
+ m_iconUndefined(":/icons/report.png"),
+ m_emptyUuid(0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00),
+ m_emptyList("Oups, no data available!")
{
}
}
else if(role == Qt::DecorationRole && index.column() == 0)
{
- switch(m_jobState.value(m_jobList.at(index.row())))
- {
- case JobRunning:
- return m_iconRunning;
- break;
- case JobPaused:
- return m_iconPaused;
- break;
- case JobComplete:
- return m_iconComplete;
- break;
- case JobSystem:
- return m_iconSystem;
- break;
- case JobWarning:
- return m_iconWarning;
- break;
- case JobPerformance:
- return m_iconPerformance;
- break;
- default:
- return m_iconFailed;
- break;
- }
+ const int currentState = m_jobState.value(m_jobList.at(index.row()));
+ return getIcon(static_cast<const JobState>(currentState));
}
else if(role == Qt::TextAlignmentRole)
{
}
}
-const QStringList &ProgressModel::getLogFile(const QModelIndex &index)
+const QStringList &ProgressModel::getLogFile(const QModelIndex &index) const
{
if(index.row() < m_jobList.count())
{
QUuid id = m_jobList.at(index.row());
- return m_jobLogFile[id];
+ QHash<QUuid,QStringList>::const_iterator iter = m_jobLogFile.constFind(id);
+ if(iter != m_jobLogFile.constEnd()) { return iter.value(); }
}
- return *(reinterpret_cast<QStringList*>(NULL));
+ return m_emptyList;
}
-const QUuid &ProgressModel::getJobId(const QModelIndex &index)
+const QUuid &ProgressModel::getJobId(const QModelIndex &index) const
{
if(index.row() < m_jobList.count())
{
return m_jobList.at(index.row());
}
- return *(reinterpret_cast<QUuid*>(NULL));
+ return m_emptyUuid;
+}
+
+const ProgressModel::JobState ProgressModel::getJobState(const QModelIndex &index) const
+{
+ if(index.row() < m_jobList.count())
+ {
+ return static_cast<JobState>(m_jobState.value(m_jobList.at(index.row()), -1));
+ }
+
+ return static_cast<JobState>(-1);
}
void ProgressModel::addSystemMessage(const QString &text, int type)
endResetModel();
}
}
+
+const QIcon &ProgressModel::getIcon(ProgressModel::JobState state) const
+{
+ switch(state)
+ {
+ case JobRunning:
+ return m_iconRunning;
+ break;
+ case JobPaused:
+ return m_iconPaused;
+ break;
+ case JobComplete:
+ return m_iconComplete;
+ break;
+ case JobSystem:
+ return m_iconSystem;
+ break;
+ case JobWarning:
+ return m_iconWarning;
+ break;
+ case JobPerformance:
+ return m_iconPerformance;
+ break;
+ case JobSkipped:
+ return m_iconSkipped;
+ break;
+ default:
+ return (state < 0) ? m_iconUndefined : m_iconFailed;
+ break;
+ }
+}