forked from Ivasoft/DSView
fix stack decoder create issue
This commit is contained in:
@@ -120,7 +120,9 @@ DecodeTrace::DecodeTrace(pv::SigSession &session,
|
|||||||
decoder_stack->stack().front()->decoder()->name), index, Trace::DS_DECODER),
|
decoder_stack->stack().front()->decoder()->name), index, Trace::DS_DECODER),
|
||||||
_session(session),
|
_session(session),
|
||||||
_decoder_stack(decoder_stack),
|
_decoder_stack(decoder_stack),
|
||||||
_show_hide_mapper(this)
|
_show_hide_mapper(this),
|
||||||
|
_popup_form(NULL),
|
||||||
|
_popup()
|
||||||
{
|
{
|
||||||
assert(_decoder_stack);
|
assert(_decoder_stack);
|
||||||
|
|
||||||
@@ -297,21 +299,11 @@ void DecodeTrace::paint_fore(QPainter &p, int left, int right)
|
|||||||
|
|
||||||
bool DecodeTrace::create_popup()
|
bool DecodeTrace::create_popup()
|
||||||
{
|
{
|
||||||
// Clear the layout
|
|
||||||
|
|
||||||
// Transfer the layout and the child widgets to a temporary widget
|
|
||||||
// which then goes out of scope destroying the layout and all the child
|
|
||||||
// widgets.
|
|
||||||
//if (_popup_form)
|
|
||||||
// QWidget().setLayout(_popup_form);
|
|
||||||
|
|
||||||
int ret = false;
|
int ret = false;
|
||||||
QDialog popup;
|
_popup = new QDialog();
|
||||||
QFormLayout popup_form;
|
create_popup_form();
|
||||||
popup.setLayout(&popup_form);
|
|
||||||
populate_popup_form(&popup, &popup_form);
|
|
||||||
|
|
||||||
if (QDialog::Accepted == popup.exec())
|
if (QDialog::Accepted == _popup->exec())
|
||||||
{
|
{
|
||||||
BOOST_FOREACH(shared_ptr<data::decode::Decoder> dec,
|
BOOST_FOREACH(shared_ptr<data::decode::Decoder> dec,
|
||||||
_decoder_stack->stack())
|
_decoder_stack->stack())
|
||||||
@@ -321,12 +313,28 @@ bool DecodeTrace::create_popup()
|
|||||||
ret = true;
|
ret = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
return false;
|
_popup = NULL;
|
||||||
|
_popup_form = NULL;
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DecodeTrace::create_popup_form()
|
||||||
|
{
|
||||||
|
// Clear the layout
|
||||||
|
|
||||||
|
// Transfer the layout and the child widgets to a temporary widget
|
||||||
|
// which then goes out of scope destroying the layout and all the child
|
||||||
|
// widgets.
|
||||||
|
if (_popup_form)
|
||||||
|
QWidget().setLayout(_popup_form);
|
||||||
|
|
||||||
|
_popup_form = new QFormLayout(_popup);
|
||||||
|
_popup->setLayout(_popup_form);
|
||||||
|
populate_popup_form(_popup, _popup_form);
|
||||||
|
}
|
||||||
|
|
||||||
void DecodeTrace::populate_popup_form(QWidget *parent, QFormLayout *form)
|
void DecodeTrace::populate_popup_form(QWidget *parent, QFormLayout *form)
|
||||||
{
|
{
|
||||||
@@ -368,8 +376,8 @@ void DecodeTrace::populate_popup_form(QWidget *parent, QFormLayout *form)
|
|||||||
new pv::widgets::DecoderMenu(parent);
|
new pv::widgets::DecoderMenu(parent);
|
||||||
connect(decoder_menu, SIGNAL(decoder_selected(srd_decoder*)),
|
connect(decoder_menu, SIGNAL(decoder_selected(srd_decoder*)),
|
||||||
this, SLOT(on_stack_decoder(srd_decoder*)));
|
this, SLOT(on_stack_decoder(srd_decoder*)));
|
||||||
connect(decoder_menu, SIGNAL(selected()),
|
//connect(decoder_menu, SIGNAL(selected()),
|
||||||
parent, SLOT(accept()));
|
// parent, SLOT(accept()));
|
||||||
|
|
||||||
QPushButton *const stack_button =
|
QPushButton *const stack_button =
|
||||||
new QPushButton(tr("Stack Decoder"), parent);
|
new QPushButton(tr("Stack Decoder"), parent);
|
||||||
@@ -769,7 +777,7 @@ void DecodeTrace::on_stack_decoder(srd_decoder *decoder)
|
|||||||
new data::decode::Decoder(decoder)));
|
new data::decode::Decoder(decoder)));
|
||||||
//_decoder_stack->begin_decode();
|
//_decoder_stack->begin_decode();
|
||||||
|
|
||||||
create_popup();
|
create_popup_form();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DecodeTrace::on_show_hide_decoder(int index)
|
void DecodeTrace::on_show_hide_decoder(int index)
|
||||||
|
|||||||
@@ -128,6 +128,8 @@ protected:
|
|||||||
void paint_type_options(QPainter &p, int right, bool hover, int action);
|
void paint_type_options(QPainter &p, int right, bool hover, int action);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void create_popup_form();
|
||||||
|
|
||||||
void populate_popup_form(QWidget *parent, QFormLayout *form);
|
void populate_popup_form(QWidget *parent, QFormLayout *form);
|
||||||
|
|
||||||
void draw_annotation(const pv::data::decode::Annotation &a, QPainter &p,
|
void draw_annotation(const pv::data::decode::Annotation &a, QPainter &p,
|
||||||
@@ -196,6 +198,8 @@ private:
|
|||||||
std::vector<QString> _cur_row_headings;
|
std::vector<QString> _cur_row_headings;
|
||||||
|
|
||||||
QSignalMapper _show_hide_mapper;
|
QSignalMapper _show_hide_mapper;
|
||||||
|
QFormLayout *_popup_form;
|
||||||
|
QDialog *_popup;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace view
|
} // namespace view
|
||||||
|
|||||||
@@ -308,7 +308,10 @@ void Viewport::paintProgress(QPainter &p)
|
|||||||
(status.captured_cnt1 << 8) +
|
(status.captured_cnt1 << 8) +
|
||||||
(status.captured_cnt2 << 16) +
|
(status.captured_cnt2 << 16) +
|
||||||
(status.captured_cnt3 << 24));
|
(status.captured_cnt3 << 24));
|
||||||
captured_progress = captured_cnt * 100.0 / _total_sample_len;
|
if (triggred)
|
||||||
|
captured_progress = (_total_sample_len - captured_cnt) * 100.0 / _total_sample_len;
|
||||||
|
else
|
||||||
|
captured_progress = captured_cnt * 100.0 / _total_sample_len;
|
||||||
|
|
||||||
|
|
||||||
p.setPen(Trace::dsLightBlue);
|
p.setPen(Trace::dsLightBlue);
|
||||||
@@ -320,7 +323,7 @@ void Viewport::paintProgress(QPainter &p)
|
|||||||
if (triggred)
|
if (triggred)
|
||||||
p.drawText(status_rect,
|
p.drawText(status_rect,
|
||||||
Qt::AlignCenter | Qt::AlignVCenter,
|
Qt::AlignCenter | Qt::AlignVCenter,
|
||||||
"Triggered! " + QString::number(1-captured_progress)+"% Captured");
|
"Triggered! " + QString::number(captured_progress)+"% Captured");
|
||||||
else
|
else
|
||||||
p.drawText(status_rect,
|
p.drawText(status_rect,
|
||||||
Qt::AlignCenter | Qt::AlignVCenter,
|
Qt::AlignCenter | Qt::AlignVCenter,
|
||||||
|
|||||||
Reference in New Issue
Block a user