Commit d305132f by 刘帅

1. 修改ui背景颜色;

2. 参数从*.cfg文件中读取
parent 166c7c5b
...@@ -69,4 +69,6 @@ Thumbs.db ...@@ -69,4 +69,6 @@ Thumbs.db
# Binaries # Binaries
# -------- # --------
*.exe *.exe
log/ /bin/*
!/bin/*.txt
...@@ -8,16 +8,21 @@ QT += core gui ...@@ -8,16 +8,21 @@ QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = FmclientUi TARGET = fmclient
TEMPLATE = app TEMPLATE = app
LIBS += -L$$PWD/lib/ LIBS += -L$$PWD/lib/
DESTDIR = $$PWD/bin LIBS += -lfmcrypt
include(./QsLog/QsLog.pri) include(./QsLog/QsLog.pri)
win32 { CONFIG(debug, debug|release){
LIBS += -lfmcrypt DESTDIR = $$PWD/bin/debug
} }else
{
DESTDIR = $$PWD/bin/release
}
SOURCES += main.cpp\ SOURCES += main.cpp\
widget.cpp \ widget.cpp \
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include <Qdebug> #include <Qdebug>
#include <QApplication> #include <QApplication>
#include <QWidget> #include <QWidget>
#include <QDir>
#include "QsLog/QsLog.h" #include "QsLog/QsLog.h"
#ifdef WIN32 #ifdef WIN32
...@@ -30,7 +31,7 @@ ...@@ -30,7 +31,7 @@
#endif #endif
unsigned int QFmClient::s_reqCount = 0; unsigned int QFmClient::s_reqCount = 0;
#define CONFIGURE_FILE_NAME "fmclient.cfg"
QFmClient::QFmClient(QObject *parent) : QThread(parent) QFmClient::QFmClient(QObject *parent) : QThread(parent)
{ {
...@@ -40,6 +41,47 @@ QFmClient::QFmClient(QObject *parent) : QThread(parent) ...@@ -40,6 +41,47 @@ QFmClient::QFmClient(QObject *parent) : QThread(parent)
bool QFmClient::Init(QString proxy_IP, unsigned short proxy_port, unsigned short listen_prot, unsigned short long_timeout, unsigned short short_timeout) bool QFmClient::Init(QString proxy_IP, unsigned short proxy_port, unsigned short listen_prot, unsigned short long_timeout, unsigned short short_timeout)
{ {
QString fileName = qApp->applicationDirPath();
fileName.append(QDir::separator());
fileName.append(CONFIGURE_FILE_NAME);
FILE* cfgFile = fopen(fileName.toStdString().c_str(),"rt");
unsigned int value = 0;
int rlt = 0;
char proxyIp[30];
char clientVerInfo[32];
if(0 == cfgFile)
{
QLOG_ERROR()<<"open cfg file failed!\r\n";
return false;
}
rlt = fscanf(cfgFile, "%s", clientVerInfo);
rlt = fscanf(cfgFile, "%u", &value);
//changeCount = value;
rlt = fscanf(cfgFile, "%s", proxyIp);
proxy_IP = proxyIp;
rlt = fscanf(cfgFile, "%u", &value);
listen_prot = value;
rlt = fscanf(cfgFile, "%u", &value);
proxy_port = value;
rlt = fscanf(cfgFile, "%u", &value);
long_timeout = value;
rlt = fscanf(cfgFile, "%u", &value);
short_timeout = value;
rlt = fscanf(cfgFile, "%u", &value);
_codeFlag = (char)value;
fclose(cfgFile);
cfgFile = 0;
if(proxy_IP.size() == 0 || if(proxy_IP.size() == 0 ||
proxy_port <= 0 || proxy_port <= 0 ||
...@@ -691,8 +733,9 @@ void QFmClient::run() ...@@ -691,8 +733,9 @@ void QFmClient::run()
{ {
if(!Init("115.159.63.201", 29534, 34952, 30, 5)) if(!Init("115.159.63.201", 29534, 34952, 30, 5))
{ {
qDebug() << "Init QFmClient failed"; qDebug() << "Init failed!";
emit Error("Init QFmClient failed"); emit Error("Init failed!");
return;
} }
else else
qDebug() << "Init QFmClient success."; qDebug() << "Init QFmClient success.";
...@@ -876,7 +919,7 @@ void QFmClient::CheckRollBackData() ...@@ -876,7 +919,7 @@ void QFmClient::CheckRollBackData()
} }
qDebug() << "need to roll back data...\r\n"; qDebug() << "need to roll back data...\r\n";
QLOG_INFO() << "need to roll back data...\r\n";
fseek(file, 0, SEEK_SET); fseek(file, 0, SEEK_SET);
fseek(file, 0, SEEK_END); fseek(file, 0, SEEK_END);
...@@ -898,9 +941,6 @@ void QFmClient::CheckRollBackData() ...@@ -898,9 +941,6 @@ void QFmClient::CheckRollBackData()
memset(_sendbuf, 0, MAX_BUF_LEN); memset(_sendbuf, 0, MAX_BUF_LEN);
ZH_decodeBkData(_codeBuf, _sendbuf, readLen); ZH_decodeBkData(_codeBuf, _sendbuf, readLen);
//qDebug() << "rollback data:" << _sendbuf;
qDebug() << "\r\n";
QByteArray senddata(_sendbuf); QByteArray senddata(_sendbuf);
QJsonParseError json_error; QJsonParseError json_error;
...@@ -923,6 +963,7 @@ void QFmClient::CheckRollBackData() ...@@ -923,6 +963,7 @@ void QFmClient::CheckRollBackData()
qDebug() << "rollback data:" << _sendbuf; qDebug() << "rollback data:" << _sendbuf;
qDebug() << "\r\n"; qDebug() << "\r\n";
QLOG_INFO() << "rollback data:" << _sendbuf << "\r\n";
do do
{ {
...@@ -931,21 +972,21 @@ void QFmClient::CheckRollBackData() ...@@ -931,21 +972,21 @@ void QFmClient::CheckRollBackData()
if (0 != Try2ConnectZhProxy()) if (0 != Try2ConnectZhProxy())
{ {
qDebug() << "roll back data: connect ZH Proxy failed, will try after 5 seconds...\r\n"; qDebug() << "roll back data: connect ZH Proxy failed, will try after 5 seconds...\r\n";
QLOG_INFO() << "roll back data: connect ZH Proxy failed, will try after 5 seconds...\r\n";
continue; continue;
} }
if (0 != SendCtrlInfo2Proxy()) if (0 != SendCtrlInfo2Proxy())
{ {
qDebug() << "roll back data: send ctrl info 2 ZH Proxy failed, will try after 5 seconds...\r\n"; qDebug() << "roll back data: send ctrl info 2 ZH Proxy failed, will try after 5 seconds...\r\n";
QLOG_INFO() << "roll back data: send ctrl info 2 ZH Proxy failed, will try after 5 seconds...\r\n";
continue; continue;
} }
if (0 != SendData2ZhProxyAndWaitRspData()) if (0 != SendData2ZhProxyAndWaitRspData())
{ {
qDebug() << "roll back data: send data to proxy fail, will try after 5 seconds...\r\n"; qDebug() << "roll back data: send data to proxy fail, will try after 5 seconds...\r\n";
QLOG_INFO() << "roll back data: send data to proxy fail, will try after 5 seconds...\r\n";
continue; continue;
} }
...@@ -953,7 +994,7 @@ void QFmClient::CheckRollBackData() ...@@ -953,7 +994,7 @@ void QFmClient::CheckRollBackData()
}while(1); }while(1);
qDebug() << "roll back ok!\r\n"; qDebug() << "roll back ok!\r\n";
QLOG_INFO() << "roll back ok!\r\n";
CloseSocket(&_zhProxySock); CloseSocket(&_zhProxySock);
remove(filename.toStdString().c_str()); remove(filename.toStdString().c_str());
......
...@@ -45,23 +45,23 @@ ...@@ -45,23 +45,23 @@
#widget_wait_time_11 #widget_wait_time_11
{ {
border: 1px solid; border: 1px solid;
border-color: #FFD700; border-color: #FFC300;
border-radius: 10px; border-radius: 8px;
} }
#widget_wait_main_11 #widget_wait_main_11
{ {
font: 9pt &quot;Agency FB&quot;; font: 9pt &quot;Agency FB&quot;;
background-color: rgb(255, 255, 255); background-color: rgb(225, 225, 225);
border-radius:15px border-radius:15px
} }
#label_wait_time_11 #label_wait_time_11
{ {
background-color:#32CD32; background-color:#32CD32;
border-radius: 10px; border-radius: 8px;
min-width: 49px; min-height:23px; min-width: 49px; min-height:17px;
max-width: 49px; max-height:23px; max-width: 49px; max-height:17px;
} }
#label_wait_msg_11 #label_wait_msg_11
...@@ -170,31 +170,6 @@ ...@@ -170,31 +170,6 @@
</spacer> </spacer>
</item> </item>
<item> <item>
<widget class="QLabel" name="label_wait_title_11">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true">#label_wait_title
{
font: 75 25px &quot;Microsoft YaHei UI Light&quot;;
}</string>
</property>
<property name="text">
<string>扫描成功 正在支付中</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_75"> <spacer name="verticalSpacer_75">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
...@@ -230,6 +205,31 @@ ...@@ -230,6 +205,31 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLabel" name="label_wait_title_11">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true">#label_wait_title
{
font: 75 25px &quot;Microsoft YaHei UI Light&quot;;
}</string>
</property>
<property name="text">
<string>扫描成功 正在支付中</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_76"> <spacer name="verticalSpacer_76">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
...@@ -284,20 +284,20 @@ ...@@ -284,20 +284,20 @@
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>200</width> <width>200</width>
<height>25</height> <height>19</height>
</size> </size>
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>200</width> <width>200</width>
<height>25</height> <height>19</height>
</size> </size>
</property> </property>
<property name="styleSheet"> <property name="styleSheet">
<string notr="true">#Widget <string notr="true">#Widget
{ {
border: 1px solid #FF00FF; border: 1px solid #FF00FF;
border-radius: 5px; border-radius: 10px;
}</string> }</string>
</property> </property>
<widget class="QLabel" name="label_wait_time_11"> <widget class="QLabel" name="label_wait_time_11">
...@@ -306,19 +306,19 @@ ...@@ -306,19 +306,19 @@
<x>1</x> <x>1</x>
<y>1</y> <y>1</y>
<width>49</width> <width>49</width>
<height>23</height> <height>17</height>
</rect> </rect>
</property> </property>
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>49</width> <width>49</width>
<height>23</height> <height>17</height>
</size> </size>
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>49</width> <width>49</width>
<height>23</height> <height>17</height>
</size> </size>
</property> </property>
<property name="styleSheet"> <property name="styleSheet">
...@@ -330,6 +330,8 @@ ...@@ -330,6 +330,8 @@
min-width: 64px; min-height:64px; min-width: 64px; min-height:64px;
max-width: 64px; max-height:64px; max-width: 64px; max-height:64px;
border-radius:10px;
} }
</string> </string>
</property> </property>
......
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