projects
/
pulseview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Session: Enable logic data acquisition using gstreamer
[pulseview.git]
/
pv
/
binding
/
inputoutput.cpp
diff --git
a/pv/binding/inputoutput.cpp
b/pv/binding/inputoutput.cpp
index 30548a82a000d5641f75a3ce0073a1e3e4589d50..f9a061c76e78c7b7e77a33ec1d04250328263b70 100644
(file)
--- a/
pv/binding/inputoutput.cpp
+++ b/
pv/binding/inputoutput.cpp
@@
-14,8
+14,7
@@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
#include <cassert>
*/
#include <cassert>
@@
-36,7
+35,6
@@
using boost::none;
using boost::none;
-using std::make_pair;
using std::map;
using std::pair;
using std::shared_ptr;
using std::map;
using std::pair;
using std::shared_ptr;
@@
-61,16
+59,18
@@
namespace binding {
InputOutput::InputOutput(
const map<string, shared_ptr<Option>> &options)
{
InputOutput::InputOutput(
const map<string, shared_ptr<Option>> &options)
{
- for (
pair<string, shared_ptr<Option>>
o : options) {
+ for (
const pair<string, shared_ptr<Option>>&
o : options) {
const shared_ptr<Option> &opt = o.second;
assert(opt);
const QString name = QString::fromStdString(opt->name());
const shared_ptr<Option> &opt = o.second;
assert(opt);
const QString name = QString::fromStdString(opt->name());
+ const QString desc = QString::fromStdString(opt->description());
+
const VariantBase def_val = opt->default_value();
const vector<VariantBase> values = opt->values();
options_[opt->id()] = def_val;
const VariantBase def_val = opt->default_value();
const vector<VariantBase> values = opt->values();
options_[opt->id()] = def_val;
-
+
const Property::Getter get = [&, opt]() {
return options_[opt->id()]; };
const Property::Setter set = [&, opt](VariantBase value) {
const Property::Getter get = [&, opt]() {
return options_[opt->id()]; };
const Property::Setter set = [&, opt](VariantBase value) {
@@
-79,20
+79,20
@@
InputOutput::InputOutput(
shared_ptr<Property> prop;
if (!opt->values().empty())
shared_ptr<Property> prop;
if (!opt->values().empty())
- prop = bind_enum(name, values, get, set);
+ prop = bind_enum(name,
desc,
values, get, set);
else if (def_val.is_of_type(VariantType("b")))
else if (def_val.is_of_type(VariantType("b")))
- prop = shared_ptr<Property>(new Bool(name, get, set));
+ prop = shared_ptr<Property>(new Bool(name,
desc,
get, set));
else if (def_val.is_of_type(VariantType("d")))
else if (def_val.is_of_type(VariantType("d")))
- prop = shared_ptr<Property>(new Double(name, 2, "",
+ prop = shared_ptr<Property>(new Double(name,
desc,
2, "",
none, none, get, set));
else if (def_val.is_of_type(VariantType("i")) ||
def_val.is_of_type(VariantType("t")) ||
def_val.is_of_type(VariantType("u")))
prop = shared_ptr<Property>(
none, none, get, set));
else if (def_val.is_of_type(VariantType("i")) ||
def_val.is_of_type(VariantType("t")) ||
def_val.is_of_type(VariantType("u")))
prop = shared_ptr<Property>(
- new Int(name, "", none, get, set));
+ new Int(name,
desc,
"", none, get, set));
else if (def_val.is_of_type(VariantType("s")))
prop = shared_ptr<Property>(
else if (def_val.is_of_type(VariantType("s")))
prop = shared_ptr<Property>(
- new String(name, get, set));
+ new String(name,
desc,
get, set));
else
continue;
else
continue;
@@
-106,13
+106,13
@@
const map<string, VariantBase>& InputOutput::options() const
}
shared_ptr<Property> InputOutput::bind_enum(
}
shared_ptr<Property> InputOutput::bind_enum(
- const QString &name, const vector<VariantBase> &values,
+ const QString &name, const
QString &desc, const
vector<VariantBase> &values,
Property::Getter getter, Property::Setter setter)
{
vector< pair<VariantBase, QString> > enum_vals;
for (VariantBase var : values)
Property::Getter getter, Property::Setter setter)
{
vector< pair<VariantBase, QString> > enum_vals;
for (VariantBase var : values)
- enum_vals.
push_back(make_pair(var, print_gvariant(var)
));
- return shared_ptr<Property>(new Enum(name, enum_vals, getter, setter));
+ enum_vals.
emplace_back(var, print_gvariant(var
));
+ return shared_ptr<Property>(new Enum(name,
desc,
enum_vals, getter, setter));
}
} // namespace binding
}
} // namespace binding