diff --git a/src/ChangShaTour/ChangShaTour.pro b/src/ChangShaTour/ChangShaTour.pro index 535bfde..bebb9fc 100644 --- a/src/ChangShaTour/ChangShaTour.pro +++ b/src/ChangShaTour/ChangShaTour.pro @@ -1,4 +1,4 @@ -QT += core gui webenginewidgets sql +QT += core gui webenginewidgets sql network greaterThan(QT_MAJOR_VERSION, 4): QT += widgets @@ -38,6 +38,7 @@ SOURCES += \ recommendwidget.cpp \ registermanager.cpp \ registerwidget.cpp \ + route.cpp \ routechoicewidget.cpp \ searchwidget.cpp \ showplaceinfowidget.cpp \ @@ -49,6 +50,7 @@ SOURCES += \ webwidget.cpp HEADERS += \ + RouteItem.h \ cglobal.h \ conditionwidget.h \ confirmwidget.h \ @@ -70,6 +72,7 @@ HEADERS += \ recommendwidget.h \ registermanager.h \ registerwidget.h \ + route.h \ routechoicewidget.h \ searchwidget.h \ showplaceinfowidget.h \ diff --git a/src/ChangShaTour/ChangShaTour.pro.user b/src/ChangShaTour/ChangShaTour.pro.user index ff40fb2..124f655 100644 --- a/src/ChangShaTour/ChangShaTour.pro.user +++ b/src/ChangShaTour/ChangShaTour.pro.user @@ -1,806 +1,562 @@ - - - - - - EnvironmentId - {61ba832e-6c30-4ab6-b0b8-ace44f46ca0c} - - - 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 - false - 0 - true - true - true - false - - - - ProjectExplorer.Project.PluginSettings - - - -fno-delayed-template-parsing - - true - - - - ProjectExplorer.Project.Target.0 - - Desktop Qt 5.14.2 MSVC2017 64bit - Desktop Qt 5.14.2 MSVC2017 64bit - qt.qt5.5142.win64_msvc2017_64_kit - 0 - 0 - 0 - - D:/Study/SE/project/code/Trip-in-Chang-sha-main-4/Trip-in-Chang-sha-main/build-ChangShaTour-Desktop_Qt_5_14_2_MSVC2017_64bit-Debug - - - true - QtProjectManager.QMakeBuildStep - true - - false - false - false - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Debug - Qt4ProjectManager.Qt4BuildConfiguration - 2 - - - D:/Study/SE/project/code/Trip-in-Chang-sha-main-4/Trip-in-Chang-sha-main/build-ChangShaTour-Desktop_Qt_5_14_2_MSVC2017_64bit-Release - - - true - QtProjectManager.QMakeBuildStep - false - - false - false - true - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Release - Qt4ProjectManager.Qt4BuildConfiguration - 0 - - - D:/Study/SE/project/code/Trip-in-Chang-sha-main-4/Trip-in-Chang-sha-main/build-ChangShaTour-Desktop_Qt_5_14_2_MSVC2017_64bit-Profile - - - true - QtProjectManager.QMakeBuildStep - true - - false - true - true - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Profile - Qt4ProjectManager.Qt4BuildConfiguration - 0 - - 3 - - - 0 - Deploy - Deploy - ProjectExplorer.BuildSteps.Deploy - - 1 - 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 - - ChangShaTour2 - Qt4ProjectManager.Qt4RunConfiguration:D:/ChangShaTour/ChangShaTour.pro - D:/ChangShaTour/ChangShaTour.pro - - false - - false - true - true - false - false - true - - D:/Study/SE/project/code/Trip-in-Chang-sha-main-4/Trip-in-Chang-sha-main/build-ChangShaTour-Desktop_Qt_5_14_2_MSVC2017_64bit-Debug - - 1 - - - - ProjectExplorer.Project.Target.1 - - Desktop Qt 5.14.2 MinGW 32-bit - Desktop Qt 5.14.2 MinGW 32-bit - qt.qt5.5142.win32_mingw73_kit - 0 - 0 - 0 - - D:/Study/SE/project/code/Trip-in-Chang-sha-main-4/Trip-in-Chang-sha-main/build-ChangShaTour-Desktop_Qt_5_14_2_MinGW_32_bit-Debug - - - true - QtProjectManager.QMakeBuildStep - true - - false - false - false - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Debug - Qt4ProjectManager.Qt4BuildConfiguration - 2 - - - D:/Study/SE/project/code/Trip-in-Chang-sha-main-4/Trip-in-Chang-sha-main/build-ChangShaTour-Desktop_Qt_5_14_2_MinGW_32_bit-Release - - - true - QtProjectManager.QMakeBuildStep - false - - false - false - true - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Release - Qt4ProjectManager.Qt4BuildConfiguration - 0 - - - D:/Study/SE/project/code/Trip-in-Chang-sha-main-4/Trip-in-Chang-sha-main/build-ChangShaTour-Desktop_Qt_5_14_2_MinGW_32_bit-Profile - - - true - QtProjectManager.QMakeBuildStep - true - - false - true - true - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Profile - Qt4ProjectManager.Qt4BuildConfiguration - 0 - - 3 - - - 0 - Deploy - Deploy - ProjectExplorer.BuildSteps.Deploy - - 1 - 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 - - - ProjectExplorer.CustomExecutableRunConfiguration - - - false - - false - true - false - false - true - - - - 1 - - - - ProjectExplorer.Project.Target.2 - - Desktop Qt 5.14.2 MinGW 64-bit - Desktop Qt 5.14.2 MinGW 64-bit - qt.qt5.5142.win64_mingw73_kit - 0 - 0 - 0 - - D:/Study/SE/project/code/Trip-in-Chang-sha-main-4/Trip-in-Chang-sha-main/build-ChangShaTour-Desktop_Qt_5_14_2_MinGW_64_bit-Debug - - - true - QtProjectManager.QMakeBuildStep - true - - false - false - false - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Debug - Qt4ProjectManager.Qt4BuildConfiguration - 2 - - - D:/Study/SE/project/code/Trip-in-Chang-sha-main-4/Trip-in-Chang-sha-main/build-ChangShaTour-Desktop_Qt_5_14_2_MinGW_64_bit-Release - - - true - QtProjectManager.QMakeBuildStep - false - - false - false - true - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Release - Qt4ProjectManager.Qt4BuildConfiguration - 0 - - - D:/Study/SE/project/code/Trip-in-Chang-sha-main-4/Trip-in-Chang-sha-main/build-ChangShaTour-Desktop_Qt_5_14_2_MinGW_64_bit-Profile - - - true - QtProjectManager.QMakeBuildStep - true - - false - true - true - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Profile - Qt4ProjectManager.Qt4BuildConfiguration - 0 - - 3 - - - 0 - Deploy - Deploy - ProjectExplorer.BuildSteps.Deploy - - 1 - 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 - - - ProjectExplorer.CustomExecutableRunConfiguration - - - false - - false - true - false - false - true - - - - 1 - - - - ProjectExplorer.Project.TargetCount - 3 - - - ProjectExplorer.Project.Updater.FileVersion - 22 - - - Version - 22 - - + + + + + + EnvironmentId + {4109ff11-a646-43d1-9619-aeb32783df6e} + + + 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 + 1 + true + true + true + false + + + + ProjectExplorer.Project.PluginSettings + + + -fno-delayed-template-parsing + + true + + + + ProjectExplorer.Project.Target.0 + + Desktop Qt 5.14.2 MSVC2017 64bit + Desktop Qt 5.14.2 MSVC2017 64bit + qt.qt5.5142.win64_msvc2017_64_kit + 1 + 0 + 0 + + E:/ChangShaTour/Trip-in-Chang-sha/build-ChangShaTour-Desktop_Qt_5_14_2_MSVC2017_64bit-Debug + + + true + QtProjectManager.QMakeBuildStep + true + + false + false + false + + + true + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Debug + Qt4ProjectManager.Qt4BuildConfiguration + 2 + + + E:/ChangShaTour/Trip-in-Chang-sha/build-ChangShaTour-Desktop_Qt_5_14_2_MSVC2017_64bit-Release + + + true + QtProjectManager.QMakeBuildStep + false + + false + false + true + + + true + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Release + Qt4ProjectManager.Qt4BuildConfiguration + 0 + + + E:/ChangShaTour/Trip-in-Chang-sha/build-ChangShaTour-Desktop_Qt_5_14_2_MSVC2017_64bit-Profile + + + true + QtProjectManager.QMakeBuildStep + true + + false + true + true + + + true + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Profile + Qt4ProjectManager.Qt4BuildConfiguration + 0 + + 3 + + + 0 + Deploy + Deploy + ProjectExplorer.BuildSteps.Deploy + + 1 + 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:C:/Users/13648/Desktop/Trip-in-Chang-sha-042a8abb0ff29b210015c9bef1bad274bdb5d3d5/ChangShaTour/ChangShaTour.pro + C:/Users/13648/Desktop/Trip-in-Chang-sha-042a8abb0ff29b210015c9bef1bad274bdb5d3d5/ChangShaTour/ChangShaTour.pro + + false + + false + true + true + false + false + true + + E:/ChangShaTour/Trip-in-Chang-sha/build-ChangShaTour-Desktop_Qt_5_14_2_MSVC2017_64bit-Release + + 1 + + + + ProjectExplorer.Project.Target.1 + + Desktop Qt 5.14.2 MinGW 64-bit + Desktop Qt 5.14.2 MinGW 64-bit + qt.qt5.5142.win64_mingw73_kit + 0 + 0 + 0 + + E:/ChangShaTour/Trip-in-Chang-sha/build-ChangShaTour-Desktop_Qt_5_14_2_MinGW_64_bit-Debug + + + true + QtProjectManager.QMakeBuildStep + true + + false + false + false + + + true + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Debug + Qt4ProjectManager.Qt4BuildConfiguration + 2 + + + E:/ChangShaTour/Trip-in-Chang-sha/build-ChangShaTour-Desktop_Qt_5_14_2_MinGW_64_bit-Release + + + true + QtProjectManager.QMakeBuildStep + false + + false + false + true + + + true + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Release + Qt4ProjectManager.Qt4BuildConfiguration + 0 + + + E:/ChangShaTour/Trip-in-Chang-sha/build-ChangShaTour-Desktop_Qt_5_14_2_MinGW_64_bit-Profile + + + true + QtProjectManager.QMakeBuildStep + true + + false + true + true + + + true + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Profile + Qt4ProjectManager.Qt4BuildConfiguration + 0 + + 3 + + + 0 + Deploy + Deploy + ProjectExplorer.BuildSteps.Deploy + + 1 + 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 + + + ProjectExplorer.CustomExecutableRunConfiguration + + + false + + false + true + false + false + true + + + + 1 + + + + ProjectExplorer.Project.TargetCount + 2 + + + ProjectExplorer.Project.Updater.FileVersion + 22 + + + Version + 22 + + diff --git a/src/ChangShaTour/ChangShaTour.pro.user.4109ff1 b/src/ChangShaTour/ChangShaTour.pro.user.4109ff1 new file mode 100644 index 0000000..54b70f7 --- /dev/null +++ b/src/ChangShaTour/ChangShaTour.pro.user.4109ff1 @@ -0,0 +1,562 @@ + + + + + + EnvironmentId + {4109ff11-a646-43d1-9619-aeb32783df6e} + + + ProjectExplorer.Project.ActiveTarget + 1 + + + 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 + 1 + true + true + true + false + + + + ProjectExplorer.Project.PluginSettings + + + -fno-delayed-template-parsing + + true + + + + ProjectExplorer.Project.Target.0 + + Desktop Qt 5.14.2 MinGW 64-bit + Desktop Qt 5.14.2 MinGW 64-bit + qt.qt5.5142.win64_mingw73_kit + 0 + 0 + 0 + + E:/ChangShaTour/Trip-in-Chang-sha/build-ChangShaTour-Desktop_Qt_5_14_2_MinGW_64_bit-Debug + + + true + QtProjectManager.QMakeBuildStep + true + + false + false + false + + + true + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Debug + Qt4ProjectManager.Qt4BuildConfiguration + 2 + + + E:/ChangShaTour/Trip-in-Chang-sha/build-ChangShaTour-Desktop_Qt_5_14_2_MinGW_64_bit-Release + + + true + QtProjectManager.QMakeBuildStep + false + + false + false + true + + + true + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Release + Qt4ProjectManager.Qt4BuildConfiguration + 0 + + + E:/ChangShaTour/Trip-in-Chang-sha/build-ChangShaTour-Desktop_Qt_5_14_2_MinGW_64_bit-Profile + + + true + QtProjectManager.QMakeBuildStep + true + + false + true + true + + + true + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Profile + Qt4ProjectManager.Qt4BuildConfiguration + 0 + + 3 + + + 0 + Deploy + Deploy + ProjectExplorer.BuildSteps.Deploy + + 1 + 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 + + + ProjectExplorer.CustomExecutableRunConfiguration + + + false + + false + true + false + false + true + + + + 1 + + + + ProjectExplorer.Project.Target.1 + + Desktop Qt 5.14.2 MSVC2017 64bit + Desktop Qt 5.14.2 MSVC2017 64bit + qt.qt5.5142.win64_msvc2017_64_kit + 0 + 0 + 0 + + E:/ChangShaTour/Trip-in-Chang-sha/build-ChangShaTour-Desktop_Qt_5_14_2_MSVC2017_64bit-Debug + + + true + QtProjectManager.QMakeBuildStep + true + + false + false + false + + + true + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Debug + Qt4ProjectManager.Qt4BuildConfiguration + 2 + + + E:/ChangShaTour/Trip-in-Chang-sha/build-ChangShaTour-Desktop_Qt_5_14_2_MSVC2017_64bit-Release + + + true + QtProjectManager.QMakeBuildStep + false + + false + false + true + + + true + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Release + Qt4ProjectManager.Qt4BuildConfiguration + 0 + + + E:/ChangShaTour/Trip-in-Chang-sha/build-ChangShaTour-Desktop_Qt_5_14_2_MSVC2017_64bit-Profile + + + true + QtProjectManager.QMakeBuildStep + true + + false + true + true + + + true + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Profile + Qt4ProjectManager.Qt4BuildConfiguration + 0 + + 3 + + + 0 + Deploy + Deploy + ProjectExplorer.BuildSteps.Deploy + + 1 + 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:E:/ChangShaTour/Trip-in-Chang-sha/ChangShaTour/ChangShaTour.pro + E:/ChangShaTour/Trip-in-Chang-sha/ChangShaTour/ChangShaTour.pro + + false + + false + true + true + false + false + true + + E:/ChangShaTour/Trip-in-Chang-sha/build-ChangShaTour-Desktop_Qt_5_14_2_MSVC2017_64bit-Debug + + 1 + + + + ProjectExplorer.Project.TargetCount + 2 + + + ProjectExplorer.Project.Updater.FileVersion + 22 + + + Version + 22 + + diff --git a/src/ChangShaTour/ChangShaTour.pro.user.61ba832 b/src/ChangShaTour/ChangShaTour.pro.user.61ba832 new file mode 100644 index 0000000..037fd42 --- /dev/null +++ b/src/ChangShaTour/ChangShaTour.pro.user.61ba832 @@ -0,0 +1,805 @@ + + + + + + EnvironmentId + {61ba832e-6c30-4ab6-b0b8-ace44f46ca0c} + + + 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 + false + 0 + true + true + true + false + + + + ProjectExplorer.Project.PluginSettings + + + -fno-delayed-template-parsing + + true + + + + ProjectExplorer.Project.Target.0 + + Desktop Qt 5.14.2 MSVC2017 64bit + Desktop Qt 5.14.2 MSVC2017 64bit + qt.qt5.5142.win64_msvc2017_64_kit + 0 + 0 + 0 + + D:/Study/SE/project/code/Trip-in-Chang-sha-main-4/Trip-in-Chang-sha-main/build-ChangShaTour-Desktop_Qt_5_14_2_MSVC2017_64bit-Debug + + + true + QtProjectManager.QMakeBuildStep + true + + false + false + false + + + true + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Debug + Qt4ProjectManager.Qt4BuildConfiguration + 2 + + + D:/Study/SE/project/code/Trip-in-Chang-sha-main-4/Trip-in-Chang-sha-main/build-ChangShaTour-Desktop_Qt_5_14_2_MSVC2017_64bit-Release + + + true + QtProjectManager.QMakeBuildStep + false + + false + false + true + + + true + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Release + Qt4ProjectManager.Qt4BuildConfiguration + 0 + + + D:/Study/SE/project/code/Trip-in-Chang-sha-main-4/Trip-in-Chang-sha-main/build-ChangShaTour-Desktop_Qt_5_14_2_MSVC2017_64bit-Profile + + + true + QtProjectManager.QMakeBuildStep + true + + false + true + true + + + true + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Profile + Qt4ProjectManager.Qt4BuildConfiguration + 0 + + 3 + + + 0 + Deploy + Deploy + ProjectExplorer.BuildSteps.Deploy + + 1 + 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:D:/Study/SE/project/code/Trip-in-Chang-sha-main-4/Trip-in-Chang-sha-main/ChangShaTour/ChangShaTour.pro + D:/Study/SE/project/code/Trip-in-Chang-sha-main-4/Trip-in-Chang-sha-main/ChangShaTour/ChangShaTour.pro + + false + + false + true + true + false + false + true + + D:/Study/SE/project/code/Trip-in-Chang-sha-main-4/Trip-in-Chang-sha-main/build-ChangShaTour-Desktop_Qt_5_14_2_MSVC2017_64bit-Debug + + 1 + + + + ProjectExplorer.Project.Target.1 + + Desktop Qt 5.14.2 MinGW 32-bit + Desktop Qt 5.14.2 MinGW 32-bit + qt.qt5.5142.win32_mingw73_kit + 0 + 0 + 0 + + D:/Study/SE/project/code/Trip-in-Chang-sha-main-4/Trip-in-Chang-sha-main/build-ChangShaTour-Desktop_Qt_5_14_2_MinGW_32_bit-Debug + + + true + QtProjectManager.QMakeBuildStep + true + + false + false + false + + + true + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Debug + Qt4ProjectManager.Qt4BuildConfiguration + 2 + + + D:/Study/SE/project/code/Trip-in-Chang-sha-main-4/Trip-in-Chang-sha-main/build-ChangShaTour-Desktop_Qt_5_14_2_MinGW_32_bit-Release + + + true + QtProjectManager.QMakeBuildStep + false + + false + false + true + + + true + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Release + Qt4ProjectManager.Qt4BuildConfiguration + 0 + + + D:/Study/SE/project/code/Trip-in-Chang-sha-main-4/Trip-in-Chang-sha-main/build-ChangShaTour-Desktop_Qt_5_14_2_MinGW_32_bit-Profile + + + true + QtProjectManager.QMakeBuildStep + true + + false + true + true + + + true + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Profile + Qt4ProjectManager.Qt4BuildConfiguration + 0 + + 3 + + + 0 + Deploy + Deploy + ProjectExplorer.BuildSteps.Deploy + + 1 + 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 + + + ProjectExplorer.CustomExecutableRunConfiguration + + + false + + false + true + false + false + true + + + + 1 + + + + ProjectExplorer.Project.Target.2 + + Desktop Qt 5.14.2 MinGW 64-bit + Desktop Qt 5.14.2 MinGW 64-bit + qt.qt5.5142.win64_mingw73_kit + 0 + 0 + 0 + + D:/Study/SE/project/code/Trip-in-Chang-sha-main-4/Trip-in-Chang-sha-main/build-ChangShaTour-Desktop_Qt_5_14_2_MinGW_64_bit-Debug + + + true + QtProjectManager.QMakeBuildStep + true + + false + false + false + + + true + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Debug + Qt4ProjectManager.Qt4BuildConfiguration + 2 + + + D:/Study/SE/project/code/Trip-in-Chang-sha-main-4/Trip-in-Chang-sha-main/build-ChangShaTour-Desktop_Qt_5_14_2_MinGW_64_bit-Release + + + true + QtProjectManager.QMakeBuildStep + false + + false + false + true + + + true + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Release + Qt4ProjectManager.Qt4BuildConfiguration + 0 + + + D:/Study/SE/project/code/Trip-in-Chang-sha-main-4/Trip-in-Chang-sha-main/build-ChangShaTour-Desktop_Qt_5_14_2_MinGW_64_bit-Profile + + + true + QtProjectManager.QMakeBuildStep + true + + false + true + true + + + true + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Profile + Qt4ProjectManager.Qt4BuildConfiguration + 0 + + 3 + + + 0 + Deploy + Deploy + ProjectExplorer.BuildSteps.Deploy + + 1 + 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 + + + ProjectExplorer.CustomExecutableRunConfiguration + + + false + + false + true + false + false + true + + + + 1 + + + + ProjectExplorer.Project.TargetCount + 3 + + + ProjectExplorer.Project.Updater.FileVersion + 22 + + + Version + 22 + + diff --git a/src/ChangShaTour/ChangShaTour.pro.user.c9f9416 b/src/ChangShaTour/ChangShaTour.pro.user.c9f9416 new file mode 100644 index 0000000..57a164a --- /dev/null +++ b/src/ChangShaTour/ChangShaTour.pro.user.c9f9416 @@ -0,0 +1,562 @@ + + + + + + EnvironmentId + {c9f94164-08c8-4e3c-b552-0ae5039b502e} + + + ProjectExplorer.Project.ActiveTarget + 1 + + + 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 + 1 + true + true + true + false + + + + ProjectExplorer.Project.PluginSettings + + + -fno-delayed-template-parsing + + true + + + + ProjectExplorer.Project.Target.0 + + Desktop Qt 5.14.2 MSVC2017 32bit + Desktop Qt 5.14.2 MSVC2017 32bit + qt.qt5.5142.win32_msvc2017_kit + 0 + 0 + 0 + + D:/kunlin/OneDrive/QT project/build-ChangShaTour-Desktop_Qt_5_14_2_MSVC2017_32bit-Debug + + + true + QtProjectManager.QMakeBuildStep + true + + false + false + false + + + true + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Debug + Qt4ProjectManager.Qt4BuildConfiguration + 2 + + + D:/kunlin/OneDrive/QT project/build-ChangShaTour-Desktop_Qt_5_14_2_MSVC2017_32bit-Release + + + true + QtProjectManager.QMakeBuildStep + false + + false + false + true + + + true + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Release + Qt4ProjectManager.Qt4BuildConfiguration + 0 + + + D:/kunlin/OneDrive/QT project/build-ChangShaTour-Desktop_Qt_5_14_2_MSVC2017_32bit-Profile + + + true + QtProjectManager.QMakeBuildStep + true + + false + true + true + + + true + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Profile + Qt4ProjectManager.Qt4BuildConfiguration + 0 + + 3 + + + 0 + Deploy + Deploy + ProjectExplorer.BuildSteps.Deploy + + 1 + 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:D:/kunlin/OneDrive/QT project/ChangShaTour/ChangShaTour.pro + D:/kunlin/OneDrive/QT project/ChangShaTour/ChangShaTour.pro + + false + + false + true + true + false + false + true + + D:/kunlin/OneDrive/QT project/build-ChangShaTour-Desktop_Qt_5_14_2_MSVC2017_32bit-Debug + + 1 + + + + ProjectExplorer.Project.Target.1 + + Desktop Qt 5.14.2 MSVC2017 64bit + Desktop Qt 5.14.2 MSVC2017 64bit + qt.qt5.5142.win64_msvc2017_64_kit + 1 + 0 + 0 + + D:/kunlin/OneDrive/QT project/build-ChangShaTour-Desktop_Qt_5_14_2_MSVC2017_64bit-Debug + + + true + QtProjectManager.QMakeBuildStep + true + + false + false + false + + + true + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Debug + Qt4ProjectManager.Qt4BuildConfiguration + 2 + + + D:/kunlin/OneDrive/QT project/build-ChangShaTour-Desktop_Qt_5_14_2_MSVC2017_64bit-Release + + + true + QtProjectManager.QMakeBuildStep + false + + false + false + true + + + true + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Release + Qt4ProjectManager.Qt4BuildConfiguration + 0 + + + D:/kunlin/OneDrive/QT project/build-ChangShaTour-Desktop_Qt_5_14_2_MSVC2017_64bit-Profile + + + true + QtProjectManager.QMakeBuildStep + true + + false + true + true + + + true + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Profile + Qt4ProjectManager.Qt4BuildConfiguration + 0 + + 3 + + + 0 + Deploy + Deploy + ProjectExplorer.BuildSteps.Deploy + + 1 + 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:D:/kunlin/OneDrive/QT project/ChangShaTour/ChangShaTour.pro + D:/kunlin/OneDrive/QT project/ChangShaTour/ChangShaTour.pro + + false + + false + true + true + false + false + true + + D:/kunlin/OneDrive/QT project/build-ChangShaTour-Desktop_Qt_5_14_2_MSVC2017_64bit-Release + + 1 + + + + ProjectExplorer.Project.TargetCount + 2 + + + ProjectExplorer.Project.Updater.FileVersion + 22 + + + Version + 22 + + diff --git a/src/ChangShaTour/RouteItem.h b/src/ChangShaTour/RouteItem.h index cd30a99..7f450bd 100644 --- a/src/ChangShaTour/RouteItem.h +++ b/src/ChangShaTour/RouteItem.h @@ -1,16 +1,17 @@ -#include +#include #include +#include #ifndef ROUTEITEM_H #define ROUTEITEM_H struct routeItem{ QString placeName; QString url; QString cateId; - QString startTime; - QString endTime; + QDateTime startTime; + QDateTime endTime; QString traffic; - int distance; - int timeCost; + double distance; + double timeCost; QString description; struct routeItem * next; }; diff --git a/src/ChangShaTour/customizewidget.cpp b/src/ChangShaTour/customizewidget.cpp index 9b4905a..f6dc8f6 100644 --- a/src/ChangShaTour/customizewidget.cpp +++ b/src/ChangShaTour/customizewidget.cpp @@ -9,32 +9,53 @@ CustomizeWidget::CustomizeWidget(QWidget *parent) : num = 1; limit = 15; + startTimeList = (QDateTime *)malloc(sizeof(QDateTime) * limit); + endTimeList = (QDateTime *)malloc(sizeof(QDateTime) * limit); + for(int i = 0; i < limit; i++) + { + nameList.append(""); + urlList.append(""); + cateIdList.append(""); + } mainLayout = new QVBoxLayout(); + title = new QLabel("现在开始定制您的路线\n点击空白按钮就可以向路线中添加场所"); + title->setAlignment(Qt::AlignCenter); + + format = new QHBoxLayout(); + format->addWidget(new QLabel("序号"),1); + format->addWidget(new QLabel("场所"),12); + format->addWidget(new QLabel("起始时间"),3); + format->addWidget(new QLabel("结束时间"),3); + format->addWidget(new QLabel(""),2); + format->addWidget(new QLabel(""),2); + lineList = (QHBoxLayout **)malloc(sizeof(QHBoxLayout *) * limit); labelList = (QLabel **)malloc(sizeof(QLabel *) * limit); placeBtnList = (QPushButton **)malloc(sizeof(QPushButton *) * limit); + startEditList = (QDateTimeEdit **)malloc(sizeof(QDateTimeEdit *) * limit); + endEditList = (QDateTimeEdit **)malloc(sizeof(QDateTimeEdit *) * limit); addBtnList = (QPushButton **)malloc(sizeof(QPushButton *) * limit); delBtnList = (QPushButton **)malloc(sizeof(QPushButton *) * limit); - for(int i = 0; i < limit; i++) - { - nameList.append(""); - urlList.append(""); - cateIdList.append(""); - } spaceList = (QHBoxLayout **)malloc(sizeof(QHBoxLayout *) * (limit - 1)); spacers = (QLabel **)malloc(sizeof(QLabel *) * (limit - 1)); this->setLayout(mainLayout); + mainLayout->addWidget(title); + mainLayout->addWidget(new QLabel("")); + mainLayout->addLayout(format); + for (int i = 0; i < limit; i++) { lineList[i] = new QHBoxLayout(); labelList[i] = new QLabel(QString::number(i+1)); labelList[i]->setAlignment(Qt::AlignCenter); placeBtnList[i] = new QPushButton(""); + startEditList[i] = new QDateTimeEdit(); + endEditList[i] = new QDateTimeEdit(); addBtnList[i] = new QPushButton("add"); delBtnList[i] = new QPushButton("del"); @@ -44,6 +65,8 @@ CustomizeWidget::CustomizeWidget(QWidget *parent) : lineList[i]->addWidget(labelList[i],1); lineList[i]->addWidget(placeBtnList[i],12); + lineList[i]->addWidget(startEditList[i],3); + lineList[i]->addWidget(endEditList[i],3); lineList[i]->addWidget(addBtnList[i],2); lineList[i]->addWidget(delBtnList[i],2); @@ -75,6 +98,8 @@ void CustomizeWidget::visibleAt(int index, bool flag) { labelList[index]->setVisible(flag); placeBtnList[index]->setVisible(flag); + startEditList[index]->setVisible(flag); + endEditList[index]->setVisible(flag); addBtnList[index]->setVisible(flag); delBtnList[index]->setVisible(flag); // if (flag) diff --git a/src/ChangShaTour/customizewidget.h b/src/ChangShaTour/customizewidget.h index 17ed5f1..e751772 100644 --- a/src/ChangShaTour/customizewidget.h +++ b/src/ChangShaTour/customizewidget.h @@ -10,6 +10,8 @@ #include #include #include +#include +#include #include "popwidget.h" #if _MSC_VER >= 1600 @@ -42,10 +44,14 @@ private: QStringList nameList; QStringList urlList; QStringList cateIdList; + QDateTime *startTimeList; + QDateTime *endTimeList; QHBoxLayout **lineList; QLabel **labelList; QPushButton **placeBtnList; + QDateTimeEdit **startEditList; + QDateTimeEdit **endEditList; QPushButton **addBtnList; QPushButton ** delBtnList; @@ -53,6 +59,8 @@ private: QLabel **spacers; QVBoxLayout *mainLayout; + QLabel *title; + QHBoxLayout *format; }; #endif // CUSTOMIZEWIDGET_H diff --git a/src/ChangShaTour/favoritewidget.cpp b/src/ChangShaTour/favoritewidget.cpp index 69eee61..6534136 100644 --- a/src/ChangShaTour/favoritewidget.cpp +++ b/src/ChangShaTour/favoritewidget.cpp @@ -61,9 +61,13 @@ void FavoriteWidget::queryDatabase() size = 0; while(queryUser.next()) { - QString url = queryUser.value("url").toString(); + QString name = queryUser.value("title").toString(); + QString img = queryUser.value("frontimg").toString(); + QString url = queryUser.value("detail").toString(); QString cateId = queryUser.value("cateId").toString(); - queryMeituanDatabase(url, cateId); + //queryMeituanDatabase(url, cateId); + nameList.append(name); + imgList.append(img); urlList.append(url); cateIdList.append(cateId); size++; @@ -95,7 +99,7 @@ void FavoriteWidget::switchToRoute() //从美团数据库获取详情页,暂只获取名字和图片链接 void FavoriteWidget::queryMeituanDatabase(QString url,QString cateId) { - QSqlQuery queryMeituan(meituanDb); + /*QSqlQuery queryMeituan(meituanDb); queryMeituan.prepare("select * from " + labelToDb[cateId] + " where detail = ?"); queryMeituan.addBindValue(url); queryMeituan.exec(); @@ -103,7 +107,7 @@ void FavoriteWidget::queryMeituanDatabase(QString url,QString cateId) QString title = queryMeituan.value("title").toString(); QString img = queryMeituan.value("frontimg").toString(); titleList.append(title);//获取名字 - imgList.append(img);//获取图片链接 + imgList.append(img);//获取图片链接*/ } //设置场所收藏夹界面 void FavoriteWidget::setFavPlaceScreen() @@ -143,7 +147,7 @@ void FavoriteWidget::nextPage() cateIdList.clear(); urlList.clear(); imgList.clear(); - titleList.clear(); + nameList.clear(); deleteWidgetsInLayout(); pageNumber++; queryDatabase(); @@ -157,7 +161,7 @@ void FavoriteWidget::backPage() cateIdList.clear(); urlList.clear(); imgList.clear(); - titleList.clear(); + nameList.clear(); deleteWidgetsInLayout(); pageNumber--; queryDatabase(); @@ -169,14 +173,105 @@ void FavoriteWidget::setFavRouteScreen() { favoRoutesWidget = new QWidget(); - QVBoxLayout *layout = new QVBoxLayout(); - favoRoutesWidget->setLayout(layout); - layout->addWidget(new QLabel("FavoriteWidget")); + verticalLayout = new QVBoxLayout(); + + numOfFavRoutes = 0; + favRoutesIdList = new int[100]; + favRoutesList = new Route[100]; + + getFavRoutesList(); + setFavRoutesBtns(); + favoRoutesWidget->setLayout(verticalLayout); verLayout->addWidget(favoRoutesWidget); } +void FavoriteWidget::getFavRoutesList() +{ + QSqlQuery query(userDb); + query.prepare("select distinct routeId from favRoutes where userId = ?"); + query.addBindValue(Id); + query.exec(); + while(query.next()) + { + favRoutesIdList[numOfFavRoutes] = query.value("routeId").toInt(); + numOfFavRoutes += 1; + } + + for(int i = numOfFavRoutes; i > 0; i--) + { + QDateTime * startTimeList = new QDateTime[16]; + QDateTime * endTimeList = new QDateTime[16]; + QStringList placeNameList; + QStringList urlList; + QStringList cateIdList; + QStringList trafficList; + double * distanceList = new double[16]; + double * timeCostList = new double[16]; + QStringList descriptionList; + + query.prepare("select * from favPlaces where userId = ? and routeId = ? order by placeNo"); + query.addBindValue(Id); + query.addBindValue(favRoutesIdList[i-1]); + query.exec(); + favRoutesList[numOfFavRoutes - i].setUserId(Id); + int j = 0; + while(query.next()) + { + int routeId = query.value("routeId").toInt(); + QString routeName = query.value("routeName").toString(); + QDateTime startTime = query.value("startTime").toDateTime(); + QDateTime endTime = query.value("endTime").toDateTime(); + QString placeName = query.value("placeName").toString(); + QString url = query.value("url").toString(); + QString cateId = query.value("cateId").toString(); + QString traffic = query.value("traffic").toString(); + double distance = query.value("distance").toInt() / 1000.0; + double timeCost = query.value("timeCost").toInt() / 60.0; + QString description = query.value("description").toString(); + + favRoutesList[numOfFavRoutes - i].setRouteId(routeId); + favRoutesList[numOfFavRoutes - i].setRouteName(routeName); + startTimeList[j] = startTime; + endTimeList[j] = endTime; + placeNameList.append(placeName); + urlList.append(url); + cateIdList.append(cateId); + trafficList.append(traffic); + distanceList[j] = distance; + timeCostList[j] = timeCost; + descriptionList.append(description); + j++; + } + favRoutesList[numOfFavRoutes - i].setAllItems(placeNameList, urlList, cateIdList, startTimeList, endTimeList, trafficList, distanceList, timeCostList, descriptionList); + } +} + +void FavoriteWidget::setFavRoutesBtns() +{ + for(int i = 0; i < numOfFavRoutes; i++) + { + Route journey = favRoutesList[i]; + QString routeName = journey.getRouteName(); + RouteItem * head = journey.getAllItems(); + head = head->next; + QString text; + text += routeName; + text += "\r\n"; + text += head->placeName; + while(head->next) + { + head = head->next; + text += "--->"; + text += head->placeName; + } + QPushButton * journeyButton = new QPushButton(text); + journeyButton->setStyleSheet("QPushButton{text-align : left;}"); + verticalLayout->addWidget(journeyButton); + } +} + QToolButton * FavoriteWidget::setBtn(QToolButton *btn, const QString text) { btn->setText(text); @@ -190,10 +285,10 @@ void FavoriteWidget::setBtns() for (int i = 0; i < size; i++) { int index = i; - btnList[index] = setBtn(btnList[index], titleList[index]); + btnList[index] = setBtn(btnList[index], nameList[index]); //btnList[index]->setText(titleList[index]); //btnList[index]->setToolButtonStyle(Qt::ToolButtonTextOnly); - connect(btnList[index], &QToolButton::clicked, this, [=](){web->loadPage((const QString)urlList[index],cateIdList[index]); invisibleAllScreens(); web->setVisible(true);}); + connect(btnList[index], &QToolButton::clicked, this, [=](){web->loadPage(nameList[index], imgList[index], urlList[index],cateIdList[index]); invisibleAllScreens(); web->setVisible(true);}); } } diff --git a/src/ChangShaTour/favoritewidget.h b/src/ChangShaTour/favoritewidget.h index 6abfc64..b310862 100644 --- a/src/ChangShaTour/favoritewidget.h +++ b/src/ChangShaTour/favoritewidget.h @@ -9,6 +9,7 @@ #include #include #include +#include #if _MSC_VER >= 1600 #pragma execution_character_set("utf-8") @@ -38,6 +39,9 @@ public: void setPageMaxNumber(); void invisibleAllScreens(); void deleteWidgetsInLayout(); + + void getFavRoutesList(); + void setFavRoutesBtns(); ~FavoriteWidget(); private: @@ -48,7 +52,7 @@ private: QStringList urlList; QStringList imgList; - QStringList titleList; + QStringList nameList; QStringList cateIdList; WebWidget * web; @@ -68,6 +72,12 @@ private: QWidget *favoPlacesWidget; QPushButton *favoRoutesBtn; QPushButton *favoPlacesBtn; + + int numOfFavRoutes = 0; + int * favRoutesIdList; + Route * favRoutesList; + QVBoxLayout * verticalLayout; + Ui::FavoriteWidget *ui; public slots: diff --git a/src/ChangShaTour/historywidget.cpp b/src/ChangShaTour/historywidget.cpp index 9e90a35..01a3359 100644 --- a/src/ChangShaTour/historywidget.cpp +++ b/src/ChangShaTour/historywidget.cpp @@ -24,10 +24,9 @@ HistoryWidget::HistoryWidget(QWidget *parent) : btnList[i]->setVisible(false); } - //获取用户历史信息存入historyList和cateIdList + //获取用户历史信息存入historyList和nameList getHistory(); - //根据历史信息获取店铺信息填入nameList中 - getShops(); + //填写nameList信息到按钮中 setBtns(); @@ -65,49 +64,35 @@ void HistoryWidget::getHistory() historyQuery.exec(); while (historyQuery.next() == true) { - qDebug() << "HistoryUrl:" << historyQuery.value("url").value(); - historyList.append(historyQuery.value("url").value()); + qDebug() << "HistoryUrl:" << historyQuery.value("detail").value(); + nameList.append(historyQuery.value("title").value()); + imgList.append(historyQuery.value("frontimg").value()); + urlList.append(historyQuery.value("detail").value()); cateIdList.append(historyQuery.value("cateId").value()); } } -void HistoryWidget::getShops() -{ - QSqlQuery shopQuery(meituanDb); - - for (int i = 0; i < historyList.length(); i++) - { - QString cate = labelToDb[cateIdList[i]]; - shopQuery.prepare("select title from " + cate + " where detail=:url"); - shopQuery.bindValue(":url", historyList[i]); - shopQuery.exec(); - shopQuery.next(); -// qDebug() << shopQuery.value("title").value(); - nameList.append(shopQuery.value("title").value()); - } -} - void HistoryWidget::setBtns() { - for (int i = 0; i < historyList.length(); i++) + for (int i = 0; i < urlList.length(); i++) { btnList[i]->setText(nameList[i]); btnList[i]->setVisible(true); // btnList[i]->setFixedSize(QSize(200,200)); - connect(btnList[i], &QPushButton::clicked, this, [=](){web->loadPage(historyList[i], cateIdList[i]); web->setVisible(true); subWidget->setVisible(false);}); + connect(btnList[i], &QPushButton::clicked, this, [=](){web->loadPage(nameList[i], imgList[i], urlList[i], cateIdList[i]); web->setVisible(true); subWidget->setVisible(false);}); } } void HistoryWidget::refresh() { - historyList.clear(); nameList.clear(); + imgList.clear(); + urlList.clear(); cateIdList.clear(); getHistory(); - getShops(); setBtns(); } diff --git a/src/ChangShaTour/historywidget.h b/src/ChangShaTour/historywidget.h index ab4c7c4..509acb7 100644 --- a/src/ChangShaTour/historywidget.h +++ b/src/ChangShaTour/historywidget.h @@ -26,7 +26,6 @@ public: ~HistoryWidget(); void getHistory(); - void getShops(); void setBtns(); void refresh(); void returnHistory(); @@ -47,9 +46,10 @@ private: QPushButton *refreshBtn; QPushButton **btnList; - QStringList historyList; //店铺url QStringList nameList; //店铺名称 - QStringList cateIdList; + QStringList imgList; //店铺图片 + QStringList urlList; //店铺url + QStringList cateIdList; //店铺分类 }; #endif // HISTORYWIDGET_H diff --git a/src/ChangShaTour/journywidget.cpp b/src/ChangShaTour/journywidget.cpp index 42003d0..546435e 100644 --- a/src/ChangShaTour/journywidget.cpp +++ b/src/ChangShaTour/journywidget.cpp @@ -6,9 +6,105 @@ JournyWidget::JournyWidget(QWidget *parent) : ui(new Ui::JournyWidget) { ui->setupUi(this); + + verticalLayout = new QVBoxLayout(); + + numOfJourney = 0; + routeIdList = new int[5]; + journeyList = new Route[5]; + + getJourneyList(); + setBtns(); + this->setLayout(verticalLayout); } JournyWidget::~JournyWidget() { delete ui; } + + +void JournyWidget::getJourneyList() +{ + QSqlQuery query(userDb); + query.prepare("select distinct routeId from journey where userId = ?"); + query.addBindValue(Id); + query.exec(); + while(query.next()) + { + routeIdList[numOfJourney] = query.value("routeId").toInt(); + numOfJourney += 1; + } + + for(int i = numOfJourney; i > 0; i--) + { + QDateTime * startTimeList = new QDateTime[16]; + QDateTime * endTimeList = new QDateTime[16]; + QStringList placeNameList; + QStringList urlList; + QStringList cateIdList; + QStringList trafficList; + double * distanceList = new double[16]; + double * timeCostList = new double[16]; + QStringList descriptionList; + + query.prepare("select * from journey where userId = ? and routeId = ? order by placeNo"); + query.addBindValue(Id); + query.addBindValue(routeIdList[i-1]); + query.exec(); + journeyList[numOfJourney - i].setUserId(Id); + int j = 0; + while(query.next()) + { + int routeId = query.value("routeId").toInt(); + QString routeName = query.value("routeName").toString(); + QDateTime startTime = query.value("startTime").toDateTime(); + QDateTime endTime = query.value("endTime").toDateTime(); + QString placeName = query.value("placeName").toString(); + QString url = query.value("url").toString(); + QString cateId = query.value("cateId").toString(); + QString traffic = query.value("traffic").toString(); + double distance = query.value("distance").toInt() / 1000.0; + double timeCost = query.value("timeCost").toInt() / 60.0; + QString description = query.value("description").toString(); + + journeyList[numOfJourney - i].setRouteId(routeId); + journeyList[numOfJourney - i].setRouteName(routeName); + startTimeList[j] = startTime; + endTimeList[j] = endTime; + placeNameList.append(placeName); + urlList.append(url); + cateIdList.append(cateId); + trafficList.append(traffic); + distanceList[j] = distance; + timeCostList[j] = timeCost; + descriptionList.append(description); + j++; + } + journeyList[numOfJourney - i].setAllItems(placeNameList, urlList, cateIdList, startTimeList, endTimeList, trafficList, distanceList, timeCostList, descriptionList); + } +} + +void JournyWidget::setBtns() +{ + for(int i = 0; i < numOfJourney; i++) + { + Route journey = journeyList[i]; + QString routeName = journey.getRouteName(); + RouteItem * head = journey.getAllItems(); + head = head->next; + QString text; + text += routeName; + text += "\r\n"; + text += head->placeName; + while(head->next) + { + head = head->next; + text += "--->"; + text += head->placeName; + } + QPushButton * journeyButton = new QPushButton(text); + journeyButton->setStyleSheet("QPushButton{text-align : left;}"); + verticalLayout->addWidget(journeyButton); + } +} diff --git a/src/ChangShaTour/journywidget.h b/src/ChangShaTour/journywidget.h index fdeba91..a65f481 100644 --- a/src/ChangShaTour/journywidget.h +++ b/src/ChangShaTour/journywidget.h @@ -2,6 +2,13 @@ #define JOURNYWIDGET_H #include +#include +#include +#include +#include +#include +#include "cglobal.h" +#include "route.h" #if _MSC_VER >= 1600 #pragma execution_character_set("utf-8") @@ -19,8 +26,16 @@ public: explicit JournyWidget(QWidget *parent = nullptr); ~JournyWidget(); + void getJourneyList(); + void setBtns(); + private: Ui::JournyWidget *ui; + + int numOfJourney = 0; + int * routeIdList; + Route * journeyList; + QVBoxLayout * verticalLayout; }; #endif // JOURNYWIDGET_H diff --git a/src/ChangShaTour/listwidget.cpp b/src/ChangShaTour/listwidget.cpp index 301f587..01fc8d1 100644 --- a/src/ChangShaTour/listwidget.cpp +++ b/src/ChangShaTour/listwidget.cpp @@ -60,8 +60,8 @@ ListWidget::ListWidget(QWidget *parent) : lineList_2[0] = line_2; lineList_3[0] = line_3; setHotList(); - setMinorityList(); - setFavorableList(); + //setMinorityList(); + //setFavorableList(); //设置总体布局 this->setLayout(mainLayout); @@ -78,8 +78,8 @@ ListWidget::ListWidget(QWidget *parent) : for (int i = 0; i < (listLen + 1); i++) { layout_1->addLayout(lineList_1[i]); - layout_2->addLayout(lineList_2[i]); - layout_3->addLayout(lineList_3[i]); + //layout_2->addLayout(lineList_2[i]); + //layout_3->addLayout(lineList_3[i]); } connect(web->getReturnBtn(), &QPushButton::clicked, this, &ListWidget::returnWeb); @@ -151,8 +151,8 @@ void ListWidget::setHotList() QSqlQuery queryMeituan(meituanDb); int index = 1; - queryList.prepare("select * from hotlist limit :limit"); - queryList.bindValue(":limit", listLen); + queryList.prepare("select * from hotlist order by clickCount desc"); + //queryList.bindValue(":limit", listLen); queryList.exec(); while (queryList.next() == true && index < (listLen + 1)) { @@ -161,19 +161,22 @@ void ListWidget::setHotList() rank->setAlignment(Qt::AlignCenter); QToolButton *btn = new QToolButton(); - QString url = queryList.value("url").value(); + int id = queryList.value("id").value(); + QString name = queryList.value("title").value(); + QString img = queryList.value("frontimg").value(); + QString url = queryList.value("detail").value(); QString cate = queryList.value("cateId").value(); - queryMeituan.prepare("select * from " + labelToDb[cate] + " where detail = :url"); + /*queryMeituan.prepare("select * from " + labelToDb[cate] + " where detail = :url"); // qDebug() << "类名:" << cate; // qDebug() << "所属表名:" << labelToDb[cate]; queryMeituan.bindValue(":url", url); - QStringList list = queryMeituanDatabase(queryMeituan);//获得图片链接和店铺名和id + QStringList list = queryMeituanDatabase(queryMeituan);//获得图片链接和店铺名和id*/ imgDownloader *imgDownload = new imgDownloader(); - QString imgPath = "./images/" + labelToDb[cate] + list[2] + ".png"; - imgDownload->downloadFileFromUrl(list[0], imgPath); - btn = setBtn(btn, imgPath, list[1]); - connect(btn, &QToolButton::clicked, this, [=](){web->loadPage(url, cate); subWidget->setVisible(false); web->setVisible(true);}); + QString imgPath = "./images/hotlist" + QString::number(id) + ".png"; + imgDownload->downloadFileFromUrl(img, imgPath); + btn = setBtn(btn, imgPath, name); + connect(btn, &QToolButton::clicked, this, [=](){web->loadPage(name, img, url, cate); subWidget->setVisible(false); web->setVisible(true);}); line->addWidget(rank, 1); line->addWidget(btn, 10); @@ -200,6 +203,8 @@ void ListWidget::setMinorityList() rank->setAlignment(Qt::AlignCenter); QToolButton *btn = new QToolButton(); + QString name = queryList.value("title").value(); + QString img = queryList.value("title").value(); QString url = queryList.value("url").value(); QString cate = queryList.value("cateId").value(); @@ -212,7 +217,7 @@ void ListWidget::setMinorityList() QString imgPath = "D:/Study/SE/project/images/" + labelToDb[cate] + list[2] + ".png"; imgDownload->downloadFileFromUrl(list[0], imgPath); btn = setBtn(btn, imgPath, list[1]); - connect(btn, &QToolButton::clicked, this, [=](){web->loadPage(url, cate); subWidget->setVisible(false); web->setVisible(true);}); + connect(btn, &QToolButton::clicked, this, [=](){web->loadPage(name, img, url, cate); subWidget->setVisible(false); web->setVisible(true);}); line->addWidget(rank, 1); line->addWidget(btn, 10); @@ -251,7 +256,7 @@ void ListWidget::setFavorableList() QString imgPath = "D:/Study/SE/project/images/" + labelToDb[cate] + list[2] + ".png"; imgDownload->downloadFileFromUrl(list[0], imgPath); btn = setBtn(btn, imgPath, list[1]); - connect(btn, &QToolButton::clicked, this, [=](){web->loadPage(url, cate); subWidget->setVisible(false); web->setVisible(true);}); + connect(btn, &QToolButton::clicked, this, [=](){web->loadPage(list[1], list[0], url, cate); subWidget->setVisible(false); web->setVisible(true);}); line->addWidget(rank, 1); line->addWidget(btn, 10); diff --git a/src/ChangShaTour/loginwidget.cpp b/src/ChangShaTour/loginwidget.cpp index f15872f..8026a41 100644 --- a/src/ChangShaTour/loginwidget.cpp +++ b/src/ChangShaTour/loginwidget.cpp @@ -68,6 +68,10 @@ void LoginWidget::InitSubWidget() gridLayout->addWidget(loginButton, 1, 3, 1, 1); InitButton(registerButton); InitButton(loginButton); + loginButton->setFocus(); + loginButton->setShortcut(QKeySequence::InsertParagraphSeparator); + loginButton->setShortcut(Qt::Key_Enter); + loginButton->setShortcut(Qt::Key_Return); } void LoginWidget::InitLabel(QLabel * label) diff --git a/src/ChangShaTour/mainwidget.cpp b/src/ChangShaTour/mainwidget.cpp index 8eeda87..15feb12 100644 --- a/src/ChangShaTour/mainwidget.cpp +++ b/src/ChangShaTour/mainwidget.cpp @@ -22,11 +22,10 @@ MainWidget::MainWidget(QWidget *parent) : homeWidget = new HomeWidget(this); userWidget = new UserWidget(this); searchWidget = new SearchWidget(this); +// home2user = new QPropertyAnimation(homeWidget, "geometry"); +// user2home = new QPropertyAnimation(userWidget, "geometry"); - userWidget->setVisible(false); - searchWidget->setVisible(false); - - setLayout(verLayout); + this->setLayout(verLayout); verLayout->addLayout(horLayout); verLayout->addWidget(homeWidget); @@ -38,10 +37,17 @@ MainWidget::MainWidget(QWidget *parent) : horLayout->addWidget(searchBar); horLayout->addWidget(searchBtn); +// homeWidget->setGeometry(11, 45, 1418, 727); +// userWidget->setGeometry(1440, 45, 1418, 727); +// searchWidget->setGeometry(); + userWidget->setVisible(false); + searchWidget->setVisible(false); + connect(homeBtn, &QPushButton::clicked, this, &MainWidget::switchToHome); connect(userBtn, &QPushButton::clicked, this, &MainWidget::switchToUser); connect(searchBtn, &QPushButton::clicked, this, &MainWidget::actSearch); connect(searchWidget->getReturnBtn(), &QPushButton::clicked, this, &MainWidget::returnSearch); + } void MainWidget::switchToHome() @@ -50,11 +56,16 @@ void MainWidget::switchToHome() { //homeBtn->setStyleSheet("QPushButton{background-color: rgb(20, 62, 134);color:rgb(255, 255, 255);}"); //userBtn->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); +// homeWidget->setVisible(true); +// userWidget->setVisible(false); + user2homeAnimation(); homeWidget->setVisible(true); userWidget->setVisible(false); searchWidget->setVisible(false); searchBar->clear(); index = 0; + qDebug() << "homeWidget:" << homeWidget->geometry(); + qDebug() << "userWidget:" << userWidget->geometry(); } } @@ -64,11 +75,16 @@ void MainWidget::switchToUser() { //homeBtn->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); //userBtn->setStyleSheet("QPushButton{background-color: rgb(20, 62, 134);color:rgb(255, 255, 255);}"); - homeWidget->setVisible(false); - userWidget->setVisible(true); +// homeWidget->setVisible(false); +// userWidget->setVisible(true); + home2userAnimation(); +// homeWidget->setVisible(false); +// userWidget->setVisible(true); searchWidget->setVisible(false); searchBar->clear(); index = 1; + qDebug() << "homeWidget:" << homeWidget->geometry(); + qDebug() << "userWidget:" << userWidget->geometry(); } } @@ -104,6 +120,63 @@ void MainWidget::returnSearch() index = 0; } +void MainWidget::home2userAnimation() +{ +// home2user->setDuration(1000); +// home2user->setStartValue(homeWidget->geometry()); +// home2user->setEndValue(QRect(-homeWidget->width(), 0, homeWidget->width(), homeWidget->height())); + +// home2user->start(); + + QPropertyAnimation *animation1= new QPropertyAnimation(homeWidget,"geometry"); + animation1->setDuration(500); + animation1->setStartValue(QRect(11, 45, 1418, 727)); + animation1->setEndValue(QRect(-1418, 45, 1418, 727)); + + QPropertyAnimation *animation2= new QPropertyAnimation(userWidget,"geometry"); + animation2->setDuration(500); + animation2->setStartValue(QRect(1440, 45, 1418, 727)); + animation2->setEndValue(QRect(11, 45, 1418, 727)); + + QParallelAnimationGroup *group = new QParallelAnimationGroup; + group->addAnimation(animation1); + group->addAnimation(animation2); +// userWidget->setVisible(true); + group->start(); + userWidget->setVisible(true); + homeWidget->setVisible(false); + +// animation1->start(); +// homeWidget->setVisible(false); +// userWidget->setVisible(true); +// animation2->start(); + +} + +void MainWidget::user2homeAnimation() +{ + + QPropertyAnimation *animation1= new QPropertyAnimation(userWidget,"geometry"); + animation1->setDuration(500); + animation1->setStartValue(QRect(11, 45, 1418, 727)); + animation1->setEndValue(QRect(1440, 45, 1418, 727)); + + QPropertyAnimation *animation2= new QPropertyAnimation(homeWidget,"geometry"); + animation2->setDuration(500); + animation2->setStartValue(QRect(-1418, 45, 1418, 727)); + animation2->setEndValue(QRect(11, 45, 1418, 727)); + + QParallelAnimationGroup *group = new QParallelAnimationGroup; + group->addAnimation(animation1); + group->addAnimation(animation2); + group->start(); + +// animation1->start(); + +// homeWidget->setVisible(true); +// userWidget->setVisible(false); +} + MainWidget::~MainWidget() { delete ui; diff --git a/src/ChangShaTour/mainwidget.h b/src/ChangShaTour/mainwidget.h index 9f3eb56..7b61cd3 100644 --- a/src/ChangShaTour/mainwidget.h +++ b/src/ChangShaTour/mainwidget.h @@ -7,6 +7,9 @@ #include #include #include +#include +#include +#include #include "homewidget.h" #include "userwidget.h" #include "searchwidget.h" @@ -27,6 +30,9 @@ public: explicit MainWidget(QWidget *parent = nullptr); ~MainWidget(); + void home2userAnimation(); + void user2homeAnimation(); + private: Ui::MainWidget *ui; diff --git a/src/ChangShaTour/mainwindow.cpp b/src/ChangShaTour/mainwindow.cpp index fbec060..cdda1f3 100644 --- a/src/ChangShaTour/mainwindow.cpp +++ b/src/ChangShaTour/mainwindow.cpp @@ -9,7 +9,6 @@ MainWindow::MainWindow(QWidget *parent) resize(800,450); setWindowFlags(windowFlags()&~Qt::WindowMaximizeButtonHint); // 禁止最大化按钮 - //setFixedSize(this->width(),this->height()); // 禁止拖动窗口大小 loginWidget = new LoginWidget(); setWindowTitle("长沙游"); @@ -35,15 +34,13 @@ void MainWindow::switchToMain() } else if(loginmanage->loginVerify(accountLogin,passwordLogin)) { - //setMaximumSize(QSize(1330,1000)); - // showMaximized(); WaitStart(); - loginWidget->deleteLater(); mainWidget = new MainWidget(this); - WaitEnd(); - resize(1600, 900); setCentralWidget(mainWidget); - move ((QApplication::desktop()->width() - this->width())/2,(QApplication::desktop()->height() - this->height())/2); + WaitEnd(); + DisposalOtherEvents(25); + setGeometry(240, 135, 1440, 810); + setFixedSize(this->width(),this->height()); // 禁止拖动窗口大小 } else { @@ -106,6 +103,16 @@ void MainWindow::WaitEnd() waitProcess->kill(); } +void MainWindow::DisposalOtherEvents(int time) +{ + QElapsedTimer et; + et.start(); + while(et.elapsed() < time) + { + QCoreApplication::processEvents(); + } +} + MainWindow::~MainWindow() { delete ui; diff --git a/src/ChangShaTour/mainwindow.h b/src/ChangShaTour/mainwindow.h index cc0e34f..806357e 100644 --- a/src/ChangShaTour/mainwindow.h +++ b/src/ChangShaTour/mainwindow.h @@ -4,6 +4,7 @@ #include #include #include +#include #include "loginwidget.h" #include "mainwidget.h" #include "loginmanager.h" @@ -44,5 +45,6 @@ public slots: void clickGetVerificationCodeButton(); void WaitStart(); void WaitEnd(); + void DisposalOtherEvents(int); }; #endif // MAINWINDOW_H diff --git a/src/ChangShaTour/planwidget.cpp b/src/ChangShaTour/planwidget.cpp index 424788c..9f33c71 100644 --- a/src/ChangShaTour/planwidget.cpp +++ b/src/ChangShaTour/planwidget.cpp @@ -45,8 +45,8 @@ PlanWidget::PlanWidget(QWidget *parent) : verLayout->addWidget(confirmWidget); horLayout->addWidget(returnBtn); - horLayout->addWidget(favoriteBtn); horLayout->addStretch(5); + horLayout->addWidget(favoriteBtn); horLayout->addWidget(confirmBtn); connect(rcmdPlanBtn, &QPushButton::clicked, this, &PlanWidget::switchToConditionWidget); diff --git a/src/ChangShaTour/popwidget.cpp b/src/ChangShaTour/popwidget.cpp index 1c00b8c..fac0599 100644 --- a/src/ChangShaTour/popwidget.cpp +++ b/src/ChangShaTour/popwidget.cpp @@ -8,7 +8,8 @@ PopWidget::PopWidget(QWidget *parent) : ui->setupUi(this); this->setWindowModality(Qt::ApplicationModal); - this->setFixedSize(QSize(400,1000)); + this->setFixedSize(QSize(400,810)); + this->setWindowTitle("请选择..."); chosen.append(""); chosen.append(""); diff --git a/src/ChangShaTour/recommendwidget.cpp b/src/ChangShaTour/recommendwidget.cpp index 49c4d9a..7141474 100644 --- a/src/ChangShaTour/recommendwidget.cpp +++ b/src/ChangShaTour/recommendwidget.cpp @@ -130,6 +130,7 @@ void RecommendWidget::queryDatabase(int page) QString price = QString::number(avgprice.value()); QString text = name + "\n" + score + "分 " + commentNum + "条评论\n" + addr + "\n" + "人均" + price + "元"; idList[i] = id.value(); + nameList.append(name); urlList.append(detail.value()); imgList.append(frontimg.value()); cateIdList.append(cateId.value()); @@ -157,7 +158,7 @@ void RecommendWidget::setBtns() qDebug()<loadPage(urlList[index],cateIdList[index]); scroll->setVisible(false); web->setVisible(true); refreshBtn->setVisible(false);}); + connect(btnList[index], &QToolButton::clicked, this, [=](){web->loadPage(nameList[index], imgList[index], urlList[index],cateIdList[index]); scroll->setVisible(false); web->setVisible(true); refreshBtn->setVisible(false);}); } } } @@ -209,6 +210,7 @@ void RecommendWidget::refresh() { rollTop(); + nameList.clear(); urlList.clear(); imgList.clear(); textList.clear(); diff --git a/src/ChangShaTour/recommendwidget.h b/src/ChangShaTour/recommendwidget.h index ecb03d9..f81c3f8 100644 --- a/src/ChangShaTour/recommendwidget.h +++ b/src/ChangShaTour/recommendwidget.h @@ -53,6 +53,7 @@ private: int labellimit; int page;//页数 int displaynumber; + QStringList nameList; QStringList urlList; QStringList imgList; QStringList textList; diff --git a/src/ChangShaTour/route.cpp b/src/ChangShaTour/route.cpp index 652de85..e5bca0b 100644 --- a/src/ChangShaTour/route.cpp +++ b/src/ChangShaTour/route.cpp @@ -1,8 +1,9 @@ -#include "route.h" +#include "route.h" +#include Route::Route() { - routeItems=(RouteItem*)malloc(sizeof (RouteItem)); + routeItems=new RouteItem; routeItems->next=NULL; } //route结构体使用方式和query类似 @@ -31,6 +32,7 @@ int Route::getUserId() void Route::setRouteName(QString name) { this->routeName = name; + return; } void Route::setUserId(int id) { @@ -40,7 +42,7 @@ void Route::setRouteId(int id) { this->routeId=id; } -void Route::setAllItems(QStringList titleList,QStringList urlList,QStringList cateIdList,QStringList startTimeList,QStringList endTimeList,QStringList trafficList,int * distanceList,int * timeCostList,QStringList descriptionList) +void Route::setAllItems(QStringList titleList,QStringList urlList,QStringList cateIdList,QDateTime * startTimeList,QDateTime * endTimeList,QStringList trafficList,double * distanceList,double * timeCostList,QStringList descriptionList) { RouteItem * head= routeItems; RouteItem * p; @@ -48,7 +50,7 @@ void Route::setAllItems(QStringList titleList,QStringList urlList,QStringList ca int i; for(i=0;iplaceName = titleList[i]; p->url = urlList[i]; p->cateId = cateIdList[i]; diff --git a/src/ChangShaTour/route.h b/src/ChangShaTour/route.h index a790053..4b9c2bb 100644 --- a/src/ChangShaTour/route.h +++ b/src/ChangShaTour/route.h @@ -1,6 +1,6 @@ -#ifndef ROUTE_H +#ifndef ROUTE_H #define ROUTE_H -#include +#include "RouteItem.h" #include class Route @@ -9,7 +9,7 @@ public: Route(); struct routeItem * getAllItems(); //距离和时间都用int表示,单位m/km,时间s/min,统一一下 - void setAllItems(QStringList titleList,QStringList urlList,QStringList cateIdList,QStringList startTimeList,QStringList endTimeList,QStringList trafficList,int *distanceList,int *timeCostList,QStringList descriptionList); + void setAllItems(QStringList titleList,QStringList urlList,QStringList cateIdList,QDateTime * startTimeList,QDateTime * endTimeList,QStringList trafficList,double *distanceList,double *timeCostList,QStringList descriptionList); int getRouteId(); int getUserId(); QString getRouteName(); @@ -19,7 +19,7 @@ public: RouteItem * addItem(RouteItem * oneItem,int locate); RouteItem * deleteItem(int locate); private: - QString name; + QString routeName; int userId=0;//路线没有用户时默认为0 int routeId=0;//路线编号默认为0 struct routeItem *routeItems; diff --git a/src/ChangShaTour/searchwidget.cpp b/src/ChangShaTour/searchwidget.cpp index a59c33f..78ef250 100644 --- a/src/ChangShaTour/searchwidget.cpp +++ b/src/ChangShaTour/searchwidget.cpp @@ -126,6 +126,7 @@ void SearchWidget::queryDatabase(QSqlQuery query) QString cateid = cateId.value(); idList[i] = id.value(); + nameList.append(name); urlList.append(detail.value()); imgList.append(frontimg.value()); textList.append(text); @@ -163,7 +164,7 @@ void SearchWidget::setBtns() qDebug() << "info:" << cateList[currentCate] << idList[index] << urlList[index] << imgList[index]; // btnList[index]->setVisible(true); disconnect(btnList[index], 0, 0, 0); - connect(btnList[index], &QToolButton::clicked, this, [=](){web->loadPage(urlList[index], cateIdList[index]); subWidget->setVisible(false); web->setVisible(true); nullWidget->setVisible(false);}); + connect(btnList[index], &QToolButton::clicked, this, [=](){web->loadPage(nameList[index], imgList[index], urlList[index], cateIdList[index]); subWidget->setVisible(false); web->setVisible(true); nullWidget->setVisible(false);}); } for (i; i < showLimit; i++) { @@ -181,6 +182,7 @@ void SearchWidget::querySet() rollTop(); //重置存储查询信息的列表 + nameList.clear(); urlList.clear(); imgList.clear(); textList.clear(); diff --git a/src/ChangShaTour/searchwidget.h b/src/ChangShaTour/searchwidget.h index 3e2a52a..b19b945 100644 --- a/src/ChangShaTour/searchwidget.h +++ b/src/ChangShaTour/searchwidget.h @@ -50,6 +50,7 @@ private: QString segment; + QStringList nameList; QStringList urlList; QStringList imgList; QStringList textList; diff --git a/src/ChangShaTour/sortwidget.cpp b/src/ChangShaTour/sortwidget.cpp index d3c33e8..2bc4bbc 100644 --- a/src/ChangShaTour/sortwidget.cpp +++ b/src/ChangShaTour/sortwidget.cpp @@ -80,6 +80,7 @@ QToolButton * SortWidget::setBtn(QToolButton *btn, const QString text) void SortWidget::queryDatabase(QSqlQuery query, QString statement) { query.exec(statement); + nameList.clear(); idList.clear(); urlList.clear(); imgList.clear(); @@ -109,6 +110,7 @@ void SortWidget::queryDatabase(QSqlQuery query, QString statement) QString price = QString::number(avgprice.value()); QString text = name + " " + score + "分 " + commentNum + "条评论 " + addr + " " + "人均" + price + "元"; idList.append(id.value()); + nameList.append(name); urlList.append(detail.value()); imgList.append(frontimg.value()); cateIdList.append(cateId.value()); @@ -122,7 +124,7 @@ void SortWidget::setBtns() { int index = i; btnList[index] = setBtn(btnList[index], textList[index]); - connect(btnList[index], &QToolButton::clicked, this, [=](){web->loadPage((const QString)urlList[index],cateIdList[index]); scroll->setVisible(false); funcWidget->setVisible(false); pageWidget->setVisible(false); InvisibleAllSubScreenBtns(); web->setVisible(true);}); + connect(btnList[index], &QToolButton::clicked, this, [=](){web->loadPage(nameList[index], imgList[index], urlList[index],cateIdList[index]); scroll->setVisible(false); funcWidget->setVisible(false); pageWidget->setVisible(false); InvisibleAllSubScreenBtns(); web->setVisible(true);}); } } diff --git a/src/ChangShaTour/sortwidget.h b/src/ChangShaTour/sortwidget.h index 8638f41..93d3864 100644 --- a/src/ChangShaTour/sortwidget.h +++ b/src/ChangShaTour/sortwidget.h @@ -50,6 +50,7 @@ private: WebWidget *web; QSqlDatabase db; + QStringList nameList; QStringList urlList; QStringList imgList; QStringList textList; diff --git a/src/ChangShaTour/webwidget.cpp b/src/ChangShaTour/webwidget.cpp index a21ed15..f939aaa 100644 --- a/src/ChangShaTour/webwidget.cpp +++ b/src/ChangShaTour/webwidget.cpp @@ -12,6 +12,7 @@ WebWidget::WebWidget(QWidget *parent) : horLayout = new QHBoxLayout(); view = new QWebEngineView(); + QNetworkProxyFactory::setUseSystemConfiguration(false); add = new QPushButton("添加到收藏夹"); rtn = new QPushButton("返回"); @@ -37,17 +38,17 @@ QPushButton *WebWidget::getAddBtn() { return add; } -void WebWidget::addToHis(QString url,QString cateId) +void WebWidget::addToHis(QString name, QString img, QString url,QString cateId) { QSqlQuery query(userDb); - query.prepare("select historyId from history where url=? and userId=?"); + query.prepare("select historyId from history where detail=? and userId=?"); query.addBindValue(url); query.addBindValue(Id); query.exec(); query.next(); if(query.isValid()) { - query.prepare("update history set createdtime = now() where url=? and userId=?"); + query.prepare("update history set createdTime = now() where detail=? and userId=?"); query.addBindValue(url); query.addBindValue(Id); query.exec(); @@ -60,12 +61,14 @@ void WebWidget::addToHis(QString url,QString cateId) int count=query.value(0).toInt(); if(count>=hisLimit) { - query.prepare("select historyId from history where userId = ? order by createdtime"); + query.prepare("select historyId from history where userId = ? order by createdTime"); query.addBindValue(Id); query.exec(); query.next(); int historyId=query.value("historyId").toInt(); - query.prepare("update history set url = ?, cateId = ?, createdtime = now() where historyId=?"); + query.prepare("update history set title = ?, frontimg = ?, detail = ?, cateId = ?, createdTime = now() where historyId=?"); + query.addBindValue(name); + query.addBindValue(img); query.addBindValue(url); query.addBindValue(cateId); query.addBindValue(historyId); @@ -74,18 +77,20 @@ void WebWidget::addToHis(QString url,QString cateId) else { - query.prepare("insert into history (userId,url,cateId)values(?,?,?)"); + query.prepare("insert into history (userId, title, frontimg, detail, cateId)values(?, ?, ?, ?, ?)"); query.addBindValue(Id); + query.addBindValue(name); + query.addBindValue(img); query.addBindValue(url); query.addBindValue(cateId); query.exec(); } } -void WebWidget::addToHot(QString url, QString cateId) +void WebWidget::addToHot(QString name, QString img, QString url, QString cateId) { QSqlQuery query(listDb); - query.prepare("select clickCount from hotlist where url=?"); + query.prepare("select clickCount from hotlist where detail=?"); query.addBindValue(url); query.exec(); query.next(); @@ -94,14 +99,16 @@ void WebWidget::addToHot(QString url, QString cateId) { clickCount=query.value(0).toInt(); clickCount+=1; - query.prepare("update hotlist set clickCount = ? where url=?"); + query.prepare("update hotlist set clickCount = ? where detail=?"); query.addBindValue(clickCount); query.addBindValue(url); query.exec(); return ; } clickCount=1; - query.prepare("insert into hotlist (url,cateId,clickCount)values(?,?,?)"); + query.prepare("insert into hotlist (title, frontimg, detail, cateId, clickCount)values(?, ?, ?, ?, ?)"); + query.addBindValue(name); + query.addBindValue(img); query.addBindValue(url); query.addBindValue(cateId); query.addBindValue(clickCount); @@ -128,22 +135,24 @@ void WebWidget::addToRecommend(QString cateId) query.exec(); } -void WebWidget::addToFavPlaces() +void WebWidget::addToFavPlaces(QString name, QString img, QString url,QString cateId) { QSqlQuery query(userDb); - query.prepare("select * from favPlaces where userId = ? and url = ?"); + query.prepare("select * from favPlaces where userId = ? and detail = ?"); query.addBindValue(Id); - query.addBindValue(this->url); + query.addBindValue(url); query.exec(); if(query.next()) { QMessageBox::warning(this,"警告","该场所已在收藏夹中,请不要重复添加!", QMessageBox::Yes); return; } - query.prepare("insert into favPlaces (userId, url, cateId)values(?, ?, ?)"); + query.prepare("insert into favPlaces (userId, title, frontimg, detail, cateId)values(?, ?, ?, ?, ?)"); query.addBindValue(Id); - query.addBindValue(this->url); - query.addBindValue(this->cateId); + query.addBindValue(name); + query.addBindValue(img); + query.addBindValue(url); + query.addBindValue(cateId); query.exec(); QMessageBox::information(this,"提示","添加成功!"); return; @@ -154,16 +163,13 @@ QPushButton *WebWidget::getReturnBtn() return rtn; } -void WebWidget::loadPage(QString url,QString cateId) +void WebWidget::loadPage(QString name, QString img, QString url,QString cateId) { - this->url = url; - this->cateId = cateId; - - addToHis(url,cateId); - addToHot(url,cateId); + addToHis(name, img, url,cateId); + addToHot(name, img, url,cateId); addToRecommend(cateId); - connect(add, &QPushButton::clicked, this, &WebWidget::addToFavPlaces); + connect(add, &QPushButton::clicked, this, [=](){this->addToFavPlaces(name, img, url, cateId);}); - view->load(QUrl(url)); + view->page()->load(QUrl(url)); } diff --git a/src/ChangShaTour/webwidget.h b/src/ChangShaTour/webwidget.h index 8b035db..7039652 100644 --- a/src/ChangShaTour/webwidget.h +++ b/src/ChangShaTour/webwidget.h @@ -10,6 +10,7 @@ #include #include #include +#include #if _MSC_VER >= 1600 #pragma execution_character_set("utf-8") @@ -28,11 +29,11 @@ public: ~WebWidget(); QPushButton *getReturnBtn(); QPushButton *getAddBtn(); - void loadPage(QString url,QString cateId); - void addToHis(QString url,QString cateId); - void addToHot(QString url,QString cateId); + void loadPage(QString name, QString img, QString url,QString cateId); + void addToHis(QString name, QString img, QString url,QString cateId); + void addToHot(QString name, QString img, QString url,QString cateId); void addToRecommend(QString cateId); - void addToFavPlaces(); + void addToFavPlaces(QString name, QString img, QString url,QString cateId); private: Ui::WebWidget *ui; @@ -46,9 +47,6 @@ private: QWebEngineView *view; - QString url; - QString cateId; - }; #endif // WEBWIDGET_H