Commit 918e3391 by 刘帅

1. 实现支付过程中弹出、隐藏界面功能

parents
# This file is used to ignore files which are generated
# ----------------------------------------------------------------------------
*~
*.autosave
*.a
*.core
*.moc
*.o
*.obj
*.orig
*.rej
*.so
*.so.*
*_pch.h.cpp
*_resource.rc
*.qm
.#*
*.*#
core
!core/
tags
.DS_Store
*.debug
Makefile*
*.prl
*.app
moc_*.cpp
ui_*.h
qrc_*.cpp
Thumbs.db
*.res
*.rc
/.qmake.cache
/.qmake.stash
*.manifest
# qtcreator generated files
*.pro.user*
# xemacs temporary files
*.flc
# Vim temporary files
.*.swp
# Visual Studio generated files
*.ib_pdb_index
*.idb
*.ilk
*.pdb
*.sln
*.suo
*.vcproj
*vcproj.*.*.user
*.ncb
*.sdf
*.opensdf
*.vcxproj
*vcxproj.*
# MinGW generated files
*.Debug
*.Release
# Python byte code
*.pyc
# Binaries
# --------
#-------------------------------------------------
#
# Project created by QtCreator 2017-12-12T18:08:21
#
#-------------------------------------------------
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = FmclientUi
TEMPLATE = app
LIBS += -L$$PWD/lib/
DESTDIR = $$PWD/bin
win32 {
LIBS += -lfmcrypt
}
SOURCES += main.cpp\
widget.cpp \
qfmclient.cpp
HEADERS += widget.h \
fmcrypt.h \
qfmclient.h
FORMS += widget.ui
File added
#ifndef __ZHCRYPT_H__
#define __ZHCRYPT_H__
extern "C" {
int ZH_getKey(char * keyBuf, char * ctrlBuf, void * pvInfo);
char * ZH_encodeSendData(char * codeBuf, char * buf, int length, int * eLength, char * keyBuf, int keyLengh);
char * ZH_decodeRecvData(char * codeBuf, char * buf, int length, int * dLength, char * keyBuf, int keyLength, int * pcurKeyPos);
int ZH_encodeBkData(char * pOrgData, int dataLen, char * keyBuf, int keyLen, char * pCodeBuf);
void ZH_decodeBkData(char * pCodeBuf, char * pOrgBuf,int totalLen);
int ZH_checkChkValue(char * pJsonData, int dLength, int tbckValue);
}
#endif
File added
#include "widget.h"
#include <QApplication>
#include "qfmclient.h"
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
Widget w;
QFmClient client;
QObject::connect(&client,&QFmClient::HideUi, &w, &Widget::hide,Qt::QueuedConnection);
QObject::connect(&client,&QFmClient::ShowUi, &w, &Widget::show,Qt::QueuedConnection);
client.start();
return a.exec();
}
This diff is collapsed. Click to expand it.
#ifndef QFMCLIENT_H
#define QFMCLIENT_H
#include <QThread>
#include <windows.h>
#include <QTextStream>
#define MAX_CODE_KEY 32
#define MAX_CTRL_INFO_LEN 16
#define MAX_BUF_LEN 4096
#define MAX_REQ_COUNT 25600
#define ROLL_BACK_FILE_NAME "fmclient.rbk"
class QFmClient : public QThread
{
Q_OBJECT
public:
QFmClient(QObject *parent = NULL);
void run();
void quit();
bool Init(QString proxy_IP, unsigned short proxy_port, unsigned short listen_prot, unsigned short long_timeout, unsigned short short_timeout);
signals:
void Error(QString error);
void HideUi();
void ShowUi();
private:
void CloseSocket(int *sock);
void GetKey();
bool StartListenport();
void CheckRollBackData();
int Try2ConnectZhProxy();
int SendCtrlInfo2Proxy();
void WaitAndSleep(int elapse);
bool WaitForConnectReqFromPos();
int ProcessPosReqData(QJsonObject& object);
void AddReqCount(QJsonObject &object);
int CheckIsCompleteJsonData(int *count, char *data);
int RecvSockData(int sock, char *buffer, int length);
int WaitAndReadDataFromPos(int type, int flag);
char *DecodeRecvData(char *buf, int length, int *dLength);
int UTF8ToGBK(unsigned char *lpUTF8Str, unsigned char *lpGBKStr, int nGBKStrLen);
int GBKToUTF8(unsigned char *lpGBKStr, int gbkLen, unsigned char *lpUTF8Str, int nUTF8StrLen);
int CheckReqFromPos(char *pJsonData, int dLength, int chkValue);
int SendSocketData(int sock, char *buf, int length, int flag);
char *EncodeSendData(char *buf, int length, int *eLength);
int SendData2ZhProxyAndWaitRspData();
int RecvAndCheckDataFromSock(int sock, int flag, int type);
int ProcessZhProxyRspDataAndSend2Pos();
int CheckRecvedData();
void BackupPosReq(char *req);
private:
bool _endflag;
char _recvbuf[MAX_BUF_LEN];
char _tempbuf[MAX_BUF_LEN];
char _sendbuf[MAX_BUF_LEN];
char _codeBuf[MAX_BUF_LEN];
unsigned char _codeKey[MAX_CODE_KEY];
//proxy IP
char _proxyIP[30];
//proxy 端口
unsigned short _proxyPort;
//QFMClient监听端口
unsigned short _clientPort;
//应用层分段大小(1024)
unsigned int _fmMSS;
//监听本地端口的socket
int _listenSock;
//接收pos请求的socket
int _acceptedSock;
//和proxy交互的socket
int _zhProxySock;
//接收数据长度
int _rcvLength;
//长超时
unsigned short _longTimeOut;
//短超时
unsigned short _shortTimeOut;
//当前使用超时
unsigned short _sockTimeOut;
char _keyLength;
char _curKeyPos;
char _codeFlag;
char _reserved;
static unsigned int s_reqCount;
};
#endif // QFMCLIENT_H
#include "widget.h"
#include "ui_widget.h"
#include <QPixmap>
#include <QPropertyAnimation>
Widget::Widget(QWidget *parent) :
QWidget(parent),
ui(new Ui::Widget)
{
ui->setupUi(this);
this->setWindowFlags(Qt::FramelessWindowHint);
this->setAttribute(Qt::WA_TranslucentBackground);
animation = new QPropertyAnimation(ui->label_wait_time_11, "pos");
animation->setStartValue(QPoint(0,1));
animation->setDuration(1000);
animation->setEndValue(QPoint(150,1));
animation->start();
QObject::connect(animation,SIGNAL(finished()),this,SLOT(move()));
}
Widget::~Widget()
{
delete ui;
}
void Widget::move()
{
if(ui->label_wait_time_11->pos().x() == 0)
{
animation->setStartValue(QPoint(0,1));
animation->setDuration(1000);
animation->setEndValue(QPoint(150,1));
animation->start();
}
else
{
animation->setStartValue(QPoint(150,1));
animation->setDuration(1000);
animation->setEndValue(QPoint(0,1));
animation->start();
}
}
#ifndef WIDGET_H
#define WIDGET_H
#include <QWidget>
#include <QPropertyAnimation>
namespace Ui {
class Widget;
}
class Widget : public QWidget
{
Q_OBJECT
public:
explicit Widget(QWidget *parent = 0);
~Widget();
protected slots:
void move();
private:
Ui::Widget *ui;
QPropertyAnimation *animation;
};
#endif // WIDGET_H
This diff is collapsed. Click to expand it.
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