Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
fmPOS
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhenfei.zhang
fmPOS
Commits
d84037a3
Commit
d84037a3
authored
Jun 27, 2017
by
gujin.wang
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into tianfu
# Conflicts: # fmp_home
parents
d09eef87
3f7cfbe7
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
126 additions
and
231 deletions
+126
-231
FreemudPOS/FreemudPOS.pro
+8
-5
FreemudPOS/fm_pos_app.cpp
+19
-10
fmp_manager/fmp_manager.cpp
+3
-0
fmp_manager/version.h
+1
-1
include/application/fm_singleton.h
+95
-0
include/plugins/ctkPluginGeneratorAbstractExtension.h
+0
-75
include/plugins/ctkPluginGeneratorAbstractUiExtension.h
+0
-80
include/plugins/org_commontk_plugingenerator_core_Export.h
+0
-30
include/plugins/org_commontk_plugingenerator_ui_Export.h
+0
-30
No files found.
FreemudPOS/FreemudPOS.pro
View file @
d84037a3
include
(
"qtservice/src/qtservice.pri"
)
QT
+=
core
widgets
QT
+=
core
widgets
network
CONFIG
+=
c
++
11
TARGET
=
FreemudPOS
TEMPLATE
=
app
INCLUDEPATH
+=
$$
PWD
/../
include
/
interface
SOURCES
+=
\
fm_pos_app
.
cpp
INCLUDEPATH
+=
$$
PWD
/../
include
/
interface
\
CONFIG
(
debug
,
debug
|
release
)
{
DESTDIR
=
$$
PWD
/../
debug
/
bins
...
...
@@ -21,3 +18,9 @@ else {
win32
{
RC_FILE
+=
res
/
FreemudPOS
.
rc
}
HEADERS
+=
\
..
/
include
/
application
/
fm_singleton
.
h
SOURCES
+=
\
fm_pos_app
.
cpp
FreemudPOS/fm_pos_app.cpp
View file @
d84037a3
#
include
<
QApplication
>
#include <fmp_manager_i.h>
#
include
<
fmp_manager_i
.
h
>
#include <QDebug>
#include <QPluginLoader>
#include <QSettings>
...
...
@@ -14,16 +13,17 @@
#undef StartService
#endif
#include "../application/fm_singleton.h"
#include "../fmp_settings/fmp_settings_def.h"
class
FMPService
:
public
QtService
<
Q
Application
>
class
FMPService
:
public
QtService
<
FMSingle
Application
>
{
public
:
FMPService
(
int
argc
,
char
**
argv
,
const
QString
&
svcname
)
:
_starttype
(
0
),
_name
(
svcname
),
_setting
(
0
),
QtService
<
Q
Application
>
(
argc
,
argv
,
svcname
)
QtService
<
FMSingle
Application
>
(
argc
,
argv
,
svcname
)
{
createApplication
(
argc
,
argv
);
_setting
=
new
QSettings
(
qApp
->
applicationDirPath
()
+
"/"
+
qApp
->
applicationName
()
+
".ini"
,
QSettings
::
IniFormat
);
...
...
@@ -36,7 +36,12 @@ public:
setServiceDescription
(
_description
);
}
void
start
()
bool
isRunning
()
{
return
application
()
->
IsRunning
();
}
void
start
()
{
QString
manager_plugin_path
=
getPluginPath
(
"fmp.manager"
);
QPluginLoader
fmp_manager_plugin
(
manager_plugin_path
);
...
...
@@ -64,7 +69,7 @@ public:
}
}
QString
getPluginPath
(
const
QString
&
plugin_name
)
QString
getPluginPath
(
const
QString
&
plugin_name
)
{
QString
plugin_file_name
(
plugin_name
);
plugin_file_name
.
replace
(
"."
,
"_"
);
...
...
@@ -127,11 +132,15 @@ int main(int argc, char** argv)
FMPService
svc
(
argc
,
argv
,
svc_name
);
if
(
!
svc
.
isRunning
())
{
#if SERVICE
return
svc
->
exec
();
return
svc
->
exec
();
#else
svc
.
start
();
return
qApp
->
exec
();
svc
.
start
();
return
qApp
->
exec
();
#endif
}
else
{
return
0
;
}
}
fmp_manager/fmp_manager.cpp
View file @
d84037a3
...
...
@@ -29,6 +29,9 @@ void FMPluginManager::InitService()
{
if
(
_fw_factory
)
return
;
//! 每次启动前删除配置文件夹
QDir
(
qApp
->
applicationDirPath
()
+
"/configuration"
).
removeRecursively
();
_fw_factory
=
new
ctkPluginFrameworkFactory
(
_fw_props
);
_fw
=
_fw_factory
->
getFramework
();
...
...
fmp_manager/version.h
View file @
d84037a3
...
...
@@ -5,7 +5,7 @@
#define VER_MINOR 1
#define VER_REVISION 0
#define VER_BUILD
58
#define VER_BUILD
60
//! Convert version numbers to string
#define _STR(S) #S
...
...
include/application/fm_singleton.h
0 → 100644
View file @
d84037a3
#
ifndef
DSINGLEAPPLICATION_H
#define DSINGLEAPPLICATION_H
#include <QWidget>
#include <QFileInfo>
#include <QLocalSocket>
#include <QLocalServer>
#include <QApplication>
class
FMSingleApplication
:
public
QApplication
{
Q_OBJECT
public
:
explicit
FMSingleApplication
(
int
&
argc
,
char
**
argv
)
:
QApplication
(
argc
,
argv
),
widget
(
NULL
),
isRunning
(
false
),
localServer
(
NULL
)
{
//! 取应用程序名作为LocalServer的名字
serverName
=
QFileInfo
(
QCoreApplication
::
applicationFilePath
()).
fileName
();
InitLocalConnection
();
}
/** 功能:判断是否有实例在运行
* 返回:true有 false无
**/
bool
IsRunning
()
{
return
isRunning
;
}
/** 功能:设置主窗口句柄
* 参数:主窗口句柄
* 返回:NULL
**/
void
SetWidget
(
QWidget
*
w
)
{
widget
=
w
;
}
private
slots
:
//! 有新连接时触发
void
OnNewLocalConnection
()
{
ActivateWindow
();
}
private
:
//! 初始化本地连接
void
InitLocalConnection
()
{
isRunning
=
false
;
QLocalSocket
socket
;
socket
.
connectToServer
(
serverName
);
if
(
socket
.
waitForConnected
(
500
))
{
isRunning
=
true
;
return
;
}
//! 连接不上服务器,就创建一个
NewLocalServer
();
}
//! 创建服务端
void
NewLocalServer
()
{
localServer
=
new
QLocalServer
(
this
);
connect
(
localServer
,
SIGNAL
(
newConnection
()),
this
,
SLOT
(
OnNewLocalConnection
()));
if
(
!
localServer
->
listen
(
serverName
))
{
//! 此时监听失败,可能是程序崩溃时,残留进程服务导致的,移除之
if
(
localServer
->
serverError
()
==
QAbstractSocket
::
AddressInUseError
)
{
QLocalServer
::
removeServer
(
serverName
);
localServer
->
listen
(
serverName
);
//! 再次监听
}
}
}
//! 激活窗口
void
ActivateWindow
()
{
if
(
NULL
!=
widget
)
{
widget
->
show
();
widget
->
raise
();
widget
->
activateWindow
();
}
return
;
}
QWidget
*
widget
;
//! 主窗口句柄
bool
isRunning
;
//! 是否已经有实例在运行
QLocalServer
*
localServer
;
//! 本地socket Server
QString
serverName
;
//! 服务名称
};
#endif // DSINGLEAPPLICATION_H
include/plugins/ctkPluginGeneratorAbstractExtension.h
deleted
100644 → 0
View file @
d09eef87
/*=============================================================================
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.
=============================================================================*/
#ifndef CTKPLUGINGENERATORABSTRACTEXTENSION_H
#define CTKPLUGINGENERATORABSTRACTEXTENSION_H
#include <QObject>
#include <QHash>
#include <org_commontk_plugingenerator_core_Export.h>
class
ctkPluginGeneratorAbstractExtensionPrivate
;
class
ctkPluginGeneratorCodeModel
;
class
org_commontk_plugingenerator_core_EXPORT
ctkPluginGeneratorAbstractExtension
:
public
QObject
{
Q_OBJECT
public
:
ctkPluginGeneratorAbstractExtension
();
virtual
~
ctkPluginGeneratorAbstractExtension
();
//virtual void getCommandLineArgs() const = 0;
void
setParameter
(
const
QHash
<
QString
,
QVariant
>&
params
);
void
setParameter
(
const
QString
&
name
,
const
QVariant
&
value
);
QHash
<
QString
,
QVariant
>
getParameter
()
const
;
bool
isValid
()
const
;
void
validate
();
void
updateCodeModel
();
QString
getErrorMessage
()
const
;
ctkPluginGeneratorCodeModel
*
getCodeModel
()
const
;
Q_SIGNALS
:
void
errorMessageChanged
(
const
QString
&
);
protected
:
void
setErrorMessage
(
const
QString
&
errMsg
);
virtual
bool
verifyParameters
(
const
QHash
<
QString
,
QVariant
>&
params
)
=
0
;
virtual
void
updateCodeModel
(
const
QHash
<
QString
,
QVariant
>&
params
)
=
0
;
private
:
Q_DECLARE_PRIVATE
(
ctkPluginGeneratorAbstractExtension
)
const
QScopedPointer
<
ctkPluginGeneratorAbstractExtensionPrivate
>
d_ptr
;
};
#endif // CTKPLUGINGENERATORABSTRACTEXTENSION_H
include/plugins/ctkPluginGeneratorAbstractUiExtension.h
deleted
100644 → 0
View file @
d09eef87
/*=============================================================================
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.
=============================================================================*/
#ifndef CTKPLUGINGENERATORABSTRACTUIEXTENSION_H
#define CTKPLUGINGENERATORABSTRACTUIEXTENSION_H
#include <QObject>
#include <QIcon>
#include <ctkPluginGeneratorAbstractExtension.h>
#include <org_commontk_plugingenerator_ui_Export.h>
class
QWidget
;
class
ctkPluginGeneratorAbstractUiExtensionPrivate
;
class
org_commontk_plugingenerator_ui_EXPORT
ctkPluginGeneratorAbstractUiExtension
:
public
ctkPluginGeneratorAbstractExtension
{
Q_OBJECT
public
:
ctkPluginGeneratorAbstractUiExtension
();
virtual
~
ctkPluginGeneratorAbstractUiExtension
();
QWidget
*
getWidget
();
QString
getDescription
()
const
;
QString
getTitle
()
const
;
QString
getMessage
()
const
;
QIcon
getIcon
()
const
;
Q_SIGNALS
:
void
descriptionChanged
(
const
QString
&
);
void
titleChanged
(
const
QString
&
);
void
messageChanged
(
const
QString
&
);
void
iconChanged
(
const
QIcon
&
);
protected
:
virtual
QWidget
*
createWidget
()
=
0
;
void
setDescription
(
const
QString
&
description
);
void
setTitle
(
const
QString
&
title
);
void
setMessage
(
const
QString
&
msg
);
void
setIcon
(
const
QIcon
&
icon
);
private
:
Q_DECLARE_PRIVATE
(
ctkPluginGeneratorAbstractUiExtension
)
const
QScopedPointer
<
ctkPluginGeneratorAbstractUiExtensionPrivate
>
d_ptr
;
};
#endif // CTKPLUGINGENERATORABSTRACTUIEXTENSION_H
include/plugins/org_commontk_plugingenerator_core_Export.h
deleted
100644 → 0
View file @
d09eef87
// .NAME __org_commontk_plugingenerator_core_Export - manage Windows system differences
// .SECTION Description
// The __org_commontk_plugingenerator_core_Export captures some system differences between Unix
// and Windows operating systems.
#ifndef __org_commontk_plugingenerator_core_Export_h
#define __org_commontk_plugingenerator_core_Export_h
#include <QtGlobal>
#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
# if defined(org_commontk_plugingenerator_core_EXPORTS)
# define org_commontk_plugingenerator_core_EXPORT Q_DECL_EXPORT
# else
# define org_commontk_plugingenerator_core_EXPORT Q_DECL_IMPORT
# endif
#endif
#if !defined(org_commontk_plugingenerator_core_EXPORT)
//# if defined(CTK_SHARED)
# define org_commontk_plugingenerator_core_EXPORT Q_DECL_EXPORT
//# else
//# define org_commontk_plugingenerator_core_EXPORT
//# endif
#endif
#endif
include/plugins/org_commontk_plugingenerator_ui_Export.h
deleted
100644 → 0
View file @
d09eef87
// .NAME __org_commontk_plugingenerator_ui_Export - manage Windows system differences
// .SECTION Description
// The __org_commontk_plugingenerator_ui_Export captures some system differences between Unix
// and Windows operating systems.
#ifndef __org_commontk_plugingenerator_ui_Export_h
#define __org_commontk_plugingenerator_ui_Export_h
#include <QtGlobal>
#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
# if defined(org_commontk_plugingenerator_ui_EXPORTS)
# define org_commontk_plugingenerator_ui_EXPORT Q_DECL_EXPORT
# else
# define org_commontk_plugingenerator_ui_EXPORT Q_DECL_IMPORT
# endif
#endif
#if !defined(org_commontk_plugingenerator_ui_EXPORT)
//# if defined(CTK_SHARED)
# define org_commontk_plugingenerator_ui_EXPORT Q_DECL_EXPORT
//# else
//# define org_commontk_plugingenerator_ui_EXPORT
//# endif
#endif
#endif
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment