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
3abd1032
Commit
3abd1032
authored
Apr 11, 2017
by
NitefullWind
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1. 新增Toast通知接口。
parent
13c338a0
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
52 additions
and
18 deletions
+52
-18
fmp_home.cpp
+7
-0
fmp_home.h
+3
-0
fmp_home_i.h
+13
-0
fmp_home_navwindow.cpp
+5
-5
fmp_home_navwindow.h
+4
-2
fmp_home_p.cpp
+15
-11
fmp_home_p.h
+5
-0
No files found.
fmp_home.cpp
View file @
3abd1032
...
@@ -63,3 +63,10 @@ bool FMPHome::stopBlink(int blinkId)
...
@@ -63,3 +63,10 @@ bool FMPHome::stopBlink(int blinkId)
Q_D
(
FMPHome
);
Q_D
(
FMPHome
);
return
d
->
stopBlink
(
blinkId
);
return
d
->
stopBlink
(
blinkId
);
}
}
void
FMPHome
::
notification
(
const
QString
&
msg
,
const
QString
&
title
,
QSystemTrayIcon
::
MessageIcon
icon
,
int
mecs
)
{
Q_D
(
FMPHome
);
return
d
->
notification
(
msg
,
title
,
icon
,
mecs
);
}
fmp_home.h
View file @
3abd1032
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
#define FMP_HOME_H
#define FMP_HOME_H
#include <QObject>
#include <QObject>
#include <QSystemTrayIcon>
#include "fmp_home_i.h"
#include "fmp_home_i.h"
...
@@ -30,6 +31,8 @@ public:
...
@@ -30,6 +31,8 @@ public:
int
blink
(
FMPluginInterface
*
plugin
,
const
QString
&
image
);
int
blink
(
FMPluginInterface
*
plugin
,
const
QString
&
image
);
bool
stopBlink
(
int
blinkId
);
bool
stopBlink
(
int
blinkId
);
void
notification
(
const
QString
&
msg
,
const
QString
&
title
=
QString
::
fromLocal8Bit
(
FMP_APPNAME
),
QSystemTrayIcon
::
MessageIcon
icon
=
QSystemTrayIcon
::
Information
,
int
mecs
=
1000
);
private
:
private
:
FMPHomePrivate
*
d_ptr
;
FMPHomePrivate
*
d_ptr
;
...
...
fmp_home_i.h
View file @
3abd1032
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
#define FMP_HOME_I_H
#define FMP_HOME_I_H
#include <fmp_plugin_i.h>
#include <fmp_plugin_i.h>
#include <QSystemTrayIcon>
class
FMPHomeInterface
:
public
FMPluginInterface
class
FMPHomeInterface
:
public
FMPluginInterface
{
{
...
@@ -26,6 +27,18 @@ public:
...
@@ -26,6 +27,18 @@ public:
* @return bool 如果参数blinkId标识的闪烁不存在或已结束则返回false, 否则返回true
* @return bool 如果参数blinkId标识的闪烁不存在或已结束则返回false, 否则返回true
*/
*/
virtual
bool
stopBlink
(
int
blinkId
)
=
0
;
virtual
bool
stopBlink
(
int
blinkId
)
=
0
;
/**
* @brief notification
* 弹出一个Toast通知
* @param msg
* @param title
* @param icon
* @param mecs
*/
virtual
void
notification
(
const
QString
&
msg
,
const
QString
&
title
=
QString
::
fromLocal8Bit
(
FMP_APPNAME
),
QSystemTrayIcon
::
MessageIcon
icon
=
QSystemTrayIcon
::
Information
,
int
mecs
=
1000
)
=
0
;
};
};
Q_DECLARE_INTERFACE
(
FMPHomeInterface
,
"com.fmp.home"
)
Q_DECLARE_INTERFACE
(
FMPHomeInterface
,
"com.fmp.home"
)
...
...
fmp_home_navwindow.cpp
View file @
3abd1032
...
@@ -218,7 +218,7 @@ int NavWindow::addBlink(FMPluginInterface *plugin, const QString &image)
...
@@ -218,7 +218,7 @@ int NavWindow::addBlink(FMPluginInterface *plugin, const QString &image)
blink
();
blink
();
}
}
HOME
_DEBUG
()
<<
"Add blink: "
<<
blinkId
;
FMP
_DEBUG
()
<<
"Add blink: "
<<
blinkId
;
return
blinkId
;
return
blinkId
;
}
}
...
@@ -242,7 +242,7 @@ bool NavWindow::removeBlink(int blinkId)
...
@@ -242,7 +242,7 @@ bool NavWindow::removeBlink(int blinkId)
}
}
}
while
(
0
);
}
while
(
0
);
HOME
_DEBUG
()
<<
"Stop blink: "
<<
blinkId
<<
" isOk: "
<<
isOk
;
FMP
_DEBUG
()
<<
"Stop blink: "
<<
blinkId
<<
" isOk: "
<<
isOk
;
return
isOk
;
return
isOk
;
}
}
...
@@ -287,7 +287,7 @@ void NavWindow::blink()
...
@@ -287,7 +287,7 @@ void NavWindow::blink()
loop
.
exec
();
loop
.
exec
();
}
}
if
(
_blinkObjIdSet
.
contains
(
blinkObject
.
id
))
{
if
(
_blinkObjIdSet
.
contains
(
blinkObject
.
id
))
{
HOME
_DEBUG
()
<<
"Active blink plugin: "
<<
blinkObject
.
id
;
FMP
_DEBUG
()
<<
"Active blink plugin: "
<<
blinkObject
.
id
;
// 如果blinkObject.id还在set中,说明没有调用该闪烁的stop方法,可以发送激活插件信号
// 如果blinkObject.id还在set中,说明没有调用该闪烁的stop方法,可以发送激活插件信号
emit
pluginActived
(
blinkObject
.
plugin
);
emit
pluginActived
(
blinkObject
.
plugin
);
_blinkObjIdSet
.
remove
(
blinkObject
.
id
);
_blinkObjIdSet
.
remove
(
blinkObject
.
id
);
...
@@ -316,7 +316,7 @@ void NavWindow::onNavImageChanged()
...
@@ -316,7 +316,7 @@ void NavWindow::onNavImageChanged()
"border: none;}"
"border: none;}"
).
arg
(
_navImage
));
).
arg
(
_navImage
));
}
}
void
NavWindow
::
showMessage
(
const
QString
&
message
)
void
NavWindow
::
showMessage
(
const
QString
&
title
,
const
QString
&
msg
,
QSystemTrayIcon
::
MessageIcon
icon
,
int
mecs
)
{
{
_systemTrayIcon
->
showMessage
(
QString
::
fromLocal8Bit
(
FMP_APPNAME
),
message
);
_systemTrayIcon
->
showMessage
(
title
,
msg
,
icon
,
mecs
);
}
}
fmp_home_navwindow.h
View file @
3abd1032
...
@@ -7,6 +7,7 @@
...
@@ -7,6 +7,7 @@
#include <QSet>
#include <QSet>
#include <QString>
#include <QString>
#include <QFuture>
#include <QFuture>
#include <QSystemTrayIcon>
namespace
Ui
{
namespace
Ui
{
class
NavWindow
;
class
NavWindow
;
...
@@ -19,7 +20,6 @@ class QSequentialAnimationGroup;
...
@@ -19,7 +20,6 @@ class QSequentialAnimationGroup;
class
FMPSettingsInterface
;
class
FMPSettingsInterface
;
class
QStateMachine
;
class
QStateMachine
;
class
QState
;
class
QState
;
class
QSystemTrayIcon
;
class
FMPluginInterface
;
class
FMPluginInterface
;
/**
/**
...
@@ -76,7 +76,9 @@ public slots:
...
@@ -76,7 +76,9 @@ public slots:
* @brief showMessage
* @brief showMessage
* @param message
* @param message
*/
*/
void
showMessage
(
const
QString
&
message
);
void
showMessage
(
const
QString
&
title
,
const
QString
&
msg
,
QSystemTrayIcon
::
MessageIcon
icon
=
QSystemTrayIcon
::
Information
,
int
mecs
=
1000
);
signals
:
signals
:
void
menuBtnClicked
(
QString
btnName
);
void
menuBtnClicked
(
QString
btnName
);
...
...
fmp_home_p.cpp
View file @
3abd1032
...
@@ -19,6 +19,7 @@ FMPHomePrivate::FMPHomePrivate(FMPHome *q)
...
@@ -19,6 +19,7 @@ FMPHomePrivate::FMPHomePrivate(FMPHome *q)
_userName
(
""
),
_userName
(
""
),
_errorMsg
(
""
)
_errorMsg
(
""
)
{
{
FMPLoggerInterface
::
InitContext
(
q
->
_ctx
);
}
}
FMPHomePrivate
::~
FMPHomePrivate
()
FMPHomePrivate
::~
FMPHomePrivate
()
...
@@ -29,9 +30,8 @@ FMPHomePrivate::~FMPHomePrivate()
...
@@ -29,9 +30,8 @@ FMPHomePrivate::~FMPHomePrivate()
int
FMPHomePrivate
::
Init
()
int
FMPHomePrivate
::
Init
()
{
{
Q_Q
(
FMPHome
);
Q_Q
(
FMPHome
);
FMPLoggerInterface
*
logger
=
q
->
GetService
<
FMPLoggerInterface
>
(
q
->
_ctx
);
_settings
=
q
->
GetService
<
FMPSettingsInterface
>
(
q
->
_ctx
);
_settings
=
q
->
GetService
<
FMPSettingsInterface
>
(
q
->
_ctx
);
FMPHomeSettings
::
instance
()
->
init
(
_settings
,
logger
);
FMPHomeSettings
::
instance
()
->
init
(
_settings
);
_navWindow
=
new
NavWindow
;
_navWindow
=
new
NavWindow
;
...
@@ -62,7 +62,7 @@ int FMPHomePrivate::Uninit()
...
@@ -62,7 +62,7 @@ int FMPHomePrivate::Uninit()
void
FMPHomePrivate
::
StartPlugins
(
const
QVariantList
&
pids
)
void
FMPHomePrivate
::
StartPlugins
(
const
QVariantList
&
pids
)
{
{
HOME
_DEBUG
()
<<
pids
;
FMP
_DEBUG
()
<<
pids
;
}
}
int
FMPHomePrivate
::
login
()
int
FMPHomePrivate
::
login
()
...
@@ -103,6 +103,12 @@ bool FMPHomePrivate::stopBlink(int blinkId)
...
@@ -103,6 +103,12 @@ bool FMPHomePrivate::stopBlink(int blinkId)
return
_navWindow
->
removeBlink
(
blinkId
);
return
_navWindow
->
removeBlink
(
blinkId
);
}
}
void
FMPHomePrivate
::
notification
(
const
QString
&
msg
,
const
QString
&
title
,
QSystemTrayIcon
::
MessageIcon
icon
,
int
mecs
)
{
_navWindow
->
showMessage
(
title
,
msg
,
icon
,
mecs
);
}
void
FMPHomePrivate
::
onPluginActived
(
FMPBaseInterface
*
plugin
)
void
FMPHomePrivate
::
onPluginActived
(
FMPBaseInterface
*
plugin
)
{
{
if
(
plugin
!=
nullptr
)
{
if
(
plugin
!=
nullptr
)
{
...
@@ -113,10 +119,10 @@ void FMPHomePrivate::onPluginActived(FMPBaseInterface *plugin)
...
@@ -113,10 +119,10 @@ void FMPHomePrivate::onPluginActived(FMPBaseInterface *plugin)
void
FMPHomePrivate
::
onMenuBtnClicked
(
QString
btnName
)
void
FMPHomePrivate
::
onMenuBtnClicked
(
QString
btnName
)
{
{
Q_Q
(
FMPHome
);
Q_Q
(
FMPHome
);
FMP_DEBUG
_CTX
(
q
->
_ctx
)
<<
"Menu clicked: "
<<
btnName
;
FMP_DEBUG
(
)
<<
"Menu clicked: "
<<
btnName
;
if
(
btnName
==
"quit"
)
{
if
(
btnName
==
"quit"
)
{
FMP_DEBUG
_CTX
(
q
->
_ctx
)
<<
"Will Quit!"
;
FMP_DEBUG
(
)
<<
"Will Quit!"
;
q
->
PostEvent
(
FMP_TOPICS_QUIT
);
q
->
PostEvent
(
FMP_TOPICS_QUIT
);
return
;
return
;
}
}
...
@@ -132,16 +138,14 @@ void FMPHomePrivate::onMenuBtnClicked(QString btnName)
...
@@ -132,16 +138,14 @@ void FMPHomePrivate::onMenuBtnClicked(QString btnName)
e
->
StartService
();
e
->
StartService
();
}
else
if
(
btnName
==
"vip"
)
{
}
else
if
(
btnName
==
"vip"
)
{
FMPVipInterface
*
e
=
q
->
GetService
<
FMPVipInterface
>
(
q
->
_ctx
);
FMPVipInterface
*
e
=
q
->
GetService
<
FMPVipInterface
>
(
q
->
_ctx
);
if
(
e
->
StartService
()
==
FMP_SUCCESS
)
{
e
->
StartService
();
_navWindow
->
showMessage
(
QString
::
fromLocal8Bit
(
"[非码会员]已启动"
));
}
else
if
(
btnName
==
"takeout"
)
{
}
// FMPTakeoutInterface *e = q->GetService<FMPTakeoutInterface>(q->_ctx);
}
else
if
(
btnName
==
"takeaway"
)
{
// FMPTakeawayInterface *e = q->GetService<FMPTakeawayInterface>(q->_ctx);
// e->StartService();
// e->StartService();
}
else
if
(
btnName
==
"coupons"
)
{
}
else
if
(
btnName
==
"coupons"
)
{
// FMPVipInterface *e = q->GetService<FMPVipInterface>(q->_ctx);
// FMPVipInterface *e = q->GetService<FMPVipInterface>(q->_ctx);
// e->StartService();
// e->StartService();
}
else
if
(
btnName
==
"tool"
)
{
}
else
if
(
btnName
==
"tool"
)
{
HOME
_DEBUG
()
<<
"tool menu"
;
FMP
_DEBUG
()
<<
"tool menu"
;
}
}
}
}
fmp_home_p.h
View file @
3abd1032
#
ifndef
FMP_HOME_P_H
#
ifndef
FMP_HOME_P_H
#define FMP_HOME_P_H
#define FMP_HOME_P_H
#include <QSystemTrayIcon>
#include "fmp_home.h"
#include "fmp_home.h"
class
NavWindow
;
class
NavWindow
;
...
@@ -23,6 +25,9 @@ public:
...
@@ -23,6 +25,9 @@ public:
int
blink
(
FMPluginInterface
*
plugin
,
const
QString
&
image
);
int
blink
(
FMPluginInterface
*
plugin
,
const
QString
&
image
);
bool
stopBlink
(
int
blinkId
);
bool
stopBlink
(
int
blinkId
);
void
notification
(
const
QString
&
msg
,
const
QString
&
title
=
QString
::
fromLocal8Bit
(
FMP_APPNAME
),
QSystemTrayIcon
::
MessageIcon
icon
=
QSystemTrayIcon
::
Information
,
int
mecs
=
1000
);
public
slots
:
public
slots
:
void
onMenuBtnClicked
(
QString
btnName
);
void
onMenuBtnClicked
(
QString
btnName
);
void
onPluginActived
(
FMPBaseInterface
*
plugin
);
void
onPluginActived
(
FMPBaseInterface
*
plugin
);
...
...
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