using std::list;
using std::map;
+using std::pair;
using std::shared_ptr;
using std::string;
devices.push_back(selected_device);
assert(selected_device);
- map<shared_ptr<Device>, string> device_names;
+ list< pair< shared_ptr<Device>, string> > device_list;
for (auto device : devices)
- device_names[device] = _device_manager.get_display_name(device);
+ device_list.push_back(make_pair(
+ device, _device_manager.get_display_name(device)));
- _sampling_bar->set_device_list(device_names, selected_device);
+ _sampling_bar->set_device_list(device_list, selected_device);
}
void MainWindow::closeEvent(QCloseEvent *event)
}
void SamplingBar::set_device_list(
- const std::map< shared_ptr<Device>, string > &device_names,
+ const std::list< std::pair<std::shared_ptr<sigrok::Device>, std::string> > &devices,
shared_ptr<Device> selected)
{
int selected_index = -1;
_device_selector.clear();
- for (auto entry : device_names) {
+ for (auto entry : devices) {
auto device = entry.first;
- auto description = entry.second;
+ auto display_name = entry.second;
assert(device);
if (selected == device)
selected_index = _device_selector.count();
- _device_selector.addItem(description.c_str(),
+ _device_selector.addItem(display_name.c_str(),
qVariantFromValue(device));
}
#include <stdint.h>
-#include <map>
+#include <list>
#include <memory>
#include <QComboBox>
SamplingBar(SigSession &session, QWidget *parent);
void set_device_list(
- const std::map< std::shared_ptr<sigrok::Device>, std::string >
- &device_names,
+ const std::list< std::pair<std::shared_ptr<sigrok::Device>, std::string> > &devices,
std::shared_ptr<sigrok::Device> selected);
std::shared_ptr<sigrok::Device> get_selected_device() const;