[Qt] Improve CPU usage when no game is running, another fix to progress

dialog...
This commit is contained in:
Marcos Medeiros 2014-09-12 15:11:40 +00:00
parent 729f2aef2a
commit 805b291c6b
2 changed files with 12 additions and 5 deletions

View File

@ -51,8 +51,13 @@ int MainWindow::main(QApplication &app)
{
m_closeApp = false;
while (!m_closeApp) {
app.processEvents();
m_emulation->run();
if (m_isRunning) {
app.processEvents();
m_emulation->run();
} else {
app.processEvents();
QThread::msleep(10);
}
}
return 0;
}
@ -238,10 +243,10 @@ void MainWindow::disableInGame()
void MainWindow::drawLogo()
{
extern void RubyVidBlit(QImage &image);
extern void rubyBlitImage(QImage &image);
if (!m_isRunning) {
QApplication::processEvents();
RubyVidBlit(m_logo);
rubyBlitImage(m_logo);
}
}

View File

@ -41,7 +41,7 @@ static int ProgressUpdateBurn(double dProgress, const TCHAR *pszText, bool bAbs)
dlgProgress->setValue(nProgressMin + nProgressPosBurn + nProgressPosBurner);
}
}
QApplication::processEvents();
return 0;
}
@ -77,6 +77,8 @@ void ProgressCreate()
void ProgressDestroy()
{
dlgProgress->setValue(nProgressMax);
dlgProgress->close();
QApplication::processEvents();
BurnExtProgressRangeCallback = NULL;
BurnExtProgressUpdateCallback = NULL;
}