Commit 6773474f by Carwyn

1.添加支付业务工程

parent 0d8cbb5a
...@@ -4,8 +4,9 @@ TEMPLATE = subdirs ...@@ -4,8 +4,9 @@ TEMPLATE = subdirs
SUBDIRS += fmp_manager \ SUBDIRS += fmp_manager \
fmp_logger \ fmp_logger \
fmp_settings \ fmp_settings \
fmp_uiloader \ # fmp_uiloader \
fmp_synchronizer \ fmp_synchronizer \
fmp_epay \
fmPosApp fmPosApp
CONFIG += ordered CONFIG += ordered
#include "fmp_epay_p.h"
class ctkPluginContext;
FMPePay::FMPePay(ctkPluginContext *context)
: _inited(false),
q_ptr(new FMPePayPrivate)
{
}
int FMPePay::Init(const FMPProps &props)
{
if (_inited) return FMP_SUCCESS;
Q_D(FMPePay);
return d->Init();
}
int FMPePay::Uninit()
{
if (!_inited) return FMP_SUCCESS;
Q_D(FMPePay);
return d->Init();
}
#ifndef FMP_UILOADER_H
#define FMP_UILOADER_H
#include <QObject>
#include "fmp_epay_i.h"
#include <ctkPluginContext.h>
class FMPePayPrivate;
class FMPePay : public QObject, public FMPePayInterface
{
Q_OBJECT
Q_INTERFACES(FMPePayInterface)
Q_DECLARE_PRIVATE(FMPePay)
public:
FMPePay(ctkPluginContext *context);
int Init(const FMPProps &props);
int Uninit();
int Upgrade() { return 0; }
int Downgrade() { return 0; }
public slots:
void OnUpgraded() {}
int Pay() { return 0; }
private:
bool _inited;
FMPePayPrivate* q_ptr;
};
#endif // FMP_UILOADER_H
#-------------------------------------------------
#
# Project created by QtCreator 2017-01-11T15:59:15
#
#-------------------------------------------------
TEMPLATE = lib
SOURCES += \
fmp_epay.cpp \
fmp_epay_p.cpp \
fmp_epay_plugin.cpp
HEADERS +=\
fmp_epay.h \
fmp_epay_i.h \
fmp_epay_p.h \
fmp_epay_plugin_p.h
unix {
target.path = /usr/lib
INSTALLS += target
}
#Target name
VER = $$system($$PWD/../fmprc.bat $$TARGET)
ORIGIN_TARGET = $$TARGET
TARGET = $${TARGET}_$${VER}
#Header path
INCLUDEPATH += $$PWD/../include/ctk \
+= $$PWD/../include/interface \
#Library path
LIBS += -L$$PWD/../lib
CONFIG(debug, debug|release) {
#Linking library
LIBS += -lCTKCored -lCTKPluginFrameworkd
#Destination path
DESTDIR = $$PWD/../debug/plugins
} else {
LIBS += -lCTKCore -lCTKPluginFramework
DESTDIR = $$PWD/../release/plugins
}
#
RESOURCES += \
res/$${ORIGIN_TARGET}.qrc
win32 {
RC_FILE += res/$${ORIGIN_TARGET}.rc
system($$PWD/../fmprc.bat $$PWD/version.h $$ORIGIN_TARGET)
}
else {
system($$PWD/../fmprc.sh $$PWD/version.h $$ORIGIN_TARGET)
}
#ifndef FMP_EPAY_I_H
#define FMP_EPAY_I_H
#include <fmp_base_i.h>
class FMPePayInterface : public FMPluginInterface
{
public:
virtual int Pay() = 0;
};
Q_DECLARE_INTERFACE(FMPePayInterface, "fmp.epay")
#endif // FMP_LOGGER_I_H
#include "fmp_epay_p.h"
#include <fmp_settings_i.h>
#include <QCoreApplication>
#include <QDateTime>
#include <ctkPluginContext.h>
#include <ctkServiceReference.h>
int FMPePayPrivate::Init()
{
Q_Q(FMPePay);
q->_inited = true;
return FMP_SUCCESS;
}
int FMPePayPrivate::Uninit()
{
Q_Q(FMPePay);
//! Clean up
q->_inited = false;
return FMP_SUCCESS;
}
#ifndef FMP_EPAY_P_H
#define FMP_EPAY_P_H
#include "fmp_epay.h"
class FMPePayPrivate
{
Q_DECLARE_PUBLIC(FMPePay)
public:
int Init();
int Uninit();
private:
public:
FMPePay *q_ptr;
private:
};
#endif // FMP_EPAY_P_H
/*=============================================================================
Library: CTK
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=============================================================================*/
#include "fmp_epay_plugin_p.h"
#include "fmp_epay.h"
#include <QtPlugin>
#include <QStringList>
#include <QDebug>
FMPePayPlugin::FMPePayPlugin()
: _epay_service(0)
{
}
void FMPePayPlugin::start(ctkPluginContext* context)
{
_epay_service = new FMPePay(context);
context->registerService(QStringList("FMPePayInterface"), _epay_service);
}
void FMPePayPlugin::stop(ctkPluginContext* context)
{
Q_UNUSED(context)
if (_epay_service)
{
delete _epay_service;
_epay_service = 0;
}
}
#if (QT_VERSION < QT_VERSION_CHECK(5,0,0))
Q_EXPORT_PLUGIN2(fmp_epay, FMPePayPlugin)
#endif
#ifndef FMP_EPAY_PLUGIN_P_H
#define FMP_EPAY_PLUGIN_P_H
#include <ctkPluginActivator.h>
class FMPePay;
class FMPePayPlugin : public QObject, public ctkPluginActivator
{
Q_OBJECT
Q_INTERFACES(ctkPluginActivator)
#if (QT_VERSION > QT_VERSION_CHECK(5,0,0))
Q_PLUGIN_METADATA(IID "fmp_epay")
#endif
public:
explicit FMPePayPlugin();
void start(ctkPluginContext* context);
void stop(ctkPluginContext* context);
private:
FMPePay* _epay_service;
}; // FMPePayPlugin
#endif // FMP_EPAY_PLUGIN_P_H
#ifndef _VERSION_H_
#define _VERSION_H_
#define VER_MAJOR 0
#define VER_MINOR 1
#define VER_REVISION 0
#define VER_BUILD 3
//! Convert version numbers to string
#define _STR(S) #S
#define STR(S) _STR(S)
#define _MAK_VER(maj, min, rev, build) STR(##maj.##min.##rev.##build\0)
#define MAK_VER(maj, min, rev, build) _MAK_VER(maj, min, rev, build)
//! Resource version infomation
#define RES_FILE_VER VER_MAJOR,VER_MINOR,VER_REVISION,VER_BUILD
#define RES_PRODUCT_VER VER_MAJOR,VER_MINOR,VER_REVISION,VER_BUILD
#define RES_STR_FILE_VER MAK_VER(VER_MAJOR, VER_MINOR, VER_REVISION, VER_BUILD)
#define RES_STR_PRODUCT_VER MAK_VER(VER_MAJOR, VER_MINOR, VER_REVISION, VER_BUILD)
#define RES_COMPANY_NAME "上海非码网络科技有限公司\0"
#define RES_COPYRIGHT "Freemud Ltd. Copyright (C) 2014-2017\0"
#define RES_FILE_DESC "fmp.epay\0"
#define RES_INTER_NAME "fmp.epay\0"
#define RES_FILE_NAME "fmp.epay\0"
#define RES_PRODUCT_NAME "fmp.epay\0"
#define RES_FILE_EXT "*\0"
#endif //!_VERSION_H_
#ifndef FMP_LOGGER_I_H #ifndef FMP_LOGGER_I_H
#define FMP_LOGGER_I_H #define FMP_LOGGER_I_H
#include <fmp_base_i.h> #include <fmp_base_i.h>
......
...@@ -29,24 +29,23 @@ ...@@ -29,24 +29,23 @@
#include <QDebug> #include <QDebug>
FMPLoggerPlugin::FMPLoggerPlugin() FMPLoggerPlugin::FMPLoggerPlugin()
: logService(0) : _log_service(0)
{ {
qDebug() << __FUNCTION__;
} }
void FMPLoggerPlugin::start(ctkPluginContext* context) void FMPLoggerPlugin::start(ctkPluginContext* context)
{ {
logService = new FMPLogger(context); _log_service = new FMPLogger(context);
context->registerService(QStringList("FMPLoggerInterface"), logService); context->registerService(QStringList("FMPLoggerInterface"), _log_service);
} }
void FMPLoggerPlugin::stop(ctkPluginContext* context) void FMPLoggerPlugin::stop(ctkPluginContext* context)
{ {
Q_UNUSED(context) Q_UNUSED(context)
if (logService) if (_log_service)
{ {
delete logService; delete _log_service;
logService = 0; _log_service = 0;
} }
} }
......
...@@ -14,15 +14,14 @@ class FMPLoggerPlugin : public QObject, public ctkPluginActivator ...@@ -14,15 +14,14 @@ class FMPLoggerPlugin : public QObject, public ctkPluginActivator
#endif #endif
public: public:
explicit FMPLoggerPlugin();
FMPLoggerPlugin(); void start(ctkPluginContext* context);
void stop(ctkPluginContext* context);
void start(ctkPluginContext* context);
void stop(ctkPluginContext* context);
private: private:
FMPLogger* logService; FMPLogger* _log_service;
}; // FMPLoggerPlugin }; // FMPLoggerPlugin
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
#define VER_MINOR 1 #define VER_MINOR 1
#define VER_REVISION 0 #define VER_REVISION 0
#define VER_BUILD 1 #define VER_BUILD 3
//! Convert version numbers to string //! Convert version numbers to string
#define _STR(S) #S #define _STR(S) #S
......
...@@ -99,6 +99,7 @@ int FMPluginManager::LoadPlugin(const QString &plugin) ...@@ -99,6 +99,7 @@ int FMPluginManager::LoadPlugin(const QString &plugin)
int FMPluginManager::StartPlugin(const QString &plugin) int FMPluginManager::StartPlugin(const QString &plugin)
{ {
//! TODO: 检查登录信息,所有业务插件都需要登录后才可以使用
try { try {
if(!plugin.isEmpty()) { if(!plugin.isEmpty()) {
QString pluginPath = GetPluginPath(plugin); QString pluginPath = GetPluginPath(plugin);
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
#define VER_MINOR 1 #define VER_MINOR 1
#define VER_REVISION 0 #define VER_REVISION 0
#define VER_BUILD 1 #define VER_BUILD 3
//! Convert version numbers to string //! Convert version numbers to string
#define _STR(S) #S #define _STR(S) #S
......
...@@ -27,23 +27,23 @@ ...@@ -27,23 +27,23 @@
#include <QDebug> #include <QDebug>
FMPSettingsPlugin::FMPSettingsPlugin() FMPSettingsPlugin::FMPSettingsPlugin()
: settingsService(0) : _sets_service(0)
{ {
} }
void FMPSettingsPlugin::start(ctkPluginContext* context) void FMPSettingsPlugin::start(ctkPluginContext* context)
{ {
settingsService = new FMPSettings(context); _sets_service = new FMPSettings(context);
context->registerService(QStringList("FMPSettingsInterface"), settingsService); context->registerService(QStringList("FMPSettingsInterface"), _sets_service);
} }
void FMPSettingsPlugin::stop(ctkPluginContext* context) void FMPSettingsPlugin::stop(ctkPluginContext* context)
{ {
Q_UNUSED(context) Q_UNUSED(context)
if (settingsService) if (_sets_service)
{ {
delete settingsService; delete _sets_service;
settingsService = 0; _sets_service = 0;
} }
} }
......
...@@ -14,15 +14,14 @@ class FMPSettingsPlugin : public QObject, public ctkPluginActivator ...@@ -14,15 +14,14 @@ class FMPSettingsPlugin : public QObject, public ctkPluginActivator
#endif #endif
public: public:
explicit FMPSettingsPlugin();
FMPSettingsPlugin(); void start(ctkPluginContext* context);
void stop(ctkPluginContext* context);
void start(ctkPluginContext* context);
void stop(ctkPluginContext* context);
private: private:
FMPSettings* settingsService; FMPSettings* _sets_service;
}; // FMPSettingsPlugin }; // FMPSettingsPlugin
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
#define VER_MINOR 1 #define VER_MINOR 1
#define VER_REVISION 0 #define VER_REVISION 0
#define VER_BUILD 1 #define VER_BUILD 3
//! Convert version numbers to string //! Convert version numbers to string
#define _STR(S) #S #define _STR(S) #S
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
#define VER_MINOR 1 #define VER_MINOR 1
#define VER_REVISION 0 #define VER_REVISION 0
#define VER_BUILD 1 #define VER_BUILD 3
//! Convert version numbers to string //! Convert version numbers to string
#define _STR(S) #S #define _STR(S) #S
......
...@@ -6,8 +6,6 @@ ...@@ -6,8 +6,6 @@
TEMPLATE = lib TEMPLATE = lib
DEFINES += FMP_SETTINGS_LIBRARY
SOURCES += \ SOURCES += \
fmp_uiloader.cpp fmp_uiloader.cpp
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment