Make it possible to abort the operation when adding files or when scanning for directories. Press "ESC" key to abort!
This commit is contained in:
parent
8977e0073f
commit
fa2a5a3754
@ -64,8 +64,8 @@
|
|||||||
#include <QResource>
|
#include <QResource>
|
||||||
#include <QScrollBar>
|
#include <QScrollBar>
|
||||||
|
|
||||||
//Win32 includes
|
//System includes
|
||||||
#include <Windows.h>
|
#include <MMSystem.h>
|
||||||
|
|
||||||
//Helper macros
|
//Helper macros
|
||||||
#define ABORT_IF_BUSY if(m_banner->isVisible() || m_delayedFileTimer->isActive()) { MessageBeep(MB_ICONEXCLAMATION); return; }
|
#define ABORT_IF_BUSY if(m_banner->isVisible() || m_delayedFileTimer->isActive()) { MessageBeep(MB_ICONEXCLAMATION); return; }
|
||||||
@ -472,10 +472,20 @@ void MainWindow::addFolder(const QString &path, bool recursive)
|
|||||||
QStringList fileList;
|
QStringList fileList;
|
||||||
|
|
||||||
m_banner->show(tr("Scanning folder(s) for files, please wait..."));
|
m_banner->show(tr("Scanning folder(s) for files, please wait..."));
|
||||||
|
|
||||||
QApplication::processEvents();
|
QApplication::processEvents();
|
||||||
|
GetAsyncKeyState(VK_ESCAPE);
|
||||||
|
|
||||||
while(!folderInfoList.isEmpty())
|
while(!folderInfoList.isEmpty())
|
||||||
{
|
{
|
||||||
|
if(GetAsyncKeyState(VK_ESCAPE) & 0x0001)
|
||||||
|
{
|
||||||
|
MessageBeep(MB_ICONERROR);
|
||||||
|
qWarning("Operation cancelled by user!");
|
||||||
|
fileList.clear();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
QDir currentDir(folderInfoList.takeFirst().canonicalFilePath());
|
QDir currentDir(folderInfoList.takeFirst().canonicalFilePath());
|
||||||
QFileInfoList fileInfoList = currentDir.entryInfoList(QDir::Files);
|
QFileInfoList fileInfoList = currentDir.entryInfoList(QDir::Files);
|
||||||
|
|
||||||
@ -652,14 +662,14 @@ void MainWindow::changeEvent(QEvent *e)
|
|||||||
comboBoxNeroAACProfile->setCurrentIndex(comboBoxIndex[2]);
|
comboBoxNeroAACProfile->setCurrentIndex(comboBoxIndex[2]);
|
||||||
|
|
||||||
//Update the window title
|
//Update the window title
|
||||||
#if !defined(_DEBUG) && !defined(QT_DEBUG) && defined(NDEBUG) && defined(QT_NO_DEBUG)
|
if(LAMEXP_DEBUG)
|
||||||
if(lamexp_version_demo())
|
{
|
||||||
|
setWindowTitle(QString("%1 [!!! DEBUG BUILD !!!]").arg(windowTitle()));
|
||||||
|
}
|
||||||
|
else if(lamexp_version_demo())
|
||||||
{
|
{
|
||||||
setWindowTitle(QString("%1 [%2]").arg(windowTitle(), tr("DEMO VERSION")));
|
setWindowTitle(QString("%1 [%2]").arg(windowTitle(), tr("DEMO VERSION")));
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
setWindowTitle(QString("%1 [!!! DEBUG BUILD !!!]").arg(windowTitle()));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//Manually re-translate widgets that UIC doesn't handle
|
//Manually re-translate widgets that UIC doesn't handle
|
||||||
m_dropNoteLabel->setText(QString("» %1 «").arg(tr("You can drop in audio files here!")));
|
m_dropNoteLabel->setText(QString("» %1 «").arg(tr("You can drop in audio files here!")));
|
||||||
|
@ -69,15 +69,24 @@ void FileAnalyzer::run()
|
|||||||
m_filesRejected = 0;
|
m_filesRejected = 0;
|
||||||
m_filesDenied = 0;
|
m_filesDenied = 0;
|
||||||
m_filesDummyCDDA = 0;
|
m_filesDummyCDDA = 0;
|
||||||
|
|
||||||
m_inputFiles.sort();
|
m_inputFiles.sort();
|
||||||
|
|
||||||
|
GetAsyncKeyState(VK_ESCAPE);
|
||||||
|
|
||||||
while(!m_inputFiles.isEmpty())
|
while(!m_inputFiles.isEmpty())
|
||||||
{
|
{
|
||||||
|
if(GetAsyncKeyState(VK_ESCAPE) & 0x0001)
|
||||||
|
{
|
||||||
|
MessageBeep(MB_ICONERROR);
|
||||||
|
qWarning("Operation cancelled by user!");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
QString currentFile = QDir::fromNativeSeparators(m_inputFiles.takeFirst());
|
QString currentFile = QDir::fromNativeSeparators(m_inputFiles.takeFirst());
|
||||||
qDebug64("Analyzing: %1", currentFile);
|
qDebug64("Analyzing: %1", currentFile);
|
||||||
emit fileSelected(QFileInfo(currentFile).fileName());
|
emit fileSelected(QFileInfo(currentFile).fileName());
|
||||||
AudioFileModel file = analyzeFile(currentFile);
|
AudioFileModel file = analyzeFile(currentFile);
|
||||||
|
|
||||||
if(file.fileName().isEmpty() || file.formatContainerType().isEmpty() || file.formatAudioType().isEmpty())
|
if(file.fileName().isEmpty() || file.formatContainerType().isEmpty() || file.formatAudioType().isEmpty())
|
||||||
{
|
{
|
||||||
if(!PlaylistImporter::importPlaylist(m_inputFiles, currentFile))
|
if(!PlaylistImporter::importPlaylist(m_inputFiles, currentFile))
|
||||||
@ -87,6 +96,7 @@ void FileAnalyzer::run()
|
|||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_filesAccepted++;
|
m_filesAccepted++;
|
||||||
emit fileAnalyzed(file);
|
emit fileAnalyzed(file);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user