Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
fmPOS
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
xiaojing.zhang
fmPOS
Commits
f0da09cb
Commit
f0da09cb
authored
Mar 17, 2017
by
NitefullWind
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1. 导航界面使用状态机和动画重新实现。 2. 登录界面去掉阴影和扩展键盘。
parent
b4b4a9c2
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
124 additions
and
288 deletions
+124
-288
fmp_home/fmnumpad.cpp
+3
-7
fmp_home/fmnumpad.h
+3
-3
fmp_home/fmnumpad.ui
+1
-87
fmp_home/fmp_he_handlers.cpp
+0
-1
fmp_home/fmp_home.pro
+4
-4
fmp_home/fmp_home_navwindow.cpp
+54
-54
fmp_home/fmp_home_navwindow.h
+6
-22
fmp_home/fmp_home_navwindow.ui
+13
-7
fmp_home/fmp_login.cpp
+6
-21
fmp_home/fmp_login.h
+1
-6
fmp_home/fmp_login.ui
+30
-73
fmp_home/fmp_wnd.cpp
+1
-1
fmp_home/menubutton.cpp
+2
-2
fmp_home/res/img/fm-icon_02.png
+0
-0
No files found.
fmp_home/fm
p_num_
pad.cpp
→
fmp_home/fm
num
pad.cpp
View file @
f0da09cb
#
include
"fm
p_num_
pad.h"
#
include
"fm
num
pad.h"
#include "ui_fmnumpad.h"
#include "ui_fmnumpad.h"
#include <QLineEdit>
#include <QLineEdit>
FMNumPad
::
FMNumPad
(
Q
Dialog
*
parent
)
:
FMNumPad
::
FMNumPad
(
Q
Widget
*
parent
)
:
FMPWnd
(
parent
),
QWidget
(
parent
),
ui
(
new
Ui
::
FMNumPad
),
ui
(
new
Ui
::
FMNumPad
),
_lineEdit
(
nullptr
)
_lineEdit
(
nullptr
)
{
{
...
@@ -24,10 +24,6 @@ FMNumPad::FMNumPad(QDialog *parent) :
...
@@ -24,10 +24,6 @@ FMNumPad::FMNumPad(QDialog *parent) :
FMNumPad
::~
FMNumPad
()
FMNumPad
::~
FMNumPad
()
{
{
delete
ui
;
delete
ui
;
if
(
_lineEdit
)
{
delete
_lineEdit
;
_lineEdit
=
nullptr
;
}
}
}
void
FMNumPad
::
on_digit_clicked
()
void
FMNumPad
::
on_digit_clicked
()
...
...
fmp_home/fm
p_num_
pad.h
→
fmp_home/fm
num
pad.h
View file @
f0da09cb
#
ifndef
FMNUMPAD_H
#
ifndef
FMNUMPAD_H
#define FMNUMPAD_H
#define FMNUMPAD_H
#include
"fmp_wnd.h"
#include
<QWidget>
class
QLineEdit
;
class
QLineEdit
;
...
@@ -9,12 +9,12 @@ namespace Ui {
...
@@ -9,12 +9,12 @@ namespace Ui {
class
FMNumPad
;
class
FMNumPad
;
}
}
class
FMNumPad
:
public
FMPWnd
class
FMNumPad
:
public
QWidget
{
{
Q_OBJECT
Q_OBJECT
public
:
public
:
explicit
FMNumPad
(
Q
Dialog
*
parent
=
0
);
explicit
FMNumPad
(
Q
Widget
*
parent
=
0
);
~
FMNumPad
();
~
FMNumPad
();
void
setLineEdit
(
QLineEdit
*
lineEdit
);
void
setLineEdit
(
QLineEdit
*
lineEdit
);
...
...
fmp_home/fmnumpad.ui
View file @
f0da09cb
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
<x>
0
</x>
<x>
0
</x>
<y>
0
</y>
<y>
0
</y>
<width>
246
</width>
<width>
246
</width>
<height>
305
</height>
<height>
234
</height>
</rect>
</rect>
</property>
</property>
<property
name=
"windowTitle"
>
<property
name=
"windowTitle"
>
...
@@ -106,79 +106,6 @@ QPushButton:hover {
...
@@ -106,79 +106,6 @@ QPushButton:hover {
<number>
0
</number>
<number>
0
</number>
</property>
</property>
<item>
<item>
<widget
class=
"QWidget"
name=
"title"
native=
"true"
>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout"
>
<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=
"title_label"
>
<property
name=
"text"
>
<string>
数字键盘
</string>
</property>
</widget>
</item>
<item>
<spacer
name=
"horizontalSpacer"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
40
</width>
<height>
20
</height>
</size>
</property>
</spacer>
</item>
<item>
<widget
class=
"QPushButton"
name=
"close_btn"
>
<property
name=
"minimumSize"
>
<size>
<width>
34
</width>
<height>
34
</height>
</size>
</property>
<property
name=
"maximumSize"
>
<size>
<width>
34
</width>
<height>
34
</height>
</size>
</property>
<property
name=
"text"
>
<string/>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer
name=
"verticalSpacer"
>
<property
name=
"orientation"
>
<enum>
Qt::Vertical
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
20
</width>
<height>
10
</height>
</size>
</property>
</spacer>
</item>
<item>
<layout
class=
"QGridLayout"
name=
"gridLayout"
>
<layout
class=
"QGridLayout"
name=
"gridLayout"
>
<property
name=
"leftMargin"
>
<property
name=
"leftMargin"
>
<number>
10
</number>
<number>
10
</number>
...
@@ -289,19 +216,6 @@ QPushButton:hover {
...
@@ -289,19 +216,6 @@ QPushButton:hover {
</item>
</item>
</layout>
</layout>
</item>
</item>
<item>
<spacer
name=
"verticalSpacer_2"
>
<property
name=
"orientation"
>
<enum>
Qt::Vertical
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
20
</width>
<height>
10
</height>
</size>
</property>
</spacer>
</item>
</layout>
</layout>
</widget>
</widget>
<resources/>
<resources/>
...
...
fmp_home/fmp_he_handlers.cpp
View file @
f0da09cb
...
@@ -14,7 +14,6 @@ FMPStartEventHandler::FMPStartEventHandler(ctkPluginContext *ctx, FMPHome *home)
...
@@ -14,7 +14,6 @@ FMPStartEventHandler::FMPStartEventHandler(ctkPluginContext *ctx, FMPHome *home)
void
FMPStartEventHandler
::
handleEvent
(
const
ctkEvent
&
event
)
void
FMPStartEventHandler
::
handleEvent
(
const
ctkEvent
&
event
)
{
{
qDebug
()
<<
"==========="
;
if
(
_home
)
{
if
(
_home
)
{
QString
ack_topic
=
event
.
getTopic
();
QString
ack_topic
=
event
.
getTopic
();
//! com/fmp/services/REQ_START/id
//! com/fmp/services/REQ_START/id
...
...
fmp_home/fmp_home.pro
View file @
f0da09cb
...
@@ -19,9 +19,9 @@ SOURCES +=\
...
@@ -19,9 +19,9 @@ SOURCES +=\
menubutton
.
cpp
\
menubutton
.
cpp
\
fmp_wnd
.
cpp
\
fmp_wnd
.
cpp
\
fmp_login
.
cpp
\
fmp_login
.
cpp
\
fmp_num_pad
.
cpp
\
fmnetwork
.
cpp
\
fmnetwork
.
cpp
\
fmp_he_handlers
.
cpp
fmp_he_handlers
.
cpp
\
fmnumpad
.
cpp
HEADERS
+=
fmp_home
.
h
\
HEADERS
+=
fmp_home
.
h
\
fmp_home_plugin_p
.
h
\
fmp_home_plugin_p
.
h
\
...
@@ -31,9 +31,9 @@ HEADERS += fmp_home.h \
...
@@ -31,9 +31,9 @@ HEADERS += fmp_home.h \
fmp_wnd
.
h
\
fmp_wnd
.
h
\
fmp_login
.
h
\
fmp_login
.
h
\
menubutton
.
h
\
menubutton
.
h
\
fmp_num_pad
.
h
\
fmnetwork
.
h
\
fmnetwork
.
h
\
fmp_he_handlers
.
h
fmp_he_handlers
.
h
\
fmnumpad
.
h
FORMS
+=
\
FORMS
+=
\
fmp_home_navwindow
.
ui
\
fmp_home_navwindow
.
ui
\
...
...
fmp_home/fmp_home_navwindow.cpp
View file @
f0da09cb
...
@@ -4,7 +4,10 @@
...
@@ -4,7 +4,10 @@
#include <QDebug>
#include <QDebug>
#include <QDesktopWidget>
#include <QDesktopWidget>
#include <QParallelAnimationGroup>
#include <QParallelAnimationGroup>
#include <QSequentialAnimationGroup>
#include <QPropertyAnimation>
#include <QPropertyAnimation>
#include <QEasingCurve>
#include <QStateMachine>
#include <fmp_settings_i.h>
#include <fmp_settings_i.h>
NavWindow
::
NavWindow
(
FMPSettingsInterface
*&
settings
,
QWidget
*
parent
)
:
NavWindow
::
NavWindow
(
FMPSettingsInterface
*&
settings
,
QWidget
*
parent
)
:
...
@@ -12,6 +15,7 @@ NavWindow::NavWindow(FMPSettingsInterface *&settings, QWidget *parent) :
...
@@ -12,6 +15,7 @@ NavWindow::NavWindow(FMPSettingsInterface *&settings, QWidget *parent) :
ui
(
new
Ui
::
NavWindow
),
ui
(
new
Ui
::
NavWindow
),
_btn_group
(
new
QButtonGroup
(
this
)),
_btn_group
(
new
QButtonGroup
(
this
)),
_animationShow
(
new
QParallelAnimationGroup
(
this
)),
_animationShow
(
new
QParallelAnimationGroup
(
this
)),
_stateMachine
(
new
QStateMachine
(
this
)),
PI
(
3.1415926
),
PI
(
3.1415926
),
_settings
(
settings
)
_settings
(
settings
)
{
{
...
@@ -20,23 +24,19 @@ NavWindow::NavWindow(FMPSettingsInterface *&settings, QWidget *parent) :
...
@@ -20,23 +24,19 @@ NavWindow::NavWindow(FMPSettingsInterface *&settings, QWidget *parent) :
btns
.
push_back
(
"payment"
);
btns
.
push_back
(
"payment"
);
btns
.
push_back
(
"tool"
);
btns
.
push_back
(
"tool"
);
btns
.
push_back
(
"tool"
);
MenuUiProp
.
distance
=
100
;
MenuUiProp
.
distance
=
100
;
MenuUiProp
.
beginAngle
=
-
(
PI
*
0.45
);
MenuUiProp
.
beginAngle
=
-
(
PI
/
2
);
MenuUiProp
.
endAngle
=
(
PI
*
0.45
);
MenuUiProp
.
endAngle
=
(
PI
/
2
);
MenuUiProp
.
interval
=
(
PI
)
/
4
;
isUseAnimation
=
_settings
->
GetBool
(
FMP_INIKEY_HOMEANIMATION
);
isUseAnimation
=
_settings
->
GetBool
(
FMP_INIKEY_HOMEANIMATION
);
setNavStatus
(
Default
);
this
->
setAttribute
(
Qt
::
WA_TranslucentBackground
);
this
->
setAttribute
(
Qt
::
WA_TranslucentBackground
);
this
->
setWindowFlags
(
windowFlags
()
|
Qt
::
FramelessWindowHint
|
Qt
::
WindowStaysOnTopHint
|
Qt
::
Tool
);
this
->
setWindowFlags
(
windowFlags
()
|
Qt
::
FramelessWindowHint
|
Qt
::
WindowStaysOnTopHint
|
Qt
::
Tool
);
connect
(
_btn_group
,
SIGNAL
(
buttonClicked
(
QAbstractButton
*
)),
this
,
SLOT
(
onMenuBtnClicked
(
QAbstractButton
*
)));
connect
(
_btn_group
,
SIGNAL
(
buttonClicked
(
QAbstractButton
*
)),
this
,
SLOT
(
onMenuBtnClicked
(
QAbstractButton
*
)));
initMenu
();
initMenu
();
connect
(
this
,
SIGNAL
(
statusChanged
(
NavStatus
)),
this
,
SLOT
(
onStatusChanged
(
NavStatus
)));
connect
(
_animationShow
,
&
QParallelAnimationGroup
::
finished
,
this
,
[
=
](){
ui
->
navMainBtn
->
lower
();
});
}
}
NavWindow
::~
NavWindow
()
NavWindow
::~
NavWindow
()
...
@@ -46,65 +46,85 @@ NavWindow::~NavWindow()
...
@@ -46,65 +46,85 @@ NavWindow::~NavWindow()
delete
ui
;
delete
ui
;
}
}
void
NavWindow
::
setNavStatus
(
const
NavStatus
status
)
{
this
->
_status
=
status
;
emit
statusChanged
(
status
);
}
void
NavWindow
::
on_navMainBtn_clicked
()
{
int
status
=
this
->
_status
;
status
=
(
status
+
1
)
%
2
;
setNavStatus
((
NavStatus
)
status
);
}
void
NavWindow
::
spreadMenus
(
const
bool
isSpread
)
void
NavWindow
::
spreadMenus
(
const
bool
isSpread
)
{
{
//! Start animation.
if
(
!
isSpread
)
{
if
(
isSpread
&&
isUseAnimation
)
{
ui
->
navMainBtn
->
raise
();
ui
->
navMainBtn
->
raise
();
}
if
(
isUseAnimation
)
{
auto
dir
=
isSpread
?
QParallelAnimationGroup
::
Forward
:
QParallelAnimationGroup
::
Backward
;
_animationShow
->
setDirection
(
dir
);
_animationShow
->
start
();
_animationShow
->
start
();
}
else
{
auto
btnList
=
_btn_group
->
buttons
();
for
(
int
i
=
0
;
i
<
btnList
.
size
();
++
i
)
{
auto
btn
=
qobject_cast
<
QPushButton
*>
(
btnList
[
i
]);
if
(
isSpread
)
{
auto
r
=
_btnsGeometry
[
i
];
btn
->
setGeometry
(
r
);
ui
->
navMainBtn
->
lower
();
}
else
{
btn
->
setGeometry
(
_centerGeometry
);
}
}
}
//! Set the menu btns are visible.
foreach
(
QAbstractButton
*
b
,
_btn_group
->
buttons
())
{
auto
btn
=
qobject_cast
<
QPushButton
*>
(
b
);
btn
->
setVisible
(
isSpread
);
}
}
}
}
void
NavWindow
::
initMenu
()
void
NavWindow
::
initMenu
()
{
{
QState
*
stateDefault
=
new
QState
(
_stateMachine
);
stateDefault
->
assignProperty
(
ui
->
navMainBtn
,
"styleSheet"
,
"#navMainBtn{ background-image: url(:fm-icon_01);margin: -26 0 0 -30;}"
);
QState
*
stateSpread
=
new
QState
(
_stateMachine
);
stateSpread
->
assignProperty
(
ui
->
navMainBtn
,
"styleSheet"
,
"#navMainBtn{ background-image: url(:fm-icon_02);margin: -26 0 0 -30;}"
);
stateSpread
->
addTransition
(
ui
->
navMainBtn
,
&
QPushButton
::
clicked
,
stateDefault
);
stateDefault
->
addTransition
(
ui
->
navMainBtn
,
&
QPushButton
::
clicked
,
stateSpread
);
connect
(
stateSpread
,
&
QState
::
exited
,
this
,
[
&
](){
ui
->
navMainBtn
->
raise
();
});
int
centerX
=
ui
->
navMainBtn
->
x
()
+
ui
->
navMainBtn
->
width
()
/
2
;
int
centerX
=
ui
->
navMainBtn
->
x
()
+
ui
->
navMainBtn
->
width
()
/
2
;
int
centerY
=
ui
->
navMainBtn
->
y
()
+
ui
->
navMainBtn
->
height
()
/
2
;
int
centerY
=
ui
->
navMainBtn
->
y
()
+
ui
->
navMainBtn
->
height
()
/
2
;
const
int
dis
=
MenuUiProp
.
distance
;
const
int
dis
=
MenuUiProp
.
distance
;
int
btnsNum
=
btns
.
size
();
int
btnsNum
=
btns
.
size
();
double
jianGe
=
0
;
double
jianGe
=
0
;
if
(
btnsNum
>
1
)
{
if
(
MenuUiProp
.
interval
>
0
)
{
jianGe
=
MenuUiProp
.
interval
;
}
else
if
(
btnsNum
>
1
)
{
jianGe
=
(
MenuUiProp
.
endAngle
-
MenuUiProp
.
beginAngle
)
/
(
btns
.
size
()
-
1
);
jianGe
=
(
MenuUiProp
.
endAngle
-
MenuUiProp
.
beginAngle
)
/
(
btns
.
size
()
-
1
);
}
}
const
int
btnWidth
=
60
;
const
int
btnWidth
=
60
;
_centerGeometry
=
QRect
(
centerX
-
btnWidth
/
2
,
centerY
-
btnWidth
/
2
,
btnWidth
,
btnWidth
);
bool
isUseAnimation
=
_settings
->
GetBool
(
FMP_INIKEY_HOMEANIMATION
);
for
(
decltype
(
btns
.
size
())
i
=
0
;
i
<
btns
.
size
();
++
i
)
{
for
(
decltype
(
btns
.
size
())
i
=
0
;
i
<
btns
.
size
();
++
i
)
{
auto
btn
=
new
QPushButton
(
this
);
auto
btn
=
new
QPushButton
(
this
);
btn
->
setVisible
(
false
);
double
angle
=
MenuUiProp
.
beginAngle
+
jianGe
*
i
;
double
angle
=
MenuUiProp
.
beginAngle
+
jianGe
*
i
;
int
x
=
centerX
+
dis
*
cos
(
angle
)
-
btnWidth
/
2
;
int
x
=
centerX
+
dis
*
cos
(
angle
)
-
btnWidth
/
2
;
int
y
=
centerY
+
dis
*
sin
(
angle
)
-
btnWidth
/
2
;
int
y
=
centerY
+
dis
*
sin
(
angle
)
-
btnWidth
/
2
;
QRect
btnGrometry
(
x
,
y
,
btnWidth
,
btnWidth
);
btn
->
setObjectName
(
btns
[
i
]);
btn
->
setObjectName
(
btns
[
i
]);
btn
->
setGeometry
(
x
,
y
,
btnWidth
,
btnWidth
);
_btn_group
->
addButton
(
btn
);
_btn_group
->
addButton
(
btn
);
btn
->
setGeometry
(
_centerGeometry
);
stateDefault
->
assignProperty
(
btn
,
"geometry"
,
_centerGeometry
);
stateSpread
->
assignProperty
(
btn
,
"geometry"
,
btnGrometry
);
if
(
isUseAnimation
)
{
// 创建动画
// 创建动画
auto
animation
=
new
QPropertyAnimation
(
btn
,
"geometry"
);
auto
animation
=
new
QPropertyAnimation
(
btn
,
"geometry"
);
animation
->
setDuration
(
200
);
animation
->
setDuration
(
300
+
i
*
75
);
animation
->
setStartValue
(
QRect
(
centerX
-
btn
->
width
()
/
2
,
centerY
-
btn
->
width
()
/
2
,
btn
->
width
(),
btn
->
height
()));
animation
->
setEasingCurve
(
QEasingCurve
::
InOutBack
);
animation
->
setEndValue
(
btn
->
geometry
());
_animationShow
->
addAnimation
(
animation
);
_animationShow
->
addAnimation
(
animation
);
}
}
}
ui
->
navMainBtn
->
raise
();
_stateMachine
->
addDefaultAnimation
(
_animationShow
);
_stateMachine
->
setInitialState
(
stateDefault
);
_stateMachine
->
start
();
}
}
void
NavWindow
::
onMenuBtnClicked
(
QAbstractButton
*
btn
)
void
NavWindow
::
onMenuBtnClicked
(
QAbstractButton
*
btn
)
...
@@ -112,23 +132,3 @@ void NavWindow::onMenuBtnClicked(QAbstractButton *btn)
...
@@ -112,23 +132,3 @@ void NavWindow::onMenuBtnClicked(QAbstractButton *btn)
QString
btnName
=
btn
->
objectName
();
QString
btnName
=
btn
->
objectName
();
emit
menuBtnClicked
(
btnName
);
emit
menuBtnClicked
(
btnName
);
}
}
void
NavWindow
::
onStatusChanged
(
NavStatus
status
)
{
switch
(
status
)
{
case
Default
:
spreadMenus
(
false
);
ui
->
navMainBtn
->
setStyleSheet
(
"#navMainBtn{ border-image: url(:fm-icon_01)}"
);
break
;
case
Spread
:
spreadMenus
(
true
);
ui
->
navMainBtn
->
setStyleSheet
(
"#navMainBtn{ border-image: url(:fm-icon_02)}"
);
break
;
case
Message
:
ui
->
navMainBtn
->
setStyleSheet
(
"#navMainBtn{ border-image: url(:xiaoxi)}"
);
break
;
default
:
ui
->
navMainBtn
->
setStyleSheet
(
"#navMainBtn{ border-image: url(:fm-icon_01)}"
);
break
;
}
}
fmp_home/fmp_home_navwindow.h
View file @
f0da09cb
...
@@ -12,35 +12,19 @@ class NavWindow;
...
@@ -12,35 +12,19 @@ class NavWindow;
class
QButtonGroup
;
class
QButtonGroup
;
class
QAbstractButton
;
class
QAbstractButton
;
class
QParallelAnimationGroup
;
class
QParallelAnimationGroup
;
class
QSequentialAnimationGroup
;
class
FMPSettingsInterface
;
class
FMPSettingsInterface
;
class
QStateMachine
;
class
NavWindow
:
public
QDialog
class
NavWindow
:
public
QDialog
{
{
Q_OBJECT
Q_OBJECT
public
:
public
:
/**
* @brief The NavStatus enum
* Default: 默认状态
* Message: 由新消息状态
* Spread: 菜单按钮展开状态
*/
enum
NavStatus
{
Default
=
0
,
Spread
,
Message
};
explicit
NavWindow
(
FMPSettingsInterface
*
&
settings
,
QWidget
*
parent
=
0
);
explicit
NavWindow
(
FMPSettingsInterface
*
&
settings
,
QWidget
*
parent
=
0
);
~
NavWindow
();
~
NavWindow
();
public
slots
:
public
slots
:
/**
* @brief setNavStatus
* 设置该导航窗口的状态
* @param status
*/
void
setNavStatus
(
const
NavStatus
status
);
/**
/**
* @brief spreadMenus
* @brief spreadMenus
...
@@ -51,19 +35,18 @@ public slots:
...
@@ -51,19 +35,18 @@ public slots:
signals
:
signals
:
void
menuBtnClicked
(
QString
btnName
);
void
menuBtnClicked
(
QString
btnName
);
void
statusChanged
(
NavStatus
status
);
private
slots
:
private
slots
:
void
on_navMainBtn_clicked
();
void
onMenuBtnClicked
(
QAbstractButton
*
);
void
onMenuBtnClicked
(
QAbstractButton
*
);
void
onStatusChanged
(
NavStatus
status
);
private
:
private
:
Ui
::
NavWindow
*
ui
;
Ui
::
NavWindow
*
ui
;
NavStatus
_status
;
QButtonGroup
*
_btn_group
;
QButtonGroup
*
_btn_group
;
std
::
vector
<
QRect
>
_btnsGeometry
;
QParallelAnimationGroup
*
_animationShow
;
QParallelAnimationGroup
*
_animationShow
;
QRect
_centerGeometry
;
QStateMachine
*
_stateMachine
;
void
initMenu
();
void
initMenu
();
...
@@ -75,6 +58,7 @@ private:
...
@@ -75,6 +58,7 @@ private:
int
distance
;
int
distance
;
double
beginAngle
;
double
beginAngle
;
double
endAngle
;
double
endAngle
;
double
interval
;
};
};
MenuUiProps
MenuUiProp
;
MenuUiProps
MenuUiProp
;
bool
isUseAnimation
;
bool
isUseAnimation
;
...
...
fmp_home/fmp_home_navwindow.ui
View file @
f0da09cb
...
@@ -15,9 +15,9 @@
...
@@ -15,9 +15,9 @@
</property>
</property>
<property
name=
"styleSheet"
>
<property
name=
"styleSheet"
>
<string
notr=
"true"
>
#navMainBtn {
<string
notr=
"true"
>
#navMainBtn {
min-width: 185px; min-height:185px
;
background-image: url(:fm-icon_02)
;
max-width: 185px; max-height:185px
;
margin: -26 0 0 -30
;
border
-image: url(:fm-icon_01)
border
: none;
}
}
QPushButton {
QPushButton {
...
@@ -42,15 +42,21 @@ QPushButton:hover {
...
@@ -42,15 +42,21 @@ QPushButton:hover {
}
}
#payment:pressed {
#payment:pressed {
border-image: url(:payment_onclick);
border-image: url(:payment_onclick);
}
#vip {
border-image: url(:member02);
}
#vip:pressed {
border-image: url(:member02_onclick);
}
</string>
}
</string>
</property>
</property>
<widget
class=
"MenuButton"
name=
"navMainBtn"
native=
"true"
>
<widget
class=
"MenuButton"
name=
"navMainBtn"
native=
"true"
>
<property
name=
"geometry"
>
<property
name=
"geometry"
>
<rect>
<rect>
<x>
1
1
0
</x>
<x>
1
4
0
</x>
<y>
6
0
</y>
<y>
9
0
</y>
<width>
1
85
</width>
<width>
1
21
</width>
<height>
1
85
</height>
<height>
1
21
</height>
</rect>
</rect>
</property>
</property>
<property
name=
"styleSheet"
>
<property
name=
"styleSheet"
>
...
...
fmp_home/fmp_login.cpp
View file @
f0da09cb
...
@@ -5,14 +5,12 @@
...
@@ -5,14 +5,12 @@
#include <QJsonDocument>
#include <QJsonDocument>
#include <QJsonObject>
#include <QJsonObject>
#include <QJsonParseError>
#include <QJsonParseError>
#include "fmp_num_pad.h"
#include "fmnetwork.h"
#include "fmnetwork.h"
#include <QDebug>
#include <QDebug>
FMPLogin
::
FMPLogin
(
QString
url
,
QString
storeId
,
QString
partnerId
,
QDialog
*
parent
)
:
FMPLogin
::
FMPLogin
(
QString
url
,
QString
storeId
,
QString
partnerId
,
QDialog
*
parent
)
:
FMPWnd
(
parent
),
FMPWnd
(
parent
),
ui
(
new
Ui
::
FMPLogin
),
ui
(
new
Ui
::
FMPLogin
),
_numPad
(
new
FMNumPad
),
_userName
(
""
),
_userName
(
""
),
_errorMsg
(
""
),
_errorMsg
(
""
),
_url
(
url
),
_url
(
url
),
...
@@ -20,22 +18,18 @@ FMPLogin::FMPLogin(QString url, QString storeId, QString partnerId, QDialog *par
...
@@ -20,22 +18,18 @@ FMPLogin::FMPLogin(QString url, QString storeId, QString partnerId, QDialog *par
_partnerId
(
partnerId
)
_partnerId
(
partnerId
)
{
{
ui
->
setupUi
(
this
);
ui
->
setupUi
(
this
);
connect
(
_numP
ad
,
SIGNAL
(
digit_confirm
()),
this
,
SLOT
(
on_login_btn_clicked
()));
connect
(
ui
->
nump
ad
,
SIGNAL
(
digit_confirm
()),
this
,
SLOT
(
on_login_btn_clicked
()));
QDesktopWidget
w
;
connect
(
qApp
,
&
QApplication
::
focusChanged
,
this
,
&
FMPLogin
::
onFocusChanged
);
QRect
rc
=
w
.
availableGeometry
();
_numPad
->
setGeometry
((
rc
.
width
()
+
640
)
/
2
,
(
rc
.
height
()
-
480
)
/
2
,
_numPad
->
width
(),
_numPad
->
height
());
}
}
FMPLogin
::~
FMPLogin
()
FMPLogin
::~
FMPLogin
()
{
{
delete
ui
;
delete
ui
;
delete
_numPad
;
}
}
void
FMPLogin
::
on_login_btn_clicked
()
void
FMPLogin
::
on_login_btn_clicked
()
{
{
_numPad
->
close
();
this
->
setEnabled
(
false
);
this
->
setEnabled
(
false
);
if
(
login
(
ui
->
user_edit
->
text
(),
ui
->
pwd_edit
->
text
()))
{
if
(
login
(
ui
->
user_edit
->
text
(),
ui
->
pwd_edit
->
text
()))
{
...
@@ -77,18 +71,9 @@ bool FMPLogin::login(QString userName, QString password)
...
@@ -77,18 +71,9 @@ bool FMPLogin::login(QString userName, QString password)
return
isLogined
();
return
isLogined
();
}
}
void
FMPLogin
::
on
_key_btn_clicked
(
)
void
FMPLogin
::
on
FocusChanged
(
QWidget
*
,
QWidget
*
now
)
{
{
_numPad
->
setLineEdit
(
ui
->
user_edit
);
if
(
ui
->
user_edit
==
now
||
ui
->
pwd_edit
==
now
)
{
_numPad
->
close
();
ui
->
numpad
->
setLineEdit
(
qobject_cast
<
QLineEdit
*>
(
now
));
_numPad
->
show
();
}
ui
->
user_edit
->
setFocus
();
}
void
FMPLogin
::
on_key_btn_2_clicked
()
{
_numPad
->
setLineEdit
(
ui
->
pwd_edit
);
_numPad
->
close
();
_numPad
->
show
();
ui
->
pwd_edit
->
setFocus
();
}
}
fmp_home/fmp_login.h
View file @
f0da09cb
...
@@ -3,8 +3,6 @@
...
@@ -3,8 +3,6 @@
#include "fmp_wnd.h"
#include "fmp_wnd.h"
class
FMNumPad
;
namespace
Ui
{
namespace
Ui
{
class
FMPLogin
;
class
FMPLogin
;
}
}
...
@@ -31,14 +29,11 @@ public:
...
@@ -31,14 +29,11 @@ public:
private
slots
:
private
slots
:
void
on_login_btn_clicked
();
void
on_login_btn_clicked
();
void
on_key_btn_clicked
();
void
onFocusChanged
(
QWidget
*
,
QWidget
*
now
);
void
on_key_btn_2_clicked
();
private
:
private
:
Ui
::
FMPLogin
*
ui
;
Ui
::
FMPLogin
*
ui
;
FMNumPad
*
_numPad
;
QString
_userName
;
QString
_userName
;
QString
_errorMsg
;
QString
_errorMsg
;
...
...
fmp_home/fmp_login.ui
View file @
f0da09cb
...
@@ -6,8 +6,8 @@
...
@@ -6,8 +6,8 @@
<rect>
<rect>
<x>
0
</x>
<x>
0
</x>
<y>
0
</y>
<y>
0
</y>
<width>
847
</width>
<width>
640
</width>
<height>
615
</height>
<height>
480
</height>
</rect>
</rect>
</property>
</property>
<property
name=
"windowTitle"
>
<property
name=
"windowTitle"
>
...
@@ -15,12 +15,7 @@
...
@@ -15,12 +15,7 @@
</property>
</property>
<property
name=
"styleSheet"
>
<property
name=
"styleSheet"
>
<string
notr=
"true"
>
#FMPLogin {
<string
notr=
"true"
>
#FMPLogin {
background: rgba(100,100,100,80);
}
#Center {
background: rgb(255,255,255);
background: rgb(255,255,255);
border: 1 solid silver;
}
}
QWidget {
QWidget {
...
@@ -77,19 +72,6 @@ QLineEdit {
...
@@ -77,19 +72,6 @@ QLineEdit {
color: rgb(50,50,50);
color: rgb(50,50,50);
background: white;
background: white;
border: 1 solid silver;
border: 1 solid silver;
border-right: 0;
}
#key_btn, #key_btn_2 {
border: 1 solid silver;
border-left: 0px;
color: rgb(130,130,130);
background-color: rgb(255, 255, 255);
font: 13px
"
微软雅黑
"
;
min-height: 49px; min-width: 30px;
}
#key_btn:hover, #key_btn_2:hover {
color: rgb(37,176,246);
}
}
#login_btn {
#login_btn {
...
@@ -103,33 +85,13 @@ QLineEdit {
...
@@ -103,33 +85,13 @@ QLineEdit {
#login_btn:hover {
#login_btn:hover {
padding: 2 0 0 2;
padding: 2 0 0 2;
}
}
</string>
</property>
#numpad {
<layout
class=
"QGridLayout"
name=
"gridLayout_2"
>
min-width: 0; min-height:0;
<property
name=
"leftMargin"
>
max-width: 0; max-height:0;
<number>
0
</number>
}
</string>
</property>
<property
name=
"topMargin"
>
<number>
0
</number>
</property>
<property
name=
"rightMargin"
>
<number>
0
</number>
</property>
<property
name=
"bottomMargin"
>
<number>
0
</number>
</property>
<property
name=
"spacing"
>
<number>
0
</number>
</property>
<item
row=
"0"
column=
"0"
>
<widget
class=
"QWidget"
name=
"Center"
native=
"true"
>
<property
name=
"maximumSize"
>
<size>
<width>
640
</width>
<height>
480
</height>
</size>
</property>
</property>
<layout
class=
"QVBoxLayout"
name=
"verticalLayout
"
>
<layout
class=
"QVBoxLayout"
name=
"verticalLayout_2
"
>
<property
name=
"spacing"
>
<property
name=
"spacing"
>
<number>
0
</number>
<number>
0
</number>
</property>
</property>
...
@@ -223,6 +185,11 @@ QLineEdit {
...
@@ -223,6 +185,11 @@ QLineEdit {
<number>
0
</number>
<number>
0
</number>
</property>
</property>
<item>
<item>
<layout
class=
"QVBoxLayout"
name=
"verticalLayout"
>
<property
name=
"spacing"
>
<number>
30
</number>
</property>
<item>
<widget
class=
"QLineEdit"
name=
"user_edit"
>
<widget
class=
"QLineEdit"
name=
"user_edit"
>
<property
name=
"text"
>
<property
name=
"text"
>
<string/>
<string/>
...
@@ -233,20 +200,6 @@ QLineEdit {
...
@@ -233,20 +200,6 @@ QLineEdit {
</widget>
</widget>
</item>
</item>
<item>
<item>
<widget
class=
"QPushButton"
name=
"key_btn"
>
<property
name=
"text"
>
<string>
键盘
</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout_3"
>
<property
name=
"spacing"
>
<number>
0
</number>
</property>
<item>
<widget
class=
"QLineEdit"
name=
"pwd_edit"
>
<widget
class=
"QLineEdit"
name=
"pwd_edit"
>
<property
name=
"echoMode"
>
<property
name=
"echoMode"
>
<enum>
QLineEdit::Password
</enum>
<enum>
QLineEdit::Password
</enum>
...
@@ -257,21 +210,26 @@ QLineEdit {
...
@@ -257,21 +210,26 @@ QLineEdit {
</widget>
</widget>
</item>
</item>
<item>
<item>
<widget
class=
"QPushButton"
name=
"key_btn_2
"
>
<widget
class=
"QPushButton"
name=
"login_btn
"
>
<property
name=
"text"
>
<property
name=
"text"
>
<string>
键盘
</string>
<string>
登录
</string>
</property>
</property>
</widget>
</widget>
</item>
</item>
</layout>
</layout>
</item>
</item>
<item>
<item>
<widget
class=
"QPushButton"
name=
"login_btn"
>
<widget
class=
"FMNumPad"
name=
"numpad"
native=
"true"
>
<property
name=
"text"
>
<property
name=
"minimumSize"
>
<string>
登录
</string>
<size>
<width>
0
</width>
<height>
0
</height>
</size>
</property>
</property>
</widget>
</widget>
</item>
</item>
</layout>
</item>
<item>
<item>
<spacer
name=
"verticalSpacer_2"
>
<spacer
name=
"verticalSpacer_2"
>
<property
name=
"orientation"
>
<property
name=
"orientation"
>
...
@@ -351,15 +309,14 @@ QLineEdit {
...
@@ -351,15 +309,14 @@ QLineEdit {
</item>
</item>
</layout>
</layout>
</widget>
</widget>
</item>
<customwidgets>
</layout>
<customwidget>
</widget>
<class>
FMNumPad
</class>
<extends>
QWidget
</extends>
<header>
fmnumpad.h
</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstops>
<tabstop>
user_edit
</tabstop>
<tabstop>
pwd_edit
</tabstop>
<tabstop>
login_btn
</tabstop>
<tabstop>
key_btn
</tabstop>
<tabstop>
key_btn_2
</tabstop>
<tabstop>
close_btn
</tabstop>
<tabstop>
close_btn
</tabstop>
</tabstops>
</tabstops>
<resources/>
<resources/>
...
...
fmp_home/fmp_wnd.cpp
View file @
f0da09cb
...
@@ -22,7 +22,7 @@ FMPWnd::~FMPWnd()
...
@@ -22,7 +22,7 @@ FMPWnd::~FMPWnd()
int
FMPWnd
::
exec
()
int
FMPWnd
::
exec
()
{
{
show
FullScreen
();
show
Normal
();
// ::SetForegroundWindow((HWND)effectiveWinId());
// ::SetForegroundWindow((HWND)effectiveWinId());
// ::SetWindowPos( (HWND)effectiveWinId(), HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW);
// ::SetWindowPos( (HWND)effectiveWinId(), HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW);
...
...
fmp_home/menubutton.cpp
View file @
f0da09cb
...
@@ -6,7 +6,7 @@ MenuButton::MenuButton(QWidget *parent)
...
@@ -6,7 +6,7 @@ MenuButton::MenuButton(QWidget *parent)
_mouseMove
(
false
),
_mouseMove
(
false
),
_mousePress
(
false
),
_mousePress
(
false
),
_canMove
(
false
),
_canMove
(
false
),
_movedItem
(
this
)
_movedItem
(
nullptr
)
{
{
}
}
...
@@ -31,7 +31,7 @@ void MenuButton::mousePressEvent(QMouseEvent *e)
...
@@ -31,7 +31,7 @@ void MenuButton::mousePressEvent(QMouseEvent *e)
void
MenuButton
::
mouseMoveEvent
(
QMouseEvent
*
e
)
void
MenuButton
::
mouseMoveEvent
(
QMouseEvent
*
e
)
{
{
if
(
_mousePress
&&
(
e
->
buttons
()
==
Qt
::
LeftButton
))
if
(
_mo
vedItem
&&
_mo
usePress
&&
(
e
->
buttons
()
==
Qt
::
LeftButton
))
{
{
QPoint
moved
=
e
->
globalPos
()
-
_lastMousePos
;
QPoint
moved
=
e
->
globalPos
()
-
_lastMousePos
;
// 防止因抖动误拖动
// 防止因抖动误拖动
...
...
fmp_home/res/img/fm-icon_02.png
View replaced file @
b4b4a9c2
View file @
f0da09cb
12.1 KB
|
W:
|
H:
3.8 KB
|
W:
|
H:
2-up
Swipe
Onion skin
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