]> sigrok.org Git - pulseview.git/blame_incremental - pv/dialogs/about.cpp
ViewItemPaintParams: Fixed height()
[pulseview.git] / pv / dialogs / about.cpp
... / ...
CommitLineData
1/*
2 * This file is part of the PulseView project.
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
21#ifdef ENABLE_DECODE
22#include <libsigrokdecode/libsigrokdecode.h>
23#endif
24
25#include <QTextDocument>
26
27#include "about.hpp"
28#include <ui_about.h>
29
30#include <libsigrok/libsigrok.hpp>
31
32using std::shared_ptr;
33using sigrok::Context;
34
35namespace pv {
36namespace dialogs {
37
38About::About(shared_ptr<Context> context, QWidget *parent) :
39 QDialog(parent),
40 ui(new Ui::About)
41{
42#ifdef ENABLE_DECODE
43 struct srd_decoder *dec;
44#endif
45
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>")
52 .arg(QApplication::applicationName())
53 .arg(QApplication::applicationVersion())
54 .arg(tr("GNU GPL, version 3 or later"))
55 .arg(QApplication::organizationDomain()));
56 ui->versionInfo->setOpenExternalLinks(true);
57
58 s.append("<table>");
59
60 /* Set up the supported field */
61 s.append("<tr><td colspan=\"2\"><b>" +
62 tr("Supported hardware drivers:") +
63 "</b></td></tr>");
64 for (auto entry : context->drivers()) {
65 s.append(QString("<tr><td><i>%1</i></td><td>%2</td></tr>")
66 .arg(QString::fromUtf8(entry.first.c_str()))
67 .arg(QString::fromUtf8(entry.second->long_name().c_str())));
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()) {
74 s.append(QString("<tr><td><i>%1</i></td><td>%2</td></tr>")
75 .arg(QString::fromUtf8(entry.first.c_str()))
76 .arg(QString::fromUtf8(entry.second->description().c_str())));
77 }
78
79#ifdef ENABLE_DECODE
80 s.append("<tr><td colspan=\"2\"><b>" +
81 tr("Supported protocol decoders:") +
82 "</b></td></tr>");
83 for (const GSList *l = srd_decoder_list(); l; l = l->next) {
84 dec = (struct srd_decoder *)l->data;
85 s.append(QString("<tr><td><i>%1</i></td><td>%2</td></tr>")
86 .arg(QString::fromUtf8(dec->id))
87 .arg(QString::fromUtf8(dec->longname)));
88 }
89#endif
90
91 s.append("</table>");
92
93 supportedDoc.reset(new QTextDocument(this));
94 supportedDoc->setHtml(s);
95 ui->supportList->setDocument(supportedDoc.get());
96}
97
98About::~About()
99{
100 delete ui;
101}
102
103} // namespace dialogs
104} // namespace pv