]> sigrok.org Git - pulseview.git/commitdiff
Added decoder dialog heading
authorJoel Holdsworth <redacted>
Mon, 31 Dec 2012 09:56:00 +0000 (09:56 +0000)
committerJoel Holdsworth <redacted>
Sun, 22 Sep 2013 22:15:05 +0000 (23:15 +0100)
pv/dialogs/decoder.cpp
pv/dialogs/decoder.h
pv/mainwindow.cpp

index 01cec8431a9feacbc1b7c99e792de016ee50b3e1..afb5852db729cf2b184b590cd6e48d42f7e9dc9e 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
  */
 
-#include "decoder.h"
-
 extern "C" {
-/* __STDC_FORMAT_MACROS is required for PRIu64 and friends (in C++). */
-#define __STDC_FORMAT_MACROS
-#include <glib.h>
-#include <libsigrok/libsigrok.h>
+#include <libsigrokdecode/libsigrokdecode.h>
 }
 
+#include "decoder.h"
+
 namespace pv {
 namespace dialogs {
 
-Decoder::Decoder(QWidget *parent) :
+Decoder::Decoder(QWidget *parent, const srd_decoder *decoder) :
        QDialog(parent),
+       _decoder(decoder),
        _layout(this),
        _form(this),
        _form_layout(&_form),
+       _heading(this),
        _button_box(QDialogButtonBox::Ok | QDialogButtonBox::Cancel,
                Qt::Horizontal, this)
 {
-       setWindowTitle(tr("Configure Decoder"));
+       setWindowTitle(tr("Configure %1").arg(decoder->name));
+
+       _heading.setText(tr("<h3>%1</h3>%2")
+               .arg(decoder->longname)
+               .arg(decoder->desc));
 
        connect(&_button_box, SIGNAL(accepted()), this, SLOT(accept()));
        connect(&_button_box, SIGNAL(rejected()), this, SLOT(reject()));
@@ -46,6 +49,7 @@ Decoder::Decoder(QWidget *parent) :
        _form.setLayout(&_form_layout);
 
        setLayout(&_layout);
+       _layout.addWidget(&_heading);
        _layout.addWidget(&_form);
        _layout.addWidget(&_button_box);
 }
index 9d61202fcb7d447fa55b867f96eb1ca0c680576f..eed33ac0f2dbdd9a67d73c36fa1519e16675776f 100644 (file)
 #include <QDialog>
 #include <QDialogButtonBox>
 #include <QFormLayout>
+#include <QLabel>
 #include <QVBoxLayout>
 
+struct srd_decoder;
+
 namespace pv {
 namespace dialogs {
 
 class Decoder : public QDialog
 {
 public:
-       Decoder(QWidget *parent);
+       Decoder(QWidget *parent, const srd_decoder *decoder);
 
 private:
+       const srd_decoder *const _decoder;
+
        QVBoxLayout _layout;
 
        QWidget _form;
        QFormLayout _form_layout;
 
+       QLabel _heading;
        QDialogButtonBox _button_box;
 };
 
index 9873541dd5dbe4dc24aea9be777a949cc15c0e96..eae106746b76b6313182ecdf9f7bdf7661b72fb5 100644 (file)
@@ -388,7 +388,7 @@ void MainWindow::add_decoder(QObject *action)
                (srd_decoder*)((QAction*)action)->data().value<void*>();
        assert(dec);
 
-       dialogs::Decoder dlg(this);
+       dialogs::Decoder dlg(this, dec);
        dlg.exec();
 }