From ba245a661823b0f546cfa91bbf7f67456c45667e Mon Sep 17 00:00:00 2001 From: dorian Date: Fri, 22 Jun 2018 09:36:20 +0200 Subject: [PATCH] progress --- fannyapp.pro.user | 363 +++++++++++++++++++++++++++++++++++--- fannyapp.pro.user.736334c | 336 +++++++++++++++++++++++++++++++++++ headers/serverconn.h | 5 +- qml/HomeForm.qml | 21 +++ source/serverconn.cpp | 18 ++ 5 files changed, 720 insertions(+), 23 deletions(-) create mode 100644 fannyapp.pro.user.736334c diff --git a/fannyapp.pro.user b/fannyapp.pro.user index 6dbd4e2..7d36b7c 100644 --- a/fannyapp.pro.user +++ b/fannyapp.pro.user @@ -1,14 +1,14 @@ - + EnvironmentId - {736334c7-59b9-42fb-bb64-0bbe827a8b2c} + {21eb7c7e-fe37-4955-bdba-642d7341ba98} ProjectExplorer.Project.ActiveTarget - 0 + 1 ProjectExplorer.Project.EditorSettings @@ -59,14 +59,333 @@ ProjectExplorer.Project.Target.0 - Desktop Qt 5.10.1 clang 64bit - Desktop Qt 5.10.1 clang 64bit - qt.qt5.5101.clang_64_kit - 2 + Android for armeabi-v7a (GCC 4.9, Qt 5.10.1 for Android armv7) + Android for armeabi-v7a (GCC 4.9, Qt 5.10.1 for Android armv7) + {c2d2fa4a-1656-4ab9-a542-92c96158a688} + 1 0 0 - /Users/dorian/Documents/git/build-fannyapp-Desktop_Qt_5_10_1_clang_64bit-Debug + /home/dorian/Documents/Fanny App/build-fannyapp-Android_for_armeabi_v7a_GCC_4_9_Qt_5_10_1_for_Android_armv7-Debug + + + true + qmake + + QtProjectManager.QMakeBuildStep + true + + false + false + false + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + false + + + + + true + Copy application data + + Qt4ProjectManager.AndroidPackageInstallationStep + + + android-27 + + true + Build Android APK + + QmakeProjectManager.AndroidBuildApkStep + false + false + + 4 + Build + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + true + clean + + + 1 + Clean + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Debug + Debug + Qt4ProjectManager.Qt4BuildConfiguration + 2 + true + + + /home/dorian/Documents/builds/Qt/fanny-app/build-fannyapp-Android_for_armeabi_v7a_GCC_4_9_Qt_5_10_1_for_Android_armv7-Release + + + true + qmake + + QtProjectManager.QMakeBuildStep + false + + false + false + false + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + false + + + + + true + Copy application data + + Qt4ProjectManager.AndroidPackageInstallationStep + + + android-27 + /home/dorian/Documents/gitlab/fanny-app/android_release.keystore + true + Build Android APK + + QmakeProjectManager.AndroidBuildApkStep + false + false + + 4 + Build + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + true + clean + + + 1 + Clean + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Release + Release + Qt4ProjectManager.Qt4BuildConfiguration + 0 + true + + + /home/dorian/Documents/Fanny App/build-fannyapp-Android_for_armeabi_v7a_GCC_4_9_Qt_5_10_1_for_Android_armv7-Profile + + + true + qmake + + QtProjectManager.QMakeBuildStep + true + + false + true + false + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + false + + + + + true + Copy application data + + Qt4ProjectManager.AndroidPackageInstallationStep + + + android-27 + + true + Build Android APK + + QmakeProjectManager.AndroidBuildApkStep + false + false + + 4 + Build + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + true + clean + + + 1 + Clean + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Profile + Profile + Qt4ProjectManager.Qt4BuildConfiguration + 0 + true + + 3 + + + + true + Deploy to Android device + + Qt4ProjectManager.AndroidDeployQtStep + false + + 1 + Deploy + + ProjectExplorer.BuildSteps.Deploy + + 1 + Deploy to Android device + + Qt4ProjectManager.AndroidDeployConfiguration2 + + 1 + + MWS0216A15001488 + 24 + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + + + + fannyapp + fannyapp + Qt4ProjectManager.AndroidRunConfiguration:/home/dorian/Documents/gitlab/fanny-app/fannyapp.pro + fannyapp.pro + 3768 + false + true + false + false + true + + 1 + + + + ProjectExplorer.Project.Target.1 + + Desktop Qt 5.10.1 GCC 64bit + Desktop Qt 5.10.1 GCC 64bit + qt.qt5.5101.gcc_64_kit + 0 + 0 + 0 + + /home/dorian/Documents/builds/Qt/fanny-app true @@ -93,7 +412,7 @@ 2 - Erstellen + Build ProjectExplorer.BuildSteps.Build @@ -112,7 +431,7 @@ 1 - Bereinigen + Clean ProjectExplorer.BuildSteps.Clean @@ -126,7 +445,7 @@ true - /Users/dorian/Documents/git/build-fannyapp-Desktop_Qt_5_10_1_clang_64bit-Release + /home/dorian/Documents/Fanny App/build-fannyapp-Desktop_Qt_5_10_1_GCC_64bit-Release true @@ -153,7 +472,7 @@ 2 - Erstellen + Build ProjectExplorer.BuildSteps.Build @@ -172,7 +491,7 @@ 1 - Bereinigen + Clean ProjectExplorer.BuildSteps.Clean @@ -186,7 +505,7 @@ true - /Users/dorian/Documents/git/build-fannyapp-Desktop_Qt_5_10_1_clang_64bit-Profile + /home/dorian/Documents/Fanny App/build-fannyapp-Desktop_Qt_5_10_1_GCC_64bit-Profile true @@ -213,7 +532,7 @@ 2 - Erstellen + Build ProjectExplorer.BuildSteps.Build @@ -232,7 +551,7 @@ 1 - Bereinigen + Clean ProjectExplorer.BuildSteps.Clean @@ -249,12 +568,12 @@ 0 - Deployment + Deploy ProjectExplorer.BuildSteps.Deploy 1 - Deployment-Konfiguration + Deploy Configuration ProjectExplorer.DefaultDeployConfiguration @@ -303,14 +622,14 @@ 2 fannyapp - - Qt4ProjectManager.Qt4RunConfiguration:/Users/dorian/Documents/git/fanny-app/fannyapp.pro + fannyapp2 + Qt4ProjectManager.Qt4RunConfiguration:/home/dorian/Documents/gitlab/fanny-app/fannyapp.pro true fannyapp.pro false - /Users/dorian/Documents/git/build-fannyapp-Desktop_Qt_5_10_1_clang_64bit-Profile/fannyapp.app/Contents/MacOS + /home/dorian/Documents/builds/Qt/fanny-app 3768 false true @@ -323,7 +642,7 @@ ProjectExplorer.Project.TargetCount - 1 + 2 ProjectExplorer.Project.Updater.FileVersion diff --git a/fannyapp.pro.user.736334c b/fannyapp.pro.user.736334c new file mode 100644 index 0000000..6dbd4e2 --- /dev/null +++ b/fannyapp.pro.user.736334c @@ -0,0 +1,336 @@ + + + + + + EnvironmentId + {736334c7-59b9-42fb-bb64-0bbe827a8b2c} + + + 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 + + + + ProjectExplorer.Project.Target.0 + + Desktop Qt 5.10.1 clang 64bit + Desktop Qt 5.10.1 clang 64bit + qt.qt5.5101.clang_64_kit + 2 + 0 + 0 + + /Users/dorian/Documents/git/build-fannyapp-Desktop_Qt_5_10_1_clang_64bit-Debug + + + true + qmake + + QtProjectManager.QMakeBuildStep + true + + false + false + false + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + false + + + + 2 + Erstellen + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + true + clean + + + 1 + Bereinigen + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Debug + Debug + Qt4ProjectManager.Qt4BuildConfiguration + 2 + true + + + /Users/dorian/Documents/git/build-fannyapp-Desktop_Qt_5_10_1_clang_64bit-Release + + + true + qmake + + QtProjectManager.QMakeBuildStep + false + + false + false + false + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + false + + + + 2 + Erstellen + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + true + clean + + + 1 + Bereinigen + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Release + Release + Qt4ProjectManager.Qt4BuildConfiguration + 0 + true + + + /Users/dorian/Documents/git/build-fannyapp-Desktop_Qt_5_10_1_clang_64bit-Profile + + + true + qmake + + QtProjectManager.QMakeBuildStep + true + + false + true + false + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + false + + + + 2 + Erstellen + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + true + clean + + + 1 + Bereinigen + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Profile + Profile + Qt4ProjectManager.Qt4BuildConfiguration + 0 + true + + 3 + + + 0 + Deployment + + ProjectExplorer.BuildSteps.Deploy + + 1 + Deployment-Konfiguration + + ProjectExplorer.DefaultDeployConfiguration + + 1 + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + fannyapp + + Qt4ProjectManager.Qt4RunConfiguration:/Users/dorian/Documents/git/fanny-app/fannyapp.pro + true + + fannyapp.pro + false + + /Users/dorian/Documents/git/build-fannyapp-Desktop_Qt_5_10_1_clang_64bit-Profile/fannyapp.app/Contents/MacOS + 3768 + false + true + false + false + true + + 1 + + + + ProjectExplorer.Project.TargetCount + 1 + + + ProjectExplorer.Project.Updater.FileVersion + 18 + + + Version + 18 + + diff --git a/headers/serverconn.h b/headers/serverconn.h index 36175de..cb0579e 100644 --- a/headers/serverconn.h +++ b/headers/serverconn.h @@ -26,19 +26,22 @@ public: QString password; QNetworkAccessManager *networkManager; QNetworkAccessManager *refreshNetworkManager; + float progress; public: explicit ServerConn(QObject *parent = nullptr); ~ServerConn(); - Q_INVOKABLE QString login(QString username, QString password, bool permanent); Q_INVOKABLE int logout(); Q_INVOKABLE QString getDay(QString day); Q_INVOKABLE int checkConn(); + Q_INVOKABLE float getProgress(); ReturnData_t senddata(QUrl serviceUrl, QUrlQuery postData); signals: public slots: + void updateProgress(qint64 read, qint64 total); + }; #endif // SERVERCONN_H diff --git a/qml/HomeForm.qml b/qml/HomeForm.qml index 7c00234..d56d3e6 100644 --- a/qml/HomeForm.qml +++ b/qml/HomeForm.qml @@ -121,6 +121,27 @@ Page { id: busyIndicator visible: true anchors.centerIn: parent + Label { + id: progress + anchors.fill: parent + anchors.centerIn: parent + text: _cppServerConn.getProgress() + } + Timer { + id: refreshTimer + interval: 1; + running: busyDialog.visible + repeat: true + onTriggered: { + var ret = _cppServerConn.getProgress() + console.log(ret) + progress.text = ret + "%" + } + } + } + ProgressBar { + anchors.bottom: parent.bottom + anchors.left: parent.left } } diff --git a/source/serverconn.cpp b/source/serverconn.cpp index 5a02bd6..0f348b7 100644 --- a/source/serverconn.cpp +++ b/source/serverconn.cpp @@ -98,6 +98,9 @@ QString ServerConn::getDay(QString day) QNetworkReply*reply = this->networkManager->post(request, pdata.toString(QUrl::FullyEncoded).toUtf8()); //QNetworkReply*reply = networkManager->get( request ); + connect(reply, SIGNAL(downloadProgress(qint64, qint64)), + this, SLOT(updateProgress(qint64, qint64))); + QEventLoop loop; loop.connect(this->networkManager, SIGNAL(finished(QNetworkReply*)), SLOT(quit())); loop.exec(); @@ -161,6 +164,21 @@ int ServerConn::checkConn() } +void ServerConn::updateProgress(qint64 read, qint64 total) +{ + int read_int = read; + int total_int = total; + float percent = ((float)read_int / (float)total_int) * 100; + + percent = (int)percent; + this->progress = percent; +// qDebug() << read << total << percent << "%"; +} + +float ServerConn::getProgress() +{ + return(this->progress); +} ReturnData_t ServerConn::senddata(QUrl serviceUrl, QUrlQuery pdata) {