]>
Commit | Line | Data |
---|---|---|
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 | ||
27 | #include "about.h" | |
51e77110 | 28 | #include <ui_about.h> |
40eb2ff4 | 29 | |
e8d00928 | 30 | #include <libsigrok/libsigrok.hpp> |
e82fd481 | 31 | |
e8d00928 ML |
32 | using std::shared_ptr; |
33 | using sigrok::Context; | |
40eb2ff4 | 34 | |
51e77110 | 35 | namespace pv { |
acda14b8 | 36 | namespace dialogs { |
51e77110 | 37 | |
e8d00928 | 38 | About::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>") | |
52 | .arg(QApplication::applicationName()) | |
53 | .arg(QApplication::applicationVersion()) | |
0ec7aba5 | 54 | .arg(tr("GNU GPL, version 3 or later")) |
40eb2ff4 | 55 | .arg(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>") | |
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()) { | |
40eb2ff4 | 74 | s.append(QString("<tr><td><i>%1</i></td><td>%2</td></tr>") |
e8d00928 ML |
75 | .arg(QString::fromUtf8(entry.first.c_str())) |
76 | .arg(QString::fromUtf8(entry.second->description().c_str()))); | |
40eb2ff4 | 77 | } |
40eb2ff4 | 78 | |
269528f5 | 79 | #ifdef ENABLE_DECODE |
be20a3b8 JH |
80 | s.append("<tr><td colspan=\"2\"><b>" + |
81 | tr("Supported protocol decoders:") + | |
82 | "</b></td></tr>"); | |
83259518 | 83 | for (const GSList *l = srd_decoder_list(); l; l = l->next) { |
40eb2ff4 JH |
84 | dec = (struct srd_decoder *)l->data; |
85 | s.append(QString("<tr><td><i>%1</i></td><td>%2</td></tr>") | |
27e8df22 JH |
86 | .arg(QString::fromUtf8(dec->id)) |
87 | .arg(QString::fromUtf8(dec->longname))); | |
40eb2ff4 | 88 | } |
269528f5 | 89 | #endif |
be20a3b8 | 90 | |
40eb2ff4 JH |
91 | s.append("</table>"); |
92 | ||
93 | supportedDoc.reset(new QTextDocument(this)); | |
94 | supportedDoc->setHtml(s); | |
95 | ui->supportList->setDocument(supportedDoc.get()); | |
96 | } | |
97 | ||
98 | About::~About() | |
99 | { | |
100 | delete ui; | |
101 | } | |
51e77110 | 102 | |
acda14b8 | 103 | } // namespace dialogs |
51e77110 | 104 | } // namespace pv |