# HG changeset patch # User Chris Cannam # Date 1228502749 0 # Node ID 975f6b6c414c5f9b6332910ec1cd8f5b5abac3b0 # Parent c4bc499122ec457c58e1bc2f2ed34c844b86e6ab * Improvements to importer feedback dialogs and suchlike diff -r c4bc499122ec -r 975f6b6c414c main/MainWindow.cpp --- a/main/MainWindow.cpp Thu Dec 04 17:17:06 2008 +0000 +++ b/main/MainWindow.cpp Fri Dec 05 18:45:49 2008 +0000 @@ -2182,7 +2182,7 @@ } else if (status == FileOpenWrongMode) { emit hideSplash(); QMessageBox::critical(this, tr("Failed to open file"), - tr("Audio required
Please load at least one audio file before importing annotation data")); + tr("Audio required
Unable to load layer data from \"%1\" without an audio file.
Please load at least one audio file before importing annotations.").arg(path));
}
}
}
@@ -2482,7 +2482,7 @@
} else if (status == FileOpenWrongMode) {
emit hideSplash();
QMessageBox::critical(this, tr("Failed to open file"),
- tr("Audio required
Please load at least one audio file before importing annotation data")); + tr("Audio required
Unable to load layer data from \"%1\" without an audio file.
Please load at least one audio file before importing annotations.").arg(path));
}
}
@@ -2514,7 +2514,7 @@
} else if (status == FileOpenWrongMode) {
emit hideSplash();
QMessageBox::critical(this, tr("Failed to open location"),
- tr("Audio required
Please load at least one audio file before importing annotation data")); + tr("Audio required
Unable to load layer data from \"%1\" without an audio file.
Please load at least one audio file before importing annotations.").arg(text));
}
}
@@ -2542,7 +2542,7 @@
} else if (status == FileOpenWrongMode) {
emit hideSplash();
QMessageBox::critical(this, tr("Failed to open location"),
- tr("Audio required
Please load at least one audio file before importing annotation data")); + tr("Audio required
Unable to load layer data from \"%1\" without an audio file.
Please load at least one audio file before importing annotations.").arg(path));
}
}
@@ -2580,7 +2580,7 @@
} else if (status == FileOpenWrongMode) {
emit hideSplash();
QMessageBox::critical(this, tr("Failed to open dropped URL"),
- tr("Audio required
Please load at least one audio file before importing annotation data")); + tr("Audio required
Unable to load layer data from \"%1\" without an audio file.
Please load at least one audio file before importing annotations.").arg(*i));
}
}
}
@@ -2728,20 +2728,39 @@
}
bool
-MainWindow::shouldCreateNewSessionForRDFAudio()
+MainWindow::shouldCreateNewSessionForRDFAudio(bool *cancel)
{
- QMessageBox mb;
- mb.setWindowTitle("Open as new session?");
- mb.setText("RDF refers to audio files
This RDF document refers to one or more audio files.
Do you want to start a new session for it?");
- QPushButton *a = mb.addButton(tr("Create new session"), QMessageBox::AcceptRole);
- QPushButton *b = mb.addButton(tr("Add to current session"), QMessageBox::RejectRole);
- mb.setDefaultButton(a);
- mb.exec();
- if (mb.clickedButton() == a) {
- return true;
- } else {
+ //!!! This is very similar to part of MainWindowBase::openAudio --
+ //!!! make them a bit more uniform
+
+ QSettings settings;
+ settings.beginGroup("MainWindow");
+ bool prevNewSession = settings.value("newsessionforrdfaudio", true).toBool();
+ settings.endGroup();
+ bool newSession = true;
+
+ QStringList items;
+ items << tr("Close the current session and create a new one")
+ << tr("Add this data to the current session");
+
+ bool ok = false;
+ QString item = ListInputDialog::getItem
+ (this, tr("Select target for import"),
+ tr("Select a target for import
This RDF document refers to one or more audio files.
You already have an audio waveform loaded.
What would you like to do with the new data?"),
+ items, prevNewSession ? 0 : 1, &ok);
+
+ if (!ok || item.isEmpty()) {
+ *cancel = true;
return false;
}
+
+ newSession = (item == items[0]);
+ settings.beginGroup("MainWindow");
+ settings.setValue("newsessionforrdfaudio", newSession);
+ settings.endGroup();
+
+ if (newSession) return true;
+ else return false;
}
void
@@ -3731,3 +3750,4 @@
m_keyReference->show();
}
+
diff -r c4bc499122ec -r 975f6b6c414c main/MainWindow.h
--- a/main/MainWindow.h Thu Dec 04 17:17:06 2008 +0000
+++ b/main/MainWindow.h Fri Dec 05 18:45:49 2008 +0000
@@ -261,7 +261,7 @@
virtual void updateVisibleRangeDisplay(Pane *p) const;
- virtual bool shouldCreateNewSessionForRDFAudio();
+ virtual bool shouldCreateNewSessionForRDFAudio(bool *cancel);
virtual void connectLayerEditDialog(ModelDataTableDialog *);
};