]> sigrok.org Git - pulseview.git/blame_incremental - pv/dialogs/about.cpp
TraceView: Center traces more than once
[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, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifdef ENABLE_DECODE
21#include <libsigrokdecode/libsigrokdecode.h>
22#endif
23
24#include <QTextDocument>
25
26#include "about.hpp"
27#include <ui_about.h>
28
29#include <libsigrokcxx/libsigrokcxx.hpp>
30
31using std::shared_ptr;
32using sigrok::Context;
33
34namespace pv {
35namespace dialogs {
36
37About::About(shared_ptr<Context> context, QWidget *parent) :
38 QDialog(parent),
39 ui(new Ui::About)
40{
41#ifdef ENABLE_DECODE
42 struct srd_decoder *dec;
43#endif
44
45 QString s;
46
47 ui->setupUi(this);
48
49 /* Setup the version field */
50 ui->versionInfo->setText(tr("%1 %2<br />%3<br /><a href=\"%4\">%4</a>")
51 .arg(QApplication::applicationName(),
52 QApplication::applicationVersion(),
53 tr("GNU GPL, version 3 or later"),
54 QApplication::organizationDomain()));
55 ui->versionInfo->setOpenExternalLinks(true);
56
57 s.append("<table>");
58
59 /* Set up the supported field */
60 s.append("<tr><td colspan=\"2\"><b>" +
61 tr("Supported hardware drivers:") +
62 "</b></td></tr>");
63 for (auto entry : context->drivers()) {
64 s.append(QString("<tr><td><i>%1</i></td><td>%2</td></tr>")
65 .arg(QString::fromUtf8(entry.first.c_str()),
66 QString::fromUtf8(entry.second->long_name().c_str())));
67 }
68
69 s.append("<tr><td colspan=\"2\"><b>" +
70 tr("Supported input formats:") +
71 "</b></td></tr>");
72 for (auto entry : context->input_formats()) {
73 s.append(QString("<tr><td><i>%1</i></td><td>%2</td></tr>")
74 .arg(QString::fromUtf8(entry.first.c_str()),
75 QString::fromUtf8(entry.second->description().c_str())));
76 }
77
78 s.append("<tr><td colspan=\"2\"><b>" +
79 tr("Supported output formats:") +
80 "</b></td></tr>");
81 for (auto entry : context->output_formats()) {
82 s.append(QString("<tr><td><i>%1</i></td><td>%2</td></tr>")
83 .arg(QString::fromUtf8(entry.first.c_str()),
84 QString::fromUtf8(entry.second->description().c_str())));
85 }
86
87#ifdef ENABLE_DECODE
88 s.append("<tr><td colspan=\"2\"><b>" +
89 tr("Supported protocol decoders:") +
90 "</b></td></tr>");
91 for (const GSList *l = srd_decoder_list(); l; l = l->next) {
92 dec = (struct srd_decoder *)l->data;
93 s.append(QString("<tr><td><i>%1</i></td><td>%2</td></tr>")
94 .arg(QString::fromUtf8(dec->id),
95 QString::fromUtf8(dec->longname)));
96 }
97#endif
98
99 s.append("</table>");
100
101 supportedDoc = new QTextDocument(this);
102 supportedDoc->setHtml(s);
103 ui->supportList->setDocument(supportedDoc);
104}
105
106About::~About()
107{
108 delete ui;
109}
110
111} // namespace dialogs
112} // namespace pv