Small tweak to the initialization of the encoding process.

This commit is contained in:
LoRd_MuldeR 2023-09-26 21:42:22 +02:00
parent 87bc19732e
commit 550ef315c4
2 changed files with 10 additions and 5 deletions

View File

@ -375,13 +375,11 @@ void ProcessingDialog::showEvent(QShowEvent *event)
ui->button_closeDialog->setEnabled(false); ui->button_closeDialog->setEnabled(false);
ui->button_AbortProcess->setEnabled(false); ui->button_AbortProcess->setEnabled(false);
MUtils::OS::change_process_priority(1);
ui->label_cpu->setText(NA); ui->label_cpu->setText(NA);
ui->label_disk->setText(NA); ui->label_disk->setText(NA);
ui->label_ram->setText(NA); ui->label_ram->setText(NA);
QTimer::singleShot(500, this, SLOT(initEncoding())); QTimer::singleShot(100, this, SLOT(initEncodingLater()));
m_firstShow = false; m_firstShow = false;
} }
@ -472,6 +470,11 @@ void ProcessingDialog::resizeEvent(QResizeEvent *event)
// SLOTS // SLOTS
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void ProcessingDialog::initEncodingLater(void)
{
QTimer::singleShot(100, this, SLOT(initEncoding()));
}
void ProcessingDialog::initEncoding(void) void ProcessingDialog::initEncoding(void)
{ {
qDebug("Initializing encoding process..."); qDebug("Initializing encoding process...");
@ -486,6 +489,7 @@ void ProcessingDialog::initEncoding(void)
m_playList.clear(); m_playList.clear();
m_progressIndicator->start(); m_progressIndicator->start();
MUtils::OS::change_process_priority(1);
DecoderRegistry::configureDecoders(m_settings); DecoderRegistry::configureDecoders(m_settings);
CHANGE_BACKGROUND_COLOR(ui->frame_header, QColor(Qt::white)); CHANGE_BACKGROUND_COLOR(ui->frame_header, QColor(Qt::white));
@ -544,7 +548,7 @@ void ProcessingDialog::initNextJob(void)
startNextJob(); startNextJob();
if(--m_initThreads > 0) 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)) 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()); qDebug("%d files left, starting next job...", m_pendingJobs.count());
return; return;
} }

View File

@ -77,6 +77,7 @@ public:
int getShutdownFlag(void) { return m_shutdownFlag; } int getShutdownFlag(void) { return m_shutdownFlag; }
private slots: private slots:
void initEncodingLater(void);
void initEncoding(void); void initEncoding(void);
void initNextJob(void); void initNextJob(void);
void startNextJob(void); void startNextJob(void);