From: Konrad Rosenbaum Date: Thu, 12 Dec 2013 20:41:35 +0000 (+0100) Subject: add barcode plugin basic structure X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=577a1856997d632b5f7204fd4b0a9a556efad6ed;p=web%2Fkonrad%2Fsmoke.git add barcode plugin basic structure --- diff --git a/.gitmodules b/.gitmodules index fa420c6..a1bfcf4 100644 --- a/.gitmodules +++ b/.gitmodules @@ -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 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 index 0000000..5aac522 --- /dev/null +++ b/plugins/bcscanner/bcs-plugin.cpp @@ -0,0 +1,27 @@ +// +// C++ Implementation: Barcode Plugin Basics +// +// +// Author: Konrad Rosenbaum , (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 index 0000000..9271e19 --- /dev/null +++ b/plugins/bcscanner/bcs-plugin.h @@ -0,0 +1,30 @@ +// +// C++ Interface: plugin base for barcode scanners +// +// Description: +// +// +// Author: Konrad Rosenbaum , (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 index 0000000..1abd988 --- /dev/null +++ b/plugins/bcscanner/bcscanner.pro @@ -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 index 0000000..9b0ba28 --- /dev/null +++ b/plugins/bcscanner/hidapi.pri @@ -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 index 0000000..0034d33 --- /dev/null +++ b/plugins/plugins.pro @@ -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 index 0000000..5f6cc5d --- /dev/null +++ b/src/misc/barcode-plugin.cpp @@ -0,0 +1,21 @@ +// +// C++ Implementation: Barcode Plugin Basics +// +// +// Author: Konrad Rosenbaum , (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 index 0000000..3f55249 --- /dev/null +++ b/src/misc/barcode-plugin.h @@ -0,0 +1,54 @@ +// +// C++ Interface: plugin base for barcode scanners +// +// Description: +// +// +// Author: Konrad Rosenbaum , (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 +#include +#include + +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 index 0000000..08bfa38 --- /dev/null +++ b/src/smoke.pri @@ -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 +