]> sigrok.org Git - pulseview.git/blame - pv/dialogs/about.cpp
Adapt to new <libsigrokdecode/libsigrokdecode.h> header.
[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
d52d8455 21#ifdef ENABLE_SIGROKDECODE
aaabd61b 22#include <libsigrokdecode/libsigrokdecode.h>
d52d8455 23#endif
40eb2ff4
JH
24
25#include <QTextDocument>
26
27#include "about.h"
51e77110 28#include <ui_about.h>
40eb2ff4 29
40eb2ff4
JH
30/* __STDC_FORMAT_MACROS is required for PRIu64 and friends (in C++). */
31#define __STDC_FORMAT_MACROS
32#include <glib.h>
33#include <libsigrok/libsigrok.h>
e82fd481 34
40eb2ff4 35
51e77110 36namespace pv {
acda14b8 37namespace dialogs {
51e77110 38
40eb2ff4
JH
39About::About(QWidget *parent) :
40 QDialog(parent),
41 ui(new Ui::About)
42{
40eb2ff4
JH
43 struct sr_dev_driver **drivers;
44 struct sr_input_format **inputs;
45 struct sr_output_format **outputs;
d52d8455
JH
46
47#ifdef ENABLE_SIGROKDECODE
40eb2ff4 48 struct srd_decoder *dec;
d52d8455
JH
49#endif
50
40eb2ff4
JH
51 QString s;
52
53 ui->setupUi(this);
54
55 /* Setup the version field */
56 ui->versionInfo->setText(tr("%1 %2<br />%3<br /><a href=\"%4\">%4</a>")
57 .arg(QApplication::applicationName())
58 .arg(QApplication::applicationVersion())
0ec7aba5 59 .arg(tr("GNU GPL, version 3 or later"))
40eb2ff4 60 .arg(QApplication::organizationDomain()));
eb2b2d91 61 ui->versionInfo->setOpenExternalLinks(true);
40eb2ff4 62
be20a3b8
JH
63 s.append("<table>");
64
40eb2ff4 65 /* Set up the supported field */
be20a3b8
JH
66 s.append("<tr><td colspan=\"2\"><b>" +
67 tr("Supported hardware drivers:") +
68 "</b></td></tr>");
40eb2ff4
JH
69 drivers = sr_driver_list();
70 for (int i = 0; drivers[i]; ++i) {
71 s.append(QString("<tr><td><i>%1</i></td><td>%2</td></tr>")
72 .arg(QString(drivers[i]->name))
73 .arg(QString(drivers[i]->longname)));
74 }
40eb2ff4 75
be20a3b8
JH
76 s.append("<tr><td colspan=\"2\"><b>" +
77 tr("Supported input formats:") +
78 "</b></td></tr>");
40eb2ff4
JH
79 inputs = sr_input_list();
80 for (int i = 0; inputs[i]; ++i) {
81 s.append(QString("<tr><td><i>%1</i></td><td>%2</td></tr>")
82 .arg(QString(inputs[i]->id))
83 .arg(QString(inputs[i]->description)));
84 }
40eb2ff4 85
be20a3b8
JH
86 s.append("<tr><td colspan=\"2\"><b>" +
87 tr("Supported output formats:") +
88 "</b></td></tr>");
40eb2ff4
JH
89 outputs = sr_output_list();
90 for (int i = 0; outputs[i]; ++i) {
91 s.append(QString("<tr><td><i>%1</i></td><td>%2</td></tr>")
92 .arg(QString(outputs[i]->id))
93 .arg(QString(outputs[i]->description)));
94 }
40eb2ff4 95
d52d8455 96#ifdef ENABLE_SIGROKDECODE
be20a3b8
JH
97 s.append("<tr><td colspan=\"2\"><b>" +
98 tr("Supported protocol decoders:") +
99 "</b></td></tr>");
83259518 100 for (const GSList *l = srd_decoder_list(); l; l = l->next) {
40eb2ff4
JH
101 dec = (struct srd_decoder *)l->data;
102 s.append(QString("<tr><td><i>%1</i></td><td>%2</td></tr>")
103 .arg(QString(dec->id))
104 .arg(QString(dec->longname)));
105 }
d52d8455 106#endif
be20a3b8 107
40eb2ff4
JH
108 s.append("</table>");
109
110 supportedDoc.reset(new QTextDocument(this));
111 supportedDoc->setHtml(s);
112 ui->supportList->setDocument(supportedDoc.get());
113}
114
115About::~About()
116{
117 delete ui;
118}
51e77110 119
acda14b8 120} // namespace dialogs
51e77110 121} // namespace pv