]> sigrok.org Git - pulseview.git/commitdiff
Added empty decoder dialog
authorJoel Holdsworth <redacted>
Mon, 31 Dec 2012 08:46:45 +0000 (08:46 +0000)
committerJoel Holdsworth <redacted>
Sun, 22 Sep 2013 22:15:05 +0000 (23:15 +0100)
CMakeLists.txt
pv/dialogs/decoder.cpp [new file with mode: 0644]
pv/dialogs/decoder.h [new file with mode: 0644]
pv/mainwindow.cpp

index 724adcd60ba58a71a5149022237c569763f309ec..58365a10d04e60b38f866e12f61670d96d366e3c 100644 (file)
@@ -113,6 +113,7 @@ set(pulseview_SOURCES
        pv/data/snapshot.cpp
        pv/dialogs/about.cpp
        pv/dialogs/connect.cpp
        pv/data/snapshot.cpp
        pv/dialogs/about.cpp
        pv/dialogs/connect.cpp
+       pv/dialogs/decoder.cpp
        pv/dialogs/deviceoptions.cpp
        pv/prop/bool.cpp
        pv/prop/double.cpp
        pv/dialogs/deviceoptions.cpp
        pv/prop/bool.cpp
        pv/prop/double.cpp
diff --git a/pv/dialogs/decoder.cpp b/pv/dialogs/decoder.cpp
new file mode 100644 (file)
index 0000000..01cec84
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * This file is part of the PulseView project.
+ *
+ * Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * 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
+ */
+
+#include "decoder.h"
+
+extern "C" {
+/* __STDC_FORMAT_MACROS is required for PRIu64 and friends (in C++). */
+#define __STDC_FORMAT_MACROS
+#include <glib.h>
+#include <libsigrok/libsigrok.h>
+}
+
+namespace pv {
+namespace dialogs {
+
+Decoder::Decoder(QWidget *parent) :
+       QDialog(parent),
+       _layout(this),
+       _form(this),
+       _form_layout(&_form),
+       _button_box(QDialogButtonBox::Ok | QDialogButtonBox::Cancel,
+               Qt::Horizontal, this)
+{
+       setWindowTitle(tr("Configure Decoder"));
+
+       connect(&_button_box, SIGNAL(accepted()), this, SLOT(accept()));
+       connect(&_button_box, SIGNAL(rejected()), this, SLOT(reject()));
+
+       _form.setLayout(&_form_layout);
+
+       setLayout(&_layout);
+       _layout.addWidget(&_form);
+       _layout.addWidget(&_button_box);
+}
+
+} // namespace dialogs
+} // namespace pv
diff --git a/pv/dialogs/decoder.h b/pv/dialogs/decoder.h
new file mode 100644 (file)
index 0000000..9d61202
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * This file is part of the PulseView project.
+ *
+ * Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * 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
+ */
+
+#ifndef PULSEVIEW_PV_DECODER_H
+#define PULSEVIEW_PV_DECODER_H
+
+#include <QComboBox>
+#include <QDialog>
+#include <QDialogButtonBox>
+#include <QFormLayout>
+#include <QVBoxLayout>
+
+namespace pv {
+namespace dialogs {
+
+class Decoder : public QDialog
+{
+public:
+       Decoder(QWidget *parent);
+
+private:
+       QVBoxLayout _layout;
+
+       QWidget _form;
+       QFormLayout _form_layout;
+
+       QDialogButtonBox _button_box;
+};
+
+} // namespace dialogs
+} // namespace pv
+
+#endif // PULSEVIEW_PV_DECODER_H
index 02df0ad510e3fb38be0b108daf444804e1fbfcfc..9873541dd5dbe4dc24aea9be777a949cc15c0e96 100644 (file)
@@ -39,6 +39,7 @@
 #include "devicemanager.h"
 #include "dialogs/about.h"
 #include "dialogs/connect.h"
 #include "devicemanager.h"
 #include "dialogs/about.h"
 #include "dialogs/connect.h"
+#include "dialogs/decoder.h"
 #include "toolbars/contextbar.h"
 #include "toolbars/samplingbar.h"
 #include "view/view.h"
 #include "toolbars/contextbar.h"
 #include "toolbars/samplingbar.h"
 #include "view/view.h"
@@ -382,7 +383,13 @@ void MainWindow::device_selected()
 
 void MainWindow::add_decoder(QObject *action)
 {
 
 void MainWindow::add_decoder(QObject *action)
 {
-       (void)action;
+       assert(action);
+       srd_decoder *const dec =
+               (srd_decoder*)((QAction*)action)->data().value<void*>();
+       assert(dec);
+
+       dialogs::Decoder dlg(this);
+       dlg.exec();
 }
 
 void MainWindow::run_stop()
 }
 
 void MainWindow::run_stop()