26 #include <libsigrokcxx/libsigrokcxx.hpp>
34 using std::shared_ptr;
36 using sigrok::Context;
37 using sigrok::InputFormat;
43 QAction *open_action) :
51 addAction(open_action);
52 setDefaultAction(open_action);
56 const map<string, shared_ptr<InputFormat> > formats =
57 context->input_formats();
59 for (
const pair<
string, shared_ptr<InputFormat> > &f : formats) {
61 QAction *
const action = addAction(tr(
"Import %1...")
62 .arg(QString::fromStdString(f.second->description())));
63 action->setData(qVariantFromValue((
void*)f.second.get()));
64 mapper_.setMapping(action, action);
65 connect(action, SIGNAL(triggered()), &
mapper_, SLOT(map()));
76 const map<string, shared_ptr<InputFormat> > formats =
78 const auto iter = find_if(formats.cbegin(), formats.cend(),
79 [&](
const pair<string, shared_ptr<InputFormat> > &f) {
80 return f.second.get() ==
81 ((QAction*)action)->data().value<
void*>(); });
82 if (iter == formats.cend())