X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=pv%2Fmainwindow.cpp;h=183e841e804c3c6f48d37949268ec3227a0c70be;hb=3045c869ada2e32bf55cbb68633b5213b9b11e28;hp=0e971ce06cc7373f6da132479483101f187aa3c7;hpb=98bac9636ee62a8863760a8b8381019a6a546173;p=pulseview.git diff --git a/pv/mainwindow.cpp b/pv/mainwindow.cpp index 0e971ce0..183e841e 100644 --- a/pv/mainwindow.cpp +++ b/pv/mainwindow.cpp @@ -40,8 +40,8 @@ #include "dialogs/about.h" #include "dialogs/connect.h" #include "dialogs/decoder.h" -#include "toolbars/contextbar.h" #include "toolbars/samplingbar.h" +#include "view/logicsignal.h" #include "view/view.h" /* __STDC_FORMAT_MACROS is required for PRIu64 and friends (in C++). */ @@ -98,8 +98,6 @@ 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); @@ -217,21 +215,15 @@ void MainWindow::setup_ui() addToolBar(_toolbar); // Setup the sampling bar - _sampling_bar = new toolbars::SamplingBar(this); + _sampling_bar = new toolbars::SamplingBar(_session, this); // Populate the device list and select the initially selected device update_device_list(); - connect(_sampling_bar, SIGNAL(device_selected()), this, - SLOT(device_selected())); connect(_sampling_bar, SIGNAL(run_stop()), this, SLOT(run_stop())); addToolBar(_sampling_bar); - // Setup the context bar - _context_bar = new toolbars::ContextBar(this); - addToolBar(_context_bar); - // Set the title setWindowTitle(QApplication::translate("MainWindow", "PulseView", 0, QApplication::UnicodeUTF8)); @@ -305,14 +297,15 @@ void MainWindow::setup_add_decoders(QMenu *parent) { GSList *l = g_slist_sort(g_slist_copy( (GSList*)srd_decoder_list()), decoder_name_cmp); - do { + for(; l; l = l->next) + { QAction *const action = parent->addAction(QString( ((srd_decoder*)l->data)->name)); action->setData(qVariantFromValue(l->data)); _decoders_add_mapper.setMapping(action, action); connect(action, SIGNAL(triggered()), &_decoders_add_mapper, SLOT(map())); - } while ((l = l->next)); + } g_slist_free(l); } @@ -376,11 +369,6 @@ void MainWindow::on_actionAbout_triggered() dlg.exec(); } -void MainWindow::device_selected() -{ - _session.set_device(_sampling_bar->get_selected_device()); -} - void MainWindow::add_decoder(QObject *action) { assert(action); @@ -388,13 +376,21 @@ void MainWindow::add_decoder(QObject *action) (srd_decoder*)((QAction*)action)->data().value(); assert(dec); - const std::vector< boost::shared_ptr > &sigs = + vector< shared_ptr > logic_sigs; + const vector< shared_ptr > &sigs = _session.get_signals(); + BOOST_FOREACH(shared_ptr s, sigs) { + assert(s); + shared_ptr l = + dynamic_pointer_cast(s); + if (l) + logic_sigs.push_back(l); + } GHashTable *const options = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, (GDestroyNotify)g_variant_unref); - dialogs::Decoder dlg(this, dec, sigs, options); + dialogs::Decoder dlg(this, dec, logic_sigs, options); if(dlg.exec() != QDialog::Accepted) { g_hash_table_destroy(options); return; @@ -424,13 +420,4 @@ void MainWindow::capture_state_changed(int state) _sampling_bar->set_capture_state((pv::SigSession::capture_state)state); } -void MainWindow::view_selection_changed() -{ - assert(_context_bar); - - const list > items( - _view->selected_items()); - _context_bar->set_selected_items(items); -} - } // namespace pv