X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fdialogs%2Fabout.cpp;h=dbe7d9b809a43f76821e7314950b9d346f5f83db;hp=c4827962c59afda9891b62a99cd2268ae8c44234;hb=b14db788ee3483eed195c1e73a1ab85ea8c41e47;hpb=9ab0d1f7b53d4e10f6ee7abd0b02816eafac5f99 diff --git a/pv/dialogs/about.cpp b/pv/dialogs/about.cpp index c4827962..dbe7d9b8 100644 --- a/pv/dialogs/about.cpp +++ b/pv/dialogs/about.cpp @@ -14,8 +14,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * along with this program; if not, see . */ #ifdef ENABLE_DECODE @@ -24,25 +23,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; - struct sr_input_format **inputs; - #ifdef ENABLE_DECODE struct srd_decoder *dec; #endif @@ -53,10 +48,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(""); @@ -65,21 +60,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(drivers[i]->name)) - .arg(QString::fromUtf8(drivers[i]->longname))); + .arg(QString::fromUtf8(entry.first.c_str()), + QString::fromUtf8(entry.second->long_name().c_str()))); } s.append(""); - inputs = sr_input_list(); - for (int i = 0; inputs[i]; ++i) { + 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(inputs[i]->id)) - .arg(QString::fromUtf8(inputs[i]->description))); + .arg(QString::fromUtf8(entry.first.c_str()), + QString::fromUtf8(entry.second->description().c_str()))); } #ifdef ENABLE_DECODE @@ -89,16 +91,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()