Prevent adding files while there are pop-up windows open.

This commit is contained in:
LoRd_MuldeR 2014-01-16 22:35:28 +01:00
parent 2c68a972db
commit f6183c9a60
2 changed files with 17 additions and 3 deletions

View File

@ -213,6 +213,7 @@ void CMainWindow::closeEvent(QCloseEvent *event)
{ {
if(!APPLICATION_IS_IDLE) if(!APPLICATION_IS_IDLE)
{ {
qWarning("Cannot exit program at this time!");
event->ignore(); event->ignore();
} }
} }
@ -364,6 +365,8 @@ void CMainWindow::analyzeNextFile(void)
return; return;
} }
m_status = APP_STATUS_WORKING;
//Lookup MediaInfo path //Lookup MediaInfo path
const QString mediaInfoPath = getMediaInfoPath(); const QString mediaInfoPath = getMediaInfoPath();
if(mediaInfoPath.isEmpty()) if(mediaInfoPath.isEmpty())
@ -412,11 +415,14 @@ void CMainWindow::analyzeButtonClicked(void)
{ {
if(!APPLICATION_IS_IDLE) if(!APPLICATION_IS_IDLE)
{ {
qWarning("Cannot process files at this time!\n"); qWarning("Cannot open files at this time!\n");
return; return;
} }
m_status = APP_STATUS_BLOCKED;
const QStringList selectedFiles = QFileDialog::getOpenFileNames(this, tr("Select file to analyze..."), QString(), tr("All supported media files (*.*)")); const QStringList selectedFiles = QFileDialog::getOpenFileNames(this, tr("Select file to analyze..."), QString(), tr("All supported media files (*.*)"));
m_status = APP_STATUS_IDLE;
if(!selectedFiles.isEmpty()) if(!selectedFiles.isEmpty())
{ {
m_pendingFiles.clear(); m_pendingFiles.clear();
@ -434,7 +440,10 @@ void CMainWindow::saveButtonClicked(void)
return; return;
} }
m_status = APP_STATUS_BLOCKED;
const QString selectedFile = QFileDialog::getSaveFileName(this, tr("Select file to save..."), QString(), tr("Plain Text (*.txt)")); const QString selectedFile = QFileDialog::getSaveFileName(this, tr("Select file to save..."), QString(), tr("Plain Text (*.txt)"));
m_status = APP_STATUS_IDLE;
if(!selectedFile.isEmpty()) if(!selectedFile.isEmpty())
{ {
QFile file(selectedFile); QFile file(selectedFile);
@ -604,7 +613,7 @@ void CMainWindow::showAboutScreen(void)
{ {
if(!APPLICATION_IS_IDLE) if(!APPLICATION_IS_IDLE)
{ {
qWarning("Cannot process files at this time!\n"); qWarning("Cannot show about box at this time!\n");
return; return;
} }
@ -643,6 +652,8 @@ void CMainWindow::showAboutScreen(void)
aboutBox.setEscapeButton(btn); aboutBox.setEscapeButton(btn);
} }
m_status = APP_STATUS_BLOCKED;
forever forever
{ {
const int ret = aboutBox.exec(); const int ret = aboutBox.exec();
@ -653,6 +664,8 @@ void CMainWindow::showAboutScreen(void)
} }
break; break;
} }
m_status = APP_STATUS_IDLE;
} }
void CMainWindow::updateSize(void) void CMainWindow::updateSize(void)

View File

@ -74,7 +74,8 @@ private:
APP_STATUS_STARTING = 0, APP_STATUS_STARTING = 0,
APP_STATUS_IDLE = 1, APP_STATUS_IDLE = 1,
APP_STATUS_AWAITING = 2, APP_STATUS_AWAITING = 2,
APP_STATUS_WORKING = 3 APP_STATUS_WORKING = 3,
APP_STATUS_BLOCKED = 4
} }
status_t; status_t;