]> sigrok.org Git - pulseview.git/blame - pv/dialogs/about.cpp
Fix #849 by making sure no references to the DecodeTrace instance remain
[pulseview.git] / pv / dialogs / about.cpp
CommitLineData
40eb2ff4 1/*
b3f22de0 2 * This file is part of the PulseView project.
40eb2ff4
JH
3 *
4 * Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
269528f5 21#ifdef ENABLE_DECODE
aaabd61b 22#include <libsigrokdecode/libsigrokdecode.h>
269528f5 23#endif
40eb2ff4
JH
24
25#include <QTextDocument>
26
2acdb232 27#include "about.hpp"
51e77110 28#include <ui_about.h>
40eb2ff4 29
fe3a1c21 30#include <libsigrokcxx/libsigrokcxx.hpp>
e82fd481 31
e8d00928
ML
32using std::shared_ptr;
33using sigrok::Context;
40eb2ff4 34
51e77110 35namespace pv {
acda14b8 36namespace dialogs {
51e77110 37
e8d00928 38About::About(shared_ptr<Context> context, QWidget *parent) :
40eb2ff4
JH
39 QDialog(parent),
40 ui(new Ui::About)
41{
269528f5 42#ifdef ENABLE_DECODE
40eb2ff4 43 struct srd_decoder *dec;
269528f5 44#endif
d52d8455 45
40eb2ff4
JH
46 QString s;
47
48 ui->setupUi(this);
49
50 /* Setup the version field */
51 ui->versionInfo->setText(tr("%1 %2<br />%3<br /><a href=\"%4\">%4</a>")
744aa24f
UH
52 .arg(QApplication::applicationName(),
53 QApplication::applicationVersion(),
54 tr("GNU GPL, version 3 or later"),
55 QApplication::organizationDomain()));
eb2b2d91 56 ui->versionInfo->setOpenExternalLinks(true);
40eb2ff4 57
be20a3b8
JH
58 s.append("<table>");
59
40eb2ff4 60 /* Set up the supported field */
be20a3b8
JH
61 s.append("<tr><td colspan=\"2\"><b>" +
62 tr("Supported hardware drivers:") +
63 "</b></td></tr>");
e8d00928
ML
64 for (auto entry : context->drivers()) {
65 s.append(QString("<tr><td><i>%1</i></td><td>%2</td></tr>")
744aa24f
UH
66 .arg(QString::fromUtf8(entry.first.c_str()),
67 QString::fromUtf8(entry.second->long_name().c_str())));
e8d00928
ML
68 }
69
70 s.append("<tr><td colspan=\"2\"><b>" +
71 tr("Supported input formats:") +
72 "</b></td></tr>");
73 for (auto entry : context->input_formats()) {
40eb2ff4 74 s.append(QString("<tr><td><i>%1</i></td><td>%2</td></tr>")
744aa24f
UH
75 .arg(QString::fromUtf8(entry.first.c_str()),
76 QString::fromUtf8(entry.second->description().c_str())));
40eb2ff4 77 }
40eb2ff4 78
23841977
UH
79 s.append("<tr><td colspan=\"2\"><b>" +
80 tr("Supported output formats:") +
81 "</b></td></tr>");
82 for (auto entry : context->output_formats()) {
83 s.append(QString("<tr><td><i>%1</i></td><td>%2</td></tr>")
744aa24f
UH
84 .arg(QString::fromUtf8(entry.first.c_str()),
85 QString::fromUtf8(entry.second->description().c_str())));
23841977
UH
86 }
87
269528f5 88#ifdef ENABLE_DECODE
be20a3b8
JH
89 s.append("<tr><td colspan=\"2\"><b>" +
90 tr("Supported protocol decoders:") +
91 "</b></td></tr>");
83259518 92 for (const GSList *l = srd_decoder_list(); l; l = l->next) {
40eb2ff4
JH
93 dec = (struct srd_decoder *)l->data;
94 s.append(QString("<tr><td><i>%1</i></td><td>%2</td></tr>")
744aa24f
UH
95 .arg(QString::fromUtf8(dec->id),
96 QString::fromUtf8(dec->longname)));
40eb2ff4 97 }
269528f5 98#endif
be20a3b8 99
40eb2ff4
JH
100 s.append("</table>");
101
db8a1b5c 102 supportedDoc = new QTextDocument(this);
40eb2ff4 103 supportedDoc->setHtml(s);
db8a1b5c 104 ui->supportList->setDocument(supportedDoc);
40eb2ff4
JH
105}
106
107About::~About()
108{
109 delete ui;
110}
51e77110 111
acda14b8 112} // namespace dialogs
51e77110 113} // namespace pv