Don't display more than 50 table items in the processing window. It seems Qt is getting a bit slow on updates when there are a lot of items in the table view...
This commit is contained in:
parent
76046b4ae5
commit
5c2961e109
@ -29,8 +29,8 @@
|
||||
#define VER_LAMEXP_MINOR_HI 0
|
||||
#define VER_LAMEXP_MINOR_LO 2
|
||||
#define VER_LAMEXP_TYPE RC
|
||||
#define VER_LAMEXP_PATCH 3
|
||||
#define VER_LAMEXP_BUILD 574
|
||||
#define VER_LAMEXP_PATCH 4
|
||||
#define VER_LAMEXP_BUILD 576
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Tools versions
|
||||
|
@ -415,6 +415,7 @@ void ProcessingDialog::doneEncoding(void)
|
||||
button_AbortProcess->setEnabled(false);
|
||||
checkBox_shutdownComputer->setEnabled(false);
|
||||
|
||||
m_progressModel->restoreHiddenItems();
|
||||
view_log->scrollToBottom();
|
||||
m_progressIndicator->stop();
|
||||
progressBar->setValue(progressBar->maximum());
|
||||
|
@ -23,6 +23,8 @@
|
||||
|
||||
#include <QUuid>
|
||||
|
||||
#define MAX_DISPLAY_ITEMS 50
|
||||
|
||||
ProgressModel::ProgressModel(void)
|
||||
:
|
||||
m_iconRunning(":/icons/media_play.png"),
|
||||
@ -130,11 +132,18 @@ QVariant ProgressModel::headerData(int section, Qt::Orientation orientation, int
|
||||
|
||||
void ProgressModel::addJob(const QUuid &jobId, const QString &jobName, const QString &jobInitialStatus, int jobInitialState)
|
||||
{
|
||||
if(m_jobList.contains(jobId))
|
||||
if(m_jobList.contains(jobId) || m_jobListHidden.contains(jobId))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
while(m_jobList.count() >= MAX_DISPLAY_ITEMS)
|
||||
{
|
||||
beginRemoveRows(QModelIndex(), 0, 0);
|
||||
m_jobListHidden.append(m_jobList.takeFirst());
|
||||
endRemoveRows();
|
||||
}
|
||||
|
||||
int newIndex = m_jobList.count();
|
||||
beginInsertRows(QModelIndex(), newIndex, newIndex);
|
||||
|
||||
@ -153,6 +162,11 @@ void ProgressModel::updateJob(const QUuid &jobId, const QString &newStatus, int
|
||||
|
||||
if(row < 0)
|
||||
{
|
||||
if(m_jobListHidden.indexOf(jobId) >= 0)
|
||||
{
|
||||
if(!newStatus.isEmpty()) m_jobStatus.insert(jobId, newStatus);
|
||||
if(newState >= 0) m_jobState.insert(jobId, newState);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@ -200,6 +214,13 @@ void ProgressModel::addSystemMessage(const QString &text, bool isWarning)
|
||||
return;
|
||||
}
|
||||
|
||||
while(m_jobList.count() >= MAX_DISPLAY_ITEMS)
|
||||
{
|
||||
beginRemoveRows(QModelIndex(), 0, 0);
|
||||
m_jobListHidden.append(m_jobList.takeFirst());
|
||||
endRemoveRows();
|
||||
}
|
||||
|
||||
int newIndex = m_jobList.count();
|
||||
beginInsertRows(QModelIndex(), newIndex, newIndex);
|
||||
|
||||
@ -211,3 +232,16 @@ void ProgressModel::addSystemMessage(const QString &text, bool isWarning)
|
||||
|
||||
endInsertRows();
|
||||
}
|
||||
|
||||
void ProgressModel::restoreHiddenItems(void)
|
||||
{
|
||||
if(!m_jobListHidden.isEmpty())
|
||||
{
|
||||
beginResetModel();
|
||||
while(!m_jobListHidden.isEmpty())
|
||||
{
|
||||
m_jobList.prepend(m_jobListHidden.takeLast());
|
||||
}
|
||||
endResetModel();
|
||||
}
|
||||
}
|
||||
|
@ -57,6 +57,7 @@ public:
|
||||
//Public functions
|
||||
const QStringList &getLogFile(const QModelIndex &index);
|
||||
const QUuid &getJobId(const QModelIndex &index);
|
||||
void restoreHiddenItems(void);
|
||||
|
||||
public slots:
|
||||
void addJob(const QUuid &jobId, const QString &jobName, const QString &jobInitialStatus = QString("Initializing..."), int jobInitialState = JobRunning);
|
||||
@ -66,6 +67,7 @@ public slots:
|
||||
|
||||
private:
|
||||
QList<QUuid> m_jobList;
|
||||
QList<QUuid> m_jobListHidden;
|
||||
QMap<QUuid, QString> m_jobName;
|
||||
QMap<QUuid, QString> m_jobStatus;
|
||||
QMap<QUuid, int> m_jobState;
|
||||
|
Loading…
x
Reference in New Issue
Block a user