Commit 4589e123 by NitefullWind

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

parent 2e50725e
......@@ -27,6 +27,9 @@ NavWindow::NavWindow(QWidget *parent) :
ui->navMainBtn->setMovedItem(this);
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("设置")));
MenuUiProp.distance = 100;
......@@ -137,6 +140,7 @@ void NavWindow::initMenu()
});
actions << action;
auto btn = new QPushButton(this);
btn->setCursor(QCursor(Qt::PointingHandCursor));
btn->addAction(action);
double angle = MenuUiProp.beginAngle + jianGe*i;
......@@ -175,11 +179,11 @@ void NavWindow::initSystemTrayIcon()
{
QIcon icon(":fm-icon_tray");
_systemTrayIcon->setIcon(icon);
_systemTrayIcon->setToolTip(qApp->applicationName());
_systemTrayIcon->setToolTip(QString::fromLocal8Bit(FMP_APPNAME));
auto quitAction = new QAction(QString::fromLocal8Bit("退出"), this);
connect(quitAction, &QAction::triggered, this, [&](){
// _systemTrayIcon->hide();
_systemTrayIcon->hide();
emit menuBtnClicked("quit");
});
auto menus = new QMenu(this);
......@@ -312,3 +316,7 @@ void NavWindow::onNavImageChanged()
"border: none;}"
).arg(_navImage));
}
void NavWindow::showMessage(const QString &message)
{
_systemTrayIcon->showMessage(QString::fromLocal8Bit(FMP_APPNAME), message);
}
......@@ -72,6 +72,11 @@ public slots:
*/
bool removeBlink(int blinkId);
/**
* @brief showMessage
* @param message
*/
void showMessage(const QString &message);
signals:
void menuBtnClicked(QString btnName);
......
......@@ -40,10 +40,22 @@ QPushButton:hover {
border-image: url(:payment_onclick);
}
#vip {
border-image: url(:member02);
border-image: url(:vip);
}
#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>
</property>
<widget class="MenuButton" name="navMainBtn" native="true">
......@@ -55,6 +67,9 @@ QPushButton:hover {
<height>124</height>
</rect>
</property>
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
......
......@@ -5,6 +5,7 @@
#include <ctkServiceReference.h>
#include <QDebug>
#include <fmp_epay_i.h>
//#include <fmp_vip_i.h>
#include <fmp_settings_i.h>
#include <QApplication>
#include "fmp_login.h"
......@@ -14,6 +15,7 @@
FMPHomePrivate::FMPHomePrivate(FMPHome *q)
: q_ptr(q),
_isLogined(false),
_isLogining(false),
_userName(""),
_errorMsg("")
{
......@@ -65,8 +67,14 @@ void FMPHomePrivate::StartPlugins(const QVariantList &pids)
int FMPHomePrivate::login()
{
if(_isLogining) {
return FMP_FAILURE;
}
_isLogining = true;
#if 1
FMPLogin loginWnd;
loginWnd.exec();
_isLogining = false;
if(loginWnd.isLogined()) {
_isLogined = true;
_userName = loginWnd.userName();
......@@ -75,6 +83,12 @@ int FMPHomePrivate::login()
_isLogined = false;
return FMP_FAILURE;
}
#else
_isLogining = false;
_isLogined = true;
_userName = "";
return FMP_SUCCESS;
#endif
}
int FMPHomePrivate::blink(FMPluginInterface *plugin, const QString &image)
......@@ -116,6 +130,17 @@ void FMPHomePrivate::onMenuBtnClicked(QString btnName)
if(btnName == "payment") {
FMPePayInterface *e = q->GetService<FMPePayInterface>(q->_ctx);
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") {
HOME_DEBUG() << "tool menu";
}
......
......@@ -37,6 +37,8 @@ public:
private:
NavWindow *_navWindow;
FMPSettingsInterface *_settings;
bool _isLogining;
};
#endif // FMP_HOME_P_H
......@@ -25,12 +25,12 @@ FMPLoggerInterface *FMPHomeSettings::getLogger()
bool FMPHomeSettings::getIsUseAnimation()
{
return _GetValue(FMP_INIKEY_HOMEANIMATION).toBool();
return _GetValue(FMP_INIKEY_ANIMATION).toBool();
}
bool FMPHomeSettings::setIsUseAnimation(bool isUse)
{
return _SetValue(FMP_INIKEY_HOMEANIMATION, isUse);
return _SetValue(FMP_INIKEY_ANIMATION, isUse);
}
QPoint FMPHomeSettings::getWindowPosition()
......
......@@ -16,11 +16,14 @@ FMPLogin::FMPLogin(QDialog *parent) :
_errorMsg("")
{
ui->setupUi(this);
connect(ui->numpad, SIGNAL(digit_confirm()), this, SLOT(on_login_btn_clicked()));
connect(qApp, &QApplication::focusChanged, this, &FMPLogin::onFocusChanged);
// connect(ui->numpad, SIGNAL(digit_confirm()), this, SLOT(on_login_btn_clicked()));
// connect(qApp, &QApplication::focusChanged, this, &FMPLogin::onFocusChanged);
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();
_storeId = FMPHomeSettings::instance()->getStroeId();
......@@ -78,6 +81,6 @@ bool FMPLogin::login(QString userName, QString password)
void FMPLogin::onFocusChanged(QWidget *, QWidget *now)
{
if(ui->user_edit == now || ui->pwd_edit == now) {
ui->numpad->setLineEdit(qobject_cast<QLineEdit*>(now));
// ui->numpad->setLineEdit(qobject_cast<QLineEdit*>(now));
}
}
......@@ -10,88 +10,107 @@
<height>480</height>
</rect>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="sizeIncrement">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="mouseTracking">
<bool>false</bool>
</property>
<property name="windowTitle">
<string>Form</string>
<string>FMVipPanel</string>
</property>
<property name="styleSheet">
<string notr="true">#FMPLogin {
background: rgb(255,255,255);
}
QWidget {
<string notr="true">QWidget {
font: normal 22px &quot;Microsoft YaHei&quot;;
color: rgb(90,90,90);
}
#FMPLogin {
background-color: rgb(255, 255, 255);
}
/*
* 标题栏
*/
#title {
background: rgb(61,65,77);
min-height: 48px; max-height: 48px;
background: rgb(56, 56, 64);
min-height: 54px; max-height: 54px;
border: 1 solid silver;
border-bottom: 0 solid silver;
}
#logo_label {
min-height: 48px;
color: rgb(252,252,252);
font: 75 22px &quot;微软雅黑&quot;;;
color: rgb(220, 220, 220);
min-width: 120px; min-height: 54px;
margin-left: 20;
/*image: url(&quot;:/img_logo.png&quot;);*/
}
#close_btn {
min-width: 50px; min-height: 50px;
border-image: url(&quot;:/img/btn_close.png&quot;);
margin-right: 12px;
}
#close_btn:hover{
min-width: 51px; min-height: 51px;
border-image: url(&quot;:/img/btn_alert_close.png&quot;);
min-width: 54;
min-height: 54;
border-radius: 0px;
image: url(:/img/fm-icon_close_02.png);
}
/*
* 信息
*
*/
#tip, #tip QLabel {
background: rgb(186,186,186);
color: rgb(252,252,252);
font-size: 14px;
border-bottom: 1 solid silver;
}
#tip {
min-height: 0px; max-height: 0px;
#user_label,#pwd_label {
color: rgb(169,169,169);
image: url(&quot;:/account.png&quot;);
background: white;
border: 1 solid silver;
border-top: 0;
border-right: 0;
min-width: 49; max-width: 49;
}
/*
* 主界面
*/
QLineEdit {
#user_edit, #pwd_edit {
min-height: 49px;
font: 100 19px &quot;Microsoft YaHei&quot;;
color: rgb(50,50,50);
background: white;
border: 1 solid silver;
border-left: 0;
}
#login_btn {
min-height: 56px;
background: rgb(93,144,237);
background: rgb(99, 148, 235);
font: 400 23px &quot;Microsoft YaHei&quot;;
color: white;
border: 1 solid white;
border-right: 0 solid silver;
}
#login_btn:hover {
#pay_btn:hover {
padding: 2 0 0 2;
}
#numpad {
min-width: 0; min-height:0;
max-width: 0; max-height:0;
/*
* 信息
*/
#tip {
min-height: 36px; max-height:36px;
border: 1 solid silver;
}
#tip, #tip QLabel {
background: rgb(140,140,140);
color: rgb(252,252,252);
font-size: 16px;
}
#tip QLabel {
min-height: 35px; max-height:35px;
}</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>0</number>
</property>
......@@ -109,31 +128,37 @@ QLineEdit {
</property>
<item>
<widget class="QWidget" name="title" native="true">
<layout class="QHBoxLayout" name="horizontalLayout">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>20</number>
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>20</number>
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="logo_label">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>非码</string>
<string/>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<spacer name="horizontalSpacer_7">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
......@@ -147,6 +172,9 @@ QLineEdit {
</item>
<item>
<widget class="QPushButton" name="close_btn">
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="text">
<string/>
</property>
......@@ -156,17 +184,6 @@ QLineEdit {
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="main">
<property name="spacing">
<number>40</number>
</property>
<property name="leftMargin">
<number>130</number>
</property>
<property name="rightMargin">
<number>130</number>
</property>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
......@@ -174,33 +191,88 @@ QLineEdit {
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<widget class="QWidget" name="user" native="true">
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="spacing">
<number>25</number>
</property>
<property name="leftMargin">
<number>124</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>124</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>30</number>
<number>0</number>
</property>
<item>
<widget class="QLabel" name="user_label">
<property name="margin">
<number>0</number>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="user_edit">
<property name="inputMask">
<string/>
</property>
<property name="text">
<string/>
</property>
<property name="maxLength">
<number>20</number>
</property>
<property name="frame">
<bool>true</bool>
</property>
<property name="placeholderText">
<string>账号</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="pwd_label">
<property name="margin">
<number>0</number>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="pwd_edit">
<property name="inputMask">
<string/>
</property>
<property name="text">
<string/>
</property>
<property name="maxLength">
<number>20</number>
</property>
<property name="frame">
<bool>true</bool>
</property>
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
......@@ -209,27 +281,27 @@ QLineEdit {
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QPushButton" name="login_btn">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="text">
<string>登录</string>
<string>会员认证</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="FMNumPad" name="numpad" native="true">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
......@@ -243,80 +315,122 @@ QLineEdit {
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QWidget" name="tip" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_5">
<layout class="QHBoxLayout" name="tipLay">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>20</number>
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>20</number>
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="operator_desc_label">
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="store_desc_label">
<property name="text">
<string>操作员:</string>
<string>门店/</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="operator_label">
<widget class="QLabel" name="pos_desc_label">
<property name="text">
<string>00000</string>
<string>pos编号:</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<widget class="QLabel" name="store_label">
<property name="text">
<string>fm9999</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>/</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="pos_label">
<property name="text">
<string>001</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<width>100</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="bd_desc_label_2">
<widget class="QLabel" name="bd_desc_label">
<property name="text">
<string>营业日:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="bd_desc_label">
<widget class="QLabel" name="bd_label">
<property name="text">
<string>2017-02-20</string>
<string>0000-00-00</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_9">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>FMNumPad</class>
<extends>QWidget</extends>
<header>fmnumpad.h</header>
</customwidget>
</customwidgets>
<layoutdefault spacing="6" margin="11"/>
<tabstops>
<tabstop>user_edit</tabstop>
<tabstop>pwd_edit</tabstop>
<tabstop>login_btn</tabstop>
<tabstop>close_btn</tabstop>
</tabstops>
<resources/>
......
......@@ -11,8 +11,7 @@
FMPWnd::FMPWnd(QDialog *parent)
: QDialog(parent)
{
setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
setAttribute(Qt::WA_TranslucentBackground);
setWindowFlags(Qt::FramelessWindowHint);
}
FMPWnd::~FMPWnd()
......@@ -30,9 +29,9 @@ int FMPWnd::exec()
// showFullScreen();
// ::SetForegroundWindow((HWND)effectiveWinId());
QDesktopWidget w;
QRect rc = w.availableGeometry();
setGeometry((rc.width()-width())/2, (rc.height()-height())/2, width(), height());
// QDesktopWidget w;
// QRect rc = w.availableGeometry();
// setGeometry((rc.width()-width())/2, (rc.height()-height())/2, width(), height());
return QDialog::exec();
}
......@@ -120,13 +119,13 @@ long FMPWnd::winHCHitTest(MSG *msg)
USHORT uCol = 1;
bool fOnResizeBorder = false;
// //! Test caption area
// QRegion m_children_region(0, 0, width()-54, 60);
// QRegion new_region = m_children_region.translated(window_rect.x(), window_rect.y());
// if (new_region.contains(mouse_pos)) {
// //! Title regions contains the mouse position, treat it as caption area
// uRow = 0;
// }
//! Test caption area
QRegion m_children_region(0, 0, width()-54, 60);
QRegion new_region = m_children_region.translated(window_rect.x(), window_rect.y());
if (new_region.contains(mouse_pos)) {
//! Title regions contains the mouse position, treat it as caption area
uRow = 0;
}
// Hit test (HTTOPLEFT, ... HTBOTTOMRIGHT)
LRESULT hitTests[3][3] =
......
<RCC>
<qresource prefix="/">
<file alias="xiaoxi">img/消息.png</file>
<file>img/btn_close.png</file>
<file>img/num_del.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_onclick">img/fm-icon_payment_onclick.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="tool_onclick">img/fm-icon_tool_onclick.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>
</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