Show notification in progress window, if multi-threading is activated.

This commit is contained in:
LoRd_MuldeR 2011-02-02 22:56:45 +01:00
parent 7206fe771e
commit d9e775b4b8
10 changed files with 72 additions and 9 deletions

View File

@ -1408,6 +1408,10 @@
<source>Encoding files, please wait...</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Multi-threading enabled: Running %1 instances in parallel!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Aborted! Waiting for running jobs to terminate...</source>
<translation type="unfinished"></translation>

View File

@ -1469,6 +1469,10 @@
<source>Process was aborted prematurely by the user!</source>
<translation>Der Vorgang wurde vom Benutzer abgebrochen!</translation>
</message>
<message>
<source>Multi-threading enabled: Running %1 instances in parallel!</source>
<translation>Multithreading aktiviert: Führe %1 Instanzen parallel aus!</translation>
</message>
</context>
<context>
<name>ProgressModel</name>

View File

@ -1469,6 +1469,10 @@
<source>Process was aborted prematurely by the user!</source>
<translation>¡El proceso fue cancelado prematuramente por el usuario!</translation>
</message>
<message>
<source>Multi-threading enabled: Running %1 instances in parallel!</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ProgressModel</name>

View File

@ -1471,6 +1471,10 @@ Votre dossier TEMP est situé ici:</translation>
<source>Process was aborted prematurely by the user!</source>
<translation>Le processus a é abandonné prématurément par l&apos;utilisateur !</translation>
</message>
<message>
<source>Multi-threading enabled: Running %1 instances in parallel!</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ProgressModel</name>

View File

@ -1469,6 +1469,10 @@
<source>Process was aborted prematurely by the user!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Multi-threading enabled: Running %1 instances in parallel!</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ProgressModel</name>

Binary file not shown.

View File

@ -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 289
#define VER_LAMEXP_BUILD 290
#define VER_LAMEXP_SUFFIX Beta-3
/*

View File

@ -259,8 +259,14 @@ void ProcessingDialog::initEncoding(void)
WinSevenTaskbar::setOverlayIcon(this, &QIcon(":/icons/control_play_blue.png"));
lamexp_cpu_t cpuFeatures = lamexp_detect_cpu_features();
int parallelThreadCount = max(min(min(cpuFeatures.count, m_pendingJobs.count()), 4), 1);
for(int i = 0; i < min(max(cpuFeatures.count, 1), 4); i++)
if(parallelThreadCount > 1)
{
m_progressModel->addSystemMessage(tr("Multi-threading enabled: Running %1 instances in parallel!").arg(QString::number(parallelThreadCount)));
}
for(int i = 0; i < parallelThreadCount; i++)
{
startNextJob();
}
@ -391,6 +397,9 @@ void ProcessingDialog::logViewDoubleClicked(const QModelIndex &index)
if(m_runningThreads == 0)
{
const QStringList &logFile = m_progressModel->getLogFile(index);
if(!logFile.isEmpty())
{
LogViewDialog *logView = new LogViewDialog(this);
logView->setWindowTitle(QString("LameXP - [%1]").arg(m_progressModel->data(index, Qt::DisplayRole).toString()));
logView->exec(logFile);
@ -401,6 +410,11 @@ void ProcessingDialog::logViewDoubleClicked(const QModelIndex &index)
MessageBeep(MB_ICONWARNING);
}
}
else
{
MessageBeep(MB_ICONWARNING);
}
}
void ProcessingDialog::contextMenuTriggered(const QPoint &pos)
{

View File

@ -23,11 +23,13 @@
#include <QUuid>
ProgressModel::ProgressModel(void) :
ProgressModel::ProgressModel(void)
:
m_iconRunning(":/icons/media_play.png"),
m_iconPaused(":/icons/control_pause_blue.png"),
m_iconComplete(":/icons/tick.png"),
m_iconFailed(":/icons/exclamation.png")
m_iconFailed(":/icons/exclamation.png"),
m_iconSystem(":/icons/computer.png")
{
}
@ -77,6 +79,9 @@ QVariant ProgressModel::data(const QModelIndex &index, int role) const
case JobComplete:
return m_iconComplete;
break;
case JobSystem:
return m_iconSystem;
break;
default:
return m_iconFailed;
break;
@ -171,3 +176,24 @@ const QStringList &ProgressModel::getLogFile(const QModelIndex &index)
return *(reinterpret_cast<QStringList*>(NULL));
}
void ProgressModel::addSystemMessage(const QString &text)
{
const QUuid &jobId = QUuid::createUuid();
if(m_jobList.contains(jobId))
{
return;
}
int newIndex = m_jobList.count();
beginInsertRows(QModelIndex(), newIndex, newIndex);
m_jobList.append(jobId);
m_jobName.insert(jobId, text);
m_jobStatus.insert(jobId, QString());
m_jobState.insert(jobId, JobSystem);
m_jobLogFile.insert(jobId, QStringList());
endInsertRows();
}

View File

@ -43,7 +43,8 @@ public:
JobRunning = 0,
JobPaused = 1,
JobComplete = 2,
JobFailed = 3
JobFailed = 3,
JobSystem = 4
};
//Model functions
@ -59,6 +60,7 @@ public slots:
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);
void appendToLog(const QUuid &jobId, const QString &line);
void addSystemMessage(const QString &text);
private:
QList<QUuid> m_jobList;
@ -71,4 +73,5 @@ private:
const QIcon m_iconPaused;
const QIcon m_iconComplete;
const QIcon m_iconFailed;
const QIcon m_iconSystem;
};