]> sigrok.org Git - pulseview.git/commitdiff
MainWindow: Added import options dialog
authorJoel Holdsworth <redacted>
Thu, 22 Jan 2015 02:48:19 +0000 (21:48 -0500)
committerUwe Hermann <redacted>
Thu, 11 Jun 2015 18:38:48 +0000 (20:38 +0200)
pv/mainwindow.cpp

index e48df546613a308b9e1374df3ea197be56fc71c5..3480d8cc2fcaaa62feacb6f85f7f5651f9019328 100644 (file)
@@ -274,12 +274,25 @@ void MainWindow::import_file(shared_ptr<InputFormat> format)
                        "%1 files (*.*);;All Files (*.*)").arg(
                        QString::fromStdString(format->description())));
 
-       if (!file_name.isEmpty()) {
-               load_file(file_name, format);
+       if (file_name.isEmpty())
+               return;
 
-               const QString abs_path = QFileInfo(file_name).absolutePath();
-               settings.setValue(SettingOpenDirectory, abs_path);
+       // Show the options dialog
+       map<string, Glib::VariantBase> options;
+       if (!format->options().empty()) {
+               dialogs::InputOutputOptions dlg(
+                       tr("Import %1").arg(QString::fromStdString(
+                               format->description())),
+                       format->options(), this);
+               if (!dlg.exec())
+                       return;
+               options = dlg.options();
        }
+
+       load_file(file_name, format, options);
+
+       const QString abs_path = QFileInfo(file_name).absolutePath();
+       settings.setValue(SettingOpenDirectory, abs_path);
 }
 
 void MainWindow::setup_ui()