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 @@ ...@@ -19,3 +19,4 @@
*/res/*.rc */res/*.rc
release/bins/database/Fmtakeout.s3db release/bins/database/Fmtakeout.s3db
release/plugins/FreemudPOS.ini release/plugins/FreemudPOS.ini
fmPos.pro.user.d496c5a
...@@ -44,6 +44,8 @@ int main(int argc, char *argv[]) ...@@ -44,6 +44,8 @@ int main(int argc, char *argv[])
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
QSettings sets(QCoreApplication::applicationDirPath() + "/" + QString(app).replace(".exe", ".ini"), QSettings::IniFormat); QSettings sets(QCoreApplication::applicationDirPath() + "/" + QString(app).replace(".exe", ".ini"), QSettings::IniFormat);
#else
QSettings sets(QCoreApplication::applicationDirPath() + "/" + QString(app), QSettings::IniFormat);
#endif #endif
download_dir = sets.value(FMP_INIKEY_DOWNLOADPATH, "download").toString(); download_dir = sets.value(FMP_INIKEY_DOWNLOADPATH, "download").toString();
deploy_dir = sets.value(FMP_INIKEY_DEPLOYPATH, "..").toString(); deploy_dir = sets.value(FMP_INIKEY_DEPLOYPATH, "..").toString();
...@@ -68,95 +70,90 @@ int main(int argc, char *argv[]) ...@@ -68,95 +70,90 @@ int main(int argc, char *argv[])
QStringList dFilesInfo, bUpdFiles; QStringList dFilesInfo, bUpdFiles;
QString error; QString error;
bool updateReault = true; bool updateReault = true;
bool process_closed = false;
// 开始替换文件 // 开始替换文件
if(dInfoFile.open(QIODevice::ReadOnly)) if(dInfoFile.open(QIODevice::ReadOnly))
{ {
dFilesInfo = QString(dInfoFile.readAll()).split(","); dFilesInfo = QString(dInfoFile.readAll()).split(",");
dInfoFile.close(); dInfoFile.close();
}else //! 如果更新包含主程序,则关闭主程序
{ if (dFilesInfo.contains(app)) {
error = QString("open dfilesInfo.txt failed [%1]").arg(dInfoFile.errorString()); KillProcessByPid(instance_pid);
qDebug() << error;
updateReault = false;
goto end;
}
//! 如果更新包含主程序,则关闭主程序
bool process_closed = false;
if (dFilesInfo.contains(app)) {
KillProcessByPid(instance_pid);
process_closed = true; process_closed = true;
} }
foreach(QString dfile, dFilesInfo) { foreach(QString dfile, dFilesInfo) {
if(!dfile.isEmpty()) { if(!dfile.isEmpty()) {
QString downloadFile = QString("%1/%2").arg(download_dir, dfile); QString downloadFile = QString("%1/%2").arg(download_dir, dfile);
QString oldFile = QString("%1/%2").arg(deploy_dir, dfile); QString oldFile = QString("%1/%2").arg(deploy_dir, dfile);
QString newName = QString("%1.bak").arg(oldFile); QString newName = QString("%1.bak").arg(oldFile);
qDebug() << QString("checking file [%1]").arg(oldFile); qDebug() << QString("checking file [%1]").arg(oldFile);
if(!QFile(oldFile).exists()) { if(!QFile(oldFile).exists()) {
qDebug() << "file not exists"; qDebug() << "file not exists";
QDir parent_dir(oldFile.section("/", 0, -2)); QDir parent_dir(oldFile.section("/", 0, -2));
if(!parent_dir.exists()) { if(!parent_dir.exists()) {
if (parent_dir.mkpath(parent_dir.path())) { if (parent_dir.mkpath(parent_dir.path())) {
qDebug() << "mkdir successful"; qDebug() << "mkdir successful";
}
else {
qDebug() << "mkdir failed";
}
}
}
else {
qDebug() << "file exists";
QFile(newName).remove();
if(QFile().rename(oldFile, newName)) {
qDebug() << "rename successful";
} }
else { else {
qDebug() << "mkdir failed"; qDebug() << "rename failed";
} }
} }
}
else { if(QFile().copy(downloadFile, oldFile)) {
qDebug() << "file exists"; qDebug() << "copy file successful";
QFile(newName).remove();
if(QFile().rename(oldFile, newName)) {
qDebug() << "rename successful";
} }
else { else {
qDebug() << "rename failed"; error = "copy file failed";
} qDebug() << error;
} updateReault = false;
// 回滚文件
if(QFile().copy(downloadFile, oldFile)) { foreach(QString file, bUpdFiles) {
qDebug() << "copy file successful"; qDebug() << QString("rollback file [%1]").arg(file);
} QFile(file).remove();
else { QFile().rename(QString("%1.bak").arg(file), file);
error = "copy file failed"; }
qDebug() << error; break;
updateReault = false;
// 回滚文件
foreach(QString file, bUpdFiles) {
qDebug() << QString("rollback file [%1]").arg(file);
QFile(file).remove();
QFile().rename(QString("%1.bak").arg(file), file);
} }
break; bUpdFiles.append(oldFile);
} }
bUpdFiles.append(oldFile);
} }
} if (process_closed) {
// 启动服务
end: QProcess::startDetached(fmscupdPath, QStringList());
if(resultFile.open(QIODevice::WriteOnly)) }
}else
{ {
QByteArray buf; error = QString("open dfilesInfo.txt failed [%1]").arg(dInfoFile.errorString());
if(updateReault) qDebug() << error;
{ updateReault = false;
buf = "1";
}else if(resultFile.open(QIODevice::WriteOnly))
{ {
buf = QString("0%1").arg(error).toLatin1(); QByteArray buf;
if(updateReault)
{
buf = "1";
}else
{
buf = QString("0%1").arg(error).toLatin1();
}
resultFile.write(buf);
resultFile.close();
} }
resultFile.write(buf);
resultFile.close();
}
if (process_closed) {
// 启动服务
QProcess::startDetached(fmscupdPath, QStringList());
} }
return 0; return 0;
} }
......
[Paths]
Libraries=.
Plugins=../qtplugins
[Home] [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 \ ...@@ -10,8 +10,8 @@ SUBDIRS += fmp_manager \
fmp_epay \ fmp_epay \
fmp_home \ fmp_home \
fmp_vip \ fmp_vip \
fmp_takeout \ # fmp_takeout \
fmp_printer \ # fmp_printer \
FreemudPOS \ FreemudPOS \
FreemudSyncer \ FreemudSyncer \
fmp_redeem 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() ...@@ -40,7 +40,7 @@ FMPLogger::~FMPLogger()
if (d_ptr) { if (d_ptr) {
delete d_ptr; delete d_ptr;
d_ptr = nullptr; d_ptr = 0;
} }
} }
...@@ -104,4 +104,4 @@ short FMPLogger::GetLogLevel() const ...@@ -104,4 +104,4 @@ short FMPLogger::GetLogLevel() const
void FMPLogger::SetLogLevel(short level) void FMPLogger::SetLogLevel(short level)
{ {
d_func()->SetLogLevel(level); d_func()->SetLogLevel(level);
} }
\ No newline at end of file
...@@ -30,8 +30,14 @@ unix { ...@@ -30,8 +30,14 @@ unix {
#Target name #Target name
VER = $$system($$PWD/../fmprc.bat $$TARGET) VER = $$system($$PWD/../fmprc.bat $$TARGET)
#VER = 0.1.1 #VER = 0.1.1
ORIGIN_TARGET = $$TARGET ORIGIN_TARGET = $$TARGET
TARGET = $${TARGET}_$${VER} win32{
TARGET = $${TARGET}_$${VER}
}
else{
TARGET = $${TARGET}
}
#Header path #Header path
INCLUDEPATH += $$PWD/../include/common \ INCLUDEPATH += $$PWD/../include/common \
...@@ -44,7 +50,12 @@ LIBS += -L$$PWD/../lib ...@@ -44,7 +50,12 @@ LIBS += -L$$PWD/../lib
CONFIG(debug, debug|release) { CONFIG(debug, debug|release) {
#Linking library #Linking library
LIBS += -lCTKCored -lCTKPluginFrameworkd -llog4cxxd win32 {
LIBS += -lCTKCored -lCTKPluginFrameworkd -llog4cxxd
}else{
LIBS += -lCTKCore -lCTKPluginFramework -llog4cxx
}
#Destination path #Destination path
DESTDIR = $$PWD/../debug/plugins DESTDIR = $$PWD/../debug/plugins
} else { } else {
......
...@@ -36,8 +36,8 @@ int FMPLoggerPrivate::Init() ...@@ -36,8 +36,8 @@ int FMPLoggerPrivate::Init()
fn_setenv(L"FMP_PID", pid.toStdWString().c_str()); fn_setenv(L"FMP_PID", pid.toStdWString().c_str());
lib.unload(); lib.unload();
#else #else
setenv("FMP_APP", path.toStdString().c_str()); setenv("FMP_APP", path.toStdString().c_str(),0);
setenv("FMP_PID", pid.toStdString().c_str()); setenv("FMP_PID", pid.toStdString().c_str(),0);
#endif #endif
......
...@@ -32,7 +32,7 @@ public: ...@@ -32,7 +32,7 @@ public:
if (_stream) { if (_stream) {
delete _stream; delete _stream;
_stream = nullptr; _stream = 0;
} }
} }
......
...@@ -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 65 #define VER_BUILD 73
//! Convert version numbers to string //! Convert version numbers to string
#define _STR(S) #S #define _STR(S) #S
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
#include <fmp_settings_i.h> #include <fmp_settings_i.h>
#include <fmp_syncer_i.h> #include <fmp_syncer_i.h>
FMPluginManager::FMPluginManager() : fwContext(nullptr) FMPluginManager::FMPluginManager() : fwContext(0)
{ {
} }
...@@ -39,7 +39,15 @@ void FMPluginManager::InitService() ...@@ -39,7 +39,15 @@ void FMPluginManager::InitService()
fwContext->connectPluginListener(this, SLOT(OnPluginEvent(ctkPluginEvent))); fwContext->connectPluginListener(this, SLOT(OnPluginEvent(ctkPluginEvent)));
fwContext->connectServiceListener(this, "OnServiceEvent"); fwContext->connectServiceListener(this, "OnServiceEvent");
fw->start(); qDebug()<<"fw start";
try{
fw->start();
}
catch(const ctkPluginException &except)
{
qCritical() << "pluginFramework init failed!";
qDebug()<<except.what();
}
//! 设置模块必须第一个加载 //! 设置模块必须第一个加载
FMP_INFO() << "======================== Started ========================"; FMP_INFO() << "======================== Started ========================";
...@@ -111,7 +119,7 @@ void FMPluginManager::UninitService() ...@@ -111,7 +119,7 @@ void FMPluginManager::UninitService()
p->stop(ctkPlugin::STOP_TRANSIENT); p->stop(ctkPlugin::STOP_TRANSIENT);
} }
FMP_INFO() << "======================== Quit ========================"; FMP_INFO() << "======================== Quit ========================";
fwContext = nullptr; fwContext = 0;
fw->stop(); fw->stop();
fw->waitForStop(30000); fw->waitForStop(30000);
qApp->quit(); qApp->quit();
...@@ -135,14 +143,23 @@ int FMPluginManager::LoadPlugin(const QString &plugin) ...@@ -135,14 +143,23 @@ int FMPluginManager::LoadPlugin(const QString &plugin)
try { try {
if(!plugin.isEmpty()) { if(!plugin.isEmpty()) {
QFileInfo pluginInfo = GetPluginInfo(plugin); 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 搜索不到导致无法加载 //! 设置程序当前目录为插件目录,防止插件依赖 Dll 搜索不到导致无法加载
QDir::setCurrent(pluginInfo.path()); QDir::setCurrent(pluginInfo.canonicalPath());
QSharedPointer<ctkPlugin> p = fwContext->installPlugin(QUrl::fromLocalFile(pluginInfo.canonicalFilePath())); try
if (!p.isNull()) { {
p->start(ctkPlugin::START_TRANSIENT); QSharedPointer<ctkPlugin> p = fwContext->installPlugin(QUrl::fromLocalFile(pluginInfo.canonicalFilePath()));
plugins << p;
if (!p.isNull()) {
p->start(ctkPlugin::START_TRANSIENT);
plugins << p;
}
}
catch(ctkPluginException &except)
{
qDebug()<<"install failed:"<<pluginInfo.canonicalFilePath();
qDebug()<<except.what();
} }
} }
else { else {
...@@ -282,7 +299,13 @@ QStringList FMPluginManager::GetNewPlugins() ...@@ -282,7 +299,13 @@ QStringList FMPluginManager::GetNewPlugins()
if (fileBasename.startsWith("lib")) fileBasename = fileBasename.mid(3); if (fileBasename.startsWith("lib")) fileBasename = fileBasename.mid(3);
QString pluginName; QString pluginName;
# ifdef Q_OS_LINUX
pluginName = fileBasename.section("_", 0, 1).replace("_", "."); //ubuntu use soft link
#else
pluginName = fileBasename.section("_", 0, -2).replace("_", "."); pluginName = fileBasename.section("_", 0, -2).replace("_", ".");
#endif
if(pluginName.contains(QString("commontk")))
continue;
if (!loadedPlugins.contains(pluginName)) { if (!loadedPlugins.contains(pluginName)) {
newPlugins << pluginName; newPlugins << pluginName;
} }
...@@ -328,7 +351,7 @@ QVariantList FMPluginManager::GetExpiredPlugins() ...@@ -328,7 +351,7 @@ QVariantList FMPluginManager::GetExpiredPlugins()
QSharedPointer<ctkPlugin> p; QSharedPointer<ctkPlugin> p;
if (loadedPlugins.contains(pluginName) && (p = loadedPlugins[pluginName]) if (loadedPlugins.contains(pluginName) && (p = loadedPlugins[pluginName])
&& plugin_ver > p->getVersion().toString()) { && plugin_ver > p->getVersion().toString()) {
expiredPlugins << p->getPluginId(); expiredPlugins << (int)p->getPluginId();
} }
} }
......
...@@ -15,8 +15,14 @@ HEADERS += \ ...@@ -15,8 +15,14 @@ HEADERS += \
#Target name #Target name
VER = $$system($$PWD/../fmprc.bat $$TARGET) VER = $$system($$PWD/../fmprc.bat $$TARGET)
ORIGIN_TARGET = $$TARGET ORIGIN_TARGET = $$TARGET
TARGET = $${TARGET}_$${VER} win32{
TARGET = $${TARGET}_$${VER}
}
else{
TARGET = $${TARGET}
}
#Header path #Header path
INCLUDEPATH += $$PWD/../include/ctk \ INCLUDEPATH += $$PWD/../include/ctk \
...@@ -27,7 +33,11 @@ LIBS += -L$$PWD/../lib ...@@ -27,7 +33,11 @@ LIBS += -L$$PWD/../lib
CONFIG(debug, debug|release) { CONFIG(debug, debug|release) {
#Linking library #Linking library
LIBS += -lCTKCored -lCTKPluginFrameworkd win32 {
LIBS += -lCTKCored -lCTKPluginFrameworkd
}else{
LIBS += -lCTKCore -lCTKPluginFramework
}
#Destination path #Destination path
DESTDIR = $$PWD/../debug/plugins DESTDIR = $$PWD/../debug/plugins
} else { } else {
......
#ifndef FMP_MANAGER_I_H #ifndef FMP_MANAGER_I_H
#define FMP_MANAGER_I_H #define FMP_MANAGER_I_H
#include <QDebug>
#include <QSharedPointer> #include <QSharedPointer>
#include <QPluginLoader> #include <QPluginLoader>
#include <QDir> #include <QDir>
...@@ -66,7 +67,7 @@ public: ...@@ -66,7 +67,7 @@ public:
template <class T> template <class T>
T* GetService() T* GetService()
{ {
T* svc = nullptr; T* svc = 0;
FMPContext ctx = GetContext(); FMPContext ctx = GetContext();
if (ctx) { if (ctx) {
try { try {
...@@ -95,7 +96,7 @@ public: ...@@ -95,7 +96,7 @@ public:
template <class T> template <class T>
T* GetService(const QString &svcName) T* GetService(const QString &svcName)
{ {
T* svc = nullptr; T* svc = 0;
FMPContext ctx = GetContext(); FMPContext ctx = GetContext();
if (ctx) { if (ctx) {
try { try {
...@@ -199,16 +200,18 @@ public: ...@@ -199,16 +200,18 @@ public:
} }
private: private:
explicit FMP() : svc(nullptr) explicit FMP() : svc(0)
{ {
props[FMP_PROPKEY_LOADER] = "fmp.manager"; props[FMP_PROPKEY_LOADER] = "fmp.manager";
props[FMP_PROPKEY_PLUGINPATH] = "../plugins"; props[FMP_PROPKEY_PLUGINPATH] = "../plugins";
props[FMP_PROPKEY_ENTRY] = "fmp.home"; props[FMP_PROPKEY_ENTRY] = "fmp.home";
props[FMP_PROPKEY_CFG] = "FreemudPOS.ini"; 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)) { 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()) { if (!d.isEmpty()) {
props = d.object(); props = d.object();
} }
...@@ -223,6 +226,7 @@ private: ...@@ -223,6 +226,7 @@ private:
void Load() void Load()
{ {
QString loaderPath = GetPluginPath( props[FMP_PROPKEY_LOADER].toString()); QString loaderPath = GetPluginPath( props[FMP_PROPKEY_LOADER].toString());
qDebug()<<"path: "<<loaderPath;
loader.setFileName(loaderPath); loader.setFileName(loaderPath);
bool loaded = loader.load(); bool loaded = loader.load();
if (!loaded) { if (!loaded) {
...@@ -251,12 +255,14 @@ private: ...@@ -251,12 +255,14 @@ private:
filters << pluginFileName + "*" + ".dll"; filters << pluginFileName + "*" + ".dll";
#else #else
# ifdef Q_OS_LINUX # ifdef Q_OS_LINUX
filters << pluginFileName + "*" + ".so"; filters << "lib" + pluginFileName + "*" + ".so";
//filters <<"libfmp_manager*.so";
# else # else
filters << pluginFileName + "*" + ".dylib"; filters << pluginFileName + "*" + ".dylib";
# endif # endif
#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; QString pluginVersion;
QFileInfo pluginFileInfo; QFileInfo pluginFileInfo;
while(dirIter.hasNext()) { 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 \ ...@@ -25,7 +25,12 @@ HEADERS += fmp_network_plugin_p.h \
#Target name #Target name
VER = $$system($$PWD/../fmprc.bat $$TARGET) VER = $$system($$PWD/../fmprc.bat $$TARGET)
ORIGIN_TARGET = $$TARGET ORIGIN_TARGET = $$TARGET
TARGET = $${TARGET}_$${VER} win32{
TARGET = $${TARGET}_$${VER}
}
else{
TARGET = $${TARGET}
}
#Header path #Header path
INCLUDEPATH += $$PWD/../include/ctk \ INCLUDEPATH += $$PWD/../include/ctk \
...@@ -36,7 +41,11 @@ LIBS += -L$$PWD/../lib ...@@ -36,7 +41,11 @@ LIBS += -L$$PWD/../lib
CONFIG(debug, debug|release) { CONFIG(debug, debug|release) {
#Linking library #Linking library
win32 {
LIBS += -lCTKCored -lCTKPluginFrameworkd LIBS += -lCTKCored -lCTKPluginFrameworkd
}else{
LIBS += -lCTKCore -lCTKPluginFramework
}
#Destination path #Destination path
DESTDIR = $$PWD/../debug/plugins DESTDIR = $$PWD/../debug/plugins
} else { } else {
......
fmp_printer @ 641c3cbb
Subproject commit 4594503af57e9d86b8c64d2f1e0eb4ea87d174fd Subproject commit 641c3cbb262d3ba19765e28774273d57afc9b647
...@@ -5,7 +5,14 @@ ...@@ -5,7 +5,14 @@
#------------------------------------------------- #-------------------------------------------------
TEMPLATE = lib TEMPLATE = lib
win32 {
QT += core gui network winextras QT += core gui network winextras
}
else{
QT += core gui network x11extras
}
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
CONFIG += c++11 CONFIG += c++11
...@@ -17,7 +24,12 @@ unix { ...@@ -17,7 +24,12 @@ unix {
#Target name #Target name
VER = $$system($$PWD/../fmprc.bat $$TARGET) VER = $$system($$PWD/../fmprc.bat $$TARGET)
ORIGIN_TARGET = $$TARGET ORIGIN_TARGET = $$TARGET
TARGET = $${TARGET}_$${VER} win32{
TARGET = $${TARGET}_$${VER}
}
else{
TARGET = $${TARGET}
}
#Header path #Header path
INCLUDEPATH += $$PWD/../include/ctk \ INCLUDEPATH += $$PWD/../include/ctk \
...@@ -31,7 +43,11 @@ LIBS += -L$$PWD/../lib ...@@ -31,7 +43,11 @@ LIBS += -L$$PWD/../lib
CONFIG(debug, debug|release) { CONFIG(debug, debug|release) {
#Linking library #Linking library
win32 {
LIBS += -lCTKCored -lCTKPluginFrameworkd LIBS += -lCTKCored -lCTKPluginFrameworkd
}else{
LIBS += -lCTKCore -lCTKPluginFramework
}
#Destination path #Destination path
DESTDIR = $$PWD/../debug/plugins DESTDIR = $$PWD/../debug/plugins
} else { } else {
...@@ -78,4 +94,4 @@ FORMS += \ ...@@ -78,4 +94,4 @@ FORMS += \
consumptiondialog.ui \ consumptiondialog.ui \
couponkeypad.ui \ couponkeypad.ui \
errcodedialog.ui \ errcodedialog.ui \
scanningdialog.ui scanningdialog.ui
\ No newline at end of file
<RCC>
<qresource prefix="/fmp.redeem/META-INF">
<file>MANIFEST.MF</file>
</qresource>
</RCC>
...@@ -3,7 +3,9 @@ ...@@ -3,7 +3,9 @@
#include "couponkeypad.h" #include "couponkeypad.h"
#include "fmp_logger_i.h" #include "fmp_logger_i.h"
#include <QDebug> #include <QDebug>
#ifdef WIN32
#include <Windows.h> #include <Windows.h>
#endif
#include <QTimer> #include <QTimer>
ScanningDialog::ScanningDialog(QWidget * parent, Qt::WindowFlags f) : ScanningDialog::ScanningDialog(QWidget * parent, Qt::WindowFlags f) :
...@@ -81,6 +83,7 @@ void ScanningDialog::timeOut() ...@@ -81,6 +83,7 @@ void ScanningDialog::timeOut()
{ {
qDebug() << "activateWindow"; qDebug() << "activateWindow";
FMP_DEBUG() << "activateWindow"; FMP_DEBUG() << "activateWindow";
#ifdef WIN32
HWND hForeWnd = ::GetForegroundWindow(); HWND hForeWnd = ::GetForegroundWindow();
DWORD dwForeID = ::GetWindowThreadProcessId(hForeWnd,NULL); DWORD dwForeID = ::GetWindowThreadProcessId(hForeWnd,NULL);
DWORD dwCurID = ::GetCurrentThreadId(); DWORD dwCurID = ::GetCurrentThreadId();
...@@ -93,7 +96,8 @@ void ScanningDialog::timeOut() ...@@ -93,7 +96,8 @@ void ScanningDialog::timeOut()
::SetForegroundWindow((HWND)this->effectiveWinId()); ::SetForegroundWindow((HWND)this->effectiveWinId());
::AttachThreadInput(dwCurID,dwForeID,FALSE); ::AttachThreadInput(dwCurID,dwForeID,FALSE);
#else
#endif
this->setFocus(); this->setFocus();
ui->labScaningBar->setFocus(); ui->labScaningBar->setFocus();
} }
...@@ -101,4 +105,4 @@ void ScanningDialog::timeOut() ...@@ -101,4 +105,4 @@ void ScanningDialog::timeOut()
ScanningDialog::~ScanningDialog() ScanningDialog::~ScanningDialog()
{ {
delete ui; delete ui;
} }
\ No newline at end of file
#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() ...@@ -25,7 +25,7 @@ FMPSyncer::~FMPSyncer()
if (d_ptr) { if (d_ptr) {
delete d_ptr; delete d_ptr;
d_ptr = nullptr; d_ptr = 0;
} }
} }
...@@ -37,9 +37,11 @@ void FMPSyncer::InitService() ...@@ -37,9 +37,11 @@ void FMPSyncer::InitService()
void FMPSyncer::UninitService() void FMPSyncer::UninitService()
{ {
if (d_ptr) { if (d_ptr) {
d_ptr->terminate(); d_ptr->Uninit();
// d_ptr->terminate();
// d_ptr->wait();
delete d_ptr; delete d_ptr;
d_ptr = nullptr; d_ptr = 0;
} }
} }
......
...@@ -31,7 +31,12 @@ unix { ...@@ -31,7 +31,12 @@ unix {
#Target name #Target name
VER = $$system($$PWD/../fmprc.bat $$TARGET) VER = $$system($$PWD/../fmprc.bat $$TARGET)
ORIGIN_TARGET = $$TARGET ORIGIN_TARGET = $$TARGET
TARGET = $${TARGET}_$${VER} win32{
TARGET = $${TARGET}_$${VER}
}
else{
TARGET = $${TARGET}
}
#Header path #Header path
INCLUDEPATH += $$PWD/../include/ctk \ INCLUDEPATH += $$PWD/../include/ctk \
...@@ -44,11 +49,20 @@ LIBS += -L$$PWD/../lib ...@@ -44,11 +49,20 @@ LIBS += -L$$PWD/../lib
CONFIG(debug, debug|release) { CONFIG(debug, debug|release) {
#Linking library #Linking library
win32 {
LIBS += -lCTKCored -lCTKPluginFrameworkd -lquazipd -lzlibstaticd LIBS += -lCTKCored -lCTKPluginFrameworkd -lquazipd -lzlibstaticd
}else{
LIBS += -lCTKCore -lCTKPluginFramework -lquazip -lz
}
#Destination path #Destination path
DESTDIR = $$PWD/../debug/plugins DESTDIR = $$PWD/../debug/plugins
} else { } else {
LIBS += -lCTKCore -lCTKPluginFramework -lquazip -lzlibstatic win32 {
LIBS += -lCTKCore -lCTKPluginFramework -lquazip -lzlibstatic
}else{
LIBS += -lCTKCore -lCTKPluginFramework -lquazip -lz
}
DESTDIR = $$PWD/../release/plugins DESTDIR = $$PWD/../release/plugins
} }
......
...@@ -24,7 +24,8 @@ FMPSyncerPrivate::FMPSyncerPrivate(FMPSyncer *q) ...@@ -24,7 +24,8 @@ FMPSyncerPrivate::FMPSyncerPrivate(FMPSyncer *q)
: _inited(false), : _inited(false),
sets(0), sets(0),
nw(0), nw(0),
q_ptr(q) q_ptr(q),
bQuit(false)
{ {
} }
...@@ -50,11 +51,10 @@ int FMPSyncerPrivate::Init() ...@@ -50,11 +51,10 @@ int FMPSyncerPrivate::Init()
int FMPSyncerPrivate::Uninit() int FMPSyncerPrivate::Uninit()
{ {
if (!_inited) return FMP_SUCCESS; if (!_inited) return FMP_SUCCESS;
bQuit = true;
quit(); quit();
wait();
_inited = false; _inited = false;
return FMP_SUCCESS; return FMP_SUCCESS;
} }
...@@ -191,11 +191,21 @@ void FMPSyncerPrivate::run() ...@@ -191,11 +191,21 @@ void FMPSyncerPrivate::run()
QString task_id; QString task_id;
while(1) { while(1) {
FMP_INFO() << QString("check update after %1 ms").arg(sync_interval); static int nTimes = 0;
QEventLoop eventLoop; QEventLoop eventLoop;
QTimer::singleShot(sync_interval, &eventLoop, &QEventLoop::quit); QTimer::singleShot(1, &eventLoop, &QEventLoop::quit);
eventLoop.exec(); 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(); ReportTask();
......
...@@ -57,6 +57,7 @@ public: ...@@ -57,6 +57,7 @@ public:
//! QThread //! QThread
void run(); void run();
bool bQuit;
/** /**
* @brief ReportTask * @brief ReportTask
* 汇报升级任务 * 汇报升级任务
......
fmp_vip @ f821c854
Subproject commit 1896782c508ec9cea2a38f0e02cc6dc4a3702835 Subproject commit f821c85412423569c53f554b1fd072897c27d7d4
...@@ -60,7 +60,11 @@ typedef unsigned int log4cxx_uint32_t; ...@@ -60,7 +60,11 @@ typedef unsigned int log4cxx_uint32_t;
#define LOG4CXX_EXPORT __declspec(dllexport) #define LOG4CXX_EXPORT __declspec(dllexport)
#else #else
// definitions used when using DLL // definitions used when using DLL
#ifdef WIN32
#define LOG4CXX_EXPORT __declspec(dllimport) #define LOG4CXX_EXPORT __declspec(dllimport)
#else
#define LOG4CXX_EXPORT
#endif
#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