Mercurial > hg > svapp
diff framework/MainWindowBase.cpp @ 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 | 0c1ea5ff6518 |
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