Commit 1a997b69 by xiaoqing.gu

1、悬浮框左右展开 2、退单table页增加退单数量显示 3、修改新登陆界面 4、增加长按悬浮框显示扫码点餐

parent 57a21699
...@@ -34,6 +34,8 @@ QEvent::Type PosEvent::s_driver_order_status = static_cast<QEvent::Type>(QEvent: ...@@ -34,6 +34,8 @@ QEvent::Type PosEvent::s_driver_order_status = static_cast<QEvent::Type>(QEvent:
QEvent::Type PosEvent::s_get_driver_info = static_cast<QEvent::Type>(QEvent::registerEventType()); QEvent::Type PosEvent::s_get_driver_info = static_cast<QEvent::Type>(QEvent::registerEventType());
QEvent::Type PosEvent::s_need_get_driver_info = static_cast<QEvent::Type>(QEvent::registerEventType()); QEvent::Type PosEvent::s_need_get_driver_info = static_cast<QEvent::Type>(QEvent::registerEventType());
QEvent::Type PosEvent::s_show_pickup = static_cast<QEvent::Type>(QEvent::registerEventType());
PosEvent::PosEvent(Type e):QEvent(e) PosEvent::PosEvent(Type e):QEvent(e)
{ {
//qDebug() << "------event : " << this; //qDebug() << "------event : " << this;
......
...@@ -121,6 +121,9 @@ public: ...@@ -121,6 +121,9 @@ public:
static Type s_driver_order_status; //拉取到骑手信息并缓存后,推送事件,展示界面响应事件,展示图标 static Type s_driver_order_status; //拉取到骑手信息并缓存后,推送事件,展示界面响应事件,展示图标
static Type s_get_driver_info; //登陆拉取骑手信息后,推送事件,posorderpool响应事件,将骑手信息缓存 static Type s_get_driver_info; //登陆拉取骑手信息后,推送事件,posorderpool响应事件,将骑手信息缓存
static Type s_need_get_driver_info; //收到消息中心推送的cmd=5的消息的时候,推送的事件 static Type s_need_get_driver_info; //收到消息中心推送的cmd=5的消息的时候,推送的事件
//---------------------长按悬浮框显示扫码点餐界面--------
static Type s_show_pickup;
private: private:
//事件携带的信息,该内存你应当在堆中分配 //事件携带的信息,该内存你应当在堆中分配
void *_info; void *_info;
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include "model/posstallspool.h" #include "model/posstallspool.h"
#include "view/mainForm.h" #include "view/mainForm.h"
#include "view/floatForm.h" #include "view/floatForm.h"
#include "view/newfloatform.h"
#include "view/newmainform.h" #include "view/newmainform.h"
#include "control/orderlocalizework.h" #include "control/orderlocalizework.h"
#include "control/orderpushwork.h" #include "control/orderpushwork.h"
...@@ -242,7 +243,8 @@ int main(int argc, char *argv[]) ...@@ -242,7 +243,8 @@ int main(int argc, char *argv[])
NewLoginForm loginform; NewLoginForm loginform;
NewMainForm mainform; NewMainForm mainform;
FloatForm floatform; // FloatForm floatform;
NewFloatForm floatform;
mainform.MyShow(); mainform.MyShow();
loginform.showfull(); loginform.showfull();
#endif #endif
......
...@@ -64,6 +64,7 @@ ...@@ -64,6 +64,7 @@
#define INI_POSNO "info/posNo" #define INI_POSNO "info/posNo"
#define INI_PASSWORD "info/password" #define INI_PASSWORD "info/password"
#define INI_AUTOCONFIRM "info/autoconfirm" #define INI_AUTOCONFIRM "info/autoconfirm"
#define INI_REMEMBERPWD "info/rememberPwd"
#define INI_AUTOLOGIN "info/autologin" #define INI_AUTOLOGIN "info/autologin"
#define INI_UIVISIBLE "Ui/visible" #define INI_UIVISIBLE "Ui/visible"
......
...@@ -84,7 +84,8 @@ SOURCES += main.cpp \ ...@@ -84,7 +84,8 @@ SOURCES += main.cpp \
model/prtmodelpool.cpp \ model/prtmodelpool.cpp \
view/newchangeshiftsform.cpp \ view/newchangeshiftsform.cpp \
base/Arithmetic/cretopt.cpp \ base/Arithmetic/cretopt.cpp \
control/driverinfogetwork.cpp control/driverinfogetwork.cpp \
view/newfloatform.cpp
HEADERS += \ HEADERS += \
event/fmapplication.h \ event/fmapplication.h \
...@@ -143,7 +144,8 @@ HEADERS += \ ...@@ -143,7 +144,8 @@ HEADERS += \
control/prtmodelgetwork.h \ control/prtmodelgetwork.h \
model/prtmodelpool.h \ model/prtmodelpool.h \
view/newchangeshiftsform.h \ view/newchangeshiftsform.h \
control/driverinfogetwork.h control/driverinfogetwork.h \
view/newfloatform.h
DISTFILES += takeout.rc DISTFILES += takeout.rc
...@@ -167,7 +169,8 @@ FORMS += \ ...@@ -167,7 +169,8 @@ FORMS += \
view/prttypeform.ui \ view/prttypeform.ui \
view/newloginform.ui \ view/newloginform.ui \
view/newpickupform.ui \ view/newpickupform.ui \
view/newchangeshiftsform.ui view/newchangeshiftsform.ui \
view/newfloatform.ui
CONFIG(release, debug|release){ CONFIG(release, debug|release){
QMAKE_LFLAGS += /DEBUG QMAKE_LFLAGS += /DEBUG
......
...@@ -4,6 +4,9 @@ ...@@ -4,6 +4,9 @@
#include <QMouseEvent> #include <QMouseEvent>
#include <qDebug> #include <qDebug>
#include "event/posevent.h"
#include "event/fmapplication.h"
#include "model/posorderpool.h"
#include "QsLog.h" #include "QsLog.h"
...@@ -13,6 +16,9 @@ MainBtn::MainBtn(QWidget *parent) : ...@@ -13,6 +16,9 @@ MainBtn::MainBtn(QWidget *parent) :
{ {
ui->setupUi(this); ui->setupUi(this);
_checked = false; _checked = false;
FMApplication::subscibeEvent(this, PosEvent::s_change_order);
FMApplication::subscibeEvent(this, PosEvent::s_delete_order);
} }
MainBtn::~MainBtn() MainBtn::~MainBtn()
...@@ -170,7 +176,59 @@ void MainBtn::SetText(QString data, QString type) ...@@ -170,7 +176,59 @@ void MainBtn::SetText(QString data, QString type)
} }
} }
QString MainBtn::getMainBtnType() const
{
return _type;
}
QString MainBtn::info() const QString MainBtn::info() const
{ {
return _info; return _info;
} }
//bool MainBtn::event(QEvent *e)
//{
// if(e->type() == PosEvent::s_change_order)
// {
// QLOG_DEBUG() << "MainBtn PosEvent::s_change_order:";
// QString orderid;
// GETEVENTINFO(orderid,e,QString);
// int tk_new = 0, tk_make = 0, tk_send = 0, tk_refund = 0;
// int self_new = 0, self_make = 0, self_refund = 0;
// PosOrderPool::GetOrderNum(tk_new, tk_make, tk_send, tk_refund, self_new, self_make, self_refund);
// QLOG_DEBUG() << "tk_new" << tk_new << "tk_make" << tk_make << "tk_send" << tk_send << "self_new" << self_new << "self_make" << self_make;
// QLOG_DEBUG() << "tk_refund" << tk_refund << "self_refund" << self_refund;
// if(_type.compare("refund",Qt::CaseInsensitive) == 0)
// {
// _info = QString::fromUtf8("\xE9\x80\x80\xE5\x8D\x95") + QString("(%1)").arg(QString::number(tk_refund + self_refund));
// }
// return true;
// }
// if(e->type() == PosEvent::s_delete_order)
// {
// QLOG_DEBUG() << "MainBtn PosEvent::s_delete_order:";
// int tk_new = 0, tk_make = 0, tk_send = 0, tk_refund = 0;
// int self_new = 0, self_make = 0, self_refund = 0;
// PosOrderPool::GetOrderNum(tk_new, tk_make, tk_send, tk_refund, self_new, self_make, self_refund);
// QLOG_DEBUG() << "tk_new" << tk_new << "tk_make" << tk_make << "tk_send" << tk_send << "self_new" << self_new << "self_make" << self_make;
// QLOG_DEBUG() << "tk_refund" << tk_refund << "self_refund" << self_refund;
// if(_type.compare("refund",Qt::CaseInsensitive) == 0)
// {
// _info = QString::fromUtf8("\xE9\x80\x80\xE5\x8D\x95") + QString("(%1)").arg(QString::number(tk_refund + self_refund));
// }
// return true;
// }
// return QWidget::event(e);
//}
...@@ -21,8 +21,12 @@ public: ...@@ -21,8 +21,12 @@ public:
void SetText(QString data, QString type); void SetText(QString data, QString type);
QString getMainBtnType() const;
QString info() const; QString info() const;
// virtual bool event(QEvent *e);
signals: signals:
void clicked(); void clicked();
private: private:
......
#include "newfloatform.h"
#include "ui_newfloatform.h"
#include <QPixmap>
#include "base/config/configManger.h"
#include "preDefine.h"
#include "QsLog.h"
#include <QProcess>
#include <QThread>
#include <QHostInfo>
#include <QUdpSocket>
#include <QByteArray>
#include <QJsonObject>
#include <QJsonDocument>
#include <QDesktopWidget>
#include <QPoint>
#include "event/fmapplication.h"
#include "event/posevent.h"
#include "model/posorderpool.h"
extern QThread workThread;
NewFloatForm::NewFloatForm(QWidget *parent) :
QDialog(parent),
ui(new Ui::NewFloatForm)
{
ui->setupUi(this);
m_is_login = false;
FMApplication::subscibeEvent(this, PosEvent::s_change_order);
FMApplication::subscibeEvent(this, PosEvent::s_show_float);
FMApplication::subscibeEvent(this, PosEvent::s_delete_order);
FMApplication::subscibeEvent(this, PosEvent::s_login_status);
FMApplication::subscibeEvent(this, PosEvent::s_network_outtime);
FMApplication::subscibeEvent(this, PosEvent::s_pickuporder_remind);
m_bReminding = false;
m_num = 0;
QPixmap imgNormal(":loginlogin.png");
m_imgNormalSize = imgNormal.size();
QPixmap imgRemind(":loginlogin.png");
m_imgRemindSize = imgRemind.size();
m_animation.setTargetObject(this);
m_animation.setPropertyName("windowOpacity");
m_animation.setDuration(ConfigManger::GetInstance().GetBlinkInterval());
m_animation.setEasingCurve(QEasingCurve::InOutSine);
m_raiseTimer.setInterval(2000);
connect(&m_raiseTimer, &QTimer::timeout, this, &NewFloatForm::raise);
connect(&m_clickTimer, &QTimer::timeout, this, &NewFloatForm::OnUpdate);
// desktopSize= QApplication::desktop()->screenGeometry().size();
// desktopSize-= QSize(144, 48);
//界面数据初始化
ui->label_front_newnum->setText("0");
ui->label_back_newnum->setText("0");
ui->label_front_refundnum->setText("0");
ui->label_back_refundnum->setText("0");
//设置拖动图层透明度
ui->widget_touch->setWindowOpacity(0.1);
_Init();
}
NewFloatForm::~NewFloatForm()
{
delete ui;
}
void NewFloatForm::InitWidget(int flag)
{
if(flag == -1)
{
if(m_is_login)
{
ui->widget_base_frame->show();
ui->widget_back_login->hide();
ui->widget_front_login->hide();
ui->widget_back_synshow->hide();
ui->widget_front_synshow->hide();
}
else
{
ui->widget_base_frame->show();
ui->widget_front_login->hide();
ui->widget_back_login->hide();
ui->widget_front_synshow->hide();
ui->widget_back_synshow->hide();
}
return ;
}
}
bool NewFloatForm::event(QEvent *e)
{
if(e->type() == PosEvent::s_change_order)
{
QString orderid;
GETEVENTINFO(orderid,e,QString);
int refundstatus, orderstatus, ordertype;
bool oldorder;
int tk_new = 0, tk_make = 0, tk_send = 0, tk_refund = 0;
int self_new = 0, self_make = 0, self_refund = 0;
PosOrderPool::GetOrderNum(tk_new, tk_make, tk_send, tk_refund, self_new, self_make, self_refund);
QLOG_DEBUG() << "tk_new" << tk_new << "tk_make" << tk_make << "tk_send" << tk_send << "self_new" << self_new << "self_make" << self_make;
QLOG_DEBUG() << "tk_refund" << tk_refund << "self_refund" << self_refund;
ui->label_back_newnum->setText(QString::number(tk_new + self_new + tk_make + self_make));
ui->label_back_refundnum->setText(QString::number(self_refund + tk_refund));
ui->label_front_newnum->setText(QString::number(tk_new + self_new + tk_make + self_make));
ui->label_front_refundnum->setText(QString::number(self_refund + tk_refund));
if(!PosOrderPool::GetOrderStatusAndOrderType(orderid, orderstatus, refundstatus, ordertype, oldorder))
return true;
//预约单不在提醒
if(ordertype == AppointmentTakeout || ordertype == AppointmentDining || ordertype == AppointmentInvite)
return true;
QLOG_DEBUG() << "input : " << orderid << orderstatus << refundstatus << oldorder;
QString configfile = qApp->applicationDirPath() + "/" + CONFIG_NAME;
QString autoconf = QSettings(configfile, QSettings::IniFormat).value(INI_AUTOCONFIRM, "0").toString();
if(!oldorder && ((orderstatus == NewOrder && autoconf.toInt() == 0) || (orderstatus == FirmOrder && autoconf.toInt() == 1)) &&
refundstatus != ApplicationRefundOrder && refundstatus != ApplicationPartialRefundOrder && refundstatus != RefusingRefundOrder)
{
//m_play_flag = false;
if(ui->widget_back_synshow->isHidden())
ui->widget_back_synshow->show();
onStartRemind(0);
return true;
}
if((refundstatus == ApplicationRefundOrder || refundstatus == ApplicationPartialRefundOrder))
{
//m_play_flag = false;
if(ui->widget_back_synshow->isHidden())
ui->widget_back_synshow->show();
onStartRemind(1);
return true;
}
return true;
}
if(e->type() == PosEvent::s_show_float)
{
this->onShow();
return true;
}
if(e->type() == PosEvent::s_network_outtime)
{
// if(!this->isHidden())
// {
QVariantMap value;
GETEVENTINFO(value,e,QVariantMap);
if(value.contains(EVENT_KEY_NETWORKSTATUS) && value[EVENT_KEY_NETWORKSTATUS].toBool() == true)
{
this->onStopRemind();
}
else
{
//m_play_flag = true;
// if(ui->widget_back_synshow->isHidden())
// ui->widget_back_synshow->show();
// QSize tmpdesktopSize= QApplication::desktop()->screenGeometry().size();
// tmpdesktopSize-= QSize(ui->widget_base->width(), ui->widget_base->height());
QLOG_DEBUG() << "table show1------------------------------" ;
// if(ui->widget_back_synshow->isHidden() && m_is_login && ui->widget_front_synshow->isHidden())
// {
// QLOG_DEBUG() << "table show2------------------------------" ;
// if(pos().x() > tmpdesktopSize.width() - 2*(ui->widget_base->width()))
// {
// QLOG_DEBUG() << "table show3------------------------------" ;
// ui->widget_front_synshow->show();
// } else {
// QLOG_DEBUG() << "table show4------------------------------" ;
// ui->widget_back_synshow->show();
// }
// if(!ui->widget_base_frame->isHidden())
// ui->widget_base_frame->hide();
// }
// else if(!ui->widget_back_synshow->isHidden() && m_is_login)
// {
// QLOG_DEBUG() << "table show5------------------------------" ;
//// ui->widget_back_synshow->hide();
// if(ui->widget_base_frame->isHidden())
// ui->widget_base_frame->show();
// } else if(!ui->widget_front_synshow->isHidden() && m_is_login) {
// QLOG_DEBUG() << "table show6------------------------------" ;
//// ui->widget_front_synshow->hide();
// if(ui->widget_base_frame->isHidden())
// ui->widget_base_frame->show();
// }
onStartRemind(2);
}
// }
return true;
}
if(e->type() == PosEvent::s_delete_order)
{
int tk_new = 0, tk_make = 0, tk_send = 0, tk_refund = 0;
int self_new = 0, self_make = 0, self_refund = 0;
PosOrderPool::GetOrderNum(tk_new, tk_make, tk_send, tk_refund, self_new, self_make, self_refund);
QLOG_DEBUG() << "tk_new" << tk_new << "tk_make" << tk_make << "tk_send" << tk_send << "self_new" << self_new << "self_make" << self_make;
QLOG_DEBUG() << "tk_refund" << tk_refund << "self_refund" << self_refund;
ui->label_back_newnum->setText(QString::number(tk_new + self_new + tk_make + self_make));
ui->label_back_refundnum->setText(QString::number(self_refund + tk_refund));
ui->label_front_newnum->setText(QString::number(tk_new + self_new + tk_make + self_make));
ui->label_front_refundnum->setText(QString::number(self_refund + tk_refund));
return true;
}
if(e->type() == PosEvent::s_login_status)
{
QVariantMap value;
GETEVENTINFO(value,e,QVariantMap);
if(value.contains(EVENT_KEY_STATUS) && value[EVENT_KEY_STATUS].toBool() == true)
{
m_is_login = true;
}
return true;
}
//预约单提醒
if(e->type() == PosEvent::s_pickuporder_remind)
{
QString orderid;
GETEVENTINFO(orderid,e,QString);
QLOG_DEBUG() << "pickuporderremind : " << orderid;
//m_play_flag = false;
if(ui->widget_back_synshow->isHidden())
ui->widget_back_synshow->show();
onStartRemind(0);
return true;
}
return QWidget::event(e);
}
void NewFloatForm::mouseMoveEvent(QMouseEvent *event)
{
if ((event->buttons()==Qt::LeftButton) && m_bMousePress)
{
QSize tmpdesktopSize= QApplication::desktop()->screenGeometry().size();
if(!m_is_login)
tmpdesktopSize-= QSize(ui->widget_base->width(), ui->widget_base->height());
else
tmpdesktopSize-= QSize(this->width(), this->height());
QPoint moveAmount = event->globalPos() - m_lastMousePos;
m_absMove += moveAmount;
int x=0,y=0;
x=pos().x()+moveAmount.x();
y=pos().y()+moveAmount.y();
qDebug() << "----------------------1010------------------" <<pos().x() << pos().y() << x << y;
if(ui->widget_back_synshow->isHidden()) {
if(x>tmpdesktopSize.width()+ui->widget_base->width()){x=tmpdesktopSize.width()+ui->widget_base->width();}
} else {
if(x>tmpdesktopSize.width()){x=tmpdesktopSize.width();}
}
if(!ui->widget_front_synshow->isHidden()) {
if(x<0){x=0;}
} else {
if(x<-ui->widget_base->width()){x=-ui->widget_base->width();}
}
if(y>tmpdesktopSize.height()){y=tmpdesktopSize.height();}
if(y<0){y=0;}
move(x,y);
m_lastMousePos = event->globalPos();
m_bMouseMove = true;
}
m_clickTimer.stop();
m_num = 0;
}
void NewFloatForm::mousePressEvent(QMouseEvent *event)
{
if (event->button()==Qt::LeftButton)
{
m_bMousePress = true;
m_lastMousePos = event->globalPos();
m_absMove = QPoint(0,0);
m_clickTimer.start(200);
}
}
void NewFloatForm::mouseReleaseEvent(QMouseEvent *event)
{
qDebug() << "-------------2020------------------" << event->globalPos() << pos();
QSize tmpdesktopSize= QApplication::desktop()->screenGeometry().size();
tmpdesktopSize-= QSize(ui->widget_base->width(), ui->widget_base->height());
if (event->button()==Qt::LeftButton)
{
m_bMousePress = false;
}
int x = m_absMove.x();
int y = m_absMove.y();
if(!m_bMouseMove || (((x>-10)&&(x<10))&&((y>-10)&&(y<10))))
{
//qDebug() << "x:" << event->x() << "y:" << event->y();
qDebug() << "-----------------30---------------------------" <<m_num;
if(event->x() > (ui->widget_base->width())*2 || !m_is_login || event->x() < ui->widget_base->width())
{
hide();
m_raiseTimer.stop();
if(m_bReminding)
{
this->onStopRemind();
}
DEFAULTPOSTEVENT(PosEvent::s_show_login, "");
}
else if(m_num > 0)
{
hide();
m_raiseTimer.stop();
if(m_bReminding)
{
this->onStopRemind();
}
DEFAULTPOSTEVENT(PosEvent::s_show_pickup, "");
}
else
{
if(ui->widget_back_synshow->isHidden() && m_is_login && ui->widget_front_synshow->isHidden())
{
if(pos().x() > tmpdesktopSize.width() - 2*(ui->widget_base->width()))
{
ui->widget_front_synshow->show();
} else {
ui->widget_back_synshow->show();
}
if(!ui->widget_base_frame->isHidden())
ui->widget_base_frame->hide();
}
else if(!ui->widget_back_synshow->isHidden() && m_is_login)
{
ui->widget_back_synshow->hide();
if(ui->widget_base_frame->isHidden())
ui->widget_base_frame->show();
} else if(!ui->widget_front_synshow->isHidden() && m_is_login) {
ui->widget_front_synshow->hide();
if(ui->widget_base_frame->isHidden())
ui->widget_base_frame->show();
}
}
m_clickTimer.stop();
m_num = 0;
}
m_bMouseMove = false;
ConfigManger::GetInstance().setFloatInitPostion(this->pos());
}
void NewFloatForm::_Init()
{
QSize tmpdesktopSize= QApplication::desktop()->screenGeometry().size();
if(!m_is_login)
tmpdesktopSize-= QSize(ui->widget_base->width(), ui->widget_base->height());
else
tmpdesktopSize-= QSize(this->width(), this->height());
setWindowFlags(this->windowFlags() | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint | Qt::Tool);
setAttribute(Qt::WA_TranslucentBackground);
// setFixedSize(m_imgNormalSize);
// setStyleSheet("#floatWdg{ border-image: url(:float_normal.png); }");
move(ConfigManger::GetInstance().GetFloatInitPostion());
QPoint pos=ConfigManger::GetInstance().GetFloatInitPostion();
if(pos.x()<0)
{
pos.setX(0);
}
if(pos.y()<0)
{
pos.setY(0);
}
if(pos.x()>tmpdesktopSize.width())
{
pos.setX(tmpdesktopSize.width());
}
if(pos.y()>tmpdesktopSize.height())
{
pos.setY(tmpdesktopSize.height());
}
move(pos);
int currentScreenWid = tmpdesktopSize.width();
int currentScreenHei = tmpdesktopSize.height();
double factoryx = currentScreenWid/800.0;
double factoryy = currentScreenHei/600.0;
qDebug() << "******************************9090*************************" <<currentScreenWid << currentScreenHei << factoryx << factoryy;
// resetGrid(this,factoryx,factoryy);
}
void NewFloatForm::_Blink()
{
QSize tmpdesktopSize= QApplication::desktop()->screenGeometry().size();
tmpdesktopSize-= QSize(ui->widget_base->width(), ui->widget_base->height());
QEventLoop loop;
connect(&m_animation, &QPropertyAnimation::finished, &loop, &QEventLoop::quit);
m_animation.setStartValue(1);
m_animation.setEndValue(0);
m_animation.start();
loop.exec();
// this->setFixedSize(m_imgRemindSize);
//ui->floatWdg->setStyleSheet("#floatWdg{ border-image: url(:float_remind.png)}");
//ui->widget_login->show();
qDebug() << pos().x() << "pppp" << tmpdesktopSize.width() - 2*(ui->widget_base->width()) << tmpdesktopSize;
if(pos().x() > tmpdesktopSize.width() - 2*(ui->widget_base->width()))
{
qDebug() <<"table show21------------------------------";
ui->widget_base_frame->hide();
ui->widget_front_synshow->hide();
ui->widget_back_synshow->hide();
ui->widget_front_login->show();
} else {
qDebug() <<"table show22------------------------------";
ui->widget_base_frame->hide();
ui->widget_back_synshow->hide();
ui->widget_front_synshow->hide();
ui->widget_back_login->show();
}
m_animation.setStartValue(0);
m_animation.setEndValue(1);
m_animation.start();
loop.exec();
m_animation.setStartValue(1);
m_animation.setEndValue(0);
m_animation.start();
loop.exec();
// this->setFixedSize(m_imgNormalSize);
//ui->floatWdg->setStyleSheet("#floatWdg{ border-image: url(:float_normal.png)}");
if(pos().x() > tmpdesktopSize.width() - 2*(ui->widget_base->width()))
{
qDebug() <<"table show23------------------------------";
ui->widget_base_frame->hide();
ui->widget_front_synshow->show();
ui->widget_back_synshow->hide();
ui->widget_front_login->hide();
} else {
qDebug() <<"table show24------------------------------";
ui->widget_base_frame->hide();
ui->widget_back_synshow->show();
ui->widget_front_synshow->hide();
ui->widget_back_login->hide();
}
// ui->widget_base->hide();
// ui->widget_back_synshow->show();
// ui->widget_back_login->hide();
m_animation.setStartValue(0);
m_animation.setEndValue(1);
m_animation.start();
loop.exec();
if(m_bReminding)
{
QTimer::singleShot(ConfigManger::GetInstance().GetBlinkInterval(), this, &NewFloatForm::_Blink);
}
}
void NewFloatForm::_PlayWav()
{
//if(m_play_flag == false && m_bReminding == true)
QSound::play(m_remindWav);
if(m_bReminding)
{
QTimer::singleShot(m_wavPlayInterval, this, &NewFloatForm::_PlayWav);
}
}
void NewFloatForm::_UdpRadio(QString songName, int type,int time)
{
QJsonObject json;
json.insert("reqType",type);
json.insert("sound_name",songName);
json.insert("time",time);
static QString ipAddress;
if(ipAddress.isEmpty())
{
QHostInfo info = QHostInfo::fromName(QHostInfo::localHostName());
foreach(QHostAddress address,info.addresses())
{
if(address.protocol() == QAbstractSocket::IPv4Protocol)
{
ipAddress=address.toString();
}
}
}
int port=ConfigManger::GetInstance().GetUdpPort();
QHostAddress mcast_addr(ipAddress.replace(10,3,ConfigManger::GetInstance().GetUdpUrl()));
QLOG_INFO()<<"udp info"<<mcast_addr<<port<<QJsonDocument(json).toJson(QJsonDocument::Compact);
QUdpSocket udp_socket;
//udp_socket.writeDatagram(QJsonDocument(json).toJson(QJsonDocument::Compact), mcast_addr, port);
udp_socket.writeDatagram(QJsonDocument(json).toJson(QJsonDocument::Compact), QHostAddress::Broadcast, port);
udp_socket.waitForBytesWritten();
udp_socket.close();
qDebug()<<__FUNCTION__;
}
void NewFloatForm::onStartRemind(int type)
{
QSize tmpdesktopSize= QApplication::desktop()->screenGeometry().size();
tmpdesktopSize-= QSize(ui->widget_base->width(), ui->widget_base->height());
switch(type)
{
case 0:
m_remindWav = QString("%1/wav/msg.wav").arg(QApplication::applicationDirPath());
// 加上音频的时长
m_wavPlayInterval = ConfigManger::GetInstance().GetSoundInterval() + VALUE_NEWORDERTIME;
if(ui->widget_back_synshow->isHidden() && m_is_login && ui->widget_front_synshow->isHidden())
{
if(pos().x() > tmpdesktopSize.width() - 2*(ui->widget_base->width()))
{
ui->widget_front_synshow->show();
ui->label_front_newmsg->setText(QString::fromLocal8Bit("新订单"));
} else {
ui->widget_back_synshow->show();
ui->label_back_newmsg->setText(QString::fromLocal8Bit("新订单"));
}
if(!ui->widget_base_frame->isHidden())
ui->widget_base_frame->hide();
}
else if(!ui->widget_back_synshow->isHidden() && m_is_login)
{
// ui->widget_back_synshow->hide();
ui->label_back_newmsg->setText(QString::fromLocal8Bit("新订单"));
if(ui->widget_base_frame->isHidden())
ui->widget_base_frame->show();
} else if(!ui->widget_front_synshow->isHidden() && m_is_login) {
// ui->widget_front_synshow->hide();
ui->label_front_newmsg->setText(QString::fromLocal8Bit("新订单"));
if(ui->widget_base_frame->isHidden())
ui->widget_base_frame->show();
}
// ui->label_back_newmsg->setText(QString::fromLocal8Bit("新订单"));
break;
case 1:
m_remindWav = QString("%1/wav/msg1.wav").arg(QApplication::applicationDirPath());
m_wavPlayInterval = ConfigManger::GetInstance().GetSoundInterval() + VALUE_REFUNDORDERTIME;
if(ui->widget_back_synshow->isHidden() && m_is_login && ui->widget_front_synshow->isHidden())
{
if(pos().x() > tmpdesktopSize.width() - 2*(ui->widget_base->width()))
{
ui->widget_front_synshow->show();
ui->label_front_newmsg->setText(QString::fromLocal8Bit("新退单"));
} else {
ui->widget_back_synshow->show();
ui->label_back_newmsg->setText(QString::fromLocal8Bit("新退单"));
}
if(!ui->widget_base_frame->isHidden())
ui->widget_base_frame->hide();
}
else if(!ui->widget_back_synshow->isHidden() && m_is_login)
{
// ui->widget_back_synshow->hide();
ui->label_back_newmsg->setText(QString::fromLocal8Bit("新退单"));
if(ui->widget_base_frame->isHidden())
ui->widget_base_frame->show();
} else if(!ui->widget_front_synshow->isHidden() && m_is_login) {
// ui->widget_front_synshow->hide();
ui->label_front_newmsg->setText(QString::fromLocal8Bit("新退单"));
if(ui->widget_base_frame->isHidden())
ui->widget_base_frame->show();
}
// ui->label_back_newmsg->setText(QString::fromLocal8Bit("新退单"));
break;
case 2:
m_remindWav = QString("%1/wav/msg2.wav").arg(QApplication::applicationDirPath());
m_wavPlayInterval = ConfigManger::GetInstance().GetSoundInterval() + VALUE_REFUNDORDERTIME;
if(ui->widget_back_synshow->isHidden() && m_is_login && ui->widget_front_synshow->isHidden())
{
if(pos().x() > tmpdesktopSize.width() - 2*(ui->widget_base->width()))
{
ui->widget_front_synshow->show();
ui->label_front_newmsg->setText(QString::fromLocal8Bit("网络异常"));
} else {
ui->widget_back_synshow->show();
ui->label_back_newmsg->setText(QString::fromLocal8Bit("网络异常"));
}
if(!ui->widget_base_frame->isHidden())
ui->widget_base_frame->hide();
}
else if(!ui->widget_back_synshow->isHidden() && m_is_login)
{
// ui->widget_back_synshow->hide();
ui->label_back_newmsg->setText(QString::fromLocal8Bit("网络异常"));
if(ui->widget_base_frame->isHidden())
ui->widget_base_frame->show();
} else if(!ui->widget_front_synshow->isHidden() && m_is_login) {
// ui->widget_front_synshow->hide();
ui->label_front_newmsg->setText(QString::fromLocal8Bit("网络异常"));
if(ui->widget_base_frame->isHidden())
ui->widget_base_frame->show();
}
// ui->label_back_newmsg->setText(QString::fromLocal8Bit("网络异常"));
}
if(m_bReminding)
{
return;
}else
{
m_bReminding = true;
}
if(m_remindTimer.isActive())
m_remindTimer.stop();
if(this->isHidden())
m_remindTimer.start(1*1000);
else
m_remindTimer.start(7*24*60*60*1000);
m_remindTimer.setSingleShot(true);
connect(&m_remindTimer, &QTimer::timeout, this, &NewFloatForm::onStopRemind);
_Blink();
_PlayWav();
}
void NewFloatForm::onStopRemind()
{
m_bReminding = false;
//m_play_flag = false;
}
void NewFloatForm::onShow()
{
InitWidget();
show();
m_raiseTimer.start();
}
void NewFloatForm::resetGrid(QDialog *widget, double factorx, double factory)
{
int widgetX = widget->x();
int widgetY = widget->y();
int widgetWid = widget->width();
int widgetHei = widget->height();
int nWidgetWid = (int)(widgetWid*factorx);
int nWidgetHei = (int)(widgetHei*factory);
qDebug() << "----------------------------------------9090-----------------------" << widgetX << widgetY << nWidgetWid << nWidgetHei;
// this->setGeometry(0,0,nWidgetWid,nWidgetHei);
// ui->widget_base->setGeometry(widgetX,widgetY+ui->widget_base->width(),nWidgetWid*(48/144.0),nWidgetHei);
// ui->widget_back_login->setGeometry(0,0,nWidgetWid,nWidgetHei);
// ui->widget_back_synshow->setGeometry(0,0,nWidgetWid,nWidgetHei);
// ui->widget_touch->setGeometry(0,0,nWidgetWid,nWidgetHei);
// widget->setFixedSize(nWidgetWid,nWidgetHei);
this->setFixedSize(nWidgetWid,nWidgetHei);
ui->widget_base_frame->setFixedSize(nWidgetWid,nWidgetHei);
ui->widget_back_login->setFixedSize(nWidgetWid,nWidgetHei);
ui->widget_back_synshow->setFixedSize(nWidgetWid,nWidgetHei);
ui->widget_front_login->setFixedSize(nWidgetWid,nWidgetHei);
ui->widget_front_synshow->setFixedSize(nWidgetWid,nWidgetHei);
ui->widget_touch->setFixedSize(nWidgetWid,nWidgetHei);
//设置label字体大小l
ui->label_back_new->setStyleSheet(QString("#label_back_new{font-size:%1px;}").arg(QString::number((int)(10*factorx))));
ui->label_back_newnum->setStyleSheet(QString("#label_back_newnum{font-size:%1px;}").arg(QString::number((int)(10*factorx))));
ui->label_front_new->setStyleSheet(QString("#label_front_new{font-size:%1px;}").arg(QString::number((int)(10*factorx))));
ui->label_front_newnum->setStyleSheet(QString("#label_front_newnum{font-size:%1px;}").arg(QString::number((int)(10*factorx))));
ui->label_back_refund->setStyleSheet(QString("#label_back_refund{font-size:%1px;}").arg(QString::number((int)(10*factorx))));
ui->label_back_refundnum->setStyleSheet(QString("#label_back_refundnum{font-size:%1px;}").arg(QString::number((int)(10*factorx))));
ui->label_front_refund->setStyleSheet(QString("#label_front_refund{font-size:%1px;}").arg(QString::number((int)(10*factorx))));
ui->label_front_refundnum->setStyleSheet(QString("#label_front_refundnum{font-size:%1px;}").arg(QString::number((int)(10*factorx))));
ui->label_back_newmsg->setStyleSheet(QString("#label_back_newmsg{font-size:%1px;}").arg(QString::number((int)(10*factorx))));
ui->label_front_newmsg->setStyleSheet(QString("#label_front_newmsg{font-size:%1px;}").arg(QString::number((int)(10*factorx))));
}
void NewFloatForm::OnUpdate()
{
m_num++;
}
#ifndef NEWFLOATFORM_H
#define NEWFLOATFORM_H
#include <QDialog>
#include <QMouseEvent>
#include <QTimer>
#include <QSize>
#include <QPropertyAnimation>
#include <QSound>
namespace Ui {
class NewFloatForm;
}
class NewFloatForm : public QDialog
{
Q_OBJECT
public:
explicit NewFloatForm(QWidget *parent = 0);
~NewFloatForm();
virtual bool event(QEvent *e);
protected:
void mouseMoveEvent(QMouseEvent * event);
void mousePressEvent(QMouseEvent * event);
void mouseReleaseEvent(QMouseEvent * event);
private:
QSize desktopSize;
Ui::NewFloatForm *ui;
// 记录左键按下去后是否移动过
bool m_bMouseMove;
// 记录左键是否按下去
bool m_bMousePress;
// 拖动前鼠标坐标
QPoint m_lastMousePos;
// 此次拖动一共移动的距离
QPoint m_absMove;
// 记录正常状态图片的大小
QSize m_imgNormalSize;
// 记录提示状态图片的大小
QSize m_imgRemindSize;
// 记录是否正在提示
bool m_bReminding;
// 闪烁动画
QPropertyAnimation m_animation;
// 记录音频文件
QString m_remindWav;
// 声音的间隔
int m_wavPlayInterval;
// 置顶定时器
QTimer m_raiseTimer;
QTimer m_remindTimer;
//长按悬浮框计时定时器
QTimer m_clickTimer;
//计时1s加1
int m_num;
// 是否登录成功
bool m_is_login;
//停止标识
bool m_play_flag;
//
/* 功能:初始化
* 参数:NULL
* 返回:NULL
* */
void _Init();
/* 功能:界面展示
* 参数:[1] -1界面展示; 0新订单; 1新退单
* 返回:NULL
* */
void InitWidget(int flag = -1);
private slots:
/* 功能:闪烁
* 参数:NULL
* 返回:NULL
* */
void _Blink();
/* 功能:声音
* 参数:NULL
* 返回:NULL
* */
void _PlayWav();
//udp广播声音播控
void _UdpRadio(QString songName, int type, int time);
//悬浮框大小自适应不同屏幕分辨率
void resetGrid(QDialog *widget,double factorx,double factory);
void OnUpdate();
signals:
/* 功能:通知主窗口显示
* 参数:NULL
* 返回:NULL
* */
void showMainForm();
public slots:
/* 功能:开启提示
* 参数:[1]提示类型 0新订单1申请退款
* 返回:NULL
* */
void onStartRemind(int type);
/* 功能:关闭提示
* 参数:NULL
* 返回:NULL
* */
void onStopRemind();
/* 功能:显示窗口
* 参数:NULL
* 返回:NULL
* */
void onShow();
};
#endif // NEWFLOATFORM_H
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>NewFloatForm</class>
<widget class="QDialog" name="NewFloatForm">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>144</width>
<height>48</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<property name="styleSheet">
<string notr="true">#label_front_new,#label_back_new
{
font: 75 10px &quot;黑体&quot;;
color: #0073FF;
}
#label_front_refund,#label_back_refund
{
font: 75 10px &quot;黑体&quot;;
color: #FF000A;
}
#label_front_newnum,#label_back_newnum
{
font: 75 10px &quot;微软雅黑&quot;;
color: #0073FF;
}
#label_front_refundnum,#label_back_refundnum
{
font: 75 10px &quot;微软雅黑&quot;;
color: #FF000A;
}
#widget_base
{
border-image: url(:base_logo.png);
}
/*#widget_back_login
{
border-image: url(:loginlogin.png);
}*/
#widget_back_showmsg
{
border-image: url(:loginlogin.png);
}
#widget_back_login
{
border-image: url(:loginlogin.png);
}
#widget_front_showmsg
{
border-image: url(:loginlogin_back.png);
}
#widget_front_login
{
border-image: url(:loginlogin_back.png);
}
/*#widget_back_synshow
{
border-image: url(:loginlogin.png);
}*/
#label_back_newmsg,#label_front_newmsg
{
font: 10px &quot;微软雅黑&quot;;
color: #FF000A;
}</string>
</property>
<widget class="QWidget" name="widget_base_frame" native="true">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>144</width>
<height>48</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_7" stretch="1,1,1">
<property name="spacing">
<number>0</number>
</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>
<spacer name="horizontalSpacer_7">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>45</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QWidget" name="widget_base" native="true"/>
</item>
<item>
<spacer name="horizontalSpacer_8">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>45</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="widget_touch" native="true">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>144</width>
<height>48</height>
</rect>
</property>
</widget>
<widget class="QWidget" name="widget_back_login" native="true">
<property name="geometry">
<rect>
<x>48</x>
<y>0</y>
<width>96</width>
<height>48</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout" stretch="2,1">
<property name="spacing">
<number>0</number>
</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>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>48</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_back_newmsg">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="widget_front_login" native="true">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>96</width>
<height>48</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2" stretch="1,2">
<property name="spacing">
<number>0</number>
</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>
<widget class="QLabel" name="label_front_newmsg">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>48</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="widget_back_synshow" native="true">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>144</width>
<height>48</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3" stretch="1,2">
<property name="spacing">
<number>0</number>
</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>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>48</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QWidget" name="widget_back_showmsg" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_5" stretch="1,1">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>5</number>
</property>
<property name="rightMargin">
<number>5</number>
</property>
<property name="bottomMargin">
<number>5</number>
</property>
<item>
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>48</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QGridLayout" name="gridLayout">
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label_back_new">
<property name="text">
<string></string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="label_back_newnum">
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_back_refund">
<property name="text">
<string>退</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="label_back_refundnum">
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="widget_front_synshow" native="true">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>144</width>
<height>48</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_4" stretch="2,1">
<property name="spacing">
<number>0</number>
</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>
<widget class="QWidget" name="widget_front_showmsg" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_6" stretch="1,1">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>5</number>
</property>
<property name="topMargin">
<number>5</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>5</number>
</property>
<item>
<layout class="QGridLayout" name="gridLayout_4">
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label_front_new">
<property name="text">
<string></string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="label_front_newnum">
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_front_refund">
<property name="text">
<string>退</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="label_front_refundnum">
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>48</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>48</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
<resources/>
<connections/>
</ui>
...@@ -26,21 +26,34 @@ NewLoginForm::NewLoginForm(QWidget *parent) : ...@@ -26,21 +26,34 @@ NewLoginForm::NewLoginForm(QWidget *parent) :
connect(ui->lineEdit_account_2, &ClickedLineEdit::clicked, this, &NewLoginForm::GetCurrLineEdit); connect(ui->lineEdit_account_2, &ClickedLineEdit::clicked, this, &NewLoginForm::GetCurrLineEdit);
connect(ui->lineEdit_partnerid_2, &ClickedLineEdit::clicked, this, &NewLoginForm::GetCurrLineEdit); connect(ui->lineEdit_partnerid_2, &ClickedLineEdit::clicked, this, &NewLoginForm::GetCurrLineEdit);
connect(ui->lineEdit_pwd_2, &ClickedLineEdit::clicked, this, &NewLoginForm::GetCurrLineEdit); connect(ui->lineEdit_pwd_2, &ClickedLineEdit::clicked, this, &NewLoginForm::GetCurrLineEdit);
connect(ui->lineEdit_posno_2, &ClickedLineEdit::clicked, this, &NewLoginForm::GetCurrLineEdit); // connect(ui->lineEdit_posno_2, &ClickedLineEdit::clicked, this, &NewLoginForm::GetCurrLineEdit);
connect(ui->lineEdit_storeid_2, &ClickedLineEdit::clicked, this, &NewLoginForm::GetCurrLineEdit); connect(ui->lineEdit_storeid_2, &ClickedLineEdit::clicked, this, &NewLoginForm::GetCurrLineEdit);
connect(ui->pushButton_10, &QPushButton::clicked, this, &NewLoginForm::number_btn_click); // connect(ui->pushButton_10, &QPushButton::clicked, this, &NewLoginForm::number_btn_click);
connect(ui->pushButton_11, &QPushButton::clicked, this, &NewLoginForm::number_btn_click); // connect(ui->pushButton_11, &QPushButton::clicked, this, &NewLoginForm::number_btn_click);
connect(ui->pushButton_12, &QPushButton::clicked, this, &NewLoginForm::number_btn_click); // connect(ui->pushButton_12, &QPushButton::clicked, this, &NewLoginForm::number_btn_click);
connect(ui->pushButton_13, &QPushButton::clicked, this, &NewLoginForm::number_btn_click); // connect(ui->pushButton_13, &QPushButton::clicked, this, &NewLoginForm::number_btn_click);
connect(ui->pushButton_14, &QPushButton::clicked, this, &NewLoginForm::number_btn_click); // connect(ui->pushButton_14, &QPushButton::clicked, this, &NewLoginForm::number_btn_click);
connect(ui->pushButton_15, &QPushButton::clicked, this, &NewLoginForm::number_btn_click); // connect(ui->pushButton_15, &QPushButton::clicked, this, &NewLoginForm::number_btn_click);
connect(ui->pushButton_16, &QPushButton::clicked, this, &NewLoginForm::number_btn_click); // connect(ui->pushButton_16, &QPushButton::clicked, this, &NewLoginForm::number_btn_click);
connect(ui->pushButton_17, &QPushButton::clicked, this, &NewLoginForm::number_btn_click); // connect(ui->pushButton_17, &QPushButton::clicked, this, &NewLoginForm::number_btn_click);
connect(ui->pushButton_18, &QPushButton::clicked, this, &NewLoginForm::number_btn_click); // connect(ui->pushButton_18, &QPushButton::clicked, this, &NewLoginForm::number_btn_click);
connect(ui->pushButton_19, &QPushButton::clicked, this, &NewLoginForm::number_btn_click); // connect(ui->pushButton_19, &QPushButton::clicked, this, &NewLoginForm::number_btn_click);
connect(ui->pushButton_clear_2, &QPushButton::clicked, this, &NewLoginForm::number_btn_click); // connect(ui->pushButton_clear_2, &QPushButton::clicked, this, &NewLoginForm::number_btn_click);
connect(ui->pushButton_del_2, &QPushButton::clicked, this, &NewLoginForm::number_btn_click); // connect(ui->pushButton_del_2, &QPushButton::clicked, this, &NewLoginForm::number_btn_click);
connect(ui->pushButton_num0, &QPushButton::clicked, this, &NewLoginForm::number_btn_click);
connect(ui->pushButton_num1, &QPushButton::clicked, this, &NewLoginForm::number_btn_click);
connect(ui->pushButton_num2, &QPushButton::clicked, this, &NewLoginForm::number_btn_click);
connect(ui->pushButton_num3, &QPushButton::clicked, this, &NewLoginForm::number_btn_click);
connect(ui->pushButton_num4, &QPushButton::clicked, this, &NewLoginForm::number_btn_click);
connect(ui->pushButton_num5, &QPushButton::clicked, this, &NewLoginForm::number_btn_click);
connect(ui->pushButton_num6, &QPushButton::clicked, this, &NewLoginForm::number_btn_click);
connect(ui->pushButton_num7, &QPushButton::clicked, this, &NewLoginForm::number_btn_click);
connect(ui->pushButton_num8, &QPushButton::clicked, this, &NewLoginForm::number_btn_click);
connect(ui->pushButton_num9, &QPushButton::clicked, this, &NewLoginForm::number_btn_click);
connect(ui->pushButton_clearBtn, &QPushButton::clicked, this, &NewLoginForm::number_btn_click);
connect(ui->pushButton_delBtn, &QPushButton::clicked, this, &NewLoginForm::number_btn_click);
_curr_lineedit = ui->lineEdit_partnerid_2; _curr_lineedit = ui->lineEdit_partnerid_2;
_curr_lineedit->setFocus(); _curr_lineedit->setFocus();
...@@ -52,9 +65,12 @@ NewLoginForm::NewLoginForm(QWidget *parent) : ...@@ -52,9 +65,12 @@ NewLoginForm::NewLoginForm(QWidget *parent) :
QString configfile = qApp->applicationDirPath() + "/" + CONFIG_NAME; QString configfile = qApp->applicationDirPath() + "/" + CONFIG_NAME;
m_autologin = QSettings(configfile, QSettings::IniFormat).value(INI_AUTOLOGIN, 0).toInt(); m_autologin = QSettings(configfile, QSettings::IniFormat).value(INI_AUTOLOGIN, 0).toInt();
m_rememberPwd = QSettings(configfile, QSettings::IniFormat).value(INI_REMEMBERPWD, 0).toInt();
if(m_autologin) if(m_autologin)
ui->checkBox_2->setChecked(true); ui->checkBox_2->setChecked(true);
if(m_rememberPwd)
ui->checkBox_rememberPwd->setChecked(true);
FMApplication::subscibeEvent(this, PosEvent::s_login_status); FMApplication::subscibeEvent(this, PosEvent::s_login_status);
FMApplication::subscibeEvent(this, PosEvent::s_opt_status); FMApplication::subscibeEvent(this, PosEvent::s_opt_status);
...@@ -96,9 +112,12 @@ void NewLoginForm::SetStoreInfo() ...@@ -96,9 +112,12 @@ void NewLoginForm::SetStoreInfo()
ui->lineEdit_partnerid_2->setText(partnerid); ui->lineEdit_partnerid_2->setText(partnerid);
ui->lineEdit_storeid_2->setText(storeid); ui->lineEdit_storeid_2->setText(storeid);
ui->lineEdit_posno_2->setText(stationid); // ui->lineEdit_posno_2->setText(stationid);
ui->lineEdit_account_2->setText(userid); ui->lineEdit_account_2->setText(userid);
ui->lineEdit_pwd_2->setText(pwd); ui->lineEdit_pwd_2->setText(pwd);
if(ui->checkBox_rememberPwd->isChecked())
ui->lineEdit_pwd_2->setText(pwd);
} }
void NewLoginForm::showfull() void NewLoginForm::showfull()
...@@ -202,14 +221,21 @@ void NewLoginForm::on_pushButton_login_2_clicked() ...@@ -202,14 +221,21 @@ void NewLoginForm::on_pushButton_login_2_clicked()
else else
QSettings(configfile, QSettings::IniFormat).setValue(INI_AUTOLOGIN, 0); QSettings(configfile, QSettings::IniFormat).setValue(INI_AUTOLOGIN, 0);
if(ui->checkBox_rememberPwd->isChecked())
QSettings(configfile, QSettings::IniFormat).setValue(INI_REMEMBERPWD, 1);
else
QSettings(configfile, QSettings::IniFormat).setValue(INI_REMEMBERPWD, 0);
QLOG_DEBUG() << "configfile" << configfile; QLOG_DEBUG() << "configfile" << configfile;
QVariantMap map; QVariantMap map;
if(ui->lineEdit_pwd_2->text().isEmpty())
return;
if(ui->lineEdit_account_2->text().isEmpty() || if(ui->lineEdit_account_2->text().isEmpty() ||
ui->lineEdit_pwd_2->text().isEmpty() || ui->lineEdit_pwd_2->text().isEmpty() ||
ui->lineEdit_partnerid_2->text().isEmpty() || ui->lineEdit_partnerid_2->text().isEmpty() ||
ui->lineEdit_posno_2->text().isEmpty() || /*ui->lineEdit_posno_2->text().isEmpty() ||*/
ui->lineEdit_storeid_2->text().isEmpty() ) ui->lineEdit_storeid_2->text().isEmpty() )
{ {
onShowAlert(AlertForm::ERROR, QString::fromLocal8Bit("商户号/门店号/POS编号/账号/密码均不能为空")); onShowAlert(AlertForm::ERROR, QString::fromLocal8Bit("商户号/门店号/POS编号/账号/密码均不能为空"));
...@@ -217,7 +243,7 @@ void NewLoginForm::on_pushButton_login_2_clicked() ...@@ -217,7 +243,7 @@ void NewLoginForm::on_pushButton_login_2_clicked()
} }
map.insert(JSON_STOREID, ui->lineEdit_storeid_2->text()); map.insert(JSON_STOREID, ui->lineEdit_storeid_2->text());
map.insert(JSON_STATIONID, ui->lineEdit_posno_2->text()); // map.insert(JSON_STATIONID, ui->lineEdit_posno_2->text());
map.insert(JSON_KEY_USERID, ui->lineEdit_account_2->text()); map.insert(JSON_KEY_USERID, ui->lineEdit_account_2->text());
map.insert(JSON_KEY_PWD, ui->lineEdit_pwd_2->text()); map.insert(JSON_KEY_PWD, ui->lineEdit_pwd_2->text());
map.insert(JSON_KEY_PARTNERID, ui->lineEdit_partnerid_2->text()); map.insert(JSON_KEY_PARTNERID, ui->lineEdit_partnerid_2->text());
...@@ -249,11 +275,13 @@ void NewLoginForm::number_btn_click() ...@@ -249,11 +275,13 @@ void NewLoginForm::number_btn_click()
{ {
QPushButton *btn = qobject_cast<QPushButton*>(sender()); QPushButton *btn = qobject_cast<QPushButton*>(sender());
if(btn == ui->pushButton_clear_2) // if(btn == ui->pushButton_clear_2)
if(btn == ui->pushButton_clearBtn)
{ {
_curr_lineedit->clear(); _curr_lineedit->clear();
} }
else if(btn == ui->pushButton_del_2) // else if(btn == ui->pushButton_del_2)
else if(btn == ui->pushButton_delBtn)
{ {
QString text = _curr_lineedit->text(); QString text = _curr_lineedit->text();
......
...@@ -49,7 +49,11 @@ private: ...@@ -49,7 +49,11 @@ private:
// 通知窗口 // 通知窗口
AlertForm *m_alertForm; AlertForm *m_alertForm;
//自动登录标志位
int m_autologin; int m_autologin;
//记住密码标志位
int m_rememberPwd;
}; };
#endif // NEWLOGINFORM_H #endif // NEWLOGINFORM_H
...@@ -50,6 +50,7 @@ NewMainForm::NewMainForm(QWidget *parent) : ...@@ -50,6 +50,7 @@ NewMainForm::NewMainForm(QWidget *parent) :
FMApplication::subscibeEvent(this, PosEvent::s_network_outtime); FMApplication::subscibeEvent(this, PosEvent::s_network_outtime);
FMApplication::subscibeEvent(this, PosEvent::s_show_stalls); FMApplication::subscibeEvent(this, PosEvent::s_show_stalls);
FMApplication::subscibeEvent(this,PosEvent::s_driver_order_status); FMApplication::subscibeEvent(this,PosEvent::s_driver_order_status);
FMApplication::subscibeEvent(this,PosEvent::s_show_pickup);
//this->show(); //this->show();
this->showFullScreen(); this->showFullScreen();
...@@ -515,7 +516,8 @@ void NewMainForm::ClassifyOrderWithOrderStatus(int order_status) ...@@ -515,7 +516,8 @@ void NewMainForm::ClassifyOrderWithOrderStatus(int order_status)
void NewMainForm::InitMainBtn() void NewMainForm::InitMainBtn()
{ {
ui->newmainbtn_order->SetText("\xE8\xAE\xA2\xE5\x8D\x95\xE7\xAE\xA1\xE7\x90\x86", MAIN_ORDER); ui->newmainbtn_order->SetText("\xE8\xAE\xA2\xE5\x8D\x95\xE7\xAE\xA1\xE7\x90\x86", MAIN_ORDER);
ui->newmainbtn_refund->SetText("\xE9\x80\x80\xE5\x8D\x95", MAIN_REFUND); // ui->newmainbtn_refund->SetText("\xE9\x80\x80\xE5\x8D\x95", MAIN_REFUND);
ui->newmainbtn_refund->SetText("\xE9\x80\x80\xE5\x8D\x95\x28\x30\x29", MAIN_REFUND);
ui->newmainbtn_shifts->SetText("\xE4\xBA\xA4\xE6\x8E\xA5\xE7\x8F\xAD", MAIN_SHIFT); ui->newmainbtn_shifts->SetText("\xE4\xBA\xA4\xE6\x8E\xA5\xE7\x8F\xAD", MAIN_SHIFT);
ui->newmainbtn_set->SetText("\xE8\xAE\xBE\xE7\xBD\xAE", MAIN_SET); ui->newmainbtn_set->SetText("\xE8\xAE\xBE\xE7\xBD\xAE", MAIN_SET);
ui->newmainbtn_scan->SetText("\xE6\x89\xAB\xE7\xA0\x81\xE5\x8F\x96\xE9\xA4\x90", MAIN_SCAN); ui->newmainbtn_scan->SetText("\xE6\x89\xAB\xE7\xA0\x81\xE5\x8F\x96\xE9\xA4\x90", MAIN_SCAN);
...@@ -602,6 +604,21 @@ bool NewMainForm::event(QEvent *e) ...@@ -602,6 +604,21 @@ bool NewMainForm::event(QEvent *e)
InsertTableWidget(order); InsertTableWidget(order);
} }
int tk_new = 0, tk_make = 0, tk_send = 0, tk_refund = 0;
int self_new = 0, self_make = 0, self_refund = 0;
PosOrderPool::GetOrderNum(tk_new, tk_make, tk_send, tk_refund, self_new, self_make, self_refund);
QLOG_DEBUG() << "tk_new" << tk_new << "tk_make" << tk_make << "tk_send" << tk_send << "self_new" << self_new << "self_make" << self_make;
QLOG_DEBUG() << "tk_refund" << tk_refund << "self_refund" << self_refund;
foreach (auto var, _main_btn) {
if(var->getMainBtnType().compare("refund",Qt::CaseInsensitive) == 0)
{
var->SetText((QString::fromUtf8("\xE9\x80\x80\xE5\x8D\x95") + QString("(%1)").arg(QString::number(tk_refund + self_refund))), MAIN_REFUND);
}
}
return true; return true;
} }
...@@ -663,6 +680,22 @@ bool NewMainForm::event(QEvent *e) ...@@ -663,6 +680,22 @@ bool NewMainForm::event(QEvent *e)
DeleteTableWidget(value[EVENT_KEY_ORDERID].toString()); DeleteTableWidget(value[EVENT_KEY_ORDERID].toString());
_order_indexs.remove(value[EVENT_KEY_ORDERID].toString()); _order_indexs.remove(value[EVENT_KEY_ORDERID].toString());
} }
int tk_new = 0, tk_make = 0, tk_send = 0, tk_refund = 0;
int self_new = 0, self_make = 0, self_refund = 0;
PosOrderPool::GetOrderNum(tk_new, tk_make, tk_send, tk_refund, self_new, self_make, self_refund);
QLOG_DEBUG() << "tk_new" << tk_new << "tk_make" << tk_make << "tk_send" << tk_send << "self_new" << self_new << "self_make" << self_make;
QLOG_DEBUG() << "tk_refund" << tk_refund << "self_refund" << self_refund;
foreach (auto var, _main_btn) {
if(var->getMainBtnType().compare("refund",Qt::CaseInsensitive) == 0)
{
var->SetText((QString::fromUtf8("\xE9\x80\x80\xE5\x8D\x95") + QString("(%1)").arg(QString::number(tk_refund + self_refund))), MAIN_REFUND);
}
}
return true; return true;
} }
...@@ -740,6 +773,13 @@ bool NewMainForm::event(QEvent *e) ...@@ -740,6 +773,13 @@ bool NewMainForm::event(QEvent *e)
return true; return true;
} }
if(e->type() == PosEvent::s_show_pickup)
{
this->showFullScreen();
InitWidget(MAIN_SCAN);
return true;
}
return QWidget::event(e); return QWidget::event(e);
} }
......
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