Made the ProgressModel expose the QIcon's, so we can re-use them int the ProcessingDialog instead of maintaining a separate set of icons there.
This commit is contained in:
parent
c180306e85
commit
93f8e28620
@ -30,7 +30,7 @@
|
|||||||
#define VER_LAMEXP_MINOR_LO 7
|
#define VER_LAMEXP_MINOR_LO 7
|
||||||
#define VER_LAMEXP_TYPE Alpha
|
#define VER_LAMEXP_TYPE Alpha
|
||||||
#define VER_LAMEXP_PATCH 3
|
#define VER_LAMEXP_PATCH 3
|
||||||
#define VER_LAMEXP_BUILD 1189
|
#define VER_LAMEXP_BUILD 1192
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// Tool versions (minimum expected versions!)
|
// Tool versions (minimum expected versions!)
|
||||||
|
@ -117,6 +117,19 @@ while(0)
|
|||||||
} \
|
} \
|
||||||
while(0)
|
while(0)
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
//Dummy class for UserData
|
||||||
|
class IntUserData : public QObjectUserData
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
IntUserData(int value) : m_value(value) {/*NOP*/}
|
||||||
|
int value(void) { return m_value; }
|
||||||
|
void setValue(int value) { m_value = value; }
|
||||||
|
private:
|
||||||
|
int m_value;
|
||||||
|
};
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Constructor
|
// Constructor
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
@ -190,11 +203,11 @@ ProcessingDialog::ProcessingDialog(FileListModel *fileListModel, AudioFileModel
|
|||||||
QAction *contextMenuFilterAction[5] = {NULL, NULL, NULL, NULL, NULL};
|
QAction *contextMenuFilterAction[5] = {NULL, NULL, NULL, NULL, NULL};
|
||||||
if(QMenu *filterMenu = m_contextMenu->addMenu(QIcon(":/icons/filter.png"), tr("Filter Log Items")))
|
if(QMenu *filterMenu = m_contextMenu->addMenu(QIcon(":/icons/filter.png"), tr("Filter Log Items")))
|
||||||
{
|
{
|
||||||
contextMenuFilterAction[0] = filterMenu->addAction(QIcon(":/icons/media_play.png"), tr("Show Running Only"));
|
contextMenuFilterAction[0] = filterMenu->addAction(m_progressModel->getIcon(ProgressModel::JobRunning), tr("Show Running Only"));
|
||||||
contextMenuFilterAction[1] = filterMenu->addAction(QIcon(":/icons/tick.png"), tr("Show Succeeded Only"));
|
contextMenuFilterAction[1] = filterMenu->addAction(m_progressModel->getIcon(ProgressModel::JobComplete), tr("Show Succeeded Only"));
|
||||||
contextMenuFilterAction[2] = filterMenu->addAction(QIcon(":/icons/exclamation.png"), tr("Show Failed Only"));
|
contextMenuFilterAction[2] = filterMenu->addAction(m_progressModel->getIcon(ProgressModel::JobFailed), tr("Show Failed Only"));
|
||||||
contextMenuFilterAction[3] = filterMenu->addAction(QIcon(":/icons/step_over.png"), tr("Show Skipped Only"));
|
contextMenuFilterAction[3] = filterMenu->addAction(m_progressModel->getIcon(ProgressModel::JobSkipped), tr("Show Skipped Only"));
|
||||||
contextMenuFilterAction[4] = filterMenu->addAction(QIcon(":/icons/report.png"), tr("Show All Items"));
|
contextMenuFilterAction[4] = filterMenu->addAction(m_progressModel->getIcon(ProgressModel::JobState(-1)), tr("Show All Items"));
|
||||||
if(QAction *act = contextMenuFilterAction[0]) { m_progressViewFilterGroup->addAction(act); act->setCheckable(true); act->setData(ProgressModel::JobRunning); }
|
if(QAction *act = contextMenuFilterAction[0]) { m_progressViewFilterGroup->addAction(act); act->setCheckable(true); act->setData(ProgressModel::JobRunning); }
|
||||||
if(QAction *act = contextMenuFilterAction[1]) { m_progressViewFilterGroup->addAction(act); act->setCheckable(true); act->setData(ProgressModel::JobComplete); }
|
if(QAction *act = contextMenuFilterAction[1]) { m_progressViewFilterGroup->addAction(act); act->setCheckable(true); act->setData(ProgressModel::JobComplete); }
|
||||||
if(QAction *act = contextMenuFilterAction[2]) { m_progressViewFilterGroup->addAction(act); act->setCheckable(true); act->setData(ProgressModel::JobFailed); }
|
if(QAction *act = contextMenuFilterAction[2]) { m_progressViewFilterGroup->addAction(act); act->setCheckable(true); act->setData(ProgressModel::JobFailed); }
|
||||||
@ -206,14 +219,24 @@ ProcessingDialog::ProcessingDialog(FileListModel *fileListModel, AudioFileModel
|
|||||||
if(m_filterInfoLabel = new QLabel(view_log))
|
if(m_filterInfoLabel = new QLabel(view_log))
|
||||||
{
|
{
|
||||||
m_filterInfoLabel->setFrameShape(QFrame::NoFrame);
|
m_filterInfoLabel->setFrameShape(QFrame::NoFrame);
|
||||||
m_filterInfoLabel->setAlignment(Qt::AlignHCenter | Qt::AlignTop);
|
m_filterInfoLabel->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||||
m_filterInfoLabel->setUserData(0, reinterpret_cast<QObjectUserData*>(-1));
|
m_filterInfoLabel->setUserData(0, new IntUserData(-1));
|
||||||
SET_FONT_BOLD(m_filterInfoLabel, true);
|
SET_FONT_BOLD(m_filterInfoLabel, true);
|
||||||
SET_TEXT_COLOR(m_filterInfoLabel, Qt::darkGray);
|
SET_TEXT_COLOR(m_filterInfoLabel, Qt::darkGray);
|
||||||
m_filterInfoLabel->setContextMenuPolicy(Qt::CustomContextMenu);
|
m_filterInfoLabel->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
connect(m_filterInfoLabel, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuTriggered(QPoint)));
|
connect(m_filterInfoLabel, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuTriggered(QPoint)));
|
||||||
m_filterInfoLabel->hide();
|
m_filterInfoLabel->hide();
|
||||||
}
|
}
|
||||||
|
if(m_filterInfoLabelIcon = new QLabel(view_log))
|
||||||
|
{
|
||||||
|
m_filterInfoLabelIcon->setFrameShape(QFrame::NoFrame);
|
||||||
|
m_filterInfoLabelIcon->setAlignment(Qt::AlignHCenter | Qt::AlignTop);
|
||||||
|
m_filterInfoLabelIcon->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
|
const QIcon &ico = m_progressModel->getIcon(ProgressModel::JobState(-1));
|
||||||
|
m_filterInfoLabelIcon->setPixmap(ico.pixmap(16, 16));
|
||||||
|
connect(m_filterInfoLabelIcon, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuTriggered(QPoint)));
|
||||||
|
m_filterInfoLabelIcon->hide();
|
||||||
|
}
|
||||||
|
|
||||||
//Connect context menu
|
//Connect context menu
|
||||||
view_log->setContextMenuPolicy(Qt::CustomContextMenu);
|
view_log->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
@ -259,6 +282,8 @@ ProcessingDialog::ProcessingDialog(FileListModel *fileListModel, AudioFileModel
|
|||||||
|
|
||||||
ProcessingDialog::~ProcessingDialog(void)
|
ProcessingDialog::~ProcessingDialog(void)
|
||||||
{
|
{
|
||||||
|
fprintf(stderr, "BUMP 1\n"); fflush(stderr);
|
||||||
|
|
||||||
view_log->setModel(NULL);
|
view_log->setModel(NULL);
|
||||||
|
|
||||||
if(m_progressIndicator)
|
if(m_progressIndicator)
|
||||||
@ -294,17 +319,7 @@ ProcessingDialog::~ProcessingDialog(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LAMEXP_DELETE(m_progressIndicator);
|
fprintf(stderr, "BUMP 2\n"); fflush(stderr);
|
||||||
LAMEXP_DELETE(m_progressModel);
|
|
||||||
LAMEXP_DELETE(m_contextMenu);
|
|
||||||
LAMEXP_DELETE(m_systemTray);
|
|
||||||
LAMEXP_DELETE(m_diskObserver);
|
|
||||||
LAMEXP_DELETE(m_cpuObserver);
|
|
||||||
LAMEXP_DELETE(m_ramObserver);
|
|
||||||
LAMEXP_DELETE(m_progressViewFilterGroup);
|
|
||||||
|
|
||||||
WinSevenTaskbar::setOverlayIcon(this, NULL);
|
|
||||||
WinSevenTaskbar::setTaskbarState(this, WinSevenTaskbar::WinSevenTaskbarNoState);
|
|
||||||
|
|
||||||
while(!m_threadList.isEmpty())
|
while(!m_threadList.isEmpty())
|
||||||
{
|
{
|
||||||
@ -314,6 +329,25 @@ ProcessingDialog::~ProcessingDialog(void)
|
|||||||
delete thread;
|
delete thread;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fprintf(stderr, "BUMP 3\n"); fflush(stderr);
|
||||||
|
|
||||||
|
LAMEXP_DELETE(m_progressIndicator);
|
||||||
|
LAMEXP_DELETE(m_systemTray);
|
||||||
|
LAMEXP_DELETE(m_diskObserver);
|
||||||
|
LAMEXP_DELETE(m_cpuObserver);
|
||||||
|
LAMEXP_DELETE(m_ramObserver);
|
||||||
|
LAMEXP_DELETE(m_progressViewFilterGroup);
|
||||||
|
LAMEXP_DELETE(m_filterInfoLabel);
|
||||||
|
LAMEXP_DELETE(m_filterInfoLabelIcon);
|
||||||
|
LAMEXP_DELETE(m_contextMenu);
|
||||||
|
LAMEXP_DELETE(m_progressModel);
|
||||||
|
|
||||||
|
fprintf(stderr, "BUMP 4\n"); fflush(stderr);
|
||||||
|
|
||||||
|
WinSevenTaskbar::setOverlayIcon(this, NULL);
|
||||||
|
WinSevenTaskbar::setTaskbarState(this, WinSevenTaskbar::WinSevenTaskbarNoState);
|
||||||
|
|
||||||
|
fprintf(stderr, "BUMP 5\n"); fflush(stderr);
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
@ -426,7 +460,8 @@ void ProcessingDialog::resizeEvent(QResizeEvent *event)
|
|||||||
if(QWidget *port = view_log->viewport())
|
if(QWidget *port = view_log->viewport())
|
||||||
{
|
{
|
||||||
QRect geom = port->geometry();
|
QRect geom = port->geometry();
|
||||||
m_filterInfoLabel->setGeometry(geom.left() + 16, geom.top() + 16, geom.width() - 32, geom.height() - 32);
|
m_filterInfoLabel->setGeometry(geom.left() + 16, geom.top() + 16, geom.width() - 32, 48);
|
||||||
|
m_filterInfoLabelIcon->setGeometry(geom.left() + 16, geom.top() + 64, geom.width() - 32, geom.height() - 80);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -803,38 +838,31 @@ void ProcessingDialog::contextMenuFilterActionTriggered(void)
|
|||||||
*/
|
*/
|
||||||
void ProcessingDialog::progressViewFilterChanged(void)
|
void ProcessingDialog::progressViewFilterChanged(void)
|
||||||
{
|
{
|
||||||
unsigned int counter = 0;
|
bool matchFound = false;
|
||||||
|
|
||||||
for(int i = 0; i < view_log->model()->rowCount(); i++)
|
for(int i = 0; i < view_log->model()->rowCount(); i++)
|
||||||
{
|
{
|
||||||
QModelIndex index = (m_progressViewFilter >= 0) ? m_progressModel->index(i, 0) : QModelIndex();
|
QModelIndex index = (m_progressViewFilter >= 0) ? m_progressModel->index(i, 0) : QModelIndex();
|
||||||
const bool bHide = index.isValid() ? (m_progressModel->getJobState(index) != m_progressViewFilter) : false;
|
const bool bHide = index.isValid() ? (m_progressModel->getJobState(index) != m_progressViewFilter) : false;
|
||||||
view_log->setRowHidden(i, bHide);
|
view_log->setRowHidden(i, bHide); matchFound = matchFound || (!bHide);
|
||||||
if(!bHide) counter++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if((m_progressViewFilter >= 0) && (counter == 0))
|
if((m_progressViewFilter >= 0) && (!matchFound))
|
||||||
{
|
{
|
||||||
if(m_filterInfoLabel->isHidden() || (m_filterInfoLabel->userData(0) != reinterpret_cast<QObjectUserData*>(m_progressViewFilter)))
|
if(m_filterInfoLabel->isHidden() || (dynamic_cast<IntUserData*>(m_filterInfoLabel->userData(0))->value() != m_progressViewFilter))
|
||||||
{
|
{
|
||||||
QString iconPath;
|
dynamic_cast<IntUserData*>(m_filterInfoLabel->userData(0))->setValue(m_progressViewFilter);
|
||||||
switch(m_progressViewFilter)
|
m_filterInfoLabel->setText(QString("<p>» %1 «</p>").arg(tr("None of the items matches the current filtering rules")));
|
||||||
{
|
|
||||||
case ProgressModel::JobRunning: iconPath = ":/icons/media_play.png"; break;
|
|
||||||
case ProgressModel::JobComplete: iconPath = ":/icons/tick.png"; break;
|
|
||||||
case ProgressModel::JobFailed: iconPath = ":/icons/exclamation.png"; break;
|
|
||||||
case ProgressModel::JobSkipped: iconPath = ":/icons/step_over.png"; break;
|
|
||||||
default: iconPath = ":/icons/report.png"; break;
|
|
||||||
}
|
|
||||||
m_filterInfoLabel->show();
|
m_filterInfoLabel->show();
|
||||||
m_filterInfoLabel->setText(QString("» %1 «<br><br><img src=\"%2\">").arg(tr("None of the items matches the current filtering rules"), iconPath));
|
m_filterInfoLabelIcon->setPixmap(m_progressModel->getIcon(static_cast<ProgressModel::JobState>(m_progressViewFilter)).pixmap(16, 16, QIcon::Disabled));
|
||||||
m_filterInfoLabel->setUserData(0, reinterpret_cast<QObjectUserData*>(m_progressViewFilter));
|
m_filterInfoLabelIcon->show();
|
||||||
resizeEvent(NULL);
|
resizeEvent(NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(!m_filterInfoLabel->isHidden())
|
else if(!m_filterInfoLabel->isHidden())
|
||||||
{
|
{
|
||||||
m_filterInfoLabel->hide();
|
m_filterInfoLabel->hide();
|
||||||
|
m_filterInfoLabelIcon->hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,6 +100,7 @@ private:
|
|||||||
QMenu *m_contextMenu;
|
QMenu *m_contextMenu;
|
||||||
QActionGroup *m_progressViewFilterGroup;
|
QActionGroup *m_progressViewFilterGroup;
|
||||||
QLabel *m_filterInfoLabel;
|
QLabel *m_filterInfoLabel;
|
||||||
|
QLabel *m_filterInfoLabelIcon;
|
||||||
unsigned int m_runningThreads;
|
unsigned int m_runningThreads;
|
||||||
unsigned int m_currentFile;
|
unsigned int m_currentFile;
|
||||||
QList<QUuid> m_allJobs;
|
QList<QUuid> m_allJobs;
|
||||||
|
@ -34,7 +34,8 @@ ProgressModel::ProgressModel(void)
|
|||||||
m_iconSystem(":/icons/computer.png"),
|
m_iconSystem(":/icons/computer.png"),
|
||||||
m_iconWarning(":/icons/error.png"),
|
m_iconWarning(":/icons/error.png"),
|
||||||
m_iconPerformance(":/icons/clock.png"),
|
m_iconPerformance(":/icons/clock.png"),
|
||||||
m_iconSkipped(":/icons/step_over.png")
|
m_iconSkipped(":/icons/step_over.png"),
|
||||||
|
m_iconUndefined(":/icons/report.png")
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,33 +74,8 @@ QVariant ProgressModel::data(const QModelIndex &index, int role) const
|
|||||||
}
|
}
|
||||||
else if(role == Qt::DecorationRole && index.column() == 0)
|
else if(role == Qt::DecorationRole && index.column() == 0)
|
||||||
{
|
{
|
||||||
switch(m_jobState.value(m_jobList.at(index.row())))
|
const int currentState = m_jobState.value(m_jobList.at(index.row()));
|
||||||
{
|
return getIcon(static_cast<const JobState>(currentState));
|
||||||
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 m_iconFailed;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if(role == Qt::TextAlignmentRole)
|
else if(role == Qt::TextAlignmentRole)
|
||||||
{
|
{
|
||||||
@ -212,7 +188,7 @@ const QStringList &ProgressModel::getLogFile(const QModelIndex &index)
|
|||||||
return *(reinterpret_cast<QStringList*>(NULL));
|
return *(reinterpret_cast<QStringList*>(NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
const QUuid &ProgressModel::getJobId(const QModelIndex &index)
|
const QUuid &ProgressModel::getJobId(const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
if(index.row() < m_jobList.count())
|
if(index.row() < m_jobList.count())
|
||||||
{
|
{
|
||||||
@ -290,3 +266,34 @@ void ProgressModel::restoreHiddenItems(void)
|
|||||||
endResetModel();
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -66,8 +66,9 @@ public:
|
|||||||
|
|
||||||
//Public functions
|
//Public functions
|
||||||
const QStringList &getLogFile(const QModelIndex &index);
|
const QStringList &getLogFile(const QModelIndex &index);
|
||||||
const QUuid &getJobId(const QModelIndex &index);
|
const QUuid &getJobId(const QModelIndex &index) const;
|
||||||
const JobState getJobState(const QModelIndex &index) const;
|
const JobState getJobState(const QModelIndex &index) const;
|
||||||
|
const QIcon &ProgressModel::getIcon(ProgressModel::JobState state) const;
|
||||||
void restoreHiddenItems(void);
|
void restoreHiddenItems(void);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
@ -94,4 +95,5 @@ private:
|
|||||||
const QIcon m_iconWarning;
|
const QIcon m_iconWarning;
|
||||||
const QIcon m_iconPerformance;
|
const QIcon m_iconPerformance;
|
||||||
const QIcon m_iconSkipped;
|
const QIcon m_iconSkipped;
|
||||||
|
const QIcon m_iconUndefined;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user