X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fmainwindow.cpp;h=b7a0818b62ab5c7a28e88fecdfc0b1938133d73a;hp=f907f09cce33f118b0c830dbc0ee564f50a76501;hb=da30ecb7e72bd2547e524258efa5ec642988b70b;hpb=da5e6727a632752d19f975d84ea76f1683cd656f diff --git a/pv/mainwindow.cpp b/pv/mainwindow.cpp index f907f09c..b7a0818b 100644 --- a/pv/mainwindow.cpp +++ b/pv/mainwindow.cpp @@ -45,6 +45,8 @@ #include "mainwindow.hpp" #include "devicemanager.hpp" +#include "devices/hardwaredevice.hpp" +#include "devices/sessionfile.hpp" #include "dialogs/about.hpp" #include "dialogs/connect.hpp" #include "dialogs/inputoutputoptions.hpp" @@ -72,9 +74,7 @@ using std::vector; using boost::algorithm::join; -using sigrok::Device; using sigrok::Error; -using sigrok::HardwareDevice; using sigrok::OutputFormat; namespace pv { @@ -188,7 +188,7 @@ void MainWindow::run_stop() } } -void MainWindow::select_device(shared_ptr device) +void MainWindow::select_device(shared_ptr device) { try { session_.set_device(device); @@ -455,8 +455,6 @@ void MainWindow::restore_ui_settings() { QSettings settings; - shared_ptr device; - map dev_info; list key_list; string value; @@ -489,8 +487,8 @@ void MainWindow::restore_ui_settings() dev_info.insert(std::make_pair(key, value)); } - device = device_manager_.find_device_from_info(dev_info); - + const shared_ptr device = + device_manager_.find_device_from_info(dev_info); if (device) { select_device(device); update_device_list(); @@ -534,7 +532,10 @@ void MainWindow::load_file(QString file_name) const QString infoMessage; try { - session_.set_session_file(file_name.toStdString()); + session_.set_device( + shared_ptr(new devices::SessionFile( + device_manager_.context(), + file_name.toStdString()))); } catch(Error e) { show_session_error(tr("Failed to load ") + file_name, e.what()); session_.set_default_device(); @@ -658,7 +659,7 @@ void MainWindow::capture_state_changed(int state) void MainWindow::device_selected() { // Set the title to include the device/file name - const shared_ptr device = session_.device(); + const shared_ptr device = session_.device(); if (!device) return;