Chris@378: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ Chris@378: Chris@378: /* Chris@378: Sonic Visualiser Chris@378: An audio file viewer and annotation editor. Chris@378: Centre for Digital Music, Queen Mary, University of London. Chris@378: Chris@378: This program is free software; you can redistribute it and/or Chris@378: modify it under the terms of the GNU General Public License as Chris@378: published by the Free Software Foundation; either version 2 of the Chris@378: License, or (at your option) any later version. See the file Chris@378: COPYING included with this distribution for more information. Chris@378: */ Chris@378: Chris@378: #include "MIDIFileImportDialog.h" Chris@378: Chris@378: #include Chris@378: #include Chris@378: Chris@378: MIDIFileImportDialog::MIDIFileImportDialog(QWidget *parent) : Chris@378: m_parent(parent) Chris@378: { Chris@378: } Chris@378: Chris@378: MIDIFileImportDialog::TrackPreference Chris@378: MIDIFileImportDialog::getTrackImportPreference(QStringList displayNames, Chris@378: bool haveSomePercussion, Chris@378: QString &singleTrack) const Chris@378: { Chris@378: QStringList available; Chris@378: Chris@378: QString allTracks = tr("Merge all tracks"); Chris@378: QString allNonPercussion = tr("Merge all non-percussion tracks"); Chris@378: Chris@378: singleTrack = ""; Chris@378: Chris@378: int nonTrackItems = 1; Chris@378: Chris@378: available << allTracks; Chris@378: Chris@378: if (haveSomePercussion) { Chris@378: available << allNonPercussion; Chris@378: ++nonTrackItems; Chris@378: } Chris@378: Chris@378: available << displayNames; Chris@378: Chris@378: bool ok = false; Chris@378: QString selected = QInputDialog::getItem Chris@378: (0, tr("Select track or tracks to import"), Chris@378: tr("Select track to import

You can only import this file as a single annotation layer, but the file contains more than one track, or notes on more than one channel.

Please select the track or merged tracks you wish to import:"), Chris@378: available, 0, false, &ok); Chris@378: Chris@378: if (!ok || selected.isEmpty()) return ImportNothing; Chris@378: Chris@378: TrackPreference pref; Chris@378: if (selected == allTracks) pref = MergeAllTracks; Chris@378: else if (selected == allNonPercussion) pref = MergeAllNonPercussionTracks; Chris@378: else { Chris@378: singleTrack = selected; Chris@378: pref = ImportSingleTrack; Chris@378: } Chris@378: Chris@378: return pref; Chris@378: } Chris@378: Chris@378: void Chris@378: MIDIFileImportDialog::showError(QString error) Chris@378: { Chris@378: QMessageBox::critical(0, tr("Error in MIDI file import"), error); Chris@378: } Chris@378: