projects
/
pulseview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Ruler: Don't use a function that is only available in recent boost versions
[pulseview.git]
/
pv
/
view
/
signal.cpp
diff --git
a/pv/view/signal.cpp
b/pv/view/signal.cpp
index 767896f2ccda2d75b5063d55a0c17afaf6b7adda..08fa54eea55a40392f5d32f73be5eccb9e02e0ec 100644
(file)
--- a/
pv/view/signal.cpp
+++ b/
pv/view/signal.cpp
@@
-21,7
+21,7
@@
#include <extdef.h>
#include <assert.h>
#include <extdef.h>
#include <assert.h>
-#include <
math.
h>
+#include <
cmat
h>
#include <QApplication>
#include <QFormLayout>
#include <QApplication>
#include <QFormLayout>
@@
-29,7
+29,7
@@
#include <QLineEdit>
#include <QMenu>
#include <QLineEdit>
#include <QMenu>
-#include <libsigrok
/libsigrok
.hpp>
+#include <libsigrok
cxx/libsigrokcxx
.hpp>
#include "signal.hpp"
#include "view.hpp"
#include "signal.hpp"
#include "view.hpp"
@@
-47,8
+47,8
@@
const char *const ChannelNames[] = {
"IN",
"OUT",
"RST",
"IN",
"OUT",
"RST",
- "T
x
",
- "R
x
",
+ "T
X
",
+ "R
X
",
"EN",
"SCLK",
"MOSI",
"EN",
"SCLK",
"MOSI",
@@
-60,10
+60,10
@@
const char *const ChannelNames[] = {
Signal::Signal(pv::Session &session,
std::shared_ptr<sigrok::Channel> channel) :
Signal::Signal(pv::Session &session,
std::shared_ptr<sigrok::Channel> channel) :
- Trace(
channel->name().c_str(
)),
+ Trace(
QString::fromUtf8(channel->name().c_str()
)),
session_(session),
channel_(channel),
session_(session),
channel_(channel),
- name_widget_(
NULL
),
+ name_widget_(
nullptr
),
updating_name_widget_(false)
{
assert(channel_);
updating_name_widget_(false)
{
assert(channel_);
@@
-75,6
+75,10
@@
void Signal::set_name(QString name)
updating_name_widget_ = true;
name_widget_->setEditText(name);
updating_name_widget_ = false;
updating_name_widget_ = true;
name_widget_->setEditText(name);
updating_name_widget_ = false;
+
+ // Store the channel name in sigrok::Channel so that it
+ // will end up in the .sr file upon save.
+ channel_->set_name(name.toUtf8().constData());
}
bool Signal::enabled() const
}
bool Signal::enabled() const
@@
-97,15
+101,14
@@
shared_ptr<Channel> Signal::channel() const
void Signal::populate_popup_form(QWidget *parent, QFormLayout *form)
{
void Signal::populate_popup_form(QWidget *parent, QFormLayout *form)
{
- int index;
-
name_widget_ = new QComboBox(parent);
name_widget_->setEditable(true);
name_widget_ = new QComboBox(parent);
name_widget_->setEditable(true);
+ name_widget_->setCompleter(0);
- for(unsigned int i = 0; i < countof(ChannelNames); i++)
+ for
(unsigned int i = 0; i < countof(ChannelNames); i++)
name_widget_->insertItem(i, ChannelNames[i]);
name_widget_->insertItem(i, ChannelNames[i]);
- index = name_widget_->findText(name_, Qt::MatchExactly);
+
const int
index = name_widget_->findText(name_, Qt::MatchExactly);
if (index == -1) {
name_widget_->insertItem(0, name_);
if (index == -1) {
name_widget_->insertItem(0, name_);