mirror of git://sigrok.org/pulseview
MathSignal: Add config dialog
This commit is contained in:
parent
4788af1e3e
commit
86eeec3bfd
|
@ -0,0 +1,197 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||||
|
|
||||||
|
<svg
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
width="73.108994mm"
|
||||||
|
height="72.888451mm"
|
||||||
|
viewBox="0 0 73.108993 72.88845"
|
||||||
|
version="1.1"
|
||||||
|
id="svg8"
|
||||||
|
inkscape:version="0.92.4 5da689c313, 2019-01-14"
|
||||||
|
sodipodi:docname="math.svg">
|
||||||
|
<defs
|
||||||
|
id="defs2" />
|
||||||
|
<sodipodi:namedview
|
||||||
|
id="base"
|
||||||
|
pagecolor="#ffffff"
|
||||||
|
bordercolor="#666666"
|
||||||
|
borderopacity="1.0"
|
||||||
|
inkscape:pageopacity="0.0"
|
||||||
|
inkscape:pageshadow="2"
|
||||||
|
inkscape:zoom="2.3994141"
|
||||||
|
inkscape:cx="136.49166"
|
||||||
|
inkscape:cy="131.54997"
|
||||||
|
inkscape:document-units="mm"
|
||||||
|
inkscape:current-layer="layer2"
|
||||||
|
showgrid="false"
|
||||||
|
fit-margin-top="0"
|
||||||
|
fit-margin-left="0"
|
||||||
|
fit-margin-right="0"
|
||||||
|
fit-margin-bottom="0"
|
||||||
|
inkscape:window-width="1920"
|
||||||
|
inkscape:window-height="1022"
|
||||||
|
inkscape:window-x="0"
|
||||||
|
inkscape:window-y="0"
|
||||||
|
inkscape:window-maximized="1" />
|
||||||
|
<metadata
|
||||||
|
id="metadata5">
|
||||||
|
<rdf:RDF>
|
||||||
|
<cc:Work
|
||||||
|
rdf:about="">
|
||||||
|
<dc:format>image/svg+xml</dc:format>
|
||||||
|
<dc:type
|
||||||
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||||
|
<dc:title></dc:title>
|
||||||
|
</cc:Work>
|
||||||
|
</rdf:RDF>
|
||||||
|
</metadata>
|
||||||
|
<g
|
||||||
|
inkscape:groupmode="layer"
|
||||||
|
id="layer2"
|
||||||
|
inkscape:label="bg"
|
||||||
|
style="display:inline"
|
||||||
|
transform="translate(-9.0421371,-8.6010609)">
|
||||||
|
<rect
|
||||||
|
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.26499999;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:normal"
|
||||||
|
id="rect901"
|
||||||
|
width="33.522072"
|
||||||
|
height="33.522072"
|
||||||
|
x="9.0421381"
|
||||||
|
y="8.6010609"
|
||||||
|
ry="7.3880887" />
|
||||||
|
<rect
|
||||||
|
ry="7.3880887"
|
||||||
|
y="8.6010609"
|
||||||
|
x="48.629059"
|
||||||
|
height="33.522072"
|
||||||
|
width="33.522072"
|
||||||
|
id="rect4606"
|
||||||
|
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.26499999;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:normal" />
|
||||||
|
<rect
|
||||||
|
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.26499999;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:normal"
|
||||||
|
id="rect4608"
|
||||||
|
width="33.522072"
|
||||||
|
height="33.522072"
|
||||||
|
x="48.629059"
|
||||||
|
y="47.967442"
|
||||||
|
ry="7.3880887" />
|
||||||
|
<rect
|
||||||
|
ry="7.3880887"
|
||||||
|
y="47.967442"
|
||||||
|
x="9.0421371"
|
||||||
|
height="33.522072"
|
||||||
|
width="33.522072"
|
||||||
|
id="rect4610"
|
||||||
|
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.26499999;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:normal" />
|
||||||
|
</g>
|
||||||
|
<g
|
||||||
|
inkscape:groupmode="layer"
|
||||||
|
id="layer3"
|
||||||
|
inkscape:label="text"
|
||||||
|
style="display:inline"
|
||||||
|
transform="translate(-9.0421371,-8.6010609)">
|
||||||
|
<text
|
||||||
|
xml:space="preserve"
|
||||||
|
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:2.3812499px;line-height:125%;font-family:Sans;-inkscape-font-specification:Helvetica;text-align:start;letter-spacing:0px;word-spacing:0px;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||||
|
x="-26.023714"
|
||||||
|
y="23.928589"
|
||||||
|
id="text4615"><tspan
|
||||||
|
sodipodi:role="line"
|
||||||
|
id="tspan4613"
|
||||||
|
x="-26.023714"
|
||||||
|
y="26.073511"
|
||||||
|
style="line-height:25.34355545px;stroke-width:0.26458332px" /></text>
|
||||||
|
<text
|
||||||
|
xml:space="preserve"
|
||||||
|
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:2.3812499px;line-height:125%;font-family:Sans;-inkscape-font-specification:Helvetica;text-align:start;letter-spacing:0px;word-spacing:0px;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||||
|
x="-6.8615932"
|
||||||
|
y="27.153271"
|
||||||
|
id="text4619"><tspan
|
||||||
|
sodipodi:role="line"
|
||||||
|
id="tspan4617"
|
||||||
|
x="-6.8615932"
|
||||||
|
y="29.298193"
|
||||||
|
style="stroke-width:0.26458332px" /></text>
|
||||||
|
<text
|
||||||
|
xml:space="preserve"
|
||||||
|
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:2.3812499px;line-height:125%;font-family:Sans;-inkscape-font-specification:Helvetica;text-align:start;letter-spacing:0px;word-spacing:0px;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||||
|
x="-22.715614"
|
||||||
|
y="52.267971"
|
||||||
|
id="text4635"><tspan
|
||||||
|
sodipodi:role="line"
|
||||||
|
id="tspan4633"
|
||||||
|
x="-22.715614"
|
||||||
|
y="54.412891"
|
||||||
|
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:42.33333206px;font-family:Sans;-inkscape-font-specification:'Sans, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;writing-mode:lr-tb;text-anchor:start;stroke-width:0.26458332px" /></text>
|
||||||
|
<g
|
||||||
|
id="g4686"
|
||||||
|
style="fill:#fcfcfc;fill-opacity:1">
|
||||||
|
<text
|
||||||
|
id="text4627"
|
||||||
|
y="39.476654"
|
||||||
|
x="13.673477"
|
||||||
|
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:2.3812499px;line-height:125%;font-family:Sans;-inkscape-font-specification:Helvetica;text-align:start;letter-spacing:0px;word-spacing:0px;text-anchor:start;fill:#fcfcfc;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||||
|
xml:space="preserve"><tspan
|
||||||
|
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:42.33333206px;font-family:Sans;-inkscape-font-specification:'Sans, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;writing-mode:lr-tb;text-anchor:start;fill:#fcfcfc;fill-opacity:1;stroke-width:0.26458332px"
|
||||||
|
y="39.476654"
|
||||||
|
x="13.673477"
|
||||||
|
id="tspan4625"
|
||||||
|
sodipodi:role="line">+</tspan></text>
|
||||||
|
<text
|
||||||
|
transform="scale(1.4000838,0.71424298)"
|
||||||
|
id="text4631"
|
||||||
|
y="51.256554"
|
||||||
|
x="36.829548"
|
||||||
|
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.33394933px;line-height:125%;font-family:Sans;-inkscape-font-specification:Helvetica;text-align:start;letter-spacing:0px;word-spacing:0px;text-anchor:start;fill:#fcfcfc;fill-opacity:1;stroke:none;stroke-width:0.37043878px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||||
|
xml:space="preserve"><tspan
|
||||||
|
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:59.27021027px;font-family:Sans;-inkscape-font-specification:'Sans, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;writing-mode:lr-tb;text-anchor:start;fill:#fcfcfc;fill-opacity:1;stroke-width:0.37043878px"
|
||||||
|
y="51.256554"
|
||||||
|
x="36.829548"
|
||||||
|
id="tspan4629"
|
||||||
|
sodipodi:role="line">-</tspan></text>
|
||||||
|
<text
|
||||||
|
transform="rotate(-45)"
|
||||||
|
xml:space="preserve"
|
||||||
|
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:2.3812499px;line-height:125%;font-family:Sans;-inkscape-font-specification:Helvetica;text-align:start;letter-spacing:0px;word-spacing:0px;text-anchor:start;fill:#fcfcfc;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||||
|
x="-39.823532"
|
||||||
|
y="78.197281"
|
||||||
|
id="text4639"><tspan
|
||||||
|
sodipodi:role="line"
|
||||||
|
id="tspan4637"
|
||||||
|
x="-39.823532"
|
||||||
|
y="78.197281"
|
||||||
|
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:42.33333206px;font-family:Sans;-inkscape-font-specification:'Sans, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;writing-mode:lr-tb;text-anchor:start;fill:#fcfcfc;fill-opacity:1;stroke-width:0.26458332px">+</tspan></text>
|
||||||
|
<text
|
||||||
|
transform="scale(1.4000838,0.71424297)"
|
||||||
|
id="text4631-7"
|
||||||
|
y="106.67771"
|
||||||
|
x="36.993214"
|
||||||
|
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.33394957px;line-height:125%;font-family:Sans;-inkscape-font-specification:Helvetica;text-align:start;letter-spacing:0px;word-spacing:0px;text-anchor:start;display:inline;fill:#fcfcfc;fill-opacity:1;stroke:none;stroke-width:0.37043881px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||||
|
xml:space="preserve"><tspan
|
||||||
|
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:59.27021027px;font-family:Sans;-inkscape-font-specification:'Sans, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;writing-mode:lr-tb;text-anchor:start;fill:#fcfcfc;fill-opacity:1;stroke-width:0.37043881px"
|
||||||
|
y="106.67771"
|
||||||
|
x="36.993214"
|
||||||
|
id="tspan4629-6"
|
||||||
|
sodipodi:role="line">-</tspan></text>
|
||||||
|
<circle
|
||||||
|
r="2.976748"
|
||||||
|
cy="57.78373"
|
||||||
|
cx="65.500908"
|
||||||
|
id="path4659"
|
||||||
|
style="opacity:1;fill:#fcfcfc;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.26499999;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal" />
|
||||||
|
<circle
|
||||||
|
r="2.976748"
|
||||||
|
cy="71.785759"
|
||||||
|
cx="65.500366"
|
||||||
|
id="path4659-0"
|
||||||
|
style="display:inline;opacity:1;fill:#fcfcfc;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.26499999;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal" />
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 10 KiB |
|
@ -10,6 +10,7 @@
|
||||||
<file>icons/document-new.png</file>
|
<file>icons/document-new.png</file>
|
||||||
<file>icons/document-open.png</file>
|
<file>icons/document-open.png</file>
|
||||||
<file>icons/document-save-as.png</file>
|
<file>icons/document-save-as.png</file>
|
||||||
|
<file>icons/math.svg</file>
|
||||||
<file>icons/edit-paste.svg</file>
|
<file>icons/edit-paste.svg</file>
|
||||||
<file>icons/help-browser.png</file>
|
<file>icons/help-browser.png</file>
|
||||||
<file>icons/information.svg</file>
|
<file>icons/information.svg</file>
|
||||||
|
|
|
@ -53,10 +53,10 @@ public:
|
||||||
QWidget *get_about_page(QWidget *parent) const;
|
QWidget *get_about_page(QWidget *parent) const;
|
||||||
QWidget *get_logging_page(QWidget *parent) const;
|
QWidget *get_logging_page(QWidget *parent) const;
|
||||||
|
|
||||||
|
private Q_SLOTS:
|
||||||
void accept();
|
void accept();
|
||||||
void reject();
|
void reject();
|
||||||
|
|
||||||
private Q_SLOTS:
|
|
||||||
void on_page_changed(QListWidgetItem *current, QListWidgetItem *previous);
|
void on_page_changed(QListWidgetItem *current, QListWidgetItem *previous);
|
||||||
void on_general_language_changed(const QString &text);
|
void on_general_language_changed(const QString &text);
|
||||||
void on_general_theme_changed(int value);
|
void on_general_theme_changed(int value);
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#include <QDialogButtonBox>
|
||||||
#include <QFormLayout>
|
#include <QFormLayout>
|
||||||
#include <QGridLayout>
|
#include <QGridLayout>
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
|
@ -38,6 +39,42 @@ namespace trace {
|
||||||
|
|
||||||
#define MATHSIGNAL_INPUT_TIMEOUT (2000)
|
#define MATHSIGNAL_INPUT_TIMEOUT (2000)
|
||||||
|
|
||||||
|
|
||||||
|
MathEditDialog::MathEditDialog(pv::Session &session,
|
||||||
|
shared_ptr<pv::data::MathSignal> math_signal, QWidget *parent) :
|
||||||
|
QDialog(parent),
|
||||||
|
session_(session),
|
||||||
|
math_signal_(math_signal),
|
||||||
|
expression_(math_signal->get_expression()),
|
||||||
|
old_expression_(math_signal->get_expression())
|
||||||
|
{
|
||||||
|
setWindowTitle(tr("Math Expression Editor"));
|
||||||
|
|
||||||
|
// Create the rest of the dialog
|
||||||
|
QDialogButtonBox *button_box = new QDialogButtonBox(
|
||||||
|
QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
||||||
|
|
||||||
|
QVBoxLayout* root_layout = new QVBoxLayout(this);
|
||||||
|
// root_layout->addLayout(tab_layout);
|
||||||
|
root_layout->addWidget(button_box);
|
||||||
|
|
||||||
|
connect(button_box, SIGNAL(accepted()), this, SLOT(accept()));
|
||||||
|
connect(button_box, SIGNAL(rejected()), this, SLOT(reject()));
|
||||||
|
}
|
||||||
|
|
||||||
|
void MathEditDialog::accept()
|
||||||
|
{
|
||||||
|
math_signal_->set_expression(expression_);
|
||||||
|
QDialog::accept();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MathEditDialog::reject()
|
||||||
|
{
|
||||||
|
math_signal_->set_expression(old_expression_);
|
||||||
|
QDialog::reject();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
MathSignal::MathSignal(
|
MathSignal::MathSignal(
|
||||||
pv::Session &session,
|
pv::Session &session,
|
||||||
shared_ptr<data::SignalBase> base) :
|
shared_ptr<data::SignalBase> base) :
|
||||||
|
@ -56,8 +93,15 @@ void MathSignal::populate_popup_form(QWidget *parent, QFormLayout *form)
|
||||||
|
|
||||||
expression_edit_ = new QLineEdit();
|
expression_edit_ = new QLineEdit();
|
||||||
expression_edit_->setText(math_signal_->get_expression());
|
expression_edit_->setText(math_signal_->get_expression());
|
||||||
|
|
||||||
|
const QIcon edit_icon(QIcon::fromTheme("edit", QIcon(":/icons/math.svg")));
|
||||||
|
QAction *edit_action =
|
||||||
|
expression_edit_->addAction(edit_icon, QLineEdit::TrailingPosition);
|
||||||
|
|
||||||
connect(expression_edit_, SIGNAL(textEdited(QString)),
|
connect(expression_edit_, SIGNAL(textEdited(QString)),
|
||||||
this, SLOT(on_expression_changed(QString)));
|
this, SLOT(on_expression_changed(QString)));
|
||||||
|
connect(edit_action, SIGNAL(triggered(bool)),
|
||||||
|
this, SLOT(on_edit_clicked()));
|
||||||
form->addRow(tr("Expression"), expression_edit_);
|
form->addRow(tr("Expression"), expression_edit_);
|
||||||
|
|
||||||
sample_count_cb_ = new QComboBox();
|
sample_count_cb_ = new QComboBox();
|
||||||
|
@ -92,6 +136,13 @@ void MathSignal::on_sample_count_changed(const QString &text)
|
||||||
(void)text;
|
(void)text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MathSignal::on_edit_clicked()
|
||||||
|
{
|
||||||
|
MathEditDialog dlg(session_, math_signal_);
|
||||||
|
|
||||||
|
dlg.exec();
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace trace
|
} // namespace trace
|
||||||
} // namespace views
|
} // namespace views
|
||||||
} // namespace pv
|
} // namespace pv
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#define PULSEVIEW_PV_VIEWS_TRACE_MATHSIGNAL_HPP
|
#define PULSEVIEW_PV_VIEWS_TRACE_MATHSIGNAL_HPP
|
||||||
|
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
|
#include <QDialog>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
|
@ -33,6 +34,25 @@ namespace pv {
|
||||||
namespace views {
|
namespace views {
|
||||||
namespace trace {
|
namespace trace {
|
||||||
|
|
||||||
|
class MathEditDialog : public QDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
MathEditDialog(pv::Session &session, shared_ptr<pv::data::MathSignal> math_signal,
|
||||||
|
QWidget *parent = nullptr);
|
||||||
|
|
||||||
|
private Q_SLOTS:
|
||||||
|
void accept();
|
||||||
|
void reject();
|
||||||
|
|
||||||
|
private:
|
||||||
|
pv::Session &session_;
|
||||||
|
shared_ptr<pv::data::MathSignal> math_signal_;
|
||||||
|
QString expression_, old_expression_;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
class MathSignal : public AnalogSignal
|
class MathSignal : public AnalogSignal
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -49,6 +69,8 @@ private Q_SLOTS:
|
||||||
void on_expression_changed(const QString &text);
|
void on_expression_changed(const QString &text);
|
||||||
void on_sample_count_changed(const QString &text);
|
void on_sample_count_changed(const QString &text);
|
||||||
|
|
||||||
|
void on_edit_clicked();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QLineEdit *expression_edit_;
|
QLineEdit *expression_edit_;
|
||||||
QComboBox *sample_count_cb_, *sample_rate_cb_;
|
QComboBox *sample_count_cb_, *sample_rate_cb_;
|
||||||
|
|
Loading…
Reference in New Issue