From: Soeren Apel Date: Tue, 21 Dec 2021 21:09:51 +0000 (+0100) Subject: Application: Do not show unsupported device drivers in version info X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=22dc404045aa3b519da58e02109d3ecb95682f1c;p=pulseview.git Application: Do not show unsupported device drivers in version info --- diff --git a/main.cpp b/main.cpp index d3c52adb..0867187c 100644 --- a/main.cpp +++ b/main.cpp @@ -332,7 +332,7 @@ int main(int argc, char *argv[]) // Create the device manager, initialise the drivers pv::DeviceManager device_manager(context, driver, do_scan); - a.collect_version_info(context); + a.collect_version_info(device_manager); if (show_version) { a.print_version_info(); } else { diff --git a/pv/application.cpp b/pv/application.cpp index a34a6ca7..15195d06 100644 --- a/pv/application.cpp +++ b/pv/application.cpp @@ -143,7 +143,7 @@ void Application::on_setting_changed(const QString &key, const QVariant &value) switch_language(value.toString()); } -void Application::collect_version_info(shared_ptr context) +void Application::collect_version_info(pv::DeviceManager &device_manager) { // Library versions and features version_info_.emplace_back(applicationName(), applicationVersion()); @@ -211,17 +211,18 @@ void Application::collect_version_info(shared_ptr context) #endif // Device drivers - for (auto& entry : context->drivers()) - driver_list_.emplace_back(QString::fromUtf8(entry.first.c_str()), - QString::fromUtf8(entry.second->long_name().c_str())); + for (auto& entry : device_manager.context()->drivers()) + if (device_manager.driver_supported(entry.second)) + driver_list_.emplace_back(QString::fromUtf8(entry.first.c_str()), + QString::fromUtf8(entry.second->long_name().c_str())); // Input formats - for (auto& entry : context->input_formats()) + for (auto& entry : device_manager.context()->input_formats()) input_format_list_.emplace_back(QString::fromUtf8(entry.first.c_str()), QString::fromUtf8(entry.second->description().c_str())); // Output formats - for (auto& entry : context->output_formats()) + for (auto& entry : device_manager.context()->output_formats()) output_format_list_.emplace_back(QString::fromUtf8(entry.first.c_str()), QString::fromUtf8(entry.second->description().c_str())); diff --git a/pv/application.hpp b/pv/application.hpp index 75ddbc06..bfe46570 100644 --- a/pv/application.hpp +++ b/pv/application.hpp @@ -28,6 +28,7 @@ #include +#include "devicemanager.hpp" #include "globalsettings.hpp" using std::shared_ptr; @@ -47,7 +48,7 @@ public: void on_setting_changed(const QString &key, const QVariant &value); - void collect_version_info(shared_ptr context); + void collect_version_info(pv::DeviceManager &device_manager); void print_version_info(); vector< pair > get_version_info() const;