Mercurial > hg > svapp
comparison framework/MainWindowBase.cpp @ 427:a67245dce0d4 alignment_view
Permit loading a whole directory of audio on the command line or through drag and drop
author | Chris Cannam |
---|---|
date | Fri, 21 Nov 2014 11:48:39 +0000 |
parents | 03fd6990ab52 |
children | a9141963b580 |
comparison
equal
deleted
inserted
replaced
426:03fd6990ab52 | 427:a67245dce0d4 |
---|---|
1741 | 1741 |
1742 return FileOpenSucceeded; | 1742 return FileOpenSucceeded; |
1743 } | 1743 } |
1744 | 1744 |
1745 MainWindowBase::FileOpenStatus | 1745 MainWindowBase::FileOpenStatus |
1746 MainWindowBase::openDirOfAudio(QString dirPath) | |
1747 { | |
1748 QDir dir(dirPath); | |
1749 QStringList files = dir.entryList(QDir::Files | QDir::Readable); | |
1750 files.sort(); | |
1751 | |
1752 FileOpenStatus status = FileOpenFailed; | |
1753 bool first = true; | |
1754 bool cancelled = false; | |
1755 | |
1756 foreach (QString file, files) { | |
1757 | |
1758 FileSource source(dir.filePath(file)); | |
1759 if (!source.isAvailable()) { | |
1760 continue; | |
1761 } | |
1762 | |
1763 if (AudioFileReaderFactory::getKnownExtensions().contains | |
1764 (source.getExtension().toLower())) { | |
1765 | |
1766 AudioFileOpenMode mode = CreateAdditionalModel; | |
1767 if (first) mode = ReplaceSession; | |
1768 | |
1769 switch (openAudio(source, mode)) { | |
1770 case FileOpenSucceeded: | |
1771 status = FileOpenSucceeded; | |
1772 first = false; | |
1773 break; | |
1774 case FileOpenFailed: | |
1775 break; | |
1776 case FileOpenCancelled: | |
1777 cancelled = true; | |
1778 break; | |
1779 case FileOpenWrongMode: | |
1780 break; | |
1781 } | |
1782 } | |
1783 | |
1784 if (cancelled) break; | |
1785 } | |
1786 | |
1787 return status; | |
1788 } | |
1789 | |
1790 MainWindowBase::FileOpenStatus | |
1746 MainWindowBase::openSessionPath(QString fileOrUrl) | 1791 MainWindowBase::openSessionPath(QString fileOrUrl) |
1747 { | 1792 { |
1748 ProgressDialog dialog(tr("Opening session..."), true, 2000, this); | 1793 ProgressDialog dialog(tr("Opening session..."), true, 2000, this); |
1749 connect(&dialog, SIGNAL(showing()), this, SIGNAL(hideSplash())); | 1794 connect(&dialog, SIGNAL(showing()), this, SIGNAL(hideSplash())); |
1750 return openSession(FileSource(fileOrUrl, &dialog)); | 1795 return openSession(FileSource(fileOrUrl, &dialog)); |