X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=pv%2Fdialogs%2Fabout.cpp;h=0a47bdda92fa48938e7b78a33096eca860ff7e29;hb=c9da51187f8db0c9822d544a0253e0e7a58945d7;hp=f8394f2ae6f3784bdd72ef84089ac26e3dcd3711;hpb=ab973f4729258b729d2aa84abfa14b61609fa35e;p=pulseview.git diff --git a/pv/dialogs/about.cpp b/pv/dialogs/about.cpp index f8394f2a..0a47bdda 100644 --- a/pv/dialogs/about.cpp +++ b/pv/dialogs/about.cpp @@ -24,24 +24,21 @@ #include -#include "about.h" +#include "about.hpp" #include -/* __STDC_FORMAT_MACROS is required for PRIu64 and friends (in C++). */ -#define __STDC_FORMAT_MACROS -#include -#include +#include +using std::shared_ptr; +using sigrok::Context; namespace pv { namespace dialogs { -About::About(QWidget *parent) : +About::About(shared_ptr context, QWidget *parent) : QDialog(parent), ui(new Ui::About) { - struct sr_dev_driver **drivers; - #ifdef ENABLE_DECODE struct srd_decoder *dec; #endif @@ -52,10 +49,10 @@ About::About(QWidget *parent) : /* Setup the version field */ ui->versionInfo->setText(tr("%1 %2
%3
%4") - .arg(QApplication::applicationName()) - .arg(QApplication::applicationVersion()) - .arg(tr("GNU GPL, version 3 or later")) - .arg(QApplication::organizationDomain())); + .arg(QApplication::applicationName(), + QApplication::applicationVersion(), + tr("GNU GPL, version 3 or later"), + QApplication::organizationDomain())); ui->versionInfo->setOpenExternalLinks(true); s.append(""); @@ -64,11 +61,28 @@ About::About(QWidget *parent) : s.append(""); - drivers = sr_driver_list(); - for (int i = 0; drivers[i]; ++i) { + for (auto entry : context->drivers()) { + s.append(QString("") + .arg(QString::fromUtf8(entry.first.c_str()), + QString::fromUtf8(entry.second->long_name().c_str()))); + } + + s.append(""); + for (auto entry : context->input_formats()) { + s.append(QString("") + .arg(QString::fromUtf8(entry.first.c_str()), + QString::fromUtf8(entry.second->description().c_str()))); + } + + s.append(""); + for (auto entry : context->output_formats()) { s.append(QString("") - .arg(QString::fromUtf8(drivers[i]->name)) - .arg(QString::fromUtf8(drivers[i]->longname))); + .arg(QString::fromUtf8(entry.first.c_str()), + QString::fromUtf8(entry.second->description().c_str()))); } #ifdef ENABLE_DECODE @@ -78,16 +92,16 @@ About::About(QWidget *parent) : for (const GSList *l = srd_decoder_list(); l; l = l->next) { dec = (struct srd_decoder *)l->data; s.append(QString("") - .arg(QString::fromUtf8(dec->id)) - .arg(QString::fromUtf8(dec->longname))); + .arg(QString::fromUtf8(dec->id), + QString::fromUtf8(dec->longname))); } #endif s.append("
" + tr("Supported hardware drivers:") + "
%1%2
" + + tr("Supported input formats:") + + "
%1%2
" + + tr("Supported output formats:") + + "
%1%2
%1%2
"); - supportedDoc.reset(new QTextDocument(this)); + supportedDoc = new QTextDocument(this); supportedDoc->setHtml(s); - ui->supportList->setDocument(supportedDoc.get()); + ui->supportList->setDocument(supportedDoc); } About::~About()