projects
/
pulseview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Introduce pv::data::SignalBase
[pulseview.git]
/
pv
/
view
/
signal.cpp
diff --git
a/pv/view/signal.cpp
b/pv/view/signal.cpp
index 5cd5b183590af45dcd783dd948f3a0d81af84582..fc90eba1fcd11cf6f5b5d0e132895304b8cbc9f9 100644
(file)
--- a/
pv/view/signal.cpp
+++ b/
pv/view/signal.cpp
@@
-31,14
+31,14
@@
#include <libsigrokcxx/libsigrokcxx.hpp>
#include <libsigrokcxx/libsigrokcxx.hpp>
+#include "pv/data/signalbase.hpp"
+
#include "signal.hpp"
#include "view.hpp"
using std::shared_ptr;
using std::make_shared;
#include "signal.hpp"
#include "view.hpp"
using std::shared_ptr;
using std::make_shared;
-using sigrok::Channel;
-
namespace pv {
namespace view {
namespace pv {
namespace view {
@@
-60,10
+60,9
@@
const char *const ChannelNames[] = {
};
Signal::Signal(pv::Session &session,
};
Signal::Signal(pv::Session &session,
- std::shared_ptr<
sigrok::Channel
> channel) :
- Trace(
QString::fromUtf8(channel->name().c_str())
),
+ std::shared_ptr<
data::SignalBase
> channel) :
+ Trace(
channel
),
session_(session),
session_(session),
- channel_(channel),
scale_handle_(make_shared<SignalScaleHandle>(*this)),
items_({scale_handle_}),
name_widget_(nullptr)
scale_handle_(make_shared<SignalScaleHandle>(*this)),
items_({scale_handle_}),
name_widget_(nullptr)
@@
-77,10
+76,6
@@
void Signal::set_name(QString name)
if (name != name_widget_->currentText())
name_widget_->setEditText(name);
if (name != name_widget_->currentText())
name_widget_->setEditText(name);
-
- // 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
@@
-96,7
+91,7
@@
void Signal::enable(bool enable)
owner_->extents_changed(true, true);
}
owner_->extents_changed(true, true);
}
-shared_ptr<
Channel
> Signal::channel() const
+shared_ptr<
data::SignalBase
> Signal::channel() const
{
return channel_;
}
{
return channel_;
}
@@
-121,17
+116,17
@@
void Signal::populate_popup_form(QWidget *parent, QFormLayout *form)
for (unsigned int i = 0; i < countof(ChannelNames); i++)
name_widget_->insertItem(i, ChannelNames[i]);
for (unsigned int i = 0; i < countof(ChannelNames); i++)
name_widget_->insertItem(i, ChannelNames[i]);
- const int index = name_widget_->findText(
name_
, Qt::MatchExactly);
+ const int index = name_widget_->findText(
channel_->name()
, Qt::MatchExactly);
if (index == -1) {
if (index == -1) {
- name_widget_->insertItem(0,
name_
);
+ name_widget_->insertItem(0,
channel_->name()
);
name_widget_->setCurrentIndex(0);
} else {
name_widget_->setCurrentIndex(index);
}
connect(name_widget_, SIGNAL(editTextChanged(const QString&)),
name_widget_->setCurrentIndex(0);
} else {
name_widget_->setCurrentIndex(index);
}
connect(name_widget_, SIGNAL(editTextChanged(const QString&)),
- this, SLOT(on_
tex
t_changed(const QString&)));
+ this, SLOT(on_
nameedi
t_changed(const QString&)));
form->addRow(tr("Name"), name_widget_);
form->addRow(tr("Name"), name_widget_);
@@
-157,6
+152,14
@@
void Signal::delete_pressed()
on_disable();
}
on_disable();
}
+void Signal::on_name_changed(const QString &text)
+{
+ if (text != name_widget_->currentText())
+ name_widget_->setEditText(text);
+
+ Trace::on_name_changed(text);
+}
+
void Signal::on_disable()
{
enable(false);
void Signal::on_disable()
{
enable(false);