X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fmainwindow.cpp;h=1a05907c9c1a4470be862fdf2691887411b915e3;hp=3c5af937fda9546eaf67e84b08a04eb819e41861;hb=cd0c558b8e1dbae12c3faba2349d874942b96066;hpb=574c568d184240cd87be1b57fc00d60a4eac7566 diff --git a/pv/mainwindow.cpp b/pv/mainwindow.cpp index 3c5af937..1a05907c 100644 --- a/pv/mainwindow.cpp +++ b/pv/mainwindow.cpp @@ -177,6 +177,11 @@ QAction* MainWindow::action_view_sticky_scrolling() const return action_view_sticky_scrolling_; } +QAction* MainWindow::action_view_coloured_bg() const +{ + return action_view_coloured_bg_; +} + QAction* MainWindow::action_view_show_cursors() const { return action_view_show_cursors_; @@ -269,7 +274,7 @@ void MainWindow::export_file(shared_ptr format, filter += "(*.*)"; else filter += QString("(*.%1);;%2 (*.*)").arg( - QString::fromStdString(join(exts, ", *."))).arg( + QString::fromStdString(join(exts, ", *.")), tr("All Files")); // Show the file dialog @@ -310,7 +315,7 @@ void MainWindow::import_file(shared_ptr format) const vector exts = format->extensions(); const QString filter = exts.empty() ? "" : tr("%1 files (*.%2)").arg( - QString::fromStdString(format->description())).arg( + QString::fromStdString(format->description()), QString::fromStdString(join(exts, ", *."))); // Show the file dialog @@ -562,8 +567,9 @@ void MainWindow::select_init_device() QSettings settings; map dev_info; list key_list; + shared_ptr device; - // Re-select last used device if possible. + // Re-select last used device if possible but only if it's not demo settings.beginGroup("Device"); key_list.push_back("vendor"); key_list.push_back("model"); @@ -581,8 +587,24 @@ void MainWindow::select_init_device() dev_info.insert(std::make_pair(key, value)); } - const shared_ptr device = - device_manager_.find_device_from_info(dev_info); + if (dev_info.count("model") > 0) + if (dev_info.at("model").find("Demo device") == std::string::npos) + device = device_manager_.find_device_from_info(dev_info); + + // When we can't find a device similar to the one we used last + // time and there is at least one device aside from demo, use it + if (!device) { + for (shared_ptr dev : device_manager_.devices()) { + dev_info = device_manager_.get_device_info(dev); + + if (dev_info.count("model") > 0) + if (dev_info.at("model").find("Demo device") == std::string::npos) { + device = dev; + break; + } + } + } + select_device(device); update_device_list();