From: Joel Holdsworth Date: Mon, 31 Dec 2012 09:56:00 +0000 (+0000) Subject: Added decoder dialog heading X-Git-Tag: pulseview-0.2.0~317 X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=commitdiff_plain;h=df840662d228637f84d44ec24005e8b9bed8628f Added decoder dialog heading --- diff --git a/pv/dialogs/decoder.cpp b/pv/dialogs/decoder.cpp index 01cec843..afb5852d 100644 --- a/pv/dialogs/decoder.cpp +++ b/pv/dialogs/decoder.cpp @@ -18,27 +18,30 @@ * 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 -#include +#include } +#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("

%1

%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); } diff --git a/pv/dialogs/decoder.h b/pv/dialogs/decoder.h index 9d61202f..eed33ac0 100644 --- a/pv/dialogs/decoder.h +++ b/pv/dialogs/decoder.h @@ -25,22 +25,28 @@ #include #include #include +#include #include +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; }; diff --git a/pv/mainwindow.cpp b/pv/mainwindow.cpp index 9873541d..eae10674 100644 --- a/pv/mainwindow.cpp +++ b/pv/mainwindow.cpp @@ -388,7 +388,7 @@ void MainWindow::add_decoder(QObject *action) (srd_decoder*)((QAction*)action)->data().value(); assert(dec); - dialogs::Decoder dlg(this); + dialogs::Decoder dlg(this, dec); dlg.exec(); }