X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fmainwindow.cpp;h=e70ca9891c565ca81891ef30e2f1b2246aa661d8;hp=b916999fb9bd2a1fcfd2c691f5aa89a6081f15ba;hb=b1264f5650d4bd6cb801585ed5d1dc61226a21db;hpb=1d43d7677a7ead4ee6e1da49d87a1848b45ef75d diff --git a/pv/mainwindow.cpp b/pv/mainwindow.cpp index b916999f..e70ca989 100644 --- a/pv/mainwindow.cpp +++ b/pv/mainwindow.cpp @@ -41,6 +41,7 @@ #include "devicemanager.h" #include "dialogs/about.h" #include "dialogs/connect.h" +#include "toolbars/contextbar.h" #include "toolbars/samplingbar.h" #include "view/view.h" @@ -52,10 +53,15 @@ #include #include +using namespace boost; using namespace std; namespace pv { +namespace view { +class SelectableItem; +} + MainWindow::MainWindow(DeviceManager &device_manager, const char *open_file_name, QWidget *parent) : @@ -92,6 +98,9 @@ void MainWindow::setup_ui() setCentralWidget(_central_widget); _view = new pv::view::View(_session, this); + connect(_view, SIGNAL(selection_changed()), this, + SLOT(view_selection_changed())); + _vertical_layout->addWidget(_view); // Setup the menu bar @@ -204,6 +213,11 @@ void MainWindow::setup_ui() SLOT(run_stop())); addToolBar(_sampling_bar); + // Setup the context bar + _context_bar = new toolbars::ContextBar(this); + addToolBar(_context_bar); + insertToolBarBreak(_context_bar); + // Set the title setWindowTitle(QApplication::translate("MainWindow", "PulseView", 0, QApplication::UnicodeUTF8)); @@ -352,4 +366,13 @@ void MainWindow::capture_state_changed(int state) _sampling_bar->set_sampling(state != SigSession::Stopped); } +void MainWindow::view_selection_changed() +{ + assert(_context_bar); + + const list > items( + _view->selected_items()); + _context_bar->set_selected_items(items); +} + } // namespace pv