X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fmainwindow.cpp;h=ac5372a6f46d295468699ca95460cbab647720ef;hp=7dcf8958e4dd29fc3778f7b19e3c94d664993c0b;hb=474e817a724fdad4db635ba59202283fbcc22ef9;hpb=ea2dbfea21a4c02854c5ffa0d97e14e3483c42c0 diff --git a/pv/mainwindow.cpp b/pv/mainwindow.cpp index 7dcf8958..ac5372a6 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 { @@ -101,8 +101,10 @@ MainWindow::MainWindow(DeviceManager &device_manager, action_view_zoom_fit_(new QAction(this)), action_view_zoom_one_to_one_(new QAction(this)), action_view_show_cursors_(new QAction(this)), - action_about_(new QAction(this)), - menu_decoders_add_(new pv::widgets::DecoderMenu(this, true)) + action_about_(new QAction(this)) +#ifdef ENABLE_DECODE + , menu_decoders_add_(new pv::widgets::DecoderMenu(this, true)) +#endif { setup_ui(); restore_ui_settings(); @@ -164,10 +166,12 @@ QAction* MainWindow::action_about() const return action_about_; } +#ifdef ENABLE_DECODE QMenu* MainWindow::menu_decoder_add() const { return menu_decoders_add_; } +#endif void MainWindow::run_stop() { @@ -184,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); @@ -451,8 +455,6 @@ void MainWindow::restore_ui_settings() { QSettings settings; - shared_ptr device; - map dev_info; list key_list; string value; @@ -485,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(); @@ -530,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(); @@ -654,11 +659,11 @@ 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; - const string display_name = device_manager_.get_display_name(device); + const string display_name = device->display_name(device_manager_); setWindowTitle(tr("%1 - PulseView").arg(display_name.c_str())); }