Commit 676de7e5 by gujin.wang

添加查看核销详情的悬浮按钮

parent 005693b1
......@@ -24,7 +24,8 @@ SOURCES +=\
fmnumpad.cpp \
fmp_home_settings.cpp \
fmp_flicker.cpp \
fmp_message.cpp
fmp_message.cpp \
storeinfo.cpp
HEADERS += fmp_home.h \
fmp_home_plugin_p.h \
......@@ -41,13 +42,15 @@ HEADERS += fmp_home.h \
fmp_flicker.h \
algorithm.h \
fmp_message.h \
fmp_home_def.h
fmp_home_def.h \
storeinfo.h
FORMS += \
fmp_home_navwindow.ui \
fmp_login.ui \
fmnumpad.ui \
fmp_message.ui
fmp_message.ui \
storeinfo.ui
unix {
target.path = /usr/lib
......@@ -65,6 +68,9 @@ INCLUDEPATH += $$PWD/../include/ctk \
+= $$PWD/../include/interface \
#Library path
win32 {
LIBS += -luser32
}
LIBS += -L$$PWD/../lib
CONFIG(debug, debug|release) {
......
......@@ -2,6 +2,7 @@
#include "ui_fmp_home_navwindow.h"
#include "menubutton.h"
#include "fmp_home_settings.h"
#include "fmp_redeem_i.h"
#include <QDebug>
#include <QDesktopWidget>
#include <QParallelAnimationGroup>
......@@ -14,6 +15,8 @@
#include <QMenu>
#include <QtConcurrent>
#include <QDesktopWidget>
#include <QPainter>
#include <Windows.h>
NavWindow::NavWindow(QWidget *parent) :
QDialog(parent),
......@@ -36,14 +39,14 @@ NavWindow::NavWindow(QWidget *parent) :
// 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);
MenuUiProp.endAngle = (PI/2);
MenuUiProp.interval = (PI)/4;
MenuUiProp.distance = 60;
MenuUiProp.beginAngle = -(PI/1);
MenuUiProp.endAngle = (PI/1);
MenuUiProp.interval = (PI)/1;
isUseAnimation = FMPHomeSettings::instance()->getIsUseAnimation();
this->setAttribute(Qt::WA_TranslucentBackground);
this->setWindowFlags(windowFlags() | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint | Qt::Tool);
setAttribute(Qt::WA_TranslucentBackground);
setWindowFlags(windowFlags() | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint | Qt::Tool);
connect(_btn_group, SIGNAL(buttonClicked(QAbstractButton*)), this, SLOT(onMenuBtnClicked(QAbstractButton*)));
initMenu();
......@@ -67,6 +70,7 @@ NavWindow::NavWindow(QWidget *parent) :
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()));
startTimer(1000);
}
NavWindow::~NavWindow()
......@@ -119,9 +123,9 @@ void NavWindow::initMenu()
stateGroup = new QState(_stateMachine);
stateDefault = new QState(stateGroup);
stateSpread = new QState(stateGroup);
stateDefault->assignProperty(this, "navImage", ":fm-icon_01");
stateDefault->assignProperty(this, "navImage", ":img/logo.png");
stateDefault->addTransition(ui->navMainBtn, &QPushButton::clicked, stateSpread);
stateSpread->assignProperty(this, "navImage", ":fm-icon_02");
stateSpread->assignProperty(this, "navImage", ":img/logo.png");
stateSpread->addTransition(ui->navMainBtn, &QPushButton::clicked, stateDefault);
stateGroup->setInitialState(stateSpread);
QHistoryState *stateGroupHistory = new QHistoryState(stateGroup);
......@@ -147,7 +151,7 @@ void NavWindow::initMenu()
_stateMachine->start();
MenuUiProp.btnWidth = 60;
MenuUiProp.btnWidth = 45;
int centerX = ui->navMainBtn->x() + ui->navMainBtn->width()/2;
int centerY = ui->navMainBtn->y() + ui->navMainBtn->height()/2;
_centerPoint = QPoint(centerX, centerY);
......@@ -174,6 +178,7 @@ void NavWindow::createMenuBtn(const QString &btnName, const QString &showName)
connect(action, &QAction::triggered, this, [=](){
emit menuBtnClicked(btnName);
});
auto btn = new QPushButton(this);
btn->setCursor(QCursor(Qt::PointingHandCursor));
btn->addAction(action);
......@@ -348,3 +353,18 @@ void NavWindow::onOnlyPayment()
{
emit menuBtnClicked("payment");
}
#undef StartService
void NavWindow::timerEvent(QTimerEvent *)
{
FMPRedeemInterface* svcRedeem = FMP::GetService<FMPRedeemInterface>();
if(svcRedeem)
{
svcRedeem->StartService();
if(svcRedeem->IsRedeeming() == false)
{
show();
raise();
}
}
}
\ No newline at end of file
......@@ -104,6 +104,9 @@ signals:
void navImageChanged();
protected:
void timerEvent(QTimerEvent*);
private slots:
void onMenuBtnClicked(QAbstractButton*);
void onMoved(QPoint point);
......
......@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>315</height>
<width>300</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
......@@ -15,13 +15,14 @@
</property>
<property name="styleSheet">
<string notr="true">#navMainBtn {
background: url(:fm-icon_01) center no-repeat;
/*background: url(:fm-icon_01) center no-repeat;*/
background: url(:img/logo.png) center no-repeat;
border: none;
}
QPushButton {
min-width:60px;
min-height:60px;
min-width:45px;
min-height:45px;
}
QPushButton:hover {
border: 5px solid;
......@@ -56,15 +57,21 @@ QPushButton:hover {
}
#coupons:pressed {
border-image: url(:coupons_onclick);
}
#check{
border-image: url(:check_detail);
}
#check:pressed{
border-image: url(:check_detail_onclick);
}</string>
</property>
<widget class="MenuButton" name="navMainBtn" native="true">
<property name="geometry">
<rect>
<x>140</x>
<y>90</y>
<width>124</width>
<height>124</height>
<x>127</x>
<y>127</y>
<width>45</width>
<height>45</height>
</rect>
</property>
<property name="cursor">
......
......@@ -12,9 +12,11 @@
#include "fmp_he_handlers.h"
#include "fmp_home_settings.h"
#include "fmp_redeem_i.h"
#include "storeinfo.h"
#include <QTimer>
#include <QEventLoop>
#include <QJsonArray>
#include <QSettings>
FMPHomePrivate::FMPHomePrivate(FMPHome *q)
: q_ptr(q),
......@@ -39,14 +41,15 @@ int FMPHomePrivate::Init()
FMPStartEventHandler* handler = new FMPStartEventHandler(q);
_navWindow = new NavWindow;
// std::vector<FMPBaseInterface*> svcVector;
// svcVector.push_back(FMP::GetService<FMPVipInterface>());
// svcVector.push_back(FMP::GetService<FMPePayInterface>());
std::vector<FMPBaseInterface*> svcVector;
svcVector.push_back(FMP::GetService<FMPVipInterface>());
svcVector.push_back(FMP::GetService<FMPePayInterface>());
// _navWindow->createMenuBtn("payment", QString::fromLocal8Bit("非码支付"));
// _navWindow->createMenuBtn("vip", QString::fromLocal8Bit("非码会员"));
// _navWindow->createMenuBtn("takeout", QString::fromLocal8Bit("非码外卖"));
_navWindow->createMenuBtn("coupons", QString::fromLocal8Bit("码多多"));
_navWindow->createMenuBtn("check", QString::fromLocal8Bit("核销详情"));
// _navWindow->createMenuBtn("tool", QString::fromLocal8Bit("设置"));
_navWindow->show();
......@@ -56,19 +59,30 @@ int FMPHomePrivate::Init()
login();
// 启动会员
// FMPBaseInterface* svc = FMP::GetService<FMPVipInterface>();
// if(svc) {
// svc->StartService();
// }
FMPBaseInterface* svc = FMP::GetService<FMPVipInterface>();
if(svc) {
svc->StartService();
}
//启动外卖
// FMPBaseInterface *svcTakeout = FMP::GetService<FMPTakeoutInterface>();
// if(svcTakeout) {
// svcTakeout->StartService();
// }
FMPBaseInterface *svcTakeout = FMP::GetService<FMPTakeoutInterface>();
if(svcTakeout) {
svcTakeout->StartService();
}
q->_inited = true;
q->notification(QString::fromLocal8Bit("[非码POS插件]启动成功!"));
//第一次启动时,显示门店信息
QSettings s(QApplication::applicationDirPath()+"/FreemudPOS.ini", QSettings::IniFormat);
int showInfo = s.value("Home/ShowStoreInfo").toInt();
if(showInfo)
{
_navWindow->menuBtnClicked("tool");
s.setValue("Home/ShowStoreInfo", 0);
s.sync();
}
return FMP_SUCCESS;
}
......@@ -181,8 +195,19 @@ void FMPHomePrivate::onMenuBtnClicked(QString btnName)
FMP_DEBUG() << "coupon service not available";
}
return ;
} else if(btnName == "tool") {
svc = FMP::GetService<FMPSettingsInterface>();
}else if(btnName == "check"){
return;
}else if(btnName == "tool") {
//svc = FMP::GetService<FMPSettingsInterface>();
QSettings s(QApplication::applicationDirPath()+"/FreemudPOS.ini", QSettings::IniFormat);
StoreInfo dlg;
dlg.Init(s.value("Home/StoreId").toString(), s.value("Home/PosId").toString());
dlg.exec();
s.setValue("Home/StoreId", dlg.NewInfo().first);
s.setValue("Home/PosId", dlg.NewInfo().second);
s.sync();
return;
}
if (svc) {
......
......@@ -40,8 +40,8 @@ QPoint FMPHomeSettings::getWindowPosition()
bool FMPHomeSettings::setWindowPosition(QPoint point)
{
QStringList posList;
posList << QString::number(point.x());
posList << QString::number(point.y());
posList << QString::number(point.x() > 100 ? point.x() : 100);
posList << QString::number(point.y() > 100 ? point.y() : 100);
return _SetValue(FMP_INIKEY_HOMEPOSITION, posList);
}
......
......@@ -15,5 +15,8 @@
<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>
<file>img/logo.png</file>
<file alias="check_detail">img/fm-check_detail.png</file>
<file alias="check_detail_onclick">img/fm-check_detail_onclick.png</file>
</qresource>
</RCC>
res/img/fm-icon_coupons.png

5.8 KB | W: | H:

res/img/fm-icon_coupons.png

2.83 KB | W: | H:

res/img/fm-icon_coupons.png
res/img/fm-icon_coupons.png
res/img/fm-icon_coupons.png
res/img/fm-icon_coupons.png
  • 2-up
  • Swipe
  • Onion skin
res/img/fm-icon_coupons_02.png

5.91 KB | W: | H:

res/img/fm-icon_coupons_02.png

4.36 KB | W: | H:

res/img/fm-icon_coupons_02.png
res/img/fm-icon_coupons_02.png
res/img/fm-icon_coupons_02.png
res/img/fm-icon_coupons_02.png
  • 2-up
  • Swipe
  • Onion skin
#include "storeinfo.h"
#include "ui_storeinfo.h"
#include <QMessageBox>
#include <QSettings>
StoreInfo::StoreInfo(QWidget *parent) :
QDialog(parent),
ui(new Ui::StoreInfo)
{
ui->setupUi(this);
setWindowFlags(windowFlags() | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
connect(ui->closeBtn, SIGNAL(clicked(bool)), this, SLOT(close()));
connect(ui->cancelBtn, SIGNAL(clicked(bool)), this, SLOT(close()));
connect(ui->modifyBtn, SIGNAL(clicked(bool)), this, SLOT(OnModify()));
ui->modifyWidget->hide();
QSettings s(QApplication::applicationDirPath()+"/FreemudPOS.ini", QSettings::IniFormat);
ui->storeLabel->setText(s.value("Home/StoreId").toString());
ui->posLabel->setText(s.value("Home/PosId").toString());
}
StoreInfo::~StoreInfo()
{
delete ui;
}
void StoreInfo::Init(QString storeId, QString posId)
{
ui->storeLabel->setText(storeId);
ui->posLabel->setText(posId);
}
QPair<QString, QString> StoreInfo::NewInfo()
{
return qMakePair(ui->storeLabel->text(), ui->posLabel->text());
}
void StoreInfo::OnModify()
{
QString str = ui->modifyBtn->text();
if(str == QString::fromLocal8Bit("修改"))
{
ui->infoWidget->hide();
ui->modifyWidget->show();
ui->modifyBtn->setText(QString::fromLocal8Bit("确定"));
}
else if(str == QString::fromLocal8Bit("确定"))
{
ui->storeLabel->setText(ui->storeEdit->text().trimmed());
ui->posLabel->setText(ui->posEdit->text().trimmed());
ui->infoWidget->show();
ui->modifyWidget->hide();
ui->modifyBtn->setText(QString::fromLocal8Bit("修改"));
}
}
void StoreInfo::mousePressEvent(QMouseEvent *event)
{
mouse_pressed = true;
movePosition = event->globalPos() - pos();
return QDialog::mousePressEvent(event);
}
void StoreInfo::mouseMoveEvent(QMouseEvent *event)
{
if (mouse_pressed && (event->buttons() && Qt::LeftButton)
&& (event->globalPos()-movePosition).manhattanLength() > QApplication::startDragDistance())
{
move(event->globalPos()-movePosition);
movePosition = event->globalPos() - pos();
}
return QDialog::mouseMoveEvent(event);
}
void StoreInfo::mouseReleaseEvent(QMouseEvent *event)
{
mouse_pressed = false;
return QDialog::mouseReleaseEvent(event);
}
\ No newline at end of file
#ifndef DIALOG_H
#define DIALOG_H
#include <QDialog>
#include <QMouseEvent>
namespace Ui {
class StoreInfo;
}
class StoreInfo : public QDialog
{
Q_OBJECT
public:
explicit StoreInfo(QWidget *parent = 0);
~StoreInfo();
void Init(QString storeId, QString posId);
QPair<QString, QString> NewInfo();
protected:
void mousePressEvent(QMouseEvent* event);
void mouseMoveEvent(QMouseEvent* event);
void mouseReleaseEvent(QMouseEvent* event);
private slots:
void OnModify();
private:
Ui::StoreInfo *ui;
bool mouse_pressed;
QPoint movePosition;
};
#endif // DIALOG_H
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>StoreInfo</class>
<widget class="QDialog" name="StoreInfo">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>407</width>
<height>321</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<property name="styleSheet">
<string notr="true">#Dialog{
background-color:white;
}
QLabel{
font-size:20px;
color: rgb(99,148,235) ;
}
QLineEdit{
font-size:20px;
}
#softLabel, #companyLabel{
font-size:15px;
}
#titleLabel{
background: rgb(56, 56, 64);
color:rgb(255, 255, 255);
}
#closeBtn{
background: rgb(56, 56, 64);
border: 0;
image: url(:/img/fm-icon_close_02.png);
}
#closeBtn:pressed
{
padding: 1 0 0 2;
}
#infoWidget, #modifyWidget, #btnWidget{
background-color: rgb(233, 239, 251);
}
#modifyBtn, #cancelBtn{
background: rgb(93,144,237);
font: normal 16px &quot;Microsoft YaHei&quot;;
color: white;
border-radius:15px;
}
#modifyBtn:pressed, #cancelBtn:pressed{
padding: 1 0 0 2;
}
#companyLabel
{
font: normal 16px &quot;微软雅黑&quot;;
color: rgb(200,200,200);
}</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,1,1,0,0">
<property name="spacing">
<number>6</number>
</property>
<property name="sizeConstraint">
<enum>QLayout::SetFixedSize</enum>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="titleLabel">
<property name="minimumSize">
<size>
<width>363</width>
<height>26</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>26</height>
</size>
</property>
<property name="text">
<string>门店信息</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="closeBtn">
<property name="minimumSize">
<size>
<width>26</width>
<height>26</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>26</width>
<height>26</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QWidget" name="infoWidget" native="true">
<layout class="QGridLayout" name="gridLayout" rowstretch="0,0" columnstretch="0,1">
<property name="horizontalSpacing">
<number>9</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>门店号</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="storeLabel">
<property name="text">
<string>WH026</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>POS号</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="posLabel">
<property name="text">
<string>001</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QWidget" name="modifyWidget" native="true">
<layout class="QGridLayout" name="gridLayout_2">
<property name="horizontalSpacing">
<number>9</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>门店号</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="storeEdit"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_9">
<property name="text">
<string>POS号</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="posEdit"/>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QWidget" name="btnWidget" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>194</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="modifyBtn">
<property name="minimumSize">
<size>
<width>90</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>修改</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="cancelBtn">
<property name="minimumSize">
<size>
<width>90</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>退出</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QLabel" name="companyLabel">
<property name="text">
<string>由非码提供技术支持 V1.0.7</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>
<connections/>
</ui>
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