Commit 63e2e165 by NitefullWind

Merge branch 'master' of git.oschina.net:kong__mo/fmPOS

parents 7149527b b7d2e09b
...@@ -3,7 +3,7 @@ include ("qtservice/src/qtservice.pri") ...@@ -3,7 +3,7 @@ include ("qtservice/src/qtservice.pri")
QT += core widgets QT += core widgets
CONFIG += c++11 CONFIG += c++11
TARGET = fmPos TARGET = FreemudPOS
TEMPLATE = app TEMPLATE = app
INCLUDEPATH += $$PWD/../include/interface INCLUDEPATH += $$PWD/../include/interface
......
...@@ -6,6 +6,14 @@ ...@@ -6,6 +6,14 @@
#include <QDir> #include <QDir>
#include <QDirIterator> #include <QDirIterator>
#include <qtservice.h> #include <qtservice.h>
#ifdef Q_OS_WIN
#include <Windows.h>
//! 命名冲突
#undef StartService
#endif
#include "../fmp_settings/fmp_settings_def.h" #include "../fmp_settings/fmp_settings_def.h"
class FMPService : public QtService<QApplication> class FMPService : public QtService<QApplication>
...@@ -18,7 +26,7 @@ public: ...@@ -18,7 +26,7 @@ public:
QtService<QApplication>(argc, argv, svcname) QtService<QApplication>(argc, argv, svcname)
{ {
createApplication(argc, argv); createApplication(argc, argv);
_setting = new QSettings(qApp->applicationDirPath() + "/fmPos.ini", QSettings::IniFormat); _setting = new QSettings(qApp->applicationDirPath() + "/" + qApp->applicationName() + ".ini", QSettings::IniFormat);
_starttype = _setting->value(FMP_INIKEY_SERVICESTARTTYPE, 0).toInt(); _starttype = _setting->value(FMP_INIKEY_SERVICESTARTTYPE, 0).toInt();
_description = _setting->value(FMP_INIKEY_SERVICEDESC, "Freemud POS plugin service").toString(); _description = _setting->value(FMP_INIKEY_SERVICEDESC, "Freemud POS plugin service").toString();
_plugin_path = _setting->value(FMP_INIKEY_PLUGINPATH, "plugins").toString(); _plugin_path = _setting->value(FMP_INIKEY_PLUGINPATH, "plugins").toString();
...@@ -44,6 +52,9 @@ public: ...@@ -44,6 +52,9 @@ public:
props[FMP_PROPKEY_PLUGINPATH] = _plugin_path; props[FMP_PROPKEY_PLUGINPATH] = _plugin_path;
props[FMP_PROPKEY_ENTRY] = _entry_plugin; props[FMP_PROPKEY_ENTRY] = _entry_plugin;
props[FMP_PROPKEY_CFG] = _setting->fileName(); props[FMP_PROPKEY_CFG] = _setting->fileName();
#ifdef Q_OS_WIN
props[FMP_PROPKEY_PROCID] = QString::number(GetCurrentProcessId());
#endif
if (FMP_SUCCESS != fmp_manager->SetProperties(props) if (FMP_SUCCESS != fmp_manager->SetProperties(props)
|| FMP_SUCCESS != fmp_manager->StartService()) { || FMP_SUCCESS != fmp_manager->StartService()) {
exit(0); exit(0);
...@@ -105,10 +116,11 @@ private: ...@@ -105,10 +116,11 @@ private:
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
QString appPath = QString::fromLocal8Bit(argv[0]); QString app_path = QString::fromLocal8Bit(argv[0]);
appPath.replace("\\", "/"); app_path.replace("\\", "/");
appPath = appPath.section("/", 0, -2); QString app_dir = app_path.section("/", 0, -2);
QSettings setting(appPath + "/fmPos.ini", QSettings::IniFormat); QString app_name = app_path.section("/", -1);
QSettings setting(app_dir + "/" + app_name.replace(".exe", ".ini"), QSettings::IniFormat);
QString svc_name = setting.value(FMP_INIKEY_SERVICENAME, "FMPService").toString(); QString svc_name = setting.value(FMP_INIKEY_SERVICENAME, "FMPService").toString();
FMPService svc(argc, argv, svc_name); FMPService svc(argc, argv, svc_name);
......
...@@ -6,6 +6,16 @@ CONFIG += c++11 ...@@ -6,6 +6,16 @@ CONFIG += c++11
TARGET = FreemudSyncer TARGET = FreemudSyncer
CONFIG += app CONFIG += app
CONFIG(debug, debug|release) {
DESTDIR = $$PWD/../debug/bin
} else {
DESTDIR = $$PWD/../release/bin
}
win32 {
LIBS += -lpsapi
}
TEMPLATE = app TEMPLATE = app
SOURCES += main.cpp SOURCES += main.cpp
...@@ -6,6 +6,8 @@ ...@@ -6,6 +6,8 @@
#include <QDateTime> #include <QDateTime>
#include <QSettings> #include <QSettings>
QString download_dir, deploy_dir;
void MessageOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg) void MessageOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg)
{ {
Q_UNUSED(type); Q_UNUSED(context); Q_UNUSED(type); Q_UNUSED(context);
...@@ -13,7 +15,7 @@ void MessageOutput(QtMsgType type, const QMessageLogContext &context, const QStr ...@@ -13,7 +15,7 @@ void MessageOutput(QtMsgType type, const QMessageLogContext &context, const QStr
QString strDateTime = QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss.zzz"); QString strDateTime = QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss.zzz");
QString strMessage = QString("%1: %2").arg(strDateTime).arg(msg); QString strMessage = QString("%1: %2").arg(strDateTime).arg(msg);
// 输出信息至文件中(读写、追加形式) // 输出信息至文件中(读写、追加形式)
QFile file(QString("%1/download/porter.log").arg(qApp->applicationDirPath())); QFile file(QString("%1/porter.log").arg(download_dir));
file.open(QIODevice::ReadWrite | QIODevice::Append); file.open(QIODevice::ReadWrite | QIODevice::Append);
QTextStream stream(&file); QTextStream stream(&file);
stream << strMessage << "\r\n"; stream << strMessage << "\r\n";
...@@ -21,31 +23,52 @@ void MessageOutput(QtMsgType type, const QMessageLogContext &context, const QStr ...@@ -21,31 +23,52 @@ void MessageOutput(QtMsgType type, const QMessageLogContext &context, const QStr
file.close(); file.close();
} }
QString GetProcessNameByPid(int pid);
bool KillProcessByPid(int pid);
#define FMP_INIKEY_DOWNLOADPATH "Syncer/DownloadPath"
#define FMP_INIKEY_DEPLOYPATH "Syncer/DeployPath"
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
if (argc < 2) { if (argc < 2) {
qDebug() << "Usage: FreemudSyncer [App name]"; qDebug() << "Usage: FreemudSyncer [Process ID]";
return 0; return 0;
} }
QCoreApplication a(argc, argv); QCoreApplication a(argc, argv);
QString app = argv[1]; int instance_pid = QString(argv[1]).toInt();
QString fmscupdPath = GetProcessNameByPid(instance_pid);
QString app = fmscupdPath.section("/", -1);
#ifdef Q_OS_WIN
QSettings sets(QCoreApplication::applicationDirPath() + "/" + QString(app).replace(".exe", ".ini"), QSettings::IniFormat);
#endif
download_dir = sets.value(FMP_INIKEY_DOWNLOADPATH, "download").toString();
deploy_dir = sets.value(FMP_INIKEY_DEPLOYPATH, "..").toString();
if (QFileInfo(deploy_dir).isAbsolute()) {
download_dir = deploy_dir + "/" + download_dir;
}
else {
deploy_dir = qApp->applicationDirPath() + "/" + deploy_dir;
download_dir = deploy_dir + "/" + download_dir;
}
// 日志输出 // 日志输出
// qInstallMessageHandler(MessageOutput); QDir().mkdir(download_dir);
qInstallMessageHandler(MessageOutput);
qDebug() << "\r\n\r\n\r\n"; qDebug() << "\r\n\r\n\r\n";
QString appDir = QCoreApplication::applicationDirPath(); qDebug() << QString("Process %1[%2] asks for sync.").arg(app).arg(instance_pid);
QString fmscupdPath = QString("%1/%2").arg(appDir).arg(app);
QFile dInfoFile(QString("%1/download/dfilesInfo.txt").arg(appDir)); QFile dInfoFile(QString("%1/dfilesInfo.txt").arg(download_dir));
QFile resultFile(QString("%1/download/updateresult.txt").arg(appDir)); QFile resultFile(QString("%1/updateresult.txt").arg(download_dir));
QStringList dFilesInfo, bUpdFiles; QStringList dFilesInfo, bUpdFiles;
QString error; QString error;
bool updateReault = true; bool updateReault = true;
// 关闭服务
QProcess::execute(fmscupdPath, QStringList("-t"));
// 开始替换文件 // 开始替换文件
if(dInfoFile.open(QIODevice::ReadOnly)) if(dInfoFile.open(QIODevice::ReadOnly))
{ {
...@@ -59,48 +82,51 @@ int main(int argc, char *argv[]) ...@@ -59,48 +82,51 @@ int main(int argc, char *argv[])
goto end; goto end;
} }
foreach(QString dfile, dFilesInfo) //! 如果更新包含主程序,则关闭主程序
{ bool process_closed = false;
if(!dfile.isEmpty()) if (dFilesInfo.contains(app)) {
{ KillProcessByPid(instance_pid);
QString downloadFile = QString("%1/download/%2").arg(appDir, dfile);
QString oldFile = QString("%1/%2").arg(appDir, dfile); process_closed = true;
}
foreach(QString dfile, dFilesInfo) {
if(!dfile.isEmpty()) {
QString downloadFile = QString("%1/%2").arg(download_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("replace 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";
if(QDir().mkpath(oldFile.left(oldFile.lastIndexOf("/")))) QDir parent_dir(oldFile.section("/", 0, -2));
{ if(!parent_dir.exists()) {
qDebug() << "mkdir successful"; if (parent_dir.mkpath(parent_dir.path())) {
}else qDebug() << "mkdir successful";
{ }
qDebug() << "mkdir failed"; else {
qDebug() << "mkdir failed";
}
} }
}else }
{ else {
qDebug() << "file exists"; qDebug() << "file exists";
QFile(newName).remove(); QFile(newName).remove();
if(QFile().rename(oldFile, newName)) if(QFile().rename(oldFile, newName)) {
{
qDebug() << "rename successful"; qDebug() << "rename successful";
}else }
{ else {
qDebug() << "rename failed"; qDebug() << "rename failed";
} }
} }
if(QFile().copy(downloadFile, oldFile)) if(QFile().copy(downloadFile, oldFile)) {
{
qDebug() << "copy file successful"; qDebug() << "copy file successful";
}else }
{ else {
error = "copy file failed"; error = "copy file failed";
qDebug() << error; qDebug() << error;
updateReault = false; updateReault = false;
// 回滚文件 // 回滚文件
foreach(QString file, bUpdFiles) foreach(QString file, bUpdFiles) {
{
qDebug() << QString("rollback file [%1]").arg(file); qDebug() << QString("rollback file [%1]").arg(file);
QFile(file).remove(); QFile(file).remove();
QFile().rename(QString("%1.bak").arg(file), file); QFile().rename(QString("%1.bak").arg(file), file);
...@@ -125,7 +151,43 @@ end: ...@@ -125,7 +151,43 @@ end:
resultFile.write(buf); resultFile.write(buf);
resultFile.close(); resultFile.close();
} }
// 启动服务
QProcess::startDetached(fmscupdPath, QStringList(fmscupdPath)); if (process_closed) {
// 启动服务
QProcess::startDetached(fmscupdPath, QStringList());
}
return 0; return 0;
} }
#ifdef Q_OS_WIN
#include <Windows.h>
#include <Psapi.h>
#endif
QString GetProcessNameByPid(int pid)
{
QString proc_name;
#ifdef Q_OS_WIN
HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, false, pid);
WCHAR module[MAX_PATH] = { 0 };
GetModuleFileNameEx(hProcess, NULL, module, MAX_PATH);
proc_name = QString::fromWCharArray(module);
proc_name = proc_name.replace("\\", "/");
#endif
return proc_name;
}
bool KillProcessByPid(int pid)
{
bool killed = false;
#ifdef Q_OS_WIN
HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, false, pid);
killed = (TerminateProcess(hProcess, 0) == TRUE);
#endif
return killed;
}
...@@ -9,7 +9,7 @@ Path=../plugins ...@@ -9,7 +9,7 @@ Path=../plugins
EntryService=com.fmp.home EntryService=com.fmp.home
[Log] [Log]
Path=log/testlog Path=log
Size=1 Size=1
;0:关闭 1:错误 2:警告 3:信息 4:调试 ;0:关闭 1:错误 2:警告 3:信息 4:调试
Level=0 Level=0
...@@ -29,4 +29,6 @@ Animation=1 ...@@ -29,4 +29,6 @@ Animation=1
[Syncer] [Syncer]
Interval=3 Interval=3
TaskUrl=http://192.168.110.150:8080/api/fork/checkupdate TaskUrl=http://192.168.110.150:8080/api/fork/checkupdate
\ No newline at end of file DeployPath=..
DownloadPath=download
\ No newline at end of file
...@@ -9,6 +9,7 @@ SUBDIRS += fmp_manager \ ...@@ -9,6 +9,7 @@ SUBDIRS += fmp_manager \
fmp_syncer \ fmp_syncer \
fmp_epay \ fmp_epay \
fmp_home \ fmp_home \
FreemudPOS FreemudPOS \
FreemudSyncer
CONFIG += ordered CONFIG += ordered
...@@ -14,6 +14,7 @@ FMPStartEventHandler::FMPStartEventHandler(ctkPluginContext *ctx, FMPHome *home) ...@@ -14,6 +14,7 @@ FMPStartEventHandler::FMPStartEventHandler(ctkPluginContext *ctx, FMPHome *home)
void FMPStartEventHandler::handleEvent(const ctkEvent &event) void FMPStartEventHandler::handleEvent(const ctkEvent &event)
{ {
qDebug() << "===========";
if (_home) { if (_home) {
QString ack_topic = event.getTopic(); QString ack_topic = event.getTopic();
//! com/fmp/services/REQ_START/id //! com/fmp/services/REQ_START/id
......
...@@ -80,8 +80,6 @@ void FMPLogger::SetPath(const QString &path) ...@@ -80,8 +80,6 @@ void FMPLogger::SetPath(const QString &path)
QIODevice *FMPLogger::GetIODevice() QIODevice *FMPLogger::GetIODevice()
{ {
d_func()->_KeepFileSize();
return _file; return _file;
} }
......
...@@ -10,12 +10,15 @@ ...@@ -10,12 +10,15 @@
FMPLoggerPrivate::FMPLoggerPrivate(FMPLogger *q, ctkPluginContext *ctx) FMPLoggerPrivate::FMPLoggerPrivate(FMPLogger *q, ctkPluginContext *ctx)
: q_ptr(q), : q_ptr(q),
_ctx(ctx), _ctx(ctx),
_inited(false) _inited(false),
_file_index(0)
{ {
_lvlmap[FMPLogger::LOG_DEBUG] = "dbg"; _lvlmap[FMPLogger::LOG_DEBUG] = "dbg";
_lvlmap[FMPLogger::LOG_INFO] = "info"; _lvlmap[FMPLogger::LOG_INFO] = "info";
_lvlmap[FMPLogger::LOG_WARNING] = "warn"; _lvlmap[FMPLogger::LOG_WARNING] = "warn";
_lvlmap[FMPLogger::LOG_ERROR] = "err"; _lvlmap[FMPLogger::LOG_ERROR] = "error";
_log_date = QDateTime::currentDateTime();
} }
int FMPLoggerPrivate::Init() int FMPLoggerPrivate::Init()
...@@ -24,10 +27,11 @@ int FMPLoggerPrivate::Init() ...@@ -24,10 +27,11 @@ int FMPLoggerPrivate::Init()
Q_Q(FMPLogger); Q_Q(FMPLogger);
QString filename = _NewFileName(); if (q->_level > 0) {
q->_file = new QFile(filename); QString filename = _NewFileName();
q->_file->open(QFile::WriteOnly); q->_file = new QFile(filename);
q->_file->open(QFile::Append);
}
_inited = true; _inited = true;
return FMP_SUCCESS; return FMP_SUCCESS;
} }
...@@ -95,11 +99,7 @@ void FMPLoggerPrivate::Log(short level, const QString &msg, const char* file, co ...@@ -95,11 +99,7 @@ void FMPLoggerPrivate::Log(short level, const QString &msg, const char* file, co
Q_Q(FMPLogger); Q_Q(FMPLogger);
if (level > q->_level) { if (level > q->_level) {
if (q->_file->size() >= (q->_max_size * 1024 * 1024)) { _KeepFileSize();
q->_file->close();
q->_file->setFileName(_NewFileName());
q->_file->open(QFile::WriteOnly);
}
FMPLogStream(level, file, func, line, q->_file) << msg; FMPLogStream(level, file, func, line, q->_file) << msg;
} }
else { else {
...@@ -109,7 +109,14 @@ void FMPLoggerPrivate::Log(short level, const QString &msg, const char* file, co ...@@ -109,7 +109,14 @@ void FMPLoggerPrivate::Log(short level, const QString &msg, const char* file, co
QString FMPLoggerPrivate::_NewFileName() QString FMPLoggerPrivate::_NewFileName()
{ {
QString file_time = QDateTime::currentDateTime().toString("yyMMddhhmmss"); if (_log_date.date() < QDateTime::currentDateTime().date()) {
//! 日志记录重置
_file_index = 0;
_log_date = QDateTime::currentDateTime();
}
QString file_index = QString::number(++_file_index);
Q_Q(FMPLogger); Q_Q(FMPLogger);
QString log_path = GetLogPath(); QString log_path = GetLogPath();
QDir log_dir(log_path); QDir log_dir(log_path);
...@@ -121,7 +128,7 @@ QString FMPLoggerPrivate::_NewFileName() ...@@ -121,7 +128,7 @@ QString FMPLoggerPrivate::_NewFileName()
_FMP_INFO << "Create log dir" << log_path << "failed!"; _FMP_INFO << "Create log dir" << log_path << "failed!";
} }
} }
return q->_path + "/" + _lvlmap[q->_level] + "_" + file_time + ".log"; return q->_path + "/" + _lvlmap[q->_level] + "_" + file_index + ".log";
} }
bool FMPLoggerPrivate::_SetValue(const QString &key, QVariant v) bool FMPLoggerPrivate::_SetValue(const QString &key, QVariant v)
...@@ -156,13 +163,16 @@ QVariant FMPLoggerPrivate::_GetValue(const QString &key, QVariant default_val) ...@@ -156,13 +163,16 @@ QVariant FMPLoggerPrivate::_GetValue(const QString &key, QVariant default_val)
void FMPLoggerPrivate::_KeepFileSize() void FMPLoggerPrivate::_KeepFileSize()
{ {
Q_Q(FMPLogger); Q_Q(FMPLogger);
qint64 file_sz = q->_file->size(); if (q->_level > 0) {
if ( file_sz >= (q->_max_size * 1024 * 1024)) { qint64 file_sz = q->_file->size();
QString new_file_name = _NewFileName(); if ( file_sz >= (q->_max_size * 1024 * 1024)) {
FMP_INFO(q) << "Current log file size:" << file_sz << "reaches max value"; QString new_file_name = _NewFileName();
FMP_INFO(q) << "New log file:" << new_file_name; FMP_INFO(q) << "Current log file size:" << file_sz << "reaches max value";
q->_file->close(); FMP_INFO(q) << "New log file:" << new_file_name;
q->_file->setFileName(new_file_name); q->_file->close();
q->_file->open(QFile::WriteOnly); q->_file->setFileName(new_file_name);
q->_file->open(QFile::Append);
}
} }
} }
...@@ -30,6 +30,10 @@ public: ...@@ -30,6 +30,10 @@ public:
FMPLogger *q_ptr; FMPLogger *q_ptr;
ctkPluginContext *_ctx; ctkPluginContext *_ctx;
QMap<short, QString> _lvlmap; QMap<short, QString> _lvlmap;
int _file_index;
QDateTime _log_date;
}; };
#define _FMP_INFO FMPNullLogStream(FMPLogger::LOG_INFO, __FILE__, __FUNCTION__, __LINE__) #define _FMP_INFO FMPNullLogStream(FMPLogger::LOG_INFO, __FILE__, __FUNCTION__, __LINE__)
......
...@@ -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 10 #define VER_BUILD 28
//! Convert version numbers to string //! Convert version numbers to string
#define _STR(S) #S #define _STR(S) #S
......
...@@ -213,12 +213,12 @@ QFileInfo FMPluginManager::GetPluginInfo(const QString &plugin_name, const QStri ...@@ -213,12 +213,12 @@ QFileInfo FMPluginManager::GetPluginInfo(const QString &plugin_name, const QStri
plugin_file_name.replace(".", "_"); plugin_file_name.replace(".", "_");
QStringList filters; QStringList filters;
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
filters << plugin_file_name + "*" + ".dll"; filters << "*" + plugin_file_name + "*" + ".dll";
#else #else
# ifdef Q_OS_LINUX # ifdef Q_OS_LINUX
filters << plugin_file_name + "*" + ".so"; filters << "*" + plugin_file_name + "*" + ".so";
# else # else
filters << plugin_file_name + "*" + ".dylib"; filters << "*" + plugin_file_name + "*" + ".dylib";
# endif # endif
#endif #endif
QDirIterator dir_iter(qApp->applicationDirPath() + "/" + _fw_props[FMP_PROPKEY_PLUGINPATH].toString(), filters, QDir::Files); QDirIterator dir_iter(qApp->applicationDirPath() + "/" + _fw_props[FMP_PROPKEY_PLUGINPATH].toString(), filters, QDir::Files);
...@@ -230,7 +230,14 @@ QFileInfo FMPluginManager::GetPluginInfo(const QString &plugin_name, const QStri ...@@ -230,7 +230,14 @@ QFileInfo FMPluginManager::GetPluginInfo(const QString &plugin_name, const QStri
QString file_basename = file_info.completeBaseName(); QString file_basename = file_info.completeBaseName();
if (file_basename.startsWith("lib")) file_basename = file_basename.mid(3); if (file_basename.startsWith("lib")) file_basename = file_basename.mid(3);
QString tmp_ver = file_basename.section(plugin_file_name, 1, 1).replace("_", ""); QString tmp_ver = file_basename.section(plugin_file_name, 1, 1).replace("_", "");
if (plugin_version.isEmpty() || plugin_version < tmp_ver) { if (plugin_version.isEmpty()) {
plugin_version = tmp_ver;
plugin_file_info = file_info;
}
else if (plugin_version < tmp_ver) {
//! 删除旧版本
QFile::remove(plugin_file_info.absoluteFilePath());
plugin_version = tmp_ver; plugin_version = tmp_ver;
plugin_file_info = file_info; plugin_file_info = file_info;
} }
......
...@@ -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 10 #define VER_BUILD 28
//! Convert version numbers to string //! Convert version numbers to string
#define _STR(S) #S #define _STR(S) #S
......
...@@ -74,7 +74,6 @@ FMPHttpReplyPointer FMPNetworkPrivate::HttpGet(const FMPHttpRequest &r) ...@@ -74,7 +74,6 @@ FMPHttpReplyPointer FMPNetworkPrivate::HttpGet(const FMPHttpRequest &r)
req_timer[net_manager] = timer; req_timer[net_manager] = timer;
QNetworkReply* net_reply = net_manager->get(req); QNetworkReply* net_reply = net_manager->get(req);
connect(net_reply, SIGNAL(error(QNetworkReply::NetworkError)), SLOT(OnRequestError(int)));
connect(timer, SIGNAL(timeout()), SLOT(OnRequestTimeout())); connect(timer, SIGNAL(timeout()), SLOT(OnRequestTimeout()));
timer->start(r.timeout); timer->start(r.timeout);
...@@ -106,7 +105,6 @@ FMPHttpReplyPointer FMPNetworkPrivate::HttpPost(const FMPHttpRequest &req, const ...@@ -106,7 +105,6 @@ FMPHttpReplyPointer FMPNetworkPrivate::HttpPost(const FMPHttpRequest &req, const
req_timer[net_manager] = timer; req_timer[net_manager] = timer;
QNetworkReply* net_reply = net_manager->post(request, data); QNetworkReply* net_reply = net_manager->post(request, data);
connect(net_reply, SIGNAL(error(QNetworkReply::NetworkError)), SLOT(OnRequestError(QNetworkReply::NetworkError)));
connect(timer, SIGNAL(timeout()), SLOT(OnRequestTimeout())); connect(timer, SIGNAL(timeout()), SLOT(OnRequestTimeout()));
timer->start(req.timeout); timer->start(req.timeout);
...@@ -124,31 +122,17 @@ void FMPNetworkPrivate::OnRequestFinished(QNetworkReply *reply) ...@@ -124,31 +122,17 @@ void FMPNetworkPrivate::OnRequestFinished(QNetworkReply *reply)
{ {
QNetworkAccessManager *net_manager = reply->manager(); QNetworkAccessManager *net_manager = reply->manager();
FMPSockReplyPointer fmp_reply = req_map[net_manager]; if (req_map.contains(net_manager)) {
fmp_reply->SetResponse(reply->readAll()); FMPSockReplyPointer fmp_reply = req_map[net_manager];
fmp_reply->SetError(reply->error()); fmp_reply->SetResponse(reply->readAll());
fmp_reply->Finish(fmp_reply); fmp_reply->SetError(reply->error());
fmp_reply->Finish(fmp_reply);
req_map.take(net_manager);
QTimer *timer = req_timer.take(net_manager);
timer->deleteLater();
net_manager->deleteLater();
}
void FMPNetworkPrivate::OnRequestError(QNetworkReply::NetworkError err)
{
QNetworkReply *reply = qobject_cast<QNetworkReply*>(sender());
QNetworkAccessManager *net_manager = reply->manager(); req_map.take(net_manager);
FMPSockReplyPointer fmp_reply = req_map[net_manager]; QTimer *timer = req_timer.take(net_manager);
fmp_reply->SetError(err); timer->deleteLater();
fmp_reply->SetErrorString("Request timeout"); net_manager->deleteLater();
fmp_reply->Finish(fmp_reply); }
req_map.take(net_manager);
QTimer *timer = req_timer.take(net_manager);
timer->deleteLater();
net_manager->deleteLater();
} }
void FMPNetworkPrivate::OnRequestTimeout() void FMPNetworkPrivate::OnRequestTimeout()
......
...@@ -3,8 +3,6 @@ ...@@ -3,8 +3,6 @@
#include <QObject> #include <QObject>
#include "fmp_network_i.h" #include "fmp_network_i.h"
#include <QNetworkReply>
#include <QQueue>
class QTimer; class QTimer;
class FMPNetworkPrivate; class FMPNetworkPrivate;
...@@ -61,7 +59,6 @@ public: ...@@ -61,7 +59,6 @@ public:
public slots: public slots:
void OnRequestFinished(QNetworkReply* reply); void OnRequestFinished(QNetworkReply* reply);
void OnRequestError(QNetworkReply::NetworkError err);
void OnRequestTimeout(); void OnRequestTimeout();
protected: protected:
......
...@@ -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 13 #define VER_BUILD 28
//! Convert version numbers to string //! Convert version numbers to string
#define _STR(S) #S #define _STR(S) #S
......
...@@ -5,9 +5,10 @@ ...@@ -5,9 +5,10 @@
#define FMP_PROPKEY_PLUGINPATH "FMPPath" #define FMP_PROPKEY_PLUGINPATH "FMPPath"
#define FMP_PROPKEY_CFG "FMPConfig" #define FMP_PROPKEY_CFG "FMPConfig"
#define FMP_PROPKEY_ENTRY "FMPEntry" #define FMP_PROPKEY_ENTRY "FMPEntry"
#define FMP_PROPKEY_PID "PMPid" #define FMP_PROPKEY_PID "PMPPid"
#define FMP_PROPKEY_PID_LIST "FMPidList" #define FMP_PROPKEY_PID_LIST "FMPPidList"
#define FMP_PROPKEY_AGREED "FMPAgreed" #define FMP_PROPKEY_AGREED "FMPAgreed"
#define FMP_PROPKEY_PROCID "FMPProcId"
//! 配置文件 Key //! 配置文件 Key
#define FMP_INIKEY_SERVICENAME "Service/Name" #define FMP_INIKEY_SERVICENAME "Service/Name"
......
...@@ -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 13 #define VER_BUILD 28
//! Convert version numbers to string //! Convert version numbers to string
#define _STR(S) #S #define _STR(S) #S
......
...@@ -12,7 +12,9 @@ FMPSyncer::FMPSyncer(ctkPluginContext *ctx) ...@@ -12,7 +12,9 @@ FMPSyncer::FMPSyncer(ctkPluginContext *ctx)
_sync_interval(d_ptr->GetSyncInterval()), _sync_interval(d_ptr->GetSyncInterval()),
_req_timeout(d_ptr->GetRequestTimeout()), _req_timeout(d_ptr->GetRequestTimeout()),
_task_url(d_ptr->GetTaskUrl()), _task_url(d_ptr->GetTaskUrl()),
_task_report_url(d_ptr->GetTaskReportUrl()) _task_report_url(d_ptr->GetTaskReportUrl()),
_deploy_path(d_ptr->GetDeployPath()),
_download_path(d_ptr->GetDownloadPath())
{ {
StartService(); StartService();
...@@ -65,3 +67,13 @@ void FMPSyncer::SetTaskReportUrl(const QString &url) ...@@ -65,3 +67,13 @@ void FMPSyncer::SetTaskReportUrl(const QString &url)
{ {
d_func()->SetTaskReportUrl(url); d_func()->SetTaskReportUrl(url);
} }
void FMPSyncer::SetDownloadPath(const QString &path)
{
d_func()->SetDownloadPath(path);
}
void FMPSyncer::SetDeployPath(const QString &path)
{
d_func()->SetDeployPath(path);
}
...@@ -31,6 +31,8 @@ public: ...@@ -31,6 +31,8 @@ public:
int GetSyncInterval() const { return _sync_interval; } int GetSyncInterval() const { return _sync_interval; }
QString GetTaskUrl() const { return _task_url; } QString GetTaskUrl() const { return _task_url; }
QString GetTaskReportUrl() const { return _task_report_url; } QString GetTaskReportUrl() const { return _task_report_url; }
QString GetDownloadPath() const { return _download_path; }
QString GetDeployPath() const { return _deploy_path; }
void SetStoreId(const QString &id); void SetStoreId(const QString &id);
void SetPosId(const QString &id); void SetPosId(const QString &id);
...@@ -38,6 +40,8 @@ public: ...@@ -38,6 +40,8 @@ public:
void SetSyncInterval(int ms); void SetSyncInterval(int ms);
void SetTaskUrl(const QString &url); void SetTaskUrl(const QString &url);
void SetTaskReportUrl(const QString &url); void SetTaskReportUrl(const QString &url);
void SetDownloadPath(const QString &path);
void SetDeployPath(const QString &path);
private: private:
FMPSyncerPrivate *d_ptr; FMPSyncerPrivate *d_ptr;
...@@ -51,6 +55,8 @@ private: ...@@ -51,6 +55,8 @@ private:
QString _task_report_url; QString _task_report_url;
QString _upload_url; QString _upload_url;
QString _upload_report_url; QString _upload_report_url;
QString _download_path;
QString _deploy_path;
}; };
#endif // FMP_SYNCER_H #endif // FMP_SYNCER_H
...@@ -41,11 +41,15 @@ ...@@ -41,11 +41,15 @@
#define FMP_INIKEY_SYNCINTERVAL "Syncer/Interval" #define FMP_INIKEY_SYNCINTERVAL "Syncer/Interval"
#define FMP_INIKEY_SYNCTASKURL "Syncer/TaskUrl" #define FMP_INIKEY_SYNCTASKURL "Syncer/TaskUrl"
#define FMP_INIKEY_SYNCTASKRPTURL "Syncer/TaskReportUrl" #define FMP_INIKEY_SYNCTASKRPTURL "Syncer/TaskReportUrl"
#define FMP_INIKEY_DOWNLOADPATH "Syncer/DownloadPath"
#define FMP_INIKEY_DEPLOYPATH "Syncer/DeployPath"
#define FMP_INIKEY_SYNCHELPER "Syncer/FreemudSyncer"
#define FMPSYNC_DEFAULT_INTERVAL 60 #define FMPSYNC_DEFAULT_INTERVAL 60
#define FMPSYNC_DEFAULT_TASKURL "http://192.168.110.150:8080/api/fork/checkupdate" #define FMPSYNC_DEFAULT_TASKURL "http://192.168.110.150:8080/api/fork/checkupdate"
#define FMPSYNC_DEFAULT_TASKRPTURL "http://192.168.110.150:8080/api/fork/PosPlanState" #define FMPSYNC_DEFAULT_TASKRPTURL "http://192.168.110.150:8080/api/fork/PosPlanState"
#define FMPSYNC_DEFAULT_DOWNLOADPATH "download"
#define FMPSYNC_DEFAULT_DEPLOYPATH ".."
#define FMPNW_DEFAULT_TIMEOUT 30 #define FMPNW_DEFAULT_TIMEOUT 30
#define FMPCOMMON_DEFAULT_PARTNERID "1101" #define FMPCOMMON_DEFAULT_PARTNERID "1101"
#define FMPCOMMON_DEFAULT_STOREID "fm99999" #define FMPCOMMON_DEFAULT_STOREID "fm99999"
......
...@@ -51,6 +51,12 @@ public: ...@@ -51,6 +51,12 @@ public:
virtual QString GetTaskReportUrl() const = 0; virtual QString GetTaskReportUrl() const = 0;
virtual void SetTaskReportUrl(const QString &url) = 0; virtual void SetTaskReportUrl(const QString &url) = 0;
virtual QString GetDeployPath() const = 0;
virtual void SetDeployPath(const QString &url) = 0;
virtual QString GetDownloadPath() const = 0;
virtual void SetDownloadPath(const QString &path) = 0;
// /** // /**
// * @brief GetUploadReportUrl // * @brief GetUploadReportUrl
// * 获取汇报上传结果的URL // * 获取汇报上传结果的URL
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include <QTimer> #include <QTimer>
#include <QEventLoop> #include <QEventLoop>
#include <QCryptographicHash> #include <QCryptographicHash>
#include <QProcess>
#include "JlCompress.h" #include "JlCompress.h"
FMPSyncerPrivate::FMPSyncerPrivate(FMPSyncer *q) FMPSyncerPrivate::FMPSyncerPrivate(FMPSyncer *q)
...@@ -91,6 +92,16 @@ QString FMPSyncerPrivate::GetTaskReportUrl() ...@@ -91,6 +92,16 @@ QString FMPSyncerPrivate::GetTaskReportUrl()
return _GetValue(FMP_INIKEY_SYNCTASKRPTURL, FMPSYNC_DEFAULT_TASKRPTURL).toString(); return _GetValue(FMP_INIKEY_SYNCTASKRPTURL, FMPSYNC_DEFAULT_TASKRPTURL).toString();
} }
QString FMPSyncerPrivate::GetDownloadPath()
{
return _GetValue(FMP_INIKEY_DOWNLOADPATH, FMPSYNC_DEFAULT_DOWNLOADPATH).toString();
}
QString FMPSyncerPrivate::GetDeployPath()
{
return _GetValue(FMP_INIKEY_DEPLOYPATH, FMPSYNC_DEFAULT_DEPLOYPATH).toString();
}
void FMPSyncerPrivate::SetStoreId(const QString &id) void FMPSyncerPrivate::SetStoreId(const QString &id)
{ {
_SetValue(FMP_INIKEY_STOREID, id); _SetValue(FMP_INIKEY_STOREID, id);
...@@ -121,6 +132,16 @@ void FMPSyncerPrivate::SetTaskReportUrl(const QString &url) ...@@ -121,6 +132,16 @@ void FMPSyncerPrivate::SetTaskReportUrl(const QString &url)
_SetValue(FMP_INIKEY_SYNCTASKRPTURL, url); _SetValue(FMP_INIKEY_SYNCTASKRPTURL, url);
} }
void FMPSyncerPrivate::SetDownloadPath(const QString &path)
{
_SetValue(FMP_INIKEY_DOWNLOADPATH, path);
}
void FMPSyncerPrivate::SetDeployPath(const QString &path)
{
_SetValue(FMP_INIKEY_DEPLOYPATH, path);
}
QVariant FMPSyncerPrivate::_GetValue(const QString &k, QVariant default_val) QVariant FMPSyncerPrivate::_GetValue(const QString &k, QVariant default_val)
{ {
if (!_sets) { if (!_sets) {
...@@ -159,7 +180,12 @@ bool FMPSyncerPrivate::_SetValue(const QString &k, QVariant val) ...@@ -159,7 +180,12 @@ bool FMPSyncerPrivate::_SetValue(const QString &k, QVariant val)
void FMPSyncerPrivate::run() void FMPSyncerPrivate::run()
{ {
Q_Q(FMPSyncer); Q_Q(FMPSyncer);
_app_dir = QApplication::applicationDirPath(); if (QFileInfo(q->_deploy_path).isAbsolute()) {
_deploy_dir = q->_deploy_path;
}
else {
_deploy_dir = QApplication::applicationDirPath() + "/" + q->_deploy_path;
}
int sync_interval = q->_sync_interval; int sync_interval = q->_sync_interval;
QString task_id; QString task_id;
...@@ -182,6 +208,8 @@ void FMPSyncerPrivate::run() ...@@ -182,6 +208,8 @@ void FMPSyncerPrivate::run()
#ifdef QT_DEBUG #ifdef QT_DEBUG
//!TEST //!TEST
task_json["NeedUpdate"] = "yes";
task_json["UpdatePath"] = "http://192.168.110.150:8080/UpgradeFiles/1101";
task_json.insert("NeedUpload", "yes"); task_json.insert("NeedUpload", "yes");
task_json.insert("UploadFiles", "img/yb.jpg|img/dlb.jpg"); task_json.insert("UploadFiles", "img/yb.jpg|img/dlb.jpg");
//!TEST //!TEST
...@@ -213,14 +241,14 @@ void FMPSyncerPrivate::run() ...@@ -213,14 +241,14 @@ void FMPSyncerPrivate::run()
FMP_INFO(_logger) << QString("Download [%1] files successful").arg(latest_files.count()); FMP_INFO(_logger) << QString("Download [%1] files successful").arg(latest_files.count());
//! 记录升级任务编号 //! 记录升级任务编号
QFile planIdFile(QString("%1/download/planid.txt").arg(_app_dir)); QFile planIdFile(QString("%1/%2/planid.txt").arg(_deploy_dir).arg(q->_download_path));
if(planIdFile.open(QIODevice::WriteOnly)) { if(planIdFile.open(QIODevice::WriteOnly)) {
planIdFile.write(QString::number(task_json[FMP_JSONKEY_PLANID].toInt()).toLatin1()); planIdFile.write(QString::number(task_json[FMP_JSONKEY_PLANID].toInt()).toLatin1());
planIdFile.close(); planIdFile.close();
} }
//! 将需要替换的文件写入./download/dfilesInfo.txt //! 将需要替换的文件写入 dfilesInfo.txt
QFile file(QString("%1/download/dfilesInfo.txt").arg(_app_dir)); QFile file(QString("%1/%2/dfilesInfo.txt").arg(_deploy_dir).arg(q->_download_path));
if(file.open(QIODevice::WriteOnly)) { if(file.open(QIODevice::WriteOnly)) {
QTextStream stream(&file); QTextStream stream(&file);
foreach(QString f, downloaded_files) { foreach(QString f, downloaded_files) {
...@@ -229,9 +257,10 @@ void FMPSyncerPrivate::run() ...@@ -229,9 +257,10 @@ void FMPSyncerPrivate::run()
file.close(); file.close();
//! 通知升级已准备就绪 QString sync_helper = _GetValue(FMP_INIKEY_SYNCHELPER, "FreemudSyncer").toString();
FMP_INFO(_logger) << "Upgrade ready"; QStringList params;
emit UpgradeReady(); params << q->_ctx->getProperty(FMP_PROPKEY_PROCID).toString();
QProcess::startDetached(sync_helper, params);
} }
} }
else { else {
...@@ -250,15 +279,16 @@ void FMPSyncerPrivate::run() ...@@ -250,15 +279,16 @@ void FMPSyncerPrivate::run()
void FMPSyncerPrivate::ReportTask(const QString& tid, const QString& msg, const QString& state) void FMPSyncerPrivate::ReportTask(const QString& tid, const QString& msg, const QString& state)
{ {
QString task_id, task_msg, task_state; QString task_id, task_msg, task_state;
QFile resultFile(QString("%1/download/updateresult.txt").arg(_app_dir)); Q_Q(FMPSyncer);
QFile resultFile(QString("%1/%2/updateresult.txt").arg(_deploy_dir).arg(q->_download_path));
if(resultFile.exists() && tid.isEmpty()) { if(resultFile.exists() && tid.isEmpty()) {
if(tid.isEmpty()) { if(tid.isEmpty()) {
QFile file(QString("%1/download/planid.txt").arg(_app_dir)); QFile file(QString("%1/%2/planid.txt").arg(_deploy_dir).arg(q->_download_path));
if(file.open(QIODevice::ReadOnly)) { if(file.open(QIODevice::ReadOnly)) {
task_id = QString(file.readAll()); task_id = QString(file.readAll());
file.close(); file.close();
} }
file.setFileName(QString("%1/download/updateresult.txt").arg(_app_dir)); file.setFileName(QString("%1/%2/updateresult.txt").arg(_deploy_dir).arg(q->_download_path));
if(file.open(QIODevice::ReadOnly)) { if(file.open(QIODevice::ReadOnly)) {
QString readStr = file.readAll(); QString readStr = file.readAll();
task_state = readStr.mid(0, 1); task_state = readStr.mid(0, 1);
...@@ -351,7 +381,7 @@ bool FMPSyncerPrivate::UploadFiles(const QStringList &files) ...@@ -351,7 +381,7 @@ bool FMPSyncerPrivate::UploadFiles(const QStringList &files)
bool upload_success = false; bool upload_success = false;
QStringList uploaded_file; QStringList uploaded_file;
foreach(QString f, files) { foreach(QString f, files) {
QString file_path = QString("%1/%2").arg(_app_dir, f); QString file_path = QString("%1/%2").arg(_deploy_dir, f);
if(!JlCompress::compressFile(file_path + ".zip", file_path)) { if(!JlCompress::compressFile(file_path + ".zip", file_path)) {
FMP_ERROR(_logger) << QString("Compress file[%1] failed").arg(file_path); FMP_ERROR(_logger) << QString("Compress file[%1] failed").arg(file_path);
continue; continue;
...@@ -424,7 +454,7 @@ bool FMPSyncerPrivate::RetainLatestFiles(const QMap<QString, QString> &all_files ...@@ -424,7 +454,7 @@ bool FMPSyncerPrivate::RetainLatestFiles(const QMap<QString, QString> &all_files
{ {
QStringList keys = all_files.keys(); QStringList keys = all_files.keys();
foreach(QString k, keys) { foreach(QString k, keys) {
QFile file(QString("%1/%2").arg(_app_dir, k)); QFile file(QString("%1/%2").arg(_deploy_dir, k));
if(file.open(QFile::ReadOnly)) { if(file.open(QFile::ReadOnly)) {
QString local_md5 = QCryptographicHash::hash(file.readAll(),QCryptographicHash::Md5).toHex(); QString local_md5 = QCryptographicHash::hash(file.readAll(),QCryptographicHash::Md5).toHex();
if( local_md5 == all_files[k]) { if( local_md5 == all_files[k]) {
...@@ -448,7 +478,7 @@ QString FMPSyncerPrivate::GetFileMd5(const QString &file_path) ...@@ -448,7 +478,7 @@ QString FMPSyncerPrivate::GetFileMd5(const QString &file_path)
file.close(); file.close();
} }
else { else {
FMP_ERROR(_logger) << "Failed open file" << file_path << file.errorString(); FMP_INFO(_logger) << "Failed open file" << file_path << file.errorString();
} }
return md5; return md5;
...@@ -458,16 +488,22 @@ QStringList FMPSyncerPrivate::DownloadFiles(const QString &url, const QMap<QStri ...@@ -458,16 +488,22 @@ QStringList FMPSyncerPrivate::DownloadFiles(const QString &url, const QMap<QStri
{ {
QStringList keys = files.keys(); QStringList keys = files.keys();
QStringList downloaded_files; QStringList downloaded_files;
Q_Q(FMPSyncer);
foreach (QString k, keys) { foreach (QString k, keys) {
QString download_url = QString("%1/%2.zip").arg(url, k); QString download_url = QString("%1/%2.zip").arg(url, k);
QString save_path = QString("%1/download/%2.zip").arg(_app_dir, k); QString save_path = QString("%1/%2/%3.zip").arg(_deploy_dir, q->_download_path, k);
FMP_INFO(_logger) << QString("Start downloading file [%1]").arg(download_url); FMP_INFO(_logger) << QString("Start downloading file [%1]").arg(download_url);
//! 下载之前先检测文件是否下载过 //! 下载之前先检测文件是否下载过
if(GetFileMd5(save_path.left(save_path.lastIndexOf("."))) == files[k]) { QString local_md5 = GetFileMd5(save_path.left(save_path.lastIndexOf(".")));
if(local_md5 == files[k]) {
FMP_INFO(_logger) << "file exists"; FMP_INFO(_logger) << "file exists";
downloaded_files << k;
continue; continue;
} }
else {
FMP_WARN(_logger) << "Md5 not match, local:" << local_md5 << "remote:" << files[k];
}
//! 下载文件 //! 下载文件
QDir().mkpath(save_path.left(save_path.lastIndexOf("/"))); QDir().mkpath(save_path.left(save_path.lastIndexOf("/")));
...@@ -488,7 +524,7 @@ QStringList FMPSyncerPrivate::DownloadFiles(const QString &url, const QMap<QStri ...@@ -488,7 +524,7 @@ QStringList FMPSyncerPrivate::DownloadFiles(const QString &url, const QMap<QStri
JlCompress::extractDir(save_path, save_path.left(save_path.lastIndexOf("/"))); JlCompress::extractDir(save_path, save_path.left(save_path.lastIndexOf("/")));
//! 检查下载的文件MD5是否正确 //! 检查下载的文件MD5是否正确
QString local_md5 = GetFileMd5(save_path.left(save_path.lastIndexOf("."))); local_md5 = GetFileMd5(save_path.left(save_path.lastIndexOf(".")));
if(local_md5 != files[k]) { if(local_md5 != files[k]) {
FMP_ERROR(_logger) << "Md5 not match, local:" << local_md5 << "remote:" << files[k]; FMP_ERROR(_logger) << "Md5 not match, local:" << local_md5 << "remote:" << files[k];
} }
......
...@@ -35,6 +35,8 @@ public: ...@@ -35,6 +35,8 @@ public:
int GetSyncInterval(); int GetSyncInterval();
QString GetTaskUrl(); QString GetTaskUrl();
QString GetTaskReportUrl(); QString GetTaskReportUrl();
QString GetDownloadPath();
QString GetDeployPath();
void SetStoreId(const QString &id); void SetStoreId(const QString &id);
void SetPosId(const QString &id); void SetPosId(const QString &id);
...@@ -43,6 +45,8 @@ public: ...@@ -43,6 +45,8 @@ public:
void SetSyncInterval(int sec); void SetSyncInterval(int sec);
void SetTaskUrl(const QString &url); void SetTaskUrl(const QString &url);
void SetTaskReportUrl(const QString &url); void SetTaskReportUrl(const QString &url);
void SetDownloadPath(const QString &path);
void SetDeployPath(const QString &path);
private: private:
QVariant _GetValue(const QString& k, QVariant default_val); QVariant _GetValue(const QString& k, QVariant default_val);
...@@ -128,7 +132,7 @@ public: ...@@ -128,7 +132,7 @@ public:
FMPSettingsInterface *_sets; FMPSettingsInterface *_sets;
FMPNetworkInterface *_nw; FMPNetworkInterface *_nw;
QString _app_dir; //! 记录程序所在的目录 QString _deploy_dir; //! 记录程序所在的目录
}; };
#endif // FMP_SYNCER_P_H #endif // FMP_SYNCER_P_H
...@@ -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 13 #define VER_BUILD 28
//! Convert version numbers to string //! Convert version numbers to string
#define _STR(S) #S #define _STR(S) #S
......
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