13
0

Fix import dialog so that file number progress gets updated correctly. Stop a new progress dialog being popped up for each file.

git-svn-id: svn://localhost/ardour2/branches/3.0@5451 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2009-08-02 00:32:26 +00:00
parent 7ed2058e3e
commit e481963920
2 changed files with 33 additions and 54 deletions

View File

@ -352,61 +352,38 @@ Editor::do_import (vector<ustring> paths, ImportDisposition chns, ImportMode mod
} else {
bool replace = false;
for (vector<ustring>::iterator a = paths.begin(); a != paths.end(); ++a) {
int const check = check_whether_and_how_to_import (*a, true);
if (check != 2) {
to_import.push_back (*a);
}
}
bool ok = true;
vector<ustring>::size_type total = paths.size();
for (vector<ustring>::iterator a = paths.begin(); a != paths.end() && ok; ++a) {
int check = check_whether_and_how_to_import(*a, true);
if (check == 2 ) {
// user said skip
continue;
}
if (check == 0) {
fatal << "Updating existing sources should be disabled!" << endl;
replace = true;
} else if (check == 1) {
replace = false;
}
switch (chns) {
case Editing::ImportDistinctFiles:
switch (chns) {
case Editing::ImportDistinctFiles:
to_import.clear ();
to_import.push_back (*a);
if (mode == Editing::ImportToTrack) {
track = get_nth_selected_audio_track (nth++);
}
ok = (import_sndfiles (to_import, mode, quality, pos, 1, -1, track, replace, total) == 0);
break;
case Editing::ImportDistinctChannels:
to_import.clear ();
to_import.push_back (*a);
ok = (import_sndfiles (to_import, mode, quality, pos, -1, -1, track, replace, total) == 0);
break;
case Editing::ImportSerializeFiles:
to_import.clear ();
to_import.push_back (*a);
ok = (import_sndfiles (to_import, mode, quality, pos, 1, 1, track, replace, total) == 0);
break;
case Editing::ImportMergeFiles:
// Not entered, handled in earlier if() branch
break;
if (mode == Editing::ImportToTrack) {
track = get_nth_selected_audio_track (nth++);
}
ok = (import_sndfiles (to_import, mode, quality, pos, 1, -1, track, false, to_import.size()) == 0);
break;
case Editing::ImportDistinctChannels:
ok = (import_sndfiles (to_import, mode, quality, pos, -1, -1, track, false, to_import.size()) == 0);
break;
case Editing::ImportSerializeFiles:
ok = (import_sndfiles (to_import, mode, quality, pos, 1, 1, track, false, to_import.size()) == 0);
break;
case Editing::ImportMergeFiles:
// Not entered, handled in earlier if() branch
break;
}
}

View File

@ -395,7 +395,7 @@ Session::import_audiofiles (ImportStatus& status)
uint channels = 0;
status.sources.clear ();
for (vector<Glib::ustring>::iterator p = status.paths.begin();
p != status.paths.end() && !status.cancel;
++p, ++cnt)
@ -404,7 +404,7 @@ Session::import_audiofiles (ImportStatus& status)
std::auto_ptr<Evoral::SMF> smf_reader;
const DataType type = ((*p).rfind(".mid") != string::npos) ?
DataType::MIDI : DataType::AUDIO;
if (type == DataType::AUDIO) {
try {
source = open_importable_source (*p, frame_rate(), status.quality);
@ -442,7 +442,9 @@ Session::import_audiofiles (ImportStatus& status)
// copy on cancel/failure so that any files that were created will be removed below
std::copy (newfiles.begin(), newfiles.end(), std::back_inserter(all_new_sources));
if (status.cancel) break;
if (status.cancel) {
break;
}
for (Sources::iterator i = newfiles.begin(); i != newfiles.end(); ++i) {
if ((afs = boost::dynamic_pointer_cast<AudioFileSource>(*i)) != 0) {