]> sigrok.org Git - pulseview.git/commitdiff
Added message when there is an empty decode stack
authorJoel Holdsworth <redacted>
Sat, 30 Nov 2013 17:48:10 +0000 (17:48 +0000)
committerJoel Holdsworth <redacted>
Sat, 30 Nov 2013 18:14:05 +0000 (18:14 +0000)
pv/view/decodetrace.cpp

index bad849c04665b2c53680836f610fdd329bc8ccd8..b67c0f7abeb256d0ae472f456d878b9cca5c468c 100644 (file)
@@ -148,14 +148,26 @@ void DecodeTrace::populate_popup_form(QWidget *parent, QFormLayout *form)
        _probe_selectors.clear();
 
        const list< shared_ptr<Decoder> >& stack = _decoder_stack->stack();
-       list< shared_ptr<Decoder> >::const_iterator iter = stack.begin();
-       for (int i = 0; i < (int)stack.size(); i++, iter++) {
-               shared_ptr<Decoder> dec(*iter);
-               create_decoder_form(i, dec, parent, form);
+
+       if (stack.empty())
+       {
+               QLabel *const l = new QLabel(
+                       tr("<p><i>No decoders in the stack</i></p>"));
+               l->setAlignment(Qt::AlignCenter);
+               form->addRow(l);
        }
+       else
+       {
+               list< shared_ptr<Decoder> >::const_iterator iter =
+                       stack.begin();
+               for (int i = 0; i < (int)stack.size(); i++, iter++) {
+                       shared_ptr<Decoder> dec(*iter);
+                       create_decoder_form(i, dec, parent, form);
+               }
 
-       form->addRow(new QLabel(
-               tr("<i>* Required Probes</i>"), parent));
+               form->addRow(new QLabel(
+                       tr("<i>* Required Probes</i>"), parent));
+       }
 
        // Add stacking button
        pv::widgets::DecoderMenu *const decoder_menu =