]> sigrok.org Git - pulseview.git/commitdiff
SamplingBar: Use DeviceManager::get_display_name() directly
authorSoeren Apel <redacted>
Fri, 12 Dec 2014 16:38:55 +0000 (17:38 +0100)
committerJoel Holdsworth <redacted>
Sat, 13 Dec 2014 10:17:25 +0000 (10:17 +0000)
pv/mainwindow.cpp
pv/toolbars/samplingbar.cpp
pv/toolbars/samplingbar.hpp

index cc0e0d25cdf550538df677ddf762aac93804cf1c..b7f360ff7f71f809c6ae714bf7a35acabbd1b60d 100644 (file)
@@ -61,7 +61,6 @@
 
 using std::list;
 using std::map;
-using std::pair;
 using std::shared_ptr;
 using std::string;
 
@@ -411,13 +410,7 @@ void MainWindow::update_device_list()
                devices.push_back(selected_device);
        assert(selected_device);
 
-       list< pair< shared_ptr<Device>, string> > device_list;
-
-       for (auto device : devices)
-               device_list.push_back(make_pair(
-                       device, device_manager_.get_display_name(device)));
-
-       sampling_bar_->set_device_list(device_list, selected_device);
+       sampling_bar_->set_device_list(devices, selected_device);
 }
 
 void MainWindow::closeEvent(QCloseEvent *event)
index b5a2aee513c7a12026b94e7bd3720894fd9e735e..7ee4d98150b5ccdb491ff9e2093a3507a9e7ad0d 100644 (file)
@@ -111,7 +111,7 @@ SamplingBar::SamplingBar(Session &session, MainWindow &main_window) :
 }
 
 void SamplingBar::set_device_list(
-       const std::list< std::pair<std::shared_ptr<sigrok::Device>, std::string> > &devices,
+       const std::list< std::shared_ptr<sigrok::Device> > &devices,
        shared_ptr<Device> selected)
 {
        int selected_index = -1;
@@ -122,12 +122,12 @@ void SamplingBar::set_device_list(
 
        device_selector_.clear();
 
-       for (auto entry : devices) {
-               auto device = entry.first;
-               auto display_name = entry.second;
-
+       for (auto device : devices) {
                assert(device);
 
+               string display_name =
+                       session_.device_manager().get_display_name(device);
+
                if (selected == device)
                        selected_index = device_selector_.count();
 
index 436304bc4ca915c88ee5a0f266a55ed66dcd2765..10e70cb9bed9b94f944c015976a03b57d7284167 100644 (file)
@@ -63,7 +63,7 @@ public:
        SamplingBar(Session &session, pv::MainWindow &main_window);
 
        void set_device_list(
-               const std::list< std::pair<std::shared_ptr<sigrok::Device>, std::string> > &devices,
+               const std::list< std::shared_ptr<sigrok::Device> > &devices,
                std::shared_ptr<sigrok::Device> selected);
 
        std::shared_ptr<sigrok::Device> get_selected_device() const;