X-Git-Url: http://git.code-monkey.de/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fdialogs%2Fabout.cpp;h=dbe7d9b809a43f76821e7314950b9d346f5f83db;hp=f8394f2ae6f3784bdd72ef84089ac26e3dcd3711;hb=efdec55aec1a137460fa362a381ed1904182bfed;hpb=ab973f4729258b729d2aa84abfa14b61609fa35e diff --git a/pv/dialogs/about.cpp b/pv/dialogs/about.cpp index f8394f2..dbe7d9b 100644 --- a/pv/dialogs/about.cpp +++ b/pv/dialogs/about.cpp @@ -14,8 +14,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * along with this program; if not, see . */ #ifdef ENABLE_DECODE @@ -24,24 +23,21 @@ #include -#include "about.h" +#include "about.hpp" #include -/* __STDC_FORMAT_MACROS is required for PRIu64 and friends (in C++). */ -#define __STDC_FORMAT_MACROS -#include -#include +#include +using std::shared_ptr; +using sigrok::Context; namespace pv { namespace dialogs { -About::About(QWidget *parent) : +About::About(shared_ptr context, QWidget *parent) : QDialog(parent), ui(new Ui::About) { - struct sr_dev_driver **drivers; - #ifdef ENABLE_DECODE struct srd_decoder *dec; #endif @@ -52,10 +48,10 @@ About::About(QWidget *parent) : /* Setup the version field */ ui->versionInfo->setText(tr("%1 %2
%3
%4") - .arg(QApplication::applicationName()) - .arg(QApplication::applicationVersion()) - .arg(tr("GNU GPL, version 3 or later")) - .arg(QApplication::organizationDomain())); + .arg(QApplication::applicationName(), + QApplication::applicationVersion(), + tr("GNU GPL, version 3 or later"), + QApplication::organizationDomain())); ui->versionInfo->setOpenExternalLinks(true); s.append(""); @@ -64,11 +60,28 @@ About::About(QWidget *parent) : s.append(""); - drivers = sr_driver_list(); - for (int i = 0; drivers[i]; ++i) { + for (auto entry : context->drivers()) { + s.append(QString("") + .arg(QString::fromUtf8(entry.first.c_str()), + QString::fromUtf8(entry.second->long_name().c_str()))); + } + + s.append(""); + for (auto entry : context->input_formats()) { + s.append(QString("") + .arg(QString::fromUtf8(entry.first.c_str()), + QString::fromUtf8(entry.second->description().c_str()))); + } + + s.append(""); + for (auto entry : context->output_formats()) { s.append(QString("") - .arg(QString::fromUtf8(drivers[i]->name)) - .arg(QString::fromUtf8(drivers[i]->longname))); + .arg(QString::fromUtf8(entry.first.c_str()), + QString::fromUtf8(entry.second->description().c_str()))); } #ifdef ENABLE_DECODE @@ -78,16 +91,16 @@ About::About(QWidget *parent) : for (const GSList *l = srd_decoder_list(); l; l = l->next) { dec = (struct srd_decoder *)l->data; s.append(QString("") - .arg(QString::fromUtf8(dec->id)) - .arg(QString::fromUtf8(dec->longname))); + .arg(QString::fromUtf8(dec->id), + QString::fromUtf8(dec->longname))); } #endif s.append("
" + tr("Supported hardware drivers:") + "
%1%2
" + + tr("Supported input formats:") + + "
%1%2
" + + tr("Supported output formats:") + + "
%1%2
%1%2
"); - supportedDoc.reset(new QTextDocument(this)); + supportedDoc = new QTextDocument(this); supportedDoc->setHtml(s); - ui->supportList->setDocument(supportedDoc.get()); + ui->supportList->setDocument(supportedDoc); } About::~About()