diff --git a/etc/Translation/Blank.ts b/etc/Translation/Blank.ts index a3d583e0..eb31a961 100644 --- a/etc/Translation/Blank.ts +++ b/etc/Translation/Blank.ts @@ -1408,6 +1408,10 @@ Encoding files, please wait... + + Multi-threading enabled: Running %1 instances in parallel! + + Aborted! Waiting for running jobs to terminate... diff --git a/etc/Translation/LameXP_DE.ts b/etc/Translation/LameXP_DE.ts index 63c6e070..63b6389e 100644 --- a/etc/Translation/LameXP_DE.ts +++ b/etc/Translation/LameXP_DE.ts @@ -1469,6 +1469,10 @@ Process was aborted prematurely by the user! Der Vorgang wurde vom Benutzer abgebrochen! + + Multi-threading enabled: Running %1 instances in parallel! + Multithreading aktiviert: Führe %1 Instanzen parallel aus! + ProgressModel diff --git a/etc/Translation/LameXP_ES.ts b/etc/Translation/LameXP_ES.ts index 48f4f60c..c1bbb895 100644 --- a/etc/Translation/LameXP_ES.ts +++ b/etc/Translation/LameXP_ES.ts @@ -1469,6 +1469,10 @@ Process was aborted prematurely by the user! ¡El proceso fue cancelado prematuramente por el usuario! + + Multi-threading enabled: Running %1 instances in parallel! + + ProgressModel diff --git a/etc/Translation/LameXP_FR.ts b/etc/Translation/LameXP_FR.ts index 1f757d89..5709a676 100644 --- a/etc/Translation/LameXP_FR.ts +++ b/etc/Translation/LameXP_FR.ts @@ -1471,6 +1471,10 @@ Votre dossier TEMP est situé ici: Process was aborted prematurely by the user! Le processus a été abandonné prématurément par l'utilisateur ! + + Multi-threading enabled: Running %1 instances in parallel! + + ProgressModel diff --git a/etc/Translation/LameXP_IT.ts b/etc/Translation/LameXP_IT.ts index 13bf33fc..c5272c8b 100644 --- a/etc/Translation/LameXP_IT.ts +++ b/etc/Translation/LameXP_IT.ts @@ -1469,6 +1469,10 @@ Process was aborted prematurely by the user! + + Multi-threading enabled: Running %1 instances in parallel! + + ProgressModel diff --git a/res/localization/LameXP_DE.qm b/res/localization/LameXP_DE.qm index 8ad4871f..4e15fc78 100644 Binary files a/res/localization/LameXP_DE.qm and b/res/localization/LameXP_DE.qm differ diff --git a/src/Config.h b/src/Config.h index 184f63ee..e80f383d 100644 --- a/src/Config.h +++ b/src/Config.h @@ -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 /* diff --git a/src/Dialog_Processing.cpp b/src/Dialog_Processing.cpp index bb225d03..8037c709 100644 --- a/src/Dialog_Processing.cpp +++ b/src/Dialog_Processing.cpp @@ -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,10 +397,18 @@ void ProcessingDialog::logViewDoubleClicked(const QModelIndex &index) if(m_runningThreads == 0) { const QStringList &logFile = m_progressModel->getLogFile(index); - LogViewDialog *logView = new LogViewDialog(this); - logView->setWindowTitle(QString("LameXP - [%1]").arg(m_progressModel->data(index, Qt::DisplayRole).toString())); - logView->exec(logFile); - LAMEXP_DELETE(logView); + + if(!logFile.isEmpty()) + { + LogViewDialog *logView = new LogViewDialog(this); + logView->setWindowTitle(QString("LameXP - [%1]").arg(m_progressModel->data(index, Qt::DisplayRole).toString())); + logView->exec(logFile); + LAMEXP_DELETE(logView); + } + else + { + MessageBeep(MB_ICONWARNING); + } } else { diff --git a/src/Model_Progress.cpp b/src/Model_Progress.cpp index f24a4521..58233c18 100644 --- a/src/Model_Progress.cpp +++ b/src/Model_Progress.cpp @@ -23,11 +23,13 @@ #include -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(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(); +} diff --git a/src/Model_Progress.h b/src/Model_Progress.h index a8128435..4afd251b 100644 --- a/src/Model_Progress.h +++ b/src/Model_Progress.h @@ -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 m_jobList; @@ -71,4 +73,5 @@ private: const QIcon m_iconPaused; const QIcon m_iconComplete; const QIcon m_iconFailed; + const QIcon m_iconSystem; };