]>
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 | |
efdec55a | 17 | * along with this program; if not, see <http://www.gnu.org/licenses/>. |
40eb2ff4 JH |
18 | */ |
19 | ||
269528f5 | 20 | #ifdef ENABLE_DECODE |
aaabd61b | 21 | #include <libsigrokdecode/libsigrokdecode.h> |
269528f5 | 22 | #endif |
40eb2ff4 JH |
23 | |
24 | #include <QTextDocument> | |
25 | ||
2acdb232 | 26 | #include "about.hpp" |
51e77110 | 27 | #include <ui_about.h> |
40eb2ff4 | 28 | |
fe3a1c21 | 29 | #include <libsigrokcxx/libsigrokcxx.hpp> |
e82fd481 | 30 | |
e8d00928 ML |
31 | using std::shared_ptr; |
32 | using sigrok::Context; | |
40eb2ff4 | 33 | |
51e77110 | 34 | namespace pv { |
acda14b8 | 35 | namespace dialogs { |
51e77110 | 36 | |
e8d00928 | 37 | About::About(shared_ptr<Context> context, QWidget *parent) : |
40eb2ff4 JH |
38 | QDialog(parent), |
39 | ui(new Ui::About) | |
40 | { | |
269528f5 | 41 | #ifdef ENABLE_DECODE |
40eb2ff4 | 42 | struct srd_decoder *dec; |
269528f5 | 43 | #endif |
d52d8455 | 44 | |
40eb2ff4 JH |
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>") | |
744aa24f UH |
51 | .arg(QApplication::applicationName(), |
52 | QApplication::applicationVersion(), | |
53 | tr("GNU GPL, version 3 or later"), | |
54 | QApplication::organizationDomain())); | |
eb2b2d91 | 55 | ui->versionInfo->setOpenExternalLinks(true); |
40eb2ff4 | 56 | |
be20a3b8 JH |
57 | s.append("<table>"); |
58 | ||
40eb2ff4 | 59 | /* Set up the supported field */ |
be20a3b8 JH |
60 | s.append("<tr><td colspan=\"2\"><b>" + |
61 | tr("Supported hardware drivers:") + | |
62 | "</b></td></tr>"); | |
e8d00928 ML |
63 | for (auto entry : context->drivers()) { |
64 | s.append(QString("<tr><td><i>%1</i></td><td>%2</td></tr>") | |
744aa24f UH |
65 | .arg(QString::fromUtf8(entry.first.c_str()), |
66 | QString::fromUtf8(entry.second->long_name().c_str()))); | |
e8d00928 ML |
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()) { | |
40eb2ff4 | 73 | s.append(QString("<tr><td><i>%1</i></td><td>%2</td></tr>") |
744aa24f UH |
74 | .arg(QString::fromUtf8(entry.first.c_str()), |
75 | QString::fromUtf8(entry.second->description().c_str()))); | |
40eb2ff4 | 76 | } |
40eb2ff4 | 77 | |
23841977 UH |
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>") | |
744aa24f UH |
83 | .arg(QString::fromUtf8(entry.first.c_str()), |
84 | QString::fromUtf8(entry.second->description().c_str()))); | |
23841977 UH |
85 | } |
86 | ||
269528f5 | 87 | #ifdef ENABLE_DECODE |
be20a3b8 JH |
88 | s.append("<tr><td colspan=\"2\"><b>" + |
89 | tr("Supported protocol decoders:") + | |
90 | "</b></td></tr>"); | |
83259518 | 91 | for (const GSList *l = srd_decoder_list(); l; l = l->next) { |
40eb2ff4 JH |
92 | dec = (struct srd_decoder *)l->data; |
93 | s.append(QString("<tr><td><i>%1</i></td><td>%2</td></tr>") | |
744aa24f UH |
94 | .arg(QString::fromUtf8(dec->id), |
95 | QString::fromUtf8(dec->longname))); | |
40eb2ff4 | 96 | } |
269528f5 | 97 | #endif |
be20a3b8 | 98 | |
40eb2ff4 JH |
99 | s.append("</table>"); |
100 | ||
db8a1b5c | 101 | supportedDoc = new QTextDocument(this); |
40eb2ff4 | 102 | supportedDoc->setHtml(s); |
db8a1b5c | 103 | ui->supportList->setDocument(supportedDoc); |
40eb2ff4 JH |
104 | } |
105 | ||
106 | About::~About() | |
107 | { | |
108 | delete ui; | |
109 | } | |
51e77110 | 110 | |
acda14b8 | 111 | } // namespace dialogs |
51e77110 | 112 | } // namespace pv |