Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
fmp_home
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
fmp_home
Commits
e32c00d4
Commit
e32c00d4
authored
Jul 28, 2017
by
guanghui.cui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
插件更新
parent
88ad1f82
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
65 additions
and
50 deletions
+65
-50
fmp_he_handlers.cpp
+7
-8
fmp_he_handlers.h
+3
-4
fmp_home.cpp
+3
-3
fmp_home.h
+5
-2
fmp_home_i.h
+6
-5
fmp_home_navwindow.cpp
+16
-10
fmp_home_navwindow.h
+1
-0
fmp_home_p.cpp
+22
-16
fmp_home_p.h
+1
-1
version.h
+1
-1
No files found.
fmp_he_handlers.cpp
View file @
e32c00d4
...
...
@@ -2,18 +2,17 @@
#include "fmp_he_handlers.h"
#include "fmp_home.h"
FMPHomeEventHandler
::
FMPHomeEventHandler
(
const
QString
&
topic
,
FMPHome
*
home
,
ctkPluginContext
*
ctx
)
FMPHomeEventHandler
::
FMPHomeEventHandler
(
const
QString
&
topic
,
FMPHome
*
home
)
:
_home
(
home
),
_topic
(
topic
),
_ctx
(
ctx
)
_topic
(
topic
)
{
FMPProps
props
;
props
[
ctkEventConstants
::
EVENT_TOPIC
]
=
_topic
;
_ctx
->
r
egisterService
<
ctkEventHandler
>
(
this
,
props
);
FMP
::
R
egisterService
<
ctkEventHandler
>
(
this
,
props
);
}
FMPStartEventHandler
::
FMPStartEventHandler
(
ctkPluginContext
*
ctx
,
FMPHome
*
home
)
:
FMPHomeEventHandler
(
FMP_TOPICS_SERVICES
FMPE_SERVICE_REQ_START
"/*"
,
home
,
ctx
)
FMPStartEventHandler
::
FMPStartEventHandler
(
FMPHome
*
home
)
:
FMPHomeEventHandler
(
FMP_TOPICS_SERVICES
FMPE_SERVICE_REQ_START
"/*"
,
home
)
{
// connect();
}
...
...
@@ -33,8 +32,8 @@ void FMPStartEventHandler::handleEvent(const ctkEvent &event)
}
}
FMPUpgradeAckEventHandler
::
FMPUpgradeAckEventHandler
(
ctkPluginContext
*
ctx
,
FMPHome
*
home
)
:
FMPHomeEventHandler
(
FMP_TOPICS_SERVICES
FMPE_SERVICE_REQ_UPDATE
"/*"
,
home
,
ctx
)
FMPUpgradeAckEventHandler
::
FMPUpgradeAckEventHandler
(
FMPHome
*
home
)
:
FMPHomeEventHandler
(
FMP_TOPICS_SERVICES
FMPE_SERVICE_REQ_UPDATE
"/*"
,
home
)
{
}
...
...
fmp_he_handlers.h
View file @
e32c00d4
...
...
@@ -12,25 +12,24 @@ class FMPHomeEventHandler : public QObject, public ctkEventHandler
Q_OBJECT
Q_INTERFACES
(
ctkEventHandler
)
public
:
explicit
FMPHomeEventHandler
(
const
QString
&
topic
,
FMPHome
*
home
,
ctkPluginContext
*
ctx
);
explicit
FMPHomeEventHandler
(
const
QString
&
topic
,
FMPHome
*
home
);
protected
:
FMPHome
*
_home
;
const
QString
_topic
;
ctkPluginContext
*
_ctx
;
};
class
FMPStartEventHandler
:
public
FMPHomeEventHandler
{
public
:
explicit
FMPStartEventHandler
(
ctkPluginContext
*
ctx
,
FMPHome
*
home
);
explicit
FMPStartEventHandler
(
FMPHome
*
home
);
void
handleEvent
(
const
ctkEvent
&
event
);
};
class
FMPUpgradeAckEventHandler
:
FMPHomeEventHandler
{
public
:
explicit
FMPUpgradeAckEventHandler
(
ctkPluginContext
*
ctx
,
FMPHome
*
home
);
explicit
FMPUpgradeAckEventHandler
(
FMPHome
*
home
);
void
handleEvent
(
const
ctkEvent
&
event
);
};
...
...
fmp_home.cpp
View file @
e32c00d4
#
include
"fmp_home_p.h"
#include <QVariant>
#include <ctkPluginContext.h>
FMPHome
::
FMPHome
(
ctkPluginContext
*
context
)
:
FMPHomeInterface
(
context
),
FMPHome
::
FMPHome
(
const
FMPContext
ctx
)
:
FMPHomeInterface
(),
pluginContext
(
ctx
),
d_ptr
(
new
FMPHomePrivate
(
this
)),
_inited
(
false
)
{
...
...
fmp_home.h
View file @
e32c00d4
...
...
@@ -6,7 +6,6 @@
#include "fmp_home_i.h"
class
ctkPluginContext
;
class
FMPHomePrivate
;
class
FMPStartEventHandler
;
...
...
@@ -18,7 +17,7 @@ class FMPHome : public FMPHomeInterface
Q_INTERFACES
(
FMPHomeInterface
)
Q_DECLARE_PRIVATE
(
FMPHome
)
public
:
explicit
FMPHome
(
c
tkPluginContext
*
context
);
explicit
FMPHome
(
c
onst
FMPContext
ctx
);
virtual
~
FMPHome
();
int
login
();
...
...
@@ -31,12 +30,16 @@ public:
void
notification
(
const
QString
&
msg
,
const
QString
&
title
=
QString
::
fromLocal8Bit
(
FMP_APPNAME
),
QSystemTrayIcon
::
MessageIcon
icon
=
QSystemTrayIcon
::
Information
,
int
mecs
=
1000
);
protected
:
const
FMPContext
GetContext
()
const
{
return
pluginContext
;
}
protected
slots
:
virtual
void
InitService
();
virtual
void
UninitService
();
private
:
friend
class
FMPStartEventHandler
;
const
FMPContext
pluginContext
;
FMPHomePrivate
*
d_ptr
;
bool
_inited
;
};
...
...
fmp_home_i.h
View file @
e32c00d4
...
...
@@ -12,14 +12,11 @@ class FMPHomeInterface : public QObject, public FMPluginInterface
Q_INTERFACES
(
FMPBaseInterface
)
Q_INTERFACES
(
FMPluginInterface
)
public
:
explicit
FMPHomeInterface
(
ctkPluginContext
*
ctx
)
:
FMPluginInterface
(
ctx
)
explicit
FMPHomeInterface
(
)
:
FMPluginInterface
(
)
{
connect
(
this
,
&
FMPHomeInterface
::
TriggerInit
,
this
,
&
FMPHomeInterface
::
OnTriggerInit
);
connect
(
this
,
&
FMPHomeInterface
::
TriggerUninit
,
this
,
&
FMPHomeInterface
::
OnTriggerUninit
);
}
virtual
int
login
()
=
0
;
virtual
bool
isLogined
()
=
0
;
virtual
QString
userName
()
=
0
;
/**
* Entry 插件不需要请求启动,直接执行 StartService 启动
...
...
@@ -34,6 +31,10 @@ public:
return
FMP_SUCCESS
;
}
virtual
int
login
()
=
0
;
virtual
bool
isLogined
()
=
0
;
virtual
QString
userName
()
=
0
;
/**
* @brief blink
* 在导航窗口中闪烁某张图片,并在下次点击导航窗口时唤起传入的插件
...
...
@@ -71,6 +72,6 @@ protected slots:
void
OnTriggerUninit
()
{
FMPluginInterface
::
OnTriggerUninit
();
}
};
Q_DECLARE_INTERFACE
(
FMPHomeInterface
,
"
com.
fmp.home"
)
Q_DECLARE_INTERFACE
(
FMPHomeInterface
,
"fmp.home"
)
#endif // FMP_HOME_I_H
fmp_home_navwindow.cpp
View file @
e32c00d4
...
...
@@ -30,11 +30,11 @@ NavWindow::NavWindow(QWidget *parent) :
connect
(
this
,
SIGNAL
(
startBlink
()),
ui
->
navMainBtn
,
SLOT
(
start
()));
connect
(
this
,
SIGNAL
(
stopBlink
()),
ui
->
navMainBtn
,
SLOT
(
stop
()));
btns
.
push_back
(
std
::
make_pair
(
"payment"
,
QString
::
fromLocal8Bit
(
"非码支付"
)));
btns
.
push_back
(
std
::
make_pair
(
"vip"
,
QString
::
fromLocal8Bit
(
"非码会员"
)));
btns
.
push_back
(
std
::
make_pair
(
"takeout"
,
QString
::
fromLocal8Bit
(
"非码外卖"
)));
btns
.
push_back
(
std
::
make_pair
(
"coupons"
,
QString
::
fromLocal8Bit
(
"码多多"
)));
btns
.
push_back
(
std
::
make_pair
(
"tool"
,
QString
::
fromLocal8Bit
(
"设置"
)));
//
btns.push_back(std::make_pair("payment", QString::fromLocal8Bit("非码支付")));
//
btns.push_back(std::make_pair("vip", QString::fromLocal8Bit("非码会员")));
//
btns.push_back(std::make_pair("takeout", QString::fromLocal8Bit("非码外卖")));
//
btns.push_back(std::make_pair("coupons", QString::fromLocal8Bit("码多多")));
//
btns.push_back(std::make_pair("tool", QString::fromLocal8Bit("设置")));
MenuUiProp
.
distance
=
100
;
MenuUiProp
.
beginAngle
=
-
(
PI
/
2
);
...
...
@@ -46,7 +46,7 @@ NavWindow::NavWindow(QWidget *parent) :
this
->
setWindowFlags
(
windowFlags
()
|
Qt
::
FramelessWindowHint
|
Qt
::
WindowStaysOnTopHint
|
Qt
::
Tool
);
connect
(
_btn_group
,
SIGNAL
(
buttonClicked
(
QAbstractButton
*
)),
this
,
SLOT
(
onMenuBtnClicked
(
QAbstractButton
*
)));
//
initMenu();
initMenu
();
initSystemTrayIcon
();
...
...
@@ -65,6 +65,7 @@ NavWindow::NavWindow(QWidget *parent) :
this
->
move
(
pos
);
connect
(
ui
->
navMainBtn
,
SIGNAL
(
moved
(
QPoint
)),
this
,
SLOT
(
onMoved
(
QPoint
)));
// connect(ui->navMainBtn, SIGNAL(clicked(bool)), this, SLOT(onOnlyPayment()));
connect
(
this
,
SIGNAL
(
navImageChanged
()),
this
,
SLOT
(
onNavImageChanged
()));
}
...
...
@@ -152,10 +153,10 @@ void NavWindow::initMenu()
_centerPoint
=
QPoint
(
centerX
,
centerY
);
_centerGeometry
=
QRect
(
centerX
-
MenuUiProp
.
btnWidth
/
2
,
centerY
-
MenuUiProp
.
btnWidth
/
2
,
MenuUiProp
.
btnWidth
,
MenuUiProp
.
btnWidth
);
//
for(int i=0; i<btns.size(); i++) {
//
std::pair<QString, QString> btnP = btns.at(i);
//
createMenuBtn(btnP.first, btnP.second);
//
}
for
(
int
i
=
0
;
i
<
btns
.
size
();
i
++
)
{
std
::
pair
<
QString
,
QString
>
btnP
=
btns
.
at
(
i
);
createMenuBtn
(
btnP
.
first
,
btnP
.
second
);
}
}
void
NavWindow
::
createMenuBtn
(
const
QString
&
btnName
,
const
QString
&
showName
)
...
...
@@ -342,3 +343,8 @@ void NavWindow::showMessage(const QString &title, const QString &msg, QSystemTra
{
_systemTrayIcon
->
showMessage
(
title
,
msg
,
icon
,
mecs
);
}
void
NavWindow
::
onOnlyPayment
()
{
emit
menuBtnClicked
(
"payment"
);
}
fmp_home_navwindow.h
View file @
e32c00d4
...
...
@@ -108,6 +108,7 @@ private slots:
void
onMenuBtnClicked
(
QAbstractButton
*
);
void
onMoved
(
QPoint
point
);
void
onNavImageChanged
();
void
onOnlyPayment
();
//针对只有支付功能 点击悬浮按钮直接弹出收银窗口
private
:
Ui
::
NavWindow
*
ui
;
...
...
fmp_home_p.cpp
View file @
e32c00d4
#
include
"fmp_home_p.h"
#include "fmp_home_navwindow.h"
#include <fmp_logger_i.h>
#include <ctkPluginContext.h>
#include <ctkServiceReference.h>
#include <QDebug>
#include <fmp_epay_i.h>
...
...
@@ -12,6 +11,8 @@
#include "fmp_login.h"
#include "fmp_he_handlers.h"
#include "fmp_home_settings.h"
#include <QTimer>
#include <QEventLoop>
FMPHomePrivate
::
FMPHomePrivate
(
FMPHome
*
q
)
:
q_ptr
(
q
),
...
...
@@ -20,7 +21,6 @@ FMPHomePrivate::FMPHomePrivate(FMPHome *q)
_userName
(
""
),
_errorMsg
(
""
)
{
FMPLoggerInterface
::
InitContext
(
q
->
_ctx
);
}
FMPHomePrivate
::~
FMPHomePrivate
()
...
...
@@ -31,21 +31,21 @@ FMPHomePrivate::~FMPHomePrivate()
int
FMPHomePrivate
::
Init
()
{
Q_Q
(
FMPHome
);
_settings
=
q
->
GetService
<
FMPSettingsInterface
>
(
q
->
_ctx
);
FMPHomeSettings
::
instance
()
->
init
(
_
settings
);
settings
=
FMP
::
GetService
<
FMPSettingsInterface
>
(
);
FMPHomeSettings
::
instance
()
->
init
(
settings
);
FMPStartEventHandler
*
handler
=
new
FMPStartEventHandler
(
q
->
_ctx
,
q
);
FMPStartEventHandler
*
handler
=
new
FMPStartEventHandler
(
q
);
_navWindow
=
new
NavWindow
;
std
::
vector
<
FMPBaseInterface
*>
svcVector
;
svcVector
.
push_back
(
q
->
GetService
<
FMPVipInterface
>
(
q
->
_ctx
));
svcVector
.
push_back
(
q
->
GetService
<
FMPePayInterface
>
(
q
->
_ctx
));
svcVector
.
push_back
(
FMP
::
GetService
<
FMPVipInterface
>
(
));
svcVector
.
push_back
(
FMP
::
GetService
<
FMPePayInterface
>
(
));
//
_navWindow->createMenuBtn("payment", QString::fromLocal8Bit("非码支付"));
_navWindow
->
createMenuBtn
(
"payment"
,
QString
::
fromLocal8Bit
(
"非码支付"
));
// _navWindow->createMenuBtn("vip", QString::fromLocal8Bit("非码会员"));
//
_navWindow->createMenuBtn("takeout", QString::fromLocal8Bit("非码外卖"));
_navWindow
->
createMenuBtn
(
"takeout"
,
QString
::
fromLocal8Bit
(
"非码外卖"
));
// _navWindow->createMenuBtn("coupons", QString::fromLocal8Bit("码多多"));
//
_navWindow->createMenuBtn("tool", QString::fromLocal8Bit("设置"));
//
_navWindow->createMenuBtn("tool", QString::fromLocal8Bit("设置"));
_navWindow
->
show
();
connect
(
_navWindow
,
SIGNAL
(
menuBtnClicked
(
QString
)),
this
,
SLOT
(
onMenuBtnClicked
(
QString
)));
...
...
@@ -54,11 +54,17 @@ int FMPHomePrivate::Init()
login
();
// 启动会员
FMPBaseInterface
*
svc
=
q
->
GetService
<
FMPVipInterface
>
(
q
->
_ctx
);
FMPBaseInterface
*
svc
=
FMP
::
GetService
<
FMPVipInterface
>
(
);
if
(
svc
)
{
svc
->
StartService
();
}
//启动外卖
FMPBaseInterface
*
svcTakeout
=
FMP
::
GetService
<
FMPTakeoutInterface
>
();
if
(
svcTakeout
)
{
svcTakeout
->
StartService
();
}
q
->
_inited
=
true
;
return
FMP_SUCCESS
;
}
...
...
@@ -148,19 +154,19 @@ void FMPHomePrivate::onMenuBtnClicked(QString btnName)
}
}
FMPBaseInterface
*
svc
=
0
;
FMPBaseInterface
*
svc
=
nullptr
;
if
(
btnName
==
"payment"
)
{
svc
=
q
->
GetService
<
FMPePayInterface
>
(
q
->
_ctx
);
svc
=
FMP
::
GetService
<
FMPePayInterface
>
(
);
}
else
if
(
btnName
==
"vip"
)
{
svc
=
q
->
GetService
<
FMPVipInterface
>
(
q
->
_ctx
);
svc
=
FMP
::
GetService
<
FMPVipInterface
>
(
);
// q->blink((FMPluginInterface*)svc, ":/image/float_remind.png");
}
else
if
(
btnName
==
"takeout"
)
{
svc
=
q
->
GetService
<
FMPTakeoutInterface
>
(
q
->
_ctx
);
svc
=
FMP
::
GetService
<
FMPTakeoutInterface
>
(
);
}
else
if
(
btnName
==
"coupons"
)
{
// FMPVipInterface *e = q->GetService<FMPVipInterface>(q->_ctx);
// e->StartService();
}
else
if
(
btnName
==
"tool"
)
{
svc
=
q
->
GetService
<
FMPSettingsInterface
>
(
q
->
_ctx
);
svc
=
FMP
::
GetService
<
FMPSettingsInterface
>
(
);
}
if
(
svc
)
{
...
...
fmp_home_p.h
View file @
e32c00d4
...
...
@@ -42,7 +42,7 @@ public:
private
:
NavWindow
*
_navWindow
;
FMPSettingsInterface
*
_
settings
;
FMPSettingsInterface
*
settings
;
bool
_isLogining
;
};
...
...
version.h
View file @
e32c00d4
...
...
@@ -5,7 +5,7 @@
#define VER_MINOR 1
#define VER_REVISION 0
#define VER_BUILD 1
7
#define VER_BUILD 1
9
//! Convert version numbers to string
#define _STR(S) #S
...
...
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