From 550ef315c405e420ad6ef5b67501c4eb68c56ffc Mon Sep 17 00:00:00 2001 From: LoRd_MuldeR Date: Tue, 26 Sep 2023 21:42:22 +0200 Subject: [PATCH] Small tweak to the initialization of the encoding process. --- src/Dialog_Processing.cpp | 14 +++++++++----- src/Dialog_Processing.h | 1 + 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/Dialog_Processing.cpp b/src/Dialog_Processing.cpp index f81a500c..75a1ab1a 100644 --- a/src/Dialog_Processing.cpp +++ b/src/Dialog_Processing.cpp @@ -375,13 +375,11 @@ void ProcessingDialog::showEvent(QShowEvent *event) ui->button_closeDialog->setEnabled(false); ui->button_AbortProcess->setEnabled(false); - MUtils::OS::change_process_priority(1); - ui->label_cpu->setText(NA); ui->label_disk->setText(NA); ui->label_ram->setText(NA); - QTimer::singleShot(500, this, SLOT(initEncoding())); + QTimer::singleShot(100, this, SLOT(initEncodingLater())); m_firstShow = false; } @@ -472,6 +470,11 @@ void ProcessingDialog::resizeEvent(QResizeEvent *event) // SLOTS //////////////////////////////////////////////////////////// +void ProcessingDialog::initEncodingLater(void) +{ + QTimer::singleShot(100, this, SLOT(initEncoding())); +} + void ProcessingDialog::initEncoding(void) { qDebug("Initializing encoding process..."); @@ -486,6 +489,7 @@ void ProcessingDialog::initEncoding(void) m_playList.clear(); m_progressIndicator->start(); + MUtils::OS::change_process_priority(1); DecoderRegistry::configureDecoders(m_settings); CHANGE_BACKGROUND_COLOR(ui->frame_header, QColor(Qt::white)); @@ -544,7 +548,7 @@ void ProcessingDialog::initNextJob(void) startNextJob(); if(--m_initThreads > 0) { - QTimer::singleShot(32, this, SLOT(initNextJob())); + QTimer::singleShot(50, this, SLOT(initNextJob())); } } } @@ -675,7 +679,7 @@ void ProcessingDialog::doneEncoding(void) if((!m_pendingJobs.isEmpty()) && (!m_userAborted)) { - QTimer::singleShot(0, this, SLOT(startNextJob())); + QTimer::singleShot(25, this, SLOT(startNextJob())); qDebug("%d files left, starting next job...", m_pendingJobs.count()); return; } diff --git a/src/Dialog_Processing.h b/src/Dialog_Processing.h index e8601c68..4ff2196c 100644 --- a/src/Dialog_Processing.h +++ b/src/Dialog_Processing.h @@ -77,6 +77,7 @@ public: int getShutdownFlag(void) { return m_shutdownFlag; } private slots: + void initEncodingLater(void); void initEncoding(void); void initNextJob(void); void startNextJob(void);