From: Joel Holdsworth Date: Fri, 11 May 2012 09:30:42 +0000 (+0100) Subject: Added the About action X-Git-Tag: pulseview-0.1.0~358 X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=commitdiff_plain;h=30236a549137e5f183e19fb696c50d7150fc1124;ds=sidebyside Added the About action --- diff --git a/mainwindow.cpp b/mainwindow.cpp index 02a85876..bf9711f2 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -18,9 +18,25 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +extern "C" { +#include +} + +#include + #include "mainwindow.h" #include "ui_mainwindow.h" +extern "C" { +/* __STDC_FORMAT_MACROS is required for PRIu64 and friends (in C++). */ +#define __STDC_FORMAT_MACROS +#include +#include +#include +#include +#include +} + MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) @@ -32,3 +48,56 @@ MainWindow::~MainWindow() { delete ui; } + +void MainWindow::on_actionAbout_triggered() +{ + GSList *l; + struct sr_dev_driver **drivers; + struct sr_input_format **inputs; + struct sr_output_format **outputs; + struct srd_decoder *dec; + + QString s = tr("%1 %2
%3
%4\n

") + .arg(QApplication::applicationName()) + .arg(QApplication::applicationVersion()) + .arg(tr("GNU GPL, version 2 or later")) + .arg(QApplication::organizationDomain()); + + s.append("" + tr("Supported hardware drivers:") + ""); + drivers = sr_driver_list(); + for (int i = 0; drivers[i]; ++i) { + s.append(QString("") + .arg(QString(drivers[i]->name)) + .arg(QString(drivers[i]->longname))); + } + s.append("
%1%2

"); + + s.append("" + tr("Supported input formats:") + ""); + inputs = sr_input_list(); + for (int i = 0; inputs[i]; ++i) { + s.append(QString("") + .arg(QString(inputs[i]->id)) + .arg(QString(inputs[i]->description))); + } + s.append("
%1%2

"); + + s.append("" + tr("Supported output formats:") + ""); + outputs = sr_output_list(); + for (int i = 0; outputs[i]; ++i) { + s.append(QString("") + .arg(QString(outputs[i]->id)) + .arg(QString(outputs[i]->description))); + } + s.append("
%1%2

"); + + s.append("" + tr("Supported protocol decoders:") + ""); + for (l = srd_decoder_list(); l; l = l->next) { + dec = (struct srd_decoder *)l->data; + s.append(QString("") + .arg(QString(dec->id)) + .arg(QString(dec->longname))); + } + s.append("
%1%2
"); + + QMessageBox::about(this, tr("About"), s); +} diff --git a/mainwindow.h b/mainwindow.h index 3f95b234..cef253cf 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -37,6 +37,9 @@ public: private: Ui::MainWindow *ui; + +private slots: + void on_actionAbout_triggered(); }; #endif // MAINWINDOW_H diff --git a/mainwindow.ui b/mainwindow.ui index 180c8a62..647ac2b8 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -17,13 +17,32 @@ :/icons/sigrok-logo-notext.png:/icons/sigrok-logo-notext.png - + + + + 0 + 0 + 400 + 25 + + + + + &Help + + + + + + + + &About... + + - - - +