Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
FmclientUi
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
shuai.liu
FmclientUi
Commits
9f2329d1
Commit
9f2329d1
authored
Nov 19, 2018
by
Carwyn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1. 添加McD 扫码退款功能
parent
7a2db306
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
172 additions
and
45 deletions
+172
-45
bin/release/fmclient.cfg
+1
-1
main.cpp
+6
-1
qfmclient.cpp
+24
-1
qfmclient.h
+7
-3
scanner.cpp
+35
-14
scanner.h
+11
-2
scanner.ui
+86
-21
widget.cpp
+1
-1
widget.h
+1
-1
No files found.
bin/release/fmclient.cfg
View file @
9f2329d1
...
...
@@ -2,7 +2,7 @@
1
115.159.63.201
34952
2
9535
2
6666
30
30
1
...
...
main.cpp
View file @
9f2329d1
...
...
@@ -4,6 +4,8 @@
#include "app_single.h"
#include "log.h"
#include "scanner.h"
int
main
(
int
argc
,
char
*
argv
[])
{
QApplication
a
(
argc
,
argv
);
...
...
@@ -15,9 +17,12 @@ int main(int argc, char *argv[])
InitLogger
();
QLOG_INFO
()
<<
"start FmclientUi..."
;
Widget
w
;
scanner
s
;
QFmClient
client
;
QObject
::
connect
(
&
client
,
&
QFmClient
::
HideUi
,
&
w
,
&
Widget
::
hide
,
Qt
::
QueuedConnection
);
QObject
::
connect
(
&
client
,
&
QFmClient
::
ShowUi
,
&
w
,
&
Widget
::
showTop
,
Qt
::
QueuedConnection
);
QObject
::
connect
(
&
client
,
&
QFmClient
::
ShowUi
,
&
w
,
&
Widget
::
showRequesting
,
Qt
::
QueuedConnection
);
QObject
::
connect
(
&
client
,
&
QFmClient
::
ShowRefundUi
,
&
s
,
&
scanner
::
showRefund
);
QObject
::
connect
(
&
s
,
SIGNAL
(
fetched
(
QString
)),
&
client
,
SLOT
(
SetTransactionId
(
QString
)));
QObject
::
connect
(
&
client
,
&
QFmClient
::
finished
,
&
a
,
&
a
.
quit
);
client
.
start
();
return
a
.
exec
();
...
...
qfmclient.cpp
View file @
9f2329d1
...
...
@@ -10,9 +10,12 @@
#include <QApplication>
#include <QWidget>
#include <QDir>
#include <QTimer>
#include "QsLog/QsLog.h"
#include "utility.h"
#include "scanner.h"
#ifdef WIN32
#include <direct.h>
#include <windows.h>
...
...
@@ -779,9 +782,13 @@ void QFmClient::BackupPosReq(char * req)
}
}
QString
QFmClient
::
GetInputfmId
(
)
void
QFmClient
::
SetTransactionId
(
QString
fmId
)
{
_refundTransId
.
clear
();
_refundTransId
=
fmId
;
emit
ContinueRefund
();
}
void
QFmClient
::
run
()
...
...
@@ -846,6 +853,22 @@ void QFmClient::run()
emit
ShowUi
();
}
if
(
reqtype
==
52
&&
(
!
object
.
contains
(
"fmId"
)
||
object
[
"fmId"
].
isNull
()))
{
emit
ShowRefundUi
();
QEventLoop
evt
;
QTimer
t
(
this
);
connect
(
&
t
,
SIGNAL
(
timeout
()),
&
evt
,
SLOT
(
quit
()));
t
.
start
(
30000
);
connect
(
this
,
SIGNAL
(
ContinueRefund
()),
&
evt
,
SLOT
(
quit
()));
evt
.
exec
();
object
[
"fmId"
]
=
_refundTransId
;
if
(
!
object
.
contains
(
"station_id"
))
{
//! 给到客户的文档中, 缺少 station_id 字段
object
[
"station_id"
]
=
"1"
;
}
QLOG_ERROR
()
<<
"refund fmId: "
<<
_refundTransId
;
}
if
(
0
!=
Try2ConnectZhProxy
())
{
qDebug
()
<<
"connect to proxy failed"
;
...
...
qfmclient.h
View file @
9f2329d1
...
...
@@ -21,11 +21,13 @@ public:
void
quit
();
bool
Init
(
QString
proxy_IP
,
unsigned
short
proxy_port
,
unsigned
short
listen_prot
,
unsigned
short
long_timeout
,
unsigned
short
short_timeout
);
signals
:
signals
:
void
Error
(
QString
error
);
void
HideUi
();
void
ShowUi
();
void
ShowRefundUi
();
void
ContinueRefund
();
private
:
void
CloseSocket
(
int
*
sock
);
void
GetKey
();
...
...
@@ -51,7 +53,9 @@ private:
int
ProcessZhProxyRspDataAndSend2Pos
();
int
CheckRecvedData
();
void
BackupPosReq
(
char
*
req
);
QString
GetInputfmId
();
//退款流程1, 从输入获取长码
public
slots
:
void
SetTransactionId
(
QString
fmId
);
//退款流程1, 从输入获取长码
private
:
...
...
@@ -98,7 +102,7 @@ private:
char
_reserved
;
QString
_refundTransId
;
static
unsigned
int
s_reqCount
;
};
...
...
scanner.cpp
View file @
9f2329d1
#include "scanner.h"
#include "ui_scanner.h"
#include <QPainter>
#include <Windows.h>
#include <QDebug>
scanner
::
scanner
(
QWidget
*
parent
)
:
Q
Widget
(
parent
),
Q
Dialog
(
parent
),
ui
(
new
Ui
::
scanner
)
{
ui
->
setupUi
(
this
);
setWindowFlags
(
Qt
::
FramelessWindowHint
);
setAttribute
(
Qt
::
WA_TranslucentBackground
);
setAttribute
(
Qt
::
WA_QuitOnClose
,
false
);
connect
(
ui
->
fmIdEdit
,
SIGNAL
(
editingFinished
()),
SLOT
(
OnEditFinished
()));
}
scanner
::~
scanner
()
...
...
@@ -13,18 +20,32 @@ scanner::~scanner()
delete
ui
;
}
bool
scanner
::
eventFilter
(
QObject
*
obj
,
QEvent
*
event
)
void
scanner
::
paintEvent
(
QPaintEvent
*
)
{
if
(
obj
==
fmId_edit
)
{
if
(
event
->
type
()
==
QEvent
::
KeyPress
)
{
QKeyEvent
*
keyEvent
=
static_cast
<
QKeyEvent
*>
(
event
);
qDebug
()
<<
"key press"
<<
keyEvent
->
key
();
return
true
;
}
else
{
return
false
;
}
}
else
{
// pass the event on to the parent class
return
QWidget
::
eventFilter
(
obj
,
event
);
}
QStyleOption
opt
;
opt
.
init
(
this
);
QPainter
p
(
this
);
style
()
->
drawPrimitive
(
QStyle
::
PE_Widget
,
&
opt
,
&
p
,
this
);
}
void
scanner
::
OnEditFinished
()
{
emit
fetched
(
ui
->
fmIdEdit
->
text
());
QDialog
::
accept
();
}
void
scanner
::
showRefund
()
{
ui
->
fmIdEdit
->
clear
();
showNormal
();
HWND
hForeWnd
=
::
GetForegroundWindow
();
DWORD
dwForeID
=
::
GetWindowThreadProcessId
(
hForeWnd
,
NULL
);
DWORD
dwCurID
=
::
GetCurrentThreadId
();
::
AttachThreadInput
(
dwCurID
,
dwForeID
,
TRUE
);
::
SetForegroundWindow
((
HWND
)
effectiveWinId
());
::
SetWindowPos
(
(
HWND
)
effectiveWinId
(),
HWND_TOPMOST
,
0
,
0
,
0
,
0
,
SWP_NOMOVE
|
SWP_NOSIZE
|
SWP_SHOWWINDOW
);
showNormal
();
::
SetForegroundWindow
((
HWND
)
effectiveWinId
());
::
AttachThreadInput
(
dwCurID
,
dwForeID
,
FALSE
);
QDialog
::
exec
();
}
scanner.h
View file @
9f2329d1
#ifndef SCANNER_H
#define SCANNER_H
#include <Q
Widget
>
#include <Q
Dialog
>
namespace
Ui
{
class
scanner
;
}
class
scanner
:
public
Q
Widget
class
scanner
:
public
Q
Dialog
{
Q_OBJECT
...
...
@@ -15,6 +15,15 @@ public:
explicit
scanner
(
QWidget
*
parent
=
0
);
~
scanner
();
void
paintEvent
(
QPaintEvent
*
);
signals
:
void
fetched
(
QString
);
public
slots
:
void
OnEditFinished
();
void
showRefund
();
private
:
Ui
::
scanner
*
ui
;
};
...
...
scanner.ui
View file @
9f2329d1
<?xml version="1.0" encoding="UTF-8"?>
<ui
version=
"4.0"
>
<class>
scanner
</class>
<widget
class=
"Q
Widget
"
name=
"scanner"
>
<widget
class=
"Q
Dialog
"
name=
"scanner"
>
<property
name=
"geometry"
>
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
3
2
0
</width>
<height>
24
0
</height>
<width>
3
1
0
</width>
<height>
31
0
</height>
</rect>
</property>
<property
name=
"focusPolicy"
>
<enum>
Qt::StrongFocus
</enum>
</property>
<property
name=
"windowTitle"
>
<string>
退款条码输入
</string>
<string>
请扫描付款凭证
</string>
</property>
<widget
class=
"QLineEdit"
name=
"fmId_edit"
>
<property
name=
"geometry"
>
<rect>
<x>
62
</x>
<y>
149
</y>
<width>
241
</width>
<height>
41
</height>
</rect>
<property
name=
"styleSheet"
>
<string
notr=
"true"
>
QLabel
{
font: 75 25px
"
Microsoft YaHei Light
"
;
}
#scanner
{
border: 0 solid gray;
border-radius:15px;
font: 9pt
"
Agency FB
"
;
background-color: rgb(225, 225, 225);
}
#fmIdEdit
{
border: 0 solid white;
background: transparent;
color: orange;
font: 400 25px
"
Microsoft YaHei
"
;
}
</string>
</property>
<layout
class=
"QVBoxLayout"
name=
"verticalLayout"
>
<item>
<widget
class=
"QLabel"
name=
"label_wait_title"
>
<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
"
Microsoft YaHei UI Light
"
;
}
</string>
</property>
<property
name=
"text"
>
<string>
请扫描付款凭证
</string>
</property>
<property
name=
"alignment"
>
<set>
Qt::AlignCenter
</set>
</property>
<property
name=
"wordWrap"
>
<bool>
true
</bool>
</property>
</widget>
<widget
class=
"QLabel"
name=
"fmId"
>
<property
name=
"geometry"
>
<rect>
<x>
10
</x>
<y>
160
</y>
<width>
54
</width>
<height>
12
</height>
</rect>
</item>
<item>
<widget
class=
"QLineEdit"
name=
"fmIdEdit"
>
<property
name=
"cursor"
>
<cursorShape>
BlankCursor
</cursorShape>
</property>
<property
name=
"focusPolicy"
>
<enum>
Qt::StrongFocus
</enum>
</property>
<property
name=
"acceptDrops"
>
<bool>
false
</bool>
</property>
<property
name=
"text"
>
<string>
fmId
</string>
<string/>
</property>
<property
name=
"frame"
>
<bool>
false
</bool>
</property>
<property
name=
"alignment"
>
<set>
Qt::AlignCenter
</set>
</property>
</widget>
</item>
<item>
<spacer
name=
"verticalSpacer"
>
<property
name=
"orientation"
>
<enum>
Qt::Vertical
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
20
</width>
<height>
40
</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<layoutdefault
spacing=
"6"
margin=
"11"
/>
<resources/>
<connections/>
</ui>
widget.cpp
View file @
9f2329d1
...
...
@@ -56,7 +56,7 @@ void Widget::move()
// //show();
//}
void
Widget
::
show
Top
()
void
Widget
::
show
Requesting
()
{
showNormal
();
HWND
hForeWnd
=
::
GetForegroundWindow
();
...
...
widget.h
View file @
9f2329d1
...
...
@@ -15,7 +15,7 @@ class Widget : public QWidget
public
:
explicit
Widget
(
QWidget
*
parent
=
0
);
~
Widget
();
void
show
Top
();
void
show
Requesting
();
protected
slots
:
void
move
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment