Commit baa932dd by 刘帅

1. 在Linux下编译了相关组件:

 ctk plugins(libCTKCore.so\libCTKPluginFramework.so\liborg_commontk_eventadmin.so)
 liblog4cxx.so(libapr-1.so\libaprutil-1.so)
 libquazip.so
 libz.so
2. 修改不适用于Linux的工程代码在Linux下编译运行通过(外卖组件暂未在linux下编译)
3. 同时支持windows下编译,不影响
4. 修改bug:
 程序关闭时崩溃(ubuntu)问题;
 monitor与fmPOS建立tcp连接后,如果monitor没有断开tcp连接,fmPOS程序菜单无响应(windows)或者无法关闭(ubuntu)
5. linux下的程序版本信息未加入
parent b1ad9a9c
......@@ -19,3 +19,4 @@
*/res/*.rc
release/bins/database/Fmtakeout.s3db
release/plugins/FreemudPOS.ini
fmPos.pro.user.d496c5a
......@@ -44,6 +44,8 @@ int main(int argc, char *argv[])
#ifdef Q_OS_WIN
QSettings sets(QCoreApplication::applicationDirPath() + "/" + QString(app).replace(".exe", ".ini"), QSettings::IniFormat);
#else
QSettings sets(QCoreApplication::applicationDirPath() + "/" + QString(app), QSettings::IniFormat);
#endif
download_dir = sets.value(FMP_INIKEY_DOWNLOADPATH, "download").toString();
deploy_dir = sets.value(FMP_INIKEY_DEPLOYPATH, "..").toString();
......@@ -68,22 +70,14 @@ int main(int argc, char *argv[])
QStringList dFilesInfo, bUpdFiles;
QString error;
bool updateReault = true;
bool process_closed = false;
// 开始替换文件
if(dInfoFile.open(QIODevice::ReadOnly))
{
dFilesInfo = QString(dInfoFile.readAll()).split(",");
dInfoFile.close();
}else
{
error = QString("open dfilesInfo.txt failed [%1]").arg(dInfoFile.errorString());
qDebug() << error;
updateReault = false;
goto end;
}
//! 如果更新包含主程序,则关闭主程序
bool process_closed = false;
if (dFilesInfo.contains(app)) {
KillProcessByPid(instance_pid);
......@@ -136,8 +130,16 @@ int main(int argc, char *argv[])
bUpdFiles.append(oldFile);
}
}
if (process_closed) {
// 启动服务
QProcess::startDetached(fmscupdPath, QStringList());
}
}else
{
error = QString("open dfilesInfo.txt failed [%1]").arg(dInfoFile.errorString());
qDebug() << error;
updateReault = false;
end:
if(resultFile.open(QIODevice::WriteOnly))
{
QByteArray buf;
......@@ -151,12 +153,7 @@ end:
resultFile.write(buf);
resultFile.close();
}
if (process_closed) {
// 启动服务
QProcess::startDetached(fmscupdPath, QStringList());
}
return 0;
}
......
[Paths]
Libraries=.
Plugins=../qtplugins
[Home]
Position=1552, 58
Position=862, 24
libCTKCore.so.0.1
\ No newline at end of file
libCTKCore.so.0.1.0
\ No newline at end of file
libCTKPluginFramework.so.0.1
\ No newline at end of file
libCTKPluginFramework.so.0.1.0
\ No newline at end of file
libapr-1.so.0.6.2
\ No newline at end of file
libapr-1.so.0.6.2
\ No newline at end of file
libaprutil-1.so.0.5.4
\ No newline at end of file
libaprutil-1.so.0.6.0
\ No newline at end of file
liblog4cxx.so.10.0.0
\ No newline at end of file
liblog4cxx.so.10.0.0
\ No newline at end of file
libquazip.so.1.0.0
\ No newline at end of file
libquazip.so.1.0.0
\ No newline at end of file
libquazip.so.1.0.0
\ No newline at end of file
libxcb.so.1.1.0
\ No newline at end of file
libxcb.so.1.1.0
\ No newline at end of file
......@@ -10,8 +10,8 @@ SUBDIRS += fmp_manager \
fmp_epay \
fmp_home \
fmp_vip \
fmp_takeout \
fmp_printer \
# fmp_takeout \
# fmp_printer \
FreemudPOS \
FreemudSyncer \
fmp_redeem
......
fmp_epay @ fb9e8e23
Subproject commit 868048a7f72e86ed42cb700d87ea7374f9678a9a
Subproject commit fb9e8e2359b45df0148ef9319e439bc9d85b80fb
fmp_home @ 9235ada3
Subproject commit e32c00d448c4366d6b103a83db400fce36853787
Subproject commit 9235ada31cc2a680789a9a959767f9652376c61a
......@@ -40,7 +40,7 @@ FMPLogger::~FMPLogger()
if (d_ptr) {
delete d_ptr;
d_ptr = nullptr;
d_ptr = 0;
}
}
......
......@@ -30,8 +30,14 @@ unix {
#Target name
VER = $$system($$PWD/../fmprc.bat $$TARGET)
#VER = 0.1.1
ORIGIN_TARGET = $$TARGET
TARGET = $${TARGET}_$${VER}
win32{
TARGET = $${TARGET}_$${VER}
}
else{
TARGET = $${TARGET}
}
#Header path
INCLUDEPATH += $$PWD/../include/common \
......@@ -44,7 +50,12 @@ LIBS += -L$$PWD/../lib
CONFIG(debug, debug|release) {
#Linking library
win32 {
LIBS += -lCTKCored -lCTKPluginFrameworkd -llog4cxxd
}else{
LIBS += -lCTKCore -lCTKPluginFramework -llog4cxx
}
#Destination path
DESTDIR = $$PWD/../debug/plugins
} else {
......
......@@ -36,8 +36,8 @@ int FMPLoggerPrivate::Init()
fn_setenv(L"FMP_PID", pid.toStdWString().c_str());
lib.unload();
#else
setenv("FMP_APP", path.toStdString().c_str());
setenv("FMP_PID", pid.toStdString().c_str());
setenv("FMP_APP", path.toStdString().c_str(),0);
setenv("FMP_PID", pid.toStdString().c_str(),0);
#endif
......
......@@ -32,7 +32,7 @@ public:
if (_stream) {
delete _stream;
_stream = nullptr;
_stream = 0;
}
}
......
......@@ -5,7 +5,7 @@
#define VER_MINOR 1
#define VER_REVISION 0
#define VER_BUILD 65
#define VER_BUILD 73
//! Convert version numbers to string
#define _STR(S) #S
......
......@@ -13,7 +13,7 @@
#include <fmp_settings_i.h>
#include <fmp_syncer_i.h>
FMPluginManager::FMPluginManager() : fwContext(nullptr)
FMPluginManager::FMPluginManager() : fwContext(0)
{
}
......@@ -39,7 +39,15 @@ void FMPluginManager::InitService()
fwContext->connectPluginListener(this, SLOT(OnPluginEvent(ctkPluginEvent)));
fwContext->connectServiceListener(this, "OnServiceEvent");
qDebug()<<"fw start";
try{
fw->start();
}
catch(const ctkPluginException &except)
{
qCritical() << "pluginFramework init failed!";
qDebug()<<except.what();
}
//! 设置模块必须第一个加载
FMP_INFO() << "======================== Started ========================";
......@@ -111,7 +119,7 @@ void FMPluginManager::UninitService()
p->stop(ctkPlugin::STOP_TRANSIENT);
}
FMP_INFO() << "======================== Quit ========================";
fwContext = nullptr;
fwContext = 0;
fw->stop();
fw->waitForStop(30000);
qApp->quit();
......@@ -135,16 +143,25 @@ int FMPluginManager::LoadPlugin(const QString &plugin)
try {
if(!plugin.isEmpty()) {
QFileInfo pluginInfo = GetPluginInfo(plugin);
if (pluginInfo.path().isEmpty()) throw ctkPluginException("Empty path for plugin " + plugin);
if (pluginInfo.canonicalPath().isEmpty()) throw ctkPluginException("Empty path for plugin " + plugin);
//! 设置程序当前目录为插件目录,防止插件依赖 Dll 搜索不到导致无法加载
QDir::setCurrent(pluginInfo.path());
QDir::setCurrent(pluginInfo.canonicalPath());
try
{
QSharedPointer<ctkPlugin> p = fwContext->installPlugin(QUrl::fromLocalFile(pluginInfo.canonicalFilePath()));
if (!p.isNull()) {
p->start(ctkPlugin::START_TRANSIENT);
plugins << p;
}
}
catch(ctkPluginException &except)
{
qDebug()<<"install failed:"<<pluginInfo.canonicalFilePath();
qDebug()<<except.what();
}
}
else {
FMP_WARN() << "Empty plugin name." << plugin;
return FMP_FAILURE;
......@@ -282,7 +299,13 @@ QStringList FMPluginManager::GetNewPlugins()
if (fileBasename.startsWith("lib")) fileBasename = fileBasename.mid(3);
QString pluginName;
# ifdef Q_OS_LINUX
pluginName = fileBasename.section("_", 0, 1).replace("_", "."); //ubuntu use soft link
#else
pluginName = fileBasename.section("_", 0, -2).replace("_", ".");
#endif
if(pluginName.contains(QString("commontk")))
continue;
if (!loadedPlugins.contains(pluginName)) {
newPlugins << pluginName;
}
......@@ -328,7 +351,7 @@ QVariantList FMPluginManager::GetExpiredPlugins()
QSharedPointer<ctkPlugin> p;
if (loadedPlugins.contains(pluginName) && (p = loadedPlugins[pluginName])
&& plugin_ver > p->getVersion().toString()) {
expiredPlugins << p->getPluginId();
expiredPlugins << (int)p->getPluginId();
}
}
......
......@@ -15,8 +15,14 @@ HEADERS += \
#Target name
VER = $$system($$PWD/../fmprc.bat $$TARGET)
ORIGIN_TARGET = $$TARGET
TARGET = $${TARGET}_$${VER}
win32{
TARGET = $${TARGET}_$${VER}
}
else{
TARGET = $${TARGET}
}
#Header path
INCLUDEPATH += $$PWD/../include/ctk \
......@@ -27,7 +33,11 @@ LIBS += -L$$PWD/../lib
CONFIG(debug, debug|release) {
#Linking library
win32 {
LIBS += -lCTKCored -lCTKPluginFrameworkd
}else{
LIBS += -lCTKCore -lCTKPluginFramework
}
#Destination path
DESTDIR = $$PWD/../debug/plugins
} else {
......
#ifndef FMP_MANAGER_I_H
#define FMP_MANAGER_I_H
#include <QDebug>
#include <QSharedPointer>
#include <QPluginLoader>
#include <QDir>
......@@ -66,7 +67,7 @@ public:
template <class T>
T* GetService()
{
T* svc = nullptr;
T* svc = 0;
FMPContext ctx = GetContext();
if (ctx) {
try {
......@@ -95,7 +96,7 @@ public:
template <class T>
T* GetService(const QString &svcName)
{
T* svc = nullptr;
T* svc = 0;
FMPContext ctx = GetContext();
if (ctx) {
try {
......@@ -199,16 +200,18 @@ public:
}
private:
explicit FMP() : svc(nullptr)
explicit FMP() : svc(0)
{
props[FMP_PROPKEY_LOADER] = "fmp.manager";
props[FMP_PROPKEY_PLUGINPATH] = "../plugins";
props[FMP_PROPKEY_ENTRY] = "fmp.home";
props[FMP_PROPKEY_CFG] = "FreemudPOS.ini";
QFile f(qApp->applicationDirPath() + "/" + props[FMP_PROPKEY_CFG].toString());
QString strFileName = qApp->applicationDirPath() + "/" + props[FMP_PROPKEY_CFG].toString();
QFile f(strFileName);
if (f.exists() && f.open(QFile::ReadWrite)) {
QJsonDocument d = QJsonDocument::fromJson(f.readAll());
QJsonParseError err;
QJsonDocument d = QJsonDocument::fromJson(f.readAll(),&err);
if (!d.isEmpty()) {
props = d.object();
}
......@@ -223,6 +226,7 @@ private:
void Load()
{
QString loaderPath = GetPluginPath( props[FMP_PROPKEY_LOADER].toString());
qDebug()<<"path: "<<loaderPath;
loader.setFileName(loaderPath);
bool loaded = loader.load();
if (!loaded) {
......@@ -251,12 +255,14 @@ private:
filters << pluginFileName + "*" + ".dll";
#else
# ifdef Q_OS_LINUX
filters << pluginFileName + "*" + ".so";
filters << "lib" + pluginFileName + "*" + ".so";
//filters <<"libfmp_manager*.so";
# else
filters << pluginFileName + "*" + ".dylib";
# endif
#endif
QDirIterator dirIter(qApp->applicationDirPath() + "/" + props[FMP_PROPKEY_PLUGINPATH].toString(), filters, QDir::Files);
QString strPluginPath = qApp->applicationDirPath() + "/" + props[FMP_PROPKEY_PLUGINPATH].toString();
QDirIterator dirIter(strPluginPath, filters,QDir::Files);
QString pluginVersion;
QFileInfo pluginFileInfo;
while(dirIter.hasNext()) {
......
#ifndef _VERSION_H_
#define _VERSION_H_
#define VER_MAJOR 0
#define VER_MINOR 1
#define VER_REVISION 0
#define VER_BUILD 65
//! 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.manager\0"
#define RES_INTER_NAME "fmp.manager\0"
#define RES_FILE_NAME "fmp.manager\0"
#define RES_PRODUCT_NAME "fmp.manager\0"
#define RES_FILE_EXT "*\0"
#endif //!_VERSION_H_
......@@ -25,7 +25,12 @@ HEADERS += fmp_network_plugin_p.h \
#Target name
VER = $$system($$PWD/../fmprc.bat $$TARGET)
ORIGIN_TARGET = $$TARGET
TARGET = $${TARGET}_$${VER}
win32{
TARGET = $${TARGET}_$${VER}
}
else{
TARGET = $${TARGET}
}
#Header path
INCLUDEPATH += $$PWD/../include/ctk \
......@@ -36,7 +41,11 @@ LIBS += -L$$PWD/../lib
CONFIG(debug, debug|release) {
#Linking library
win32 {
LIBS += -lCTKCored -lCTKPluginFrameworkd
}else{
LIBS += -lCTKCore -lCTKPluginFramework
}
#Destination path
DESTDIR = $$PWD/../debug/plugins
} else {
......
fmp_printer @ 641c3cbb
Subproject commit 4594503af57e9d86b8c64d2f1e0eb4ea87d174fd
Subproject commit 641c3cbb262d3ba19765e28774273d57afc9b647
......@@ -5,7 +5,14 @@
#-------------------------------------------------
TEMPLATE = lib
win32 {
QT += core gui network winextras
}
else{
QT += core gui network x11extras
}
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
CONFIG += c++11
......@@ -17,7 +24,12 @@ unix {
#Target name
VER = $$system($$PWD/../fmprc.bat $$TARGET)
ORIGIN_TARGET = $$TARGET
TARGET = $${TARGET}_$${VER}
win32{
TARGET = $${TARGET}_$${VER}
}
else{
TARGET = $${TARGET}
}
#Header path
INCLUDEPATH += $$PWD/../include/ctk \
......@@ -31,7 +43,11 @@ LIBS += -L$$PWD/../lib
CONFIG(debug, debug|release) {
#Linking library
win32 {
LIBS += -lCTKCored -lCTKPluginFrameworkd
}else{
LIBS += -lCTKCore -lCTKPluginFramework
}
#Destination path
DESTDIR = $$PWD/../debug/plugins
} else {
......
<RCC>
<qresource prefix="/fmp.redeem/META-INF">
<file>MANIFEST.MF</file>
</qresource>
</RCC>
......@@ -3,7 +3,9 @@
#include "couponkeypad.h"
#include "fmp_logger_i.h"
#include <QDebug>
#ifdef WIN32
#include <Windows.h>
#endif
#include <QTimer>
ScanningDialog::ScanningDialog(QWidget * parent, Qt::WindowFlags f) :
......@@ -81,6 +83,7 @@ void ScanningDialog::timeOut()
{
qDebug() << "activateWindow";
FMP_DEBUG() << "activateWindow";
#ifdef WIN32
HWND hForeWnd = ::GetForegroundWindow();
DWORD dwForeID = ::GetWindowThreadProcessId(hForeWnd,NULL);
DWORD dwCurID = ::GetCurrentThreadId();
......@@ -93,7 +96,8 @@ void ScanningDialog::timeOut()
::SetForegroundWindow((HWND)this->effectiveWinId());
::AttachThreadInput(dwCurID,dwForeID,FALSE);
#else
#endif
this->setFocus();
ui->labScaningBar->setFocus();
}
......
#ifndef _VERSION_H_
#define _VERSION_H_
#define VER_MAJOR 0
#define VER_MINOR 1
#define VER_REVISION 0
#define VER_BUILD 73
//! 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.redeem\0"
#define RES_INTER_NAME "fmp.redeem\0"
#define RES_FILE_NAME "fmp.redeem\0"
#define RES_PRODUCT_NAME "fmp.redeem\0"
#define RES_FILE_EXT "*\0"
#endif //!_VERSION_H_
fmp_settings @ 079792a1
Subproject commit bcada99bce3ac14fae00749e493ee4a2cdf8913c
Subproject commit 079792a1c265789a97c7db5b53747368e4a000f8
......@@ -25,7 +25,7 @@ FMPSyncer::~FMPSyncer()
if (d_ptr) {
delete d_ptr;
d_ptr = nullptr;
d_ptr = 0;
}
}
......@@ -37,9 +37,11 @@ void FMPSyncer::InitService()
void FMPSyncer::UninitService()
{
if (d_ptr) {
d_ptr->terminate();
d_ptr->Uninit();
// d_ptr->terminate();
// d_ptr->wait();
delete d_ptr;
d_ptr = nullptr;
d_ptr = 0;
}
}
......
......@@ -31,7 +31,12 @@ unix {
#Target name
VER = $$system($$PWD/../fmprc.bat $$TARGET)
ORIGIN_TARGET = $$TARGET
TARGET = $${TARGET}_$${VER}
win32{
TARGET = $${TARGET}_$${VER}
}
else{
TARGET = $${TARGET}
}
#Header path
INCLUDEPATH += $$PWD/../include/ctk \
......@@ -44,11 +49,20 @@ LIBS += -L$$PWD/../lib
CONFIG(debug, debug|release) {
#Linking library
win32 {
LIBS += -lCTKCored -lCTKPluginFrameworkd -lquazipd -lzlibstaticd
}else{
LIBS += -lCTKCore -lCTKPluginFramework -lquazip -lz
}
#Destination path
DESTDIR = $$PWD/../debug/plugins
} else {
win32 {
LIBS += -lCTKCore -lCTKPluginFramework -lquazip -lzlibstatic
}else{
LIBS += -lCTKCore -lCTKPluginFramework -lquazip -lz
}
DESTDIR = $$PWD/../release/plugins
}
......
......@@ -24,7 +24,8 @@ FMPSyncerPrivate::FMPSyncerPrivate(FMPSyncer *q)
: _inited(false),
sets(0),
nw(0),
q_ptr(q)
q_ptr(q),
bQuit(false)
{
}
......@@ -50,11 +51,10 @@ int FMPSyncerPrivate::Init()
int FMPSyncerPrivate::Uninit()
{
if (!_inited) return FMP_SUCCESS;
bQuit = true;
quit();
wait();
_inited = false;
return FMP_SUCCESS;
}
......@@ -191,11 +191,21 @@ void FMPSyncerPrivate::run()
QString task_id;
while(1) {
FMP_INFO() << QString("check update after %1 ms").arg(sync_interval);
static int nTimes = 0;
QEventLoop eventLoop;
QTimer::singleShot(sync_interval, &eventLoop, &QEventLoop::quit);
QTimer::singleShot(1, &eventLoop, &QEventLoop::quit);
eventLoop.exec();
nTimes++;
if(bQuit)
break; //quit
if(nTimes == sync_interval)
{
FMP_INFO() << QString("check update after %1 ms").arg(sync_interval);
nTimes = 0;
}
else
continue;
//! 如果有更新结果向服务器汇报结果
ReportTask();
......
......@@ -57,6 +57,7 @@ public:
//! QThread
void run();
bool bQuit;
/**
* @brief ReportTask
* 汇报升级任务
......
fmp_vip @ f821c854
Subproject commit 1896782c508ec9cea2a38f0e02cc6dc4a3702835
Subproject commit f821c85412423569c53f554b1fd072897c27d7d4
......@@ -60,7 +60,11 @@ typedef unsigned int log4cxx_uint32_t;
#define LOG4CXX_EXPORT __declspec(dllexport)
#else
// definitions used when using DLL
#ifdef WIN32
#define LOG4CXX_EXPORT __declspec(dllimport)
#else
#define LOG4CXX_EXPORT
#endif
#endif
......
libCTKCore.so.0.1
\ No newline at end of file
libCTKCore.so.0.1.0
\ No newline at end of file
libCTKPluginFramework.so.0.1
\ No newline at end of file
libCTKPluginFramework.so.0.1.0
\ No newline at end of file
liblog4cxx.so.10.0.0
\ No newline at end of file
liblog4cxx.so.10.0.0
\ No newline at end of file
libquazip.so.1.0.0
\ No newline at end of file
libquazip.so.1.0.0
\ No newline at end of file
libquazip.so.1.0.0
\ No newline at end of file
libz.so.1.2.11
\ No newline at end of file
libz.so.1.2.11
\ No newline at end of file
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