Mercurial > hg > svapp
changeset 109:2dd30a7cd21a
* More work to abstract out interactive components used in the data library,
so that it does not need to depend on QtGui.
author | Chris Cannam |
---|---|
date | Fri, 14 Mar 2008 17:14:21 +0000 |
parents | e25e8f5d785b |
children | f57047e0522b |
files | framework/MainWindowBase.cpp framework/MainWindowBase.h framework/SVFileReader.cpp |
diffstat | 3 files changed, 30 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/framework/MainWindowBase.cpp Thu Mar 13 14:06:03 2008 +0000 +++ b/framework/MainWindowBase.cpp Fri Mar 14 17:14:21 2008 +0000 @@ -36,6 +36,9 @@ #include "widgets/ListInputDialog.h" #include "widgets/CommandHistory.h" +#include "widgets/ProgressDialog.h" +#include "widgets/MIDIFileImportDialog.h" +#include "widgets/CSVFormatDialog.h" #include "audioio/AudioCallbackPlaySource.h" #include "audioio/AudioCallbackPlayTarget.h" @@ -815,7 +818,8 @@ MainWindowBase::FileOpenStatus MainWindowBase::open(QString fileOrUrl, AudioFileOpenMode mode) { - return open(FileSource(fileOrUrl, FileSource::ProgressDialog), mode); + ProgressDialog dialog(tr("Opening file or URL..."), true, 2000); + return open(FileSource(fileOrUrl, &dialog), mode); } MainWindowBase::FileOpenStatus @@ -1057,8 +1061,8 @@ for (PlaylistFileReader::Playlist::const_iterator i = playlist.begin(); i != playlist.end(); ++i) { - FileOpenStatus status = openAudio - (FileSource(*i, FileSource::ProgressDialog), mode); + ProgressDialog dialog(tr("Opening playlist..."), true, 2000); + FileOpenStatus status = openAudio(FileSource(*i, &dialog), mode); if (status == FileOpenCancelled) { return FileOpenCancelled; @@ -1140,9 +1144,21 @@ try { - Model *model = DataFileReaderFactory::load - (path, getMainModel()->getSampleRate()); + MIDIFileImportDialog midiDlg(this); + + Model *model = DataFileReaderFactory::loadNonCSV + (path, &midiDlg, getMainModel()->getSampleRate()); + if (!model) { + CSVFormatDialog *dialog = new CSVFormatDialog + (this, CSVFormat(path), getMainModel()->getSampleRate()); + if (dialog->exec() == QDialog::Accepted) { + model = DataFileReaderFactory::loadCSV + (path, dialog->getFormat(), + getMainModel()->getSampleRate()); + } + } + if (model) { std::cerr << "MainWindowBase::openLayer: Have model" << std::endl; @@ -1228,7 +1244,8 @@ MainWindowBase::FileOpenStatus MainWindowBase::openSessionFile(QString fileOrUrl) { - return openSession(FileSource(fileOrUrl, FileSource::ProgressDialog)); + ProgressDialog dialog(tr("Opening session..."), true, 2000); + return openSession(FileSource(fileOrUrl, &dialog)); } MainWindowBase::FileOpenStatus
--- a/framework/MainWindowBase.h Thu Mar 13 14:06:03 2008 +0000 +++ b/framework/MainWindowBase.h Fri Mar 14 17:14:21 2008 +0000 @@ -29,7 +29,7 @@ #include "layer/LayerFactory.h" #include "transform/Transform.h" #include "SVFileReader.h" -#include "data/fileio/FileFinder.h" +#include "widgets/FileFinder.h" #include "data/fileio/FileSource.h" #include <map>
--- a/framework/SVFileReader.cpp Thu Mar 13 14:06:03 2008 +0000 +++ b/framework/SVFileReader.cpp Fri Mar 14 17:14:21 2008 +0000 @@ -21,9 +21,10 @@ #include "base/PlayParameterRepository.h" #include "data/fileio/AudioFileReaderFactory.h" -#include "data/fileio/FileFinder.h" #include "data/fileio/FileSource.h" +#include "widgets/FileFinder.h" + #include "data/model/WaveFileModel.h" #include "data/model/EditableDenseThreeDimensionalModel.h" #include "data/model/SparseOneDimensionalModel.h" @@ -36,6 +37,8 @@ #include "view/Pane.h" +#include "widgets/ProgressDialog.h" + #include "Document.h" #include <QString> @@ -441,7 +444,8 @@ QString path = ff->find(FileFinder::AudioFile, originalPath, m_location); - FileSource file(path, FileSource::ProgressDialog); + ProgressDialog dialog(tr("Opening file or URL..."), true, 2000); + FileSource file(path, &dialog); file.waitForStatus(); if (!file.isOK()) {