session: apply input format match to interactively loaded files, too
[pulseview.git] / pv / session.cpp
index 87e9b3a5e1060223d27a67f0a17cab94db6e9fcc..6767951cf85961ea303d9fc6f830e8a7d9eb576d 100644 (file)
@@ -301,7 +301,8 @@ void Session::restore_settings(QSettings &settings)
                        set_device(device);
 
                        start_capture([](QString infoMessage) {
-                               qDebug().noquote() << "Session error:" << infoMessage; });
+                               // TODO Emulate noquote()
+                               qDebug() << "Session error:" << infoMessage; });
 
                        set_name(QFileInfo(filename).fileName());
                }
@@ -510,6 +511,10 @@ void Session::load_file(QString file_name,
        const QString errorMessage(
                QString("Failed to load file %1").arg(file_name));
 
+       // In the absence of a caller's format spec, try to auto detect.
+       // Assume "sigrok session file" upon lookup miss.
+       if (!format)
+               format = device_manager_.context()->input_format_match(file_name.toStdString());
        try {
                if (format)
                        set_device(shared_ptr<devices::Device>(