]> sigrok.org Git - pulseview.git/commitdiff
Added the About action
authorJoel Holdsworth <redacted>
Fri, 11 May 2012 09:30:42 +0000 (10:30 +0100)
committerJoel Holdsworth <redacted>
Mon, 3 Sep 2012 12:49:38 +0000 (13:49 +0100)
mainwindow.cpp
mainwindow.h
mainwindow.ui

index 02a85876811ff9662c3293216432304d852e5d2d..bf9711f29167803f657ce1dffcf5ba027cfe47be 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
  */
 
+extern "C" {
+#include <sigrokdecode.h>
+}
+
+#include <QMessageBox>
+
 #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 <inttypes.h>
+#include <stdint.h>
+#include <stdarg.h>
+#include <glib.h>
+#include <libsigrok/libsigrok.h>
+}
+
 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<br />%3<br /><a href=\"%4\">%4</a>\n<p>")
+               .arg(QApplication::applicationName())
+               .arg(QApplication::applicationVersion())
+               .arg(tr("GNU GPL, version 2 or later"))
+               .arg(QApplication::organizationDomain());
+
+       s.append("<b>" + tr("Supported hardware drivers:") + "</b><table>");
+       drivers = sr_driver_list();
+       for (int i = 0; drivers[i]; ++i) {
+               s.append(QString("<tr><td><i>%1</i></td><td>%2</td></tr>")
+                        .arg(QString(drivers[i]->name))
+                        .arg(QString(drivers[i]->longname)));
+       }
+       s.append("</table><p>");
+
+       s.append("<b>" + tr("Supported input formats:") + "</b><table>");
+       inputs = sr_input_list();
+       for (int i = 0; inputs[i]; ++i) {
+               s.append(QString("<tr><td><i>%1</i></td><td>%2</td></tr>")
+                        .arg(QString(inputs[i]->id))
+                        .arg(QString(inputs[i]->description)));
+       }
+       s.append("</table><p>");
+
+       s.append("<b>" + tr("Supported output formats:") + "</b><table>");
+       outputs = sr_output_list();
+       for (int i = 0; outputs[i]; ++i) {
+               s.append(QString("<tr><td><i>%1</i></td><td>%2</td></tr>")
+                       .arg(QString(outputs[i]->id))
+                       .arg(QString(outputs[i]->description)));
+       }
+       s.append("</table><p>");
+
+       s.append("<b>" + tr("Supported protocol decoders:") + "</b><table>");
+       for (l = srd_decoder_list(); l; l = l->next) {
+               dec = (struct srd_decoder *)l->data;
+               s.append(QString("<tr><td><i>%1</i></td><td>%2</td></tr>")
+                        .arg(QString(dec->id))
+                        .arg(QString(dec->longname)));
+       }
+       s.append("</table>");
+
+       QMessageBox::about(this, tr("About"), s);
+}
index 3f95b2341d504e38f2dac69e95405f8ec12de116..cef253cff9b77400aeffff35ca38ede899349a3f 100644 (file)
@@ -37,6 +37,9 @@ public:
 
 private:
        Ui::MainWindow *ui;
+
+private slots:
+       void on_actionAbout_triggered();
 };
 
 #endif // MAINWINDOW_H
index 180c8a625434eb8ade5a6ecfd055f991ad0ca660..647ac2b8d04f577f238ca146adac8092196cc71f 100644 (file)
    <iconset>
     <normaloff>:/icons/sigrok-logo-notext.png</normaloff>:/icons/sigrok-logo-notext.png</iconset>
   </property>
-  <widget class="QMenuBar" name="menuBar" />
+  <widget class="QMenuBar" name="menuBar">
+   <property name="geometry">
+    <rect>
+     <x>0</x>
+     <y>0</y>
+     <width>400</width>
+     <height>25</height>
+    </rect>
+   </property>
+   <widget class="QMenu" name="menu_Help">
+    <property name="title">
+     <string>&amp;Help</string>
+    </property>
+    <addaction name="actionAbout"/>
+   </widget>
+   <addaction name="menu_Help"/>
+  </widget>
   <widget class="QWidget" name="centralWidget" />
   <widget class="QStatusBar" name="statusBar" />
+  <action name="actionAbout">
+   <property name="text">
+    <string>&amp;About...</string>
+   </property>
+  </action>
  </widget>
- <layoutDefault spacing="6" margin="11" />
- <pixmapfunction></pixmapfunction>
- <resources/>
+ <layoutdefault spacing="6" margin="11"/>
  <resources>
   <include location="sigrok-qt2.qrc"/>
  </resources>