diff --git a/0snap/moneytool.jpg b/0snap/moneytool.jpg
new file mode 100644
index 0000000..34cc5fa
Binary files /dev/null and b/0snap/moneytool.jpg differ
diff --git a/QWidgetDemo.pro b/QWidgetDemo.pro
index c016308..1a15560 100644
--- a/QWidgetDemo.pro
+++ b/QWidgetDemo.pro
@@ -37,6 +37,7 @@ SUBDIRS += imageswitch #图片开关控件
SUBDIRS += netserver #网络中转服务器
SUBDIRS += base64helper #图片文字base64互换
SUBDIRS += smoothcurve #平滑曲线
+SUBDIRS += moneytool #存款计算器
#限定windows系统加载下面的项目
win32 {
diff --git a/QWidgetDemo.pro.user b/QWidgetDemo.pro.user
deleted file mode 100644
index 02360d8..0000000
--- a/QWidgetDemo.pro.user
+++ /dev/null
@@ -1,2964 +0,0 @@
-
-
-
-
-
- EnvironmentId
- {849db446-6f90-46aa-afcf-9e726de1fb02}
-
-
- ProjectExplorer.Project.ActiveTarget
- 0
-
-
- ProjectExplorer.Project.EditorSettings
-
- true
- false
- true
-
- Cpp
-
- CppGlobal
-
-
-
- QmlJS
-
- QmlJSGlobal
-
-
- 2
- UTF-8
- false
- 4
- false
- 80
- true
- true
- 1
- true
- false
- 0
- true
- true
- 0
- 8
- true
- 0
- true
- true
- true
- *.md, *.MD, Makefile
- false
- true
-
-
-
- ProjectExplorer.Project.PluginSettings
-
-
- true
- true
- true
- true
- true
-
-
- 0
- true
-
-
-
- ProjectExplorer.Project.Target.0
-
- Desktop
- desk5.7.0
- desk5.7.0
- {30975ac4-3883-489b-ac7a-132064e40ec0}
- 0
- 0
- 0
-
- 0
- I:\gitee\build-QWidgetDemo-desk5_7_0-Debug
- I:/gitee/build-QWidgetDemo-desk5_7_0-Debug
-
-
- true
- QtProjectManager.QMakeBuildStep
-
- false
-
-
-
- true
- Qt4ProjectManager.MakeStep
-
- 2
- Build
- Build
- ProjectExplorer.BuildSteps.Build
-
-
-
- true
- Qt4ProjectManager.MakeStep
- clean
-
- 1
- Clean
- Clean
- ProjectExplorer.BuildSteps.Clean
-
- 2
- false
-
-
- Debug
- Qt4ProjectManager.Qt4BuildConfiguration
- 2
- 0
-
-
- I:\gitee\build-QWidgetDemo-desk5_7_0-Release
- I:/gitee/build-QWidgetDemo-desk5_7_0-Release
-
-
- true
- QtProjectManager.QMakeBuildStep
-
- false
-
-
-
- true
- Qt4ProjectManager.MakeStep
-
- 2
- Build
- Build
- ProjectExplorer.BuildSteps.Build
-
-
-
- true
- Qt4ProjectManager.MakeStep
- clean
-
- 1
- Clean
- Clean
- ProjectExplorer.BuildSteps.Clean
-
- 2
- false
-
-
- Release
- Qt4ProjectManager.Qt4BuildConfiguration
- 0
- 0
-
-
- 0
- I:\gitee\build-QWidgetDemo-desk5_7_0-Profile
- I:/gitee/build-QWidgetDemo-desk5_7_0-Profile
-
-
- true
- QtProjectManager.QMakeBuildStep
-
- false
-
-
-
- true
- Qt4ProjectManager.MakeStep
-
- 2
- Build
- Build
- ProjectExplorer.BuildSteps.Build
-
-
-
- true
- Qt4ProjectManager.MakeStep
- clean
-
- 1
- Clean
- Clean
- ProjectExplorer.BuildSteps.Clean
-
- 2
- false
-
-
- Profile
- Qt4ProjectManager.Qt4BuildConfiguration
- 0
- 0
- 0
-
- 3
-
-
- 0
- Deploy
- Deploy
- ProjectExplorer.BuildSteps.Deploy
-
- 1
-
- false
- ProjectExplorer.DefaultDeployConfiguration
-
- 1
-
- dwarf
-
- cpu-cycles
-
-
- 250
-
- -e
- cpu-cycles
- --call-graph
- dwarf,4096
- -F
- 250
-
- -F
- true
- 4096
- false
- false
- 1000
-
- true
-
- false
- false
- false
- false
- true
- 0.01
- 10
- true
- kcachegrind
- 1
- 25
-
- 1
- true
- false
- true
- valgrind
-
- 0
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
-
-
- 2
-
- Qt4ProjectManager.Qt4RunConfiguration:I:/gitee/QWidgetDemo/base64helper/base64helper.pro
- I:/gitee/QWidgetDemo/base64helper/base64helper.pro
- false
- true
- true
- false
- true
- I:/gitee/QWidgetDemo/base64helper/../bin
-
-
- dwarf
-
- cpu-cycles
-
-
- 250
-
- -e
- cpu-cycles
- --call-graph
- dwarf,4096
- -F
- 250
-
- -F
- true
- 4096
- false
- false
- 1000
-
- true
-
- false
- false
- false
- false
- true
- 0.01
- 10
- true
- kcachegrind
- 1
- 25
-
- 1
- true
- false
- true
- valgrind
-
- 0
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
-
-
- 2
-
- Qt4ProjectManager.Qt4RunConfiguration:I:/gitee/QWidgetDemo/battery/battery.pro
- I:/gitee/QWidgetDemo/battery/battery.pro
- false
- true
- true
- false
- true
- I:/gitee/QWidgetDemo/battery/../bin
-
-
- dwarf
-
- cpu-cycles
-
-
- 250
-
- -e
- cpu-cycles
- --call-graph
- dwarf,4096
- -F
- 250
-
- -F
- true
- 4096
- false
- false
- 1000
-
- true
-
- false
- false
- false
- false
- true
- 0.01
- 10
- true
- kcachegrind
- 1
- 25
-
- 1
- true
- false
- true
- valgrind
-
- 0
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
-
-
- 2
-
- Qt4ProjectManager.Qt4RunConfiguration:I:/gitee/QWidgetDemo/ffmpegdemo/ffmpegdemo.pro
- I:/gitee/QWidgetDemo/ffmpegdemo/ffmpegdemo.pro
- false
- true
- true
- false
- true
- I:/gitee/QWidgetDemo/ffmpegdemo/../bin
-
-
- dwarf
-
- cpu-cycles
-
-
- 250
-
- -e
- cpu-cycles
- --call-graph
- dwarf,4096
- -F
- 250
-
- -F
- true
- 4096
- false
- false
- 1000
-
- true
-
- false
- false
- false
- false
- true
- 0.01
- 10
- true
- kcachegrind
- 1
- 25
-
- 1
- true
- false
- true
- valgrind
-
- 0
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
-
-
- 2
-
- Qt4ProjectManager.Qt4RunConfiguration:I:/gitee/QWidgetDemo/flatui/flatui.pro
- I:/gitee/QWidgetDemo/flatui/flatui.pro
- false
- true
- true
- false
- true
- I:/gitee/QWidgetDemo/flatui/../bin
-
-
- dwarf
-
- cpu-cycles
-
-
- 250
-
- -e
- cpu-cycles
- --call-graph
- dwarf,4096
- -F
- 250
-
- -F
- true
- 4096
- false
- false
- 1000
-
- true
-
- false
- false
- false
- false
- true
- 0.01
- 10
- true
- kcachegrind
- 1
- 25
-
- 1
- true
- false
- true
- valgrind
-
- 0
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
-
-
- 2
-
- Qt4ProjectManager.Qt4RunConfiguration:I:/gitee/QWidgetDemo/framelesswidget/framelesswidget.pro
- I:/gitee/QWidgetDemo/framelesswidget/framelesswidget.pro
- false
- true
- true
- false
- true
- I:/gitee/QWidgetDemo/framelesswidget/../bin
-
-
- dwarf
-
- cpu-cycles
-
-
- 250
-
- -e
- cpu-cycles
- --call-graph
- dwarf,4096
- -F
- 250
-
- -F
- true
- 4096
- false
- false
- 1000
-
- true
-
- false
- false
- false
- false
- true
- 0.01
- 10
- true
- kcachegrind
- 1
- 25
-
- 1
- true
- false
- true
- valgrind
-
- 0
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
-
-
- 2
-
- Qt4ProjectManager.Qt4RunConfiguration:I:/gitee/QWidgetDemo/gifwidget/gifwidget.pro
- I:/gitee/QWidgetDemo/gifwidget/gifwidget.pro
- false
- true
- true
- false
- true
- I:/gitee/QWidgetDemo/gifwidget/../bin
-
-
- dwarf
-
- cpu-cycles
-
-
- 250
-
- -e
- cpu-cycles
- --call-graph
- dwarf,4096
- -F
- 250
-
- -F
- true
- 4096
- false
- false
- 1000
-
- true
-
- false
- false
- false
- false
- true
- 0.01
- 10
- true
- kcachegrind
- 1
- 25
-
- 1
- true
- false
- true
- valgrind
-
- 0
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
-
-
- 2
-
- Qt4ProjectManager.Qt4RunConfiguration:I:/gitee/QWidgetDemo/imageswitch/imageswitch.pro
- I:/gitee/QWidgetDemo/imageswitch/imageswitch.pro
- false
- true
- true
- false
- true
- I:/gitee/QWidgetDemo/imageswitch/../bin
-
-
- dwarf
-
- cpu-cycles
-
-
- 250
-
- -e
- cpu-cycles
- --call-graph
- dwarf,4096
- -F
- 250
-
- -F
- true
- 4096
- false
- false
- 1000
-
- true
-
- false
- false
- false
- false
- true
- 0.01
- 10
- true
- kcachegrind
- 1
- 25
-
- 1
- true
- false
- true
- valgrind
-
- 0
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
-
-
- 2
-
- Qt4ProjectManager.Qt4RunConfiguration:I:/gitee/QWidgetDemo/ipaddress/ipaddress.pro
- I:/gitee/QWidgetDemo/ipaddress/ipaddress.pro
- false
- true
- true
- false
- true
- I:/gitee/QWidgetDemo/ipaddress/../bin
-
-
- dwarf
-
- cpu-cycles
-
-
- 250
-
- -e
- cpu-cycles
- --call-graph
- dwarf,4096
- -F
- 250
-
- -F
- true
- 4096
- false
- false
- 1000
-
- true
-
- false
- false
- false
- false
- true
- 0.01
- 10
- true
- kcachegrind
- 1
- 25
-
- 1
- true
- false
- true
- valgrind
-
- 0
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
-
-
- 2
-
- Qt4ProjectManager.Qt4RunConfiguration:I:/gitee/QWidgetDemo/lightbutton/lightbutton.pro
- I:/gitee/QWidgetDemo/lightbutton/lightbutton.pro
- false
- true
- true
- false
- true
- I:/gitee/QWidgetDemo/lightbutton/../bin
-
-
- dwarf
-
- cpu-cycles
-
-
- 250
-
- -e
- cpu-cycles
- --call-graph
- dwarf,4096
- -F
- 250
-
- -F
- true
- 4096
- false
- false
- 1000
-
- true
-
- false
- false
- false
- false
- true
- 0.01
- 10
- true
- kcachegrind
- 1
- 25
-
- 1
- true
- false
- true
- valgrind
-
- 0
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
-
-
- 2
-
- Qt4ProjectManager.Qt4RunConfiguration:I:/gitee/QWidgetDemo/lineeditnext/lineeditnext.pro
- I:/gitee/QWidgetDemo/lineeditnext/lineeditnext.pro
- false
- true
- true
- false
- true
- I:/gitee/QWidgetDemo/lineeditnext/../bin
-
-
- dwarf
-
- cpu-cycles
-
-
- 250
-
- -e
- cpu-cycles
- --call-graph
- dwarf,4096
- -F
- 250
-
- -F
- true
- 4096
- false
- false
- 1000
-
- true
-
- false
- false
- false
- false
- true
- 0.01
- 10
- true
- kcachegrind
- 1
- 25
-
- 1
- true
- false
- true
- valgrind
-
- 0
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
-
-
- 2
-
- Qt4ProjectManager.Qt4RunConfiguration:I:/gitee/QWidgetDemo/lunarcalendarwidget/lunarcalendarwidget.pro
- I:/gitee/QWidgetDemo/lunarcalendarwidget/lunarcalendarwidget.pro
- false
- true
- true
- false
- true
- I:/gitee/QWidgetDemo/lunarcalendarwidget/../bin
-
-
- dwarf
-
- cpu-cycles
-
-
- 250
-
- -e
- cpu-cycles
- --call-graph
- dwarf,4096
- -F
- 250
-
- -F
- true
- 4096
- false
- false
- 1000
-
- true
-
- false
- false
- false
- false
- true
- 0.01
- 10
- true
- kcachegrind
- 1
- 25
-
- 1
- true
- false
- true
- valgrind
-
- 0
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
-
-
- 2
-
- Qt4ProjectManager.Qt4RunConfiguration:I:/gitee/QWidgetDemo/maskwidget/maskwidget.pro
- I:/gitee/QWidgetDemo/maskwidget/maskwidget.pro
- false
- true
- true
- false
- true
- I:/gitee/QWidgetDemo/maskwidget/../bin
-
-
- dwarf
-
- cpu-cycles
-
-
- 250
-
- -e
- cpu-cycles
- --call-graph
- dwarf,4096
- -F
- 250
-
- -F
- true
- 4096
- false
- false
- 1000
-
- true
-
- false
- false
- false
- false
- true
- 0.01
- 10
- true
- kcachegrind
- 1
- 25
-
- 1
- true
- false
- true
- valgrind
-
- 0
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
-
-
- 2
-
- Qt4ProjectManager.Qt4RunConfiguration:I:/gitee/QWidgetDemo/bgdemo/bgdemo.pro
- I:/gitee/QWidgetDemo/bgdemo/bgdemo.pro
- false
- true
- true
- false
- true
- I:/gitee/QWidgetDemo/bgdemo/../bin
-
-
- dwarf
-
- cpu-cycles
-
-
- 250
-
- -e
- cpu-cycles
- --call-graph
- dwarf,4096
- -F
- 250
-
- -F
- true
- 4096
- false
- false
- 1000
-
- true
-
- false
- false
- false
- false
- true
- 0.01
- 10
- true
- kcachegrind
- 1
- 25
-
- 1
- true
- false
- true
- valgrind
-
- 0
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
-
-
- 2
-
- Qt4ProjectManager.Qt4RunConfiguration:I:/gitee/QWidgetDemo/miniblink/miniblink.pro
- I:/gitee/QWidgetDemo/miniblink/miniblink.pro
- false
- true
- true
- false
- true
- I:/gitee/QWidgetDemo/miniblink/../bin
-
-
- dwarf
-
- cpu-cycles
-
-
- 250
-
- -e
- cpu-cycles
- --call-graph
- dwarf,4096
- -F
- 250
-
- -F
- true
- 4096
- false
- false
- 1000
-
- true
-
- false
- false
- false
- false
- true
- 0.01
- 10
- true
- kcachegrind
- 1
- 25
-
- 1
- true
- false
- true
- valgrind
-
- 0
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
-
-
- 2
-
- Qt4ProjectManager.Qt4RunConfiguration:I:/gitee/QWidgetDemo/mouseline/mouseline.pro
- I:/gitee/QWidgetDemo/mouseline/mouseline.pro
- false
- true
- true
- false
- true
- I:/gitee/QWidgetDemo/mouseline/../bin
-
-
- dwarf
-
- cpu-cycles
-
-
- 250
-
- -e
- cpu-cycles
- --call-graph
- dwarf,4096
- -F
- 250
-
- -F
- true
- 4096
- false
- false
- 1000
-
- true
-
- false
- false
- false
- false
- true
- 0.01
- 10
- true
- kcachegrind
- 1
- 25
-
- 1
- true
- false
- true
- valgrind
-
- 0
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
-
-
- 2
-
- Qt4ProjectManager.Qt4RunConfiguration:I:/gitee/QWidgetDemo/movewidget/movewidget.pro
- I:/gitee/QWidgetDemo/movewidget/movewidget.pro
- false
- true
- true
- false
- true
- I:/gitee/QWidgetDemo/movewidget/../bin
-
-
- dwarf
-
- cpu-cycles
-
-
- 250
-
- -e
- cpu-cycles
- --call-graph
- dwarf,4096
- -F
- 250
-
- -F
- true
- 4096
- false
- false
- 1000
-
- true
-
- false
- false
- false
- false
- true
- 0.01
- 10
- true
- kcachegrind
- 1
- 25
-
- 1
- true
- false
- true
- valgrind
-
- 0
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
-
-
- 2
-
- Qt4ProjectManager.Qt4RunConfiguration:I:/gitee/QWidgetDemo/mpvdemo/mpvdemo.pro
- I:/gitee/QWidgetDemo/mpvdemo/mpvdemo.pro
- false
- true
- true
- false
- true
- I:/gitee/QWidgetDemo/mpvdemo/../bin
-
-
- dwarf
-
- cpu-cycles
-
-
- 250
-
- -e
- cpu-cycles
- --call-graph
- dwarf,4096
- -F
- 250
-
- -F
- true
- 4096
- false
- false
- 1000
-
- true
-
- false
- false
- false
- false
- true
- 0.01
- 10
- true
- kcachegrind
- 1
- 25
-
- 1
- true
- false
- true
- valgrind
-
- 0
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
-
-
- 2
-
- Qt4ProjectManager.Qt4RunConfiguration:I:/gitee/QWidgetDemo/navbutton/navbutton.pro
- I:/gitee/QWidgetDemo/navbutton/navbutton.pro
- false
- true
- true
- false
- true
- I:/gitee/QWidgetDemo/navbutton/../bin
-
-
- dwarf
-
- cpu-cycles
-
-
- 250
-
- -e
- cpu-cycles
- --call-graph
- dwarf,4096
- -F
- 250
-
- -F
- true
- 4096
- false
- false
- 1000
-
- true
-
- false
- false
- false
- false
- true
- 0.01
- 10
- true
- kcachegrind
- 1
- 25
-
- 1
- true
- false
- true
- valgrind
-
- 0
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
-
-
- 2
-
- Qt4ProjectManager.Qt4RunConfiguration:I:/gitee/QWidgetDemo/netserver/netserver.pro
- I:/gitee/QWidgetDemo/netserver/netserver.pro
- false
- true
- true
- false
- true
- I:/gitee/QWidgetDemo/core_qui/../bin
-
-
- dwarf
-
- cpu-cycles
-
-
- 250
-
- -e
- cpu-cycles
- --call-graph
- dwarf,4096
- -F
- 250
-
- -F
- true
- 4096
- false
- false
- 1000
-
- true
-
- false
- false
- false
- false
- true
- 0.01
- 10
- true
- kcachegrind
- 1
- 25
-
- 1
- true
- false
- true
- valgrind
-
- 0
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
-
-
- 2
-
- Qt4ProjectManager.Qt4RunConfiguration:I:/gitee/QWidgetDemo/nettool/nettool.pro
- I:/gitee/QWidgetDemo/nettool/nettool.pro
- false
- true
- true
- false
- true
- I:/gitee/QWidgetDemo/core_qui/../bin
-
-
- dwarf
-
- cpu-cycles
-
-
- 250
-
- -e
- cpu-cycles
- --call-graph
- dwarf,4096
- -F
- 250
-
- -F
- true
- 4096
- false
- false
- 1000
-
- true
-
- false
- false
- false
- false
- true
- 0.01
- 10
- true
- kcachegrind
- 1
- 25
-
- 1
- true
- false
- true
- valgrind
-
- 0
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
-
-
- 2
-
- Qt4ProjectManager.Qt4RunConfiguration:I:/gitee/QWidgetDemo/ntpclient/ntpclient.pro
- I:/gitee/QWidgetDemo/ntpclient/ntpclient.pro
- false
- true
- true
- false
- true
- I:/gitee/QWidgetDemo/ntpclient/../bin
-
-
- dwarf
-
- cpu-cycles
-
-
- 250
-
- -e
- cpu-cycles
- --call-graph
- dwarf,4096
- -F
- 250
-
- -F
- true
- 4096
- false
- false
- 1000
-
- true
-
- false
- false
- false
- false
- true
- 0.01
- 10
- true
- kcachegrind
- 1
- 25
-
- 1
- true
- false
- true
- valgrind
-
- 0
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
-
-
- 2
-
- Qt4ProjectManager.Qt4RunConfiguration:I:/gitee/QWidgetDemo/pngtool/pngtool.pro
- I:/gitee/QWidgetDemo/pngtool/pngtool.pro
- false
- true
- true
- false
- true
- I:/gitee/QWidgetDemo/pngtool/../bin
-
-
- dwarf
-
- cpu-cycles
-
-
- 250
-
- -e
- cpu-cycles
- --call-graph
- dwarf,4096
- -F
- 250
-
- -F
- true
- 4096
- false
- false
- 1000
-
- true
-
- false
- false
- false
- false
- true
- 0.01
- 10
- true
- kcachegrind
- 1
- 25
-
- 1
- true
- false
- true
- valgrind
-
- 0
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
-
-
- 2
-
- Qt4ProjectManager.Qt4RunConfiguration:I:/gitee/QWidgetDemo/qwtdemo/qwtdemo.pro
- I:/gitee/QWidgetDemo/qwtdemo/qwtdemo.pro
- false
- true
- true
- false
- true
- I:/gitee/QWidgetDemo/qwtdemo/../bin
-
-
- dwarf
-
- cpu-cycles
-
-
- 250
-
- -e
- cpu-cycles
- --call-graph
- dwarf,4096
- -F
- 250
-
- -F
- true
- 4096
- false
- false
- 1000
-
- true
-
- false
- false
- false
- false
- true
- 0.01
- 10
- true
- kcachegrind
- 1
- 25
-
- 1
- true
- false
- true
- valgrind
-
- 0
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
-
-
- 2
-
- Qt4ProjectManager.Qt4RunConfiguration:I:/gitee/QWidgetDemo/colorwidget/colorwidget.pro
- I:/gitee/QWidgetDemo/colorwidget/colorwidget.pro
- false
- true
- true
- false
- true
- I:/gitee/QWidgetDemo/colorwidget/../bin
-
-
- dwarf
-
- cpu-cycles
-
-
- 250
-
- -e
- cpu-cycles
- --call-graph
- dwarf,4096
- -F
- 250
-
- -F
- true
- 4096
- false
- false
- 1000
-
- true
-
- false
- false
- false
- false
- true
- 0.01
- 10
- true
- kcachegrind
- 1
- 25
-
- 1
- true
- false
- true
- valgrind
-
- 0
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
-
-
- 2
-
- Qt4ProjectManager.Qt4RunConfiguration:I:/gitee/QWidgetDemo/savelog/savelog.pro
- I:/gitee/QWidgetDemo/savelog/savelog.pro
- false
- true
- true
- false
- true
- I:/gitee/QWidgetDemo/savelog/../bin
-
-
- dwarf
-
- cpu-cycles
-
-
- 250
-
- -e
- cpu-cycles
- --call-graph
- dwarf,4096
- -F
- 250
-
- -F
- true
- 4096
- false
- false
- 1000
-
- true
-
- false
- false
- false
- false
- true
- 0.01
- 10
- true
- kcachegrind
- 1
- 25
-
- 1
- true
- false
- true
- valgrind
-
- 0
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
-
-
- 2
-
- Qt4ProjectManager.Qt4RunConfiguration:I:/gitee/QWidgetDemo/saveruntime/saveruntime.pro
- I:/gitee/QWidgetDemo/saveruntime/saveruntime.pro
- false
- true
- true
- false
- true
- I:/gitee/QWidgetDemo/saveruntime/../bin
-
-
- dwarf
-
- cpu-cycles
-
-
- 250
-
- -e
- cpu-cycles
- --call-graph
- dwarf,4096
- -F
- 250
-
- -F
- true
- 4096
- false
- false
- 1000
-
- true
-
- false
- false
- false
- false
- true
- 0.01
- 10
- true
- kcachegrind
- 1
- 25
-
- 1
- true
- false
- true
- valgrind
-
- 0
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
-
-
- 2
-
- Qt4ProjectManager.Qt4RunConfiguration:I:/gitee/QWidgetDemo/screenwidget/screenwidget.pro
- I:/gitee/QWidgetDemo/screenwidget/screenwidget.pro
- false
- true
- true
- false
- true
- I:/gitee/QWidgetDemo/screenwidget/../bin
-
-
- dwarf
-
- cpu-cycles
-
-
- 250
-
- -e
- cpu-cycles
- --call-graph
- dwarf,4096
- -F
- 250
-
- -F
- true
- 4096
- false
- false
- 1000
-
- true
-
- false
- false
- false
- false
- true
- 0.01
- 10
- true
- kcachegrind
- 1
- 25
-
- 1
- true
- false
- true
- valgrind
-
- 0
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
-
-
- 2
-
- Qt4ProjectManager.Qt4RunConfiguration:I:/gitee/QWidgetDemo/smoothcurve/smoothcurve.pro
- I:/gitee/QWidgetDemo/smoothcurve/smoothcurve.pro
- false
- true
- true
- false
- true
- I:/gitee/QWidgetDemo/smoothcurve/../bin
-
-
- dwarf
-
- cpu-cycles
-
-
- 250
-
- -e
- cpu-cycles
- --call-graph
- dwarf,4096
- -F
- 250
-
- -F
- true
- 4096
- false
- false
- 1000
-
- true
-
- false
- false
- false
- false
- true
- 0.01
- 10
- true
- kcachegrind
- 1
- 25
-
- 1
- true
- false
- true
- valgrind
-
- 0
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
-
-
- 2
-
- Qt4ProjectManager.Qt4RunConfiguration:I:/gitee/QWidgetDemo/styledemo/styledemo.pro
- I:/gitee/QWidgetDemo/styledemo/styledemo.pro
- false
- true
- true
- false
- true
- I:/gitee/QWidgetDemo/styledemo/../bin
-
-
- dwarf
-
- cpu-cycles
-
-
- 250
-
- -e
- cpu-cycles
- --call-graph
- dwarf,4096
- -F
- 250
-
- -F
- true
- 4096
- false
- false
- 1000
-
- true
-
- false
- false
- false
- false
- true
- 0.01
- 10
- true
- kcachegrind
- 1
- 25
-
- 1
- true
- false
- true
- valgrind
-
- 0
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
-
-
- 2
-
- Qt4ProjectManager.Qt4RunConfiguration:I:/gitee/QWidgetDemo/videopanel/videopanel.pro
- I:/gitee/QWidgetDemo/videopanel/videopanel.pro
- false
- true
- true
- false
- true
- I:/gitee/QWidgetDemo/videopanel/../bin
-
-
- dwarf
-
- cpu-cycles
-
-
- 250
-
- -e
- cpu-cycles
- --call-graph
- dwarf,4096
- -F
- 250
-
- -F
- true
- 4096
- false
- false
- 1000
-
- true
-
- false
- false
- false
- false
- true
- 0.01
- 10
- true
- kcachegrind
- 1
- 25
-
- 1
- true
- false
- true
- valgrind
-
- 0
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
-
-
- 2
-
- Qt4ProjectManager.Qt4RunConfiguration:I:/gitee/QWidgetDemo/videowidget/videowidget.pro
- I:/gitee/QWidgetDemo/videowidget/videowidget.pro
- false
- true
- true
- false
- true
- I:/gitee/QWidgetDemo/videowidget/../bin
-
-
- dwarf
-
- cpu-cycles
-
-
- 250
-
- -e
- cpu-cycles
- --call-graph
- dwarf,4096
- -F
- 250
-
- -F
- true
- 4096
- false
- false
- 1000
-
- true
-
- false
- false
- false
- false
- true
- 0.01
- 10
- true
- kcachegrind
- 1
- 25
-
- 1
- true
- false
- true
- valgrind
-
- 0
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
-
-
- 2
-
- Qt4ProjectManager.Qt4RunConfiguration:I:/gitee/QWidgetDemo/vlcdemo/vlcdemo.pro
- I:/gitee/QWidgetDemo/vlcdemo/vlcdemo.pro
- false
- true
- true
- false
- true
- I:/gitee/QWidgetDemo/vlcdemo/../bin
-
-
- dwarf
-
- cpu-cycles
-
-
- 250
-
- -e
- cpu-cycles
- --call-graph
- dwarf,4096
- -F
- 250
-
- -F
- true
- 4096
- false
- false
- 1000
-
- true
-
- false
- false
- false
- false
- true
- 0.01
- 10
- true
- kcachegrind
- 1
- 25
-
- 1
- true
- false
- true
- valgrind
-
- 0
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
-
-
- 2
-
- Qt4ProjectManager.Qt4RunConfiguration:I:/gitee/QWidgetDemo/zhtopy/zhtopy.pro
- I:/gitee/QWidgetDemo/zhtopy/zhtopy.pro
- false
- true
- true
- false
- true
- I:/gitee/QWidgetDemo/zhtopy/../bin
-
-
- dwarf
-
- cpu-cycles
-
-
- 250
-
- -e
- cpu-cycles
- --call-graph
- dwarf,4096
- -F
- 250
-
- -F
- true
- 4096
- false
- false
- 1000
-
- true
-
- false
- false
- false
- false
- true
- 0.01
- 10
- true
- kcachegrind
- 1
- 25
-
- 1
- true
- false
- true
- valgrind
-
- 0
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
-
-
- 2
-
- Qt4ProjectManager.Qt4RunConfiguration:I:/gitee/QWidgetDemo/comtool/comtool.pro
- I:/gitee/QWidgetDemo/comtool/comtool.pro
- false
- true
- true
- false
- true
- I:/gitee/QWidgetDemo/core_qui/../bin
-
-
- dwarf
-
- cpu-cycles
-
-
- 250
-
- -e
- cpu-cycles
- --call-graph
- dwarf,4096
- -F
- 250
-
- -F
- true
- 4096
- false
- false
- 1000
-
- true
-
- false
- false
- false
- false
- true
- 0.01
- 10
- true
- kcachegrind
- 1
- 25
-
- 1
- true
- false
- true
- valgrind
-
- 0
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
-
-
- 2
-
- Qt4ProjectManager.Qt4RunConfiguration:I:/gitee/QWidgetDemo/countcode/countcode.pro
- I:/gitee/QWidgetDemo/countcode/countcode.pro
- false
- true
- true
- false
- true
- I:/gitee/QWidgetDemo/countcode/../bin
-
-
- dwarf
-
- cpu-cycles
-
-
- 250
-
- -e
- cpu-cycles
- --call-graph
- dwarf,4096
- -F
- 250
-
- -F
- true
- 4096
- false
- false
- 1000
-
- true
-
- false
- false
- false
- false
- true
- 0.01
- 10
- true
- kcachegrind
- 1
- 25
-
- 1
- true
- false
- true
- valgrind
-
- 0
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
-
-
- 2
-
- Qt4ProjectManager.Qt4RunConfiguration:I:/gitee/QWidgetDemo/dbpage/dbpage.pro
- I:/gitee/QWidgetDemo/dbpage/dbpage.pro
- false
- true
- true
- false
- true
- I:/gitee/QWidgetDemo/dbpage/../bin
-
-
- dwarf
-
- cpu-cycles
-
-
- 250
-
- -e
- cpu-cycles
- --call-graph
- dwarf,4096
- -F
- 250
-
- -F
- true
- 4096
- false
- false
- 1000
-
- true
-
- false
- false
- false
- false
- true
- 0.01
- 10
- true
- kcachegrind
- 1
- 25
-
- 1
- true
- false
- true
- valgrind
-
- 0
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
-
-
- 2
-
- Qt4ProjectManager.Qt4RunConfiguration:I:/gitee/QWidgetDemo/devicebutton/devicebutton.pro
- I:/gitee/QWidgetDemo/devicebutton/devicebutton.pro
- false
- true
- true
- false
- true
- I:/gitee/QWidgetDemo/devicebutton/../bin
-
-
- dwarf
-
- cpu-cycles
-
-
- 250
-
- -e
- cpu-cycles
- --call-graph
- dwarf,4096
- -F
- 250
-
- -F
- true
- 4096
- false
- false
- 1000
-
- true
-
- false
- false
- false
- false
- true
- 0.01
- 10
- true
- kcachegrind
- 1
- 25
-
- 1
- true
- false
- true
- valgrind
-
- 0
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
-
-
- 2
-
- Qt4ProjectManager.Qt4RunConfiguration:I:/gitee/QWidgetDemo/devicesizetable/devicesizetable.pro
- I:/gitee/QWidgetDemo/devicesizetable/devicesizetable.pro
- false
- true
- true
- false
- true
- I:/gitee/QWidgetDemo/devicesizetable/../bin
-
-
- dwarf
-
- cpu-cycles
-
-
- 250
-
- -e
- cpu-cycles
- --call-graph
- dwarf,4096
- -F
- 250
-
- -F
- true
- 4096
- false
- false
- 1000
-
- true
-
- false
- false
- false
- false
- true
- 0.01
- 10
- true
- kcachegrind
- 1
- 25
-
- 1
- true
- false
- true
- valgrind
-
- 0
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
-
-
- 2
-
- Qt4ProjectManager.Qt4RunConfiguration:I:/gitee/QWidgetDemo/emailtool/emailtool.pro
- I:/gitee/QWidgetDemo/emailtool/emailtool.pro
- false
- true
- true
- false
- true
- I:/gitee/QWidgetDemo/emailtool/../bin
-
- 39
-
-
-
- ProjectExplorer.Project.TargetCount
- 1
-
-
- ProjectExplorer.Project.Updater.FileVersion
- 22
-
-
- Version
- 22
-
-
diff --git a/README.md b/README.md
index 50e722c..4e36f55 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-#### 一、目录说明
+#### 一、目录说明
1. **可以选择打开QWidgetDemo.pro一次性编译所有的,也可以进入到目录下打开pro进行编译。**
2. **如果发现有些子项目没有加载请打开QWidgetDemo.pro仔细看里面的注释。**
3. **编译好的可执行文件在源码同级目录下的bin目录。**
@@ -6,7 +6,7 @@
5. **本项目开源的是下面表格中描述的内容,并未开源左侧的树状导航菜单控件,只是方便演示效果图直接用的自定义控件大全的效果图,懒得重新截图。**
| 编号 | 文件夹 | 描述 |
-| ------ | ------ | ------ |
+| :------ | :------ | :------ |
| 1 | lightbutton | 高亮按钮控件 |
| 2 | movewidget | 通用控件移动类 |
| 3 | flatui | 模仿flatui类 |
@@ -50,6 +50,7 @@
| 41 | miniblink | miniblink示例 |
| 42 | base64 | 图片文字base64互换 |
| 43 | smoothcurve | 平滑曲线 |
+| 44 | moneytool | 存款计算器 |
#### 二、学习群
1. **Qt交流大会群 853086607(雨田哥)**
@@ -101,4 +102,5 @@
![avatar](https://gitee.com/feiyangqingyun/QWidgetDemo/raw/master/0snap/miniblink.jpg)
![avatar](https://gitee.com/feiyangqingyun/QWidgetDemo/raw/master/0snap/base64.png)
![avatar](https://gitee.com/feiyangqingyun/QWidgetDemo/raw/master/0snap/smoothcurve.gif)
-![avatar](https://gitee.com/feiyangqingyun/QWidgetDemo/raw/master/0snap/frameless.gif)
\ No newline at end of file
+![avatar](https://gitee.com/feiyangqingyun/QWidgetDemo/raw/master/0snap/frameless.gif)
+![avatar](https://gitee.com/feiyangqingyun/QWidgetDemo/raw/master/0snap/moneytool.gif)
\ No newline at end of file
diff --git a/moneytool/main.cpp b/moneytool/main.cpp
new file mode 100644
index 0000000..90b6d53
--- /dev/null
+++ b/moneytool/main.cpp
@@ -0,0 +1,11 @@
+#include "widget.h"
+#include
+
+int main(int argc, char *argv[])
+{
+ QApplication a(argc, argv);
+ Widget w;
+ w.show();
+
+ return a.exec();
+}
diff --git a/moneytool/moneytool.pro b/moneytool/moneytool.pro
new file mode 100644
index 0000000..0502909
--- /dev/null
+++ b/moneytool/moneytool.pro
@@ -0,0 +1,13 @@
+QT += core gui
+greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
+greaterThan(QT_MAJOR_VERSION, 5): QT += core5compat
+
+TARGET = mouseline
+TEMPLATE = app
+DESTDIR = $$PWD/../bin
+CONFIG += warn_off
+
+SOURCES += main.cpp
+SOURCES += widget.cpp
+HEADERS += widget.h
+FORMS += widget.ui
diff --git a/moneytool/widget.cpp b/moneytool/widget.cpp
new file mode 100644
index 0000000..da6f68f
--- /dev/null
+++ b/moneytool/widget.cpp
@@ -0,0 +1,50 @@
+#pragma execution_character_set("utf-8")
+#include "widget.h"
+#include "ui_widget.h"
+#include "qmessagebox.h"
+#include "qdebug.h"
+
+Widget::Widget(QWidget *parent) : QWidget(parent), ui(new Ui::Widget)
+{
+ ui->setupUi(this);
+}
+
+Widget::~Widget()
+{
+ delete ui;
+}
+
+void Widget::on_btnOk_clicked()
+{
+ //当前多少钱
+ int moneyCurrent = ui->txtMoneyCurrent->text().toInt();
+ //利息
+ float rate = ui->txtRate->text().toFloat();
+ //定期期限
+ int year = ui->cboxYear->currentText().left(1).toInt();
+ //总年份 必须是定期期限的倍数
+ int years = ui->txtYears->text().toInt();
+ //最终多少钱
+ int moneyAll = 0;
+
+ if (years % year != 0) {
+ ui->txtYears->setFocus();
+ QMessageBox::critical(this, "错误", "总年份必须是期限的整数倍数!");
+ return;
+ }
+
+ if (ui->cboxType->currentIndex() == 0) {
+ //傻瓜场景 直接计算
+ moneyAll = moneyCurrent + (moneyCurrent * rate * years);
+ } else {
+ //真实场景 复利计算
+ int count = years / year;
+ for (int i = 0; i < count; ++i) {
+ moneyCurrent = moneyCurrent + (moneyCurrent * rate * year);
+ }
+ moneyAll = moneyCurrent;
+ }
+
+ //计算下来3年期定期存款30年总金额翻2番到最初本金3倍 100W本金3年期自动续期30年=321W
+ ui->txtMoneyAll->setText(QString::number(moneyAll));
+}
diff --git a/moneytool/widget.h b/moneytool/widget.h
new file mode 100644
index 0000000..aff0891
--- /dev/null
+++ b/moneytool/widget.h
@@ -0,0 +1,25 @@
+#ifndef WIDGET_H
+#define WIDGET_H
+
+#include
+
+namespace Ui {
+class Widget;
+}
+
+class Widget : public QWidget
+{
+ Q_OBJECT
+
+public:
+ explicit Widget(QWidget *parent = 0);
+ ~Widget();
+
+private slots:
+ void on_btnOk_clicked();
+
+private:
+ Ui::Widget *ui;
+};
+
+#endif // WIDGET_H
diff --git a/moneytool/widget.ui b/moneytool/widget.ui
new file mode 100644
index 0000000..24e0224
--- /dev/null
+++ b/moneytool/widget.ui
@@ -0,0 +1,150 @@
+
+
+ Widget
+
+
+
+ 0
+ 0
+ 400
+ 300
+
+
+
+ 存款计算器
+
+
+
+
+ 10
+ 10
+ 381
+ 86
+
+
+
+ -
+
+
+ 年限
+
+
+
+ -
+
+
+ 本金
+
+
+
+ -
+
+
+ 0.04125
+
+
+
+ -
+
+
+ 1000000
+
+
+
+ -
+
+
+ 利率
+
+
+
+ -
+
+
+ 期限
+
+
+
+ -
+
+
+ 方式
+
+
+
+ -
+
+
+ 1
+
+
-
+
+ 单利
+
+
+ -
+
+ 复利
+
+
+
+
+ -
+
+
+ 1
+
+
-
+
+ 1年
+
+
+ -
+
+ 3年
+
+
+ -
+
+ 5年
+
+
+
+
+ -
+
+
+ 30
+
+
+
+ -
+
+
+ -
+
+
+ 总计
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ 计算
+
+
+
+
+
+
+
+
+
+
diff --git a/mouseline/widget.cpp b/mouseline/widget.cpp
index 76d6211..258a4b0 100644
--- a/mouseline/widget.cpp
+++ b/mouseline/widget.cpp
@@ -4,9 +4,7 @@
#include "qevent.h"
#include "qdebug.h"
-Widget::Widget(QWidget *parent) :
- QWidget(parent),
- ui(new Ui::Widget)
+Widget::Widget(QWidget *parent) : QWidget(parent), ui(new Ui::Widget)
{
ui->setupUi(this);
this->setMouseTracking(true);
diff --git a/mouseline/widget.ui b/mouseline/widget.ui
index 8541684..a613bc4 100644
--- a/mouseline/widget.ui
+++ b/mouseline/widget.ui
@@ -1,7 +1,8 @@
+
Widget
-
-
+
+
0
0
@@ -9,12 +10,11 @@
300
-
- Widget
+
+ 鼠标十字线
-
-
+
diff --git a/savelog/savelog.cpp b/savelog/savelog.cpp
index 9bcf8c4..f8201ad 100644
--- a/savelog/savelog.cpp
+++ b/savelog/savelog.cpp
@@ -106,6 +106,12 @@ void SaveLog::save(const QString &content)
if (toNet) {
emit send(content);
} else {
+ //检查目录是否存在,不存在则先新建
+ QDir dir(path);
+ if (!dir.exists()) {
+ dir.mkdir(path);
+ }
+
//方法改进:之前每次输出日志都打开文件,改成只有当日期改变时才新建和打开文件
QString fileName = QString("%1/%2_log_%3.txt").arg(path).arg(name).arg(QDATE);
if (this->fileName != fileName) {
diff --git a/savelog/savelog.h b/savelog/savelog.h
index 2863582..4c7548f 100644
--- a/savelog/savelog.h
+++ b/savelog/savelog.h
@@ -44,10 +44,11 @@ private:
//日志文件完整名称
QString fileName;
-signals:
+Q_SIGNALS:
+ //发送内容信号
void send(const QString &content);
-public slots:
+public Q_SLOTS:
//启动日志服务
void start();
//暂停日志服务
@@ -61,7 +62,6 @@ public slots:
void setPath(const QString &path);
//设置日志文件名称
void setName(const QString &name);
-
};
class SendLog : public QObject
@@ -74,13 +74,17 @@ public:
private:
static QScopedPointer self;
+
+ //网络通信对象
QTcpSocket *socket;
+ //网络监听服务器
QTcpServer *server;
private slots:
+ //新连接到来
void newConnection();
-public slots:
+public Q_SLOTS:
//发送日志
void send(const QString &content);
};
diff --git a/saveruntime/saveruntime.cpp b/saveruntime/saveruntime.cpp
index 5bfe6d2..a7e210b 100644
--- a/saveruntime/saveruntime.cpp
+++ b/saveruntime/saveruntime.cpp
@@ -42,23 +42,6 @@ SaveRunTime::SaveRunTime(QObject *parent) : QObject(parent)
connect(timerSave, SIGNAL(timeout()), this, SLOT(saveLog()));
}
-void SaveRunTime::start()
-{
- //开始时间变量必须在这,在部分嵌入式系统上开机后的时间不准确比如是1970,而后会变成1999或者其他时间
- //会在getDiffValue函数执行很久很久
- startTime = QDateTime::currentDateTime();
- timerSave->start();
-
- initLog();
- appendLog();
- saveLog();
-}
-
-void SaveRunTime::stop()
-{
- timerSave->stop();
-}
-
void SaveRunTime::getDiffValue(const QDateTime &startTime, const QDateTime &endTime, int &day, int &hour, int &minute)
{
qint64 sec = startTime.secsTo(endTime);
@@ -86,6 +69,32 @@ void SaveRunTime::getDiffValue(const QDateTime &startTime, const QDateTime &endT
}
}
+void SaveRunTime::start()
+{
+ //开始时间变量必须在这,在部分嵌入式系统上开机后的时间不准确比如是1970,而后会变成1999或者其他时间
+ //会在getDiffValue函数执行很久很久
+ startTime = QDateTime::currentDateTime();
+ timerSave->start();
+
+ initLog();
+ appendLog();
+ saveLog();
+}
+
+void SaveRunTime::stop()
+{
+ timerSave->stop();
+}
+
+void SaveRunTime::newPath()
+{
+ //检查目录是否存在,不存在则先新建
+ QDir dir(path);
+ if (!dir.exists()) {
+ dir.mkdir(path);
+ }
+}
+
void SaveRunTime::initLog()
{
//判断当前年份的记事本文件是否存在,不存在则新建并且写入标题
@@ -93,6 +102,7 @@ void SaveRunTime::initLog()
//幢号 开始时间 结束时间 已运行时间
//1 2016-01-01 12:33:33 2016-02-05 12:12:12 day: 0 hour: 0 minute: 0
+ newPath();
logFile = QString("%1/%2_runtime_%3.txt").arg(path).arg(name).arg(QDate::currentDate().year());
QFile file(logFile);
@@ -127,6 +137,7 @@ void SaveRunTime::initLog()
void SaveRunTime::appendLog()
{
+ newPath();
logFile = QString("%1/%2_runtime_%3.txt").arg(path).arg(name).arg(QDate::currentDate().year());
QFile file(logFile);
@@ -150,6 +161,7 @@ void SaveRunTime::appendLog()
void SaveRunTime::saveLog()
{
//每次保存都是将之前的所有文本读取出来,然后替换最后一行即可
+ newPath();
logFile = QString("%1/%2_runtime_%3.txt").arg(path).arg(name).arg(QDate::currentDate().year());
QFile file(logFile);
@@ -199,16 +211,12 @@ void SaveRunTime::saveLog()
void SaveRunTime::setPath(const QString &path)
{
- if (this->path != path) {
- this->path = path;
- }
+ this->path = path;
}
void SaveRunTime::setName(const QString &name)
{
- if (this->name != name) {
- this->name = name;
- }
+ this->name = name;
}
void SaveRunTime::setSaveInterval(int saveInterval)
diff --git a/saveruntime/saveruntime.h b/saveruntime/saveruntime.h
index 5044b45..62225bd 100644
--- a/saveruntime/saveruntime.h
+++ b/saveruntime/saveruntime.h
@@ -12,6 +12,7 @@
#include
#include
+
class QTimer;
#ifdef quc
@@ -28,29 +29,47 @@ public:
private:
static QScopedPointer self;
- QString path; //日志文件路径
- QString name; //日志文件名称
+ //日志文件路径
+ QString path;
+ //日志文件名称
+ QString name;
+
+ //最后的编号
int lastID;
+ //保存间隔
int saveInterval;
+ //开始时间
QDateTime startTime;
+ //日志文件
QString logFile;
+ //保存文件定时器
QTimer *timerSave;
private:
+ //比较两个时间差值
void getDiffValue(const QDateTime &startTime, const QDateTime &endTime, int &day, int &hour, int &minute);
-signals:
+public Q_SLOTS:
+ //启动服务
+ void start();
+ //停止服务
+ void stop();
-public slots:
- void start(); //启动服务
- void stop(); //停止服务
- void initLog(); //初始化日志文件
- void appendLog(); //追加一条记录到日志文件
- void saveLog(); //保存运行时间到日志文件
+ //新建目录
+ void newPath();
+ //初始化日志文件
+ void initLog();
+ //追加一条记录到日志文件
+ void appendLog();
+ //保存运行时间到日志文件
+ void saveLog();
+ //设置文件保存目录
void setPath(const QString &path);
+ //设置文件名称
void setName(const QString &name);
+ //设置保存间隔
void setSaveInterval(int saveInterval);
};