add barcode plugin basic structure
authorKonrad Rosenbaum <konrad@silmor.de>
Thu, 12 Dec 2013 20:41:35 +0000 (21:41 +0100)
committerKonrad Rosenbaum <konrad@silmor.de>
Thu, 12 Dec 2013 20:59:51 +0000 (21:59 +0100)
.gitmodules
hidapi [new submodule]
plugins/bcscanner/bcs-plugin.cpp [new file with mode: 0644]
plugins/bcscanner/bcs-plugin.h [new file with mode: 0644]
plugins/bcscanner/bcscanner.pro [new file with mode: 0644]
plugins/bcscanner/hidapi.pri [new file with mode: 0644]
plugins/plugins.pro [new file with mode: 0644]
src/misc/barcode-plugin.cpp [new file with mode: 0644]
src/misc/barcode-plugin.h [new file with mode: 0644]
src/smoke.pri [new file with mode: 0644]

index fa420c6..a1bfcf4 100644 (file)
@@ -10,3 +10,6 @@
 [submodule "taurus"]
        path = taurus
        url = ../taurus
+[submodule "hidapi"]
+       path = hidapi
+       url = https://github.com/signal11/hidapi.git
diff --git a/hidapi b/hidapi
new file mode 160000 (submodule)
index 0000000..1a42177
--- /dev/null
+++ b/hidapi
@@ -0,0 +1 @@
+Subproject commit 1a42177fa5f3beddb8805cb676d50acbc5e8ed01
diff --git a/plugins/bcscanner/bcs-plugin.cpp b/plugins/bcscanner/bcs-plugin.cpp
new file mode 100644 (file)
index 0000000..5aac522
--- /dev/null
@@ -0,0 +1,27 @@
+//
+// C++ Implementation: Barcode Plugin Basics
+//
+//
+// Author: Konrad Rosenbaum <konrad@silmor.de>, (C) 2013
+//
+// Copyright: See README/COPYING.GPL files that come with this distribution
+//
+//
+
+#include "bcs-plugin.h"
+
+MHidBarcodePlugin::~MHidBarcodePlugin()
+{
+
+}
+
+
+void MHidBarcodePlugin::configure(MBarcodeConfiguration* )
+{
+
+}
+
+QStringList MHidBarcodePlugin::findScanners()
+{
+        return QStringList();
+}
diff --git a/plugins/bcscanner/bcs-plugin.h b/plugins/bcscanner/bcs-plugin.h
new file mode 100644 (file)
index 0000000..9271e19
--- /dev/null
@@ -0,0 +1,30 @@
+//
+// C++ Interface: plugin base for barcode scanners
+//
+// Description: 
+//
+//
+// Author: Konrad Rosenbaum <konrad@silmor.de>, (C) 2013
+//
+// Copyright: See README/COPYING.GPL files that come with this distribution
+//
+//
+
+#ifndef MAGICSMOKE_BARCODE_PLUGIN_HID_H
+#define MAGICSMOKE_BARCODE_PLUGIN_HID_H
+
+#include "barcode-plugin.h"
+
+class MHidBarcodePlugin:public QObject,public MBarcodePlugin
+{
+        Q_OBJECT
+        Q_PLUGIN_METADATA(IID MBarcodePlugin_IID)
+        Q_INTERFACES(MBarcodePlugin)
+        public:
+                virtual ~MHidBarcodePlugin();
+                virtual QStringList findScanners() override;
+                virtual void configure(MBarcodeConfiguration*)override;
+
+};
+
+#endif
diff --git a/plugins/bcscanner/bcscanner.pro b/plugins/bcscanner/bcscanner.pro
new file mode 100644 (file)
index 0000000..1abd988
--- /dev/null
@@ -0,0 +1,10 @@
+TEMPLATE = lib
+TARGET = msp-bcscanner
+CONFIG += plugin
+
+include (../../basics.pri)
+include (../../src/smoke.pri)
+include (hidapi.pri)
+
+SOURCES += bcs-plugin.cpp
+HEADERS += bcs-plugin.h
diff --git a/plugins/bcscanner/hidapi.pri b/plugins/bcscanner/hidapi.pri
new file mode 100644 (file)
index 0000000..9b0ba28
--- /dev/null
@@ -0,0 +1,20 @@
+#HIDAPI settings
+
+HIDAPIDIR = $$PWD/../../hidapi
+
+INCLUDEPATH += $$HIDAPIDIR/hidapi
+
+linux {
+        SOURCES += $$HIDAPIDIR/libusb/hid.c
+        CONFIG += link_pkgconfig
+        PKGCONFIG += libusb-1.0
+}
+win32 {
+        SOURCES += $$HIDAPIDIR/windows/hid.c
+        LIBS += -lsetupapi
+}
+mac {
+        SOURCES += $$HIDAPIDIR/mac
+        #from mac/Makefile-manual, not sure how to use this:
+        #LIBS += -framework IOKit -framework CoreFoundation
+}
diff --git a/plugins/plugins.pro b/plugins/plugins.pro
new file mode 100644 (file)
index 0000000..0034d33
--- /dev/null
@@ -0,0 +1,2 @@
+TEMPLATE = subdirs
+SUBDIRS = bcscanner
\ No newline at end of file
diff --git a/src/misc/barcode-plugin.cpp b/src/misc/barcode-plugin.cpp
new file mode 100644 (file)
index 0000000..5f6cc5d
--- /dev/null
@@ -0,0 +1,21 @@
+//
+// C++ Implementation: Barcode Plugin Basics
+//
+//
+// Author: Konrad Rosenbaum <konrad@silmor.de>, (C) 2013
+//
+// Copyright: See README/COPYING.GPL files that come with this distribution
+//
+//
+
+#include "barcode-plugin.h"
+
+MBarcodeConfiguration::MBarcodeConfiguration(QWidget* parent): QDialog(parent)
+{
+
+}
+
+void MBarcodeConfiguration::addTab(QWidget* , QString )
+{
+
+}
diff --git a/src/misc/barcode-plugin.h b/src/misc/barcode-plugin.h
new file mode 100644 (file)
index 0000000..3f55249
--- /dev/null
@@ -0,0 +1,54 @@
+//
+// C++ Interface: plugin base for barcode scanners
+//
+// Description: 
+//
+//
+// Author: Konrad Rosenbaum <konrad@silmor.de>, (C) 2013
+//
+// Copyright: See README/COPYING.GPL files that come with this distribution
+//
+//
+
+#ifndef MAGICSMOKE_BARCODE_PLUGIN_H
+#define MAGICSMOKE_BARCODE_PLUGIN_H
+
+#ifdef MAGICSMOKE_LIB_BUILD
+#define MAGICSMOKE_EXPORT Q_DECL_EXPORT
+#else
+#define MAGICSMOKE_EXPORT Q_DECL_IMPORT
+#endif
+
+#include <QtPlugin>
+#include <QStringList>
+#include <QDialog>
+
+class QTabWidget;
+
+class MAGICSMOKE_EXPORT MBarcodeConfiguration:public QDialog
+{
+        Q_OBJECT
+        public:
+                MBarcodeConfiguration(QWidget*parent);
+                
+        public slots:
+                void addTab(QWidget*,QString);
+        private:
+                QTabWidget*mtab;
+};
+
+class MAGICSMOKE_EXPORT MBarcodePlugin
+{
+        public:
+                virtual ~MBarcodePlugin(){}
+
+                virtual QStringList findScanners()=0;
+                virtual void configure(MBarcodeConfiguration*)=0;
+};
+
+#define MBarcodePlugin_IID "de.silmor.MagicSmoke.BarcodePlugin/1.0"
+
+Q_DECLARE_INTERFACE(MBarcodePlugin, MBarcodePlugin_IID);
+
+
+#endif
diff --git a/src/smoke.pri b/src/smoke.pri
new file mode 100644 (file)
index 0000000..08bfa38
--- /dev/null
@@ -0,0 +1,17 @@
+#include project file to use libmagicsmoke
+
+
+include (../iface/iface.pri)
+include (libs.pri)
+
+LIBS += -lmagicsmoke
+INCLUDEPATH += \
+        $$PWD \
+        $$PWD/crypto \
+        $$PWD/dialogs \
+        $$PWD/misc \
+        $$PWD/mwin \
+        $$PWD/script \
+        $$PWD/templates \
+        $$PWD/widgets
+