Commit 4589e123 by NitefullWind

1.登录窗口按回车进行登录。 2. 登录窗口显示图标。 3. 动画开关配置项变更为 Plugin/Animation。 4. 菜单 Tooltip 显示宏定义信息。 5. 按钮设置手型指针。 等。

parent 2e50725e
...@@ -27,6 +27,9 @@ NavWindow::NavWindow(QWidget *parent) : ...@@ -27,6 +27,9 @@ NavWindow::NavWindow(QWidget *parent) :
ui->navMainBtn->setMovedItem(this); ui->navMainBtn->setMovedItem(this);
btns.push_back(std::make_pair("payment", 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("takeaway", 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("tool", QString::fromLocal8Bit("设置")));
MenuUiProp.distance = 100; MenuUiProp.distance = 100;
...@@ -137,6 +140,7 @@ void NavWindow::initMenu() ...@@ -137,6 +140,7 @@ void NavWindow::initMenu()
}); });
actions << action; actions << action;
auto btn = new QPushButton(this); auto btn = new QPushButton(this);
btn->setCursor(QCursor(Qt::PointingHandCursor));
btn->addAction(action); btn->addAction(action);
double angle = MenuUiProp.beginAngle + jianGe*i; double angle = MenuUiProp.beginAngle + jianGe*i;
...@@ -175,11 +179,11 @@ void NavWindow::initSystemTrayIcon() ...@@ -175,11 +179,11 @@ void NavWindow::initSystemTrayIcon()
{ {
QIcon icon(":fm-icon_tray"); QIcon icon(":fm-icon_tray");
_systemTrayIcon->setIcon(icon); _systemTrayIcon->setIcon(icon);
_systemTrayIcon->setToolTip(qApp->applicationName()); _systemTrayIcon->setToolTip(QString::fromLocal8Bit(FMP_APPNAME));
auto quitAction = new QAction(QString::fromLocal8Bit("退出"), this); auto quitAction = new QAction(QString::fromLocal8Bit("退出"), this);
connect(quitAction, &QAction::triggered, this, [&](){ connect(quitAction, &QAction::triggered, this, [&](){
// _systemTrayIcon->hide(); _systemTrayIcon->hide();
emit menuBtnClicked("quit"); emit menuBtnClicked("quit");
}); });
auto menus = new QMenu(this); auto menus = new QMenu(this);
...@@ -312,3 +316,7 @@ void NavWindow::onNavImageChanged() ...@@ -312,3 +316,7 @@ void NavWindow::onNavImageChanged()
"border: none;}" "border: none;}"
).arg(_navImage)); ).arg(_navImage));
} }
void NavWindow::showMessage(const QString &message)
{
_systemTrayIcon->showMessage(QString::fromLocal8Bit(FMP_APPNAME), message);
}
...@@ -72,6 +72,11 @@ public slots: ...@@ -72,6 +72,11 @@ public slots:
*/ */
bool removeBlink(int blinkId); bool removeBlink(int blinkId);
/**
* @brief showMessage
* @param message
*/
void showMessage(const QString &message);
signals: signals:
void menuBtnClicked(QString btnName); void menuBtnClicked(QString btnName);
......
...@@ -40,10 +40,22 @@ QPushButton:hover { ...@@ -40,10 +40,22 @@ QPushButton:hover {
border-image: url(:payment_onclick); border-image: url(:payment_onclick);
} }
#vip { #vip {
border-image: url(:member02); border-image: url(:vip);
} }
#vip:pressed { #vip:pressed {
border-image: url(:member02_onclick); border-image: url(:vip_onclick);
}
#takeaway {
border-image: url(:takeaway);
}
#takeaway:pressed {
border-image: url(:takeaway_onclick);
}
#coupons {
border-image: url(:coupons);
}
#coupons:pressed {
border-image: url(:coupons_onclick);
}</string> }</string>
</property> </property>
<widget class="MenuButton" name="navMainBtn" native="true"> <widget class="MenuButton" name="navMainBtn" native="true">
...@@ -55,6 +67,9 @@ QPushButton:hover { ...@@ -55,6 +67,9 @@ QPushButton:hover {
<height>124</height> <height>124</height>
</rect> </rect>
</property> </property>
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="styleSheet"> <property name="styleSheet">
<string notr="true"/> <string notr="true"/>
</property> </property>
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include <ctkServiceReference.h> #include <ctkServiceReference.h>
#include <QDebug> #include <QDebug>
#include <fmp_epay_i.h> #include <fmp_epay_i.h>
//#include <fmp_vip_i.h>
#include <fmp_settings_i.h> #include <fmp_settings_i.h>
#include <QApplication> #include <QApplication>
#include "fmp_login.h" #include "fmp_login.h"
...@@ -14,6 +15,7 @@ ...@@ -14,6 +15,7 @@
FMPHomePrivate::FMPHomePrivate(FMPHome *q) FMPHomePrivate::FMPHomePrivate(FMPHome *q)
: q_ptr(q), : q_ptr(q),
_isLogined(false), _isLogined(false),
_isLogining(false),
_userName(""), _userName(""),
_errorMsg("") _errorMsg("")
{ {
...@@ -65,8 +67,14 @@ void FMPHomePrivate::StartPlugins(const QVariantList &pids) ...@@ -65,8 +67,14 @@ void FMPHomePrivate::StartPlugins(const QVariantList &pids)
int FMPHomePrivate::login() int FMPHomePrivate::login()
{ {
if(_isLogining) {
return FMP_FAILURE;
}
_isLogining = true;
#if 1
FMPLogin loginWnd; FMPLogin loginWnd;
loginWnd.exec(); loginWnd.exec();
_isLogining = false;
if(loginWnd.isLogined()) { if(loginWnd.isLogined()) {
_isLogined = true; _isLogined = true;
_userName = loginWnd.userName(); _userName = loginWnd.userName();
...@@ -75,6 +83,12 @@ int FMPHomePrivate::login() ...@@ -75,6 +83,12 @@ int FMPHomePrivate::login()
_isLogined = false; _isLogined = false;
return FMP_FAILURE; return FMP_FAILURE;
} }
#else
_isLogining = false;
_isLogined = true;
_userName = "";
return FMP_SUCCESS;
#endif
} }
int FMPHomePrivate::blink(FMPluginInterface *plugin, const QString &image) int FMPHomePrivate::blink(FMPluginInterface *plugin, const QString &image)
...@@ -116,6 +130,17 @@ void FMPHomePrivate::onMenuBtnClicked(QString btnName) ...@@ -116,6 +130,17 @@ void FMPHomePrivate::onMenuBtnClicked(QString btnName)
if(btnName == "payment") { if(btnName == "payment") {
FMPePayInterface *e = q->GetService<FMPePayInterface>(q->_ctx); FMPePayInterface *e = q->GetService<FMPePayInterface>(q->_ctx);
e->StartService(); e->StartService();
} else if(btnName == "vip") {
// FMPVipInterface *e = q->GetService<FMPVipInterface>(q->_ctx);
// if(e->StartService() == FMP_SUCCESS) {
// _navWindow->showMessage(QString::fromLocal8Bit("[非码会员]已启动"));
// }
} else if(btnName == "takeaway") {
// FMPTakeawayInterface *e = q->GetService<FMPTakeawayInterface>(q->_ctx);
// e->StartService();
} else if(btnName == "coupons") {
// FMPVipInterface *e = q->GetService<FMPVipInterface>(q->_ctx);
// e->StartService();
} else if(btnName == "tool") { } else if(btnName == "tool") {
HOME_DEBUG() << "tool menu"; HOME_DEBUG() << "tool menu";
} }
......
...@@ -37,6 +37,8 @@ public: ...@@ -37,6 +37,8 @@ public:
private: private:
NavWindow *_navWindow; NavWindow *_navWindow;
FMPSettingsInterface *_settings; FMPSettingsInterface *_settings;
bool _isLogining;
}; };
#endif // FMP_HOME_P_H #endif // FMP_HOME_P_H
...@@ -25,12 +25,12 @@ FMPLoggerInterface *FMPHomeSettings::getLogger() ...@@ -25,12 +25,12 @@ FMPLoggerInterface *FMPHomeSettings::getLogger()
bool FMPHomeSettings::getIsUseAnimation() bool FMPHomeSettings::getIsUseAnimation()
{ {
return _GetValue(FMP_INIKEY_HOMEANIMATION).toBool(); return _GetValue(FMP_INIKEY_ANIMATION).toBool();
} }
bool FMPHomeSettings::setIsUseAnimation(bool isUse) bool FMPHomeSettings::setIsUseAnimation(bool isUse)
{ {
return _SetValue(FMP_INIKEY_HOMEANIMATION, isUse); return _SetValue(FMP_INIKEY_ANIMATION, isUse);
} }
QPoint FMPHomeSettings::getWindowPosition() QPoint FMPHomeSettings::getWindowPosition()
......
...@@ -16,11 +16,14 @@ FMPLogin::FMPLogin(QDialog *parent) : ...@@ -16,11 +16,14 @@ FMPLogin::FMPLogin(QDialog *parent) :
_errorMsg("") _errorMsg("")
{ {
ui->setupUi(this); ui->setupUi(this);
connect(ui->numpad, SIGNAL(digit_confirm()), this, SLOT(on_login_btn_clicked())); // connect(ui->numpad, SIGNAL(digit_confirm()), this, SLOT(on_login_btn_clicked()));
// connect(qApp, &QApplication::focusChanged, this, &FMPLogin::onFocusChanged);
connect(qApp, &QApplication::focusChanged, this, &FMPLogin::onFocusChanged);
setAttribute(Qt::WA_QuitOnClose, false); setAttribute(Qt::WA_QuitOnClose, false);
setWindowIcon(QIcon(":fm-icon_tray"));
ui->logo_label->setText(QString::fromLocal8Bit(FMP_APPNAME));
ui->user_edit->setFocus();
_url = FMPHomeSettings::instance()->getServer(); _url = FMPHomeSettings::instance()->getServer();
_storeId = FMPHomeSettings::instance()->getStroeId(); _storeId = FMPHomeSettings::instance()->getStroeId();
...@@ -78,6 +81,6 @@ bool FMPLogin::login(QString userName, QString password) ...@@ -78,6 +81,6 @@ bool FMPLogin::login(QString userName, QString password)
void FMPLogin::onFocusChanged(QWidget *, QWidget *now) void FMPLogin::onFocusChanged(QWidget *, QWidget *now)
{ {
if(ui->user_edit == now || ui->pwd_edit == now) { if(ui->user_edit == now || ui->pwd_edit == now) {
ui->numpad->setLineEdit(qobject_cast<QLineEdit*>(now)); // ui->numpad->setLineEdit(qobject_cast<QLineEdit*>(now));
} }
} }
...@@ -11,8 +11,7 @@ ...@@ -11,8 +11,7 @@
FMPWnd::FMPWnd(QDialog *parent) FMPWnd::FMPWnd(QDialog *parent)
: QDialog(parent) : QDialog(parent)
{ {
setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint); setWindowFlags(Qt::FramelessWindowHint);
setAttribute(Qt::WA_TranslucentBackground);
} }
FMPWnd::~FMPWnd() FMPWnd::~FMPWnd()
...@@ -30,9 +29,9 @@ int FMPWnd::exec() ...@@ -30,9 +29,9 @@ int FMPWnd::exec()
// showFullScreen(); // showFullScreen();
// ::SetForegroundWindow((HWND)effectiveWinId()); // ::SetForegroundWindow((HWND)effectiveWinId());
QDesktopWidget w; // QDesktopWidget w;
QRect rc = w.availableGeometry(); // QRect rc = w.availableGeometry();
setGeometry((rc.width()-width())/2, (rc.height()-height())/2, width(), height()); // setGeometry((rc.width()-width())/2, (rc.height()-height())/2, width(), height());
return QDialog::exec(); return QDialog::exec();
} }
...@@ -120,13 +119,13 @@ long FMPWnd::winHCHitTest(MSG *msg) ...@@ -120,13 +119,13 @@ long FMPWnd::winHCHitTest(MSG *msg)
USHORT uCol = 1; USHORT uCol = 1;
bool fOnResizeBorder = false; bool fOnResizeBorder = false;
// //! Test caption area //! Test caption area
// QRegion m_children_region(0, 0, width()-54, 60); QRegion m_children_region(0, 0, width()-54, 60);
// QRegion new_region = m_children_region.translated(window_rect.x(), window_rect.y()); QRegion new_region = m_children_region.translated(window_rect.x(), window_rect.y());
// if (new_region.contains(mouse_pos)) { if (new_region.contains(mouse_pos)) {
// //! Title regions contains the mouse position, treat it as caption area //! Title regions contains the mouse position, treat it as caption area
// uRow = 0; uRow = 0;
// } }
// Hit test (HTTOPLEFT, ... HTBOTTOMRIGHT) // Hit test (HTTOPLEFT, ... HTBOTTOMRIGHT)
LRESULT hitTests[3][3] = LRESULT hitTests[3][3] =
......
<RCC> <RCC>
<qresource prefix="/"> <qresource prefix="/">
<file alias="xiaoxi">img/消息.png</file> <file alias="xiaoxi">img/消息.png</file>
<file>img/btn_close.png</file>
<file>img/num_del.png</file> <file>img/num_del.png</file>
<file alias="fm-icon_01">img/fm-icon_01.png</file> <file alias="fm-icon_01">img/fm-icon_01.png</file>
<file alias="payment">img/fm-icon_payment.png</file> <file alias="payment">img/fm-icon_payment.png</file>
<file alias="payment_onclick">img/fm-icon_payment_onclick.png</file> <file alias="payment_onclick">img/fm-icon_payment_onclick.png</file>
<file alias="tool">img/fm-icon_tool.png</file> <file alias="tool">img/fm-icon_tool.png</file>
<file>img/btn_alert_close.png</file>
<file alias="fm-icon_02">img/fm-icon_02.png</file> <file alias="fm-icon_02">img/fm-icon_02.png</file>
<file alias="tool_onclick">img/fm-icon_tool_onclick.png</file> <file alias="tool_onclick">img/fm-icon_tool_onclick.png</file>
<file alias="fm-icon_tray">img/fm-icon_tray.png</file> <file alias="fm-icon_tray">img/fm-icon_tray.png</file>
<file alias="vip">img/fm-icon_member02.png</file>
<file alias="vip_onclick">img/fm-icon_member02_2.png</file>
<file alias="takeaway">img/fm-icon_book.png</file>
<file alias="takeaway_onclick">img/fm-icon_book_02.png</file>
<file alias="coupons">img/fm-icon_coupons.png</file>
<file alias="coupons_onclick">img/fm-icon_coupons_02.png</file>
<file>img/fm-icon_close_02.png</file>
</qresource> </qresource>
</RCC> </RCC>
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