Commit b1ddd768 by NitefullWind

Merge branch 'dev'

parents 9e475908 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);
}
...@@ -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;
......
...@@ -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")
......
...@@ -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);
} }
...@@ -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);
......
...@@ -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) {
...@@ -132,11 +138,9 @@ void FMPHomePrivate::onMenuBtnClicked(QString btnName) ...@@ -132,11 +138,9 @@ 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);
......
#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);
......
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